Natools

Check-in [cf4a28a612]
Login
Overview
Comment:static_hash_maps-s_expressions: add binding for the new package categorization option
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cf4a28a6124520a79eafdd3f82442c8d01f37682
User & Date: nat on 2014-05-31 15:04:56
Other Links: manifest | tags
Context
2014-06-01
16:17
Move generated source files to a dedicated directory check-in: 1beffff021 user: nat tags: trunk
2014-05-31
15:04
static_hash_maps-s_expressions: add binding for the new package categorization option check-in: cf4a28a612 user: nat tags: trunk
2014-05-30
20:11
static_hash_maps: add a new option for pragma Pure or Preelaborate on generated packages check-in: 59e052eab5 user: nat tags: trunk
Changes

Modified src/natools-static_hash_maps-s_expressions-command_maps-test.adb from [c33313b3c2] to [4ca212829b].

1
2
3
4
5
6
7
8
--  Generated at 2014-05-29 18:32:55 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

with Natools.Static_Hash_Maps.S_Expressions.Command_Pkg;
with Natools.Static_Hash_Maps.S_Expressions.Command_Map;
function Natools.Static_Hash_Maps.S_Expressions.Command_Maps.Test
  return Boolean is
begin
|







1
2
3
4
5
6
7
8
--  Generated at 2014-05-31 15:03:28 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

with Natools.Static_Hash_Maps.S_Expressions.Command_Pkg;
with Natools.Static_Hash_Maps.S_Expressions.Command_Map;
function Natools.Static_Hash_Maps.S_Expressions.Command_Maps.Test
  return Boolean is
begin

Modified src/natools-static_hash_maps-s_expressions-command_maps-test.ads from [af29308048] to [4053b539ac].

1
2
3
4
5
--  Generated at 2014-05-29 18:32:55 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

function Natools.Static_Hash_Maps.S_Expressions.Command_Maps.Test
  return Boolean;
|




1
2
3
4
5
--  Generated at 2014-05-31 15:03:28 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

function Natools.Static_Hash_Maps.S_Expressions.Command_Maps.Test
  return Boolean;

Modified src/natools-static_hash_maps-s_expressions-command_maps.adb from [1ef76473e0] to [b6be33832f].

1
2
3
4
5
6
7
8
--  Generated at 2014-05-28 17:27:24 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

with Natools.Static_Hash_Maps.S_Expressions.Command_Pkg;
with Natools.Static_Hash_Maps.S_Expressions.Command_Map;

package body Natools.Static_Hash_Maps.S_Expressions.Command_Maps is

|







1
2
3
4
5
6
7
8
--  Generated at 2014-05-31 15:03:28 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

with Natools.Static_Hash_Maps.S_Expressions.Command_Pkg;
with Natools.Static_Hash_Maps.S_Expressions.Command_Map;

package body Natools.Static_Hash_Maps.S_Expressions.Command_Maps is

Modified src/natools-static_hash_maps-s_expressions-command_maps.ads from [bc5c35a3a3] to [0eaa976a29].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15


16
17
18
19
20
21


22
23
24
25
26


27
28
29
30
31
32
33
--  Generated at 2014-05-28 17:27:24 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

private package Natools.Static_Hash_Maps.S_Expressions.Command_Maps is

   function To_Package_Command (Key : String) return Package_Command;
   function To_Map_Command (Key : String) return Map_Command;

private

   Map_1_Key_0 : aliased constant String := "extra-declarations";
   Map_1_Key_1 : aliased constant String := "extra-decl";
   Map_1_Key_2 : aliased constant String := "private";
   Map_1_Key_3 : aliased constant String := "public";
   Map_1_Key_4 : aliased constant String := "test-function";


   Map_1_Keys : constant array (0 .. 4) of access constant String
     := (Map_1_Key_0'Access,
         Map_1_Key_1'Access,
         Map_1_Key_2'Access,
         Map_1_Key_3'Access,
         Map_1_Key_4'Access);


   Map_1_Elements : constant array (0 .. 4) of Package_Command
     := (Extra_Declarations,
         Extra_Declarations,
         Private_Child,
         Public_Child,


         Test_Function);

   Map_2_Key_0 : aliased constant String := "hash-package";
   Map_2_Key_1 : aliased constant String := "nodes";
   Map_2_Key_2 : aliased constant String := "function";
   Map_2_Key_3 : aliased constant String := "not-found";
   Map_2_Keys : constant array (0 .. 3) of access constant String
|













|
>
>
|




|
>
>
|




>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--  Generated at 2014-05-31 15:03:28 +0000 by Natools.Static_Hash_Maps
--  from natools-static_hash_maps-s_expressions-hash_maps.sx

private package Natools.Static_Hash_Maps.S_Expressions.Command_Maps is

   function To_Package_Command (Key : String) return Package_Command;
   function To_Map_Command (Key : String) return Map_Command;

private

   Map_1_Key_0 : aliased constant String := "extra-declarations";
   Map_1_Key_1 : aliased constant String := "extra-decl";
   Map_1_Key_2 : aliased constant String := "private";
   Map_1_Key_3 : aliased constant String := "public";
   Map_1_Key_4 : aliased constant String := "pure";
   Map_1_Key_5 : aliased constant String := "preelaborate";
   Map_1_Key_6 : aliased constant String := "test-function";
   Map_1_Keys : constant array (0 .. 6) of access constant String
     := (Map_1_Key_0'Access,
         Map_1_Key_1'Access,
         Map_1_Key_2'Access,
         Map_1_Key_3'Access,
         Map_1_Key_4'Access,
         Map_1_Key_5'Access,
         Map_1_Key_6'Access);
   Map_1_Elements : constant array (0 .. 6) of Package_Command
     := (Extra_Declarations,
         Extra_Declarations,
         Private_Child,
         Public_Child,
         Pure_Package,
         Preelaborate_Package,
         Test_Function);

   Map_2_Key_0 : aliased constant String := "hash-package";
   Map_2_Key_1 : aliased constant String := "nodes";
   Map_2_Key_2 : aliased constant String := "function";
   Map_2_Key_3 : aliased constant String := "not-found";
   Map_2_Keys : constant array (0 .. 3) of access constant String

Modified src/natools-static_hash_maps-s_expressions-command_pkg.adb from [1d93d9989e] to [5d93ba52c8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
with Interfaces; use Interfaces;

package body Natools.Static_Hash_Maps.S_Expressions.Command_Pkg is

   P : constant array (0 .. 1) of Natural :=
     (2, 11);

   T1 : constant array (0 .. 1) of Unsigned_8 :=
     (8, 10);

   T2 : constant array (0 .. 1) of Unsigned_8 :=
     (5, 2);

   G : constant array (0 .. 10) of Unsigned_8 :=
     (2, 3, 0, 0, 0, 0, 1, 0, 0, 0, 2);

   function Hash (S : String) return Natural is
      F : constant Natural := S'First - 1;
      L : constant Natural := S'Length;
      F1, F2 : Natural := 0;
      J : Natural;
   begin
      for K in P'Range loop
         exit when L < P (K);
         J  := Character'Pos (S (P (K) + F));
         F1 := (F1 + Natural (T1 (K)) * J) mod 11;
         F2 := (F2 + Natural (T2 (K)) * J) mod 11;
      end loop;
      return (Natural (G (F1)) + Natural (G (F2))) mod 5;
   end Hash;

end Natools.Static_Hash_Maps.S_Expressions.Command_Pkg;





|


|


|

|
|










|
|

|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
with Interfaces; use Interfaces;

package body Natools.Static_Hash_Maps.S_Expressions.Command_Pkg is

   P : constant array (0 .. 1) of Natural :=
     (3, 11);

   T1 : constant array (0 .. 1) of Unsigned_8 :=
     (0, 1);

   T2 : constant array (0 .. 1) of Unsigned_8 :=
     (6, 12);

   G : constant array (0 .. 16) of Unsigned_8 :=
     (0, 2, 0, 6, 4, 0, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 1);

   function Hash (S : String) return Natural is
      F : constant Natural := S'First - 1;
      L : constant Natural := S'Length;
      F1, F2 : Natural := 0;
      J : Natural;
   begin
      for K in P'Range loop
         exit when L < P (K);
         J  := Character'Pos (S (P (K) + F));
         F1 := (F1 + Natural (T1 (K)) * J) mod 17;
         F2 := (F2 + Natural (T2 (K)) * J) mod 17;
      end loop;
      return (Natural (G (F1)) + Natural (G (F2))) mod 7;
   end Hash;

end Natools.Static_Hash_Maps.S_Expressions.Command_Pkg;

Modified src/natools-static_hash_maps-s_expressions-hash_maps.sx from [d412302ff5] to [bd439d8f06].

1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
(Natools.Static_Hash_Maps.S_Expressions.Command_Maps
   private
   (test-function Test)
   (Package_Command
      (hash-package Natools.Static_Hash_Maps.S_Expressions.Command_Pkg)
      (function To_Package_Command)
      (not-found Extra_Declarations)
      (nodes
         (Extra_Declarations extra-declarations extra-decl)
         (Private_Child private)
         (Public_Child public)


         (Test_Function test-function)))
   (Map_Command
      (hash-package Natools.Static_Hash_Maps.S_Expressions.Command_Map)
      (function To_Map_Command)
      (nodes
         (Hash_Package hash-package)
         (Nodes nodes)
         (Function_Name function)
         (Not_Found not-found))))












>
>










1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(Natools.Static_Hash_Maps.S_Expressions.Command_Maps
   private
   (test-function Test)
   (Package_Command
      (hash-package Natools.Static_Hash_Maps.S_Expressions.Command_Pkg)
      (function To_Package_Command)
      (not-found Extra_Declarations)
      (nodes
         (Extra_Declarations extra-declarations extra-decl)
         (Private_Child private)
         (Public_Child public)
         (Pure_Package pure)
         (Preelaborate_Package preelaborate)
         (Test_Function test-function)))
   (Map_Command
      (hash-package Natools.Static_Hash_Maps.S_Expressions.Command_Map)
      (function To_Map_Command)
      (nodes
         (Hash_Package hash-package)
         (Nodes nodes)
         (Function_Name function)
         (Not_Found not-found))))

Modified src/natools-static_hash_maps-s_expressions.adb from [c1e705c3e6] to [27c4cdae39].

195
196
197
198
199
200
201




202
203
204
205
206
207
208
      end if;

      case Command_Maps.To_Package_Command (Sx.To_String (Name)) is
         when Private_Child =>
            Set_Private_Child (Pkg, True);
         when Public_Child =>
            Set_Private_Child (Pkg, False);




         when Extra_Declarations =>
            if Arguments.Current_Event = Sx.Events.Add_Atom then
               Set_Extra_Declarations
                 (Pkg, Sx.To_String (Arguments.Current_Atom));
            end if;
         when Test_Function =>
            if Arguments.Current_Event = Sx.Events.Add_Atom then







>
>
>
>







195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
      end if;

      case Command_Maps.To_Package_Command (Sx.To_String (Name)) is
         when Private_Child =>
            Set_Private_Child (Pkg, True);
         when Public_Child =>
            Set_Private_Child (Pkg, False);
         when Pure_Package =>
            Set_Categorization (Pkg, Pure);
         when Preelaborate_Package =>
            Set_Categorization (Pkg, Preelaborate);
         when Extra_Declarations =>
            if Arguments.Current_Event = Sx.Events.Add_Atom then
               Set_Extra_Declarations
                 (Pkg, Sx.To_String (Arguments.Current_Atom));
            end if;
         when Test_Function =>
            if Arguments.Current_Event = Sx.Events.Add_Atom then
238
239
240
241
242
243
244




245
246
247
248
249
250
251
      pragma Unreferenced (Context);
   begin
      case Command_Maps.To_Package_Command (Sx.To_String (Name)) is
         when Private_Child =>
            Set_Private_Child (Pkg, True);
         when Public_Child =>
            Set_Private_Child (Pkg, False);




         when Extra_Declarations =>
            Set_Extra_Declarations (Pkg, Sx.To_String (Name));
         when Test_Function =>
            null;
      end case;
   end Update_Package;








>
>
>
>







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
      pragma Unreferenced (Context);
   begin
      case Command_Maps.To_Package_Command (Sx.To_String (Name)) is
         when Private_Child =>
            Set_Private_Child (Pkg, True);
         when Public_Child =>
            Set_Private_Child (Pkg, False);
         when Pure_Package =>
            Set_Categorization (Pkg, Pure);
         when Preelaborate_Package =>
            Set_Categorization (Pkg, Preelaborate);
         when Extra_Declarations =>
            Set_Extra_Declarations (Pkg, Sx.To_String (Name));
         when Test_Function =>
            null;
      end case;
   end Update_Package;

Modified src/natools-static_hash_maps-s_expressions.ads from [e10b5a68ba] to [375a4ce6c6].

37
38
39
40
41
42
43


44
45
46
47
48
49
50
51
52
53
      --  Generate the package described by Input

private

   type Package_Command is
     (Private_Child,
      Public_Child,


      Test_Function,
      Extra_Declarations);

   type Map_Command is
     (Hash_Package,
      Nodes,
      Function_Name,
      Not_Found);

end Natools.Static_Hash_Maps.S_Expressions;







>
>










37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
      --  Generate the package described by Input

private

   type Package_Command is
     (Private_Child,
      Public_Child,
      Pure_Package,
      Preelaborate_Package,
      Test_Function,
      Extra_Declarations);

   type Map_Command is
     (Hash_Package,
      Nodes,
      Function_Name,
      Not_Found);

end Natools.Static_Hash_Maps.S_Expressions;