-
Notifications
You must be signed in to change notification settings - Fork 0
/
wacc-io.ads
82 lines (64 loc) · 1.62 KB
/
wacc-io.ads
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
private with Ada.Text_IO;
private with GNAT.Strings;
package WACC.IO
with Elaborate_Body, SPARK_Mode => On
is
type Reader is private;
function Is_Open
(File : Reader)
return Boolean;
procedure Open
(File : in out Reader;
Filename : String)
with Pre => not Is_Open (File),
Post => Is_Open (File);
procedure Close
(File : in out Reader)
with Pre => Is_Open (File),
Post => not Is_Open (File);
function End_Of_File
(File : Reader)
return Boolean
with Pre => Is_Open (File);
procedure Advance
(File : in out Reader;
Count : Integer := 1)
with Pre => Is_Open (File);
function Next
(File : Reader)
return Character
with Pre => Is_Open (File);
type Writer is limited private;
function Is_Open
(File : Writer)
return Boolean;
procedure Open
(File : in out Writer;
Filename : String)
with Pre => not Is_Open (File),
Post => Is_Open (File);
procedure Put
(File : in out Writer;
Ch : Character)
with Pre => Is_Open (File);
procedure Put
(File : in out Writer;
Str : String)
with Pre => Is_Open (File);
procedure Put
(File : in out Writer;
N : Long_Integer)
with Pre => Is_Open (File);
procedure Close
(File : in out Writer)
with Pre => Is_Open (File),
Post => not Is_Open (File);
private
type Reader is record
Data : GNAT.Strings.String_Access;
Index : Natural := 0;
end record;
type Writer is limited record
Output : Ada.Text_IO.File_Type;
end record;
end WACC.IO;