Overview
Context
Changes
Added src/natools-static_hash_maps-s_expressions-command_map.adb version [e6140e570c].
|
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_Map is
P : constant array (0 .. 0) of Natural :=
(0 .. 0 => 3);
T1 : constant array (0 .. 0) of Unsigned_8 :=
(0 .. 0 => 8);
T2 : constant array (0 .. 0) of Unsigned_8 :=
(0 .. 0 => 5);
G : constant array (0 .. 8) of Unsigned_8 :=
(0, 0, 0, 0, 3, 1, 0, 2, 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 9;
F2 := (F2 + Natural (T2 (K)) * J) mod 9;
end loop;
return (Natural (G (F1)) + Natural (G (F2))) mod 4;
end Hash;
end Natools.Static_Hash_Maps.S_Expressions.Command_Map;
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/natools-static_hash_maps-s_expressions-command_map.ads version [9b8c6eae54].
|
1
2
3
|
+
+
+
|
package Natools.Static_Hash_Maps.S_Expressions.Command_Map is
function Hash (S : String) return Natural;
end Natools.Static_Hash_Maps.S_Expressions.Command_Map;
|
| |
Added src/natools-static_hash_maps-s_expressions-command_maps.adb version [51c1c623eb].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
-- Generated at 2014-05-21 20:03:41 +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
function To_Package_Command (Key : String) return Package_Command is
N : constant Natural
:= Natools.Static_Hash_Maps.S_Expressions.Command_Pkg.Hash (Key);
begin
if Map_1_Keys (N).all = Key then
return Map_1_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end To_Package_Command;
function To_Map_Command (Key : String) return Map_Command is
N : constant Natural
:= Natools.Static_Hash_Maps.S_Expressions.Command_Map.Hash (Key);
begin
if Map_2_Keys (N).all = Key then
return Map_2_Elements (N);
else
raise Constraint_Error with "Key """ & Key & """ not in map";
end if;
end To_Map_Command;
end Natools.Static_Hash_Maps.S_Expressions.Command_Maps;
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/natools-static_hash_maps-s_expressions-command_maps.ads version [1daffcd302].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
-- Generated at 2014-05-21 20:03:41 +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 := "private";
Map_1_Key_1 : aliased constant String := "public";
Map_1_Keys : constant array (0 .. 1) of access constant String
:= (Map_1_Key_0'Access,
Map_1_Key_1'Access);
Map_1_Elements : constant array (0 .. 1) of Package_Command
:= (Private_Child,
Public_Child);
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
:= (Map_2_Key_0'Access,
Map_2_Key_1'Access,
Map_2_Key_2'Access,
Map_2_Key_3'Access);
Map_2_Elements : constant array (0 .. 3) of Map_Command
:= (Hash_Package,
Nodes,
Function_Name,
Not_Found);
end Natools.Static_Hash_Maps.S_Expressions.Command_Maps;
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/natools-static_hash_maps-s_expressions-command_pkg.adb version [5994920bee].
|
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 .. 0) of Natural :=
(0 .. 0 => 2);
T1 : constant array (0 .. 0) of Unsigned_8 :=
(0 .. 0 => 4);
T2 : constant array (0 .. 0) of Unsigned_8 :=
(0 .. 0 => 3);
G : constant array (0 .. 4) of Unsigned_8 :=
(0, 0, 0, 1, 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 5;
F2 := (F2 + Natural (T2 (K)) * J) mod 5;
end loop;
return (Natural (G (F1)) + Natural (G (F2))) mod 2;
end Hash;
end Natools.Static_Hash_Maps.S_Expressions.Command_Pkg;
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/natools-static_hash_maps-s_expressions-command_pkg.ads version [7cb4b44268].
|
1
2
3
|
+
+
+
|
package Natools.Static_Hash_Maps.S_Expressions.Command_Pkg is
function Hash (S : String) return Natural;
end Natools.Static_Hash_Maps.S_Expressions.Command_Pkg;
|
| |
Added src/natools-static_hash_maps-s_expressions-hash_maps.sx version [0d990b8dfd].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
(Natools.Static_Hash_Maps.S_Expressions.Command_Maps
private
(Package_Command
(hash-package Natools.Static_Hash_Maps.S_Expressions.Command_Pkg)
(function To_Package_Command)
(nodes
(Private_Child private)
(Public_Child public)))
(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))))
|
| | | | | | | | | | | | | | | |