| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- Listing:
- 1 (* Release 3.10 *)
- 2 (*-------------------------------------------------------------------------*
- 3 * *
- 4 * SYSTEM.MOD - Machine-level support *
- 5 * *
- 6 * COPYRIGHT (C) 1988..1992 Clarion Software Corporation. *
- 7 * All Rights Reserved *
- 8 * *
- 9 *--------------------------------------------------------------------------*)
- 10
- 11 (*%F _fdata *)
- 12 (*# call(seg_name => null) *)
- 13 (*# data(seg_name => null) *)
- 14 (*%E *)
- 15 (*# module(implementation=>off) *)
- 16 (*# call(o_a_copy => off) *)
- 17 (*# check(stack=>off,index=>off,range=>off,overflow=>off,nil_ptr=>off) *)
- 18
- 19 IMPLEMENTATION MODULE SYSTEM;
- 20 (*%F _OS2 *)
- 21 IMPORT CoreMain;
- 22 (*%E *)
- 23 (*%T _OS2 *)
- 24 IMPORT Lib,Dos,CoreSig,CoreMath;
- 25 (*%E *)
- 26
- 27 (*%F _OS2 *)
- 28 PROCEDURE NEWPROCESS(P: PROC; A: FarADDRESS; S: CARDINAL; VAR P1: FarADDRESS); IN CoreProc;
- 29 PROCEDURE TRANSFER (VAR P1,P2: FarADDRESS); IN CoreProc;
- 30 PROCEDURE IOTRANSFER (VAR P1,P2: FarADDRESS; I: CARDINAL); IN CoreProc;
- 31 PROCEDURE CurrentProcess():ADDRESS; IN CoreProc;
- 32 PROCEDURE initprocess(); IN CoreProc;
- 33 PROCEDURE CurrentPriority() : CARDINAL; IN CoreProc;
- 34 PROCEDURE NewPriority(PR: CARDINAL); IN CoreProc;
- 35 PROCEDURE Listen(Mask: BITSET); IN CoreProc;
- 36 PROCEDURE InterruptRegisters(P: FarADDRESS): FarADDRESS; IN CoreProc;
- 37 (*%E *)
- 38
- 39 (*%T _OS2 *)
- 40 CONST
- 41 OS2MaxThreads = 64;
- 42
- 43 VAR
- 44 ProcessSem : ARRAY[1..OS2MaxThreads] OF LONGCARD;
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 45 (* ADR(ProcessSem[T]) is process id and HSEM *)
- 46
- 47 LaunchSem : LONGCARD; (* Set when launching new process *)
- ***** ^ undeclared identifier
- 48 LaunchProc : PROC;
- ***** ^ undeclared identifier
- 49 LI : Dos.PLINFOSEG;
- ***** ^ not supported yet
- 50
- 51
- 52 (*# save *)
- 53 (*# call(near_call=>off, reg_param=>(), reg_saved=>(di,si,ds,st1,st2)) *)
- 54 PROCEDURE Launch; (* Stub to launch new process *)
- 55 (* Input LaunchProc *)
- 56 VAR
- 57 p : Dos.THREAD;
- ***** ^ not supported yet
- 58 mp : Dos.HSEM;
- ***** ^ not supported yet
- 59 r : CARDINAL;
- 60 BEGIN
- 61 mp := FarADR(ProcessSem[LI^.tidCurrent]);
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 62 p := Dos.THREAD(LaunchProc);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 63 r := Dos.SemSet(mp);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 64 r := Dos.SemClear(FarADR(LaunchSem));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 65 r := Dos.SemWait(mp,Dos.SEM_INDEFINITE_WAIT);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 66 p();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 67 Lib.RunTimeError(CoreSig._FatalErrorPos(), 0CDH, Lib.NilStr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 68 END Launch;
- ***** ^ not supported yet
- 69 (*#restore *)
- 70
- 71 PROCEDURE NEWPROCESS(P: PROC; A: FarADDRESS; S: CARDINAL; VAR P1: FarADDRESS);
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- 72 VAR mp : Dos.HSEM;
- ***** ^ not supported yet
- 73 r : CARDINAL;
- 74 tid : CARDINAL;
- 75 BEGIN
- 76 (*%T _mthread *)
- 77 CoreMath._FloatInitInstance(CARDINAL(LONGCARD(A) >> 16));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ arithmetic operand must be numeric
- 78 INC(CARDINAL(A),S);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 79 r := Dos.SemRequest(FarADR(LaunchSem),Dos.SEM_INDEFINITE_WAIT);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 80 LaunchProc := P;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 81 IF Dos.CreateThread(Launch,tid,A) # 0 THEN (* Start process *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 82 Lib.RunTimeError(CoreSig._FatalErrorPos(), 0CAH, Lib.NilStr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 83 END;
- 84 IF tid>OS2MaxThreads THEN
- 85 Lib.RunTimeError(CoreSig._FatalErrorPos(), 0CBH, Lib.NilStr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 86 END;
- 87 r := Dos.SemWait(FarADR(LaunchSem),Dos.SEM_INDEFINITE_WAIT);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 88 P1 := FarADR(ProcessSem[tid]);
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 89 (*%E *)
- 90 END NEWPROCESS;
- ***** ^ not supported yet
- 91
- 92 PROCEDURE TRANSFER (VAR P1,P2: FarADDRESS);
- ***** ^ undeclared identifier
- 93 VAR mp,pp : Dos.HSEM;
- ***** ^ not supported yet
- 94 r : CARDINAL ;
- 95 BEGIN
- 96 (*%T _mthread *)
- 97 pp := P2;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 98 mp := FarADR(ProcessSem[LI^.tidCurrent]);
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 99 P1 := mp;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 100 r := Dos.SemSet(mp);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 101 r := Dos.SemClear(pp);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 102 r := Dos.SemWait(mp,Dos.SEM_INDEFINITE_WAIT);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 103 (*%E *)
- 104 END TRANSFER;
- ***** ^ not supported yet
- 105
- 106 PROCEDURE IOTRANSFER (VAR P1,P2: FarADDRESS; I: CARDINAL);
- ***** ^ undeclared identifier
- 107 VAR mp,pp : Dos.HSEM;
- ***** ^ not supported yet
- 108 r : CARDINAL ;
- 109 BEGIN
- 110 (*%T _mthread *)
- 111 IF (I<>8) THEN
- 112 Lib.RunTimeError(CoreSig._FatalErrorPos(), 0CCH, Lib.NilStr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 113 END;
- 114 pp := P2;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 115 mp := FarADR(ProcessSem[LI^.tidCurrent]);
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 116 P1 := mp;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 117 r := Dos.SemSet(mp);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 118 r := Dos.SemClear(pp);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 119 r := Dos.SemWait(mp,20);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 120 P2 := FarADR(ProcessSem[LI^.tidCurrent]);
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 121 (*%E *)
- 122 END IOTRANSFER;
- ***** ^ not supported yet
- 123
- 124
- 125 PROCEDURE CurrentProcess() : ADDRESS;
- ***** ^ undeclared identifier
- 126 BEGIN
- 127 RETURN ADR(ProcessSem[LI^.tidCurrent]);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 128 END CurrentProcess;
- ***** ^ not supported yet
- 129
- 130 PROCEDURE initprocess();
- 131
- 132 BEGIN
- 133
- 134 END initprocess;
- ***** ^ not supported yet
- 135
- 136 PROCEDURE CurrentPriority() : CARDINAL;
- 137
- 138 TYPE
- 139 PrType = RECORD
- 140 CASE: BOOLEAN OF
- ***** ^ not supported yet
- ***** ^ 'POINTER' expected
- 141 | TRUE :
- 142 var: CARDINAL;
- 143 | FALSE :
- 144 pl, pc: SHORTCARD;
- 145 END;
- 146 END;
- 147 VAR
- 148 Pr: PrType;
- 149 BEGIN
- 150 Dos.GetPrty(2, Pr.var, 0);
- 151 RETURN CARDINAL(Pr.pl);
- 152 END CurrentPriority;
- 153
- 154 PROCEDURE NewPriority(PR: CARDINAL);
- 155
- 156 BEGIN
- 157 Dos.SetPrty(2, 0, PR, 0);
- 158 END NewPriority;
- 159
- 160 PROCEDURE Init;
- 161 VAR i,g,l : CARDINAL;
- 162 BEGIN
- 163 FOR i := 1 TO OS2MaxThreads DO ProcessSem[i] := 0 END;
- 164 LI := FarNIL;
- 165 IF Lib.ProtectedMode() THEN
- 166 Dos.GetInfoSeg(g,l);
- 167 LI := [l:0];
- 168 END;
- 169 END Init;
- 170
- 171 PROCEDURE Listen(Mask: BITSET);
- 172
- 173 BEGIN
- 174 END Listen;
- 175
- 176 PROCEDURE InterruptRegisters(P: FarADDRESS): FarADDRESS;
- 177
- 178 BEGIN
- 179 RETURN FarNIL;
- 180 END InterruptRegisters;
- 181
- 182 (*%E*)
- 183
- 184 VAR
- 185 HB: FarADDRESS;
- 186
- 187 BEGIN
- 188 (*%F _OS2 *)
- 189 HB := CoreMain._getheapbase();
- 190 HeapBase := Seg(HB^);
- 191 (*%T _mthread *)
- 192 initprocess();
- 193 (*%E *)
- 194 (*%E *)
- 195 (*%T _OS2 *)
- 196 Init;
- 197 (*%E *)
- 198 END SYSTEM.
- 199
- 153 errors
|