Natools

Diff
Login

Differences From Artifact [b53cc2dad2]:

To Artifact [5651639d9d]:


42
43
44
45
46
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
73
74
75
76
77


78
79
80
81
82
83
84
42
43
44
45
46
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86

87
88
89
90
91
92
93
94
95







+
+
+
















+
+
+
+
+
+
+












-
+
+








   procedure Insert
     (Self : in out Map_Description;
      Key : in String;
      Element_Name : in String);
      --  Add the pair Key and element designated by Name.

   procedure Set_Definite (Self : in out Map_Description);
      --  Use an array to store definite elements (default)

   procedure Set_Element_Type
     (Self : in out Map_Description;
      Name : in String);
      --  String used to desginate the returning type of the element function.
      --  This must be set.

   procedure Set_Function_Name
     (Self : in out Map_Description;
      Name : in String);
      --  Element function name, defaulting to "Element"

   procedure Set_Hash_Package_Name
     (Self : in out Map_Description;
      Name : in String);
      --  Set the package name where the perfect hash function will be write.
      --  Defaults to "<map package>.<element type>_Hash".

   procedure Set_Indefinite
     (Self : in out Map_Description;
      Indefinite : in Boolean := True);
      --  Set whether element type is indefinite (and returned by a function
      --  containing a case statement) or definite (and stored in a global
      --  array).

   procedure Set_Not_Found
     (Self : in out Map_Description;
      Name : in String);
      --  If non-empty, when element function is called with an unknown key,
      --  return the elemnet named Name instead of raising Constraint_Error.

   function Map
     (Element_Type : String;
      Nodes : Node_Array;
      Hash_Package_Name : String := "";
      Function_Name : String := "Element";
      Not_Found : String := "")
      Not_Found : String := "";
      Indefinite : Boolean := False)
     return Map_Description;
      --  Create a map in a single call


   type Map_Package is private;

   procedure Open
149
150
151
152
153
154
155

156
157
158
159
160
161
162
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174







+








   type Map_Description is record
      Element_Type : String_Holder;
      Hash_Package_Name : String_Holder;
      Function_Name : String_Holder;
      Not_Found : String_Holder;
      Nodes : Node_Lists.List;
      Indefinite : Boolean := False;
   end record;


   package Map_Lists is new Ada.Containers.Doubly_Linked_Lists
     (Map_Description);

   type Map_Package is record