STRLOGIC.LST 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288
  1. Listing:
  2. 1 IMPLEMENTATION MODULE StrLogic;
  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/strlogic.mov 1.5 10 Mar 1991 15:33:48 coleb $
  13. 12 *
  14. 13 *)
  15. 14
  16. 15
  17. 16 IMPORT ErrorManager;
  18. 17 IMPORT LowLevel;
  19. 18 IMPORT M2Strings;
  20. 19 IMPORT PosUtils;
  21. 20 IMPORT StrConv;
  22. 21 IMPORT StrEdit;
  23. 22 IMPORT SYSTEM;
  24. 23
  25. 24 VAR
  26. 25 Initialized : BOOLEAN;
  27. 26
  28. 27 PROCEDURE Init();
  29. 28 BEGIN
  30. 29 IF Initialized THEN
  31. 30 RETURN;
  32. 31 ELSE
  33. 32 Initialized := TRUE;
  34. 33 END;
  35. 34 ErrorManager.Init();
  36. ***** ^ not supported yet
  37. ***** ^ not supported yet
  38. ***** ^ not supported yet
  39. 35 LowLevel.Init();
  40. ***** ^ not supported yet
  41. ***** ^ not supported yet
  42. ***** ^ not supported yet
  43. 36 M2Strings.Init();
  44. ***** ^ not supported yet
  45. ***** ^ not supported yet
  46. ***** ^ not supported yet
  47. 37 PosUtils.Init();
  48. ***** ^ not supported yet
  49. ***** ^ not supported yet
  50. ***** ^ not supported yet
  51. 38 StrConv.Init();
  52. ***** ^ not supported yet
  53. ***** ^ not supported yet
  54. ***** ^ not supported yet
  55. 39 StrEdit.Init();
  56. ***** ^ not supported yet
  57. ***** ^ not supported yet
  58. ***** ^ not supported yet
  59. 40
  60. 41 DelimitingChars := ' ,()[].!?";';
  61. ***** ^ undeclared identifier
  62. ***** ^ not supported yet
  63. 42 EmbeddedStrMatters := TRUE;
  64. ***** ^ undeclared identifier
  65. 43 CaseSensitive := FALSE;
  66. ***** ^ undeclared identifier
  67. 44 END Init;
  68. ***** ^ not supported yet
  69. 45
  70. 46
  71. 47 CONST
  72. 48 null = '';
  73. 49 VAR
  74. 50 FatalError : BOOLEAN;
  75. 51
  76. 52 PROCEDURE SpotInside( TheSpot: CARDINAL;
  77. 53 TheStr: ARRAY OF CHAR ): BOOLEAN;
  78. ***** ^ not supported yet
  79. 54 BEGIN
  80. 55 IF FatalError THEN RETURN FALSE END;
  81. 56 IF TheSpot <= HIGH(TheStr) THEN
  82. ***** ^ undeclared identifier
  83. ***** ^ not supported yet
  84. 57 RETURN TRUE;
  85. 58 ELSE
  86. 59 RETURN FALSE;
  87. 60 END;
  88. 61 END SpotInside;
  89. ***** ^ not supported yet
  90. 62
  91. 63
  92. 64 PROCEDURE CharCount(TheChar : CHAR; VAR TheStr : ARRAY OF CHAR)
  93. ***** ^ not supported yet
  94. 65 : CARDINAL;
  95. 66 (*CharCount returns the number of TheChar's in TheStr. It is
  96. 67 used in StrLogic to detect possible omissions of brackets
  97. 68 and quotation marks, and should be deleted when a program
  98. 69 is complete.*)
  99. 70 BEGIN
  100. 71 RETURN PosUtils.ByteCount(M2Strings.Length(TheStr),
  101. ***** ^ not supported yet
  102. ***** ^ not supported yet
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. ***** ^ not supported yet
  106. 72 TheChar,
  107. 73 SYSTEM.ADR(TheStr) );
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. 74 END CharCount;
  112. ***** ^ not supported yet
  113. 75
  114. 76
  115. 77 PROCEDURE ExpressionTest(ObjectStr,
  116. 78 FormulaList: ARRAY OF CHAR): CARDINAL;
  117. ***** ^ not supported yet
  118. 79 CONST
  119. 80 ExpressionSeparator = '\';
  120. 81 blank = ' ';
  121. 82 OrSymbol = '|';
  122. 83 AndSymbol = '&';
  123. 84 NotSymbol = '~';
  124. 85 LftBracket = '[';
  125. 86 RtBracket = ']';
  126. 87 ExpansionChar = '*';
  127. 88 (*If FormulaList is more than zero bytes long, this routine
  128. 89 copies string-analysis expressions out of FormulaList one-by-
  129. 90 one. After it copies an expression it replaces the bytes it
  130. 91 formerly occupied in FormulaList with blanks. It keeps going
  131. 92 until FormulaList is all blank, or until one of the expressions
  132. 93 returns a TRUE. It returns the number of that expression, or
  133. 94 it returns 0 if none of the expressions are TRUE.*)
  134. 95
  135. 96 PROCEDURE ThisExpression(object,
  136. 97 formula : ARRAY OF CHAR) : BOOLEAN;
  137. ***** ^ not supported yet
  138. 98 (*ThisExpression is the routine that does the analysis of each
  139. 99 individual expression in the FormulaList.*)
  140. 100
  141. 101 TYPE
  142. 102 LogicSymbol = (NoSmblAtAll, OrSmbl, AndSmbl, NotSmbl,
  143. 103 lftbracket, rtbracket, ElementalStmt);
  144. 104 CONST
  145. 105 StackSize = 50;
  146. 106 TotalSmbls = 3;
  147. 107 VAR
  148. 108 OnePattern : ARRAY [0..40] OF CHAR;
  149. ***** ^ not supported yet
  150. ***** ^ not supported yet
  151. 109 SymbolCode : LogicSymbol;
  152. ***** ^ not supported yet
  153. 110 PrecedenceCount, OldFormulaPtr, OperatorStackPtr,
  154. 111 ElementStackPtr : CARDINAL;
  155. 112 ElementStack : ARRAY [1..StackSize] OF BOOLEAN;
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. 113 OperatorStack : ARRAY [0..StackSize] OF CARDINAL;
  159. ***** ^ not supported yet
  160. ***** ^ not supported yet
  161. 114 (*Although it might look more elegant to make this an
  162. 115 array of LogicSymbol's, we can't do it because we need
  163. 116 to add numbers out of sequence to PrecedenceCount.*)
  164. 117
  165. 118 PROCEDURE ElementTest(VAR TheElement,
  166. 119 object : ARRAY OF CHAR) : BOOLEAN;
  167. ***** ^ not supported yet
  168. 120 (*ElementTest returns TRUE for the following statements about the
  169. 121 sentence "A red car just ran over your cat."
  170. 122 L < 60
  171. 123 [L means length in characters.]
  172. 124 L = 33
  173. 125 'red' < 5
  174. 126 "car" > 5
  175. 127 'car' = 7
  176. 128 'cat' > 'car'
  177. 129 W > 1
  178. 130 [W means words; represents number of DelimitingChars + 1]
  179. 131 W = 8
  180. 132 It returns FALSE for such statements as:
  181. 133 'dog' < 20
  182. 134 [In other words, the fact that Pos would return a 0 for the
  183. 135 string does not make the expression true. Both patterns in
  184. 136 an expression have to be there for it to be true.]
  185. 137 *)
  186. 138 TYPE
  187. 139 OperatorType = (NoOperator, EqualTo, UnequalTo, GreaterThan,
  188. 140 GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo);
  189. 141
  190. 142 PROCEDURE GetOperator(VAR TheStr : ARRAY OF CHAR;
  191. ***** ^ not supported yet
  192. 143 VAR TheOperator : OperatorType;
  193. 144 VAR TheSpot : CARDINAL);
  194. 145 CONST
  195. 146 operators = '=#><';
  196. ***** ^ not supported yet
  197. 147 VAR
  198. 148 QuoteMark : CHAR;
  199. 149 (*Used to keep track of whether our quote mark is
  200. 150 single or double.*)
  201. 151 OpSpot, lngth, ndx : CARDINAL;
  202. 152 InString : BOOLEAN;
  203. 153 BEGIN
  204. 154 (*GetOperator*)
  205. 155 IF FatalError THEN RETURN END;
  206. 156 lngth := M2Strings.Length(TheStr);
  207. ***** ^ not supported yet
  208. ***** ^ not supported yet
  209. ***** ^ not supported yet
  210. 157 ndx := 0;
  211. 158 InString := FALSE;
  212. 159 QuoteMark := 0C;
  213. 160 TheSpot := 255;
  214. 161 TheOperator := NoOperator;
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. 162 OpSpot := 5;
  218. 163 (*OpSpot was uninitialized in Release 1.4; fixed in
  219. 164 Release 1.5 thanks to Mike Smyth.*)
  220. 165 WHILE (ndx<lngth) AND (TheOperator=NoOperator) DO
  221. ***** ^ not supported yet
  222. ***** ^ not supported yet
  223. 166 IF (TheStr[ndx]='"') OR (TheStr[ndx]="'") THEN
  224. ***** ^ not supported yet
  225. ***** ^ not supported yet
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. 167 (*The stuff in this IF statement allows nesting a
  229. 168 single quote mark inside double quote marks, or
  230. 169 vice versa.*)
  231. 170 IF QuoteMark=0C THEN
  232. 171 QuoteMark := TheStr[ndx];
  233. ***** ^ not supported yet
  234. ***** ^ not supported yet
  235. 172 END;
  236. 173 IF TheStr[ndx]=QuoteMark THEN
  237. ***** ^ not supported yet
  238. ***** ^ not supported yet
  239. 174 InString := NOT InString;
  240. 175 END;
  241. 176 END;
  242. 177 IF NOT InString THEN
  243. 178 IF TheStr[ndx]=blank THEN
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. 179 M2Strings.Delete(TheStr, ndx, 1);
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. ***** ^ not supported yet
  250. ***** ^ not supported yet
  251. 180 (*This strips all but the blanks in strings. I'm
  252. 181 not sure it's working; we seem to be doing some
  253. 182 redundant blank stripping, but things go
  254. 183 wrong if you try to strip blanks in only one
  255. 184 place.*)
  256. 185 END;
  257. 186 OpSpot := M2Strings.Pos( TheStr[ndx], operators );
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. ***** ^ not supported yet
  261. ***** ^ not supported yet
  262. ***** ^ not supported yet
  263. 187 IF SpotInside( OpSpot, operators ) THEN
  264. ***** ^ not supported yet
  265. ***** ^ not supported yet
  266. 188 TheSpot := ndx;
  267. 189 ELSE
  268. 190 TheSpot := 255;
  269. 191 (*Actually, we just want TheSpot to be some
  270. 192 number bigger than the HIGH of operators, but
  271. 193 Logitech won't let us get the HIGH of a constant.*)
  272. 194 END;
  273. 195 END;
  274. 196 IF SpotInside( OpSpot, operators ) THEN
  275. ***** ^ not supported yet
  276. ***** ^ not supported yet
  277. 197 CASE TheStr[ndx] OF
  278. ***** ^ not supported yet
  279. ***** ^ not supported yet
  280. 198 '=' :
  281. 199 TheOperator := EqualTo;
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. 200 | '#' :
  285. 201 TheOperator := UnequalTo;
  286. ***** ^ not supported yet
  287. ***** ^ not supported yet
  288. 202 | '>' :
  289. 203 TheOperator := GreaterThan;
  290. ***** ^ not supported yet
  291. ***** ^ not supported yet
  292. 204 | '<' :
  293. 205 TheOperator := LessThan;
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. 206 ELSE
  297. 207 ErrorManager.WARN('TheSpot wrong in GetOperator.');
  298. ***** ^ not supported yet
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. 208 INC(StrLogicErrorLevel);
  302. ***** ^ undeclared identifier
  303. ***** ^ undeclared identifier
  304. 209 FatalError := TRUE;
  305. 210 RETURN;
  306. 211 END;
  307. 212 IF TheStr[ndx+1]='=' THEN
  308. ***** ^ not supported yet
  309. ***** ^ not supported yet
  310. 213 INC(TheOperator);
  311. ***** ^ undeclared identifier
  312. ***** ^ not supported yet
  313. 214 (*TheOperator should now be either
  314. 215 GreaterThanOrEqualTo or LessThanOrEqualTo.*)
  315. 216 END;
  316. 217 END;
  317. 218 INC(ndx);
  318. ***** ^ undeclared identifier
  319. ***** ^ not supported yet
  320. 219 END;
  321. 220 IF TheOperator=NoOperator THEN
  322. ***** ^ not supported yet
  323. ***** ^ not supported yet
  324. 221 TheSpot := lngth;
  325. 222 ELSIF TheSpot = 0 THEN
  326. 223 ErrorManager.WARN('Operator cannot begin an expression.');
  327. ***** ^ not supported yet
  328. ***** ^ not supported yet
  329. ***** ^ not supported yet
  330. 224 INC(StrLogicErrorLevel);
  331. ***** ^ undeclared identifier
  332. ***** ^ undeclared identifier
  333. 225 FatalError := TRUE;
  334. 226 END;
  335. 227 END GetOperator;
  336. ***** ^ not supported yet
  337. 228
  338. 229 PROCEDURE PosOfOneTerm(ElementStr, ObjStr : ARRAY OF CHAR;
  339. ***** ^ not supported yet
  340. 230 spot1, spot2 : CARDINAL;
  341. 231 VAR missing : BOOLEAN) : CARDINAL;
  342. 232 VAR
  343. 233 lngth, tmp, ndx : CARDINAL;
  344. 234 TmpStr : ARRAY [0..80] OF CHAR;
  345. ***** ^ not supported yet
  346. ***** ^ not supported yet
  347. 235 BEGIN
  348. 236 (*PosOfOneTerm*)
  349. 237 IF FatalError THEN RETURN 0 END;
  350. 238 missing := FALSE;
  351. 239 M2Strings.Copy(ElementStr, spot1, spot2-spot1+1, TmpStr);
  352. ***** ^ not supported yet
  353. ***** ^ not supported yet
  354. ***** ^ not supported yet
  355. ***** ^ not supported yet
  356. 240 StrEdit.CutLeadingChars(blank, TmpStr);
  357. ***** ^ not supported yet
  358. ***** ^ not supported yet
  359. ***** ^ not supported yet
  360. 241 IF (TmpStr[0]="'") OR (TmpStr[0]='"') THEN
  361. ***** ^ not supported yet
  362. ***** ^ not supported yet
  363. ***** ^ not supported yet
  364. ***** ^ not supported yet
  365. 242 StrEdit.DeleteChar(TmpStr[0], TmpStr);
  366. ***** ^ not supported yet
  367. ***** ^ not supported yet
  368. ***** ^ not supported yet
  369. ***** ^ not supported yet
  370. ***** ^ not supported yet
  371. 243 IF EmbeddedStrMatters THEN
  372. ***** ^ undeclared identifier
  373. 244 tmp := M2Strings.Pos(TmpStr,ObjStr);
  374. ***** ^ not supported yet
  375. ***** ^ not supported yet
  376. ***** ^ not supported yet
  377. ***** ^ not supported yet
  378. 245 IF NOT SpotInside(tmp,ObjStr) THEN
  379. ***** ^ not supported yet
  380. ***** ^ not supported yet
  381. 246 missing := TRUE;
  382. 247 END;
  383. 248 RETURN tmp;
  384. 249 ELSE
  385. 250 tmp := PosUtils.PosDelimited(TmpStr,ObjStr,DelimitingChars);
  386. ***** ^ not supported yet
  387. ***** ^ not supported yet
  388. ***** ^ not supported yet
  389. ***** ^ not supported yet
  390. ***** ^ undeclared identifier
  391. 251 IF NOT SpotInside(tmp,ObjStr) THEN
  392. ***** ^ not supported yet
  393. ***** ^ not supported yet
  394. 252 missing := TRUE;
  395. 253 END;
  396. 254 RETURN tmp;
  397. 255 END;
  398. 256 ELSIF TmpStr[0]='L' THEN
  399. ***** ^ not supported yet
  400. ***** ^ not supported yet
  401. 257 RETURN M2Strings.Length(ObjStr);
  402. ***** ^ not supported yet
  403. ***** ^ not supported yet
  404. ***** ^ not supported yet
  405. 258 ELSIF TmpStr[0]='W' THEN
  406. ***** ^ not supported yet
  407. ***** ^ not supported yet
  408. 259 (*Count delimiters and return 0 or delimiters + 1.*)
  409. 260 lngth := M2Strings.Length(ObjStr);
  410. ***** ^ not supported yet
  411. ***** ^ not supported yet
  412. ***** ^ not supported yet
  413. 261 ndx := 0;
  414. 262 tmp := 0;
  415. 263 WHILE ndx<lngth DO
  416. 264 IF PosUtils.Present(ObjStr[ndx],DelimitingChars) THEN
  417. ***** ^ not supported yet
  418. ***** ^ not supported yet
  419. ***** ^ not supported yet
  420. ***** ^ not supported yet
  421. ***** ^ undeclared identifier
  422. 265 INC(tmp);
  423. ***** ^ undeclared identifier
  424. ***** ^ not supported yet
  425. 266 END;
  426. 267 INC(ndx);
  427. ***** ^ undeclared identifier
  428. ***** ^ not supported yet
  429. 268 END;
  430. 269 IF (tmp>0) OR (lngth>0) THEN
  431. 270 INC(tmp);
  432. ***** ^ undeclared identifier
  433. ***** ^ not supported yet
  434. 271 END;
  435. 272 RETURN tmp;
  436. 273 ELSIF ((TmpStr[0]>='0') AND (TmpStr[0]<='9')) THEN
  437. ***** ^ not supported yet
  438. ***** ^ not supported yet
  439. ***** ^ not supported yet
  440. ***** ^ not supported yet
  441. 274 IF StrConv.StrToCardinal(TmpStr,0,tmp) THEN
  442. ***** ^ not supported yet
  443. ***** ^ not supported yet
  444. ***** ^ not supported yet
  445. ***** ^ not supported yet
  446. 275 RETURN tmp;
  447. 276 ELSE
  448. 277 StrEdit.Append( TmpStr, '-- This did not convert correctly.');
  449. ***** ^ not supported yet
  450. ***** ^ not supported yet
  451. ***** ^ not supported yet
  452. ***** ^ not supported yet
  453. 278 ErrorManager.WARN(TmpStr);
  454. ***** ^ not supported yet
  455. ***** ^ not supported yet
  456. ***** ^ not supported yet
  457. 279 INC(StrLogicErrorLevel);
  458. ***** ^ undeclared identifier
  459. ***** ^ undeclared identifier
  460. 280 FatalError := TRUE;
  461. 281 RETURN 0;
  462. 282 END;
  463. 283 ELSE
  464. 284 StrEdit.Append( TmpStr,
  465. ***** ^ not supported yet
  466. ***** ^ not supported yet
  467. ***** ^ not supported yet
  468. 285 ' -- Illegal term in this StrLogic formula.');
  469. ***** ^ not supported yet
  470. 286 ErrorManager.WARN(TmpStr);
  471. ***** ^ not supported yet
  472. ***** ^ not supported yet
  473. ***** ^ not supported yet
  474. 287 INC(StrLogicErrorLevel);
  475. ***** ^ undeclared identifier
  476. ***** ^ undeclared identifier
  477. 288 FatalError := TRUE;
  478. 289 RETURN 0;
  479. 290 END;
  480. 291 END PosOfOneTerm;
  481. ***** ^ not supported yet
  482. 292 VAR
  483. 293 FirstTerm, SecondTerm, OperatorSpot : CARDINAL;
  484. 294 TermMissing : BOOLEAN;
  485. 295 TheOperator : OperatorType;
  486. ***** ^ not supported yet
  487. 296
  488. 297 BEGIN
  489. 298 (*ElementTest*)
  490. 299 IF FatalError THEN RETURN FALSE END;
  491. 300 GetOperator(TheElement, TheOperator, OperatorSpot);
  492. ***** ^ not supported yet
  493. ***** ^ not supported yet
  494. ***** ^ not supported yet
  495. ***** ^ not supported yet
  496. 301 IF FatalError THEN RETURN FALSE END;
  497. 302 (*GetOperator cuts blanks, finds operaters if there are any,
  498. 303 indicates what they are in TheOperator, and indicates where
  499. 304 they are in OperatorSpot.*)
  500. 305 FirstTerm := PosOfOneTerm(TheElement,
  501. ***** ^ not supported yet
  502. ***** ^ not supported yet
  503. 306 object,
  504. ***** ^ not supported yet
  505. 307 0,
  506. 308 OperatorSpot-1,
  507. 309 TermMissing);
  508. ***** ^ not supported yet
  509. 310 (*The terms we're talking about here can be simple strings
  510. 311 (e.g., 'red'), decimal numbers, or length ('L') or width
  511. 312 ('W') variables. PosOfOneTerm evaluates those things
  512. 313 and gives us back a numeric result based on them.*)
  513. 314 IF FatalError THEN RETURN FALSE END;
  514. 315 IF TermMissing THEN
  515. 316 RETURN FALSE;
  516. 317 END;
  517. 318 IF TheOperator#NoOperator THEN
  518. ***** ^ not supported yet
  519. ***** ^ not supported yet
  520. 319 IF (TheOperator=GreaterThanOrEqualTo) OR (TheOperator=
  521. ***** ^ not supported yet
  522. ***** ^ not supported yet
  523. ***** ^ not supported yet
  524. 320 LessThanOrEqualTo) THEN
  525. ***** ^ not supported yet
  526. 321 INC(OperatorSpot);
  527. ***** ^ undeclared identifier
  528. ***** ^ not supported yet
  529. 322 (*We have to do this because those symbols are two
  530. 323 characters long, and we want OperatorSpot to
  531. 324 indicate the last character of the operator in the
  532. 325 next call to PosOfOneTerm.*)
  533. 326 END;
  534. 327 SecondTerm := PosOfOneTerm(TheElement,
  535. ***** ^ not supported yet
  536. ***** ^ not supported yet
  537. 328 object,
  538. ***** ^ not supported yet
  539. 329 OperatorSpot+1,
  540. 330 M2Strings.Length(TheElement),
  541. ***** ^ not supported yet
  542. ***** ^ not supported yet
  543. ***** ^ not supported yet
  544. 331 TermMissing);
  545. ***** ^ not supported yet
  546. 332 IF FatalError THEN RETURN FALSE END;
  547. 333 IF TermMissing THEN
  548. 334 RETURN FALSE;
  549. 335 END;
  550. 336 END;
  551. 337 CASE TheOperator OF
  552. ***** ^ not supported yet
  553. 338 NoOperator :
  554. ***** ^ not supported yet
  555. 339 RETURN TRUE;
  556. 340 (*We know it's TRUE here because if the term had
  557. 341 been missing and there had been no operator, we
  558. 342 would have returned FALSE above in the IF TermMissing
  559. 343 statements.*)
  560. 344 | EqualTo :
  561. ***** ^ not supported yet
  562. 345 RETURN (FirstTerm=SecondTerm);
  563. 346 | UnequalTo :
  564. ***** ^ not supported yet
  565. 347 RETURN (FirstTerm#SecondTerm);
  566. 348 | GreaterThan :
  567. ***** ^ not supported yet
  568. 349 RETURN (FirstTerm>SecondTerm);
  569. 350 | GreaterThanOrEqualTo :
  570. ***** ^ not supported yet
  571. 351 RETURN (FirstTerm>=SecondTerm);
  572. 352 | LessThan :
  573. ***** ^ not supported yet
  574. 353 RETURN (FirstTerm<SecondTerm);
  575. 354 | LessThanOrEqualTo :
  576. ***** ^ not supported yet
  577. 355 RETURN (FirstTerm<=SecondTerm);
  578. 356 ELSE
  579. 357 ErrorManager.WARN('Weird operator in ElementTest.');
  580. ***** ^ not supported yet
  581. ***** ^ not supported yet
  582. ***** ^ not supported yet
  583. 358 INC(StrLogicErrorLevel);
  584. ***** ^ undeclared identifier
  585. ***** ^ undeclared identifier
  586. 359 FatalError := TRUE;
  587. 360 RETURN FALSE;
  588. 361 END;
  589. 362 END ElementTest;
  590. ***** ^ not supported yet
  591. 363
  592. 364 PROCEDURE GetSymbolFromFormula(VAR TheElement : ARRAY OF CHAR;
  593. ***** ^ not supported yet
  594. 365 VAR TheOperator : LogicSymbol);
  595. 366 VAR
  596. 367 FormulaLength, FormulaPtr : CARDINAL;
  597. 368 InString, ElementFound : BOOLEAN;
  598. 369 QuoteMark: CHAR;
  599. 370 BEGIN
  600. 371 (*GetSymbolFromFormula*)
  601. 372 IF FatalError THEN RETURN END;
  602. 373 FormulaLength := M2Strings.Length(formula);
  603. ***** ^ not supported yet
  604. ***** ^ not supported yet
  605. ***** ^ not supported yet
  606. 374 QuoteMark := 0C;
  607. 375 StrEdit.AssignStr(null, TheElement);
  608. ***** ^ not supported yet
  609. ***** ^ not supported yet
  610. ***** ^ not supported yet
  611. 376 InString := FALSE;
  612. 377 TheOperator := NoSmblAtAll;
  613. ***** ^ not supported yet
  614. ***** ^ not supported yet
  615. 378 ElementFound := FALSE;
  616. 379 IF (OldFormulaPtr+1) <= FormulaLength THEN
  617. 380 FormulaPtr := OldFormulaPtr;
  618. 381 (*OldFormulaPtr starts at 0, and subsequently points
  619. 382 at the first character of the next word or symbol needing
  620. 383 to be processed.*)
  621. 384 REPEAT
  622. 385 (*Look for next operator.*)
  623. 386 IF (NOT InString) THEN
  624. 387 WHILE formula[FormulaPtr]=blank DO
  625. ***** ^ not supported yet
  626. ***** ^ not supported yet
  627. 388 M2Strings.Delete(formula, FormulaPtr, 1);
  628. ***** ^ not supported yet
  629. ***** ^ not supported yet
  630. ***** ^ not supported yet
  631. ***** ^ not supported yet
  632. 389 END;
  633. 390 END;
  634. 391 IF (formula[FormulaPtr]='"')
  635. ***** ^ not supported yet
  636. ***** ^ not supported yet
  637. 392 OR (formula[FormulaPtr]="'") THEN
  638. ***** ^ not supported yet
  639. ***** ^ not supported yet
  640. 393 IF QuoteMark = 0C THEN
  641. 394 QuoteMark := formula[FormulaPtr];
  642. ***** ^ not supported yet
  643. ***** ^ not supported yet
  644. 395 END;
  645. 396 IF formula[FormulaPtr] = QuoteMark THEN
  646. ***** ^ not supported yet
  647. ***** ^ not supported yet
  648. 397 InString := NOT InString;
  649. 398 IF NOT InString THEN
  650. 399 QuoteMark := 0C;
  651. 400 END;
  652. 401 END;
  653. 402 END;
  654. 403 IF NOT InString THEN
  655. 404 CASE formula[FormulaPtr] OF
  656. ***** ^ not supported yet
  657. ***** ^ not supported yet
  658. 405 OrSymbol :
  659. ***** ^ not supported yet
  660. 406 TheOperator := OrSmbl;
  661. ***** ^ not supported yet
  662. ***** ^ not supported yet
  663. 407 | AndSymbol :
  664. ***** ^ not supported yet
  665. 408 TheOperator := AndSmbl;
  666. ***** ^ not supported yet
  667. ***** ^ not supported yet
  668. 409 | NotSymbol :
  669. ***** ^ not supported yet
  670. 410 TheOperator := NotSmbl;
  671. ***** ^ not supported yet
  672. ***** ^ not supported yet
  673. 411 | LftBracket :
  674. ***** ^ not supported yet
  675. 412 TheOperator := lftbracket;
  676. ***** ^ not supported yet
  677. ***** ^ not supported yet
  678. 413 | RtBracket :
  679. ***** ^ not supported yet
  680. 414 TheOperator := rtbracket;
  681. ***** ^ not supported yet
  682. ***** ^ not supported yet
  683. 415 ELSE
  684. 416 TheOperator := ElementalStmt;
  685. ***** ^ not supported yet
  686. ***** ^ not supported yet
  687. 417 ElementFound := TRUE;
  688. 418 END;
  689. 419 ELSE
  690. 420 TheOperator := ElementalStmt;
  691. ***** ^ not supported yet
  692. ***** ^ not supported yet
  693. 421 ElementFound := TRUE;
  694. 422 END;
  695. 423 WHILE InString DO
  696. 424 (*skip to the end of the string*)
  697. 425 INC(FormulaPtr);
  698. ***** ^ undeclared identifier
  699. ***** ^ not supported yet
  700. 426 IF formula[FormulaPtr] = QuoteMark THEN
  701. ***** ^ not supported yet
  702. ***** ^ not supported yet
  703. 427 InString := NOT InString;
  704. 428 IF NOT InString THEN
  705. 429 QuoteMark := 0C;
  706. 430 END;
  707. 431 END;
  708. 432 END;
  709. 433 INC(FormulaPtr);
  710. ***** ^ undeclared identifier
  711. ***** ^ not supported yet
  712. 434 UNTIL (FormulaPtr >= FormulaLength)
  713. 435 OR (TheOperator#ElementalStmt);
  714. ***** ^ not supported yet
  715. ***** ^ not supported yet
  716. 436 IF ElementFound THEN
  717. 437 IF TheOperator # ElementalStmt THEN
  718. ***** ^ not supported yet
  719. ***** ^ not supported yet
  720. 438 DEC(FormulaPtr);
  721. ***** ^ undeclared identifier
  722. ***** ^ not supported yet
  723. 439 (*We DEC this because the INC at the
  724. 440 end of the loop makes it point to the character
  725. 441 AFTER the next one to be processed. FormulaPtr
  726. 442 is always supposed to be sitting on the next
  727. 443 character.*)
  728. 444 TheOperator := ElementalStmt;
  729. ***** ^ not supported yet
  730. ***** ^ not supported yet
  731. 445 (*We set this back to ElementalStmt because the
  732. 446 process of searching for the end of the statement
  733. 447 messed up the value of TheOperator.*)
  734. 448 END;
  735. 449 M2Strings.Copy(formula, OldFormulaPtr,
  736. ***** ^ not supported yet
  737. ***** ^ not supported yet
  738. ***** ^ not supported yet
  739. 450 (FormulaPtr-OldFormulaPtr), TheElement);
  740. ***** ^ not supported yet
  741. 451 END;
  742. 452 OldFormulaPtr := FormulaPtr;
  743. 453 (*OldFormulaPtr gets updated in preparation for next call
  744. 454 to GetSymbolFromFormula.*)
  745. 455 END;
  746. 456 END GetSymbolFromFormula;
  747. ***** ^ not supported yet
  748. 457
  749. 458 PROCEDURE PrecedenceOf(logicsymbol : LogicSymbol) : CARDINAL;
  750. 459 BEGIN
  751. 460 IF FatalError THEN RETURN 0 END;
  752. 461 CASE logicsymbol OF
  753. ***** ^ not supported yet
  754. 462 NoSmblAtAll :
  755. ***** ^ not supported yet
  756. 463 RETURN (0);
  757. 464 | OrSmbl :
  758. ***** ^ not supported yet
  759. 465 RETURN (1);
  760. 466 | AndSmbl :
  761. ***** ^ not supported yet
  762. 467 RETURN (2);
  763. 468 | NotSmbl :
  764. ***** ^ not supported yet
  765. 469 RETURN (3);
  766. 470 | lftbracket :
  767. ***** ^ not supported yet
  768. 471 RETURN (4);
  769. 472 | rtbracket :
  770. ***** ^ not supported yet
  771. 473 RETURN (5);
  772. 474 ELSE
  773. 475 ErrorManager.WARN('PrecedenceOf got a weird LogicSymbol.');
  774. ***** ^ not supported yet
  775. ***** ^ not supported yet
  776. ***** ^ not supported yet
  777. 476 INC(StrLogicErrorLevel);
  778. ***** ^ undeclared identifier
  779. ***** ^ undeclared identifier
  780. 477 FatalError := TRUE;
  781. 478 RETURN 0;
  782. 479 END;
  783. 480 END PrecedenceOf;
  784. ***** ^ not supported yet
  785. 481
  786. 482 PROCEDURE ResolveStacks();
  787. 483 VAR
  788. 484 Element : BOOLEAN;
  789. 485 BEGIN
  790. 486 (*ResolveStacks*)
  791. 487 IF FatalError THEN RETURN END;
  792. 488 WHILE (OperatorStackPtr>0) AND (OperatorStack[
  793. ***** ^ not supported yet
  794. 489 OperatorStackPtr]>=PrecedenceOf(SymbolCode)+
  795. ***** ^ not supported yet
  796. ***** ^ not supported yet
  797. ***** ^ not supported yet
  798. 490 PrecedenceCount) DO
  799. 491 IF FatalError THEN RETURN END;
  800. 492 Element := ElementStack[ElementStackPtr];
  801. ***** ^ not supported yet
  802. ***** ^ not supported yet
  803. 493 (*ElementStack is a stack of booleans.*)
  804. 494 CASE OperatorStack[OperatorStackPtr] MOD TotalSmbls OF
  805. ***** ^ not supported yet
  806. ***** ^ not supported yet
  807. 495 1 :
  808. 496 DEC(ElementStackPtr);
  809. ***** ^ undeclared identifier
  810. ***** ^ not supported yet
  811. 497 Element := Element OR ElementStack[ElementStackPtr];
  812. ***** ^ not supported yet
  813. ***** ^ not supported yet
  814. 498 | 2 :
  815. 499 DEC(ElementStackPtr);
  816. ***** ^ undeclared identifier
  817. ***** ^ not supported yet
  818. 500 Element := Element AND ElementStack[ElementStackPtr];
  819. ***** ^ not supported yet
  820. ***** ^ not supported yet
  821. 501 | 0, 3 :
  822. 502 Element := NOT Element;
  823. 503 ELSE
  824. 504 ErrorManager.WARN('Something strange in the OperatorStack.');
  825. ***** ^ not supported yet
  826. ***** ^ not supported yet
  827. ***** ^ not supported yet
  828. 505 INC(StrLogicErrorLevel);
  829. ***** ^ undeclared identifier
  830. ***** ^ undeclared identifier
  831. 506 FatalError := TRUE;
  832. 507 RETURN;
  833. 508 END;
  834. 509 ElementStack[ElementStackPtr] := Element;
  835. ***** ^ not supported yet
  836. ***** ^ not supported yet
  837. 510 DEC(OperatorStackPtr);
  838. ***** ^ undeclared identifier
  839. ***** ^ not supported yet
  840. 511 END;
  841. 512 END ResolveStacks;
  842. ***** ^ not supported yet
  843. 513
  844. 514 PROCEDURE AddToElementStack(TheElement : ARRAY OF CHAR);
  845. ***** ^ not supported yet
  846. 515 (*ElementStack is actually an array of booleans.
  847. 516 AddToElementStack puts a TRUE or a FALSE in the ElementStack,
  848. 517 depending on the presence or absence of TheElement in object.*)
  849. 518 VAR
  850. 519 tmp : BOOLEAN;
  851. 520 BEGIN
  852. 521 (*AddToElementStack*)
  853. 522 IF FatalError THEN RETURN END;
  854. 523 INC(ElementStackPtr);
  855. ***** ^ undeclared identifier
  856. ***** ^ not supported yet
  857. 524 IF ElementStackPtr>StackSize THEN
  858. 525 ErrorManager.WARN("Stack overflow in StrLogic.");
  859. ***** ^ not supported yet
  860. ***** ^ not supported yet
  861. ***** ^ not supported yet
  862. 526 INC(StrLogicErrorLevel);
  863. ***** ^ undeclared identifier
  864. ***** ^ undeclared identifier
  865. 527 FatalError := TRUE;
  866. 528 RETURN;
  867. 529 END;
  868. 530 tmp := ElementTest(TheElement,object);
  869. ***** ^ not supported yet
  870. ***** ^ not supported yet
  871. ***** ^ not supported yet
  872. 531 IF FatalError THEN RETURN END;
  873. 532 ElementStack[ElementStackPtr] := tmp;
  874. ***** ^ not supported yet
  875. ***** ^ not supported yet
  876. 533 END AddToElementStack;
  877. ***** ^ not supported yet
  878. 534
  879. 535 PROCEDURE AddToOperatorStack(symbol : LogicSymbol);
  880. 536 VAR
  881. 537 tmp : CARDINAL;
  882. 538 BEGIN
  883. 539 (*AddToOperatorStack*)
  884. 540 IF FatalError THEN RETURN END;
  885. 541 INC(OperatorStackPtr);
  886. ***** ^ undeclared identifier
  887. ***** ^ not supported yet
  888. 542 tmp := PrecedenceOf(symbol)+PrecedenceCount;
  889. ***** ^ not supported yet
  890. ***** ^ not supported yet
  891. 543 IF FatalError THEN RETURN END;
  892. 544 OperatorStack[OperatorStackPtr] := tmp;
  893. ***** ^ not supported yet
  894. ***** ^ not supported yet
  895. 545 END AddToOperatorStack;
  896. ***** ^ not supported yet
  897. 546
  898. 547 BEGIN
  899. 548 (*ThisExpression*)
  900. 549 IF FatalError THEN RETURN FALSE END;
  901. 550 StrEdit.CrunchBlanks(object);
  902. ***** ^ not supported yet
  903. ***** ^ not supported yet
  904. ***** ^ not supported yet
  905. 551 StrEdit.CrunchBlanks(formula);
  906. ***** ^ not supported yet
  907. ***** ^ not supported yet
  908. ***** ^ not supported yet
  909. 552 IF NOT CaseSensitive THEN
  910. ***** ^ undeclared identifier
  911. 553 StrEdit.CAPstr(object);
  912. ***** ^ not supported yet
  913. ***** ^ not supported yet
  914. ***** ^ not supported yet
  915. 554 StrEdit.CAPstr(formula);
  916. ***** ^ not supported yet
  917. ***** ^ not supported yet
  918. ***** ^ not supported yet
  919. 555 END;
  920. 556 OperatorStackPtr := 0;
  921. 557 OperatorStack[OperatorStackPtr] := 0;
  922. ***** ^ not supported yet
  923. ***** ^ not supported yet
  924. 558 ElementStackPtr := 0;
  925. 559 PrecedenceCount := 0;
  926. 560 OldFormulaPtr := 0;
  927. 561 (*OldFormulaPtr should always point to
  928. 562 the first character of the next pattern
  929. 563 in the formula that needs to be processed.*)
  930. 564 GetSymbolFromFormula(OnePattern, SymbolCode);
  931. ***** ^ not supported yet
  932. ***** ^ not supported yet
  933. ***** ^ not supported yet
  934. 565 IF SymbolCode=NoSmblAtAll THEN
  935. ***** ^ not supported yet
  936. ***** ^ not supported yet
  937. 566 RETURN FALSE;
  938. 567 ELSE
  939. 568 REPEAT
  940. 569 CASE SymbolCode OF
  941. ***** ^ not supported yet
  942. 570 ElementalStmt :
  943. ***** ^ not supported yet
  944. 571 AddToElementStack(OnePattern);
  945. ***** ^ not supported yet
  946. ***** ^ not supported yet
  947. 572 IF FatalError THEN RETURN FALSE END;
  948. 573 | OrSmbl, AndSmbl, NotSmbl :
  949. ***** ^ not supported yet
  950. ***** ^ not supported yet
  951. ***** ^ not supported yet
  952. 574 ResolveStacks();
  953. ***** ^ not supported yet
  954. ***** ^ not supported yet
  955. 575 IF FatalError THEN RETURN FALSE END;
  956. 576 AddToOperatorStack(SymbolCode);
  957. ***** ^ not supported yet
  958. ***** ^ not supported yet
  959. 577 | lftbracket :
  960. ***** ^ not supported yet
  961. 578 INC(PrecedenceCount, TotalSmbls);
  962. ***** ^ undeclared identifier
  963. ***** ^ not supported yet
  964. 579 | rtbracket :
  965. ***** ^ not supported yet
  966. 580 DEC(PrecedenceCount, TotalSmbls);
  967. ***** ^ undeclared identifier
  968. ***** ^ not supported yet
  969. 581 | NoSmblAtAll :
  970. ***** ^ not supported yet
  971. 582 ELSE
  972. 583 ErrorManager.WARN('SymbolCode probably not set.');
  973. ***** ^ not supported yet
  974. ***** ^ not supported yet
  975. ***** ^ not supported yet
  976. 584 INC(StrLogicErrorLevel);
  977. ***** ^ undeclared identifier
  978. ***** ^ undeclared identifier
  979. 585 FatalError := TRUE;
  980. 586 RETURN FALSE;
  981. 587 END;
  982. 588 (*case*)
  983. 589 GetSymbolFromFormula(OnePattern, SymbolCode);
  984. ***** ^ not supported yet
  985. ***** ^ not supported yet
  986. ***** ^ not supported yet
  987. 590 UNTIL SymbolCode=NoSmblAtAll;
  988. ***** ^ not supported yet
  989. ***** ^ not supported yet
  990. 591 ResolveStacks();
  991. ***** ^ not supported yet
  992. ***** ^ not supported yet
  993. 592 IF FatalError THEN RETURN FALSE END;
  994. 593 IF ElementStackPtr<>1 THEN
  995. 594 ErrorManager.WARN('ThisExpression error.');
  996. ***** ^ not supported yet
  997. ***** ^ not supported yet
  998. ***** ^ not supported yet
  999. 595 INC(StrLogicErrorLevel);
  1000. ***** ^ undeclared identifier
  1001. ***** ^ undeclared identifier
  1002. 596 FatalError := TRUE;
  1003. 597 RETURN FALSE;
  1004. 598 END;
  1005. 599 RETURN (ElementStack[1]);
  1006. ***** ^ not supported yet
  1007. ***** ^ not supported yet
  1008. 600 END;
  1009. 601 END ThisExpression;
  1010. ***** ^ not supported yet
  1011. 602 VAR
  1012. 603 ExpressionIdentifier, EndOfIdentifier, StartOfExpr, EndOfExpr,
  1013. 604 lngth, FormulaNumber : CARDINAL;
  1014. 605 TempExpr : ARRAY [0..255] OF CHAR;
  1015. ***** ^ not supported yet
  1016. ***** ^ not supported yet
  1017. 606 BEGIN
  1018. 607 (*ExpressionTest*)
  1019. 608 FatalError := FALSE;
  1020. 609 StrLogicErrorLevel := 0;
  1021. ***** ^ undeclared identifier
  1022. 610 lngth := M2Strings.Length(FormulaList);
  1023. ***** ^ not supported yet
  1024. ***** ^ not supported yet
  1025. ***** ^ not supported yet
  1026. 611 IF lngth=0 THEN
  1027. 612 RETURN 0;
  1028. 613 END;
  1029. 614 FormulaNumber := 1;
  1030. 615 StrEdit.AssignStr(null, TempExpr);
  1031. ***** ^ not supported yet
  1032. ***** ^ not supported yet
  1033. ***** ^ not supported yet
  1034. 616 REPEAT
  1035. 617 StartOfExpr := CARDINAL(
  1036. 618 LowLevel.ScanNE(lngth, blank, SYSTEM.ADR(FormulaList)));
  1037. ***** ^ not supported yet
  1038. ***** ^ not supported yet
  1039. ***** ^ not supported yet
  1040. ***** ^ not supported yet
  1041. ***** ^ not supported yet
  1042. 619 (*If there are no leading blanks, StartOfExpr will be 0.*)
  1043. 620 IF FormulaList[StartOfExpr]=ExpressionSeparator THEN
  1044. ***** ^ not supported yet
  1045. ***** ^ not supported yet
  1046. 621 FormulaList[StartOfExpr] := blank;
  1047. ***** ^ not supported yet
  1048. ***** ^ not supported yet
  1049. 622 (*We have to do this to remove any leading backslash.
  1050. 623 We do it in a loop to make sure that StartOfExpr gets
  1051. 624 off on the right foot, but an incidental result is
  1052. 625 that all leading null expressions will be ignored.*)
  1053. 626 END;
  1054. 627 UNTIL FormulaList[StartOfExpr]#blank;
  1055. ***** ^ not supported yet
  1056. ***** ^ not supported yet
  1057. 628 EndOfExpr := CARDINAL(LowLevel.ScanEQ(lngth,
  1058. ***** ^ not supported yet
  1059. ***** ^ not supported yet
  1060. 629 ExpressionSeparator,SYSTEM.ADR(FormulaList)));
  1061. ***** ^ not supported yet
  1062. ***** ^ not supported yet
  1063. ***** ^ not supported yet
  1064. 630 (*If there's no ExpressionSeparator, EndOfExpr will equal lngth.*)
  1065. 631 WHILE (StartOfExpr+1)<lngth DO
  1066. 632 (*It's StartOfExpr + 1 because StartOfExpr is always going
  1067. 633 to represent the number of bytes you have to skip to get
  1068. 634 from the first byte in FormulaList to the first byte of
  1069. 635 the expression you're interested in.*)
  1070. 636 LowLevel.Move(
  1071. ***** ^ not supported yet
  1072. ***** ^ not supported yet
  1073. 637 LowLevel.AddAddr(SYSTEM.ADR(FormulaList), StartOfExpr),
  1074. ***** ^ not supported yet
  1075. ***** ^ not supported yet
  1076. ***** ^ not supported yet
  1077. ***** ^ not supported yet
  1078. ***** ^ not supported yet
  1079. ***** ^ not supported yet
  1080. 638 SYSTEM.ADR(TempExpr),
  1081. ***** ^ not supported yet
  1082. ***** ^ not supported yet
  1083. ***** ^ not supported yet
  1084. 639 EndOfExpr-StartOfExpr);
  1085. ***** ^ not supported yet
  1086. 640 StrEdit.SetLength(TempExpr, EndOfExpr-StartOfExpr);
  1087. ***** ^ not supported yet
  1088. ***** ^ not supported yet
  1089. ***** ^ not supported yet
  1090. ***** ^ not supported yet
  1091. 641 IF ODD(CharCount("'",TempExpr)) THEN
  1092. ***** ^ undeclared identifier
  1093. ***** ^ not supported yet
  1094. ***** ^ not supported yet
  1095. 642 (*This and the following three IF tests should be
  1096. 643 deleted when your application is complete.*)
  1097. 644 StrEdit.Append( TempExpr,
  1098. ***** ^ not supported yet
  1099. ***** ^ not supported yet
  1100. ***** ^ not supported yet
  1101. 645 '-- Single quotation marks may be unbalanced.');
  1102. ***** ^ not supported yet
  1103. 646 ErrorManager.WARN(TempExpr);
  1104. ***** ^ not supported yet
  1105. ***** ^ not supported yet
  1106. ***** ^ not supported yet
  1107. 647 INC(StrLogicErrorLevel);
  1108. ***** ^ undeclared identifier
  1109. ***** ^ undeclared identifier
  1110. 648 FatalError := TRUE;
  1111. 649 RETURN 0;
  1112. 650 END;
  1113. 651 IF ODD(CharCount('"',TempExpr)) THEN
  1114. ***** ^ undeclared identifier
  1115. ***** ^ not supported yet
  1116. ***** ^ not supported yet
  1117. 652 StrEdit.Append( TempExpr,
  1118. ***** ^ not supported yet
  1119. ***** ^ not supported yet
  1120. ***** ^ not supported yet
  1121. 653 '-- Double quotation marks may be unbalanced.');
  1122. ***** ^ not supported yet
  1123. 654 ErrorManager.WARN(TempExpr);
  1124. ***** ^ not supported yet
  1125. ***** ^ not supported yet
  1126. ***** ^ not supported yet
  1127. 655 INC(StrLogicErrorLevel);
  1128. ***** ^ undeclared identifier
  1129. ***** ^ undeclared identifier
  1130. 656 FatalError := TRUE;
  1131. 657 RETURN 0;
  1132. 658 END;
  1133. 659 IF CharCount('[',TempExpr)#CharCount(']',TempExpr) THEN
  1134. ***** ^ not supported yet
  1135. ***** ^ not supported yet
  1136. ***** ^ not supported yet
  1137. ***** ^ not supported yet
  1138. 660 StrEdit.Append( TempExpr, '-- Brackets may be unbalanced.' );
  1139. ***** ^ not supported yet
  1140. ***** ^ not supported yet
  1141. ***** ^ not supported yet
  1142. ***** ^ not supported yet
  1143. 661 ErrorManager.WARN(TempExpr);
  1144. ***** ^ not supported yet
  1145. ***** ^ not supported yet
  1146. ***** ^ not supported yet
  1147. 662 INC(StrLogicErrorLevel);
  1148. ***** ^ undeclared identifier
  1149. ***** ^ undeclared identifier
  1150. 663 FatalError := TRUE;
  1151. 664 RETURN 0;
  1152. 665 END;
  1153. 666 IF CharCount('(',TempExpr)#CharCount(')',TempExpr) THEN
  1154. ***** ^ not supported yet
  1155. ***** ^ not supported yet
  1156. ***** ^ not supported yet
  1157. ***** ^ not supported yet
  1158. 667 StrEdit.Append( TempExpr,'-- Parentheses may be unbalanced.');
  1159. ***** ^ not supported yet
  1160. ***** ^ not supported yet
  1161. ***** ^ not supported yet
  1162. ***** ^ not supported yet
  1163. 668 ErrorManager.WARN(TempExpr);
  1164. ***** ^ not supported yet
  1165. ***** ^ not supported yet
  1166. ***** ^ not supported yet
  1167. 669 INC(StrLogicErrorLevel);
  1168. ***** ^ undeclared identifier
  1169. ***** ^ undeclared identifier
  1170. 670 FatalError := TRUE;
  1171. 671 RETURN 0;
  1172. 672 END;
  1173. 673 LowLevel.Fill(SYSTEM.ADR(FormulaList), EndOfExpr+1, blank);
  1174. ***** ^ not supported yet
  1175. ***** ^ not supported yet
  1176. ***** ^ not supported yet
  1177. ***** ^ not supported yet
  1178. ***** ^ not supported yet
  1179. ***** ^ not supported yet
  1180. 674 StrEdit.CutLeadingChars(blank, TempExpr);
  1181. ***** ^ not supported yet
  1182. ***** ^ not supported yet
  1183. ***** ^ not supported yet
  1184. 675 IF M2Strings.Pos('(',TempExpr)=0 THEN
  1185. ***** ^ not supported yet
  1186. ***** ^ not supported yet
  1187. ***** ^ not supported yet
  1188. 676 (*The opening parenthesis immediately after the
  1189. 677 ExpressionSeparator tells us that this expression
  1190. 678 has an ExpressionIdentifier.*)
  1191. 679 IF NOT StrConv.StrToCardinal(TempExpr,1,ExpressionIdentifier) THEN
  1192. ***** ^ not supported yet
  1193. ***** ^ not supported yet
  1194. ***** ^ not supported yet
  1195. ***** ^ not supported yet
  1196. 680 StrEdit.Append( TempExpr,
  1197. ***** ^ not supported yet
  1198. ***** ^ not supported yet
  1199. ***** ^ not supported yet
  1200. 681 '-- Needs a number after the opening parenthesis.');
  1201. ***** ^ not supported yet
  1202. 682 ErrorManager.WARN(TempExpr);
  1203. ***** ^ not supported yet
  1204. ***** ^ not supported yet
  1205. ***** ^ not supported yet
  1206. 683 INC(StrLogicErrorLevel);
  1207. ***** ^ undeclared identifier
  1208. ***** ^ undeclared identifier
  1209. 684 FatalError := TRUE;
  1210. 685 RETURN 0;
  1211. 686 END;
  1212. 687 IF ExpressionIdentifier=0 THEN
  1213. 688 StrEdit.Append( TempExpr,
  1214. ***** ^ not supported yet
  1215. ***** ^ not supported yet
  1216. ***** ^ not supported yet
  1217. 689 " You can't use 0 as an ExpressionIdentifier.");
  1218. ***** ^ not supported yet
  1219. 690 ErrorManager.WARN(TempExpr);
  1220. ***** ^ not supported yet
  1221. ***** ^ not supported yet
  1222. ***** ^ not supported yet
  1223. 691 INC(StrLogicErrorLevel);
  1224. ***** ^ undeclared identifier
  1225. ***** ^ undeclared identifier
  1226. 692 FatalError := TRUE;
  1227. 693 RETURN 0;
  1228. 694 END;
  1229. 695 EndOfIdentifier := M2Strings.Pos(')',TempExpr);
  1230. ***** ^ not supported yet
  1231. ***** ^ not supported yet
  1232. ***** ^ not supported yet
  1233. 696 M2Strings.Delete(TempExpr, 0, EndOfIdentifier + 1);
  1234. ***** ^ not supported yet
  1235. ***** ^ not supported yet
  1236. ***** ^ not supported yet
  1237. ***** ^ not supported yet
  1238. 697 ELSE
  1239. 698 ExpressionIdentifier := 0;
  1240. 699 END;
  1241. 700 IF ThisExpression(ObjectStr,TempExpr) THEN
  1242. ***** ^ not supported yet
  1243. ***** ^ not supported yet
  1244. ***** ^ not supported yet
  1245. 701 IF FatalError THEN RETURN 0 END;
  1246. 702 IF ExpressionIdentifier=0 THEN
  1247. 703 RETURN FormulaNumber;
  1248. 704 ELSE
  1249. 705 RETURN ExpressionIdentifier;
  1250. 706 END;
  1251. 707 END;
  1252. 708 StartOfExpr := CARDINAL(LowLevel.ScanNE(lngth,
  1253. ***** ^ not supported yet
  1254. ***** ^ not supported yet
  1255. 709 blank,
  1256. 710 SYSTEM.ADR(FormulaList)));
  1257. ***** ^ not supported yet
  1258. ***** ^ not supported yet
  1259. ***** ^ not supported yet
  1260. 711 (*We look for the first nonblank because we wipe out previously
  1261. 712 tested expressions with blanks.*)
  1262. 713 EndOfExpr := CARDINAL(LowLevel.ScanEQ(lngth,
  1263. ***** ^ not supported yet
  1264. ***** ^ not supported yet
  1265. 714 ExpressionSeparator,SYSTEM.ADR(FormulaList)));
  1266. ***** ^ not supported yet
  1267. ***** ^ not supported yet
  1268. ***** ^ not supported yet
  1269. 715 INC(FormulaNumber);
  1270. ***** ^ undeclared identifier
  1271. ***** ^ not supported yet
  1272. 716 END;
  1273. 717 RETURN 0;
  1274. 718 END ExpressionTest;
  1275. ***** ^ not supported yet
  1276. 719
  1277. 720 BEGIN
  1278. 721 Initialized := FALSE;
  1279. 722 Init();
  1280. ***** ^ not supported yet
  1281. ***** ^ not supported yet
  1282. 723 END StrLogic.
  1283. ***** ^ not supported yet
  1284. 559 errors