STRCONV.LST 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  1. Listing:
  2. 1 IMPLEMENTATION MODULE StrConv;
  3. 2 (*
  4. 3 * REPERTOIRE
  5. 4 * Release 1.6
  6. 5 * By Charles Bradford and Cole Brecheen
  7. 6 * (c) Copyright 1985-1992 PMI
  8. 7 * Green Bay, Wisconsin
  9. 8 * All rights reserved
  10. 9 * (414) 468-6040
  11. 10 *
  12. 11 * $Header: D:/logfiles/mods/strconv.mov 1.7 10 Mar 1991 15:33:12 coleb $
  13. 12 *
  14. 13 *)
  15. 14
  16. 15
  17. 16 IMPORT ErrorManager;
  18. 17 IMPORT Key;
  19. 18 IMPORT LowLevel;
  20. 19 IMPORT M2Strings;
  21. 20 IMPORT Numbers;
  22. 21 IMPORT NumTypes;
  23. 22 IMPORT PosUtils;
  24. 23 IMPORT StrEdit;
  25. 24 IMPORT StringIO;
  26. 25 IMPORT SYSTEM;
  27. 26
  28. 27 VAR
  29. 28 Initialized : BOOLEAN;
  30. 29
  31. 30 CONST
  32. 31 blank = ' ';
  33. 32
  34. 33 VAR
  35. 34 ten, zero, one : NumTypes.Real8;
  36. ***** ^ not supported yet
  37. 35
  38. 36
  39. 37 PROCEDURE StrToReal(TheStr : ARRAY OF CHAR; StartingSpot :
  40. ***** ^ not supported yet
  41. 38 CARDINAL; VAR TheReal : NumTypes.Real8): BOOLEAN;
  42. ***** ^ not supported yet
  43. 39 CONST
  44. 40 ten = 10.0;
  45. 41 one = 1.0;
  46. 42 zero = 0.0;
  47. 43 digitsize = 16;
  48. 44 OrdZero = 48;
  49. 45 VAR
  50. 46 digit : ARRAY [1..digitsize] OF INTEGER;
  51. ***** ^ not supported yet
  52. ***** ^ not supported yet
  53. 47 expstr : ARRAY [0..24] OF CHAR;
  54. ***** ^ not supported yet
  55. ***** ^ not supported yet
  56. 48 temp, WholeNum, r, fac : NumTypes.Real8;
  57. ***** ^ not supported yet
  58. 49 scalesign, negative : BOOLEAN;
  59. 50 scale, DigitsRightOfDec, exp : INTEGER;
  60. 51 NumOfBlanks, Zeroes, DecPt, EPos : INTEGER;
  61. 52 lngth, limit, spot, DigitArrayIndex, j : INTEGER;
  62. 53 BEGIN
  63. 54 TheReal := 0.0;
  64. ***** ^ not supported yet
  65. 55 exp := 0;
  66. 56 DigitsRightOfDec := 0;
  67. 57 lngth := M2Strings.Length(TheStr);
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. 58 spot := StartingSpot;
  72. 59 negative := FALSE;
  73. 60 WHILE (spot<lngth) AND (TheStr[spot]#'.') AND
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. 61 ((TheStr[spot]<'0') OR (TheStr[spot]>'9')) DO
  77. ***** ^ not supported yet
  78. ***** ^ not supported yet
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. 62 IF TheStr[spot]='-' THEN
  82. ***** ^ not supported yet
  83. ***** ^ not supported yet
  84. 63 negative := NOT negative;
  85. 64 ELSIF TheStr[spot]='+' THEN
  86. ***** ^ not supported yet
  87. ***** ^ not supported yet
  88. 65 negative := FALSE;
  89. 66 END;
  90. 67 INC(spot);
  91. ***** ^ undeclared identifier
  92. ***** ^ not supported yet
  93. 68 END;
  94. 69 IF (spot>=lngth) THEN
  95. 70 RETURN FALSE;
  96. 71 END;
  97. 72 DigitArrayIndex := 1;
  98. 73 WHILE (spot<lngth) AND (DigitArrayIndex<=digitsize) AND
  99. 74 (('0'<=TheStr[spot]) AND (TheStr[spot]<='9')) DO
  100. ***** ^ not supported yet
  101. ***** ^ not supported yet
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. 75 digit[DigitArrayIndex] := INTEGER(ORD(TheStr[spot])-OrdZero);
  105. ***** ^ not supported yet
  106. ***** ^ not supported yet
  107. ***** ^ undeclared identifier
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. 76 INC(DigitArrayIndex);
  112. ***** ^ undeclared identifier
  113. ***** ^ not supported yet
  114. 77 INC(spot);
  115. ***** ^ undeclared identifier
  116. ***** ^ not supported yet
  117. 78 END;
  118. 79
  119. 80 WholeNum := zero;
  120. ***** ^ not supported yet
  121. 81 FOR j := 1 TO DigitArrayIndex-1 DO
  122. 82 WholeNum := WholeNum*ten + Numbers.IntToR8(digit[j]);
  123. ***** ^ not supported yet
  124. ***** ^ not supported yet
  125. ***** ^ not supported yet
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. ***** ^ not supported yet
  129. 83 END;
  130. 84 IF negative THEN
  131. 85 TheReal := -WholeNum;
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. 86 ELSE
  135. 87 TheReal := WholeNum;
  136. ***** ^ not supported yet
  137. ***** ^ not supported yet
  138. 88 END;
  139. 89
  140. 90 IF (spot=lngth) OR ((TheStr[spot]#'.') AND (TheStr[spot]#'E')) THEN
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. ***** ^ not supported yet
  144. ***** ^ not supported yet
  145. 91 (*We're either at the end of the string or at the end of
  146. 92 the part of it that contains a valid real number, and
  147. 93 we've found at least one numeric character, so we
  148. 94 return true. *)
  149. 95 RETURN TRUE;
  150. 96 END;
  151. 97
  152. 98 IF (TheStr[spot]='.') THEN
  153. ***** ^ not supported yet
  154. ***** ^ not supported yet
  155. 99 scale := 0;
  156. 100 WholeNum := zero;
  157. ***** ^ not supported yet
  158. 101 INC(spot);
  159. ***** ^ undeclared identifier
  160. ***** ^ not supported yet
  161. 102 WHILE (spot<lngth)
  162. 103 AND (DigitArrayIndex<=digitsize)
  163. 104 AND PosUtils.IsNumericChar(TheStr[spot]) DO
  164. ***** ^ not supported yet
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. ***** ^ not supported yet
  168. 105 temp := Numbers.IntToR8(ORD(TheStr[spot])-OrdZero);
  169. ***** ^ not supported yet
  170. ***** ^ not supported yet
  171. ***** ^ not supported yet
  172. ***** ^ undeclared identifier
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. ***** ^ not supported yet
  176. 106 (* Every time we find a new digit right of the
  177. 107 decimal point, we essentially slide the number
  178. 108 thus far to the left one digit by multiplying
  179. 109 it by ten, and then we add this new digit as if
  180. 110 it were going to be the least significant digit
  181. 111 in the final number. WholeNum is the temporary
  182. 112 representation of the fractional part of the
  183. 113 real number. *)
  184. 114 IF negative THEN
  185. 115 WholeNum := (WholeNum * ten) - temp;
  186. ***** ^ not supported yet
  187. ***** ^ not supported yet
  188. ***** ^ not supported yet
  189. 116 ELSE
  190. 117 WholeNum := (WholeNum * ten) + temp;
  191. ***** ^ not supported yet
  192. ***** ^ not supported yet
  193. ***** ^ not supported yet
  194. 118 END;
  195. 119 INC(scale);
  196. ***** ^ undeclared identifier
  197. ***** ^ not supported yet
  198. 120 INC(DigitArrayIndex);
  199. ***** ^ undeclared identifier
  200. ***** ^ not supported yet
  201. 121 INC(DigitsRightOfDec);
  202. ***** ^ undeclared identifier
  203. ***** ^ not supported yet
  204. 122 INC(spot);
  205. ***** ^ undeclared identifier
  206. ***** ^ not supported yet
  207. 123 END;
  208. 124 IF WholeNum # zero THEN
  209. ***** ^ not supported yet
  210. 125 r := WholeNum;
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. 126 (* We kept track in the variable scale of how many times
  214. 127 we multiplied the fractional part by ten to make it
  215. 128 a whole number. Now we divide by ten that number of
  216. 129 times to get it back down to what it really is. *)
  217. 130 REPEAT
  218. 131 r := r/ten;
  219. ***** ^ not supported yet
  220. ***** ^ not supported yet
  221. 132 DEC(scale);
  222. ***** ^ undeclared identifier
  223. ***** ^ not supported yet
  224. 133 UNTIL scale=0;
  225. 134 (* Now add the fractional part to the whole number part. *)
  226. 135 TheReal := TheReal + r;
  227. ***** ^ not supported yet
  228. ***** ^ not supported yet
  229. ***** ^ not supported yet
  230. 136 ELSE
  231. 137 scale := 0;
  232. 138 END;
  233. 139 (* Now we have to worry about the possibility that the number
  234. 140 is in scientific notation. Note that spot starts out
  235. 141 sitting on the first non-numeric character after the
  236. 142 fractional part of the number. *)
  237. 143 WHILE (spot<lngth)
  238. 144 AND PosUtils.IsWhiteSpace(TheStr[spot]) DO
  239. ***** ^ not supported yet
  240. ***** ^ not supported yet
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. 145 INC(spot);
  244. ***** ^ undeclared identifier
  245. ***** ^ not supported yet
  246. 146 END;
  247. 147 END;
  248. 148 IF (spot = lngth) THEN
  249. 149 RETURN TRUE;
  250. 150 END;
  251. 151 IF (TheStr[spot] # 'E') THEN
  252. ***** ^ not supported yet
  253. ***** ^ not supported yet
  254. 152 RETURN TRUE;
  255. 153 END;
  256. 154
  257. 155 INC(spot);
  258. ***** ^ undeclared identifier
  259. ***** ^ not supported yet
  260. 156 M2Strings.Copy( TheStr, spot, lngth - spot, expstr );
  261. ***** ^ not supported yet
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. ***** ^ not supported yet
  265. 157 IF NOT StrToInteger(expstr, 0, exp) THEN
  266. ***** ^ undeclared identifier
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. 158 RETURN FALSE;
  270. 159 END;
  271. 160
  272. 161 scale := DigitsRightOfDec + exp;
  273. 162 IF scale#0 THEN
  274. 163 scalesign := scale<0;
  275. 164 scale := ABS(scale);
  276. ***** ^ undeclared identifier
  277. ***** ^ not supported yet
  278. 165 IF scale>307 THEN
  279. 166 RETURN FALSE;
  280. 167 END;
  281. 168 IF TheReal # zero THEN
  282. ***** ^ not supported yet
  283. 169 FOR spot := 0 TO 8 DO
  284. 170 IF CARDINAL(spot) IN BITSET(scale) THEN
  285. ***** ^ not supported yet
  286. ***** ^ undeclared identifier
  287. ***** ^ not supported yet
  288. 171 IF scalesign THEN
  289. 172 TheReal := TheReal / NumTypes.R8TenPowers[spot];
  290. ***** ^ not supported yet
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. ***** ^ not supported yet
  294. ***** ^ not supported yet
  295. 173 ELSE
  296. 174 TheReal := TheReal * NumTypes.R8TenPowers[spot];
  297. ***** ^ not supported yet
  298. ***** ^ not supported yet
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. 175 END;
  303. 176 END;
  304. 177 END;
  305. 178 END;
  306. 179 END;
  307. 180 RETURN TRUE;
  308. 181 END StrToReal;
  309. ***** ^ not supported yet
  310. 182
  311. 183
  312. 184 PROCEDURE AppendDecoded(VAR TheStr : ARRAY OF CHAR; TheCodeChar : CHAR;
  313. ***** ^ not supported yet
  314. 185 StrConst : ARRAY OF CHAR);
  315. ***** ^ not supported yet
  316. 186 VAR
  317. 187 CharNum, spot1, spot2 : CARDINAL;
  318. 188 TmpStr : ARRAY [0..255] OF CHAR;
  319. ***** ^ not supported yet
  320. ***** ^ not supported yet
  321. 189 tmpchar : CHAR;
  322. 190 BEGIN
  323. 191 spot2 := M2Strings.Pos(TheCodeChar,StrConst);
  324. ***** ^ not supported yet
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. 192 spot1 := 0;
  328. 193 WHILE spot2<=HIGH(StrConst) DO
  329. ***** ^ undeclared identifier
  330. ***** ^ not supported yet
  331. 194 IF spot2>spot1 THEN
  332. 195 M2Strings.Copy(StrConst, spot1, spot2-spot1, TmpStr);
  333. ***** ^ not supported yet
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. ***** ^ not supported yet
  337. 196 StrEdit.Append(TheStr, TmpStr);
  338. ***** ^ not supported yet
  339. ***** ^ not supported yet
  340. ***** ^ not supported yet
  341. ***** ^ not supported yet
  342. 197 (* Copies everything from the start of StrConst, or from
  343. 198 the end of the last CharCode, into TheStr. *)
  344. 199 END;
  345. 200 IF NOT StrToCardinal(StrConst,spot2+1,CharNum) THEN
  346. ***** ^ undeclared identifier
  347. ***** ^ not supported yet
  348. ***** ^ not supported yet
  349. 201 ErrorManager.WARN('Invalid string in AppendDecoded');
  350. ***** ^ not supported yet
  351. ***** ^ not supported yet
  352. ***** ^ not supported yet
  353. 202 END;
  354. 203 tmpchar := CHR(CharNum);
  355. ***** ^ undeclared identifier
  356. ***** ^ not supported yet
  357. 204 StrEdit.Append(TheStr, tmpchar);
  358. ***** ^ not supported yet
  359. ***** ^ not supported yet
  360. ***** ^ not supported yet
  361. ***** ^ not supported yet
  362. 205 spot1 := spot2+4;
  363. 206 spot2 := PosUtils.Positn(TheCodeChar,StrConst,spot2+1);
  364. ***** ^ not supported yet
  365. ***** ^ not supported yet
  366. ***** ^ not supported yet
  367. ***** ^ not supported yet
  368. 207 END;
  369. 208 IF spot1< M2Strings.Length(StrConst) THEN
  370. ***** ^ not supported yet
  371. ***** ^ not supported yet
  372. ***** ^ not supported yet
  373. 209 M2Strings.Copy(StrConst, spot1, M2Strings.Length(StrConst)-spot1, TmpStr);
  374. ***** ^ not supported yet
  375. ***** ^ not supported yet
  376. ***** ^ not supported yet
  377. ***** ^ not supported yet
  378. ***** ^ not supported yet
  379. ***** ^ not supported yet
  380. ***** ^ not supported yet
  381. 210 StrEdit.Append(TheStr, TmpStr);
  382. ***** ^ not supported yet
  383. ***** ^ not supported yet
  384. ***** ^ not supported yet
  385. ***** ^ not supported yet
  386. 211 END;
  387. 212 END AppendDecoded;
  388. ***** ^ not supported yet
  389. 213
  390. 214 PROCEDURE CardinalToStr(TheNum : CARDINAL; width : CARDINAL; VAR
  391. 215 TheStr : ARRAY OF CHAR);
  392. ***** ^ not supported yet
  393. 216 VAR
  394. 217 spot : INTEGER;
  395. 218 tmp : ARRAY [0..80] OF CHAR;
  396. ***** ^ not supported yet
  397. ***** ^ not supported yet
  398. 219 BEGIN
  399. 220 LowLevel.Fill(SYSTEM.ADR(TheStr), 1+HIGH(TheStr), blank);
  400. ***** ^ not supported yet
  401. ***** ^ not supported yet
  402. ***** ^ not supported yet
  403. ***** ^ not supported yet
  404. ***** ^ not supported yet
  405. ***** ^ undeclared identifier
  406. ***** ^ not supported yet
  407. ***** ^ not supported yet
  408. 221 (*Fill TheStr with spaces.*)
  409. 222 spot := HIGH(TheStr);
  410. ***** ^ undeclared identifier
  411. ***** ^ not supported yet
  412. 223 REPEAT
  413. 224 TheStr[spot] := CHR((TheNum MOD 10)+48);
  414. ***** ^ not supported yet
  415. ***** ^ not supported yet
  416. ***** ^ undeclared identifier
  417. ***** ^ not supported yet
  418. 225 TheNum := TheNum DIV 10;
  419. 226 DEC(spot);
  420. ***** ^ undeclared identifier
  421. ***** ^ not supported yet
  422. 227 UNTIL (TheNum<10) OR (spot<=0);
  423. 228 IF TheNum#0 THEN
  424. 229 TheStr[spot] := CHR(TheNum+48);
  425. ***** ^ not supported yet
  426. ***** ^ not supported yet
  427. ***** ^ undeclared identifier
  428. ***** ^ not supported yet
  429. 230 END;
  430. 231 IF M2Strings.Length(TheStr)>width THEN
  431. ***** ^ not supported yet
  432. ***** ^ not supported yet
  433. ***** ^ not supported yet
  434. 232 StrEdit.CutLeadingChars(' ', TheStr);
  435. ***** ^ not supported yet
  436. ***** ^ not supported yet
  437. ***** ^ not supported yet
  438. 233 END;
  439. 234 IF M2Strings.Length(TheStr)<width THEN
  440. ***** ^ not supported yet
  441. ***** ^ not supported yet
  442. ***** ^ not supported yet
  443. 235 LowLevel.Fill(SYSTEM.ADR(tmp), 1+HIGH(tmp), blank);
  444. ***** ^ not supported yet
  445. ***** ^ not supported yet
  446. ***** ^ not supported yet
  447. ***** ^ not supported yet
  448. ***** ^ not supported yet
  449. ***** ^ undeclared identifier
  450. ***** ^ not supported yet
  451. ***** ^ not supported yet
  452. 236 StrEdit.SetLength(tmp, width-M2Strings.Length(TheStr));
  453. ***** ^ not supported yet
  454. ***** ^ not supported yet
  455. ***** ^ not supported yet
  456. ***** ^ not supported yet
  457. ***** ^ not supported yet
  458. ***** ^ not supported yet
  459. 237 StrEdit.Append(tmp, TheStr);
  460. ***** ^ not supported yet
  461. ***** ^ not supported yet
  462. ***** ^ not supported yet
  463. ***** ^ not supported yet
  464. 238 M2Strings.Assign(tmp, TheStr);
  465. ***** ^ not supported yet
  466. ***** ^ not supported yet
  467. ***** ^ not supported yet
  468. ***** ^ not supported yet
  469. 239 END;
  470. 240 END CardinalToStr;
  471. ***** ^ not supported yet
  472. 241
  473. 242 PROCEDURE IntegerToStr(TheNum : INTEGER; width : CARDINAL; VAR
  474. 243 TheStr : ARRAY OF CHAR);
  475. ***** ^ not supported yet
  476. 244 VAR
  477. 245 spot : CARDINAL;
  478. 246 BEGIN
  479. 247 CardinalToStr(ABS(TheNum), width, TheStr);
  480. ***** ^ not supported yet
  481. ***** ^ undeclared identifier
  482. ***** ^ not supported yet
  483. ***** ^ not supported yet
  484. 248 IF TheNum<0 THEN
  485. 249 spot := LowLevel.ScanNE( M2Strings.Length(TheStr), blank,
  486. ***** ^ not supported yet
  487. ***** ^ not supported yet
  488. ***** ^ not supported yet
  489. ***** ^ not supported yet
  490. ***** ^ not supported yet
  491. 250 SYSTEM.ADR(TheStr) );
  492. ***** ^ not supported yet
  493. ***** ^ not supported yet
  494. ***** ^ not supported yet
  495. 251 (* find the first nonblank *)
  496. 252 IF spot>0 THEN
  497. 253 (* We do this to preserve the correct width,
  498. 254 if possible. *)
  499. 255 TheStr[spot-1] := '-';
  500. ***** ^ not supported yet
  501. ***** ^ not supported yet
  502. 256 ELSE
  503. 257 M2Strings.Insert('-', TheStr, spot);
  504. ***** ^ not supported yet
  505. ***** ^ not supported yet
  506. ***** ^ not supported yet
  507. ***** ^ not supported yet
  508. 258 END;
  509. 259 END;
  510. 260 END IntegerToStr;
  511. ***** ^ not supported yet
  512. 261
  513. 262
  514. 263 TYPE
  515. 264 LongAndShort =
  516. 265 RECORD
  517. 266 CASE : CHAR OF
  518. ***** ^ not supported yet
  519. ***** ^ 'POINTER' expected
  520. 267 'A' :
  521. 268 longi : LONGINT;
  522. 269 | 'B' :
  523. 270 locard, hicard : CARDINAL;
  524. 271 | 'C' :
  525. 272 loint, hiint : INTEGER;
  526. 273 END;
  527. 274 END;
  528. 275 VAR
  529. 276 TenPowers : ARRAY [0..9] OF LongAndShort;
  530. 277
  531. 278 PROCEDURE LongIntegerToStr(TheNum : LONGINT; width : CARDINAL;
  532. 279 VAR TheStr : ARRAY OF CHAR);
  533. 280 VAR
  534. 281 LongConv : LongAndShort;
  535. 282 positive : BOOLEAN;
  536. 283 charstr : ARRAY [0..80] OF CHAR;
  537. 284 i : CARDINAL;
  538. 285 tmpchar: CHAR;
  539. 286 BEGIN
  540. 287 LongConv.longi := TheNum;
  541. 288 IF LongConv.hiint < 0 THEN
  542. 289 TheNum := -TheNum;
  543. 290 positive := FALSE;
  544. 291 ELSE
  545. 292 positive := TRUE;
  546. 293 END;
  547. 294 (* Fill(ADR(charstr), 10, '0'); replaced below *)
  548. 295 charstr[10] := 0C;
  549. 296 FOR i := 0 TO 9 DO
  550. 297 tmpchar := '0';
  551. 298 WHILE NOT (TheNum < TenPowers[i].longi) DO
  552. 299 INC( tmpchar);
  553. 300 TheNum := TheNum - TenPowers[i].longi;
  554. 301 END;
  555. 302 charstr[i] := tmpchar;
  556. 303 END;
  557. 304 StrEdit.CutLeadingChars('0', charstr);
  558. 305 IF NOT positive THEN
  559. 306 M2Strings.Insert('-', charstr, 0);
  560. 307 END;
  561. 308 IF charstr[0]=0C THEN
  562. 309 charstr[0] := '0';
  563. 310 charstr[1] := 0C;
  564. 311 END;
  565. 312 M2Strings.Assign(charstr, TheStr);
  566. 313 IF M2Strings.Length(TheStr)<width THEN
  567. 314 LowLevel.Fill(SYSTEM.ADR(charstr), 1+HIGH(charstr), blank);
  568. 315 StrEdit.SetLength(charstr, width-M2Strings.Length(TheStr));
  569. 316 StrEdit.Append(charstr, TheStr);
  570. 317 M2Strings.Assign(charstr, TheStr);
  571. 318 END;
  572. 319 END LongIntegerToStr;
  573. 320
  574. 321
  575. 322 (*$O-*)
  576. 323 (*We turn off optimization for this procedure because of a bug in
  577. 324 the beta copy of Logitech's v3.0.*)
  578. 325 PROCEDURE StrToLongInteger(TheStr : ARRAY OF CHAR; StartingSpot :
  579. 326 CARDINAL; VAR TheLong : LONGINT) : BOOLEAN;
  580. 327 VAR
  581. 328 positive : BOOLEAN;
  582. 329 ten : LONGINT;
  583. 330 dumlong : LongAndShort;
  584. 331 charstr : ARRAY [0..10] OF CHAR;
  585. 332 leng : CARDINAL;
  586. 333 BEGIN
  587. 334 leng := M2Strings.Length(TheStr);
  588. 335 TheLong := NumTypes.L0;
  589. 336 ten := Numbers.Lc(10);
  590. 337 positive := TRUE;
  591. 338 WHILE (StartingSpot<leng) AND ((TheStr[StartingSpot]<'0')
  592. 339 OR (TheStr[StartingSpot]>'9')) DO
  593. 340 IF TheStr[StartingSpot]='-' THEN
  594. 341 positive := FALSE;
  595. 342 END;
  596. 343 INC(StartingSpot);
  597. 344 END;
  598. 345 IF (StartingSpot>=leng) THEN
  599. 346 RETURN FALSE;
  600. 347 END;
  601. 348 WHILE (StartingSpot<leng) AND ((TheStr[StartingSpot]>='0'
  602. 349 ) AND (TheStr[StartingSpot]<='9')) DO
  603. 350 TheLong := TheLong * ten;
  604. 351 dumlong.hicard := 0;
  605. 352 dumlong.locard := ORD(TheStr[StartingSpot])-48;
  606. 353 TheLong := TheLong + dumlong.longi;
  607. 354 INC(StartingSpot);
  608. 355 END;
  609. 356 IF NOT positive THEN
  610. 357 TheLong := -TheLong;
  611. 358 END;
  612. 359 RETURN TRUE;
  613. 360 END StrToLongInteger;
  614. 361 (*$O=*)
  615. 362
  616. 363
  617. 364 PROCEDURE StrToCardinal(TheStr : ARRAY OF CHAR; StartingSpot :
  618. 365 CARDINAL; VAR TheCard : CARDINAL) : BOOLEAN;
  619. 366 VAR
  620. 367 spot, StrLen : CARDINAL;
  621. 368 BEGIN
  622. 369 spot := StartingSpot;
  623. 370 TheCard := 0;
  624. 371 StrLen := M2Strings.Length(TheStr);
  625. 372 WHILE ((spot<StrLen) AND ((TheStr[spot]<'0'
  626. 373 ) OR (TheStr[spot]>'9'))) DO
  627. 374 INC(spot);
  628. 375 (*Skips all leading non-numeric stuff.*)
  629. 376 END;
  630. 377 IF spot>=StrLen THEN
  631. 378 RETURN FALSE;
  632. 379 END;
  633. 380 WHILE (spot<StrLen) AND (TheStr[spot]>='0'
  634. 381 ) AND (TheStr[spot]<='9') DO
  635. 382 TheCard := TheCard*10;
  636. 383 INC(TheCard, ORD(TheStr[spot])-48);
  637. 384 INC(spot);
  638. 385 END;
  639. 386 RETURN TRUE;
  640. 387 END StrToCardinal;
  641. 388
  642. 389
  643. 390 PROCEDURE StrToInteger(TheStr : ARRAY OF CHAR; StartingSpot :
  644. 391 CARDINAL; VAR TheInt : INTEGER) : BOOLEAN;
  645. 392 VAR
  646. 393 spot, StrLen : CARDINAL;
  647. 394 negative : BOOLEAN;
  648. 395 BEGIN
  649. 396 spot := StartingSpot;
  650. 397 TheInt := 0;
  651. 398 StrLen := M2Strings.Length(TheStr);
  652. 399 negative := FALSE;
  653. 400 WHILE ((spot<StrLen) AND ((TheStr[spot]<'0'
  654. 401 ) OR (TheStr[spot]>'9'))) DO
  655. 402 IF TheStr[spot]='-' THEN
  656. 403 negative := NOT negative;
  657. 404 (* Means negative will go back to FALSE if
  658. 405 there are two leading minus signs; may
  659. 406 not be good for much, but why not? *)
  660. 407 END;
  661. 408 INC(spot);
  662. 409 (*Skips all leading non-numeric stuff.*)
  663. 410 END;
  664. 411 IF spot>=StrLen THEN
  665. 412 RETURN FALSE;
  666. 413 END;
  667. 414 WHILE (spot<StrLen) AND (TheStr[spot]>='0'
  668. 415 ) AND (TheStr[spot]<='9') DO
  669. 416 TheInt := TheInt*10;
  670. 417 INC(TheInt, ORD(TheStr[spot])-48);
  671. 418 INC(spot);
  672. 419 END;
  673. 420 IF negative THEN
  674. 421 TheInt := -TheInt;
  675. 422 END;
  676. 423 RETURN TRUE;
  677. 424 END StrToInteger;
  678. 425
  679. 426
  680. 427 PROCEDURE DateToStr(month, day, year : CARDINAL; VAR TheStr :
  681. 428 ARRAY OF CHAR);
  682. 429 VAR
  683. 430 DayStr, MnthStr, YrStr : ARRAY [0..15] OF CHAR;
  684. 431 BEGIN
  685. 432 CardinalToStr(day, 2, DayStr);
  686. 433 IF DayStr[0]=' ' THEN
  687. 434 DayStr[0] := '0';
  688. 435 END;
  689. 436 CardinalToStr(month, 2, MnthStr);
  690. 437 CardinalToStr(year, 2, YrStr);
  691. 438 IF M2Strings.Length(YrStr)=4 THEN
  692. 439 (*Delete the '19' if it is present.*)
  693. 440 M2Strings.Delete(YrStr, 0, 2);
  694. 441 END;
  695. 442 M2Strings.Assign(MnthStr, TheStr);
  696. 443 StrEdit.Append(TheStr, '-');
  697. 444 StrEdit.Append(TheStr, DayStr);
  698. 445 StrEdit.Append(TheStr, '-');
  699. 446 StrEdit.Append(TheStr, YrStr);
  700. 447 END DateToStr;
  701. 448
  702. 449
  703. 450 PROCEDURE TimeToStr(hours, minutes, seconds, hundredths : CARDINAL;
  704. 451 VAR TheStr : ARRAY OF CHAR);
  705. 452 VAR
  706. 453 HundrStr, SecStr, MinStr, HourStr : ARRAY [0..20] OF CHAR;
  707. 454 pm : BOOLEAN;
  708. 455 BEGIN
  709. 456 CardinalToStr(hundredths, 2, HundrStr);
  710. 457 IF HundrStr[0]=' ' THEN
  711. 458 HundrStr[0] := '0';
  712. 459 END;
  713. 460 CardinalToStr(seconds, 2, SecStr);
  714. 461 IF SecStr[0]=' ' THEN
  715. 462 SecStr[0] := '0';
  716. 463 END;
  717. 464 CardinalToStr(minutes, 2, MinStr);
  718. 465 IF MinStr[0]=' ' THEN
  719. 466 MinStr[0] := '0';
  720. 467 END;
  721. 468 pm := hours>=12;
  722. 469 (* 10 July 87: changed from hours > 12 at suggestion of
  723. 470 H. A. Hofmans to correct problem with the first noon
  724. 471 hour being called am. *)
  725. 472 IF hours>12 THEN
  726. 473 DEC(hours, 12);
  727. 474 END;
  728. 475 CardinalToStr(hours, 2, HourStr);
  729. 476 M2Strings.Assign(HourStr, TheStr);
  730. 477 StrEdit.Append(TheStr, ':');
  731. 478 StrEdit.Append(TheStr, MinStr);
  732. 479 StrEdit.Append(TheStr, ':');
  733. 480 StrEdit.Append(TheStr, SecStr);
  734. 481 StrEdit.Append(TheStr, ':');
  735. 482 StrEdit.Append(TheStr, HundrStr);
  736. 483 IF pm THEN
  737. 484 StrEdit.Append(TheStr, 'p');
  738. 485 ELSE
  739. 486 StrEdit.Append(TheStr, 'a');
  740. 487 END;
  741. 488 END TimeToStr;
  742. 489
  743. 490
  744. 491 PROCEDURE RealToStr( TheNum: NumTypes.Real8; DigitsRightOfDec,
  745. 492 width: INTEGER; VAR TheStr: ARRAY OF CHAR);
  746. 493
  747. 494 CONST
  748. 495 ten = 10.0;
  749. 496 one = 1.0;
  750. 497 zero = 0.0;
  751. 498 VAR
  752. 499 spot : CARDINAL;
  753. 500 i, exp : INTEGER;
  754. 501 expstr : ARRAY [0..6] OF CHAR;
  755. 502 tmpstr : ARRAY [0..31] OF CHAR;
  756. 503
  757. 504 PROCEDURE PutDigit(VAR r : NumTypes.Real8);
  758. 505 VAR
  759. 506 dig : LONGINT;
  760. 507 d : CARDINAL;
  761. 508 WholePart : NumTypes.Real8;
  762. 509 BEGIN
  763. 510 dig := Numbers.R8ToL(r);
  764. 511 d := Numbers.C(dig);
  765. 512 tmpstr[spot] := CHR(d+ORD('0'));
  766. 513 INC(spot);
  767. 514 WholePart := Numbers.LToR8(dig);
  768. 515 r := r - WholePart;
  769. 516 END PutDigit;
  770. 517
  771. 518 BEGIN
  772. 519 LowLevel.Fill(SYSTEM.ADR(tmpstr), 1+HIGH(tmpstr), 0C);
  773. 520 (*Fill tmpstr with nulls.*)
  774. 521 spot := 0;
  775. 522 IF TheNum<zero THEN
  776. 523 tmpstr[spot] := '-';
  777. 524 INC(spot);
  778. 525 TheNum := -TheNum;
  779. 526 END;
  780. 527 exp := 0;
  781. 528 IF TheNum#zero THEN
  782. 529 LOOP
  783. 530 IF TheNum<one THEN
  784. 531 TheNum := TheNum*ten;
  785. 532 DEC(exp);
  786. 533 ELSIF TheNum>=ten THEN
  787. 534 TheNum := TheNum/ten;
  788. 535 INC(exp);
  789. 536 ELSE
  790. 537 EXIT;
  791. 538 END;
  792. 539 END;
  793. 540 END;
  794. 541 PutDigit(TheNum);
  795. 542 tmpstr[spot] := '.';
  796. 543 INC(spot);
  797. 544 FOR i := 1 TO 15 DO
  798. 545 TheNum := TheNum*ten;
  799. 546 PutDigit(TheNum);
  800. 547 END;
  801. 548 tmpstr[spot] := 'E';
  802. 549 IntegerToStr(exp, 0, expstr);
  803. 550 StrEdit.Append(tmpstr, expstr);
  804. 551 IF DigitsRightOfDec < 0 THEN
  805. 552 RETURN;
  806. 553 END;
  807. 554 IF NOT ScientificToPlain( tmpstr, DigitsRightOfDec,
  808. 555 width, TheStr ) THEN
  809. 556 ErrorManager.WARN('Invalid real');
  810. 557 END;
  811. 558 END RealToStr;
  812. 559
  813. 560
  814. 561 PROCEDURE ReturnedCard( TheStr: ARRAY OF CHAR ):
  815. 562 CARDINAL;
  816. 563 VAR
  817. 564 tmpc: CARDINAL;
  818. 565 BEGIN
  819. 566 IF NOT StrToCardinal( TheStr, 0, tmpc ) THEN
  820. 567 StrEdit.Append( TheStr, ' # number' );
  821. 568 ErrorManager.WARN( TheStr );
  822. 569 END;
  823. 570 RETURN tmpc;
  824. 571 END ReturnedCard;
  825. 572
  826. 573 PROCEDURE ReturnedInt( TheStr: ARRAY OF CHAR ):
  827. 574 INTEGER;
  828. 575 VAR
  829. 576 tmpi: INTEGER;
  830. 577 BEGIN
  831. 578 IF NOT StrToInteger( TheStr, 0, tmpi ) THEN
  832. 579 StrEdit.Append( TheStr, ' # number' );
  833. 580 ErrorManager.WARN( TheStr );
  834. 581 END;
  835. 582 RETURN tmpi;
  836. 583 END ReturnedInt;
  837. 584
  838. 585
  839. 586 PROCEDURE ScientificToPlain(scientific : ARRAY OF CHAR;
  840. 587 DigitsToRight, width : CARDINAL; VAR plain : ARRAY OF CHAR) :
  841. 588 BOOLEAN;
  842. 589 VAR
  843. 590 RoundSpot, lngth, FirstSpot, eSpot, DotSpot,
  844. 591 ProperNumOfDigits : CARDINAL;
  845. 592 cnt, DecimalShift : INTEGER;
  846. 593 tmpstr : ARRAY [0..79] OF CHAR;
  847. 594 carrying : BOOLEAN;
  848. 595 e, dot, space, zero : ARRAY [0..0] OF CHAR;
  849. 596 (* We use these instead of CHAR constants because this
  850. 597 procedure was actually written for the ITC version.
  851. 598 See CharStuf module chapter for explanation. *)
  852. 599 BEGIN
  853. 600 e[0] := 'E';
  854. 601 dot[0] := '.';
  855. 602 space[0] := ' ';
  856. 603 zero[0] := '0';
  857. 604 eSpot := M2Strings.Pos(e,scientific);
  858. 605 IF NOT StrToInteger(scientific, eSpot, DecimalShift) THEN
  859. 606 RETURN FALSE;
  860. 607 END;
  861. 608 M2Strings.Assign(scientific, tmpstr);
  862. 609 M2Strings.Delete(tmpstr, eSpot,
  863. 610 (M2Strings.Length(tmpstr) - eSpot) + 1);
  864. 611 DotSpot := M2Strings.Pos(dot,tmpstr);
  865. 612 IF DotSpot>HIGH(tmpstr) THEN
  866. 613 RETURN FALSE;
  867. 614 ELSE
  868. 615 M2Strings.Delete(tmpstr, DotSpot, 1);
  869. 616 END;
  870. 617 IF tmpstr[0]='-' THEN
  871. 618 FirstSpot := 1;
  872. 619 ELSE
  873. 620 FirstSpot := 0;
  874. 621 END;
  875. 622 IF DecimalShift>=0 THEN
  876. 623 DotSpot := DotSpot + CARDINAL(DecimalShift);
  877. 624 ELSE
  878. 625 DecimalShift := -DecimalShift;
  879. 626 FOR cnt := 1 TO DecimalShift DO
  880. 627 M2Strings.Insert(zero, tmpstr, FirstSpot);
  881. 628 END;
  882. 629 DotSpot := FirstSpot + 1;
  883. 630 END;
  884. 631 ProperNumOfDigits := (DotSpot + DigitsToRight);
  885. 632 lngth := M2Strings.Length(tmpstr) + 1;
  886. 633 IF lngth > ProperNumOfDigits THEN
  887. 634 IF LowLevel.ScanNE( ProperNumOfDigits, '9', SYSTEM.ADR(tmpstr)
  888. 635 ) < INTEGER(ProperNumOfDigits) THEN
  889. 636 (*We can round up without extending length of string.*)
  890. 637 RoundSpot := ProperNumOfDigits;
  891. 638 carrying := FALSE;
  892. 639 WHILE RoundSpot > 0 DO
  893. 640 IF (tmpstr[RoundSpot] >= '5') OR carrying THEN
  894. 641 INC( tmpstr[RoundSpot - 1] );
  895. 642 carrying := FALSE;
  896. 643 END;
  897. 644 DEC(RoundSpot);
  898. 645 IF tmpstr[RoundSpot] = ':' THEN
  899. 646 (*We tried to round up a 9.*)
  900. 647 carrying := TRUE;
  901. 648 tmpstr[RoundSpot] := '0';
  902. 649 ELSIF tmpstr[RoundSpot] = '/' THEN
  903. 650 carrying := TRUE;
  904. 651 (*We meant to round up the first digit to the
  905. 652 left of the decimal point, but actually rounded up
  906. 653 the decimal point itself. The carrying flag
  907. 654 will correct it next time through.*)
  908. 655 tmpstr[RoundSpot] := '.';
  909. 656 ELSE
  910. 657 RoundSpot := 0;
  911. 658 (*Forces us out of the loop.*)
  912. 659 END;
  913. 660 END;
  914. 661 END;
  915. 662 M2Strings.Delete(tmpstr, ProperNumOfDigits, lngth-ProperNumOfDigits);
  916. 663 lngth := ProperNumOfDigits + 1;
  917. 664 ELSE
  918. 665 WHILE (ProperNumOfDigits + 1) > lngth DO
  919. 666 StrEdit.Append(tmpstr, zero);
  920. 667 INC(lngth);
  921. 668 END;
  922. 669 END;
  923. 670 M2Strings.Insert(dot, tmpstr, DotSpot);
  924. 671 (*We postpone insertion of the dot so that we can scan
  925. 672 for non-9's above.*)
  926. 673 WHILE (lngth<width) AND (lngth < (HIGH(tmpstr)+1)) DO
  927. 674 M2Strings.Insert(space, tmpstr, 0);
  928. 675 INC(lngth);
  929. 676 END;
  930. 677 M2Strings.Assign(tmpstr, plain);
  931. 678 RETURN TRUE;
  932. 679 END ScientificToPlain;
  933. 680
  934. 681
  935. 682 PROCEDURE OldSetFormToNew( OldFormStr: ARRAY OF CHAR; VAR
  936. 683 NewFormStr: ARRAY OF CHAR );
  937. 684 (* This procedure will be deleted in the next release. *)
  938. 685 VAR
  939. 686 tmpcard, last, cnt: CARDINAL;
  940. 687 tmpstr, tmpstr2: ARRAY [0..79] OF CHAR;
  941. 688
  942. 689 PROCEDURE GetSymbol( VAR TheSymbol: ARRAY OF CHAR );
  943. 690 VAR
  944. 691 s: ARRAY [0..0] OF CHAR;
  945. 692 InQuote : BOOLEAN;
  946. 693 WhichQuote : CHAR;
  947. 694 BEGIN
  948. 695 TheSymbol[0] := 0C;
  949. 696 IF OldFormStr[cnt] = '.' THEN
  950. 697 StrEdit.Append( TheSymbol, '..' );
  951. 698 INC( cnt );
  952. 699 RETURN;
  953. 700 END;
  954. 701 s[0] := OldFormStr[cnt];
  955. 702 InQuote := FALSE;
  956. 703 WhichQuote := 0C;
  957. 704 REPEAT
  958. 705 IF InQuote OR (NOT PosUtils.Present(s, ';.')) THEN
  959. 706 StrEdit.Append( TheSymbol, s );
  960. 707 END;
  961. 708 IF (s[0] = '"') OR (s[0] = "'") THEN
  962. 709 IF InQuote THEN
  963. 710 IF (WhichQuote = s[0]) THEN
  964. 711 InQuote := FALSE;
  965. 712 END;
  966. 713 ELSE
  967. 714 InQuote := TRUE;
  968. 715 WhichQuote := s[0];
  969. 716 END
  970. 717 END;
  971. 718 INC( cnt );
  972. 719 IF cnt <= last THEN
  973. 720 s[0] := OldFormStr[cnt];
  974. 721 END;
  975. 722 UNTIL (cnt > last) OR ( (NOT InQuote) AND PosUtils.Present(s,
  976. 723 ';.') );
  977. 724 INC( cnt );
  978. 725 StrEdit.CrunchBlanks( TheSymbol );
  979. 726 END GetSymbol;
  980. 727
  981. 728 BEGIN
  982. 729 last := M2Strings.Length( OldFormStr );
  983. 730 IF last > 0 THEN
  984. 731 DEC( last );
  985. 732 ELSE
  986. 733 StrEdit.AssignStr( "{0..400}", NewFormStr );
  987. 734 RETURN;
  988. 735 END;
  989. 736 StrEdit.AssignStr( "{", NewFormStr );
  990. 737 cnt := 0;
  991. 738 REPEAT
  992. 739 GetSymbol( tmpstr );
  993. 740 IF CAP(tmpstr[0]) = 'E' THEN
  994. 741 IF NOT StrToCardinal( tmpstr, 1, tmpcard ) THEN
  995. 742 ErrorManager.WARN('Bad set string.');
  996. 743 END;
  997. 744 INC( tmpcard, Key.Extended );
  998. 745 CardinalToStr( tmpcard, 0, tmpstr2 );
  999. 746 StrEdit.Append( NewFormStr, tmpstr2 );
  1000. 747 ELSE
  1001. 748 (*These should always be numbers or ellipses.*)
  1002. 749 IF (tmpstr[0] = '.') THEN
  1003. 750 M2Strings.Delete( NewFormStr,
  1004. 751 M2Strings.Length(NewFormStr) - 1, 1 );
  1005. 752 (*delete the comma appended in the last loop*)
  1006. 753 END;
  1007. 754 StrEdit.Append( NewFormStr, tmpstr );
  1008. 755 END;
  1009. 756 IF (cnt <= last) AND (tmpstr[0] # '.') THEN
  1010. 757 StrEdit.Append( NewFormStr, ',' );
  1011. 758 END;
  1012. 759 UNTIL cnt > last;
  1013. 760 StrEdit.Append( NewFormStr, "}" );
  1014. 761 END OldSetFormToNew;
  1015. 762
  1016. 763
  1017. 764 PROCEDURE Init();
  1018. 765 VAR
  1019. 766 i : CARDINAL;
  1020. 767 BEGIN
  1021. 768 IF Initialized THEN
  1022. 769 RETURN;
  1023. 770 ELSE
  1024. 771 Initialized := TRUE;
  1025. 772 END;
  1026. 773 ErrorManager.Init();
  1027. 774 Key.Init();
  1028. 775 LowLevel.Init();
  1029. 776 M2Strings.Init();
  1030. 777 Numbers.Init();
  1031. 778 NumTypes.Init();
  1032. 779 PosUtils.Init();
  1033. 780 StrEdit.Init();
  1034. 781
  1035. 782 (*EntryDiag:
  1036. 783 StringIO.WriteEol( 1, 'Entering StrConv' );
  1037. 784 :EntryDiag*)
  1038. 785
  1039. 786 FOR i := 5 TO 9 DO
  1040. 787 TenPowers[i].hicard := 0;
  1041. 788 END;
  1042. 789 TenPowers[9].locard := 1;
  1043. 790 TenPowers[8].locard := 10;
  1044. 791 TenPowers[7].locard := 100;
  1045. 792 TenPowers[6].locard := 1000;
  1046. 793 TenPowers[5].locard := 10000;
  1047. 794 TenPowers[4].locard := 34464; (* 100,000 *)
  1048. 795 TenPowers[3].locard := 16960; (* 1,000,000 *)
  1049. 796 TenPowers[2].locard := 38528; (* 10,000,000 *)
  1050. 797 TenPowers[1].locard := 57600; (* 100,000,000 *)
  1051. 798 TenPowers[0].locard := 51712; (* 1,000,000,000 *)
  1052. 799 TenPowers[4].hicard := 1; (* 100,000 *)
  1053. 800 TenPowers[3].hicard := 15; (* 1,000,000 *)
  1054. 801 TenPowers[2].hicard := 152; (* 10,000,000 *)
  1055. 802 TenPowers[1].hicard := 1525; (* 100,000,000 *)
  1056. 803 TenPowers[0].hicard := 15258; (* 1,000,000,000 *)
  1057. 804
  1058. 805 (*EntryDiag:
  1059. 806 StringIO.WriteEol( 1, 'Exiting StrConv' );
  1060. 807 :EntryDiag*)
  1061. 808 END Init;
  1062. 809
  1063. 810 BEGIN
  1064. 811 Initialized := FALSE;
  1065. 812 Init();
  1066. 813 END StrConv.
  1067. 252 errors