| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587 |
- Listing:
- 1 (* Release 3.10 *)
- 2 (*-------------------------------------------------------------------------*
- 3 * *
- 4 * INOUT.MOD - input/output (core library) *
- 5 * *
- 6 * COPYRIGHT (C) 1987..1992 Clarion Software Corporation. *
- 7 * All Rights Reserved *
- 8 * *
- 9 *--------------------------------------------------------------------------*)
- 10
- 11 (*$V-*)
- 12 IMPLEMENTATION MODULE InOut ;
- 13 IMPORT FIO,Str,Terminal,ASCII ;
- 14 VAR
- 15 InputFile,
- 16 OutputFile : CARDINAL ;
- 17
- 18 PROCEDURE AddExt ( VAR fn : ARRAY OF CHAR ; ext : ARRAY OF CHAR ) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 19 VAR
- 20 i,p : CARDINAL ;
- 21 BEGIN
- 22 p := Str.Length(fn) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 23 i := 1 ;
- 24 LOOP
- 25 IF (i>p)OR(i=5)OR(fn[p-i] = '\') THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 26 Str.Append(fn,'.');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 27 Str.Append(fn,ext);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 28 RETURN ;
- 29 END ;
- 30 IF fn[p-i]='.' THEN RETURN END ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 31 INC(i) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 32 END ;
- 33 END AddExt ;
- ***** ^ not supported yet
- 34
- 35 PROCEDURE OpenInput ( defext : ARRAY OF CHAR ) ;
- ***** ^ not supported yet
- 36 VAR
- 37 fn : FIO.PathStr ;
- ***** ^ not supported yet
- 38 BEGIN
- 39 CloseInput ;
- ***** ^ undeclared identifier
- 40 Terminal.WriteString('IN>');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 41 Terminal.ReadString(fn) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 42 Terminal.WriteLn ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 43 IF fn[0]=0C THEN RETURN END ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 44 AddExt(fn,defext) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 45 InputFile := FIO.Open(fn) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 46 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 47 IF NOT Done THEN
- ***** ^ undeclared identifier
- 48 InputFile := FIO.StandardInput ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 49 END ;
- 50 END OpenInput ;
- ***** ^ not supported yet
- 51
- 52 PROCEDURE OpenOutput ( defext : ARRAY OF CHAR ) ;
- ***** ^ not supported yet
- 53 VAR
- 54 fn : FIO.PathStr ;
- ***** ^ not supported yet
- 55 BEGIN
- 56 CloseOutput ;
- ***** ^ undeclared identifier
- 57 Terminal.WriteString('OUT>');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 58 Terminal.ReadString(fn) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 59 Terminal.WriteLn ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 60 IF fn[0]=0C THEN RETURN END ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 61 AddExt(fn,defext) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 62 OutputFile := FIO.Create(fn) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 63 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 64 IF NOT Done THEN
- ***** ^ undeclared identifier
- 65 OutputFile := FIO.StandardOutput ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 66 END ;
- 67 END OpenOutput ;
- ***** ^ not supported yet
- 68
- 69 PROCEDURE CloseInput ;
- 70 BEGIN
- 71 IF InputFile<>FIO.StandardInput THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 72 FIO.Close(InputFile) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 73 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 74 InputFile := FIO.StandardInput ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 75 ELSE
- 76 Done := TRUE ;
- ***** ^ undeclared identifier
- 77 END ;
- 78 END CloseInput ;
- ***** ^ not supported yet
- 79
- 80 PROCEDURE CloseOutput ;
- 81 BEGIN
- 82 IF OutputFile<>FIO.StandardOutput THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 83 FIO.Close(OutputFile) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 84 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 85 OutputFile := FIO.StandardOutput ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 86 ELSE
- 87 Done := TRUE ;
- ***** ^ undeclared identifier
- 88 END ;
- 89 END CloseOutput ;
- ***** ^ not supported yet
- 90
- 91 PROCEDURE Read ( VAR v : CHAR ) ;
- 92 VAR
- 93 b : BOOLEAN ;
- 94 BEGIN
- 95 REPEAT
- 96 IF InputFile=FIO.StandardInput THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 97 Terminal.Read(v) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 98 Done := (v<>CHR(26)) ;
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 99 ELSE
- 100 v := FIO.RdChar(InputFile) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 101 Done := (FIO.IOresult()=0)AND(v<>CHR(26)) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 102 END ;
- 103 UNTIL v<>ASCII.lf ; (* LF ignored *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- 104 IF v=ASCII.cr THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 105 v := EOL ;
- ***** ^ undeclared identifier
- 106 END ;
- 107 END Read ;
- ***** ^ not supported yet
- 108
- 109 PROCEDURE ReadString ( VAR v : ARRAY OF CHAR ) ;
- ***** ^ not supported yet
- 110 VAR
- 111 c : CHAR ;
- 112 line : ARRAY[0..255] OF CHAR ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 113 p : CARDINAL ;
- 114 BEGIN
- 115 v[0] := 0C ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 116 IF InputFile=FIO.StandardInput THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 117 Terminal.ReadString(v) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 118 termCH := Terminal.termCH ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 119 Done := (termCH<>CHR(26)) ;
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 120 ELSE
- 121 p := 0 ;
- 122 REPEAT Read(c) UNTIL (c<>' ') OR NOT Done ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 123 LOOP
- 124 IF NOT Done THEN EXIT END ;
- ***** ^ undeclared identifier
- 125 IF (c>' ') THEN
- 126 IF p<SIZE(line) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 127 line[p] := c ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 128 INC(p) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 129 END ;
- 130 ELSE EXIT ;
- 131 END ;
- 132 Read(c) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 133 END ;
- 134 termCH := c ;
- ***** ^ undeclared identifier
- 135 IF p<SIZE(line) THEN line[p] := CHR(0) END ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 136 Str.Copy(v,line) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 137 END ;
- 138 Done := (termCH<>CHR(26)) ;
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 139 END ReadString ;
- ***** ^ not supported yet
- 140
- 141 PROCEDURE ReadCard ( VAR v : CARDINAL ) ;
- 142 VAR
- 143 r : LONGCARD ;
- ***** ^ undeclared identifier
- 144 line : ARRAY[0..79] OF CHAR ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 145 BEGIN
- 146 ReadString(line) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 147 r := Str.StrToCard(line,10,Done) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 148 Done := Done AND (r<=MAX(CARDINAL)) ;
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 149 v := CARDINAL(r) ;
- ***** ^ not supported yet
- 150 END ReadCard ;
- ***** ^ not supported yet
- 151
- 152 PROCEDURE ReadInt ( VAR v : INTEGER ) ;
- 153 VAR
- 154 r : LONGINT ;
- 155 line : ARRAY[0..79] OF CHAR ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 156 BEGIN
- 157 ReadString(line) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 158 r := Str.StrToInt(line,10,Done) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 159 Done := Done AND (r>=MIN(INTEGER)) AND (r<=MAX(INTEGER)) ;
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 160 v := INTEGER(r) ;
- ***** ^ not supported yet
- 161 END ReadInt ;
- ***** ^ not supported yet
- 162
- 163
- 164
- 165 PROCEDURE Write ( v : CHAR ) ;
- 166 BEGIN
- 167 IF OutputFile=FIO.StandardOutput THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 168 IF v=EOL THEN Terminal.WriteLn() ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 169 ELSE Terminal.Write(v) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 170 END ;
- 171 Done := TRUE ;
- ***** ^ undeclared identifier
- 172 ELSE
- 173 IF v=EOL THEN FIO.WrLn(OutputFile) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 174 ELSE FIO.WrChar(OutputFile,v) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 175 END ;
- 176 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 177 END ;
- 178 END Write ;
- ***** ^ not supported yet
- 179
- 180 PROCEDURE WriteLn ;
- 181 BEGIN
- 182 Write(EOL) ;
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 183 END WriteLn ;
- ***** ^ not supported yet
- 184
- 185 PROCEDURE WriteString ( v : ARRAY OF CHAR ) ;
- ***** ^ not supported yet
- 186 VAR
- 187 buff : ARRAY[0..256] OF CHAR ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 188 i,j : CARDINAL ;
- 189 c : CHAR ;
- 190
- 191 PROCEDURE OutBuff ;
- 192 BEGIN
- 193 IF Done THEN
- ***** ^ undeclared identifier
- 194 buff[j] := CHR(0) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 195 IF OutputFile=FIO.StandardOutput THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 196 Terminal.WriteString(buff) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 197 Done := TRUE ;
- ***** ^ undeclared identifier
- 198 ELSE
- 199 FIO.WrStr(OutputFile,buff) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 200 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 201 END ;
- 202 j := 0 ;
- 203 END ;
- 204 END OutBuff;
- ***** ^ not supported yet
- 205
- 206 BEGIN
- 207 i := 0 ; j := 0 ;
- 208 Done := TRUE ;
- ***** ^ undeclared identifier
- 209 LOOP
- 210 IF i>HIGH(v) THEN OutBuff ; RETURN END ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 211 c := v[i] ; INC(i) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 212 IF c=CHR(0) THEN OutBuff ; RETURN END ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 213 IF c=EOL THEN OutBuff ; WriteLn
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 214 ELSE
- 215 buff[j] := c ; INC(j) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 216 IF j=SIZE(buff)-1 THEN OutBuff END ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 217 END ;
- 218 IF NOT Done THEN RETURN END ;
- ***** ^ undeclared identifier
- 219 END ;
- 220 END WriteString ;
- ***** ^ not supported yet
- 221
- 222 PROCEDURE WriteCard ( v : CARDINAL ; w : CARDINAL ) ;
- 223 BEGIN
- 224 FIO.WrCard(OutputFile,v,INTEGER(w)) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 225 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 226 END WriteCard ;
- ***** ^ not supported yet
- 227
- 228 PROCEDURE WriteInt ( v : INTEGER ; w : CARDINAL ) ;
- 229 BEGIN
- 230 FIO.WrInt(OutputFile,v,INTEGER(w)) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 231 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 232 END WriteInt ;
- ***** ^ not supported yet
- 233
- 234 PROCEDURE WriteOct ( v : CARDINAL ; w : CARDINAL ) ;
- 235 VAR s : ARRAY[0..80] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 236 BEGIN
- 237 Str.CardToStr( VAL( LONGCARD,v ),s,8,Done );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 238 IF Done THEN
- ***** ^ undeclared identifier
- 239 FIO.WrStrAdj(OutputFile,s,INTEGER(w) );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 240 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 241 END;
- 242 END WriteOct ;
- ***** ^ not supported yet
- 243
- 244 PROCEDURE WriteHex ( v : CARDINAL ; w : CARDINAL ) ;
- 245 BEGIN
- 246 FIO.WrHex(OutputFile,v,INTEGER(w)) ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 247 Done := (FIO.IOresult()=0) ;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 248 END WriteHex ;
- ***** ^ not supported yet
- 249
- 250 BEGIN
- 251 Done := TRUE ;
- ***** ^ undeclared identifier
- 252 termCH := CHR(0) ;
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 253 InputFile := FIO.StandardInput ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 254 OutputFile := FIO.StandardOutput ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 255 FIO.IOcheck := FALSE ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 256 END InOut.
- ***** ^ not supported yet
- 325 errors
|