blob: 1c64deb543dabd7f761b3f9c2fc05742cfb0e6f9 (
plain)
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
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
66
67
68
69
70
71
72
73
74
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
with
Ada.Containers.Vectors,
Ada.Strings.Unbounded,
Ada.Text_IO;
private with
Ada.Strings.Fixed,
Ada.Strings.Maps;
package FMD is
procedure Put_Header
(File_Handle : in Ada.Text_IO.File_Type;
Version : in String := "1.4");
generic
type Vector_Index is range <>;
type Vector_Data is private;
with package Data_Vectors is new Ada.Containers.Vectors (Vector_Index, Vector_Data);
with function To_Unbounded_String
(Data : in Vector_Data)
return Ada.Strings.Unbounded.Unbounded_String is <>;
procedure Put_Fields
(File_Handle : in Ada.Text_IO.File_Type;
Field_IDs : in Data_Vectors.Vector);
procedure Start_Pack_Section
(File_Handle : in Ada.Text_IO.File_Type);
generic
type Vector_Index is range <>;
type Vector_Data is private;
with package Data_Vectors is new Ada.Containers.Vectors (Vector_Index, Vector_Data);
with function To_Unbounded_String
(Data : in Vector_Data)
return Ada.Strings.Unbounded.Unbounded_String is <>;
procedure Put_Pack
(File_Handle : in Ada.Text_IO.File_Type;
Q_Data : in Data_Vectors.Vector;
A_Data : in Data_Vectors.Vector)
with Pre => not Q_Data.Is_Empty and not A_Data.Is_Empty;
procedure End_Pack_Section
(File_Handle : in Ada.Text_IO.File_Type);
procedure Start_Entry_Section
(File_Handle : in Ada.Text_IO.File_Type);
generic
type Vector_Index is range <>;
type Vector_Data is private;
with package Data_Vectors is new Ada.Containers.Vectors (Vector_Index, Vector_Data);
with function To_Unbounded_String
(Data : in Vector_Data)
return Ada.Strings.Unbounded.Unbounded_String is <>;
procedure Put_Entry
(File_Handle : in Ada.Text_IO.File_Type;
Data : in Data_Vectors.Vector;
Quantity : in Positive);
procedure End_Entry_Section
(File_Handle : in Ada.Text_IO.File_Type);
procedure Put_Footer
(File_Handle : in Ada.Text_IO.File_Type);
private
package SU renames Ada.Strings.Unbounded;
function "+"
(S : in String)
return SU.Unbounded_String
renames SU.To_Unbounded_String;
function "-"
(US : in SU.Unbounded_String)
return String
renames SU.To_String;
procedure Replace_All
(Text : in out SU.Unbounded_String;
Char : in Character;
Sub : in String)
with Pre => Ada.Strings.Fixed.Count (Sub, Ada.Strings.Maps.To_Set (Char)) = 0;
procedure Replace_All
(Text : in out SU.Unbounded_String;
Item : in String;
Sub : in String);
function Prep
(Text : in SU.Unbounded_String)
return SU.Unbounded_String;
end FMD;
|