ENVIRONU.LST 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961
  1. Listing:
  2. 1 IMPLEMENTATION MODULE EnvironUtils;
  3. 2 (*
  4. 3 * REPERTOIRE
  5. 4 * Release 1.6
  6. 5 * By Charles Bradford and Cole Brecheen
  7. 6 * (c) Copyright 1985-1991 PMI
  8. 7 * Portland, Oregon
  9. 8 * All rights reserved
  10. 9 * (503) 236-1788
  11. 10 *
  12. 11 * $Header: D:/logfiles/mods/environu.mov 1.9 17 Mar 1991 17:52:14 coleb $
  13. 12 *)
  14. 13
  15. 14
  16. 15 (*EntryDiag:
  17. 16 IMPORT Diagnostics;
  18. 17 :EntryDiag*)
  19. 18
  20. 19 IMPORT ByteFiddler;
  21. 20 IMPORT ErrorManager;
  22. 21 IMPORT LowLevel;
  23. 22 IMPORT M2Strings;
  24. 23 IMPORT FAPI;
  25. 24 IMPORT PosUtils;
  26. 25 IMPORT StrConv;
  27. 26 IMPORT StrEdit;
  28. 27 IMPORT StringIO;
  29. 28 IMPORT SYSTEM;
  30. 29 IMPORT VStorage;
  31. 30
  32. 31 VAR
  33. 32 Initialized : BOOLEAN;
  34. 33
  35. 34 PROCEDURE Init();
  36. 35 BEGIN
  37. 36 IF Initialized THEN
  38. 37 RETURN;
  39. 38 ELSE
  40. 39 Initialized := TRUE;
  41. 40 END;
  42. 41 (*EntryDiag:
  43. 42 Diagnostics.Init();
  44. 43 :EntryDiag*)
  45. 44
  46. 45 ByteFiddler.Init();
  47. ***** ^ not supported yet
  48. ***** ^ not supported yet
  49. ***** ^ not supported yet
  50. 46 ErrorManager.Init();
  51. ***** ^ not supported yet
  52. ***** ^ not supported yet
  53. ***** ^ not supported yet
  54. 47 LowLevel.Init();
  55. ***** ^ not supported yet
  56. ***** ^ not supported yet
  57. ***** ^ not supported yet
  58. 48 M2Strings.Init();
  59. ***** ^ not supported yet
  60. ***** ^ not supported yet
  61. ***** ^ not supported yet
  62. 49 PosUtils.Init();
  63. ***** ^ not supported yet
  64. ***** ^ not supported yet
  65. ***** ^ not supported yet
  66. 50 StrConv.Init();
  67. ***** ^ not supported yet
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. 51 StrEdit.Init();
  71. ***** ^ not supported yet
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. 52 StringIO.Init();
  75. ***** ^ not supported yet
  76. ***** ^ not supported yet
  77. ***** ^ not supported yet
  78. 53 VStorage.Init();
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. ***** ^ not supported yet
  82. 54 END Init;
  83. ***** ^ not supported yet
  84. 55
  85. 56
  86. 57 PROCEDURE CutFirstParam(VAR TheStr : ARRAY OF CHAR);
  87. ***** ^ not supported yet
  88. 58 (* use when running under Logitech's run-time debugger *)
  89. 59 VAR
  90. 60 spot : CARDINAL;
  91. 61 BEGIN
  92. 62 StrEdit.CrunchBlanks(TheStr);
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. 63 spot := M2Strings.Pos(' ',TheStr);
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. ***** ^ not supported yet
  100. 64 IF spot<=HIGH(TheStr) THEN
  101. ***** ^ undeclared identifier
  102. ***** ^ not supported yet
  103. 65 M2Strings.Delete(TheStr, 0, spot+1);
  104. ***** ^ not supported yet
  105. ***** ^ not supported yet
  106. ***** ^ not supported yet
  107. ***** ^ not supported yet
  108. 66 ELSE
  109. 67 StrEdit.SetLength(TheStr, 0);
  110. ***** ^ not supported yet
  111. ***** ^ not supported yet
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. 68 END;
  115. 69 END CutFirstParam;
  116. ***** ^ not supported yet
  117. 70
  118. 71
  119. 72 PROCEDURE GetProgParams(VAR ParamStr : ARRAY OF CHAR);
  120. ***** ^ not supported yet
  121. 73 VAR
  122. 74 StrAdr : LowLevel.Address8086;
  123. ***** ^ not supported yet
  124. 75 knownLength, errcode, cnt, tmpw, CmdLineOffs : CARDINAL;
  125. 76 tmpc : CHAR;
  126. 77 LastWasNull: BOOLEAN;
  127. 78 machineMode: CARDINAL;
  128. 79 BEGIN
  129. 80 machineMode := 0;
  130. 81 (* Have to initialize machineMode because DOSGETMACHINEMODE is
  131. 82 * actually expecting the address of a single byte; we use a
  132. 83 * CARDINAL because JPI is obstinate about letting us compare
  133. 84 * byte values with the constants in FAPI.DEF.
  134. 85 *)
  135. 86 errcode := FAPI.DOSGETMACHINEMODE(SYSTEM.ADR(machineMode));
  136. ***** ^ not supported yet
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. ***** ^ not supported yet
  140. ***** ^ not supported yet
  141. 87 IF machineMode = FAPI.MODE_REAL THEN
  142. ***** ^ not supported yet
  143. ***** ^ not supported yet
  144. 88 StrAdr.seg := GetPSP();
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. ***** ^ undeclared identifier
  148. ***** ^ not supported yet
  149. 89 StrAdr.off := 81H;
  150. ***** ^ not supported yet
  151. ***** ^ not supported yet
  152. 90 knownLength := ORD(LowLevel.PeekByte(StrAdr.seg, StrAdr.off - 1));
  153. ***** ^ undeclared identifier
  154. ***** ^ not supported yet
  155. ***** ^ not supported yet
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. ***** ^ not supported yet
  159. ***** ^ not supported yet
  160. ***** ^ not supported yet
  161. 91 ELSE
  162. 92 knownLength := 0FFFFH;
  163. 93 (* In protected mode, the command line follows the
  164. 94 * environment block. Not so in real mode. It's in the PSP
  165. 95 * in real mode. And in real mode, you have to pay attention
  166. 96 * to the length byte that precedes the command line. You
  167. 97 * can't count on null termination, which is the only thing
  168. 98 * that signals the end of the command line in protected
  169. 99 * mode.
  170. 100 *)
  171. 101 IF FAPI.DOSGETENV(
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. 102 SYSTEM.ADR(StrAdr.seg),
  175. ***** ^ not supported yet
  176. ***** ^ not supported yet
  177. ***** ^ not supported yet
  178. ***** ^ not supported yet
  179. 103 SYSTEM.ADR(CmdLineOffs )) # 0 THEN
  180. ***** ^ not supported yet
  181. ***** ^ not supported yet
  182. ***** ^ not supported yet
  183. 104 ErrorManager.WARN( "Failed to get command line." );
  184. ***** ^ not supported yet
  185. ***** ^ not supported yet
  186. ***** ^ not supported yet
  187. 105 END;
  188. 106 StrAdr.off := CmdLineOffs;
  189. ***** ^ not supported yet
  190. ***** ^ not supported yet
  191. 107 tmpc := LowLevel.PeekByte(StrAdr.seg,StrAdr.off );
  192. ***** ^ not supported yet
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. ***** ^ not supported yet
  197. ***** ^ not supported yet
  198. 108 WHILE (tmpc # 0C) DO
  199. 109 (* Now we start on the fully qualified name of the program. *)
  200. 110 INC(StrAdr.off);
  201. ***** ^ undeclared identifier
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. 111 tmpc := LowLevel.PeekByte(StrAdr.seg, StrAdr.off);
  205. ***** ^ not supported yet
  206. ***** ^ not supported yet
  207. ***** ^ not supported yet
  208. ***** ^ not supported yet
  209. ***** ^ not supported yet
  210. ***** ^ not supported yet
  211. 112 END;
  212. 113 INC( StrAdr.off );
  213. ***** ^ undeclared identifier
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. 114 END;
  217. 115
  218. 116 LowLevel.Fill( SYSTEM.ADR(ParamStr), HIGH(ParamStr) + 1, 0C );
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. ***** ^ not supported yet
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. ***** ^ undeclared identifier
  225. ***** ^ not supported yet
  226. ***** ^ not supported yet
  227. 117 (* Fill the whole thing with nulls so we don't have to worry
  228. 118 about terminating the string in the right place. *)
  229. 119 cnt := 0;
  230. 120 tmpc := StrAdr.b^;
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. 121 (* If there are any parameters at all, this
  234. 122 will always be a space. *)
  235. 123 WHILE (tmpc # 0C) AND
  236. 124 (tmpc # 377C) AND
  237. 125 (cnt <= HIGH(ParamStr)) AND
  238. ***** ^ undeclared identifier
  239. ***** ^ not supported yet
  240. 126 ((cnt + 1) < knownLength) DO
  241. 127 (* Now we are on the parameters. *)
  242. 128 INC(StrAdr.off);
  243. ***** ^ undeclared identifier
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. 129 tmpc := StrAdr.b^;
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. 130 ParamStr[ cnt ] := tmpc;
  250. ***** ^ not supported yet
  251. ***** ^ not supported yet
  252. 131 INC( cnt );
  253. ***** ^ undeclared identifier
  254. ***** ^ not supported yet
  255. 132 END;
  256. 133 END GetProgParams;
  257. ***** ^ not supported yet
  258. 134
  259. 135
  260. 136 PROCEDURE ParsedParam( ParamNum: CARDINAL; VAR Result: ARRAY
  261. 137 OF CHAR ): BOOLEAN;
  262. ***** ^ not supported yet
  263. 138 VAR
  264. 139 ParamCnt, BlankSpot1, BlankSpot2: CARDINAL;
  265. 140 FullLine: ARRAY [0..255] OF CHAR;
  266. ***** ^ not supported yet
  267. ***** ^ not supported yet
  268. 141 BEGIN
  269. 142 GetProgParams( FullLine );
  270. ***** ^ not supported yet
  271. ***** ^ not supported yet
  272. 143 StrEdit.CrunchBlanks( FullLine );
  273. ***** ^ not supported yet
  274. ***** ^ not supported yet
  275. ***** ^ not supported yet
  276. 144 StrEdit.Append( FullLine, ' ' );
  277. ***** ^ not supported yet
  278. ***** ^ not supported yet
  279. ***** ^ not supported yet
  280. ***** ^ not supported yet
  281. 145 IF M2Strings.Length( FullLine ) > 1 THEN
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. ***** ^ not supported yet
  285. 146 IF (ParamNum = 0) THEN
  286. 147 ErrorManager.WARN('Zero passed to ParsedParam');
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. ***** ^ not supported yet
  290. 148 END;
  291. 149 ParamCnt := 0;
  292. 150 BlankSpot1 := 0;
  293. 151 BlankSpot2 := 0;
  294. 152 WHILE (ParamCnt < ParamNum) AND
  295. 153 (BlankSpot2 <= HIGH(FullLine) ) DO
  296. ***** ^ undeclared identifier
  297. ***** ^ not supported yet
  298. 154 BlankSpot2 := PosUtils.Positn( ' ', FullLine, BlankSpot2 );
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. ***** ^ not supported yet
  303. 155 INC( ParamCnt );
  304. ***** ^ undeclared identifier
  305. ***** ^ not supported yet
  306. 156 IF ParamCnt < ParamNum THEN
  307. 157 BlankSpot1 := BlankSpot2;
  308. 158 INC( BlankSpot2 );
  309. ***** ^ undeclared identifier
  310. ***** ^ not supported yet
  311. 159 END;
  312. 160 END;
  313. 161 IF BlankSpot2 > HIGH(FullLine) THEN
  314. ***** ^ undeclared identifier
  315. ***** ^ not supported yet
  316. 162 RETURN(FALSE);
  317. 163 ELSE
  318. 164 IF BlankSpot1 # 0 THEN
  319. 165 INC(BlankSpot1);
  320. ***** ^ undeclared identifier
  321. ***** ^ not supported yet
  322. 166 END;
  323. 167 M2Strings.Copy( FullLine, BlankSpot1,
  324. ***** ^ not supported yet
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. 168 BlankSpot2 - BlankSpot1, Result );
  328. ***** ^ not supported yet
  329. 169 RETURN(TRUE);
  330. 170 END;
  331. 171 ELSE
  332. 172 RETURN(FALSE);
  333. 173 END;
  334. 174 END ParsedParam;
  335. ***** ^ not supported yet
  336. 175
  337. 176
  338. 177 PROCEDURE GetDosVersion(VAR major, minor : CARDINAL);
  339. 178 VAR
  340. 179 tmpc : CARDINAL;
  341. 180 BEGIN
  342. 181 tmpc := 0;
  343. 182 FAPI.DOSGETVERSION( SYSTEM.ADR(tmpc ));
  344. ***** ^ not supported yet
  345. ***** ^ not supported yet
  346. ***** ^ not supported yet
  347. ***** ^ not supported yet
  348. ***** ^ not supported yet
  349. 183 major := ORD( CHAR(ByteFiddler.HighByte( tmpc )) );
  350. ***** ^ undeclared identifier
  351. ***** ^ not supported yet
  352. ***** ^ not supported yet
  353. ***** ^ not supported yet
  354. 184 minor := ORD( CHAR(ByteFiddler.LowByte( tmpc )) );
  355. ***** ^ undeclared identifier
  356. ***** ^ not supported yet
  357. ***** ^ not supported yet
  358. ***** ^ not supported yet
  359. 185 END GetDosVersion;
  360. ***** ^ not supported yet
  361. 186
  362. 187
  363. 188 PROCEDURE GetPSP() : CARDINAL;
  364. 189 VAR
  365. 190 rgstr : LowLevel.regpack;
  366. ***** ^ not supported yet
  367. 191 errcode, DosVersion, Subvers, PSPseg : CARDINAL;
  368. 192 machineMode: CARDINAL;
  369. 193 BEGIN
  370. 194 machineMode := 0;
  371. 195 (* Have to initialize machineMode because DOSGETMACHINEMODE is
  372. 196 * actually expecting the address of a single byte; we use a
  373. 197 * CARDINAL because JPI is obstinate about letting us compare
  374. 198 * byte values with the constants in FAPI.DEF.
  375. 199 *)
  376. 200 errcode := FAPI.DOSGETMACHINEMODE(SYSTEM.ADR(machineMode));
  377. ***** ^ not supported yet
  378. ***** ^ not supported yet
  379. ***** ^ not supported yet
  380. ***** ^ not supported yet
  381. ***** ^ not supported yet
  382. 201 IF machineMode = FAPI.MODE_REAL THEN
  383. ***** ^ not supported yet
  384. ***** ^ not supported yet
  385. 202 GetDosVersion(DosVersion, Subvers);
  386. ***** ^ not supported yet
  387. ***** ^ not supported yet
  388. 203 IF DosVersion >= 3 THEN
  389. 204 rgstr.a.h := 142C; (* 62H *)
  390. ***** ^ not supported yet
  391. ***** ^ not supported yet
  392. ***** ^ not supported yet
  393. 205 ELSE
  394. 206 rgstr.a.h := 121C; (* 51H *)
  395. ***** ^ not supported yet
  396. ***** ^ not supported yet
  397. ***** ^ not supported yet
  398. 207 END;
  399. 208 LowLevel.msdos( rgstr);
  400. ***** ^ not supported yet
  401. ***** ^ not supported yet
  402. ***** ^ not supported yet
  403. 209 IF LowLevel.FlaggedError(rgstr.flags) THEN
  404. ***** ^ not supported yet
  405. ***** ^ not supported yet
  406. ***** ^ not supported yet
  407. ***** ^ not supported yet
  408. 210 ErrorManager.WarnNumber("DOS error getting PSP:", ORD(rgstr.a.l));
  409. ***** ^ not supported yet
  410. ***** ^ not supported yet
  411. ***** ^ not supported yet
  412. ***** ^ undeclared identifier
  413. ***** ^ not supported yet
  414. ***** ^ not supported yet
  415. ***** ^ not supported yet
  416. 211 END;
  417. 212 RETURN (rgstr.b.x);
  418. ***** ^ not supported yet
  419. ***** ^ not supported yet
  420. ***** ^ not supported yet
  421. 213 ELSE
  422. 214 ErrorManager.WARN("Attempt to GetPSP in protected mode");
  423. ***** ^ not supported yet
  424. ***** ^ not supported yet
  425. ***** ^ not supported yet
  426. 215 END;
  427. 216 RETURN(0);
  428. 217 END GetPSP;
  429. ***** ^ not supported yet
  430. 218
  431. 219
  432. 220 PROCEDURE EnvironmentSeg(): CARDINAL;
  433. 221 VAR
  434. 222 pspSeg, envSeg, cmdlineOffs, errcode: CARDINAL;
  435. 223 machineMode: CARDINAL;
  436. 224 BEGIN
  437. 225 machineMode := 0;
  438. 226 (* Have to initialize machineMode because DOSGETMACHINEMODE is
  439. 227 * actually expecting the address of a single byte; we use a
  440. 228 * CARDINAL because JPI is obstinate about letting us compare
  441. 229 * byte values with the constants in FAPI.DEF.
  442. 230 *)
  443. 231 errcode := FAPI.DOSGETMACHINEMODE(SYSTEM.ADR(machineMode));
  444. ***** ^ not supported yet
  445. ***** ^ not supported yet
  446. ***** ^ not supported yet
  447. ***** ^ not supported yet
  448. ***** ^ not supported yet
  449. 232 IF machineMode = FAPI.MODE_REAL THEN
  450. ***** ^ not supported yet
  451. ***** ^ not supported yet
  452. 233 (* We break out the steps to make them easier to see in CodeView. *)
  453. 234 pspSeg := GetPSP();
  454. ***** ^ not supported yet
  455. ***** ^ not supported yet
  456. 235 envSeg := LowLevel.PeekWord( pspSeg, 2CH );
  457. ***** ^ not supported yet
  458. ***** ^ not supported yet
  459. ***** ^ not supported yet
  460. 236 (*Get segment address of the environment from PSP.*)
  461. 237 ELSE
  462. 238 errcode := FAPI.DOSGETENV(SYSTEM.ADR(envSeg), SYSTEM.ADR(cmdlineOffs));
  463. ***** ^ not supported yet
  464. ***** ^ not supported yet
  465. ***** ^ not supported yet
  466. ***** ^ not supported yet
  467. ***** ^ not supported yet
  468. ***** ^ not supported yet
  469. ***** ^ not supported yet
  470. ***** ^ not supported yet
  471. 239 (*Even though this is FAPI, it just doesn't seem to work
  472. 240 under DOS. That's why we're doing it differently depending
  473. 241 on the mode we're in. cmdlineOffs is telling us where the
  474. 242 command line is in the environment segment, but we don't care
  475. 243 about that now.*)
  476. 244 END;
  477. 245 RETURN envSeg;
  478. 246 END EnvironmentSeg;
  479. ***** ^ not supported yet
  480. 247
  481. 248
  482. 249 PROCEDURE ReadEnvironment(name : ARRAY OF CHAR; VAR parameter :
  483. ***** ^ not supported yet
  484. 250 ARRAY OF CHAR);
  485. ***** ^ not supported yet
  486. 251 VAR
  487. 252 bufch : CHAR;
  488. 253 tmpcopy : ARRAY [0..255] OF CHAR;
  489. ***** ^ not supported yet
  490. ***** ^ not supported yet
  491. 254 (*expanded from [0..80] on 11 Nov 86*)
  492. 255 found : BOOLEAN;
  493. 256 cmdlineOffs, pspSeg, errcode, EnvSeg, EnvNdx, cnt, EqSpot: CARDINAL;
  494. 257 machineMode: SYSTEM.BYTE;
  495. ***** ^ not supported yet
  496. 258 BEGIN
  497. 259 EnvSeg := EnvironmentSeg();
  498. ***** ^ not supported yet
  499. ***** ^ not supported yet
  500. 260 (* We'd like to call DOSSCANENV here, but it's not FAPI. *)
  501. 261
  502. 262 EnvNdx := 0;
  503. 263 found := FALSE;
  504. 264 StrEdit.SetLength(parameter, 0);
  505. ***** ^ not supported yet
  506. ***** ^ not supported yet
  507. ***** ^ not supported yet
  508. ***** ^ not supported yet
  509. 265 StrEdit.CAPstr( name );
  510. ***** ^ not supported yet
  511. ***** ^ not supported yet
  512. ***** ^ not supported yet
  513. 266
  514. 267 REPEAT
  515. 268 StrEdit.SetLength(tmpcopy, 0);
  516. ***** ^ not supported yet
  517. ***** ^ not supported yet
  518. ***** ^ not supported yet
  519. ***** ^ not supported yet
  520. 269 bufch := LowLevel.PeekByte(EnvSeg,EnvNdx);
  521. ***** ^ not supported yet
  522. ***** ^ not supported yet
  523. ***** ^ not supported yet
  524. 270 WHILE bufch # 0C DO
  525. 271 bufch := CAP(bufch);
  526. ***** ^ undeclared identifier
  527. ***** ^ not supported yet
  528. 272 StrEdit.Append(tmpcopy, bufch);
  529. ***** ^ not supported yet
  530. ***** ^ not supported yet
  531. ***** ^ not supported yet
  532. ***** ^ not supported yet
  533. 273 INC(EnvNdx);
  534. ***** ^ undeclared identifier
  535. ***** ^ not supported yet
  536. 274 bufch := LowLevel.PeekByte(EnvSeg,EnvNdx);
  537. ***** ^ not supported yet
  538. ***** ^ not supported yet
  539. ***** ^ not supported yet
  540. 275 END;
  541. 276 IF M2Strings.Pos(name,tmpcopy)=0 THEN
  542. ***** ^ not supported yet
  543. ***** ^ not supported yet
  544. ***** ^ not supported yet
  545. ***** ^ not supported yet
  546. 277 EqSpot := M2Strings.Pos('=',tmpcopy);
  547. ***** ^ not supported yet
  548. ***** ^ not supported yet
  549. ***** ^ not supported yet
  550. 278 IF (EqSpot<HIGH(tmpcopy)) AND
  551. ***** ^ undeclared identifier
  552. ***** ^ not supported yet
  553. 279 (EqSpot <= (M2Strings.Length(name)+1)) THEN
  554. ***** ^ not supported yet
  555. ***** ^ not supported yet
  556. ***** ^ not supported yet
  557. 280 (* Added second condition 26 Oct 88 to prevent
  558. 281 ReadEnvironment from returning the value for, say,
  559. 282 M2OBJLIB when what you wanted was the value for M2OBJ. *)
  560. 283 M2Strings.Copy(tmpcopy, EqSpot + 1,
  561. ***** ^ not supported yet
  562. ***** ^ not supported yet
  563. ***** ^ not supported yet
  564. 284 M2Strings.Length(tmpcopy) - 1 - EqSpot, parameter);
  565. ***** ^ not supported yet
  566. ***** ^ not supported yet
  567. ***** ^ not supported yet
  568. ***** ^ not supported yet
  569. 285 found := TRUE;
  570. 286 END;
  571. 287 END;
  572. 288 INC(EnvNdx);
  573. ***** ^ undeclared identifier
  574. ***** ^ not supported yet
  575. 289 IF LowLevel.PeekByte(EnvSeg, EnvNdx) = 0C THEN
  576. ***** ^ not supported yet
  577. ***** ^ not supported yet
  578. ***** ^ not supported yet
  579. 290 found := TRUE;
  580. 291 END;
  581. 292 UNTIL found;
  582. 293 WHILE M2Strings.Pos(' ',parameter)=0 DO
  583. ***** ^ not supported yet
  584. ***** ^ not supported yet
  585. ***** ^ not supported yet
  586. 294 M2Strings.Delete(parameter, 0, 1);
  587. ***** ^ not supported yet
  588. ***** ^ not supported yet
  589. ***** ^ not supported yet
  590. ***** ^ not supported yet
  591. 295 END;
  592. 296 END ReadEnvironment;
  593. ***** ^ not supported yet
  594. 297
  595. 298
  596. 299 PROCEDURE GetExeName( VAR ExeName: ARRAY OF CHAR );
  597. ***** ^ not supported yet
  598. 300 VAR
  599. 301 StrAdr: LowLevel.Address8086;
  600. ***** ^ not supported yet
  601. 302 tmpw, count, errcode: CARDINAL;
  602. 303 tmpc: CHAR;
  603. 304 machineMode: CARDINAL;
  604. 305 BEGIN
  605. 306 machineMode := 0;
  606. 307 ExeName[0] := 0C;
  607. ***** ^ not supported yet
  608. ***** ^ not supported yet
  609. 308 StrAdr.seg := EnvironmentSeg();
  610. ***** ^ not supported yet
  611. ***** ^ not supported yet
  612. ***** ^ not supported yet
  613. ***** ^ not supported yet
  614. 309 StrAdr.off := 0;
  615. ***** ^ not supported yet
  616. ***** ^ not supported yet
  617. 310
  618. 311 tmpw := LowLevel.PeekWord( StrAdr.seg, StrAdr.off );
  619. ***** ^ not supported yet
  620. ***** ^ not supported yet
  621. ***** ^ not supported yet
  622. ***** ^ not supported yet
  623. ***** ^ not supported yet
  624. ***** ^ not supported yet
  625. 312 (* Don't know what we're skipping over here. *)
  626. 313 WHILE (tmpw # 0) DO
  627. 314 INC(StrAdr.off);
  628. ***** ^ undeclared identifier
  629. ***** ^ not supported yet
  630. ***** ^ not supported yet
  631. 315 tmpw := LowLevel.PeekWord( StrAdr.seg, StrAdr.off );
  632. ***** ^ not supported yet
  633. ***** ^ not supported yet
  634. ***** ^ not supported yet
  635. ***** ^ not supported yet
  636. ***** ^ not supported yet
  637. ***** ^ not supported yet
  638. 316 END;
  639. 317 (* Now skip the two null bytes that terminate the set of
  640. 318 environment strings. *)
  641. 319 StrAdr.off := StrAdr.off + 2;
  642. ***** ^ not supported yet
  643. ***** ^ not supported yet
  644. ***** ^ not supported yet
  645. ***** ^ not supported yet
  646. 320
  647. 321 (* These things just never seem to be simple. It turns out that
  648. 322 in real mode, the exe file name doesn't exactly follow the
  649. 323 two null bytes that terminate the set of environment strings.
  650. 324 There are an additional couple of bytes -- a one byte value
  651. 325 and a null byte -- following the null pair. Rather than try
  652. 326 to figure out why, we just increment past them if we know
  653. 327 we're in real mode. *)
  654. 328 errcode := FAPI.DOSGETMACHINEMODE(SYSTEM.ADR(machineMode));
  655. ***** ^ not supported yet
  656. ***** ^ not supported yet
  657. ***** ^ not supported yet
  658. ***** ^ not supported yet
  659. ***** ^ not supported yet
  660. 329 IF machineMode = FAPI.MODE_REAL THEN
  661. ***** ^ not supported yet
  662. ***** ^ not supported yet
  663. 330 StrAdr.off := StrAdr.off + 2;
  664. ***** ^ not supported yet
  665. ***** ^ not supported yet
  666. ***** ^ not supported yet
  667. ***** ^ not supported yet
  668. 331 END;
  669. 332
  670. 333 count := 0;
  671. 334 tmpc := LowLevel.PeekByte( StrAdr.seg, StrAdr.off );
  672. ***** ^ not supported yet
  673. ***** ^ not supported yet
  674. ***** ^ not supported yet
  675. ***** ^ not supported yet
  676. ***** ^ not supported yet
  677. ***** ^ not supported yet
  678. 335 ExeName[count] := tmpc;
  679. ***** ^ not supported yet
  680. ***** ^ not supported yet
  681. 336 WHILE (tmpc # 0C) DO
  682. 337 (* We are now getting the path and file name of the .EXE file. *)
  683. 338 INC(StrAdr.off);
  684. ***** ^ undeclared identifier
  685. ***** ^ not supported yet
  686. ***** ^ not supported yet
  687. 339 tmpc := LowLevel.PeekByte( StrAdr.seg, StrAdr.off );
  688. ***** ^ not supported yet
  689. ***** ^ not supported yet
  690. ***** ^ not supported yet
  691. ***** ^ not supported yet
  692. ***** ^ not supported yet
  693. ***** ^ not supported yet
  694. 340 INC(count);
  695. ***** ^ undeclared identifier
  696. ***** ^ not supported yet
  697. 341 ExeName[count] := tmpc;
  698. ***** ^ not supported yet
  699. ***** ^ not supported yet
  700. 342 END;
  701. 343 END GetExeName;
  702. ***** ^ not supported yet
  703. 344
  704. 345
  705. 346 PROCEDURE GetDate(VAR month, day, year : CARDINAL; VAR weekday,
  706. 347 mmddyy : ARRAY OF CHAR);
  707. ***** ^ not supported yet
  708. 348 VAR
  709. 349 TimeData: FAPI.DATETIME;
  710. ***** ^ not supported yet
  711. 350 ErrorReturn: CARDINAL;
  712. 351 BEGIN
  713. 352 ErrorReturn := FAPI.DOSGETDATETIME( SYSTEM.ADR(TimeData));
  714. ***** ^ not supported yet
  715. ***** ^ not supported yet
  716. ***** ^ not supported yet
  717. ***** ^ not supported yet
  718. ***** ^ not supported yet
  719. 353 CASE ORD(TimeData.weekday) OF
  720. ***** ^ undeclared identifier
  721. ***** ^ not supported yet
  722. ***** ^ not supported yet
  723. 354 0 :
  724. 355 StrEdit.AssignStr('Sunday', weekday);
  725. ***** ^ not supported yet
  726. ***** ^ not supported yet
  727. ***** ^ not supported yet
  728. ***** ^ not supported yet
  729. 356 | 1 :
  730. 357 StrEdit.AssignStr('Monday', weekday);
  731. ***** ^ not supported yet
  732. ***** ^ not supported yet
  733. ***** ^ not supported yet
  734. ***** ^ not supported yet
  735. 358 | 2 :
  736. 359 StrEdit.AssignStr('Tuesday', weekday);
  737. ***** ^ not supported yet
  738. ***** ^ not supported yet
  739. ***** ^ not supported yet
  740. ***** ^ not supported yet
  741. 360 | 3 :
  742. 361 StrEdit.AssignStr('Wednesday', weekday);
  743. ***** ^ not supported yet
  744. ***** ^ not supported yet
  745. ***** ^ not supported yet
  746. ***** ^ not supported yet
  747. 362 | 4 :
  748. 363 StrEdit.AssignStr('Thursday', weekday);
  749. ***** ^ not supported yet
  750. ***** ^ not supported yet
  751. ***** ^ not supported yet
  752. ***** ^ not supported yet
  753. 364 | 5 :
  754. 365 StrEdit.AssignStr('Friday', weekday);
  755. ***** ^ not supported yet
  756. ***** ^ not supported yet
  757. ***** ^ not supported yet
  758. ***** ^ not supported yet
  759. 366 | 6 :
  760. 367 StrEdit.AssignStr('Saturday', weekday);
  761. ***** ^ not supported yet
  762. ***** ^ not supported yet
  763. ***** ^ not supported yet
  764. ***** ^ not supported yet
  765. 368 END;
  766. 369 month := ORD(TimeData.month);
  767. ***** ^ undeclared identifier
  768. ***** ^ not supported yet
  769. ***** ^ not supported yet
  770. 370 day := ORD(TimeData.day);
  771. ***** ^ undeclared identifier
  772. ***** ^ not supported yet
  773. ***** ^ not supported yet
  774. 371 year := ORD(TimeData.year);
  775. ***** ^ undeclared identifier
  776. ***** ^ not supported yet
  777. ***** ^ not supported yet
  778. 372 StrConv.DateToStr(month, day, year, mmddyy);
  779. ***** ^ not supported yet
  780. ***** ^ not supported yet
  781. ***** ^ not supported yet
  782. 373 IF ErrorReturn # 0 THEN
  783. 374 ErrorManager.WarnNumber("DOSGETDATETIME", ErrorReturn);
  784. ***** ^ not supported yet
  785. ***** ^ not supported yet
  786. ***** ^ not supported yet
  787. ***** ^ not supported yet
  788. 375 END;
  789. 376 END GetDate;
  790. ***** ^ not supported yet
  791. 377
  792. 378
  793. 379 PROCEDURE SetDate(month, day, year : CARDINAL): BOOLEAN;
  794. 380 VAR
  795. 381 TimeData: FAPI.DATETIME;
  796. ***** ^ not supported yet
  797. 382 BEGIN
  798. 383 IF FAPI.DOSGETDATETIME( SYSTEM.ADR(TimeData )) = 0 THEN
  799. ***** ^ not supported yet
  800. ***** ^ not supported yet
  801. ***** ^ not supported yet
  802. ***** ^ not supported yet
  803. ***** ^ not supported yet
  804. 384 END;
  805. 385 TimeData.month := SYSTEM.BYTE(CHR(month));
  806. ***** ^ not supported yet
  807. ***** ^ not supported yet
  808. ***** ^ not supported yet
  809. ***** ^ not supported yet
  810. ***** ^ undeclared identifier
  811. ***** ^ not supported yet
  812. 386 TimeData.day := SYSTEM.BYTE(CHR(day));
  813. ***** ^ not supported yet
  814. ***** ^ not supported yet
  815. ***** ^ not supported yet
  816. ***** ^ not supported yet
  817. ***** ^ undeclared identifier
  818. ***** ^ not supported yet
  819. 387 TimeData.year := year;
  820. ***** ^ not supported yet
  821. ***** ^ not supported yet
  822. 388 RETURN FAPI.DOSSETDATETIME( SYSTEM.ADR(TimeData )) = 0;
  823. ***** ^ not supported yet
  824. ***** ^ not supported yet
  825. ***** ^ not supported yet
  826. ***** ^ not supported yet
  827. ***** ^ not supported yet
  828. 389 END SetDate;
  829. ***** ^ not supported yet
  830. 390
  831. 391
  832. 392 PROCEDURE GetTime(VAR hours, minutes, seconds, hundredths : CARDINAL;
  833. 393 VAR text : ARRAY OF CHAR);
  834. ***** ^ not supported yet
  835. 394 VAR
  836. 395 TimeData: FAPI.DATETIME;
  837. ***** ^ not supported yet
  838. 396 ErrorReturn:CARDINAL;
  839. 397 BEGIN
  840. 398 ErrorReturn := FAPI.DOSGETDATETIME( SYSTEM.ADR(TimeData));
  841. ***** ^ not supported yet
  842. ***** ^ not supported yet
  843. ***** ^ not supported yet
  844. ***** ^ not supported yet
  845. ***** ^ not supported yet
  846. 399 hours := ORD(TimeData.hours);
  847. ***** ^ undeclared identifier
  848. ***** ^ not supported yet
  849. ***** ^ not supported yet
  850. 400 minutes := ORD(TimeData.minutes);
  851. ***** ^ undeclared identifier
  852. ***** ^ not supported yet
  853. ***** ^ not supported yet
  854. 401 seconds := ORD(TimeData.seconds);
  855. ***** ^ undeclared identifier
  856. ***** ^ not supported yet
  857. ***** ^ not supported yet
  858. 402 hundredths := ORD(TimeData.hundredths);
  859. ***** ^ undeclared identifier
  860. ***** ^ not supported yet
  861. ***** ^ not supported yet
  862. 403 StrConv.TimeToStr(hours,minutes,seconds,hundredths,text);
  863. ***** ^ not supported yet
  864. ***** ^ not supported yet
  865. ***** ^ not supported yet
  866. 404 END GetTime;
  867. ***** ^ not supported yet
  868. 405
  869. 406
  870. 407 PROCEDURE SetTime(hours, minutes, seconds, hundredths : CARDINAL);
  871. 408 VAR
  872. 409 TimeData:FAPI.DATETIME;
  873. ***** ^ not supported yet
  874. 410 BEGIN
  875. 411 IF FAPI.DOSGETDATETIME( SYSTEM.ADR(TimeData )) = 0 THEN
  876. ***** ^ not supported yet
  877. ***** ^ not supported yet
  878. ***** ^ not supported yet
  879. ***** ^ not supported yet
  880. ***** ^ not supported yet
  881. 412 END;
  882. 413 TimeData.hours := SYSTEM.BYTE(CHR(hours));
  883. ***** ^ not supported yet
  884. ***** ^ not supported yet
  885. ***** ^ not supported yet
  886. ***** ^ not supported yet
  887. ***** ^ undeclared identifier
  888. ***** ^ not supported yet
  889. 414 TimeData.minutes := SYSTEM.BYTE(CHR(minutes));
  890. ***** ^ not supported yet
  891. ***** ^ not supported yet
  892. ***** ^ not supported yet
  893. ***** ^ not supported yet
  894. ***** ^ undeclared identifier
  895. ***** ^ not supported yet
  896. 415 TimeData.seconds := SYSTEM.BYTE(CHR(seconds));
  897. ***** ^ not supported yet
  898. ***** ^ not supported yet
  899. ***** ^ not supported yet
  900. ***** ^ not supported yet
  901. ***** ^ undeclared identifier
  902. ***** ^ not supported yet
  903. 416 TimeData.hundredths := SYSTEM.BYTE(CHR(hundredths));
  904. ***** ^ not supported yet
  905. ***** ^ not supported yet
  906. ***** ^ not supported yet
  907. ***** ^ not supported yet
  908. ***** ^ undeclared identifier
  909. ***** ^ not supported yet
  910. 417 IF FAPI.DOSSETDATETIME( SYSTEM.ADR(TimeData )) = 0 THEN
  911. ***** ^ not supported yet
  912. ***** ^ not supported yet
  913. ***** ^ not supported yet
  914. ***** ^ not supported yet
  915. ***** ^ not supported yet
  916. 418 END;
  917. 419 END SetTime;
  918. ***** ^ not supported yet
  919. 420
  920. 421 PROCEDURE MemAvail(within: CARDINAL) : CARDINAL;
  921. 422 VAR
  922. 423 lasttry, lowtry, try : CARDINAL;
  923. 424 BEGIN
  924. 425 lasttry := 65535;
  925. 426 try := 65535;
  926. 427 lowtry := 0;
  927. 428 LOOP
  928. 429 WHILE (NOT VStorage.DosAvail(try)) AND (try>16) DO
  929. ***** ^ not supported yet
  930. ***** ^ not supported yet
  931. ***** ^ not supported yet
  932. 430 lasttry := try;
  933. 431 try := lowtry + (try-lowtry) DIV 2;
  934. 432 END;
  935. 433 IF ((lasttry-try) > within) AND (try>16) THEN
  936. 434 lowtry := try;
  937. 435 try := try + (lasttry-try) DIV 2;
  938. 436 ELSE
  939. 437 EXIT;
  940. 438 END;
  941. 439 END;
  942. 440 IF try<=16 THEN
  943. 441 RETURN 0;
  944. 442 ELSE
  945. 443 RETURN try;
  946. 444 END;
  947. 445 END MemAvail;
  948. ***** ^ not supported yet
  949. 446
  950. 447 BEGIN
  951. 448 Initialized := FALSE;
  952. 449 Init();
  953. ***** ^ not supported yet
  954. ***** ^ not supported yet
  955. 450 END EnvironUtils.
  956. ***** ^ not supported yet
  957. 505 errors