Natools

Diff
Login

Differences From Artifact [2d303fae46]:

To Artifact [8a60f68029]:


134
135
136
137
138
139
140
141



142
143
144
145
146
147
148
149


150
151























152
153
154
155
156
157
158
134
135
136
137
138
139
140

141
142
143
144
145
146
147
148
149
150
151
152
153


154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183







-
+
+
+








+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







      Ada.Text_IO.Put_Line (File, "      end if;");
      Ada.Text_IO.Put_Line
        (File, "   end " & To_String (Map.Function_Name) & ';');
   end Write_Map_Body;


   procedure Write_Map_Hash_Package (Map : in Map_Description) is
      Seed : constant Natural := 2;
      Seed : Natural := 2;
      NK : constant Float := Float (Map.Nodes.Length);
      NV : Natural := Natural (Map.Nodes.Length) * 2 + 1;
      Cursor : Node_Lists.Cursor := Map.Nodes.First;
   begin
      while Node_Lists.Has_Element (Cursor) loop
         GNAT.Perfect_Hash_Generators.Insert
           (To_String (Node_Lists.Element (Cursor).Key));
         Node_Lists.Next (Cursor);
      end loop;

      loop
         begin
      GNAT.Perfect_Hash_Generators.Initialize (Seed);
      GNAT.Perfect_Hash_Generators.Compute;
            GNAT.Perfect_Hash_Generators.Initialize (Seed, Float (NV) / NK);
            GNAT.Perfect_Hash_Generators.Compute;
            exit;
         exception
            when GNAT.Perfect_Hash_Generators.Too_Many_Tries =>
               null;
         end;

         Seed := Seed * NV;

         begin
            GNAT.Perfect_Hash_Generators.Initialize (Seed, Float (NV) / NK);
            GNAT.Perfect_Hash_Generators.Compute;
            exit;
         exception
            when GNAT.Perfect_Hash_Generators.Too_Many_Tries =>
               null;
         end;

         NV := NV + 1;
         Seed := NV;
      end loop;

      GNAT.Perfect_Hash_Generators.Produce (To_String (Map.Hash_Package_Name));
      GNAT.Perfect_Hash_Generators.Finalize;
   exception
      when others =>
         GNAT.Perfect_Hash_Generators.Finalize;
         raise;
   end Write_Map_Hash_Package;