Natools

Check-in [0ab4a630bf]
Login
Overview
Comment:static_hash_maps: add support for custom declarations at the beginning of the generated spec file
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0ab4a630bfcfa9a05ba3bdccf5fcb292b58e37c3
User & Date: nat on 2014-05-25 08:51:40
Other Links: manifest | tags
Context
2014-05-26
20:25
static_hash_maps-s_expressions: add binding for extra declarations in generated spec check-in: fcc23fc780 user: nat tags: trunk
2014-05-25
08:51
static_hash_maps: add support for custom declarations at the beginning of the generated spec file check-in: 0ab4a630bf user: nat tags: trunk
2014-05-24
13:03
static_hash_maps: retry perfect hash generation when it fails check-in: ddc10181a8 user: nat tags: trunk
Changes

Modified src/natools-static_hash_maps.adb from [8a60f68029] to [014e319f2a].

348
349
350
351
352
353
354









355
356
357
358
359
360
361
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370







+
+
+
+
+
+
+
+
+








      if Pkg.Priv then
         Ada.Text_IO.Put (Spec_File, "private ");
      end if;
      Ada.Text_IO.Put_Line
        (Spec_File, "package " & To_String (Pkg.Name) & " is");
      Ada.Text_IO.New_Line (Spec_File);

      declare
         Declarations : constant String := To_String (Pkg.Extra_Declarations);
      begin
         if Declarations'Length > 0 then
            Ada.Text_IO.Put_Line (Spec_File, Declarations);
            Ada.Text_IO.New_Line (Spec_File);
         end if;
      end;

      Current_Stage := Public_Spec;
      Map_Pos := 0;
      Pkg.Maps.Iterate (Query'Access);

      Ada.Text_IO.New_Line (Spec_File);
      Ada.Text_IO.Put_Line (Spec_File, "private");
499
500
501
502
503
504
505








506
507
508
509
510
511
512
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529







+
+
+
+
+
+
+
+







   procedure Set_Description
     (Self : in out Map_Package;
      Description : in String) is
   begin
      Self.Description := Hold (Description);
   end Set_Description;


   procedure Set_Extra_Declarations
     (Self : in out Map_Package;
      Declarations : in String) is
   begin
      Self.Extra_Declarations := Hold (Declarations);
   end Set_Extra_Declarations;


   procedure Set_Private_Child
     (Self : in out Map_Package;
      Private_Child : in Boolean := True) is
   begin
      Self.Priv := Private_Child;
   end Set_Private_Child;

Modified src/natools-static_hash_maps.ads from [f00e24d0ba] to [6dcc3fadc7].

85
86
87
88
89
90
91




92
93
94
95
96
97
98
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102







+
+
+
+







      Private_Child : in Boolean := False);
      --  Reset Self and initialize it with the givan package Name

   procedure Set_Description
     (Self : in out Map_Package;
      Description : in String);

   procedure Set_Extra_Declarations
     (Self : in out Map_Package;
      Declarations : in String);

   procedure Set_Private_Child
     (Self : in out Map_Package;
      Private_Child : in Boolean := True);

   procedure Add_Map (Self : in out Map_Package; Map : in Map_Description);
      --  Append a new Map to Self

144
145
146
147
148
149
150

151
152
153
154
155
148
149
150
151
152
153
154
155
156
157
158
159
160







+






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

   type Map_Package is record
      Name : String_Holder;
      Description : String_Holder;
      Extra_Declarations : String_Holder;
      Priv : Boolean;
      Maps : Map_Lists.List;
   end record;

end Natools.Static_Hash_Maps;