PROCESS.LST 26 KB

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