Index: src/natools-smaz.adb ================================================================== --- src/natools-smaz.adb +++ src/natools-smaz.adb @@ -16,16 +16,10 @@ package body Natools.Smaz is use type Ada.Streams.Stream_Element_Offset; - function Dict_Entry - (Dict : in Dictionary; - Index : in Ada.Streams.Stream_Element) - return String - with Pre => Index <= Dict.Dict_Last; - -- Return the string for at the given Index in Dict procedure Find_Entry (Dict : in Dictionary; Template : in String; Index : out Ada.Streams.Stream_Element; @@ -44,26 +38,10 @@ ------------------------------ -- Local Helper Subprograms -- ------------------------------ - - function Dict_Entry - (Dict : in Dictionary; - Index : in Ada.Streams.Stream_Element) - return String - is - First : constant Positive := Dict.Offsets (Index); - Last : Natural := Dict.Values'Last; - begin - if Index + 1 in Dict.Offsets'Range then - Last := Dict.Offsets (Index + 1) - 1; - end if; - - return Dict.Values (First .. Last); - end Dict_Entry; - procedure Find_Entry (Dict : in Dictionary; Template : in String; Index : out Ada.Streams.Stream_Element; @@ -147,10 +125,26 @@ ---------------------- -- Public Interface -- ---------------------- + + function Dict_Entry + (Dict : in Dictionary; + Index : in Ada.Streams.Stream_Element) + return String + is + First : constant Positive := Dict.Offsets (Index); + Last : Natural := Dict.Values'Last; + begin + if Index + 1 in Dict.Offsets'Range then + Last := Dict.Offsets (Index + 1) - 1; + end if; + + return Dict.Values (First .. Last); + end Dict_Entry; + function Compressed_Upper_Bound (Dict : in Dictionary; Input : in String) return Ada.Streams.Stream_Element_Count is Index: src/natools-smaz.ads ================================================================== --- src/natools-smaz.ads +++ src/natools-smaz.ads @@ -70,10 +70,17 @@ then Dictionary.Values'Last + 1 else Dictionary.Offsets (I + 1)) - Dictionary.Offsets (I) in 1 .. Dictionary.Max_Word_Length)); + function Dict_Entry + (Dict : in Dictionary; + Index : in Ada.Streams.Stream_Element) + return String + with Pre => Index <= Dict.Dict_Last; + -- Return the string for at the given Index in Dict + function Compressed_Upper_Bound (Dict : in Dictionary; Input : in String) return Ada.Streams.Stream_Element_Count;