Overview
Comment: | tools/smaz: add compression of an input list of strings |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
eb0d5150754288735bfd50ff4b7c28f6 |
User & Date: | nat on 2016-09-23 20:30:38 |
Other Links: | manifest | tags |
Context
2016-09-24
| ||
21:53 | tools/smaz: add the output of statistics about compression check-in: 939809f44a user: nat tags: trunk | |
2016-09-23
| ||
20:30 | tools/smaz: add compression of an input list of strings check-in: eb0d515075 user: nat tags: trunk | |
2016-09-22
| ||
21:26 | smaz-tools: add a function for Hash in dynamically created dictionaries check-in: 418b41afc4 user: nat tags: trunk | |
Changes
Modified tools/smaz.adb from [bd2e8cf2c0] to [eaae217532].
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | + + + + + + + - - - + + + + + | with Ada.Command_Line; with Ada.Streams; with Ada.Strings.Unbounded; with Ada.Text_IO.Text_Streams; with Natools.Getopt_Long; with Natools.S_Expressions.Parsers; with Natools.S_Expressions.Printers; with Natools.Smaz.Tools; with Natools.Smaz.Tools.GNAT; procedure Smaz is package Actions is type Enum is (Nothing, Encode); end Actions; package Options is type Id is |
︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | + + + + | Id : in Options.Id; Argument : in String) is begin case Id is when Options.Help => Handler.Display_Help := True; when Options.Encode => Handler.Need_Dictionary := True; Handler.Action := Actions.Encode; when Options.Output_Ada_Dictionary => Handler.Need_Dictionary := True; if Argument'Length > 0 then Handler.Ada_Dictionary := Ada.Strings.Unbounded.To_Unbounded_String (Argument); else |
︙ | |||
104 105 106 107 108 109 110 111 112 113 114 115 116 117 | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | + | function Getopt_Config return Getopt.Configuration is use Getopt; use Options; R : Getopt.Configuration; begin R.Add_Option ("ada-dict", 'A', Optional_Argument, Output_Ada_Dictionary); R.Add_Option ("encode", 'e', No_Argument, Encode); R.Add_Option ("hash-pkg", 'H', Required_Argument, Output_Hash); R.Add_Option ("help", 'h', No_Argument, Help); return R; end Getopt_Config; |
︙ | |||
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | + + + + + - - + | case Id is when Options.Help => New_Line (Output); Put_Line (Output, Indent & Indent & "Display this help text"); when Options.Encode => New_Line (Output); Put_Line (Output, Indent & Indent & "Read a list of strings and encode them"); when Options.Output_Ada_Dictionary => Put_Line (Output, "=[filename]"); Put_Line (Output, Indent & Indent & "Output the current dictionary as Ada code in the given"); Put_Line (Output, Indent & Indent & "file, or standard output if filename is ""-"""); when Options.Output_Hash => Put_Line (Output, " <Hash Package Name>"); Put_Line (Output, Indent & Indent & "Build a package with a perfect hash function for the"); Put_Line (Output, Indent & Indent & "current dictionary."); end case; end loop; end Print_Help; |
︙ | |||
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | + + + + + + + - + + + + + + + + + + + + + + + + + | if not Handler.Need_Dictionary then return; end if; Read_Input_List : declare use type Actions.Enum; Input : constant access Ada.Streams.Root_Stream_Type'Class := Ada.Text_IO.Text_Streams.Stream (Ada.Text_IO.Current_Input); Parser : Natools.S_Expressions.Parsers.Stream_Parser (Input); begin Parser.Next; Natools.Smaz.Tools.Read_List (Input_List, Parser); if Handler.Action /= Actions.Nothing then Parser.Next; Natools.Smaz.Tools.Read_List (Input_Data, Parser); end if; end Read_Input_List; Build_Dictionary : declare |