WINFIO.LST 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. Listing:
  2. 1 (* Release 3.00 *)
  3. 2 (* Copyright (C) 1987..1991 Jensen & Partners International *)
  4. 3
  5. 4 (*# call(seg_name => null) *)
  6. 5 (*# module(implementation=>off) *)
  7. 6 (*# data(seg_name => null, near_ptr=>off) *)
  8. 7 (*# call(o_a_copy => off, ds_eq_ss=>off, near_call=>off) *)
  9. 8 (*# check(stack=>off,
  10. 9 index=>off,
  11. 10 range=>off,
  12. 11 overflow=>off,
  13. 12 nil_ptr=>off) *)
  14. 13
  15. 14
  16. 15 IMPLEMENTATION MODULE WinFIO;
  17. 16
  18. 17 IMPORT Lib, SYSTEM, CoreIO, CoreFile, CoreSig, CoreMain, Windows;
  19. 18
  20. 19 VAR
  21. 20 (* CoreFile.BufInf : ARRAY[0..MaxHandle] OF FileInf; *) (* NB in CoreFile *)
  22. 21 IOR: CARDINAL;
  23. 22
  24. 23 TYPE
  25. 24 Str80 = ARRAY[0..79] OF CHAR;
  26. ***** ^ not supported yet
  27. ***** ^ not supported yet
  28. 25 PathStr = ARRAY [0..128] OF CHAR;
  29. ***** ^ not supported yet
  30. ***** ^ not supported yet
  31. 26
  32. 27
  33. 28 PROCEDURE ErrorCheck(Code: CARDINAL; ErrNum: CARDINAL; Msg, Name: ARRAY OF CHAR);
  34. ***** ^ not supported yet
  35. 29
  36. 30 VAR
  37. 31 ErrMsg: ARRAY [0..119] OF CHAR;
  38. ***** ^ not supported yet
  39. ***** ^ not supported yet
  40. 32 NumStr: ARRAY [0..19] OF CHAR;
  41. ***** ^ not supported yet
  42. ***** ^ not supported yet
  43. 33 OK: BOOLEAN;
  44. 34 BEGIN
  45. 35 IF ErrNum = 0 THEN
  46. 36 ErrNum := Lib.SysErrno();
  47. ***** ^ not supported yet
  48. ***** ^ not supported yet
  49. ***** ^ not supported yet
  50. 37 END;
  51. 38 IF IOcheck THEN
  52. ***** ^ undeclared identifier
  53. 39 Str.Copy(ErrMsg, Msg);
  54. ***** ^ undeclared identifier
  55. ***** ^ not supported yet
  56. ***** ^ not supported yet
  57. ***** ^ not supported yet
  58. 40 Str.Append(ErrMsg, Name);
  59. ***** ^ undeclared identifier
  60. ***** ^ not supported yet
  61. ***** ^ not supported yet
  62. ***** ^ not supported yet
  63. 41 Str.Append(ErrMsg, '. Dos Error Code ');
  64. ***** ^ undeclared identifier
  65. ***** ^ not supported yet
  66. ***** ^ not supported yet
  67. ***** ^ not supported yet
  68. 42 Str.CardToStr(LONGCARD(ErrNum), NumStr, 10, OK);
  69. ***** ^ undeclared identifier
  70. ***** ^ not supported yet
  71. ***** ^ undeclared identifier
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. 43 Str.Append(ErrMsg, NumStr);
  76. ***** ^ undeclared identifier
  77. ***** ^ not supported yet
  78. ***** ^ not supported yet
  79. ***** ^ not supported yet
  80. 44 (* Lib.WrDosError(SHORTCARD(ErrNum)); *)
  81. 45 Lib.RunTimeError(CoreSig._FatalErrorPos(), Code+0A0H, ErrMsg);
  82. ***** ^ not supported yet
  83. ***** ^ not supported yet
  84. ***** ^ not supported yet
  85. ***** ^ not supported yet
  86. ***** ^ not supported yet
  87. ***** ^ not supported yet
  88. 46 END;
  89. 47 IOR := ErrNum;
  90. 48 END ErrorCheck;
  91. ***** ^ not supported yet
  92. 49
  93. 50 PROCEDURE IOresult () : CARDINAL;
  94. 51 BEGIN
  95. 52 RETURN IOR;
  96. 53 END IOresult;
  97. ***** ^ not supported yet
  98. 54
  99. 55
  100. 56 PROCEDURE WrBin(F: File; Buf: ARRAY OF BYTE; Count: CARDINAL);
  101. ***** ^ undeclared identifier
  102. ***** ^ undeclared identifier
  103. 57
  104. 58 VAR
  105. 59 NumWrit : CARDINAL;
  106. 60 BEGIN
  107. 61 IOR := 0;
  108. 62 OK := TRUE;
  109. ***** ^ undeclared identifier
  110. 63 IF Count = 0 THEN RETURN END;
  111. 64 NumWrit := Windows._lwrite(F, Buf, Count);
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. ***** ^ not supported yet
  116. ***** ^ not supported yet
  117. 65 IF NumWrit # Count THEN
  118. 66 ErrorCheck(6, 0, 'WrBin : ', Lib.NilStr);
  119. ***** ^ not supported yet
  120. ***** ^ not supported yet
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. 67 OK := FALSE;
  124. ***** ^ undeclared identifier
  125. 68 END;
  126. 69 END WrBin;
  127. ***** ^ not supported yet
  128. 70
  129. 71 PROCEDURE RdBin(F: File; VAR Buf: ARRAY OF BYTE; Count: CARDINAL) : CARDINAL;
  130. ***** ^ undeclared identifier
  131. ***** ^ undeclared identifier
  132. 72 VAR
  133. 73 NumRead: CARDINAL;
  134. 74 BEGIN
  135. 75 IOR := 0;
  136. 76 OK := TRUE;
  137. ***** ^ undeclared identifier
  138. 77 EOF := FALSE;
  139. ***** ^ undeclared identifier
  140. 78 IF Count = 0 THEN RETURN 0 END;
  141. 79 NumRead := Windows._lread(F, Buf, Count);
  142. ***** ^ not supported yet
  143. ***** ^ not supported yet
  144. ***** ^ not supported yet
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. 80 IF NumRead # Count THEN
  148. 81 OK := FALSE;
  149. ***** ^ undeclared identifier
  150. 82 IF NumRead < 0 THEN
  151. 83 ErrorCheck(7, 0, 'RbBin : ', Lib.NilStr);
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. ***** ^ not supported yet
  155. ***** ^ not supported yet
  156. 84 ELSE
  157. 85 EOF := TRUE;
  158. ***** ^ undeclared identifier
  159. 86 END;
  160. 87 END;
  161. 88 RETURN NumRead;
  162. 89 END RdBin;
  163. ***** ^ not supported yet
  164. 90
  165. 91
  166. 92 PROCEDURE GetName(name: ARRAY OF CHAR; VAR fn: PathStr);
  167. ***** ^ not supported yet
  168. 93 (* Makes Null terminated filename, also sets IOR to 0 *)
  169. 94 BEGIN
  170. 95 Str.Copy(fn,name);
  171. ***** ^ undeclared identifier
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. 96 fn[HIGH(fn)] := CHR(0);
  176. ***** ^ not supported yet
  177. ***** ^ undeclared identifier
  178. ***** ^ not supported yet
  179. ***** ^ undeclared identifier
  180. ***** ^ not supported yet
  181. 97 IOR := 0;
  182. 98 END GetName;
  183. ***** ^ not supported yet
  184. 99
  185. 100 PROCEDURE Open(Name: ARRAY OF CHAR) : File;
  186. ***** ^ not supported yet
  187. ***** ^ undeclared identifier
  188. 101 VAR
  189. 102 fn: PathStr;
  190. ***** ^ not supported yet
  191. 103 H: File;
  192. ***** ^ undeclared identifier
  193. 104 BEGIN
  194. 105 GetName(Name,fn);
  195. ***** ^ not supported yet
  196. ***** ^ not supported yet
  197. ***** ^ not supported yet
  198. 106 H := Windows._lopen(fn, Windows.READ_WRITE + INTEGER(ShareMode));
  199. ***** ^ not supported yet
  200. ***** ^ not supported yet
  201. ***** ^ not supported yet
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. ***** ^ not supported yet
  205. ***** ^ undeclared identifier
  206. 107 IF H <> MAX(CARDINAL) THEN
  207. ***** ^ not supported yet
  208. ***** ^ undeclared identifier
  209. ***** ^ not supported yet
  210. 108 CoreFile._openfd[H] := (CoreIO.O_RDWR+CoreIO.O_BINARY);
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. ***** ^ not supported yet
  218. 109 IF CoreIO.isatty(H) # 0 THEN
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. ***** ^ not supported yet
  222. 110 CoreFile._openfd[H] := CoreFile._openfd[H] + CoreIO.O_DEVICE;
  223. ***** ^ not supported yet
  224. ***** ^ not supported yet
  225. ***** ^ not supported yet
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. ***** ^ not supported yet
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. 111 END;
  232. 112 ELSE
  233. 113 ErrorCheck(2, 0, 'Open : ', fn);
  234. ***** ^ not supported yet
  235. ***** ^ not supported yet
  236. ***** ^ not supported yet
  237. 114 END;
  238. 115 RETURN H;
  239. ***** ^ not supported yet
  240. 116 END Open;
  241. ***** ^ not supported yet
  242. 117
  243. 118 PROCEDURE OpenRead( Name: ARRAY OF CHAR) : File;
  244. ***** ^ not supported yet
  245. ***** ^ undeclared identifier
  246. 119 VAR
  247. 120 fn: PathStr;
  248. ***** ^ not supported yet
  249. 121 H: File;
  250. ***** ^ undeclared identifier
  251. 122 BEGIN
  252. 123 GetName(Name,fn);
  253. ***** ^ not supported yet
  254. ***** ^ not supported yet
  255. ***** ^ not supported yet
  256. 124 H := Windows._lopen(fn, Windows.READ + INTEGER(ShareMode));
  257. ***** ^ not supported yet
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. ***** ^ not supported yet
  261. ***** ^ not supported yet
  262. ***** ^ not supported yet
  263. ***** ^ undeclared identifier
  264. 125 IF H <> MAX(CARDINAL) THEN
  265. ***** ^ not supported yet
  266. ***** ^ undeclared identifier
  267. ***** ^ not supported yet
  268. 126 CoreFile._openfd[H] := (CoreIO.O_RDONLY+CoreIO.O_BINARY);
  269. ***** ^ not supported yet
  270. ***** ^ not supported yet
  271. ***** ^ not supported yet
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. ***** ^ not supported yet
  275. ***** ^ not supported yet
  276. 127 IF CoreIO.isatty(H) # 0 THEN
  277. ***** ^ not supported yet
  278. ***** ^ not supported yet
  279. ***** ^ not supported yet
  280. 128 CoreFile._openfd[H] := CoreFile._openfd[H] + CoreIO.O_DEVICE;
  281. ***** ^ not supported yet
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. ***** ^ not supported yet
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. 129 END;
  290. 130 ELSE
  291. 131 ErrorCheck(3, 0, 'OpenRead : ', fn);
  292. ***** ^ not supported yet
  293. ***** ^ not supported yet
  294. ***** ^ not supported yet
  295. 132 END;
  296. 133 RETURN H;
  297. ***** ^ not supported yet
  298. 134 END OpenRead;
  299. ***** ^ not supported yet
  300. 135
  301. 136 PROCEDURE Exists(Name: ARRAY OF CHAR) : BOOLEAN;
  302. ***** ^ not supported yet
  303. 137 VAR
  304. 138 fn : PathStr ;
  305. ***** ^ not supported yet
  306. 139 BEGIN
  307. 140 GetName(Name,fn);
  308. ***** ^ not supported yet
  309. ***** ^ not supported yet
  310. ***** ^ not supported yet
  311. 141 IF CoreIO._exists(fn) # 0 THEN
  312. ***** ^ not supported yet
  313. ***** ^ not supported yet
  314. ***** ^ not supported yet
  315. 142 RETURN TRUE;
  316. 143 END;
  317. 144 RETURN FALSE;
  318. 145 END Exists;
  319. ***** ^ not supported yet
  320. 146
  321. 147 PROCEDURE Create(Name: ARRAY OF CHAR) : File;
  322. ***** ^ not supported yet
  323. ***** ^ undeclared identifier
  324. 148 VAR
  325. 149 fn: PathStr;
  326. ***** ^ not supported yet
  327. 150 H: File;
  328. ***** ^ undeclared identifier
  329. 151 BEGIN
  330. 152 GetName(Name,fn);
  331. ***** ^ not supported yet
  332. ***** ^ not supported yet
  333. ***** ^ not supported yet
  334. 153 H := Windows._lcreat(fn, 0);
  335. ***** ^ not supported yet
  336. ***** ^ not supported yet
  337. ***** ^ not supported yet
  338. ***** ^ not supported yet
  339. ***** ^ not supported yet
  340. 154 IF H <> MAX(CARDINAL) THEN
  341. ***** ^ not supported yet
  342. ***** ^ undeclared identifier
  343. ***** ^ not supported yet
  344. 155 CoreFile._openfd[H] := (CoreIO.O_RDWR+CoreIO.O_BINARY);
  345. ***** ^ not supported yet
  346. ***** ^ not supported yet
  347. ***** ^ not supported yet
  348. ***** ^ not supported yet
  349. ***** ^ not supported yet
  350. ***** ^ not supported yet
  351. ***** ^ not supported yet
  352. 156 ELSE
  353. 157 ErrorCheck(5, 0, 'Create : ', Name);
  354. ***** ^ not supported yet
  355. ***** ^ not supported yet
  356. ***** ^ not supported yet
  357. 158 END;
  358. 159 RETURN H;
  359. ***** ^ not supported yet
  360. 160 END Create;
  361. ***** ^ not supported yet
  362. 161
  363. 162 PROCEDURE Close(F: File);
  364. ***** ^ undeclared identifier
  365. 163 BEGIN
  366. 164 IOR := 0;
  367. 165 IF F < CoreFile._open_max THEN
  368. ***** ^ not supported yet
  369. ***** ^ not supported yet
  370. ***** ^ not supported yet
  371. 166 CoreFile._openfd[F] := {};
  372. ***** ^ not supported yet
  373. ***** ^ not supported yet
  374. ***** ^ not supported yet
  375. ***** ^ not supported yet
  376. 167 END;
  377. 168 IF Windows._lclose(F) = -1 THEN
  378. ***** ^ not supported yet
  379. ***** ^ not supported yet
  380. ***** ^ not supported yet
  381. 169 ErrorCheck(0, 0, 'Close : ', Lib.NilStr);
  382. ***** ^ not supported yet
  383. ***** ^ not supported yet
  384. ***** ^ not supported yet
  385. ***** ^ not supported yet
  386. 170 END;
  387. 171 RETURN;
  388. 172 END Close;
  389. ***** ^ not supported yet
  390. 173
  391. 174 BEGIN
  392. 175 IOR := 0;
  393. 176 OK := TRUE;
  394. ***** ^ undeclared identifier
  395. 177 EOF := FALSE;
  396. ***** ^ undeclared identifier
  397. 178 ShareMode := ShareCompat;
  398. ***** ^ undeclared identifier
  399. ***** ^ undeclared identifier
  400. 179 END WinFIO.
  401. ***** ^ not supported yet
  402. 180
  403. 221 errors