| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961 |
- Listing:
- 1 IMPLEMENTATION MODULE EnvironUtils;
- 2 (*
- 3 * REPERTOIRE
- 4 * Release 1.6
- 5 * By Charles Bradford and Cole Brecheen
- 6 * (c) Copyright 1985-1991 PMI
- 7 * Portland, Oregon
- 8 * All rights reserved
- 9 * (503) 236-1788
- 10 *
- 11 * $Header: D:/logfiles/mods/environu.mov 1.9 17 Mar 1991 17:52:14 coleb $
- 12 *)
- 13
- 14
- 15 (*EntryDiag:
- 16 IMPORT Diagnostics;
- 17 :EntryDiag*)
- 18
- 19 IMPORT ByteFiddler;
- 20 IMPORT ErrorManager;
- 21 IMPORT LowLevel;
- 22 IMPORT M2Strings;
- 23 IMPORT FAPI;
- 24 IMPORT PosUtils;
- 25 IMPORT StrConv;
- 26 IMPORT StrEdit;
- 27 IMPORT StringIO;
- 28 IMPORT SYSTEM;
- 29 IMPORT VStorage;
- 30
- 31 VAR
- 32 Initialized : BOOLEAN;
- 33
- 34 PROCEDURE Init();
- 35 BEGIN
- 36 IF Initialized THEN
- 37 RETURN;
- 38 ELSE
- 39 Initialized := TRUE;
- 40 END;
- 41 (*EntryDiag:
- 42 Diagnostics.Init();
- 43 :EntryDiag*)
- 44
- 45 ByteFiddler.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 46 ErrorManager.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 47 LowLevel.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 48 M2Strings.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 49 PosUtils.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 50 StrConv.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 51 StrEdit.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 52 StringIO.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 53 VStorage.Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 54 END Init;
- ***** ^ not supported yet
- 55
- 56
- 57 PROCEDURE CutFirstParam(VAR TheStr : ARRAY OF CHAR);
- ***** ^ not supported yet
- 58 (* use when running under Logitech's run-time debugger *)
- 59 VAR
- 60 spot : CARDINAL;
- 61 BEGIN
- 62 StrEdit.CrunchBlanks(TheStr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 63 spot := M2Strings.Pos(' ',TheStr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 64 IF spot<=HIGH(TheStr) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 65 M2Strings.Delete(TheStr, 0, spot+1);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 66 ELSE
- 67 StrEdit.SetLength(TheStr, 0);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 68 END;
- 69 END CutFirstParam;
- ***** ^ not supported yet
- 70
- 71
- 72 PROCEDURE GetProgParams(VAR ParamStr : ARRAY OF CHAR);
- ***** ^ not supported yet
- 73 VAR
- 74 StrAdr : LowLevel.Address8086;
- ***** ^ not supported yet
- 75 knownLength, errcode, cnt, tmpw, CmdLineOffs : CARDINAL;
- 76 tmpc : CHAR;
- 77 LastWasNull: BOOLEAN;
- 78 machineMode: CARDINAL;
- 79 BEGIN
- 80 machineMode := 0;
- 81 (* Have to initialize machineMode because DOSGETMACHINEMODE is
- 82 * actually expecting the address of a single byte; we use a
- 83 * CARDINAL because JPI is obstinate about letting us compare
- 84 * byte values with the constants in FAPI.DEF.
- 85 *)
- 86 errcode := FAPI.DOSGETMACHINEMODE(SYSTEM.ADR(machineMode));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 87 IF machineMode = FAPI.MODE_REAL THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 88 StrAdr.seg := GetPSP();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 89 StrAdr.off := 81H;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 90 knownLength := ORD(LowLevel.PeekByte(StrAdr.seg, StrAdr.off - 1));
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 91 ELSE
- 92 knownLength := 0FFFFH;
- 93 (* In protected mode, the command line follows the
- 94 * environment block. Not so in real mode. It's in the PSP
- 95 * in real mode. And in real mode, you have to pay attention
- 96 * to the length byte that precedes the command line. You
- 97 * can't count on null termination, which is the only thing
- 98 * that signals the end of the command line in protected
- 99 * mode.
- 100 *)
- 101 IF FAPI.DOSGETENV(
- ***** ^ not supported yet
- ***** ^ not supported yet
- 102 SYSTEM.ADR(StrAdr.seg),
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 103 SYSTEM.ADR(CmdLineOffs )) # 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 104 ErrorManager.WARN( "Failed to get command line." );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 105 END;
- 106 StrAdr.off := CmdLineOffs;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 107 tmpc := LowLevel.PeekByte(StrAdr.seg,StrAdr.off );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 108 WHILE (tmpc # 0C) DO
- 109 (* Now we start on the fully qualified name of the program. *)
- 110 INC(StrAdr.off);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 111 tmpc := LowLevel.PeekByte(StrAdr.seg, StrAdr.off);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 112 END;
- 113 INC( StrAdr.off );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 114 END;
- 115
- 116 LowLevel.Fill( SYSTEM.ADR(ParamStr), HIGH(ParamStr) + 1, 0C );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 117 (* Fill the whole thing with nulls so we don't have to worry
- 118 about terminating the string in the right place. *)
- 119 cnt := 0;
- 120 tmpc := StrAdr.b^;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 121 (* If there are any parameters at all, this
- 122 will always be a space. *)
- 123 WHILE (tmpc # 0C) AND
- 124 (tmpc # 377C) AND
- 125 (cnt <= HIGH(ParamStr)) AND
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 126 ((cnt + 1) < knownLength) DO
- 127 (* Now we are on the parameters. *)
- 128 INC(StrAdr.off);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 129 tmpc := StrAdr.b^;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 130 ParamStr[ cnt ] := tmpc;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 131 INC( cnt );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 132 END;
- 133 END GetProgParams;
- ***** ^ not supported yet
- 134
- 135
- 136 PROCEDURE ParsedParam( ParamNum: CARDINAL; VAR Result: ARRAY
- 137 OF CHAR ): BOOLEAN;
- ***** ^ not supported yet
- 138 VAR
- 139 ParamCnt, BlankSpot1, BlankSpot2: CARDINAL;
- 140 FullLine: ARRAY [0..255] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 141 BEGIN
- 142 GetProgParams( FullLine );
- ***** ^ not supported yet
- ***** ^ not supported yet
- 143 StrEdit.CrunchBlanks( FullLine );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 144 StrEdit.Append( FullLine, ' ' );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 145 IF M2Strings.Length( FullLine ) > 1 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 146 IF (ParamNum = 0) THEN
- 147 ErrorManager.WARN('Zero passed to ParsedParam');
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 148 END;
- 149 ParamCnt := 0;
- 150 BlankSpot1 := 0;
- 151 BlankSpot2 := 0;
- 152 WHILE (ParamCnt < ParamNum) AND
- 153 (BlankSpot2 <= HIGH(FullLine) ) DO
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 154 BlankSpot2 := PosUtils.Positn( ' ', FullLine, BlankSpot2 );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 155 INC( ParamCnt );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 156 IF ParamCnt < ParamNum THEN
- 157 BlankSpot1 := BlankSpot2;
- 158 INC( BlankSpot2 );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 159 END;
- 160 END;
- 161 IF BlankSpot2 > HIGH(FullLine) THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 162 RETURN(FALSE);
- 163 ELSE
- 164 IF BlankSpot1 # 0 THEN
- 165 INC(BlankSpot1);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 166 END;
- 167 M2Strings.Copy( FullLine, BlankSpot1,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 168 BlankSpot2 - BlankSpot1, Result );
- ***** ^ not supported yet
- 169 RETURN(TRUE);
- 170 END;
- 171 ELSE
- 172 RETURN(FALSE);
- 173 END;
- 174 END ParsedParam;
- ***** ^ not supported yet
- 175
- 176
- 177 PROCEDURE GetDosVersion(VAR major, minor : CARDINAL);
- 178 VAR
- 179 tmpc : CARDINAL;
- 180 BEGIN
- 181 tmpc := 0;
- 182 FAPI.DOSGETVERSION( SYSTEM.ADR(tmpc ));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 183 major := ORD( CHAR(ByteFiddler.HighByte( tmpc )) );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 184 minor := ORD( CHAR(ByteFiddler.LowByte( tmpc )) );
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 185 END GetDosVersion;
- ***** ^ not supported yet
- 186
- 187
- 188 PROCEDURE GetPSP() : CARDINAL;
- 189 VAR
- 190 rgstr : LowLevel.regpack;
- ***** ^ not supported yet
- 191 errcode, DosVersion, Subvers, PSPseg : CARDINAL;
- 192 machineMode: CARDINAL;
- 193 BEGIN
- 194 machineMode := 0;
- 195 (* Have to initialize machineMode because DOSGETMACHINEMODE is
- 196 * actually expecting the address of a single byte; we use a
- 197 * CARDINAL because JPI is obstinate about letting us compare
- 198 * byte values with the constants in FAPI.DEF.
- 199 *)
- 200 errcode := FAPI.DOSGETMACHINEMODE(SYSTEM.ADR(machineMode));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 201 IF machineMode = FAPI.MODE_REAL THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 202 GetDosVersion(DosVersion, Subvers);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 203 IF DosVersion >= 3 THEN
- 204 rgstr.a.h := 142C; (* 62H *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 205 ELSE
- 206 rgstr.a.h := 121C; (* 51H *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 207 END;
- 208 LowLevel.msdos( rgstr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 209 IF LowLevel.FlaggedError(rgstr.flags) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 210 ErrorManager.WarnNumber("DOS error getting PSP:", ORD(rgstr.a.l));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 211 END;
- 212 RETURN (rgstr.b.x);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 213 ELSE
- 214 ErrorManager.WARN("Attempt to GetPSP in protected mode");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 215 END;
- 216 RETURN(0);
- 217 END GetPSP;
- ***** ^ not supported yet
- 218
- 219
- 220 PROCEDURE EnvironmentSeg(): CARDINAL;
- 221 VAR
- 222 pspSeg, envSeg, cmdlineOffs, errcode: CARDINAL;
- 223 machineMode: CARDINAL;
- 224 BEGIN
- 225 machineMode := 0;
- 226 (* Have to initialize machineMode because DOSGETMACHINEMODE is
- 227 * actually expecting the address of a single byte; we use a
- 228 * CARDINAL because JPI is obstinate about letting us compare
- 229 * byte values with the constants in FAPI.DEF.
- 230 *)
- 231 errcode := FAPI.DOSGETMACHINEMODE(SYSTEM.ADR(machineMode));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 232 IF machineMode = FAPI.MODE_REAL THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 233 (* We break out the steps to make them easier to see in CodeView. *)
- 234 pspSeg := GetPSP();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 235 envSeg := LowLevel.PeekWord( pspSeg, 2CH );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 236 (*Get segment address of the environment from PSP.*)
- 237 ELSE
- 238 errcode := FAPI.DOSGETENV(SYSTEM.ADR(envSeg), SYSTEM.ADR(cmdlineOffs));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 239 (*Even though this is FAPI, it just doesn't seem to work
- 240 under DOS. That's why we're doing it differently depending
- 241 on the mode we're in. cmdlineOffs is telling us where the
- 242 command line is in the environment segment, but we don't care
- 243 about that now.*)
- 244 END;
- 245 RETURN envSeg;
- 246 END EnvironmentSeg;
- ***** ^ not supported yet
- 247
- 248
- 249 PROCEDURE ReadEnvironment(name : ARRAY OF CHAR; VAR parameter :
- ***** ^ not supported yet
- 250 ARRAY OF CHAR);
- ***** ^ not supported yet
- 251 VAR
- 252 bufch : CHAR;
- 253 tmpcopy : ARRAY [0..255] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 254 (*expanded from [0..80] on 11 Nov 86*)
- 255 found : BOOLEAN;
- 256 cmdlineOffs, pspSeg, errcode, EnvSeg, EnvNdx, cnt, EqSpot: CARDINAL;
- 257 machineMode: SYSTEM.BYTE;
- ***** ^ not supported yet
- 258 BEGIN
- 259 EnvSeg := EnvironmentSeg();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 260 (* We'd like to call DOSSCANENV here, but it's not FAPI. *)
- 261
- 262 EnvNdx := 0;
- 263 found := FALSE;
- 264 StrEdit.SetLength(parameter, 0);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 265 StrEdit.CAPstr( name );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 266
- 267 REPEAT
- 268 StrEdit.SetLength(tmpcopy, 0);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 269 bufch := LowLevel.PeekByte(EnvSeg,EnvNdx);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 270 WHILE bufch # 0C DO
- 271 bufch := CAP(bufch);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 272 StrEdit.Append(tmpcopy, bufch);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 273 INC(EnvNdx);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 274 bufch := LowLevel.PeekByte(EnvSeg,EnvNdx);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 275 END;
- 276 IF M2Strings.Pos(name,tmpcopy)=0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 277 EqSpot := M2Strings.Pos('=',tmpcopy);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 278 IF (EqSpot<HIGH(tmpcopy)) AND
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 279 (EqSpot <= (M2Strings.Length(name)+1)) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 280 (* Added second condition 26 Oct 88 to prevent
- 281 ReadEnvironment from returning the value for, say,
- 282 M2OBJLIB when what you wanted was the value for M2OBJ. *)
- 283 M2Strings.Copy(tmpcopy, EqSpot + 1,
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 284 M2Strings.Length(tmpcopy) - 1 - EqSpot, parameter);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 285 found := TRUE;
- 286 END;
- 287 END;
- 288 INC(EnvNdx);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 289 IF LowLevel.PeekByte(EnvSeg, EnvNdx) = 0C THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 290 found := TRUE;
- 291 END;
- 292 UNTIL found;
- 293 WHILE M2Strings.Pos(' ',parameter)=0 DO
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 294 M2Strings.Delete(parameter, 0, 1);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 295 END;
- 296 END ReadEnvironment;
- ***** ^ not supported yet
- 297
- 298
- 299 PROCEDURE GetExeName( VAR ExeName: ARRAY OF CHAR );
- ***** ^ not supported yet
- 300 VAR
- 301 StrAdr: LowLevel.Address8086;
- ***** ^ not supported yet
- 302 tmpw, count, errcode: CARDINAL;
- 303 tmpc: CHAR;
- 304 machineMode: CARDINAL;
- 305 BEGIN
- 306 machineMode := 0;
- 307 ExeName[0] := 0C;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 308 StrAdr.seg := EnvironmentSeg();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 309 StrAdr.off := 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 310
- 311 tmpw := LowLevel.PeekWord( StrAdr.seg, StrAdr.off );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 312 (* Don't know what we're skipping over here. *)
- 313 WHILE (tmpw # 0) DO
- 314 INC(StrAdr.off);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 315 tmpw := LowLevel.PeekWord( StrAdr.seg, StrAdr.off );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 316 END;
- 317 (* Now skip the two null bytes that terminate the set of
- 318 environment strings. *)
- 319 StrAdr.off := StrAdr.off + 2;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 320
- 321 (* These things just never seem to be simple. It turns out that
- 322 in real mode, the exe file name doesn't exactly follow the
- 323 two null bytes that terminate the set of environment strings.
- 324 There are an additional couple of bytes -- a one byte value
- 325 and a null byte -- following the null pair. Rather than try
- 326 to figure out why, we just increment past them if we know
- 327 we're in real mode. *)
- 328 errcode := FAPI.DOSGETMACHINEMODE(SYSTEM.ADR(machineMode));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 329 IF machineMode = FAPI.MODE_REAL THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 330 StrAdr.off := StrAdr.off + 2;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 331 END;
- 332
- 333 count := 0;
- 334 tmpc := LowLevel.PeekByte( StrAdr.seg, StrAdr.off );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 335 ExeName[count] := tmpc;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 336 WHILE (tmpc # 0C) DO
- 337 (* We are now getting the path and file name of the .EXE file. *)
- 338 INC(StrAdr.off);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 339 tmpc := LowLevel.PeekByte( StrAdr.seg, StrAdr.off );
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 340 INC(count);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 341 ExeName[count] := tmpc;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 342 END;
- 343 END GetExeName;
- ***** ^ not supported yet
- 344
- 345
- 346 PROCEDURE GetDate(VAR month, day, year : CARDINAL; VAR weekday,
- 347 mmddyy : ARRAY OF CHAR);
- ***** ^ not supported yet
- 348 VAR
- 349 TimeData: FAPI.DATETIME;
- ***** ^ not supported yet
- 350 ErrorReturn: CARDINAL;
- 351 BEGIN
- 352 ErrorReturn := FAPI.DOSGETDATETIME( SYSTEM.ADR(TimeData));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 353 CASE ORD(TimeData.weekday) OF
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 354 0 :
- 355 StrEdit.AssignStr('Sunday', weekday);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 356 | 1 :
- 357 StrEdit.AssignStr('Monday', weekday);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 358 | 2 :
- 359 StrEdit.AssignStr('Tuesday', weekday);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 360 | 3 :
- 361 StrEdit.AssignStr('Wednesday', weekday);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 362 | 4 :
- 363 StrEdit.AssignStr('Thursday', weekday);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 364 | 5 :
- 365 StrEdit.AssignStr('Friday', weekday);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 366 | 6 :
- 367 StrEdit.AssignStr('Saturday', weekday);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 368 END;
- 369 month := ORD(TimeData.month);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 370 day := ORD(TimeData.day);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 371 year := ORD(TimeData.year);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 372 StrConv.DateToStr(month, day, year, mmddyy);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 373 IF ErrorReturn # 0 THEN
- 374 ErrorManager.WarnNumber("DOSGETDATETIME", ErrorReturn);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 375 END;
- 376 END GetDate;
- ***** ^ not supported yet
- 377
- 378
- 379 PROCEDURE SetDate(month, day, year : CARDINAL): BOOLEAN;
- 380 VAR
- 381 TimeData: FAPI.DATETIME;
- ***** ^ not supported yet
- 382 BEGIN
- 383 IF FAPI.DOSGETDATETIME( SYSTEM.ADR(TimeData )) = 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 384 END;
- 385 TimeData.month := SYSTEM.BYTE(CHR(month));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 386 TimeData.day := SYSTEM.BYTE(CHR(day));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 387 TimeData.year := year;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 388 RETURN FAPI.DOSSETDATETIME( SYSTEM.ADR(TimeData )) = 0;
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 389 END SetDate;
- ***** ^ not supported yet
- 390
- 391
- 392 PROCEDURE GetTime(VAR hours, minutes, seconds, hundredths : CARDINAL;
- 393 VAR text : ARRAY OF CHAR);
- ***** ^ not supported yet
- 394 VAR
- 395 TimeData: FAPI.DATETIME;
- ***** ^ not supported yet
- 396 ErrorReturn:CARDINAL;
- 397 BEGIN
- 398 ErrorReturn := FAPI.DOSGETDATETIME( SYSTEM.ADR(TimeData));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 399 hours := ORD(TimeData.hours);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 400 minutes := ORD(TimeData.minutes);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 401 seconds := ORD(TimeData.seconds);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 402 hundredths := ORD(TimeData.hundredths);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 403 StrConv.TimeToStr(hours,minutes,seconds,hundredths,text);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 404 END GetTime;
- ***** ^ not supported yet
- 405
- 406
- 407 PROCEDURE SetTime(hours, minutes, seconds, hundredths : CARDINAL);
- 408 VAR
- 409 TimeData:FAPI.DATETIME;
- ***** ^ not supported yet
- 410 BEGIN
- 411 IF FAPI.DOSGETDATETIME( SYSTEM.ADR(TimeData )) = 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 412 END;
- 413 TimeData.hours := SYSTEM.BYTE(CHR(hours));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 414 TimeData.minutes := SYSTEM.BYTE(CHR(minutes));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 415 TimeData.seconds := SYSTEM.BYTE(CHR(seconds));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 416 TimeData.hundredths := SYSTEM.BYTE(CHR(hundredths));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 417 IF FAPI.DOSSETDATETIME( SYSTEM.ADR(TimeData )) = 0 THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 418 END;
- 419 END SetTime;
- ***** ^ not supported yet
- 420
- 421 PROCEDURE MemAvail(within: CARDINAL) : CARDINAL;
- 422 VAR
- 423 lasttry, lowtry, try : CARDINAL;
- 424 BEGIN
- 425 lasttry := 65535;
- 426 try := 65535;
- 427 lowtry := 0;
- 428 LOOP
- 429 WHILE (NOT VStorage.DosAvail(try)) AND (try>16) DO
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 430 lasttry := try;
- 431 try := lowtry + (try-lowtry) DIV 2;
- 432 END;
- 433 IF ((lasttry-try) > within) AND (try>16) THEN
- 434 lowtry := try;
- 435 try := try + (lasttry-try) DIV 2;
- 436 ELSE
- 437 EXIT;
- 438 END;
- 439 END;
- 440 IF try<=16 THEN
- 441 RETURN 0;
- 442 ELSE
- 443 RETURN try;
- 444 END;
- 445 END MemAvail;
- ***** ^ not supported yet
- 446
- 447 BEGIN
- 448 Initialized := FALSE;
- 449 Init();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 450 END EnvironUtils.
- ***** ^ not supported yet
- 505 errors
|