ERRORMAN.LST 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. Listing:
  2. 1 IMPLEMENTATION MODULE ErrorManager;
  3. 2 (*
  4. 3 * REPERTOIRE
  5. 4 * Release 1.6
  6. 5 * By Charles Bradford and Cole Brecheen
  7. 6 * (c) Copyright 1985-1992 PMI
  8. 7 * Green Bay, Wisconsin
  9. 8 * All rights reserved
  10. 9 * (414) 468-6040
  11. 10 *
  12. 11 * $Header: D:/logfiles/mods/errorman.mov 1.8 10 Mar 1991 15:27:10 coleb $
  13. 12 *
  14. 13 *)
  15. 14
  16. 15
  17. 16 IMPORT KbdInput;
  18. 17 IMPORT LowLevel;
  19. 18 IMPORT M2Strings;
  20. 19 IMPORT StrConv;
  21. 20 IMPORT StrEdit;
  22. 21 IMPORT StringIO;
  23. 22 IMPORT SYSTEM;
  24. 23 IMPORT FAPI;
  25. 24 IMPORT VStorage;
  26. 25
  27. 26 VAR
  28. 27 Initialized : BOOLEAN;
  29. 28
  30. 29 CONST
  31. 30 MaxStaticProcs = 8;
  32. 31 TYPE
  33. 32 AProcRecPtr = POINTER TO AProcRec;
  34. ***** ^ undeclared identifier
  35. 33 AProcRec =
  36. 34 RECORD
  37. 35 TheProc: ATermProc;
  38. ***** ^ undeclared identifier
  39. 36 prv: AProcRecPtr;
  40. 37 fromblock: BOOLEAN;
  41. 38 END;
  42. ***** ^ not supported yet
  43. 39
  44. 40 VAR
  45. 41 TermProcStackTop : AProcRecPtr;
  46. ***** ^ not supported yet
  47. 42 TermProcsDoneOnce: BOOLEAN;
  48. 43 (*This keeps us from getting in trouble with recursive calls
  49. 44 to DoTermProcs.*)
  50. 45 ErrorReturn : CARDINAL;
  51. 46 Aborting: BOOLEAN;
  52. 47 (*And this prevents recursive calls to WARN.*)
  53. 48 StaticProcs : ARRAY [1..MaxStaticProcs] OF AProcRec;
  54. ***** ^ not supported yet
  55. ***** ^ not supported yet
  56. 49 (*We have this StaticProcs array because certain Repertoire
  57. 50 modules need to add TermProcs in their initialization
  58. 51 blocks, which are executed before the user tells us where
  59. 52 DOS memory is coming from. We can't allocate new elements
  60. 53 of the TermProcList until we can get memory. *)
  61. 54 ProcCount : CARDINAL;
  62. 55
  63. 56
  64. 57 PROCEDURE CallHalt( TheMessage: ARRAY OF CHAR );
  65. ***** ^ not supported yet
  66. 58 BEGIN
  67. 59 IF Aborting THEN
  68. 60 RETURN
  69. 61 ELSE
  70. 62 Aborting := TRUE;
  71. 63 END;
  72. 64 IF (M2Strings.Length( TheMessage ) > 0) THEN
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. 65 IF NOT AbortConfirmed( TheMessage ) THEN
  77. ***** ^ undeclared identifier
  78. ***** ^ not supported yet
  79. 66 Aborting := FALSE;
  80. 67 RETURN;
  81. 68 END;
  82. 69 END;
  83. 70 DoTermProcs();
  84. ***** ^ undeclared identifier
  85. ***** ^ not supported yet
  86. 71 HALT();
  87. ***** ^ undeclared identifier
  88. ***** ^ not supported yet
  89. 72 END CallHalt;
  90. ***** ^ not supported yet
  91. 73
  92. 74
  93. 75 PROCEDURE DefaultWarnNumber( TheMessage: ARRAY OF CHAR;
  94. ***** ^ not supported yet
  95. 76 TheErrorNum: CARDINAL );
  96. 77 VAR
  97. 78 tmpstr: ARRAY [0..79] OF CHAR;
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. 79 BEGIN
  101. 80 StrConv.CardinalToStr( TheErrorNum, 0, tmpstr );
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. 81 M2Strings.Insert( ' ', tmpstr, 0 );
  106. ***** ^ not supported yet
  107. ***** ^ not supported yet
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. 82 M2Strings.Insert( TheMessage, tmpstr, 0 );
  111. ***** ^ not supported yet
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. ***** ^ not supported yet
  116. 83 WARN( tmpstr );
  117. ***** ^ undeclared identifier
  118. ***** ^ not supported yet
  119. 84 END DefaultWarnNumber;
  120. ***** ^ not supported yet
  121. 85
  122. 86 PROCEDURE StraightToDOS( TheMessage: ARRAY OF CHAR );
  123. ***** ^ not supported yet
  124. 87 BEGIN
  125. 88 IF Aborting THEN
  126. 89 RETURN
  127. 90 ELSE
  128. 91 Aborting := TRUE;
  129. 92 END;
  130. 93 IF (M2Strings.Length( TheMessage ) > 0) THEN
  131. ***** ^ not supported yet
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. 94 IF NOT AbortConfirmed( TheMessage ) THEN
  135. ***** ^ undeclared identifier
  136. ***** ^ not supported yet
  137. 95 Aborting := FALSE;
  138. 96 RETURN;
  139. 97 END;
  140. 98 END;
  141. 99 DoTermProcs();
  142. ***** ^ undeclared identifier
  143. ***** ^ not supported yet
  144. 100 FAPI.DOSEXIT(0, 0);
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. 101 END StraightToDOS;
  149. ***** ^ not supported yet
  150. 102
  151. 103
  152. 104 PROCEDURE DoTermProcs();
  153. 105 VAR
  154. 106 LocalProcRecPtr: AProcRecPtr;
  155. ***** ^ not supported yet
  156. 107 count : CARDINAL;
  157. 108 BEGIN
  158. 109 IF TermProcsDoneOnce OR (TermProcStackTop = NIL) THEN
  159. ***** ^ not supported yet
  160. 110 RETURN
  161. 111 ELSE
  162. 112 TermProcsDoneOnce := TRUE;
  163. 113 END;
  164. 114 LocalProcRecPtr := TermProcStackTop;
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. 115 WHILE LocalProcRecPtr # NIL DO
  168. ***** ^ not supported yet
  169. 116 LocalProcRecPtr^.TheProc();
  170. ***** ^ not supported yet
  171. ***** ^ not supported yet
  172. ***** ^ not supported yet
  173. 117 LocalProcRecPtr := LocalProcRecPtr^.prv;
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. ***** ^ not supported yet
  177. 118 (* We don't attempt to deallocate the TermProc list as
  178. 119 we go, because it's about to be released to the
  179. 120 operating system anyway. *)
  180. 121 END;
  181. 122 END DoTermProcs;
  182. ***** ^ not supported yet
  183. 123
  184. 124
  185. 125 PROCEDURE AddTermProc( TheTermProc: ATermProc );
  186. ***** ^ undeclared identifier
  187. 126 VAR
  188. 127 LocalProcRecPtr: AProcRecPtr;
  189. ***** ^ not supported yet
  190. 128 (* Although it may look like a mistake for this to be local,
  191. 129 the object to which it points will be on the heap, and
  192. 130 that's what we're adding to the TermProcStack, not the
  193. 131 pointer itself. *)
  194. 132 BEGIN
  195. 133 INC(ProcCount);
  196. ***** ^ undeclared identifier
  197. ***** ^ not supported yet
  198. 134 IF ProcCount <= MaxStaticProcs THEN
  199. 135 StaticProcs[ ProcCount ].TheProc := TheTermProc;
  200. ***** ^ not supported yet
  201. ***** ^ not supported yet
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. 136 LocalProcRecPtr := SYSTEM.ADR(StaticProcs[ ProcCount ]);
  205. ***** ^ not supported yet
  206. ***** ^ not supported yet
  207. ***** ^ not supported yet
  208. ***** ^ not supported yet
  209. ***** ^ not supported yet
  210. 137 LocalProcRecPtr^.fromblock := TRUE;
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. 138 ELSE
  214. 139 VStorage.DosAlloc( LocalProcRecPtr, SYSTEM.TSIZE(AProcRec) );
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. ***** ^ not supported yet
  218. ***** ^ not supported yet
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. 140 LocalProcRecPtr^.fromblock := FALSE;
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. 141 END;
  225. 142 LocalProcRecPtr^.TheProc := TheTermProc;
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. ***** ^ not supported yet
  229. 143 LocalProcRecPtr^.prv := TermProcStackTop;
  230. ***** ^ not supported yet
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. 144 TermProcStackTop := LocalProcRecPtr;
  234. ***** ^ not supported yet
  235. ***** ^ not supported yet
  236. 145 END AddTermProc;
  237. ***** ^ not supported yet
  238. 146
  239. 147
  240. 148 PROCEDURE RemoveTermProc(TheTermProc: ATermProc);
  241. ***** ^ undeclared identifier
  242. 149 VAR
  243. 150 LocalProcRecPtr, nxt: AProcRecPtr;
  244. ***** ^ not supported yet
  245. 151 BEGIN
  246. 152 LocalProcRecPtr := TermProcStackTop;
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. 153 nxt := NIL;
  250. ***** ^ not supported yet
  251. 154 WHILE (LocalProcRecPtr # NIL) AND
  252. ***** ^ not supported yet
  253. 155 (SYSTEM.ADDRESS(LocalProcRecPtr^.TheProc) #
  254. ***** ^ not supported yet
  255. ***** ^ not supported yet
  256. ***** ^ not supported yet
  257. ***** ^ not supported yet
  258. 156 SYSTEM.ADDRESS(TheTermProc)) DO
  259. ***** ^ not supported yet
  260. ***** ^ not supported yet
  261. ***** ^ not supported yet
  262. 157 nxt := LocalProcRecPtr;
  263. ***** ^ not supported yet
  264. ***** ^ not supported yet
  265. 158 LocalProcRecPtr := LocalProcRecPtr^.prv;
  266. ***** ^ not supported yet
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. 159 END;
  270. 160 IF LocalProcRecPtr = NIL THEN
  271. ***** ^ not supported yet
  272. 161 RETURN;
  273. 162 END;
  274. 163 IF (LocalProcRecPtr = TermProcStackTop) THEN
  275. ***** ^ not supported yet
  276. ***** ^ not supported yet
  277. 164 TermProcStackTop := LocalProcRecPtr^.prv;
  278. ***** ^ not supported yet
  279. ***** ^ not supported yet
  280. ***** ^ not supported yet
  281. 165 END;
  282. 166 IF nxt # NIL THEN
  283. ***** ^ not supported yet
  284. 167 nxt^.prv := LocalProcRecPtr^.prv;
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. 168 END;
  290. 169 LocalProcRecPtr^.prv := NIL;
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. 170 LocalProcRecPtr^.TheProc := ATermProc(NIL);
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. ***** ^ undeclared identifier
  297. ***** ^ not supported yet
  298. 171 IF NOT LocalProcRecPtr^.fromblock THEN
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. 172 VStorage.DosDealloc( LocalProcRecPtr, SYSTEM.TSIZE(AProcRec) );
  302. ***** ^ not supported yet
  303. ***** ^ not supported yet
  304. ***** ^ not supported yet
  305. ***** ^ not supported yet
  306. ***** ^ not supported yet
  307. ***** ^ not supported yet
  308. 173 END;
  309. 174 END RemoveTermProc;
  310. ***** ^ not supported yet
  311. 175
  312. 176
  313. 177 PROCEDURE DefaultConfirm( TheMessage: ARRAY OF CHAR ): BOOLEAN;
  314. ***** ^ not supported yet
  315. 178 VAR
  316. 179 dummy: ARRAY [0..255] OF CHAR;
  317. ***** ^ not supported yet
  318. ***** ^ not supported yet
  319. 180 BEGIN
  320. 181 M2Strings.Assign( TheMessage, dummy );
  321. ***** ^ not supported yet
  322. ***** ^ not supported yet
  323. ***** ^ not supported yet
  324. ***** ^ not supported yet
  325. 182 StrEdit.Append( dummy, '. Press C to continue, anything else to abort.' );
  326. ***** ^ not supported yet
  327. ***** ^ not supported yet
  328. ***** ^ not supported yet
  329. ***** ^ not supported yet
  330. 183 StringIO.WriteEol( StringIO.ErrorOutp, '' );
  331. ***** ^ not supported yet
  332. ***** ^ not supported yet
  333. ***** ^ not supported yet
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. 184 StringIO.WriteEol( StringIO.ErrorOutp, dummy );
  337. ***** ^ not supported yet
  338. ***** ^ not supported yet
  339. ***** ^ not supported yet
  340. ***** ^ not supported yet
  341. ***** ^ not supported yet
  342. 185 RETURN KbdInput.CAPkey( KbdInput.KeyHit(KbdInput.AnyKeyNum) ) # ORD('C');
  343. ***** ^ not supported yet
  344. ***** ^ not supported yet
  345. ***** ^ not supported yet
  346. ***** ^ not supported yet
  347. ***** ^ not supported yet
  348. ***** ^ not supported yet
  349. ***** ^ undeclared identifier
  350. ***** ^ not supported yet
  351. 186 END DefaultConfirm;
  352. ***** ^ not supported yet
  353. 187
  354. 188
  355. 189 PROCEDURE InitStatProcs();
  356. 190 (* Initialize the StaticProcs array. *)
  357. 191 VAR
  358. 192 i: CARDINAL;
  359. 193 BEGIN
  360. 194 FOR i := 1 TO (MaxStaticProcs - 1) DO
  361. 195 StaticProcs[i].prv := SYSTEM.ADR(StaticProcs[i+1]);
  362. ***** ^ not supported yet
  363. ***** ^ not supported yet
  364. ***** ^ not supported yet
  365. ***** ^ not supported yet
  366. ***** ^ not supported yet
  367. ***** ^ not supported yet
  368. ***** ^ not supported yet
  369. 196 StaticProcs[i].fromblock := TRUE;
  370. ***** ^ not supported yet
  371. ***** ^ not supported yet
  372. ***** ^ not supported yet
  373. 197 StaticProcs[i].TheProc := ATermProc(NIL);
  374. ***** ^ not supported yet
  375. ***** ^ not supported yet
  376. ***** ^ not supported yet
  377. ***** ^ undeclared identifier
  378. ***** ^ not supported yet
  379. 198 END;
  380. 199 StaticProcs[MaxStaticProcs].prv := NIL;
  381. ***** ^ not supported yet
  382. ***** ^ not supported yet
  383. ***** ^ not supported yet
  384. 200 StaticProcs[MaxStaticProcs].fromblock := TRUE;
  385. ***** ^ not supported yet
  386. ***** ^ not supported yet
  387. ***** ^ not supported yet
  388. 201 StaticProcs[MaxStaticProcs].TheProc := ATermProc(NIL);
  389. ***** ^ not supported yet
  390. ***** ^ not supported yet
  391. ***** ^ not supported yet
  392. ***** ^ undeclared identifier
  393. ***** ^ not supported yet
  394. 202 END InitStatProcs;
  395. ***** ^ not supported yet
  396. 203
  397. 204
  398. 205 PROCEDURE Init();
  399. 206 BEGIN
  400. 207 IF Initialized THEN
  401. 208 RETURN;
  402. 209 ELSE
  403. 210 Initialized := TRUE;
  404. 211 END;
  405. 212 KbdInput.Init();
  406. ***** ^ not supported yet
  407. ***** ^ not supported yet
  408. ***** ^ not supported yet
  409. 213 LowLevel.Init();
  410. ***** ^ not supported yet
  411. ***** ^ not supported yet
  412. ***** ^ not supported yet
  413. 214 M2Strings.Init();
  414. ***** ^ not supported yet
  415. ***** ^ not supported yet
  416. ***** ^ not supported yet
  417. 215 StrConv.Init();
  418. ***** ^ not supported yet
  419. ***** ^ not supported yet
  420. ***** ^ not supported yet
  421. 216 StrEdit.Init();
  422. ***** ^ not supported yet
  423. ***** ^ not supported yet
  424. ***** ^ not supported yet
  425. 217 StringIO.Init();
  426. ***** ^ not supported yet
  427. ***** ^ not supported yet
  428. ***** ^ not supported yet
  429. 218 VStorage.Init();
  430. ***** ^ not supported yet
  431. ***** ^ not supported yet
  432. ***** ^ not supported yet
  433. 219
  434. 220 KbdInput.Init();
  435. ***** ^ not supported yet
  436. ***** ^ not supported yet
  437. ***** ^ not supported yet
  438. 221 Aborting := FALSE;
  439. 222 TermProcStackTop := NIL;
  440. ***** ^ not supported yet
  441. 223 TermProcsDoneOnce := FALSE;
  442. 224 WARN := CallHalt;
  443. ***** ^ undeclared identifier
  444. ***** ^ not supported yet
  445. 225 WarnNumber := DefaultWarnNumber;
  446. ***** ^ undeclared identifier
  447. ***** ^ not supported yet
  448. 226 AbortConfirmed := DefaultConfirm;
  449. ***** ^ undeclared identifier
  450. ***** ^ not supported yet
  451. 227 ProcCount := 0;
  452. 228 InitStatProcs();
  453. ***** ^ not supported yet
  454. ***** ^ not supported yet
  455. 229 END Init;
  456. ***** ^ not supported yet
  457. 230
  458. 231
  459. 232 BEGIN
  460. 233 Initialized := FALSE;
  461. 234 Init();
  462. ***** ^ not supported yet
  463. ***** ^ not supported yet
  464. 235 END ErrorManager.
  465. ***** ^ not supported yet
  466. 229 errors