Index: tools/smaz.adb ================================================================== --- tools/smaz.adb +++ tools/smaz.adb @@ -129,14 +129,10 @@ return Ada.Streams.Stream_Element is (Dict.Last_Code); -- Return the last valid entry procedure Print_Dictionary - (Filename : in String; - Dictionary : in Natools.Smaz_256.Dictionary; - Hash_Package_Name : in String := ""); - procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_256.Dictionary; Hash_Package_Name : in String := ""); -- print the given dictionary in the given file @@ -205,10 +201,16 @@ with procedure Filter_By_Count (Counter : in out Word_Counter; Threshold_Count : in String_Count); with function Last_Code (Dict : in Dictionary) return Dictionary_Entry; + + with procedure Print_Dictionary + (Output : in Ada.Text_IO.File_Type; + Dict : in Dictionary; + Hash_Package_Name : in String := "") + is <>; with function Remove_Element (Dict : in Dictionary; Element : in Dictionary_Entry) return Dictionary; @@ -282,10 +284,16 @@ Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts); -- Return the same results as Natools.Smaz.Tools.Evaluate_Dictionary, -- but hopefully more quickly, using Job_Count tasks. + procedure Print_Dictionary + (Filename : in String; + Dict : in Dictionary; + Hash_Package_Name : in String := ""); + -- print the given dictionary in the given file + function To_Dictionary (Handler : in Callback'Class; Input : in String_Lists.List; Method : in Methods) return Dictionary; @@ -505,10 +513,30 @@ Compressed_Size := 0; Counts := (others => 0); Parallel_Run (Cursor, Job_Count); end Parallel_Evaluate_Dictionary; + + procedure Print_Dictionary + (Filename : in String; + Dict : in Dictionary; + Hash_Package_Name : in String := "") is + begin + if Filename = "-" then + Print_Dictionary + (Ada.Text_IO.Current_Output, Dict, Hash_Package_Name); + elsif Filename'Length > 0 then + declare + File : Ada.Text_IO.File_Type; + begin + Ada.Text_IO.Create (File, Name => Filename); + Print_Dictionary (File, Dict, Hash_Package_Name); + Ada.Text_IO.Close (File); + end; + end if; + end Print_Dictionary; + function To_Dictionary (Handler : in Callback'Class; Input : in String_Lists.List; Method : in Methods) @@ -726,30 +754,10 @@ R.Add_Option ("vlen-verbatim", No_Argument, Vlen_Verbatim); return R; end Getopt_Config; - - procedure Print_Dictionary - (Filename : in String; - Dictionary : in Natools.Smaz_256.Dictionary; - Hash_Package_Name : in String := "") is - begin - if Filename = "-" then - Print_Dictionary - (Ada.Text_IO.Current_Output, Dictionary, Hash_Package_Name); - elsif Filename'Length > 0 then - declare - File : Ada.Text_IO.File_Type; - begin - Ada.Text_IO.Create (File, Name => Filename); - Print_Dictionary (File, Dictionary, Hash_Package_Name); - Ada.Text_IO.Close (File); - end; - end if; - end Print_Dictionary; - procedure Print_Dictionary (Output : in Ada.Text_IO.File_Type; Dictionary : in Natools.Smaz_256.Dictionary; Hash_Package_Name : in String := "") @@ -937,11 +945,11 @@ begin Natools.Smaz_Tools.Set_Dictionary_For_Trie_Search (Word_List); Dictionary.Hash := Natools.Smaz_Tools.Trie_Search'Access; if Ada_Dictionary'Length > 0 then - Print_Dictionary (Ada_Dictionary, Dictionary, Hash_Package); + Dict_256.Print_Dictionary (Ada_Dictionary, Dictionary, Hash_Package); end if; if Hash_Package'Length > 0 then Natools.Smaz_Tools.GNAT.Build_Perfect_Hash (Word_List, Hash_Package); end if;