Index: tools/smaz.adb ================================================================== --- tools/smaz.adb +++ tools/smaz.adb @@ -101,10 +101,11 @@ Text_List_Input, Fast_Text_Input, Max_Word_Size, Sx_Output, No_Sx_Output, + Force_Word, No_Vlen_Verbatim, Score_Method, Vlen_Verbatim); end Options; @@ -130,10 +131,11 @@ Action : Actions.Enum := Actions.Nothing; Ada_Dictionary : Ada.Strings.Unbounded.Unbounded_String; Hash_Package : Ada.Strings.Unbounded.Unbounded_String; Dict_Source : Dict_Sources.Enum := Dict_Sources.S_Expression; Check_Roundtrip : Boolean := False; + Forced_Words : Natools.Smaz_Tools.String_Lists.List; end record; overriding procedure Option (Handler : in out Callback; Id : in Options.Id; @@ -1241,10 +1243,16 @@ when Options.Base_4096 => Handler.Algorithm := Algorithms.Base_4096; when Options.Check_Roundtrip => Handler.Check_Roundtrip := True; + + when Options.Force_Word => + if Argument'Length > 0 then + Handler.Need_Dictionary := True; + Handler.Forced_Words.Append (Argument); + end if; end case; end Option; function Activate_Dictionary (Dict : in Natools.Smaz_256.Dictionary) @@ -1374,10 +1382,11 @@ R.Add_Option ("text-list", 't', No_Argument, Text_List_Input); R.Add_Option ("fast-text-list", 'T', No_Argument, Fast_Text_Input); R.Add_Option ("max-word-len", 'W', Required_Argument, Max_Word_Size); R.Add_Option ("s-expr", 'x', No_Argument, Sx_Output); R.Add_Option ("no-s-expr", 'X', No_Argument, No_Sx_Output); + R.Add_Option ("force-word", Required_Argument, Force_Word); R.Add_Option ("no-vlen-verbatim", No_Argument, No_Vlen_Verbatim); R.Add_Option ("score-method", Required_Argument, Score_Method); R.Add_Option ("vlen-verbatim", No_Argument, Vlen_Verbatim); return R; @@ -1649,10 +1658,18 @@ when Options.Check_Roundtrip => New_Line (Output); Put_Line (Output, Indent & Indent & "Check roundtrip of compression or decompression"); + + when Options.Force_Word => + Put_Line (Output, " "); + Put_Line (Output, Indent & Indent + & "Force into the dictionary," + & " replacing the worst entry"); + Put_Line (Output, Indent & Indent + & "Can be specified multiple times to force many words."); end case; end loop; end Print_Help;