Index: tools/smaz.adb ================================================================== --- tools/smaz.adb +++ tools/smaz.adb @@ -49,10 +49,16 @@ (Nothing, Decode, Encode, Evaluate); end Actions; + + package Algorithms is + type Enum is + (Base_256, + Base_256_Retired); + end Algorithms; package Dict_Sources is type Enum is (S_Expression, Text_List, @@ -59,11 +65,12 @@ Unoptimized_Text_List); end Dict_Sources; package Options is type Id is - (Output_Ada_Dict, + (Base_256, + Output_Ada_Dict, Dictionary_Input, Decode, Encode, Evaluate, Filter_Threshold, @@ -73,10 +80,11 @@ Sx_Dict_Output, Min_Sub_Size, Max_Sub_Size, Dict_Size, Max_Pending, + Base_256_Retired, Stat_Output, No_Stat_Output, Text_List_Input, Fast_Text_Input, Max_Word_Size, @@ -88,10 +96,11 @@ end Options; package Getopt is new Natools.Getopt_Long (Options.Id); type Callback is new Getopt.Handlers.Callback with record + Algorithm : Algorithms.Enum := Algorithms.Base_256; Display_Help : Boolean := False; Need_Dictionary : Boolean := False; Stat_Output : Boolean := False; Sx_Output : Boolean := False; Sx_Dict_Output : Boolean := False; @@ -1029,19 +1038,26 @@ when Options.Vlen_Verbatim => Handler.Vlen_Verbatim := True; when Options.No_Vlen_Verbatim => Handler.Vlen_Verbatim := False; + + when Options.Base_256 => + Handler.Algorithm := Algorithms.Base_256; + + when Options.Base_256_Retired => + Handler.Algorithm := Algorithms.Base_256_Retired; end case; end Option; function Getopt_Config return Getopt.Configuration is use Getopt; use Options; R : Getopt.Configuration; begin + R.Add_Option ("base-256", '2', No_Argument, Base_256); R.Add_Option ("ada-dict", 'A', Optional_Argument, Output_Ada_Dict); R.Add_Option ("decode", 'd', No_Argument, Decode); R.Add_Option ("dict", 'D', No_Argument, Dictionary_Input); R.Add_Option ("encode", 'e', No_Argument, Encode); R.Add_Option ("evaluate", 'E', No_Argument, Evaluate); @@ -1052,10 +1068,11 @@ R.Add_Option ("sx-dict", 'L', No_Argument, Sx_Dict_Output); R.Add_Option ("min-substring", 'm', Required_Argument, Min_Sub_Size); R.Add_Option ("max-substring", 'M', Required_Argument, Max_Sub_Size); R.Add_Option ("dict-size", 'n', Required_Argument, Dict_Size); R.Add_Option ("max-pending", 'N', Required_Argument, Max_Pending); + R.Add_Option ("retired", 'R', No_Argument, Base_256_Retired); R.Add_Option ("stats", 's', No_Argument, Stat_Output); R.Add_Option ("no-stats", 'S', No_Argument, No_Stat_Output); 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); @@ -1234,10 +1251,20 @@ when Options.No_Vlen_Verbatim => New_Line (Output); Put_Line (Output, Indent & Indent & "Disable variable-length verbatim in built dictionary"); + + when Options.Base_256 => + New_Line (Output); + Put_Line (Output, Indent & Indent + & "Use base-256 implementation (default)"); + + when Options.Base_256_Retired => + New_Line (Output); + Put_Line (Output, Indent & Indent + & "Use retired base-256 implementation"); end case; end loop; end Print_Help; @@ -1304,8 +1331,14 @@ Parser.Next; Natools.Smaz_Tools.Read_List (Input_Data, Parser); end if; end Read_Input_List; - Dict_256.Process (Handler, Input_List, Input_Data, Handler.Score_Method); + case Handler.Algorithm is + when Algorithms.Base_256 => + Dict_256.Process + (Handler, Input_List, Input_Data, Handler.Score_Method); + when Algorithms.Base_256_Retired => + raise Program_Error with "Not implented yet"; + end case; end Smaz;