Index: src/natools-smaz.adb ================================================================== --- src/natools-smaz.adb +++ src/natools-smaz.adb @@ -260,10 +260,22 @@ end loop Verbatim_Encode; end Verbatim_Block; end loop Main_Loop; end Compress; + + function Compress (Dict : in Dictionary; Input : in String) + return Ada.Streams.Stream_Element_Array + is + Result : Ada.Streams.Stream_Element_Array + (1 .. Compressed_Upper_Bound (Dict, Input) + 1); + Last : Ada.Streams.Stream_Element_Offset; + begin + Compress (Dict, Input, Result, Last); + return Result (Result'First .. Last); + end Compress; + function Decompressed_Length (Dict : in Dictionary; Input : in Ada.Streams.Stream_Element_Array) return Natural @@ -357,6 +369,19 @@ Input_Index := Input_Index + Verbatim_Length + 1; end if; end loop; end Decompress; + + function Decompress + (Dict : in Dictionary; Input : in Ada.Streams.Stream_Element_Array) + return String + is + Result : String (1 .. Decompressed_Length (Dict, Input)); + Last : Natural; + begin + Decompress (Dict, Input, Result, Last); + pragma Assert (Last = Result'Last); + return Result; + end Decompress; + end Natools.Smaz; Index: src/natools-smaz.ads ================================================================== --- src/natools-smaz.ads +++ src/natools-smaz.ads @@ -52,10 +52,13 @@ (Dict : in Dictionary; Input : in String; Output_Buffer : out Ada.Streams.Stream_Element_Array; Output_Last : out Ada.Streams.Stream_Element_Offset); + function Compress (Dict : in Dictionary; Input : in String) + return Ada.Streams.Stream_Element_Array; + function Decompressed_Length (Dict : in Dictionary; Input : in Ada.Streams.Stream_Element_Array) return Natural; @@ -63,7 +66,11 @@ procedure Decompress (Dict : in Dictionary; Input : in Ada.Streams.Stream_Element_Array; Output_Buffer : out String; Output_Last : out Natural); + + function Decompress + (Dict : in Dictionary; Input : in Ada.Streams.Stream_Element_Array) + return String; end Natools.Smaz;