Natools

Check-in [00a41d7915]
Login
Overview
Comment:smaz_generic-tools: add conversion from dictionary to word list
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 00a41d7915e9f877b3893ed371cfc0be9c3de39c
User & Date: nat on 2016-11-27 22:32:07
Other Links: manifest | tags
Context
2016-11-28
22:31
smaz_tools-gnat: duplication of GNAT tools for generic-based tree check-in: 29b53deb6d user: nat tags: trunk
2016-11-27
22:32
smaz_generic-tools: add conversion from dictionary to word list check-in: 00a41d7915 user: nat tags: trunk
2016-11-26
22:48
smaz_generic-tools: add dictionary evalution subprograms check-in: d7fe38e744 user: nat tags: trunk
Changes

Modified src/natools-smaz_generic-tools.adb from [50f7d5ba31] to [7f4318cc92].

371
372
373
374
375
376
377










378
379
380
381
382
383
384
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394







+
+
+
+
+
+
+
+
+
+







            Variable_Length_Verbatim => Variable_Length_Verbatim,
            Max_Word_Length => Max_Word_Length,
            Offsets => Offsets,
            Values => Values,
            Hash => Smaz_Tools.Dummy_Hash'Access);
      end;
   end To_Dictionary;

   function To_String_List (Dict : in Dictionary) return String_Lists.List is
      Result : String_Lists.List;
   begin
      for Code in Dictionary_Code'First .. Dict.Last_Code loop
         String_Lists.Append (Result, Dict_Entry (Dict, Code));
      end loop;

      return Result;
   end To_String_List;



   ---------------------------
   -- Dictionary Evaluation --
   ---------------------------

Modified src/natools-smaz_generic-tools.ads from [22086ada23] to [c594588811].

36
37
38
39
40
41
42



43
44
45
46
47
48
49
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52







+
+
+







      Variable_Length_Verbatim : in Boolean)
     return Dictionary
     with Pre => String_Lists.Length (List) in 1 ..
                 Ada.Containers.Count_Type (Ada.Streams.Stream_Element'Last);
      --  Build a Dictionary object from a string list
      --  Note that Hash is set to a placeholder which unconditionnally
      --  raises Program_Error when called.

   function To_String_List (Dict : in Dictionary) return String_Lists.List;
      --  Convert a dictionary back to the corresponding list of words

   generic
      with procedure Put_Line (Line : String);
   procedure Print_Dictionary_In_Ada
     (Dict : in Dictionary;
      Hash_Image : in String := "TODO";
      Max_Width : in Positive := 70;