| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776 |
- Listing:
- 1 (* Release 3.10 *)
- 2 (*-------------------------------------------------------------------------*
- 3 * *
- 4 * PROCESS.MOD - Multi-process support *
- 5 * *
- 6 * COPYRIGHT (C) 1987..1992 Clarion Software Corporation. *
- 7 * All Rights Reserved *
- 8 * *
- 9 *--------------------------------------------------------------------------*)
- 10
- 11 (*# call(seg_name => PROCESS) *)
- 12 (*# module(implementation=>off) *)
- 13 (*# check(stack=>off,
- 14 index=>off,
- 15 range=>off,
- 16 overflow=>off,
- 17 nil_ptr=>off) *)
- 18 (*# call(o_a_copy=>off) *)
- 19
- 20
- 21 IMPLEMENTATION MODULE Process;
- 22
- 23 (*%F _OS2 *)
- 24 FROM Storage IMPORT ALLOCATE;
- 25 IMPORT SYSTEM, Storage, Lib, CoreSig, CoreProc;
- 26
- 27 TYPE
- 28
- 29 SIGNAL = POINTER TO SigRec;
- 30
- 31
- 32 (* change to task descriptor *)
- 33
- 34 SigRec = RECORD
- 35 count : INTEGER;
- 36 waiting : CoreProc.Task;
- 37 END;
- 38
- 39
- 40 PROCEDURE QInsert(T: CoreProc.Task; VAR Q: CoreProc.Task);
- 41 (* inserts task after last task in Q with greater or equal priority *)
- 42 VAR
- 43 q,qb : CoreProc.Task;
- 44 BEGIN
- 45 q := Q;
- 46 qb := NIL;
- 47 WHILE (q<>NIL)AND(T^.priority<=q^.priority) DO
- 48 qb := q;
- 49 q := q^.next;
- 50 END;
- 51 IF qb=NIL THEN
- 52 Q := T;
- 53 ELSE
- 54 qb^.next := T;
- 55 END;
- 56 T^.next := q;
- 57 END QInsert;
- 58
- 59
- 60 PROCEDURE AddReadyProcess(T: CoreProc.Task);
- 61 (* adds new process to ready list
- 62 NB gets added ahead of current process if at same priority
- 63 *)
- 64 VAR
- 65 mp : SYSTEM.PROCESS;
- 66 oldcp : CoreProc.Task;
- 67 ie : CARDINAL;
- 68 BEGIN
- 69 ie := SYSTEM.GetFlags(); SYSTEM.DI;
- 70 IF CoreProc._cp=NIL THEN
- 71 QInsert(T,CoreProc._cp); (* add new process *)
- 72 ELSE
- 73 oldcp := CoreProc._cp; (* remove current process *)
- 74 CoreProc._cp := CoreProc._cp^.next;
- 75 QInsert(T,CoreProc._cp); (* add new process *)
- 76 QInsert(oldcp,CoreProc._cp); (* add current process *)
- 77 END;
- 78 mp := CoreProc._cp^.cor;
- 79 SYSTEM.TRANSFER (mp,mp);
- 80 SYSTEM.SetFlags(ie);
- 81 END AddReadyProcess;
- 82
- 83
- 84
- 85 PROCEDURE StartProcess(P:PROC;N,Pr:CARDINAL);
- 86 VAR
- 87 np : CoreProc.Task;
- 88 BEGIN
- 89 INC(Pr);
- 90 IF N < 32000 THEN
- 91 INC(N, 512); (* FP Overhead *)
- 92 END; (*IF*)
- 93 Storage.ALLOCATE(np,SIZE(CoreProc.TaskDescriptor));
- 94 Storage.ALLOCATE(np^.wsp,N);
- 95 np^.priority := Pr;
- 96 np^.wspsize := N;
- 97 SYSTEM.NEWPROCESS(P,np^.wsp,N,np^.cor);
- 98 AddReadyProcess(np);
- 99 END StartProcess;
- 100
- 101 (* new stop me procedure *)
- 102
- 103 PROCEDURE StopProcess;
- 104 VAR
- 105 t0 : CoreProc.Task;
- 106 mp : SYSTEM.PROCESS;
- 107 ie : CARDINAL;
- 108 BEGIN
- 109 CoreProc._ProcIds[CoreProc._getTID()-1] := 0;
- 110 ie := SYSTEM.GetFlags(); SYSTEM.DI;
- 111 t0 := CoreProc._cp ;
- 112 CoreProc._cp := CoreProc._cp^.next;
- 113 Storage.DEALLOCATE(t0^.wsp,t0^.wspsize);
- 114 Storage.DEALLOCATE(t0,SIZE(CoreProc.TaskDescriptor));
- 115 mp := CoreProc._cp^.cor;
- 116 SYSTEM.TRANSFER (mp,mp);
- 117 SYSTEM.SetFlags(ie);
- 118 END StopProcess;
- 119
- 120
- 121
- 122 PROCEDURE SEND(s: SIGNAL);
- 123 VAR
- 124 t0 : CoreProc.Task;
- 125 ie : CARDINAL;
- 126 BEGIN
- 127 ie := SYSTEM.GetFlags(); SYSTEM.DI;
- 128 IF s^.count <> MAX(INTEGER) THEN
- 129 INC(s^.count);
- 130 IF s^.count <= 0 THEN (* somebody waiting *)
- 131 t0 := s^.waiting;
- 132 s^.waiting := t0^.next;
- 133 AddReadyProcess(t0);
- 134 END;
- 135 END;
- 136 SYSTEM.SetFlags(ie);
- 137 END SEND;
- 138
- 139
- 140 PROCEDURE Notify(s: SIGNAL);
- 141 VAR
- 142 t0 : CoreProc.Task;
- 143 ie : CARDINAL;
- 144 BEGIN
- 145 ie := SYSTEM.GetFlags(); SYSTEM.DI;
- 146 IF s^.count < 0 THEN (* somebody waiting *)
- 147 INC(s^.count);
- 148 t0 := s^.waiting;
- 149 s^.waiting := t0^.next;
- 150 (* add to waiting q *)
- 151 t0^.nextdue := CoreProc._wq;
- 152 CoreProc._wq := t0;
- 153 END;
- 154 SYSTEM.SetFlags(ie);
- 155 END Notify;
- 156
- 157
- 158 PROCEDURE WAIT (s: SIGNAL);
- 159 VAR
- 160 t0 : CoreProc.Task;
- 161 mp : SYSTEM.PROCESS;
- 162 ie : CARDINAL;
- 163 BEGIN (* insert CoreProc._cp in queue s *)
- 164 ie := SYSTEM.GetFlags(); SYSTEM.DI;
- 165 DEC(s^.count);
- 166 IF s^.count < 0 THEN (* wait *)
- 167 t0 := CoreProc._cp;
- 168 CoreProc._cp := CoreProc._cp^.next;
- 169 QInsert(t0,s^.waiting);
- 170 mp := CoreProc._cp^.cor;
- 171 SYSTEM.TRANSFER (mp,mp);
- 172 END;
- 173 SYSTEM.SetFlags(ie);
- 174 END WAIT;
- 175
- 176 PROCEDURE Awaited(s: SIGNAL) : BOOLEAN;
- 177 BEGIN
- 178 RETURN (s^.count<0);
- 179 END Awaited;
- 180
- 181
- 182 PROCEDURE Init(VAR s: SIGNAL);
- 183 BEGIN
- 184 NEW(s);
- 185 s^.waiting := NIL;
- 186 s^.count := 0;
- 187 END Init;
- 188
- 189
- 190 PROCEDURE CheckTimeQ;
- 191 VAR
- 192 ta,tb,tn : CoreProc.Task;
- 193 BEGIN
- 194 ta := CoreProc._dq;
- 195 tb := NIL;
- 196 WHILE ta <> NIL DO
- 197 tn := ta^.nextdue;
- 198 IF ta^.due = CoreProc._SchedTime THEN
- 199 IF tb = NIL THEN CoreProc._dq := tn ELSE tb^.nextdue := tn END;
- 200 ta^.nextdue := CoreProc._wq;
- 201 CoreProc._wq := ta;
- 202 ELSE
- 203 tb := ta;
- 204 END;
- 205 ta := tn;
- 206 END;
- 207 END CheckTimeQ;
- 208
- 209 PROCEDURE Slice;
- 210 (* Clears waiting queue *)
- 211 (* Then schedules next ready process if it is of equal priority *)
- 212 VAR
- 213 nextt,oldt,ta : CoreProc.Task;
- 214 BEGIN
- 215 IF CoreProc._LockNestMonster = 0 THEN
- 216 (* move waiting queue to the ready queue *)
- 217 (* set up by CheckTimeQueue *)
- 218 WHILE CoreProc._wq <> NIL DO
- 219 ta := CoreProc._wq; CoreProc._wq := CoreProc._wq^.nextdue;
- 220 QInsert(ta,CoreProc._cp);
- 221 END;
- 222 (* now do slice *)
- 223 nextt := CoreProc._cp^.next;
- 224 IF (nextt <> NIL) AND (nextt^.priority = CoreProc._cp^.priority) THEN (* slice *)
- 225 oldt := CoreProc._cp; CoreProc._cp := nextt;
- 226 QInsert(oldt,CoreProc._cp); (* insert old CoreProc._cp at end of processes *)
- 227 END;
- 228 END;
- 229 END Slice;
- 230
- 231
- 232 MODULE SS[1]; (* IRQ 1: timer interrupt *)
- 233
- 234 IMPORT SYSTEM;
- 235 IMPORT CoreProc,Slice,CheckTimeQ;
- 236 EXPORT Scheduler;
- 237
- 238
- 239 PROCEDURE Scheduler;
- 240 VAR
- 241 nextt,
- 242 oldt : CoreProc.Task;
- 243 op,np : SYSTEM.PROCESS;
- 244 Int8 : PROC;
- 245
- 246 TYPE
- 247 code = ARRAY[0..2] OF SHORTCARD;
- 248
- 249 CONST
- 250 Int8code = code(0CDH,08H,0CBH); (* INT 08H / RETF *)
- 251
- 252 BEGIN
- 253 SYSTEM.DI;
- 254 Int8 := PROC(ADR(Int8code));
- 255 CoreProc.Stop := FALSE;
- 256 CoreProc._SchedTime := 0;
- 257 LOOP
- 258 np := CoreProc._cp^.cor;
- 259 LOOP
- 260 SYSTEM.IOTRANSFER(op,np,8);
- 261 Int8;
- 262 INC(CoreProc._SchedTime);
- 263 IF CoreProc.Stop THEN EXIT END;
- 264 CheckTimeQ;
- 265 Slice;
- 266 np := CoreProc._cp^.cor;
- 267 END;
- 268 CoreProc.Stop := FALSE;
- 269 SYSTEM.TRANSFER(op,np); (* no return until restarted *)
- 270 END;
- 271 END Scheduler;
- 272
- 273
- 274 END SS;
- 275
- 276
- 277 PROCEDURE Idler; (* always on CoreProc._cp chain *)
- 278 VAR
- 279 i : CARDINAL;
- 280 BEGIN
- 281 LOOP INC(i);
- 282 END;
- 283 END Idler;
- 284
- 285 PROCEDURE StartScheduler;
- 286 VAR
- 287 ie : CARDINAL;
- 288 BEGIN
- 289 ie := SYSTEM.GetFlags(); SYSTEM.DI;
- 290 IF NOT CoreProc._Started THEN
- 291 CoreProc._Started := TRUE;
- 292 IF CoreProc._SchedStack = NIL THEN (* first time *)
- 293 Storage.ALLOCATE( CoreProc._SchedStack, 1024 );
- 294 SYSTEM.NEWPROCESS( Scheduler, CoreProc._SchedStack, 1024, CoreProc._SchedProc );
- 295 END;
- 296 SYSTEM.TRANSFER( CoreProc._cp^.cor, CoreProc._SchedProc );
- 297 END;
- 298 SYSTEM.SetFlags(ie);
- 299 END StartScheduler;
- 300
- 301 PROCEDURE StopScheduler;
- 302 VAR
- 303 ie : CARDINAL;
- 304 BEGIN
- 305 ie := SYSTEM.GetFlags();
- 306 IF CoreProc._Started THEN
- 307 SYSTEM.EI ;
- 308 CoreProc._Started := FALSE;
- 309 CoreProc.Stop := TRUE;
- 310 WHILE CoreProc.Stop DO END;
- 311 END;
- 312 SYSTEM.SetFlags(ie);
- 313 END StopScheduler;
- 314
- 315 PROCEDURE Delay(T: CARDINAL);
- 316 (* Waits T time slices *)
- 317 (* 0 will swap to next process of equal priority, without delaying *)
- 318 VAR
- 319 mp : SYSTEM.PROCESS;
- 320 ie : CARDINAL;
- 321 BEGIN
- 322 IF NOT CoreProc._Started THEN RETURN END;
- 323 ie := SYSTEM.GetFlags(); SYSTEM.DI;
- 324 IF T = 0 THEN
- 325 mp := CoreProc._cp^.cor;
- 326 Slice;
- 327 IF mp = CoreProc._cp^.cor THEN
- 328 SYSTEM.SetFlags(ie);
- 329 RETURN
- 330 END; (* no other processes ready *)
- 331 ELSE
- 332 CoreProc._cp^.due := CoreProc._SchedTime + T;
- 333 CoreProc._cp^.nextdue := CoreProc._dq;
- 334 CoreProc._dq := CoreProc._cp;
- 335 CoreProc._cp := CoreProc._cp^.next;
- 336 END;
- 337 mp := CoreProc._cp^.cor;
- 338 SYSTEM.TRANSFER(mp,mp);
- 339 SYSTEM.SetFlags(ie);
- 340 END Delay;
- 341
- 342
- 343 PROCEDURE Lock;
- 344 (* Critical region lock - prevents timeslicing *)
- 345 (* may be nested *)
- 346 BEGIN
- 347 INC(CoreProc._LockNestMonster);
- 348 END Lock;
- 349
- 350 PROCEDURE Unlock;
- 351 (* Unlock procedure, always paired with a call to Lock.
- 352 Will de-schedule current process if there are ready processes
- 353 of equal priority *)
- 354
- 355 VAR
- 356 ie : CARDINAL;
- 357 BEGIN
- 358 ie := SYSTEM.GetFlags(); SYSTEM.DI;
- 359 IF CoreProc._LockNestMonster <= 1 THEN
- 360 CoreProc._LockNestMonster := 0; Delay(0);
- 361 ELSE
- 362 DEC(CoreProc._LockNestMonster);
- 363 END;
- 364 SYSTEM.SetFlags(ie);
- 365 END Unlock;
- 366
- 367
- 368 BEGIN
- 369 IF CoreProc._proc_init = FALSE THEN
- 370 SYSTEM.initprocess();
- 371 CoreProc._dq := NIL;
- 372 CoreProc._wq := NIL;
- 373 Storage.ALLOCATE(CoreProc._cp, SIZE(CoreProc.TaskDescriptor));
- 374 IF CoreProc._cp = NIL THEN
- 375 CoreSig._FatalError(CoreSig._FatalErrorPos(), 044H);
- 376 END;
- 377 CoreProc._cp^.next := NIL;
- 378 CoreProc._cp^.priority := 2;
- 379 CoreProc._cp^.cor := SYSTEM.CurrentProcess();
- 380 CoreProc._NextThread:=2;
- 381 StartProcess( Idler, 512, MAX(CARDINAL));
- 382 CoreProc._SchedStack := NIL;
- 383 CoreProc._Started := FALSE;
- 384 CoreProc._LockNestMonster := 0;
- 385 CoreProc._exit_proc:=StopScheduler;
- 386 END;
- 387 CoreProc._core_lock:=Lock;
- 388 CoreProc._core_unlock:=Unlock;
- 389 CoreProc._core_delay := Delay;
- 390 (*%E *)
- 391
- 392 (*%T _OS2 *)
- 393 IMPORT Storage, Lib, Str, Dos, CoreProc, CoreSig;
- 394 FROM Storage IMPORT ALLOCATE;
- ***** ^ duplicate identifier
- 395
- 396 TYPE
- 397
- 398 SIGNAL = POINTER TO SigRec;
- ***** ^ undeclared identifier
- 399
- 400 SigRec = RECORD
- 401 count : INTEGER;
- 402 sem : LONGCARD;
- ***** ^ undeclared identifier
- 403 END;
- ***** ^ not supported yet
- 404
- 405 PROCEDURE ErrorNamed ( IOR : CARDINAL; Code: CARDINAL; Msg: ARRAY OF CHAR);
- ***** ^ not supported yet
- 406 VAR
- 407 s : ARRAY[0..100] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 408
- 409 BEGIN
- 410 IF IOR#0 THEN
- 411 Lib.RunTimeError(CoreSig._FatalErrorPos(), Code, Msg);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 412 END;
- 413 END ErrorNamed;
- ***** ^ not supported yet
- 414
- 415
- 416 PROCEDURE StartScheduler;
- 417 VAR i : [0..MaxProcess];
- ***** ^ undeclared identifier
- 418 BEGIN
- 419 Lock;
- ***** ^ undeclared identifier
- 420 FOR i := 1 TO MaxProcess DO
- ***** ^ FOR needs integer variable and bounds
- ***** ^ undeclared identifier
- 421 IF CoreProc._ProcIds[i] # 0 THEN ErrorNamed(Dos.ResumeThread(CoreProc._ProcIds[i]), 0C0H, 'DosResumeThread') END;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 422 END;
- 423 CoreProc._Started := TRUE;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 424 Unlock;
- ***** ^ undeclared identifier
- 425 END StartScheduler;
- ***** ^ not supported yet
- 426
- 427 PROCEDURE StartProcess(P: PROC; N: CARDINAL; Pr: CARDINAL);
- ***** ^ undeclared identifier
- 428
- 429 VAR
- 430 ID: CARDINAL;
- 431 BEGIN
- 432 Lock;
- ***** ^ undeclared identifier
- 433 DEC(Pr);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 434 INC(CoreProc._LastProc);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 435 IF CoreProc._LastProc = MaxProcess THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 436 ErrorNamed(0, 0C0H, 'StartProcess');
- ***** ^ not supported yet
- ***** ^ not supported yet
- 437 END;
- 438 IF N < 32000 THEN
- 439 INC(N, 512); (* FP Overhead *)
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 440 END;
- 441 ID := CoreProc._dosbeginthread(P, N, NIL);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 442 IF ID < 0 THEN
- 443 Lib.RunTimeError(CoreSig._FatalErrorPos(), 0C1H, Lib.NilStr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 444 END;
- 445 CoreProc._ProcIds[ID-1] := ID;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 446 ErrorNamed(Dos.SetPrty(2,0,INTEGER(Pr),ID), 0C2H, 'DosSetPrty');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 447 IF NOT CoreProc._Started THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 448 ErrorNamed(Dos.SuspendThread(ID), 0C3H, 'DosSuspendThread');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 449 END;
- 450 Unlock;
- ***** ^ undeclared identifier
- 451 END StartProcess;
- ***** ^ not supported yet
- 452
- 453
- 454 PROCEDURE StopProcess();
- 455
- 456 BEGIN
- 457 CoreProc._ProcIds[CoreProc._getTID()-1] := 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 458 CoreProc._dosendthread();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 459 END StopProcess;
- ***** ^ not supported yet
- 460
- 461 PROCEDURE StopScheduler();
- 462
- 463 BEGIN
- 464 END StopScheduler;
- ***** ^ not supported yet
- 465
- 466
- 467 PROCEDURE SEND(s: SIGNAL);
- 468 BEGIN
- 469 Lock;
- ***** ^ undeclared identifier
- 470 IF s^.count < 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 471 ErrorNamed(Dos.SemClear(FarADR(s^.sem)), 0C4H, 'DosSemClear');;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 472 END;
- 473 INC(s^.count);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 474 Unlock;
- ***** ^ undeclared identifier
- 475 END SEND;
- ***** ^ not supported yet
- 476
- 477 PROCEDURE WAIT(s: SIGNAL);
- 478 BEGIN
- 479 Lock;
- ***** ^ undeclared identifier
- 480 DEC(s^.count);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 481 IF s^.count < 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 482 Unlock;
- ***** ^ undeclared identifier
- 483 ErrorNamed(Dos.SemRequest(FarADR(s^.sem),-1), 0C5H, 'DosSemRequest');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 484 ELSE
- 485 Unlock;
- ***** ^ undeclared identifier
- 486 END;
- 487 END WAIT;
- ***** ^ not supported yet
- 488
- 489 PROCEDURE Notify(s: SIGNAL);
- 490 BEGIN
- 491 Lock;
- ***** ^ undeclared identifier
- 492 IF s^.count < 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 493 ErrorNamed(Dos.SemClear(FarADR(s^.sem)), 0C6H, 'DosSemClear');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 494 INC(s^.count);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 495 END;
- 496 Unlock;
- ***** ^ undeclared identifier
- 497 END Notify;
- ***** ^ not supported yet
- 498
- 499 PROCEDURE Awaited(s: SIGNAL) : BOOLEAN;
- 500 BEGIN
- 501 RETURN s^.count < 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 502 END Awaited;
- ***** ^ not supported yet
- 503
- 504
- 505 PROCEDURE Lock;
- 506 VAR
- 507 tid : CARDINAL ;
- 508 BEGIN
- 509 tid := CoreProc._getTID();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 510 IF (CoreProc._LockCount=0)OR(CoreProc._LockedThread<>tid) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 511 IF Dos.SemRequest(FarADR(CoreProc._LockSem),-1)=0 THEN END;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 512 CoreProc._LockedThread := tid ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 513 END;
- 514 INC(CoreProc._LockCount);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 515 END Lock;
- ***** ^ not supported yet
- 516
- 517 PROCEDURE Unlock;
- 518 BEGIN
- 519 DEC(CoreProc._LockCount);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 520 IF CoreProc._LockCount=0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 521 IF Dos.SemClear(FarADR(CoreProc._LockSem))=0 THEN END;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 522 IF Dos.Sleep(0)=0 THEN END;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 523 END;
- 524 END Unlock;
- ***** ^ not supported yet
- 525
- 526
- 527 PROCEDURE Init(VAR s: SIGNAL);
- 528 BEGIN
- 529 NEW(s);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 530 s^.sem := 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 531 ErrorNamed(Dos.SemSet(FarADR(s^.sem)), 0C7H, 'DosSemSet');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 532 s^.count := 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 533 END Init;
- ***** ^ not supported yet
- 534
- 535 PROCEDURE Delay(T: CARDINAL);
- 536 BEGIN
- 537 ErrorNamed(Dos.Sleep(LONGCARD(T)*50), 0C8H, 'DosSleep');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 538 END Delay;
- ***** ^ not supported yet
- 539
- 540 PROCEDURE Idler();
- 541
- 542 END Idler;
- ***** ^ not supported yet
- 543
- 544 BEGIN
- 545 CoreProc._Started := FALSE;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 546 CoreProc._LastProc := 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 547 CoreProc._LockCount := 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 548 CoreProc._LockSem := 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 549 CoreProc._LockedThread := 0 ;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 550 CoreProc._core_lock := Lock;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 551 CoreProc._core_unlock := Unlock;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 552 CoreProc._core_delay := Delay;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 553 CoreProc._NextThread:=2;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 554 (*%E *)
- 555
- 556 END Process.
- ***** ^ not supported yet
- 214 errors
|