| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470 |
- Listing:
- 1 IMPLEMENTATION MODULE ErrorManager;
- 2 (*
- 3 * REPERTOIRE
- 4 * Release 1.6
- 5 * By Charles Bradford and Cole Brecheen
- 6 * (c) Copyright 1985-1992 PMI
- 7 * Green Bay, Wisconsin
- 8 * All rights reserved
- 9 * (414) 468-6040
- 10 *
- 11 * $Header: D:/logfiles/mods/errorman.mov 1.8 10 Mar 1991 15:27:10 coleb $
- 12 *
- 13 *)
- 14
- 15
- 16 IMPORT KbdInput;
- 17 IMPORT LowLevel;
- 18 IMPORT M2Strings;
- 19 IMPORT StrConv;
- 20 IMPORT StrEdit;
- 21 IMPORT StringIO;
- 22 IMPORT SYSTEM;
- 23 IMPORT FAPI;
- 24 IMPORT VStorage;
- 25
- 26 VAR
- 27 Initialized : BOOLEAN;
- 28
- 29 CONST
- 30 MaxStaticProcs = 8;
- 31 TYPE
- 32 AProcRecPtr = POINTER TO AProcRec;
- ***** ^ undeclared identifier
- 33 AProcRec =
- 34 RECORD
- 35 TheProc: ATermProc;
- ***** ^ undeclared identifier
- 36 prv: AProcRecPtr;
- 37 fromblock: BOOLEAN;
- 38 END;
- ***** ^ not supported yet
- 39
- 40 VAR
- 41 TermProcStackTop : AProcRecPtr;
- ***** ^ not supported yet
- 42 TermProcsDoneOnce: BOOLEAN;
- 43 (*This keeps us from getting in trouble with recursive calls
- 44 to DoTermProcs.*)
- 45 ErrorReturn : CARDINAL;
- 46 Aborting: BOOLEAN;
- 47 (*And this prevents recursive calls to WARN.*)
- 48 StaticProcs : ARRAY [1..MaxStaticProcs] OF AProcRec;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 49 (*We have this StaticProcs array because certain Repertoire
- 50 modules need to add TermProcs in their initialization
- 51 blocks, which are executed before the user tells us where
- 52 DOS memory is coming from. We can't allocate new elements
- 53 of the TermProcList until we can get memory. *)
- 54 ProcCount : CARDINAL;
- 55
- 56
- 57 PROCEDURE CallHalt( TheMessage: ARRAY OF CHAR );
- ***** ^ not supported yet
- 58 BEGIN
- 59 IF Aborting THEN
- 60 RETURN
- 61 ELSE
- 62 Aborting := TRUE;
- 63 END;
- 64 IF (M2Strings.Length( TheMessage ) > 0) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 65 IF NOT AbortConfirmed( TheMessage ) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 66 Aborting := FALSE;
- 67 RETURN;
- 68 END;
- 69 END;
- 70 DoTermProcs();
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 71 HALT();
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 72 END CallHalt;
- ***** ^ not supported yet
- 73
- 74
- 75 PROCEDURE DefaultWarnNumber( TheMessage: ARRAY OF CHAR;
- ***** ^ not supported yet
- 76 TheErrorNum: CARDINAL );
- 77 VAR
- 78 tmpstr: ARRAY [0..79] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 79 BEGIN
- 80 StrConv.CardinalToStr( TheErrorNum, 0, tmpstr );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 81 M2Strings.Insert( ' ', tmpstr, 0 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 82 M2Strings.Insert( TheMessage, tmpstr, 0 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 83 WARN( tmpstr );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 84 END DefaultWarnNumber;
- ***** ^ not supported yet
- 85
- 86 PROCEDURE StraightToDOS( TheMessage: ARRAY OF CHAR );
- ***** ^ not supported yet
- 87 BEGIN
- 88 IF Aborting THEN
- 89 RETURN
- 90 ELSE
- 91 Aborting := TRUE;
- 92 END;
- 93 IF (M2Strings.Length( TheMessage ) > 0) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 94 IF NOT AbortConfirmed( TheMessage ) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 95 Aborting := FALSE;
- 96 RETURN;
- 97 END;
- 98 END;
- 99 DoTermProcs();
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 100 FAPI.DOSEXIT(0, 0);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 101 END StraightToDOS;
- ***** ^ not supported yet
- 102
- 103
- 104 PROCEDURE DoTermProcs();
- 105 VAR
- 106 LocalProcRecPtr: AProcRecPtr;
- ***** ^ not supported yet
- 107 count : CARDINAL;
- 108 BEGIN
- 109 IF TermProcsDoneOnce OR (TermProcStackTop = NIL) THEN
- ***** ^ not supported yet
- 110 RETURN
- 111 ELSE
- 112 TermProcsDoneOnce := TRUE;
- 113 END;
- 114 LocalProcRecPtr := TermProcStackTop;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 115 WHILE LocalProcRecPtr # NIL DO
- ***** ^ not supported yet
- 116 LocalProcRecPtr^.TheProc();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 117 LocalProcRecPtr := LocalProcRecPtr^.prv;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 118 (* We don't attempt to deallocate the TermProc list as
- 119 we go, because it's about to be released to the
- 120 operating system anyway. *)
- 121 END;
- 122 END DoTermProcs;
- ***** ^ not supported yet
- 123
- 124
- 125 PROCEDURE AddTermProc( TheTermProc: ATermProc );
- ***** ^ undeclared identifier
- 126 VAR
- 127 LocalProcRecPtr: AProcRecPtr;
- ***** ^ not supported yet
- 128 (* Although it may look like a mistake for this to be local,
- 129 the object to which it points will be on the heap, and
- 130 that's what we're adding to the TermProcStack, not the
- 131 pointer itself. *)
- 132 BEGIN
- 133 INC(ProcCount);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 134 IF ProcCount <= MaxStaticProcs THEN
- 135 StaticProcs[ ProcCount ].TheProc := TheTermProc;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 136 LocalProcRecPtr := SYSTEM.ADR(StaticProcs[ ProcCount ]);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 137 LocalProcRecPtr^.fromblock := TRUE;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 138 ELSE
- 139 VStorage.DosAlloc( LocalProcRecPtr, SYSTEM.TSIZE(AProcRec) );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 140 LocalProcRecPtr^.fromblock := FALSE;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 141 END;
- 142 LocalProcRecPtr^.TheProc := TheTermProc;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 143 LocalProcRecPtr^.prv := TermProcStackTop;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 144 TermProcStackTop := LocalProcRecPtr;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 145 END AddTermProc;
- ***** ^ not supported yet
- 146
- 147
- 148 PROCEDURE RemoveTermProc(TheTermProc: ATermProc);
- ***** ^ undeclared identifier
- 149 VAR
- 150 LocalProcRecPtr, nxt: AProcRecPtr;
- ***** ^ not supported yet
- 151 BEGIN
- 152 LocalProcRecPtr := TermProcStackTop;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 153 nxt := NIL;
- ***** ^ not supported yet
- 154 WHILE (LocalProcRecPtr # NIL) AND
- ***** ^ not supported yet
- 155 (SYSTEM.ADDRESS(LocalProcRecPtr^.TheProc) #
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 156 SYSTEM.ADDRESS(TheTermProc)) DO
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 157 nxt := LocalProcRecPtr;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 158 LocalProcRecPtr := LocalProcRecPtr^.prv;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 159 END;
- 160 IF LocalProcRecPtr = NIL THEN
- ***** ^ not supported yet
- 161 RETURN;
- 162 END;
- 163 IF (LocalProcRecPtr = TermProcStackTop) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 164 TermProcStackTop := LocalProcRecPtr^.prv;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 165 END;
- 166 IF nxt # NIL THEN
- ***** ^ not supported yet
- 167 nxt^.prv := LocalProcRecPtr^.prv;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 168 END;
- 169 LocalProcRecPtr^.prv := NIL;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 170 LocalProcRecPtr^.TheProc := ATermProc(NIL);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 171 IF NOT LocalProcRecPtr^.fromblock THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 172 VStorage.DosDealloc( LocalProcRecPtr, SYSTEM.TSIZE(AProcRec) );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 173 END;
- 174 END RemoveTermProc;
- ***** ^ not supported yet
- 175
- 176
- 177 PROCEDURE DefaultConfirm( TheMessage: ARRAY OF CHAR ): BOOLEAN;
- ***** ^ not supported yet
- 178 VAR
- 179 dummy: ARRAY [0..255] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 180 BEGIN
- 181 M2Strings.Assign( TheMessage, dummy );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 182 StrEdit.Append( dummy, '. Press C to continue, anything else to abort.' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 183 StringIO.WriteEol( StringIO.ErrorOutp, '' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 184 StringIO.WriteEol( StringIO.ErrorOutp, dummy );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 185 RETURN KbdInput.CAPkey( KbdInput.KeyHit(KbdInput.AnyKeyNum) ) # ORD('C');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 186 END DefaultConfirm;
- ***** ^ not supported yet
- 187
- 188
- 189 PROCEDURE InitStatProcs();
- 190 (* Initialize the StaticProcs array. *)
- 191 VAR
- 192 i: CARDINAL;
- 193 BEGIN
- 194 FOR i := 1 TO (MaxStaticProcs - 1) DO
- 195 StaticProcs[i].prv := SYSTEM.ADR(StaticProcs[i+1]);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 196 StaticProcs[i].fromblock := TRUE;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 197 StaticProcs[i].TheProc := ATermProc(NIL);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 198 END;
- 199 StaticProcs[MaxStaticProcs].prv := NIL;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 200 StaticProcs[MaxStaticProcs].fromblock := TRUE;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 201 StaticProcs[MaxStaticProcs].TheProc := ATermProc(NIL);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 202 END InitStatProcs;
- ***** ^ not supported yet
- 203
- 204
- 205 PROCEDURE Init();
- 206 BEGIN
- 207 IF Initialized THEN
- 208 RETURN;
- 209 ELSE
- 210 Initialized := TRUE;
- 211 END;
- 212 KbdInput.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 213 LowLevel.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 214 M2Strings.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 215 StrConv.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 216 StrEdit.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 217 StringIO.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 218 VStorage.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 219
- 220 KbdInput.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 221 Aborting := FALSE;
- 222 TermProcStackTop := NIL;
- ***** ^ not supported yet
- 223 TermProcsDoneOnce := FALSE;
- 224 WARN := CallHalt;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 225 WarnNumber := DefaultWarnNumber;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 226 AbortConfirmed := DefaultConfirm;
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 227 ProcCount := 0;
- 228 InitStatProcs();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 229 END Init;
- ***** ^ not supported yet
- 230
- 231
- 232 BEGIN
- 233 Initialized := FALSE;
- 234 Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 235 END ErrorManager.
- ***** ^ not supported yet
- 229 errors
|