File: InOut.def

package info (click to toggle)
m2c 0.6-10
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,156 kB
  • ctags: 1,908
  • sloc: ansic: 18,136; sh: 1,561; makefile: 48
file content (84 lines) | stat: -rw-r--r-- 2,607 bytes parent folder | download | duplicates (5)
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
DEFINITION MODULE InOut;
IMPORT ASCII;
 (* WriteInt,WriteCard,WriteOct,WriteHex are retained for compatibility *)

 CONST
  EOL=ASCII.lf;

 VAR
  Done:BOOLEAN;
  termCh:CHAR;

 PROCEDURE OpenInput(Ext:ARRAY OF CHAR);
  (* File name is entered. The file becomes current input file ("in")  *)
  (* If OpenInput succeeds, Done=TRUE and subsequent input is taken    *)
  (*   from the streem until Closeinput is called.                     *)
  (* If the name is ended at the point, defext is appended to the name *)

 PROCEDURE OpenOutput(Ext:ARRAY OF CHAR);
  (* Analogous to OpenOutput but for current output file ("out") *)


 PROCEDURE CloseInput;
  (* Close current input file. Current input file becomes terminal *)

 PROCEDURE CloseOutput;
  (* Close current output file. Current output file becomes terminal *)

 PROCEDURE Read(VAR ch:CHAR);
  (* Done := NOT in.eof *)

 PROCEDURE ReadString(VAR s:ARRAY OF CHAR);
  (* Read a string (see string determination, leading blanks is ignored) *)
  (*   from open input stream.                                           *)
  (* Input is ended at any char <= " ". The char is assigned to termCh.  *)
  (* DEL is processed normally.                                          *)

 PROCEDURE ReadInt(VAR x:INTEGER);
  (* Read a string and transform it to an integer.  *)
  (* Syntax of integer: ["+" | "-"]digit{digit}     *)
  (* Done := "integer is read".                     *)

 PROCEDURE ReadShortInt(VAR x:SHORTINT);
  (* Analogous to ReadInt but for short integer *)

 PROCEDURE ReadLongInt(VAR x:LONGINT);
  (* Analogous to ReadInt but for long integer *)

 PROCEDURE ReadCard(VAR x:CARDINAL);
  (* Analogous to ReadInt but for cardinal  *)
  (* Syntax of cardinal: digit{digit}       *)

 PROCEDURE ReadShortCard(VAR x:SHORTCARD);
  (* Analogous to ReadCard but for short cardinal *)

 PROCEDURE ReadLongCard(VAR x:LONGCARD);
  (* Analogous to ReadCard but for long cardinal *)

 PROCEDURE Write(ch:CHAR);

 PROCEDURE WriteLn;

 PROCEDURE WriteString(s:ARRAY OF CHAR);
  (* See string determination *)

 PROCEDURE WriteInt(x:INTEGER;n:CARDINAL);
  (* Write an integer to the current output stream                   *)
  (* If n is greater than needed positions, leading blanks is output *)

 PROCEDURE WriteLongInt(x:LONGINT;n:CARDINAL);
  (* Analogous WriteInt but for long integer *)

 PROCEDURE WriteCard(x,n:CARDINAL);

 PROCEDURE WriteLongCard(x:LONGCARD;n:CARDINAL);

 PROCEDURE WriteOct(x,n:CARDINAL);

 PROCEDURE WriteLongOct(x:LONGCARD;n:CARDINAL);

 PROCEDURE WriteHex(x,n:CARDINAL);

 PROCEDURE WriteLongHex(x:LONGCARD;n:CARDINAL);

END InOut.