Index: src/natools-smaz-tools.adb ================================================================== --- src/natools-smaz-tools.adb +++ src/natools-smaz-tools.adb @@ -128,10 +128,26 @@ ---------------------- -- Public Interface -- ---------------------- + + function Append_String + (Dict : in Dictionary; + Value : in String) + return Dictionary is + begin + return Dictionary' + (Dict_Last => Dict.Dict_Last + 1, + String_Size => Dict.String_Size + Value'Length, + Variable_Length_Verbatim => Dict.Variable_Length_Verbatim, + Max_Word_Length => Positive'Max (Dict.Max_Word_Length, Value'Length), + Offsets => Dict.Offsets & (1 => Dict.String_Size + 1), + Values => Dict.Values & Value, + Hash => Dummy_Hash'Access); + end Append_String; + procedure Print_Dictionary_In_Ada (Dict : in Dictionary; Hash_Image : in String := "TODO"; Max_Width : in Positive := 70; Index: src/natools-smaz-tools.ads ================================================================== --- src/natools-smaz-tools.ads +++ src/natools-smaz-tools.ads @@ -79,10 +79,25 @@ or else (for all I in Index .. Dict.Dict_Last - 1 => Dict_Entry (Dict, I + 1) = Dict_Entry (Remove_Element'Result, I))); -- Return a new dictionary equal to Dict without element for Index + function Append_String + (Dict : in Dictionary; + Value : in String) + return Dictionary + with Pre => Dict.Dict_Last < Ada.Streams.Stream_Element'Last + and then Value'Length > 0, + Post => Dict.Dict_Last = Append_String'Result.Dict_Last - 1 + and then (for all I in 0 .. Dict.Dict_Last + => Dict_Entry (Dict, I) + = Dict_Entry (Append_String'Result, I)) + and then Dict_Entry (Append_String'Result, + Append_String'Result.Dict_Last) + = Value; + -- Return a new dictionary with Value appended + List_For_Linear_Search : String_Lists.List; function Linear_Search (Value : String) return Natural; -- Function and data source for inefficient but dynamic function -- that can be used with Dictionary.Hash.