Natools

Check-in [418b41afc4]
Login
Overview
Comment:smaz-tools: add a function for Hash in dynamically created dictionaries
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 418b41afc4a311366959b71b48926b76fc5cc81c
User & Date: nat on 2016-09-22 21:26:06
Other Links: manifest | tags
Context
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
2016-09-21
21:14
smaz: further reduce the encoder output to fit within the worst case check-in: 23214105c3 user: nat tags: trunk
Changes

Modified src/natools-smaz-tools.adb from [3cac70d086] to [2480b82e45].

47
48
49
50
51
52
53












54
55
56
57
58
59
60
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72







+
+
+
+
+
+
+
+
+
+
+
+







   end Image;



   ----------------------
   -- Public Interface --
   ----------------------

   function Linear_Search (Value : String) return Natural is
      Result : Ada.Streams.Stream_Element := 0;
   begin
      for S of List_For_Linear_Search loop
         exit when S = Value;
         Result := Result + 1;
      end loop;

      return Natural (Result);
   end Linear_Search;


   procedure Print_Dictionary_In_Ada
     (Dict : in Dictionary;
      Hash_Image : in String := "TODO";
      Max_Width : in Positive := 70;
      First_Prefix : in String := "     := (";
      Prefix : in String := "         ";

Modified src/natools-smaz-tools.ads from [95f4b3e44b] to [27bd58b9c3].

57
58
59
60
61
62
63





64
57
58
59
60
61
62
63
64
65
66
67
68
69







+
+
+
+
+

      --  Output Ada code corresponding to the value of the dictionary.
      --  Note that Prefix is the actual base indentation, while Half_Indent
      --  is added beyond Prefix before values continued on another line.
      --  Frist_Prefix is used instead of Prefix on the first line.
      --  All the defaults value are what was used to generate the constant
      --  in Natools.Smaz.Original.

   List_For_Linear_Search : String_Lists.List;
   function Linear_Search (Value : String) return Natural;
      --  Function and data source for inefficient but dynamic function
      --  that can be used with Dictionary.Hash.

end Natools.Smaz.Tools;