Natools

Check-in [076d8be66e]
Login
Overview
Comment:s_expressions-templates-generic_integers: new command for input of several images, leveraging affix syntax
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 076d8be66ec10638a17e30c2aa3d38168de7796f
User & Date: nat on 2014-10-01 17:51:20
Other Links: manifest | tags
Context
2014-10-02
21:26
s_expressions-templates-tests-integers: add tests for image ranges check-in: dc623ed4d6 user: nat tags: trunk
2014-10-01
17:51
s_expressions-templates-generic_integers: new command for input of several images, leveraging affix syntax check-in: 076d8be66e user: nat tags: trunk
2014-09-30
18:50
s_expressions-templates-tests-integers: add tests for prefix and suffix width check-in: e612c1948b user: nat tags: trunk
Changes

Modified generated/natools-static_maps-s_expressions-templates-integers-mc.adb from [5ddf184b54] to [3e8868f88c].

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
with Interfaces; use Interfaces;

package body Natools.Static_Maps.S_Expressions.Templates.Integers.MC is

   P : constant array (0 .. 4) of Natural :=
     (1, 2, 5, 6, 9);

   T1 : constant array (0 .. 4) of Unsigned_8 :=
     (0, 40, 7, 12, 15);

   T2 : constant array (0 .. 4) of Unsigned_8 :=
     (31, 48, 43, 13, 1);

   G : constant array (0 .. 48) of Unsigned_8 :=
     (0, 14, 0, 0, 0, 0, 0, 18, 0, 17, 10, 5, 0, 18, 0, 0, 18, 8, 0, 16, 18,
      0, 0, 0, 0, 15, 23, 0, 1, 4, 13, 0, 0, 0, 0, 3, 5, 17, 0, 2, 0, 14, 6,
      0, 10, 21, 0, 0, 0);

   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 49;
         F2 := (F2 + Natural (T2 (K)) * J) mod 49;
      end loop;
      return (Natural (G (F1)) + Natural (G (F2))) mod 24;
   end Hash;

end Natools.Static_Maps.S_Expressions.Templates.Integers.MC;








|


|

|
|
|
|










|
|

|



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
with Interfaces; use Interfaces;

package body Natools.Static_Maps.S_Expressions.Templates.Integers.MC is

   P : constant array (0 .. 4) of Natural :=
     (1, 2, 5, 6, 9);

   T1 : constant array (0 .. 4) of Unsigned_8 :=
     (10, 36, 34, 8, 27);

   T2 : constant array (0 .. 4) of Unsigned_8 :=
     (6, 49, 31, 26, 30);

   G : constant array (0 .. 50) of Unsigned_8 :=
     (0, 10, 0, 6, 0, 0, 0, 0, 8, 0, 0, 4, 0, 0, 11, 0, 4, 14, 1, 0, 0, 0,
      0, 0, 7, 0, 6, 0, 0, 5, 0, 0, 21, 0, 17, 0, 16, 7, 23, 0, 20, 10, 0,
      0, 2, 1, 10, 2, 0, 19, 3);

   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 51;
         F2 := (F2 + Natural (T2 (K)) * J) mod 51;
      end loop;
      return (Natural (G (F1)) + Natural (G (F2))) mod 25;
   end Hash;

end Natools.Static_Maps.S_Expressions.Templates.Integers.MC;

Modified generated/natools-static_maps-s_expressions-templates-integers-t.adb from [855c639862] to [9853f7c1f6].

1
2
3
4
5
6
7
8
--  Generated at 2014-09-26 17:52:14 +0000 by Natools.Static_Hash_Maps
--  from src/natools-s_expressions-templates-generic_integers-maps.sx

with Natools.Static_Maps.S_Expressions.Templates.Integers.MC;
with Natools.Static_Maps.S_Expressions.Templates.Integers.AC;
function Natools.Static_Maps.S_Expressions.Templates.Integers.T
  return Boolean is
begin
|







1
2
3
4
5
6
7
8
--  Generated at 2014-10-01 17:18:35 +0000 by Natools.Static_Hash_Maps
--  from src/natools-s_expressions-templates-generic_integers-maps.sx

with Natools.Static_Maps.S_Expressions.Templates.Integers.MC;
with Natools.Static_Maps.S_Expressions.Templates.Integers.AC;
function Natools.Static_Maps.S_Expressions.Templates.Integers.T
  return Boolean is
begin

Modified generated/natools-static_maps-s_expressions-templates-integers-t.ads from [a8f540c7ee] to [165b398675].

1
2
3
4
5
6
--  Generated at 2014-09-26 17:52:14 +0000 by Natools.Static_Hash_Maps
--  from src/natools-s_expressions-templates-generic_integers-maps.sx

function Natools.Static_Maps.S_Expressions.Templates.Integers.T
  return Boolean;
pragma Pure (Natools.Static_Maps.S_Expressions.Templates.Integers.T);
|





1
2
3
4
5
6
--  Generated at 2014-10-01 17:18:35 +0000 by Natools.Static_Hash_Maps
--  from src/natools-s_expressions-templates-generic_integers-maps.sx

function Natools.Static_Maps.S_Expressions.Templates.Integers.T
  return Boolean;
pragma Pure (Natools.Static_Maps.S_Expressions.Templates.Integers.T);

Modified generated/natools-static_maps-s_expressions-templates-integers.adb from [80f3affc01] to [a5c7dc8b1c].

1
2
3
4
5
6
7
8
--  Generated at 2014-09-26 17:52:14 +0000 by Natools.Static_Hash_Maps
--  from src/natools-s_expressions-templates-generic_integers-maps.sx

with Natools.Static_Maps.S_Expressions.Templates.Integers.MC;
with Natools.Static_Maps.S_Expressions.Templates.Integers.AC;

package body Natools.Static_Maps.S_Expressions.Templates.Integers is

|







1
2
3
4
5
6
7
8
--  Generated at 2014-10-01 17:18:35 +0000 by Natools.Static_Hash_Maps
--  from src/natools-s_expressions-templates-generic_integers-maps.sx

with Natools.Static_Maps.S_Expressions.Templates.Integers.MC;
with Natools.Static_Maps.S_Expressions.Templates.Integers.AC;

package body Natools.Static_Maps.S_Expressions.Templates.Integers is

Modified generated/natools-static_maps-s_expressions-templates-integers.ads from [ae0ea47a08] to [3789356c54].

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

14
15
16
17
18
19
20
--  Generated at 2014-09-26 17:52:14 +0000 by Natools.Static_Hash_Maps
--  from src/natools-s_expressions-templates-generic_integers-maps.sx

package Natools.Static_Maps.S_Expressions.Templates.Integers is
   pragma Pure;

   type Main_Command is
     (Error,
      Align,
      Align_Center,
      Align_Left,
      Align_Right,
      Base,

      Images,
      Padding,
      Padding_Left,
      Padding_Right,
      Prefix,
      Sign,
      Suffix,
|












>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--  Generated at 2014-10-01 17:18:35 +0000 by Natools.Static_Hash_Maps
--  from src/natools-s_expressions-templates-generic_integers-maps.sx

package Natools.Static_Maps.S_Expressions.Templates.Integers is
   pragma Pure;

   type Main_Command is
     (Error,
      Align,
      Align_Center,
      Align_Left,
      Align_Right,
      Base,
      Image_Range,
      Images,
      Padding,
      Padding_Left,
      Padding_Right,
      Prefix,
      Sign,
      Suffix,
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
   Map_1_Key_1 : aliased constant String := "align-center";
   Map_1_Key_2 : aliased constant String := "centered";
   Map_1_Key_3 : aliased constant String := "align-left";
   Map_1_Key_4 : aliased constant String := "left-align";
   Map_1_Key_5 : aliased constant String := "align-right";
   Map_1_Key_6 : aliased constant String := "right-align";
   Map_1_Key_7 : aliased constant String := "base";
   Map_1_Key_8 : aliased constant String := "image";
   Map_1_Key_9 : aliased constant String := "images";
   Map_1_Key_10 : aliased constant String := "padding";
   Map_1_Key_11 : aliased constant String := "padding-left";
   Map_1_Key_12 : aliased constant String := "left-padding";
   Map_1_Key_13 : aliased constant String := "padding-right";
   Map_1_Key_14 : aliased constant String := "right-padding";
   Map_1_Key_15 : aliased constant String := "prefix";
   Map_1_Key_16 : aliased constant String := "sign";
   Map_1_Key_17 : aliased constant String := "signs";
   Map_1_Key_18 : aliased constant String := "suffix";
   Map_1_Key_19 : aliased constant String := "width";
   Map_1_Key_20 : aliased constant String := "width-max";
   Map_1_Key_21 : aliased constant String := "max-width";
   Map_1_Key_22 : aliased constant String := "width-min";
   Map_1_Key_23 : aliased constant String := "min-width";

   Map_1_Keys : constant array (0 .. 23) 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,







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
   Map_1_Key_1 : aliased constant String := "align-center";
   Map_1_Key_2 : aliased constant String := "centered";
   Map_1_Key_3 : aliased constant String := "align-left";
   Map_1_Key_4 : aliased constant String := "left-align";
   Map_1_Key_5 : aliased constant String := "align-right";
   Map_1_Key_6 : aliased constant String := "right-align";
   Map_1_Key_7 : aliased constant String := "base";
   Map_1_Key_8 : aliased constant String := "image-range";
   Map_1_Key_9 : aliased constant String := "image";
   Map_1_Key_10 : aliased constant String := "images";
   Map_1_Key_11 : aliased constant String := "padding";
   Map_1_Key_12 : aliased constant String := "padding-left";
   Map_1_Key_13 : aliased constant String := "left-padding";
   Map_1_Key_14 : aliased constant String := "padding-right";
   Map_1_Key_15 : aliased constant String := "right-padding";
   Map_1_Key_16 : aliased constant String := "prefix";
   Map_1_Key_17 : aliased constant String := "sign";
   Map_1_Key_18 : aliased constant String := "signs";
   Map_1_Key_19 : aliased constant String := "suffix";
   Map_1_Key_20 : aliased constant String := "width";
   Map_1_Key_21 : aliased constant String := "width-max";
   Map_1_Key_22 : aliased constant String := "max-width";
   Map_1_Key_23 : aliased constant String := "width-min";
   Map_1_Key_24 : aliased constant String := "min-width";
   Map_1_Keys : constant array (0 .. 24) 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,
73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
88
89

90
91
92
93
94
95
96
         Map_1_Key_16'Access,
         Map_1_Key_17'Access,
         Map_1_Key_18'Access,
         Map_1_Key_19'Access,
         Map_1_Key_20'Access,
         Map_1_Key_21'Access,
         Map_1_Key_22'Access,
         Map_1_Key_23'Access);

   Map_1_Elements : constant array (0 .. 23) of Main_Command
     := (Align,
         Align_Center,
         Align_Center,
         Align_Left,
         Align_Left,
         Align_Right,
         Align_Right,
         Base,

         Images,
         Images,
         Padding,
         Padding_Left,
         Padding_Left,
         Padding_Right,
         Padding_Right,







|
>
|








>







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
         Map_1_Key_16'Access,
         Map_1_Key_17'Access,
         Map_1_Key_18'Access,
         Map_1_Key_19'Access,
         Map_1_Key_20'Access,
         Map_1_Key_21'Access,
         Map_1_Key_22'Access,
         Map_1_Key_23'Access,
         Map_1_Key_24'Access);
   Map_1_Elements : constant array (0 .. 24) of Main_Command
     := (Align,
         Align_Center,
         Align_Center,
         Align_Left,
         Align_Left,
         Align_Right,
         Align_Right,
         Base,
         Image_Range,
         Images,
         Images,
         Padding,
         Padding_Left,
         Padding_Left,
         Padding_Right,
         Padding_Right,

Modified src/natools-s_expressions-templates-generic_integers-maps.sx from [7f19af6f94] to [10536553be].

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
(Natools.Static_Maps.S_Expressions.Templates.Integers
   pure
   (test-function T)
   (extra-decl "\
   type Main_Command is
     (Error,
      Align,
      Align_Center,
      Align_Left,
      Align_Right,
      Base,

      Images,
      Padding,
      Padding_Left,
      Padding_Right,
      Prefix,
      Sign,
      Suffix,











>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(Natools.Static_Maps.S_Expressions.Templates.Integers
   pure
   (test-function T)
   (extra-decl "\
   type Main_Command is
     (Error,
      Align,
      Align_Center,
      Align_Left,
      Align_Right,
      Base,
      Image_Range,
      Images,
      Padding,
      Padding_Left,
      Padding_Right,
      Prefix,
      Sign,
      Suffix,
28
29
30
31
32
33
34

35
36
37
38
39
40
41
      (not-found Error)
      (nodes
         (Align          align)
         (Align_Center   align-center centered)
         (Align_Left     align-left left-align)
         (Align_Right    align-right right-align)
         (Base           base)

         (Images         image images)
         (Padding        padding)
         (Padding_Left   padding-left left-padding)
         (Padding_Right  padding-right right-padding)
         (Prefix         prefix)
         (Sign           sign signs)
         (Suffix         suffix)







>







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
      (not-found Error)
      (nodes
         (Align          align)
         (Align_Center   align-center centered)
         (Align_Left     align-left left-align)
         (Align_Right    align-right right-align)
         (Base           base)
         (Image_Range    image-range)
         (Images         image images)
         (Padding        padding)
         (Padding_Left   padding-left left-padding)
         (Padding_Right  padding-right right-padding)
         (Prefix         prefix)
         (Sign           sign signs)
         (Suffix         suffix)

Modified src/natools-s_expressions-templates-generic_integers.adb from [34517169c8] to [0b26ca8f47].

130
131
132
133
134
135
136



137
138
139
140
141
142
143

         when Commands.Align_Right =>
            State.Set_Align (Right_Aligned);

         when Commands.Base =>
            State.Set_Symbols (Arguments);




         when Commands.Images =>
            Image_Interpreter (Arguments, State, Meaningless_Value);

         when Commands.Padding =>
            case Arguments.Current_Event is
               when Events.Add_Atom =>
                  State.Left_Padding := Create (Arguments.Current_Atom);







>
>
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

         when Commands.Align_Right =>
            State.Set_Align (Right_Aligned);

         when Commands.Base =>
            State.Set_Symbols (Arguments);

         when Commands.Image_Range =>
            Parse (State.Images, Arguments);

         when Commands.Images =>
            Image_Interpreter (Arguments, State, Meaningless_Value);

         when Commands.Padding =>
            case Arguments.Current_Event is
               when Events.Add_Atom =>
                  State.Left_Padding := Create (Arguments.Current_Atom);