home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1999-08-22 | 12.8 KB | [ TEXT/CWIE]
open in: MacOS 8.1
extracted
|
Win98
extracted
|
DOS
extracted
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary ).
You can browse this item here: Expression.cpp
Confidence Program Detection Match Type Support
10%
dexvert
MacBinary (archive/macBinary)
fallback
Supported
1%
dexvert
Text File (text/txt)
fallback
Supported
100%
file
MacBinary II, inited, Sun Aug 22 13:13:43 1999, modified Sun Aug 22 13:13:43 1999, creator 'CWIE', type ASCII, 12317 bytes "Expression.cpp" magic text fragment for file(1) cmd, 1st line "#include "Expression.h"", 2nd line "", 3rd line "#include "ExpressionDict.h"", 4th line "#include "ExprVirtualMachine.h"", 5th line "", at 0x309d 410 bytes resource magic text fragment for file(1) cmd, 1st line "#include "Expression.h"", 2nd line "", 3rd line "#include "ExpressionDict.h"", 4th line "#include "ExprVirtualMachine.h"", 5th line ""
default (weak)
99%
file
data
default
74%
TrID
Macintosh plain text (MacBinary)
default
25%
TrID
MacBinary 2
default (weak)
100%
siegfried
fmt/1762 MacBinary (II)
default
100%
lsar
MacBinary
default
id metadata key value macFileType [ TEXT] macFileCreator [ CWIE]
hex view +--------+-------------------------+-------------------------+--------+--------+ |00000000| 00 0e 45 78 70 72 65 73 | 73 69 6f 6e 2e 63 70 70 |..Expres|sion.cpp| |00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......| |00000050| 00 00 00 00 00 30 1d 00 | 00 01 9a b3 e5 e0 47 b3 |.....0..|......G.| |00000060| e5 e0 47 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..G.....|........| |00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 a9 b2 00 00 |........|........| |00000080| 23 69 6e 63 6c 75 64 65 | 20 22 45 78 70 72 65 73 |#include| "Expres| |00000090| 73 69 6f 6e 2e 68 22 0d | 0d 23 69 6e 63 6c 75 64 |sion.h".|.#includ| |000000a0| 65 20 22 45 78 70 72 65 | 73 73 69 6f 6e 44 69 63 |e "Expre|ssionDic| |000000b0| 74 2e 68 22 0d 23 69 6e | 63 6c 75 64 65 20 22 45 |t.h".#in|clude "E| |000000c0| 78 70 72 56 69 72 74 75 | 61 6c 4d 61 63 68 69 6e |xprVirtu|alMachin| |000000d0| 65 2e 68 22 0d 0d 0d 23 | 69 66 20 45 47 5f 57 49 |e.h"...#|if EG_WI| |000000e0| 4e 0d 23 69 6e 63 6c 75 | 64 65 20 22 45 67 4f 53 |N.#inclu|de "EgOS| |000000f0| 55 74 69 6c 73 2e 68 22 | 0d 23 65 6e 64 69 66 0d |Utils.h"|.#endif.| |00000100| 0d 0d 0d 0d 0d 0d 0d 23 | 64 65 66 69 6e 65 20 5f |.......#|define _| |00000110| 5f 63 6f 6c 6c 61 70 73 | 65 54 77 6f 09 09 09 09 |_collaps|eTwo....| |00000120| 09 09 09 09 09 09 09 09 | 09 09 09 5c 0d 09 68 69 |........|...\..hi| |00000130| 67 68 65 73 74 50 72 69 | 6f 72 69 74 79 20 3d 20 |ghestPri|ority = | |00000140| 30 3b 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |0;......|........| |00000150| 5c 0d 09 66 6f 72 20 28 | 20 69 20 3d 20 30 3b 20 |\..for (| i = 0; | |00000160| 69 20 3c 20 6e 75 6d 45 | 78 70 73 2d 31 3b 20 69 |i < numE|xps-1; i| |00000170| 2b 2b 20 29 20 7b 09 09 | 09 09 09 09 09 09 09 09 |++ ) {..|........| |00000180| 09 5c 0d 09 09 70 72 69 | 6f 72 69 74 79 20 3d 20 |.\...pri|ority = | |00000190| 6f 70 65 72 5b 20 69 20 | 5d 20 26 20 30 78 30 46 |oper[ i |] & 0x0F| |000001a0| 30 30 3b 09 09 09 09 09 | 09 09 09 09 09 09 5c 0d |00;.....|......\.| |000001b0| 09 09 69 66 20 28 20 70 | 72 69 6f 72 69 74 79 20 |..if ( p|riority | |000001c0| 3e 20 68 69 67 68 65 73 | 74 50 72 69 6f 72 69 74 |> highes|tPriorit| |000001d0| 79 20 29 20 7b 09 09 09 | 09 09 09 09 09 09 09 5c |y ) {...|.......\| |000001e0| 0d 09 09 09 68 69 67 68 | 65 73 74 50 72 69 6f 72 |....high|estPrior| |000001f0| 69 74 79 09 3d 20 70 72 | 69 6f 72 69 74 79 3b 09 |ity.= pr|iority;.| |00000200| 09 09 09 09 09 09 09 09 | 09 09 5c 0d 09 09 09 63 |........|..\....c| |00000210| 6f 6c 6c 61 70 73 65 09 | 09 3d 20 69 3b 09 09 09 |ollapse.|.= i;...| |00000220| 09 09 09 09 09 09 09 09 | 09 5c 0d 09 09 7d 09 09 |........|.\...}..| |00000230| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........| |00000240| 5c 0d 09 7d 09 09 09 09 | 09 09 09 09 09 09 09 09 |\..}....|........| |00000250| 09 09 09 09 09 09 09 5c | 0d 09 69 20 3d 20 63 6f |.......\|..i = co| |00000260| 6c 6c 61 70 73 65 3b 09 | 09 09 09 09 09 09 09 09 |llapse;.|........| |00000270| 09 09 09 09 09 09 09 5c | 0d 09 69 6e 56 4d 2e 44 |.......\|..inVM.D| |00000280| 6f 4f 70 28 20 65 78 70 | 72 5b 20 69 20 5d 2c 20 |oOp( exp|r[ i ], | |00000290| 65 78 70 72 5b 20 69 20 | 2b 20 31 20 5d 2c 20 6f |expr[ i |+ 1 ], o| |000002a0| 70 65 72 5b 20 69 20 5d | 20 26 20 30 78 46 46 20 |per[ i ]| & 0xFF | |000002b0| 29 3b 09 09 09 09 09 5c | 0d 09 69 6e 56 4d 2e 44 |);.....\|..inVM.D| |000002c0| 65 61 6c 6c 6f 63 52 65 | 67 28 20 65 78 70 72 5b |eallocRe|g( expr[| |000002d0| 20 69 20 2b 20 31 20 5d | 20 29 3b 09 09 09 09 09 | i + 1 ]| );.....| |000002e0| 09 09 09 09 09 09 5c 0d | 09 6e 75 6d 45 78 70 73 |......\.|.numExps| |000002f0| 2d 2d 3b 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |--;.....|........| |00000300| 09 09 09 09 5c 0d 09 6f | 70 65 72 5b 20 69 20 5d |....\..o|per[ i ]| |00000310| 20 3d 20 6f 70 65 72 5b | 20 69 2b 31 20 5d 3b 09 | = oper[| i+1 ];.| |00000320| 09 09 09 09 09 09 09 09 | 09 09 09 09 5c 0d 09 66 |........|....\..f| |00000330| 6f 72 20 28 20 69 2b 2b | 3b 20 69 20 3c 20 6e 75 |or ( i++|; i < nu| |00000340| 6d 45 78 70 73 3b 20 69 | 2b 2b 20 29 20 7b 09 09 |mExps; i|++ ) {..| |00000350| 09 09 09 09 09 09 09 09 | 09 09 5c 0d 09 09 6f 70 |........|..\...op| |00000360| 65 72 5b 20 69 20 5d 20 | 3d 20 6f 70 65 72 5b 20 |er[ i ] |= oper[ | |00000370| 69 2b 31 20 5d 3b 09 09 | 09 09 09 09 09 09 09 09 |i+1 ];..|........| |00000380| 09 09 5c 0d 09 09 65 78 | 70 72 5b 20 69 20 5d 20 |..\...ex|pr[ i ] | |00000390| 3d 20 65 78 70 72 5b 20 | 69 2b 31 20 5d 3b 09 09 |= expr[ |i+1 ];..| |000003a0| 09 09 09 09 09 09 09 09 | 09 09 5c 0d 09 7d 0d 0d |........|..\..}..| |000003b0| 0d 0d 2f 2f 09 50 72 65 | 3a 09 41 6c 6c 20 77 68 |..//.Pre|:.All wh| |000003c0| 69 74 65 73 70 61 63 65 | 20 61 6e 64 20 69 6c 6c |itespace| and ill| |000003d0| 65 67 61 6c 20 63 68 61 | 72 73 20 61 72 65 20 72 |egal cha|rs are r| |000003e0| 65 6d 6f 76 65 64 0d 2f | 2f 09 50 72 65 3a 09 50 |emoved./|/.Pre:.P| |000003f0| 61 72 65 6e 73 20 62 61 | 6c 65 6e 63 65 20 26 20 |arens ba|lence & | |00000400| 61 6c 6c 20 6c 65 74 74 | 65 72 73 20 61 72 65 20 |all lett|ers are | |00000410| 63 61 70 69 74 61 6c 69 | 7a 65 64 0d 2f 2f 09 4e |capitali|zed.//.N| |00000420| 6f 74 65 3a 09 49 20 6e | 6f 72 6d 61 6c 6c 79 20 |ote:.I n|ormally | |00000430| 64 6f 6e 27 74 20 77 72 | 69 74 65 20 73 75 63 68 |don't wr|ite such| |00000440| 20 68 75 67 65 2c 20 6e | 6f 6e 2d 63 6f 6d 70 61 | huge, n|on-compa| |00000450| 72 74 6d 65 6e 74 61 6c | 69 7a 65 64 20 63 6f 64 |rtmental|ized cod| |00000460| 65 2c 20 62 75 74 20 73 | 70 65 65 64 20 69 73 20 |e, but s|peed is | |00000470| 69 6d 70 6f 72 74 61 6e | 74 0d 2f 2f 09 50 6f 73 |importan|t.//.Pos| |00000480| 74 3a 09 41 6c 6c 6f 63 | 61 74 65 73 20 61 20 72 |t:.Alloc|ates a r| |00000490| 65 67 69 73 74 65 72 20 | 66 6f 72 20 74 68 65 20 |egister |for the | |000004a0| 72 65 74 75 72 6e 20 76 | 61 6c 75 65 20 61 6e 64 |return v|alue and| |000004b0| 20 72 65 74 75 72 6e 73 | 20 74 68 61 74 20 72 65 | returns| that re| |000004c0| 67 69 73 74 65 72 0d 69 | 6e 74 20 45 78 70 72 65 |gister.i|nt Expre| |000004d0| 73 73 69 6f 6e 3a 3a 43 | 6f 6d 70 69 6c 65 28 20 |ssion::C|ompile( | |000004e0| 63 68 61 72 2a 20 69 6e | 53 74 72 2c 20 6c 6f 6e |char* in|Str, lon| |000004f0| 67 20 69 6e 4c 65 6e 2c | 20 45 78 70 72 65 73 73 |g inLen,| Express| |00000500| 69 6f 6e 44 69 63 74 26 | 20 69 6e 44 69 63 74 2c |ionDict&| inDict,| |00000510| 20 45 78 70 72 56 69 72 | 74 75 61 6c 4d 61 63 68 | ExprVir|tualMach| |00000520| 69 6e 65 26 20 69 6e 56 | 4d 20 29 20 7b 0d 09 62 |ine& inV|M ) {..b| |00000530| 6f 6f 6c 09 09 09 68 61 | 73 4c 65 74 74 65 72 73 |ool...ha|sLetters| |00000540| 20 3d 20 66 61 6c 73 65 | 3b 0d 09 66 6c 6f 61 74 | = false|;..float| |00000550| 2a 09 09 09 66 6c 6f 61 | 74 50 74 72 2c 20 76 61 |*...floa|tPtr, va| |00000560| 6c 2c 20 2a 2a 66 63 6e | 50 74 72 3b 0d 09 6c 6f |l, **fcn|Ptr;..lo| |00000570| 6e 67 09 09 09 68 69 67 | 68 65 73 74 50 72 69 6f |ng...hig|hestPrio| |00000580| 72 69 74 79 2c 20 70 72 | 69 6f 72 69 74 79 2c 20 |rity, pr|iority, | |00000590| 69 2c 20 6e 75 6d 45 78 | 70 73 20 3d 20 30 2c 20 |i, numEx|ps = 0, | |000005a0| 73 74 61 72 74 50 6f 73 | 20 3d 20 30 3b 0d 09 6c |startPos| = 0;..l| |000005b0| 6f 6e 67 09 09 09 66 63 | 6e 43 61 6c 6c 2c 20 63 |ong...fc|nCall, c| |000005c0| 6f 6c 6c 61 70 73 65 2c | 20 63 2c 20 70 6f 73 2c |ollapse,| c, pos,| |000005d0| 20 70 61 72 65 6e 73 20 | 3d 20 30 2c 20 66 69 72 | parens |= 0, fir| |000005e0| 73 74 50 61 72 65 6e 20 | 3d 20 2d 31 2c 20 73 69 |stParen |= -1, si| |000005f0| 7a 65 3b 0d 09 73 68 6f | 72 74 09 09 09 6f 70 65 |ze;..sho|rt...ope| |00000600| 72 5b 20 34 20 5d 3b 0d | 09 73 68 6f 72 74 09 09 |r[ 4 ];.|.short..| |00000610| 09 65 78 70 72 5b 20 34 | 20 5d 3b 0d 09 0d 09 2f |.expr[ 4| ];..../| |00000620| 2f 20 43 61 74 63 68 20 | 61 20 6e 65 67 61 74 65 |/ Catch |a negate| |00000630| 64 20 65 78 70 72 65 73 | 73 69 6f 6e 2e 20 20 4d |d expres|sion. M| |00000640| 61 6b 65 20 69 74 20 74 | 68 65 20 73 61 6d 65 20 |ake it t|he same | |00000650| 61 73 20 30 2d 2e 2e 2e | 0d 09 69 66 20 28 20 69 |as 0-...|..if ( i| |00000660| 6e 4c 65 6e 20 3e 20 30 | 20 26 26 20 2a 69 6e 53 |nLen > 0| && *inS| |00000670| 74 72 20 3d 3d 20 27 2d | 27 20 29 20 7b 0d 09 09 |tr == '-|' ) {...| |00000680| 65 78 70 72 5b 20 30 20 | 5d 20 3d 20 69 6e 56 4d |expr[ 0 |] = inVM| |00000690| 2e 41 6c 6c 6f 63 52 65 | 67 28 29 3b 0d 09 09 6f |.AllocRe|g();...o| |000006a0| 70 65 72 5b 20 30 20 5d | 20 3d 20 30 78 31 30 30 |per[ 0 ]| = 0x100| |000006b0| 20 7c 20 27 2d 27 3b 0d | 09 09 69 6e 56 4d 2e 4c | | '-';.|..inVM.L| |000006c0| 6f 61 64 69 28 20 30 2e | 30 2c 20 65 78 70 72 5b |oadi( 0.|0, expr[| |000006d0| 20 30 20 5d 20 29 3b 0d | 09 09 6e 75 6d 45 78 70 | 0 ] );.|..numExp| |000006e0| 73 20 3d 20 31 3b 0d 09 | 09 69 6e 53 74 72 2b 2b |s = 1;..|.inStr++| |000006f0| 3b 0d 09 09 69 6e 4c 65 | 6e 2d 2d 3b 0d 09 7d 0d |;...inLe|n--;..}.| |00000700| 09 09 09 0d 09 2f 2f 20 | 4d 61 6b 65 20 61 20 70 |.....// |Make a p| |00000710| 61 73 73 20 74 68 72 75 | 20 6f 66 20 74 68 65 20 |ass thru| of the | |00000720| 73 74 72 69 6e 67 2c 20 | 66 69 6e 64 69 6e 67 20 |string, |finding | |00000730| 74 68 65 20 73 74 61 72 | 74 73 20 61 6e 64 20 65 |the star|ts and e| |00000740| 6e 64 73 20 6f 66 20 61 | 6c 6c 20 72 6f 6f 74 20 |nds of a|ll root | |00000750| 65 78 70 72 73 0d 09 66 | 6f 72 20 28 20 70 6f 73 |exprs..f|or ( pos| |00000760| 20 3d 20 30 3b 20 70 6f | 73 20 3c 20 69 6e 4c 65 | = 0; po|s < inLe| |00000770| 6e 3b 20 70 6f 73 2b 2b | 20 29 20 7b 0d 09 09 63 |n; pos++| ) {...c| |00000780| 20 3d 20 69 6e 53 74 72 | 5b 20 70 6f 73 20 5d 3b | = inStr|[ pos ];| |00000790| 0d 09 09 0d 09 09 69 66 | 20 28 20 63 20 3d 3d 20 |......if| ( c == | |000007a0| 27 28 27 20 29 20 7b 0d | 09 09 09 69 66 20 28 20 |'(' ) {.|...if ( | |000007b0| 66 69 72 73 74 50 61 72 | 65 6e 20 3c 20 30 20 29 |firstPar|en < 0 )| |000007c0| 0d 09 09 09 09 66 69 72 | 73 74 50 61 72 65 6e 20 |.....fir|stParen | |000007d0| 3d 20 70 6f 73 3b 0d 09 | 09 09 70 61 72 65 6e 73 |= pos;..|..parens| |000007e0| 2b 2b 3b 20 20 7d 0d 09 | 09 65 6c 73 65 20 69 66 |++; }..|.else if| |000007f0| 20 28 20 63 20 3d 3d 20 | 27 29 27 20 29 0d 09 09 | ( c == |')' )...| |00000800| 09 70 61 72 65 6e 73 2d | 2d 3b 0d 09 0d 09 09 2f |.parens-|-;...../| |00000810| 2f 20 44 6f 6e 27 74 20 | 63 6f 6e 73 69 64 65 72 |/ Don't |consider| |00000820| 20 61 6e 79 20 63 68 61 | 72 73 20 69 66 20 77 65 | any cha|rs if we| |00000830| 27 72 65 20 6e 6f 74 20 | 61 74 20 74 68 65 20 72 |'re not |at the r| |00000840| 6f 6f 74 20 6c 65 76 65 | 6c 09 09 0d 09 09 69 66 |oot leve|l.....if| |00000850| 20 28 20 70 61 72 65 6e | 73 20 3d 3d 20 30 20 29 | ( paren|s == 0 )| |00000860| 20 7b 0d 09 09 09 0d 09 | 09 09 69 66 20 28 20 63 | {......|..if ( c| |00000870| 20 3e 3d 20 27 41 27 20 | 26 26 20 63 20 3c 3d 20 | >= 'A' |&& c <= | |00000880| 27 5a 27 20 29 0d 09 09 | 09 09 68 61 73 4c 65 74 |'Z' )...|..hasLet| |00000890| 74 65 72 73 20 3d 20 74 | 72 75 65 3b 0d 09 09 0d |ters = t|rue;....| |000008a0| 09 09 09 2f 2f 20 4f 70 | 65 72 61 74 6f 72 73 20 |...// Op|erators | |000008b0| 61 72 65 20 77 68 61 74 | 20 73 65 70 61 72 61 74 |are what| separat| |000008c0| 65 20 65 78 70 72 73 0d | 09 09 09 73 77 69 74 63 |e exprs.|...switc| |000008d0| 68 20 28 20 63 20 29 20 | 7b 09 0d 09 09 09 09 63 |h ( c ) |{......c| |000008e0| 61 73 65 20 27 2d 27 3a | 0d 09 09 09 09 63 61 73 |ase '-':|.....cas| |000008f0| 65 20 27 2b 27 3a 09 70 | 72 69 6f 72 69 74 79 20 |e '+':.p|riority | |00000900| 3d 20 30 78 30 31 30 30 | 3b 09 67 6f 74 6f 20 64 |= 0x0100|;.goto d| |00000910| 6f 4f 70 3b 0d 09 09 09 | 09 63 61 73 65 20 27 2f |oOp;....|.case '/| |00000920| 27 3a 0d 09 09 09 09 63 | 61 73 65 20 27 25 27 3a |':.....c|ase '%':| |00000930| 0d 09 09 09 09 63 61 73 | 65 20 27 2a 27 3a 09 70 |.....cas|e '*':.p| |00000940| 72 69 6f 72 69 74 79 20 | 3d 20 30 78 30 32 30 30 |riority |= 0x0200| |00000950| 3b 09 67 6f 74 6f 20 64 | 6f 4f 70 3b 0d 09 09 09 |;.goto d|oOp;....| |00000960| 09 63 61 73 65 20 27 5e | 27 3a 09 70 72 69 6f 72 |.case '^|':.prior| |00000970| 69 74 79 20 3d 20 30 78 | 30 33 30 30 3b 0d 0d 09 |ity = 0x|0300;...| |00000980| 09 09 09 09 2f 2f 20 43 | 6c 6f 73 65 20 63 75 72 |....// C|lose cur| |00000990| 20 65 78 70 72 09 0d 64 | 6f 4f 70 3a 09 09 09 09 | expr..d|oOp:....| |000009a0| 69 66 20 28 20 70 6f 73 | 20 3e 20 73 74 61 72 74 |if ( pos| > start| |000009b0| 50 6f 73 20 26 26 20 70 | 6f 73 20 2b 20 31 20 3c |Pos && p|os + 1 <| |000009c0| 20 69 6e 4c 65 6e 20 29 | 20 7b 0d 09 09 09 09 09 | inLen )| {......| |000009d0| 09 09 0d 09 09 09 09 09 | 09 2f 2f 20 52 65 63 75 |........|.// Recu| |000009e0| 72 73 65 0d 09 09 09 09 | 09 09 65 78 70 72 5b 20 |rse.....|..expr[ | |000009f0| 6e 75 6d 45 78 70 73 20 | 5d 20 3d 20 43 6f 6d 70 |numExps |] = Comp| |00000a00| 69 6c 65 28 20 69 6e 53 | 74 72 20 2b 20 73 74 61 |ile( inS|tr + sta| |00000a10| 72 74 50 6f 73 2c 20 70 | 6f 73 20 2d 20 73 74 61 |rtPos, p|os - sta| |00000a20| 72 74 50 6f 73 2c 20 69 | 6e 44 69 63 74 2c 20 69 |rtPos, i|nDict, i| |00000a30| 6e 56 4d 20 29 3b 0d 09 | 09 09 09 09 09 6f 70 65 |nVM );..|.....ope| |00000a40| 72 5b 20 6e 75 6d 45 78 | 70 73 20 5d 20 3d 20 63 |r[ numEx|ps ] = c| |00000a50| 20 7c 20 70 72 69 6f 72 | 69 74 79 3b 0d 09 09 09 | | prior|ity;....| |00000a60| 09 09 09 6e 75 6d 45 78 | 70 73 2b 2b 3b 0d 09 09 |...numEx|ps++;...| |00000a70| 09 09 09 09 73 74 61 72 | 74 50 6f 73 20 3d 20 70 |....star|tPos = p| |00000a80| 6f 73 20 2b 20 31 3b 0d | 09 09 09 09 09 09 0d 09 |os + 1;.|........| |00000a90| 09 09 09 09 09 2f 2f 20 | 34 20 65 78 70 72 73 2c |.....// |4 exprs,| |00000aa0| 20 67 69 76 65 6e 20 74 | 68 72 65 65 20 70 72 69 | given t|hree pri| |00000ab0| 6f 72 69 74 79 20 6f 70 | 65 72 61 74 6f 72 73 2c |ority op|erators,| |00000ac0| 20 34 20 65 78 70 72 73 | 20 67 75 61 72 75 6e 74 | 4 exprs| guarunt| |00000ad0| 65 65 73 20 77 65 20 63 | 61 6e 20 63 6f 6c 6c 61 |ees we c|an colla| |00000ae0| 70 73 65 20 74 77 6f 20 | 69 6e 74 6f 20 6f 6e 65 |pse two |into one| |00000af0| 20 65 78 70 72 0d 09 09 | 09 09 09 09 69 66 20 28 | expr...|....if (| |00000b00| 20 6e 75 6d 45 78 70 73 | 20 3d 3d 20 34 20 29 20 | numExps| == 4 ) | |00000b10| 7b 0d 09 09 09 09 09 09 | 09 5f 5f 63 6f 6c 6c 61 |{.......|.__colla| |00000b20| 70 73 65 54 77 6f 0d 09 | 09 09 09 09 09 7d 0d 09 |pseTwo..|.....}..| |00000b30| 09 09 09 09 7d 0d 09 09 | 09 7d 0d 09 09 7d 0d 09 |....}...|.}...}..| |00000b40| 7d 0d 0d 0d 09 2f 2f 20 | 44 65 74 65 63 74 20 62 |}....// |Detect b| |00000b50| 61 73 65 20 63 61 73 65 | 20 28 69 65 2c 20 77 68 |ase case| (ie, wh| |00000b60| 6f 6c 65 20 73 74 72 69 | 6e 67 20 69 73 20 61 6e |ole stri|ng is an| |00000b70| 20 65 78 70 72 29 0d 09 | 69 66 20 28 20 6e 75 6d | expr)..|if ( num| |00000b80| 45 78 70 73 20 3d 3d 20 | 30 20 29 20 7b 0d 09 09 |Exps == |0 ) {...| |00000b90| 09 0d 09 09 2f 2f 20 53 | 65 65 20 69 66 20 77 65 |....// S|ee if we| |00000ba0| 20 66 6f 75 6e 64 20 61 | 20 66 63 6e 20 63 61 6c | found a| fcn cal| |00000bb0| 6c 20 6f 72 20 61 6e 20 | 75 6e 6e 65 65 64 65 64 |l or an |unneeded| |00000bc0| 20 70 61 72 65 6e 20 70 | 61 69 72 3a 20 28 2e 2e | paren p|air: (..| |00000bd0| 2e 29 0d 09 09 69 66 20 | 28 20 66 69 72 73 74 50 |.)...if |( firstP| |00000be0| 61 72 65 6e 20 3e 3d 20 | 30 20 26 26 20 66 69 72 |aren >= |0 && fir| |00000bf0| 73 74 50 61 72 65 6e 20 | 3c 3d 20 34 20 29 20 7b |stParen |<= 4 ) {| |00000c00| 0d 0d 09 09 09 2f 2f 20 | 45 76 61 6c 20 77 68 61 |.....// |Eval wha| |00000c10| 74 27 73 20 69 6e 73 69 | 64 65 20 74 68 65 20 70 |t's insi|de the p| |00000c20| 61 72 65 6e 73 0d 09 09 | 09 65 78 70 72 5b 20 30 |arens...|.expr[ 0| |00000c30| 20 5d 20 3d 20 43 6f 6d | 70 69 6c 65 28 20 69 6e | ] = Com|pile( in| |00000c40| 53 74 72 20 2b 20 66 69 | 72 73 74 50 61 72 65 6e |Str + fi|rstParen| |00000c50| 20 2b 20 31 2c 20 69 6e | 4c 65 6e 20 2d 20 66 69 | + 1, in|Len - fi| |00000c60| 72 73 74 50 61 72 65 6e | 20 2d 20 32 2c 20 69 6e |rstParen| - 2, in| |00000c70| 44 69 63 74 2c 20 69 6e | 56 4d 20 29 3b 0d 09 09 |Dict, in|VM );...| |00000c80| 0d 09 09 09 2f 2f 20 69 | 66 20 77 65 20 68 61 76 |....// i|f we hav| |00000c90| 65 20 61 20 66 63 6e 20 | 28 61 73 20 6f 70 70 6f |e a fcn |(as oppo| |00000ca0| 73 65 64 20 74 6f 20 6a | 75 73 74 20 61 20 70 61 |sed to j|ust a pa| |00000cb0| 72 65 6e 20 70 61 69 72 | 29 0d 09 09 09 69 66 20 |ren pair|)....if | |00000cc0| 28 20 66 69 72 73 74 50 | 61 72 65 6e 20 3e 20 30 |( firstP|aren > 0| |00000cd0| 20 29 20 7b 20 0d 09 09 | 09 0d 09 09 09 09 2f 2f | ) { ...|......//| |00000ce0| 20 54 72 61 6e 73 6c 61 | 74 65 20 74 68 65 20 73 | Transla|te the s| |00000cf0| 74 72 69 6e 67 20 6f 66 | 20 74 68 65 20 66 63 6e |tring of| the fcn| |00000d00| 20 74 6f 20 61 20 28 6f | 6e 65 20 62 79 74 65 29 | to a (o|ne byte)| |00000d10| 20 73 75 62 20 6f 70 20 | 63 6f 64 65 20 6e 75 6d | sub op |code num| |00000d20| 62 65 72 0d 09 09 09 09 | 66 63 6e 43 61 6c 6c 20 |ber.....|fcnCall | |00000d30| 3d 20 2a 28 28 6c 6f 6e | 67 2a 29 20 69 6e 53 74 |= *((lon|g*) inSt| |00000d40| 72 29 3b 0d 09 09 09 09 | 23 69 66 20 45 47 5f 57 |r);.....|#if EG_W| |00000d50| 49 4e 0d 09 09 09 09 66 | 63 6e 43 61 6c 6c 20 3d |IN.....f|cnCall =| |00000d60| 20 45 67 4f 53 55 74 69 | 6c 73 3a 3a 52 65 76 42 | EgOSUti|ls::RevB| |00000d70| 79 74 65 73 28 20 66 63 | 6e 43 61 6c 6c 20 29 3b |ytes( fc|nCall );| |00000d80| 0d 09 09 09 09 23 65 6e | 64 69 66 0d 09 09 09 09 |.....#en|dif.....| |00000d90| 73 77 69 74 63 68 20 28 | 20 66 63 6e 43 61 6c 6c |switch (| fcnCall| |00000da0| 20 29 20 7b 0d 09 09 09 | 09 09 63 61 73 65 20 27 | ) {....|..case '| |00000db0| 53 51 52 54 27 3a 09 66 | 63 6e 43 61 6c 6c 20 3d |SQRT':.f|cnCall =| |00000dc0| 20 63 53 51 52 54 3b 09 | 09 62 72 65 61 6b 3b 0d | cSQRT;.|.break;.| |00000dd0| 09 09 09 09 09 63 61 73 | 65 20 27 41 54 41 4e 27 |.....cas|e 'ATAN'| |00000de0| 3a 09 66 63 6e 43 61 6c | 6c 20 3d 20 63 41 54 41 |:.fcnCal|l = cATA| |00000df0| 4e 3b 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 09 09 |N;..brea|k;......| |00000e00| 63 61 73 65 20 27 41 42 | 53 28 27 3a 09 66 63 6e |case 'AB|S(':.fcn| |00000e10| 43 61 6c 6c 20 3d 20 63 | 41 42 53 3b 09 09 09 62 |Call = c|ABS;...b| |00000e20| 72 65 61 6b 3b 0d 09 09 | 09 09 09 63 61 73 65 20 |reak;...|...case | |00000e30| 27 53 49 4e 28 27 3a 09 | 66 63 6e 43 61 6c 6c 20 |'SIN(':.|fcnCall | |00000e40| 3d 20 63 53 49 4e 3b 09 | 09 09 62 72 65 61 6b 3b |= cSIN;.|..break;| |00000e50| 0d 09 09 09 09 09 63 61 | 73 65 20 27 43 4f 53 28 |......ca|se 'COS(| |00000e60| 27 3a 09 66 63 6e 43 61 | 6c 6c 20 3d 20 63 43 4f |':.fcnCa|ll = cCO| |00000e70| 53 3b 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |S;...bre|ak;.....| |00000e80| 09 63 61 73 65 20 27 54 | 41 4e 28 27 3a 09 66 63 |.case 'T|AN(':.fc| |00000e90| 6e 43 61 6c 6c 20 3d 20 | 63 54 41 4e 3b 09 09 09 |nCall = |cTAN;...| |00000ea0| 62 72 65 61 6b 3b 0d 09 | 09 09 09 09 63 61 73 65 |break;..|....case| |00000eb0| 20 27 4c 4f 47 28 27 3a | 09 66 63 6e 43 61 6c 6c | 'LOG(':|.fcnCall| |00000ec0| 20 3d 20 63 4c 4f 47 3b | 09 09 09 62 72 65 61 6b | = cLOG;|...break| |00000ed0| 3b 0d 09 09 09 09 09 63 | 61 73 65 20 27 45 58 50 |;......c|ase 'EXP| |00000ee0| 28 27 3a 09 66 63 6e 43 | 61 6c 6c 20 3d 20 63 45 |(':.fcnC|all = cE| |00000ef0| 58 50 3b 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |XP;...br|eak;....| |00000f00| 09 09 63 61 73 65 20 27 | 53 51 52 28 27 3a 09 66 |..case '|SQR(':.f| |00000f10| 63 6e 43 61 6c 6c 20 3d | 20 63 53 51 52 3b 09 09 |cnCall =| cSQR;..| |00000f20| 09 62 72 65 61 6b 3b 0d | 09 09 09 09 09 63 61 73 |.break;.|.....cas| |00000f30| 65 20 27 53 51 57 56 27 | 3a 09 66 63 6e 43 61 6c |e 'SQWV'|:.fcnCal| |00000f40| 6c 20 3d 20 63 53 51 57 | 56 3b 09 09 62 72 65 61 |l = cSQW|V;..brea| |00000f50| 6b 3b 0d 09 09 09 09 09 | 63 61 73 65 20 27 50 4f |k;......|case 'PO| |00000f60| 53 28 27 3a 09 66 63 6e | 43 61 6c 6c 20 3d 20 63 |S(':.fcn|Call = c| |00000f70| 50 4f 53 3b 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |POS;...b|reak;...| |00000f80| 09 09 09 63 61 73 65 20 | 27 52 4e 44 28 27 3a 09 |...case |'RND(':.| |00000f90| 66 63 6e 43 61 6c 6c 20 | 3d 20 63 52 4e 44 3b 09 |fcnCall |= cRND;.| |00000fa0| 09 09 62 72 65 61 6b 3b | 0d 09 09 09 09 09 63 61 |..break;|......ca| |00000fb0| 73 65 20 27 53 47 4e 28 | 27 3a 09 66 63 6e 43 61 |se 'SGN(|':.fcnCa| |00000fc0| 6c 6c 20 3d 20 63 53 47 | 4e 3b 09 09 09 62 72 65 |ll = cSG|N;...bre| |00000fd0| 61 6b 3b 0d 09 09 09 09 | 09 63 61 73 65 20 27 54 |ak;.....|.case 'T| |00000fe0| 52 57 56 27 3a 09 66 63 | 6e 43 61 6c 6c 20 3d 20 |RWV':.fc|nCall = | |00000ff0| 63 54 52 57 56 3b 09 09 | 62 72 65 61 6b 3b 0d 09 |cTRWV;..|break;..| |00001000| 09 09 09 09 63 61 73 65 | 20 27 43 4c 49 50 27 3a |....case| 'CLIP':| |00001010| 09 66 63 6e 43 61 6c 6c | 20 3d 20 63 43 4c 49 50 |.fcnCall| = cCLIP| |00001020| 3b 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 09 63 |;..break|;......c| |00001030| 61 73 65 20 27 53 45 45 | 44 27 3a 09 66 63 6e 43 |ase 'SEE|D':.fcnC| |00001040| 61 6c 6c 20 3d 20 63 53 | 45 45 44 3b 09 09 62 72 |all = cS|EED;..br| |00001050| 65 61 6b 3b 0d 09 09 09 | 09 09 64 65 66 61 75 6c |eak;....|..defaul| |00001060| 74 3a 20 7b 0d 09 09 09 | 09 09 09 66 63 6e 43 61 |t: {....|...fcnCa| |00001070| 6c 6c 20 3d 20 30 3b 0d | 09 09 09 09 09 09 55 74 |ll = 0;.|......Ut| |00001080| 69 6c 53 74 72 20 74 65 | 6d 70 28 20 69 6e 53 74 |ilStr te|mp( inSt| |00001090| 72 2c 20 66 69 72 73 74 | 50 61 72 65 6e 20 29 3b |r, first|Paren );| |000010a0| 0d 09 09 09 09 09 09 66 | 63 6e 50 74 72 20 3d 20 |.......f|cnPtr = | |000010b0| 69 6e 44 69 63 74 2e 4c | 6f 6f 6b 75 70 46 75 6e |inDict.L|ookupFun| |000010c0| 63 28 20 74 65 6d 70 2c | 20 73 69 7a 65 20 29 3b |c( temp,| size );| |000010d0| 0d 09 09 09 09 09 09 69 | 6e 56 4d 2e 55 73 65 72 |.......i|nVM.User| |000010e0| 46 63 6e 4f 70 28 20 65 | 78 70 72 5b 20 30 20 5d |FcnOp( e|xpr[ 0 ]| |000010f0| 2c 20 66 63 6e 50 74 72 | 2c 20 73 69 7a 65 20 29 |, fcnPtr|, size )| |00001100| 3b 0d 09 09 09 09 09 7d | 0d 09 09 09 09 7d 0d 09 |;......}|.....}..| |00001110| 09 09 09 69 66 20 28 20 | 66 63 6e 43 61 6c 6c 20 |...if ( |fcnCall | |00001120| 29 0d 09 09 09 09 09 69 | 6e 56 4d 2e 4d 61 74 68 |)......i|nVM.Math| |00001130| 4f 70 28 20 65 78 70 72 | 5b 20 30 20 5d 2c 20 66 |Op( expr|[ 0 ], f| |00001140| 63 6e 43 61 6c 6c 20 29 | 3b 20 20 0d 09 09 09 7d |cnCall )|; ....}| |00001150| 20 7d 0d 09 09 0d 09 09 | 2f 2f 20 43 61 74 63 68 | }......|// Catch| |00001160| 20 74 68 65 20 63 61 73 | 65 20 77 68 65 72 65 20 | the cas|e where | |00001170| 77 65 20 68 61 76 65 20 | 61 20 6e 75 6d 62 65 72 |we have |a number| |00001180| 2f 69 6d 6d 65 64 69 61 | 74 65 0d 09 09 65 6c 73 |/immedia|te...els| |00001190| 65 20 69 66 20 28 20 21 | 20 68 61 73 4c 65 74 74 |e if ( !| hasLett| |000011a0| 65 72 73 20 29 20 7b 0d | 09 09 09 76 61 6c 20 3d |ers ) {.|...val =| |000011b0| 20 55 74 69 6c 53 74 72 | 3a 3a 47 65 74 46 6c 6f | UtilStr|::GetFlo| |000011c0| 61 74 56 61 6c 28 20 69 | 6e 53 74 72 2c 20 69 6e |atVal( i|nStr, in| |000011d0| 4c 65 6e 20 29 3b 0d 09 | 09 09 65 78 70 72 5b 20 |Len );..|..expr[ | |000011e0| 30 20 5d 20 3d 20 69 6e | 56 4d 2e 41 6c 6c 6f 63 |0 ] = in|VM.Alloc| |000011f0| 52 65 67 28 29 3b 20 20 | 0d 09 09 09 69 6e 56 4d |Reg(); |....inVM| |00001200| 2e 4c 6f 61 64 69 28 20 | 76 61 6c 2c 20 65 78 70 |.Loadi( |val, exp| |00001210| 72 5b 20 30 20 5d 20 29 | 3b 20 7d 0d 09 09 09 0d |r[ 0 ] )|; }.....| |00001220| 09 09 2f 2f 20 41 74 20 | 74 68 69 73 20 70 6f 69 |..// At |this poi| |00001230| 6e 74 20 77 65 20 61 73 | 73 75 6d 65 20 69 74 27 |nt we as|sume it'| |00001240| 73 20 61 6e 20 69 64 65 | 6e 74 69 66 69 65 72 2c |s an ide|ntifier,| |00001250| 20 73 6f 20 77 65 27 6c | 6c 20 6c 6f 6f 6b 20 75 | so we'l|l look u| |00001260| 70 20 69 74 73 20 76 61 | 6c 75 65 0d 09 09 65 6c |p its va|lue...el| |00001270| 73 65 20 7b 0d 09 09 09 | 55 74 69 6c 53 74 72 20 |se {....|UtilStr | |00001280| 74 65 6d 70 3b 0d 09 09 | 09 74 65 6d 70 2e 41 73 |temp;...|.temp.As| |00001290| 73 69 67 6e 28 20 69 6e | 53 74 72 2c 20 69 6e 4c |sign( in|Str, inL| |000012a0| 65 6e 20 29 3b 0d 09 09 | 09 65 78 70 72 5b 20 30 |en );...|.expr[ 0| |000012b0| 20 5d 20 3d 20 69 6e 56 | 4d 2e 41 6c 6c 6f 63 52 | ] = inV|M.AllocR| |000012c0| 65 67 28 29 3b 0d 09 09 | 09 66 6c 6f 61 74 50 74 |eg();...|.floatPt| |000012d0| 72 20 3d 20 69 6e 44 69 | 63 74 2e 4c 6f 6f 6b 75 |r = inDi|ct.Looku| |000012e0| 70 56 61 72 28 20 74 65 | 6d 70 20 29 3b 0d 09 09 |pVar( te|mp );...| |000012f0| 09 69 66 20 28 20 66 6c | 6f 61 74 50 74 72 20 29 |.if ( fl|oatPtr )| |00001300| 0d 09 09 09 09 69 6e 56 | 4d 2e 4c 6f 61 64 69 28 |.....inV|M.Loadi(| |00001310| 20 66 6c 6f 61 74 50 74 | 72 2c 20 65 78 70 72 5b | floatPt|r, expr[| |00001320| 20 30 20 5d 20 29 3b 0d | 09 09 7d 20 7d 0d 09 09 | 0 ] );.|..} }...| |00001330| 0d 09 2f 2f 20 49 66 20 | 74 68 65 72 65 20 6d 6f |..// If |there mo| |00001340| 72 65 20 74 68 61 6e 20 | 6f 6e 65 20 65 78 70 72 |re than |one expr| |00001350| 65 73 73 69 6f 6e 0d 09 | 65 6c 73 65 20 7b 0d 09 |ession..|else {..| |00001360| 09 09 09 0d 09 09 2f 2f | 20 46 69 6e 69 73 68 20 |......//| Finish | |00001370| 74 68 65 20 63 75 72 72 | 65 6e 74 20 65 78 70 72 |the curr|ent expr| |00001380| 0d 09 09 69 66 20 28 20 | 73 74 61 72 74 50 6f 73 |...if ( |startPos| |00001390| 20 3c 20 69 6e 4c 65 6e | 20 29 20 7b 0d 09 09 09 | < inLen| ) {....| |000013a0| 65 78 70 72 5b 20 6e 75 | 6d 45 78 70 73 20 5d 20 |expr[ nu|mExps ] | |000013b0| 3d 20 43 6f 6d 70 69 6c | 65 28 20 69 6e 53 74 72 |= Compil|e( inStr| |000013c0| 20 2b 20 73 74 61 72 74 | 50 6f 73 2c 20 69 6e 4c | + start|Pos, inL| |000013d0| 65 6e 20 2d 20 73 74 61 | 72 74 50 6f 73 2c 20 69 |en - sta|rtPos, i| |000013e0| 6e 44 69 63 74 2c 20 69 | 6e 56 4d 20 29 3b 0d 09 |nDict, i|nVM );..| |000013f0| 09 09 6e 75 6d 45 78 70 | 73 2b 2b 3b 0d 09 09 7d |..numExp|s++;...}| |00001400| 0d 09 09 0d 09 09 2f 2f | 20 57 68 65 6e 20 74 68 |......//| When th| |00001410| 65 72 65 27 6c 6c 20 62 | 65 20 6e 6f 20 6d 6f 72 |ere'll b|e no mor| |00001420| 65 20 65 78 70 72 73 2c | 20 77 65 27 72 65 20 66 |e exprs,| we're f| |00001430| 72 65 65 20 74 6f 20 63 | 6f 6c 6c 61 70 73 65 20 |ree to c|ollapse | |00001440| 61 6c 6c 20 74 68 65 20 | 65 78 70 72 73 20 69 6e |all the |exprs in| |00001450| 74 6f 20 6f 6e 65 0d 09 | 09 77 68 69 6c 65 20 28 |to one..|.while (| |00001460| 20 6e 75 6d 45 78 70 73 | 20 3e 20 31 20 29 20 7b | numExps| > 1 ) {| |00001470| 0d 09 09 09 5f 5f 63 6f | 6c 6c 61 70 73 65 54 77 |....__co|llapseTw| |00001480| 6f 0d 09 09 7d 0d 09 7d | 0d 09 09 09 09 0d 09 72 |o...}..}|.......r| |00001490| 65 74 75 72 6e 20 65 78 | 70 72 5b 20 30 20 5d 3b |eturn ex|pr[ 0 ];| |000014a0| 0d 7d 0d 0d 0d 0d 0d 0d | 2f 2a 0d 0d 0d 0d 0d 0d |.}......|/*......| |000014b0| 0d 0d 23 64 65 66 69 6e | 65 20 5f 5f 63 6f 6c 6c |..#defin|e __coll| |000014c0| 61 70 73 65 54 77 6f 09 | 09 09 09 09 09 09 09 09 |apseTwo.|........| |000014d0| 09 09 09 09 09 09 5c 0d | 09 68 69 67 68 65 73 74 |......\.|.highest| |000014e0| 50 72 69 6f 72 69 74 79 | 20 3d 20 30 3b 09 09 09 |Priority| = 0;...| |000014f0| 09 09 09 09 09 09 09 09 | 09 09 09 5c 0d 09 66 6f |........|...\..fo| |00001500| 72 20 28 20 69 20 3d 20 | 30 3b 20 69 20 3c 20 6e |r ( i = |0; i < n| |00001510| 75 6d 45 78 70 73 2d 31 | 3b 20 69 2b 2b 20 29 20 |umExps-1|; i++ ) | |00001520| 7b 09 09 09 09 09 09 09 | 09 09 09 09 5c 0d 09 09 |{.......|....\...| |00001530| 70 72 69 6f 72 69 74 79 | 20 3d 20 6f 70 65 72 5b |priority| = oper[| |00001540| 20 69 20 5d 20 26 20 30 | 78 30 46 30 30 3b 09 09 | i ] & 0|x0F00;..| |00001550| 09 09 09 09 09 09 09 09 | 09 5c 0d 09 09 69 66 20 |........|.\...if | |00001560| 28 20 70 72 69 6f 72 69 | 74 79 20 3e 20 68 69 67 |( priori|ty > hig| |00001570| 68 65 73 74 50 72 69 6f | 72 69 74 79 20 29 20 7b |hestPrio|rity ) {| |00001580| 09 09 09 09 09 09 09 09 | 09 09 5c 0d 09 09 09 68 |........|..\....h| |00001590| 69 67 68 65 73 74 50 72 | 69 6f 72 69 74 79 09 3d |ighestPr|iority.=| |000015a0| 20 70 72 69 6f 72 69 74 | 79 3b 09 09 09 09 09 09 | priorit|y;......| |000015b0| 09 09 09 09 09 5c 0d 09 | 09 09 63 6f 6c 6c 61 70 |.....\..|..collap| |000015c0| 73 65 09 09 3d 20 69 3b | 09 09 09 09 09 09 09 09 |se..= i;|........| |000015d0| 09 09 09 09 5c 0d 09 09 | 7d 09 09 09 09 09 09 09 |....\...|}.......| |000015e0| 09 09 09 09 09 09 09 09 | 09 09 09 5c 0d 09 7d 09 |........|...\..}.| |000015f0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |........|........| |00001600| 09 09 5c 0d 09 69 20 3d | 20 63 6f 6c 6c 61 70 73 |..\..i =| collaps| |00001610| 65 3b 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |e;......|........| |00001620| 09 09 5c 0d 09 69 6e 56 | 4d 2e 44 6f 4f 70 28 20 |..\..inV|M.DoOp( | |00001630| 69 2c 20 6f 70 65 72 5b | 20 69 20 5d 20 26 20 30 |i, oper[| i ] & 0| |00001640| 78 46 46 20 29 3b 09 09 | 09 09 09 09 09 09 09 09 |xFF );..|........| |00001650| 09 5c 0d 09 6e 75 6d 45 | 78 70 73 2d 2d 3b 09 09 |.\..numE|xps--;..| |00001660| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 09 09 5c |........|.......\| |00001670| 0d 09 6f 70 65 72 5b 20 | 69 20 5d 20 3d 20 6f 70 |..oper[ |i ] = op| |00001680| 65 72 5b 20 69 2b 31 20 | 5d 3b 09 09 09 09 09 09 |er[ i+1 |];......| |00001690| 09 09 09 09 09 09 09 5c | 0d 09 66 6f 72 20 28 20 |.......\|..for ( | |000016a0| 69 2b 2b 3b 20 69 20 3c | 20 6e 75 6d 45 78 70 73 |i++; i <| numExps| |000016b0| 3b 20 69 2b 2b 20 29 20 | 7b 09 09 09 09 09 09 09 |; i++ ) |{.......| |000016c0| 09 09 09 09 09 5c 0d 09 | 09 69 6e 56 4d 2e 4d 6f |.....\..|.inVM.Mo| |000016d0| 76 65 55 70 28 20 69 20 | 29 3b 09 09 09 09 09 09 |veUp( i |);......| |000016e0| 09 09 09 09 09 09 09 09 | 5c 0d 09 09 6f 70 65 72 |........|\...oper| |000016f0| 5b 20 69 20 5d 20 3d 20 | 6f 70 65 72 5b 20 69 2b |[ i ] = |oper[ i+| |00001700| 31 20 5d 3b 09 09 09 09 | 09 09 09 09 09 09 09 09 |1 ];....|........| |00001710| 5c 0d 09 7d 0d 0d 0d 0d | 2f 2f 09 50 72 65 3a 09 |\..}....|//.Pre:.| |00001720| 41 6c 6c 20 77 68 69 74 | 65 73 70 61 63 65 20 61 |All whit|espace a| |00001730| 6e 64 20 69 6c 6c 65 67 | 61 6c 20 63 68 61 72 73 |nd illeg|al chars| |00001740| 20 61 72 65 20 72 65 6d | 6f 76 65 64 0d 2f 2f 09 | are rem|oved.//.| |00001750| 50 72 65 3a 09 50 61 72 | 65 6e 73 20 62 61 6c 65 |Pre:.Par|ens bale| |00001760| 6e 63 65 20 26 20 61 6c | 6c 20 6c 65 74 74 65 72 |nce & al|l letter| |00001770| 73 20 61 72 65 20 63 61 | 70 69 74 61 6c 69 7a 65 |s are ca|pitalize| |00001780| 64 0d 2f 2f 09 4e 6f 74 | 65 3a 09 49 20 6e 6f 72 |d.//.Not|e:.I nor| |00001790| 6d 61 6c 6c 79 20 64 6f | 6e 27 74 20 77 72 69 74 |mally do|n't writ| |000017a0| 65 20 73 75 63 68 20 68 | 75 67 65 2c 20 6e 6f 6e |e such h|uge, non| |000017b0| 2d 63 6f 6d 70 61 72 74 | 6d 65 6e 74 61 6c 69 7a |-compart|mentaliz| |000017c0| 65 64 20 63 6f 64 65 2c | 20 62 75 74 20 73 70 65 |ed code,| but spe| |000017d0| 65 64 20 69 73 20 69 6d | 70 6f 72 74 61 6e 74 0d |ed is im|portant.| |000017e0| 76 6f 69 64 20 45 78 70 | 72 65 73 73 69 6f 6e 3a |void Exp|ression:| |000017f0| 3a 43 6f 6d 70 69 6c 65 | 28 20 63 68 61 72 2a 20 |:Compile|( char* | |00001800| 69 6e 53 74 72 2c 20 6c | 6f 6e 67 20 69 6e 4c 65 |inStr, l|ong inLe| |00001810| 6e 2c 20 63 6f 6e 73 74 | 20 48 61 73 68 74 61 62 |n, const| Hashtab| |00001820| 6c 65 26 20 69 6e 44 69 | 63 74 2c 20 45 78 70 72 |le& inDi|ct, Expr| |00001830| 56 69 72 74 75 61 6c 4d | 61 63 68 69 6e 65 26 20 |VirtualM|achine& | |00001840| 69 6e 56 4d 20 29 20 7b | 0d 09 62 6f 6f 6c 09 09 |inVM ) {|..bool..| |00001850| 09 68 61 73 4c 65 74 74 | 65 72 73 20 3d 20 66 61 |.hasLett|ers = fa| |00001860| 6c 73 65 3b 0d 09 64 6f | 75 62 6c 65 2a 09 09 09 |lse;..do|uble*...| |00001870| 64 62 6c 50 74 72 2c 20 | 76 61 6c 3b 0d 09 6c 6f |dblPtr, |val;..lo| |00001880| 6e 67 09 09 09 68 69 67 | 68 65 73 74 50 72 69 6f |ng...hig|hestPrio| |00001890| 72 69 74 79 2c 20 70 72 | 69 6f 72 69 74 79 2c 20 |rity, pr|iority, | |000018a0| 69 2c 20 6e 75 6d 45 78 | 70 73 20 3d 20 30 2c 20 |i, numEx|ps = 0, | |000018b0| 73 74 61 72 74 50 6f 73 | 20 3d 20 30 3b 0d 09 6c |startPos| = 0;..l| |000018c0| 6f 6e 67 09 09 09 66 63 | 6e 43 61 6c 6c 2c 20 63 |ong...fc|nCall, c| |000018d0| 6f 6c 6c 61 70 73 65 2c | 20 63 2c 20 70 6f 73 2c |ollapse,| c, pos,| |000018e0| 20 70 61 72 65 6e 73 20 | 3d 20 30 2c 20 66 69 72 | parens |= 0, fir| |000018f0| 73 74 50 61 72 65 6e 20 | 3d 20 2d 31 3b 0d 09 73 |stParen |= -1;..s| |00001900| 68 6f 72 74 09 09 09 6f | 70 65 72 5b 20 34 20 5d |hort...o|per[ 4 ]| |00001910| 3b 0d 09 73 68 6f 72 74 | 09 09 09 72 65 67 5b 20 |;..short|...reg[ | |00001920| 34 20 5d 3b 0d 09 0d 09 | 2f 2f 20 43 61 74 63 68 |4 ];....|// Catch| |00001930| 20 61 20 6e 65 67 61 74 | 65 64 20 65 78 70 72 65 | a negat|ed expre| |00001940| 73 73 69 6f 6e 0d 09 69 | 66 20 28 20 69 6e 4c 65 |ssion..i|f ( inLe| |00001950| 6e 20 3e 20 30 20 26 26 | 20 2a 69 6e 53 74 72 20 |n > 0 &&| *inStr | |00001960| 3d 3d 20 27 2d 27 20 29 | 20 7b 0d 09 09 69 6e 56 |== '-' )| {...inV| |00001970| 4d 2e 4c 6f 61 64 69 28 | 20 30 2e 30 20 29 3b 0d |M.Loadi(| 0.0 );.| |00001980| 09 09 6f 70 65 72 5b 20 | 30 20 5d 20 3d 20 30 78 |..oper[ |0 ] = 0x| |00001990| 31 30 30 20 7c 20 27 2d | 27 3b 0d 09 09 6e 75 6d |100 | '-|';...num| |000019a0| 45 78 70 73 20 3d 20 31 | 3b 0d 09 09 69 6e 53 74 |Exps = 1|;...inSt| |000019b0| 72 2b 2b 3b 0d 09 09 69 | 6e 4c 65 6e 2d 2d 3b 0d |r++;...i|nLen--;.| |000019c0| 09 7d 0d 09 09 09 0d 09 | 2f 2f 20 4d 61 6b 65 20 |.}......|// Make | |000019d0| 61 20 70 61 73 73 20 74 | 68 72 75 20 6f 66 20 74 |a pass t|hru of t| |000019e0| 68 65 20 73 74 72 69 6e | 67 2c 20 66 69 6e 64 69 |he strin|g, findi| |000019f0| 6e 67 20 74 68 65 20 73 | 74 61 72 74 73 20 61 6e |ng the s|tarts an| |00001a00| 64 20 65 6e 64 73 20 6f | 66 20 61 6c 6c 20 72 6f |d ends o|f all ro| |00001a10| 6f 74 20 65 78 70 72 73 | 0d 09 66 6f 72 20 28 20 |ot exprs|..for ( | |00001a20| 70 6f 73 20 3d 20 30 3b | 20 70 6f 73 20 3c 20 69 |pos = 0;| pos < i| |00001a30| 6e 4c 65 6e 3b 20 70 6f | 73 2b 2b 20 29 20 7b 0d |nLen; po|s++ ) {.| |00001a40| 09 09 63 20 3d 20 69 6e | 53 74 72 5b 20 70 6f 73 |..c = in|Str[ pos| |00001a50| 20 5d 3b 0d 09 09 0d 09 | 09 69 66 20 28 20 63 20 | ];.....|.if ( c | |00001a60| 3d 3d 20 27 28 27 20 29 | 20 7b 0d 09 09 09 69 66 |== '(' )| {....if| |00001a70| 20 28 20 66 69 72 73 74 | 50 61 72 65 6e 20 3c 20 | ( first|Paren < | |00001a80| 30 20 29 0d 09 09 09 09 | 66 69 72 73 74 50 61 72 |0 ).....|firstPar| |00001a90| 65 6e 20 3d 20 70 6f 73 | 3b 0d 09 09 09 70 61 72 |en = pos|;....par| |00001aa0| 65 6e 73 2b 2b 3b 20 20 | 7d 0d 09 09 65 6c 73 65 |ens++; |}...else| |00001ab0| 20 69 66 20 28 20 63 20 | 3d 3d 20 27 29 27 20 29 | if ( c |== ')' )| |00001ac0| 0d 09 09 09 70 61 72 65 | 6e 73 2d 2d 3b 0d 09 0d |....pare|ns--;...| |00001ad0| 09 09 2f 2f 20 44 6f 6e | 27 74 20 63 6f 6e 73 69 |..// Don|'t consi| |00001ae0| 64 65 72 20 61 6e 79 20 | 63 68 61 72 73 20 69 66 |der any |chars if| |00001af0| 20 77 65 27 72 65 20 6e | 6f 74 20 61 74 20 74 68 | we're n|ot at th| |00001b00| 65 20 72 6f 6f 74 20 6c | 65 76 65 6c 09 09 0d 09 |e root l|evel....| |00001b10| 09 69 66 20 28 20 70 61 | 72 65 6e 73 20 3d 3d 20 |.if ( pa|rens == | |00001b20| 30 20 29 20 7b 0d 09 09 | 09 0d 09 09 09 69 66 20 |0 ) {...|.....if | |00001b30| 28 20 63 20 3e 3d 20 27 | 41 27 20 26 26 20 63 20 |( c >= '|A' && c | |00001b40| 3c 3d 20 27 5a 27 20 29 | 0d 09 09 09 09 68 61 73 |<= 'Z' )|.....has| |00001b50| 4c 65 74 74 65 72 73 20 | 3d 20 74 72 75 65 3b 0d |Letters |= true;.| |00001b60| 09 09 0d 09 09 09 2f 2f | 20 4f 70 65 72 61 74 6f |......//| Operato| |00001b70| 72 73 20 61 72 65 20 77 | 68 61 74 20 73 65 70 61 |rs are w|hat sepa| |00001b80| 72 61 74 65 20 65 78 70 | 72 73 0d 09 09 09 73 77 |rate exp|rs....sw| |00001b90| 69 74 63 68 20 28 20 63 | 20 29 20 7b 09 0d 09 09 |itch ( c| ) {....| |00001ba0| 09 09 63 61 73 65 20 27 | 2d 27 3a 0d 09 09 09 09 |..case '|-':.....| |00001bb0| 63 61 73 65 20 27 2b 27 | 3a 09 70 72 69 6f 72 69 |case '+'|:.priori| |00001bc0| 74 79 20 3d 20 30 78 30 | 31 30 30 3b 09 67 6f 74 |ty = 0x0|100;.got| |00001bd0| 6f 20 64 6f 4f 70 3b 0d | 09 09 09 09 63 61 73 65 |o doOp;.|....case| |00001be0| 20 27 2f 27 3a 0d 09 09 | 09 09 63 61 73 65 20 27 | '/':...|..case '| |00001bf0| 25 27 3a 0d 09 09 09 09 | 63 61 73 65 20 27 2a 27 |%':.....|case '*'| |00001c00| 3a 09 70 72 69 6f 72 69 | 74 79 20 3d 20 30 78 30 |:.priori|ty = 0x0| |00001c10| 32 30 30 3b 09 67 6f 74 | 6f 20 64 6f 4f 70 3b 0d |200;.got|o doOp;.| |00001c20| 09 09 09 09 63 61 73 65 | 20 27 5e 27 3a 09 70 72 |....case| '^':.pr| |00001c30| 69 6f 72 69 74 79 20 3d | 20 30 78 30 33 30 30 3b |iority =| 0x0300;| |00001c40| 0d 0d 09 09 09 09 09 2f | 2f 20 43 6c 6f 73 65 20 |......./|/ Close | |00001c50| 63 75 72 20 65 78 70 72 | 09 0d 64 6f 4f 70 3a 09 |cur expr|..doOp:.| |00001c60| 09 09 09 69 66 20 28 20 | 70 6f 73 20 3e 20 73 74 |...if ( |pos > st| |00001c70| 61 72 74 50 6f 73 20 26 | 26 20 70 6f 73 20 2b 20 |artPos &|& pos + | |00001c80| 31 20 3c 20 69 6e 4c 65 | 6e 20 29 20 7b 0d 0d 09 |1 < inLe|n ) {...| |00001c90| 09 09 09 09 09 2f 2f 20 | 50 75 73 68 20 72 65 67 |.....// |Push reg| |00001ca0| 69 73 74 65 72 73 20 30 | 20 74 68 72 75 20 28 6e |isters 0| thru (n| |00001cb0| 75 6d 45 78 70 73 2d 31 | 29 2c 20 74 68 65 20 72 |umExps-1|), the r| |00001cc0| 65 67 69 73 74 65 72 73 | 20 69 6e 20 75 73 65 0d |egisters| in use.| |00001cd0| 09 09 09 09 09 09 69 6e | 56 4d 2e 4d 61 73 73 50 |......in|VM.MassP| |00001ce0| 75 73 68 28 20 6e 75 6d | 45 78 70 73 20 2d 20 31 |ush( num|Exps - 1| |00001cf0| 20 29 3b 0d 09 09 09 09 | 09 09 09 0d 09 09 09 09 | );.....|........| |00001d00| 09 09 2f 2f 20 52 65 63 | 75 72 73 65 0d 09 09 09 |..// Rec|urse....| |00001d10| 09 09 09 43 6f 6d 70 69 | 6c 65 28 20 69 6e 53 74 |...Compi|le( inSt| |00001d20| 72 20 2b 20 73 74 61 72 | 74 50 6f 73 2c 20 70 6f |r + star|tPos, po| |00001d30| 73 20 2d 20 73 74 61 72 | 74 50 6f 73 2c 20 69 6e |s - star|tPos, in| |00001d40| 44 69 63 74 2c 20 69 6e | 56 4d 20 29 3b 0d 09 09 |Dict, in|VM );...| |00001d50| 09 09 09 09 6f 70 65 72 | 5b 20 6e 75 6d 45 78 70 |....oper|[ numExp| |00001d60| 73 20 5d 20 3d 20 63 20 | 7c 20 70 72 69 6f 72 69 |s ] = c || priori| |00001d70| 74 79 3b 0d 09 09 09 09 | 09 09 6e 75 6d 45 78 70 |ty;.....|..numExp| |00001d80| 73 2b 2b 3b 0d 09 09 09 | 09 09 09 73 74 61 72 74 |s++;....|...start| |00001d90| 50 6f 73 20 3d 20 70 6f | 73 20 2b 20 31 3b 0d 09 |Pos = po|s + 1;..| |00001da0| 09 09 09 09 09 0d 09 09 | 09 09 09 09 2f 2f 20 54 |........|....// T| |00001db0| 68 65 20 72 65 74 75 72 | 6e 20 76 61 6c 75 65 20 |he retur|n value | |00001dc0| 69 73 20 69 6e 20 72 65 | 67 20 30 2e 20 41 6c 73 |is in re|g 0. Als| |00001dd0| 6f 20 70 6f 70 2f 72 65 | 73 74 6f 72 65 20 74 68 |o pop/re|store th| |00001de0| 65 20 46 50 20 72 65 67 | 69 73 74 65 72 73 20 69 |e FP reg|isters i| |00001df0| 6e 20 75 73 65 0d 09 09 | 09 09 09 09 69 6e 56 4d |n use...|....inVM| |00001e00| 2e 4d 6f 76 65 28 20 6e | 75 6d 45 78 70 73 20 2d |.Move( n|umExps -| |00001e10| 20 31 20 29 3b 0d 09 09 | 09 09 09 09 69 6e 56 4d | 1 );...|....inVM| |00001e20| 2e 4d 61 73 73 50 6f 70 | 28 20 6e 75 6d 45 78 70 |.MassPop|( numExp| |00001e30| 73 20 2d 20 32 20 29 3b | 0d 0d 09 09 09 09 09 09 |s - 2 );|........| |00001e40| 2f 2f 20 34 20 65 78 70 | 72 73 2c 20 67 69 76 65 |// 4 exp|rs, give| |00001e50| 6e 20 74 68 72 65 65 20 | 70 72 69 6f 72 69 74 79 |n three |priority| |00001e60| 20 6f 70 65 72 61 74 6f | 72 73 2c 20 34 20 65 78 | operato|rs, 4 ex| |00001e70| 70 72 73 20 67 75 61 72 | 75 6e 74 65 65 73 20 77 |prs guar|untees w| |00001e80| 65 20 63 61 6e 20 63 6f | 6c 6c 61 70 73 65 20 74 |e can co|llapse t| |00001e90| 77 6f 20 69 6e 74 6f 20 | 6f 6e 65 20 65 78 70 72 |wo into |one expr| |00001ea0| 0d 09 09 09 09 09 09 69 | 66 20 28 20 6e 75 6d 45 |.......i|f ( numE| |00001eb0| 78 70 73 20 3d 3d 20 34 | 20 29 20 7b 0d 09 09 09 |xps == 4| ) {....| |00001ec0| 09 09 09 09 5f 5f 63 6f | 6c 6c 61 70 73 65 54 77 |....__co|llapseTw| |00001ed0| 6f 0d 09 09 09 09 09 09 | 7d 0d 09 09 09 09 09 7d |o.......|}......}| |00001ee0| 0d 09 09 09 7d 0d 09 09 | 7d 0d 09 7d 0d 0d 0d 09 |....}...|}..}....| |00001ef0| 2f 2f 20 44 65 74 65 63 | 74 20 62 61 73 65 20 63 |// Detec|t base c| |00001f00| 61 73 65 20 28 69 65 2c | 20 77 68 6f 6c 65 20 73 |ase (ie,| whole s| |00001f10| 74 72 69 6e 67 20 69 73 | 20 61 6e 20 65 78 70 72 |tring is| an expr| |00001f20| 29 0d 09 69 66 20 28 20 | 6e 75 6d 45 78 70 73 20 |)..if ( |numExps | |00001f30| 3d 3d 20 30 20 29 20 7b | 0d 09 09 09 0d 09 09 2f |== 0 ) {|......./| |00001f40| 2f 20 53 65 65 20 69 66 | 20 77 65 20 66 6f 75 6e |/ See if| we foun| |00001f50| 64 20 61 20 66 63 6e 20 | 63 61 6c 6c 20 6f 72 20 |d a fcn |call or | |00001f60| 61 6e 20 75 6e 6e 65 65 | 64 65 64 20 70 61 72 65 |an unnee|ded pare| |00001f70| 6e 20 70 61 69 72 3a 20 | 28 2e 2e 2e 29 0d 09 09 |n pair: |(...)...| |00001f80| 69 66 20 28 20 66 69 72 | 73 74 50 61 72 65 6e 20 |if ( fir|stParen | |00001f90| 3e 3d 20 30 20 26 26 20 | 66 69 72 73 74 50 61 72 |>= 0 && |firstPar| |00001fa0| 65 6e 20 3c 3d 20 34 20 | 29 20 7b 0d 0d 09 09 09 |en <= 4 |) {.....| |00001fb0| 2f 2f 20 45 76 61 6c 20 | 77 68 61 74 27 73 20 69 |// Eval |what's i| |00001fc0| 6e 73 69 64 65 20 74 68 | 65 20 70 61 72 65 6e 73 |nside th|e parens| |00001fd0| 0d 09 09 09 43 6f 6d 70 | 69 6c 65 28 20 69 6e 53 |....Comp|ile( inS| |00001fe0| 74 72 20 2b 20 66 69 72 | 73 74 50 61 72 65 6e 20 |tr + fir|stParen | |00001ff0| 2b 20 31 2c 20 69 6e 4c | 65 6e 20 2d 20 66 69 72 |+ 1, inL|en - fir| |00002000| 73 74 50 61 72 65 6e 20 | 2d 20 32 2c 20 69 6e 44 |stParen |- 2, inD| |00002010| 69 63 74 2c 20 69 6e 56 | 4d 20 29 3b 0d 09 09 09 |ict, inV|M );....| |00002020| 0d 09 09 09 2f 2f 20 54 | 72 61 6e 73 6c 61 74 65 |....// T|ranslate| |00002030| 20 74 68 65 20 73 74 72 | 69 6e 67 20 6f 66 20 74 | the str|ing of t| |00002040| 68 65 20 66 63 6e 20 74 | 6f 20 61 20 28 6f 6e 65 |he fcn t|o a (one| |00002050| 20 62 79 74 65 29 20 63 | 6f 64 65 20 6e 75 6d 62 | byte) c|ode numb| |00002060| 65 72 0d 09 09 09 66 63 | 6e 43 61 6c 6c 20 3d 20 |er....fc|nCall = | |00002070| 2a 28 28 6c 6f 6e 67 2a | 29 20 69 6e 53 74 72 29 |*((long*|) inStr)| |00002080| 3b 0d 09 09 09 73 77 69 | 74 63 68 20 28 20 66 63 |;....swi|tch ( fc| |00002090| 6e 43 61 6c 6c 20 29 20 | 7b 0d 09 09 09 09 23 69 |nCall ) |{.....#i| |000020a0| 66 20 45 47 5f 4d 41 43 | 0d 09 09 09 09 63 61 73 |f EG_MAC|.....cas| |000020b0| 65 20 27 53 51 52 54 27 | 3a 09 66 63 6e 43 61 6c |e 'SQRT'|:.fcnCal| |000020c0| 6c 20 3d 20 63 53 51 52 | 54 3b 09 09 62 72 65 61 |l = cSQR|T;..brea| |000020d0| 6b 3b 0d 09 09 09 09 63 | 61 73 65 20 27 41 54 41 |k;.....c|ase 'ATA| |000020e0| 4e 27 3a 09 66 63 6e 43 | 61 6c 6c 20 3d 20 63 41 |N':.fcnC|all = cA| |000020f0| 54 41 4e 3b 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |TAN;..br|eak;....| |00002100| 09 63 61 73 65 20 27 41 | 42 53 28 27 3a 09 66 63 |.case 'A|BS(':.fc| |00002110| 6e 43 61 6c 6c 20 3d 20 | 63 41 42 53 3b 09 09 09 |nCall = |cABS;...| |00002120| 62 72 65 61 6b 3b 0d 09 | 09 09 09 63 61 73 65 20 |break;..|...case | |00002130| 27 53 49 4e 28 27 3a 09 | 66 63 6e 43 61 6c 6c 20 |'SIN(':.|fcnCall | |00002140| 3d 20 63 53 49 4e 3b 09 | 09 09 62 72 65 61 6b 3b |= cSIN;.|..break;| |00002150| 0d 09 09 09 09 63 61 73 | 65 20 27 43 4f 53 28 27 |.....cas|e 'COS('| |00002160| 3a 09 66 63 6e 43 61 6c | 6c 20 3d 20 63 43 4f 53 |:.fcnCal|l = cCOS| |00002170| 3b 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 09 63 |;...brea|k;.....c| |00002180| 61 73 65 20 27 54 41 4e | 28 27 3a 09 66 63 6e 43 |ase 'TAN|(':.fcnC| |00002190| 61 6c 6c 20 3d 20 63 54 | 41 4e 3b 09 09 09 62 72 |all = cT|AN;...br| |000021a0| 65 61 6b 3b 0d 09 09 09 | 09 63 61 73 65 20 27 4c |eak;....|.case 'L| |000021b0| 4f 47 28 27 3a 09 66 63 | 6e 43 61 6c 6c 20 3d 20 |OG(':.fc|nCall = | |000021c0| 63 4c 4f 47 3b 09 09 09 | 62 72 65 61 6b 3b 0d 09 |cLOG;...|break;..| |000021d0| 09 09 09 63 61 73 65 20 | 27 45 58 50 28 27 3a 09 |...case |'EXP(':.| |000021e0| 66 63 6e 43 61 6c 6c 20 | 3d 20 63 45 58 50 3b 09 |fcnCall |= cEXP;.| |000021f0| 09 09 62 72 65 61 6b 3b | 0d 09 09 09 09 63 61 73 |..break;|.....cas| |00002200| 65 20 27 53 51 52 28 27 | 3a 09 66 63 6e 43 61 6c |e 'SQR('|:.fcnCal| |00002210| 6c 20 3d 20 63 53 51 52 | 3b 09 09 09 62 72 65 61 |l = cSQR|;...brea| |00002220| 6b 3b 0d 09 09 09 09 63 | 61 73 65 20 27 53 51 57 |k;.....c|ase 'SQW| |00002230| 56 27 3a 09 66 63 6e 43 | 61 6c 6c 20 3d 20 63 53 |V':.fcnC|all = cS| |00002240| 51 57 56 3b 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |QWV;..br|eak;....| |00002250| 09 63 61 73 65 20 27 50 | 4f 53 28 27 3a 09 66 63 |.case 'P|OS(':.fc| |00002260| 6e 43 61 6c 6c 20 3d 20 | 63 50 4f 53 3b 09 09 09 |nCall = |cPOS;...| |00002270| 62 72 65 61 6b 3b 0d 09 | 09 09 09 63 61 73 65 20 |break;..|...case | |00002280| 27 52 4e 44 28 27 3a 09 | 66 63 6e 43 61 6c 6c 20 |'RND(':.|fcnCall | |00002290| 3d 20 63 52 4e 44 3b 09 | 09 09 62 72 65 61 6b 3b |= cRND;.|..break;| |000022a0| 0d 09 09 09 09 23 65 6c | 69 66 20 45 47 5f 57 49 |.....#el|if EG_WI| |000022b0| 4e 0d 09 09 09 09 63 61 | 73 65 20 27 54 52 51 53 |N.....ca|se 'TRQS| |000022c0| 27 3a 09 66 63 6e 43 61 | 6c 6c 20 3d 20 63 53 51 |':.fcnCa|ll = cSQ| |000022d0| 52 54 3b 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |RT;..bre|ak;.....| |000022e0| 63 61 73 65 20 27 4e 41 | 54 41 27 3a 09 66 63 6e |case 'NA|TA':.fcn| |000022f0| 43 61 6c 6c 20 3d 20 63 | 41 54 41 4e 3b 09 09 62 |Call = c|ATAN;..b| |00002300| 72 65 61 6b 3b 0d 09 09 | 09 09 63 61 73 65 20 27 |reak;...|..case '| |00002310| 28 53 42 41 27 3a 09 66 | 63 6e 43 61 6c 6c 20 3d |(SBA':.f|cnCall =| |00002320| 20 63 41 42 53 3b 09 09 | 09 62 72 65 61 6b 3b 0d | cABS;..|.break;.| |00002330| 09 09 09 09 63 61 73 65 | 20 27 28 4e 49 53 27 3a |....case| '(NIS':| |00002340| 09 66 63 6e 43 61 6c 6c | 20 3d 20 63 53 49 4e 3b |.fcnCall| = cSIN;| |00002350| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca| |00002360| 73 65 20 27 28 53 4f 43 | 27 3a 09 66 63 6e 43 61 |se '(SOC|':.fcnCa| |00002370| 6c 6c 20 3d 20 63 43 4f | 53 3b 09 09 09 62 72 65 |ll = cCO|S;...bre| |00002380| 61 6b 3b 0d 09 09 09 09 | 63 61 73 65 20 27 28 4e |ak;.....|case '(N| |00002390| 41 54 27 3a 09 66 63 6e | 43 61 6c 6c 20 3d 20 63 |AT':.fcn|Call = c| |000023a0| 54 41 4e 3b 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |TAN;...b|reak;...| |000023b0| 09 09 63 61 73 65 20 27 | 28 47 4f 4c 27 3a 09 66 |..case '|(GOL':.f| |000023c0| 63 6e 43 61 6c 6c 20 3d | 20 63 4c 4f 47 3b 09 09 |cnCall =| cLOG;..| |000023d0| 09 62 72 65 61 6b 3b 0d | 09 09 09 09 63 61 73 65 |.break;.|....case| |000023e0| 20 27 28 50 58 45 27 3a | 09 66 63 6e 43 61 6c 6c | '(PXE':|.fcnCall| |000023f0| 20 3d 20 63 45 58 50 3b | 09 09 09 62 72 65 61 6b | = cEXP;|...break| |00002400| 3b 0d 09 09 09 09 63 61 | 73 65 20 27 28 52 51 53 |;.....ca|se '(RQS| |00002410| 27 3a 09 66 63 6e 43 61 | 6c 6c 20 3d 20 63 53 51 |':.fcnCa|ll = cSQ| |00002420| 52 3b 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |R;...bre|ak;.....| |00002430| 63 61 73 65 20 27 56 57 | 51 53 27 3a 09 66 63 6e |case 'VW|QS':.fcn| |00002440| 43 61 6c 6c 20 3d 20 63 | 53 51 57 56 3b 09 09 62 |Call = c|SQWV;..b| |00002450| 72 65 61 6b 3b 0d 09 09 | 09 09 63 61 73 65 20 27 |reak;...|..case '| |00002460| 28 53 4f 50 27 3a 09 66 | 63 6e 43 61 6c 6c 20 3d |(SOP':.f|cnCall =| |00002470| 20 63 50 4f 53 3b 09 09 | 09 62 72 65 61 6b 3b 0d | cPOS;..|.break;.| |00002480| 09 09 09 09 63 61 73 65 | 20 27 28 44 4e 52 27 3a |....case| '(DNR':| |00002490| 09 66 63 6e 43 61 6c 6c | 20 3d 20 63 52 4e 44 3b |.fcnCall| = cRND;| |000024a0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 23 65 |...break|;.....#e| |000024b0| 6e 64 69 66 0d 09 09 09 | 09 64 65 66 61 75 6c 74 |ndif....|.default| |000024c0| 3a 09 09 66 63 6e 43 61 | 6c 6c 09 3d 20 30 3b 09 |:..fcnCa|ll.= 0;.| |000024d0| 09 09 62 72 65 61 6b 3b | 0d 09 09 09 7d 0d 09 09 |..break;|....}...| |000024e0| 09 69 6e 56 4d 2e 4d 61 | 74 68 4f 70 28 20 66 63 |.inVM.Ma|thOp( fc| |000024f0| 6e 43 61 6c 6c 20 29 3b | 20 20 7d 0d 09 09 0d 09 |nCall );| }.....| |00002500| 09 2f 2f 20 43 61 74 63 | 68 20 74 68 65 20 63 61 |.// Catc|h the ca| |00002510| 73 65 20 77 68 65 72 65 | 20 77 65 20 68 61 76 65 |se where| we have| |00002520| 20 61 20 6e 75 6d 62 65 | 72 2f 69 6d 6d 65 64 69 | a numbe|r/immedi| |00002530| 61 74 65 0d 09 09 65 6c | 73 65 20 69 66 20 28 20 |ate...el|se if ( | |00002540| 21 20 68 61 73 4c 65 74 | 74 65 72 73 20 29 20 7b |! hasLet|ters ) {| |00002550| 0d 09 09 09 76 61 6c 20 | 3d 20 55 74 69 6c 53 74 |....val |= UtilSt| |00002560| 72 3a 3a 47 65 74 46 6c | 6f 61 74 56 61 6c 28 20 |r::GetFl|oatVal( | |00002570| 69 6e 53 74 72 2c 20 69 | 6e 4c 65 6e 20 29 3b 20 |inStr, i|nLen ); | |00002580| 20 0d 09 09 09 69 6e 56 | 4d 2e 4c 6f 61 64 69 28 | ....inV|M.Loadi(| |00002590| 20 76 61 6c 20 29 3b 20 | 7d 0d 09 09 09 0d 09 09 | val ); |}.......| |000025a0| 2f 2f 20 41 74 20 74 68 | 69 73 20 70 6f 69 6e 74 |// At th|is point| |000025b0| 20 77 65 20 61 73 73 75 | 6d 65 20 69 74 27 73 20 | we assu|me it's | |000025c0| 61 6e 20 69 64 65 6e 74 | 69 66 69 65 72 2c 20 73 |an ident|ifier, s| |000025d0| 6f 20 77 65 27 6c 6c 20 | 6c 6f 6f 6b 20 75 70 20 |o we'll |look up | |000025e0| 69 74 73 20 76 61 6c 75 | 65 0d 09 09 65 6c 73 65 |its valu|e...else| |000025f0| 20 7b 0d 09 09 09 55 74 | 69 6c 53 74 72 20 74 65 | {....Ut|ilStr te| |00002600| 6d 70 3b 0d 09 09 09 74 | 65 6d 70 2e 41 73 73 69 |mp;....t|emp.Assi| |00002610| 67 6e 28 20 69 6e 53 74 | 72 2c 20 69 6e 4c 65 6e |gn( inSt|r, inLen| |00002620| 20 29 3b 0d 09 09 09 69 | 66 20 28 20 69 6e 44 69 | );....i|f ( inDi| |00002630| 63 74 2e 47 65 74 28 20 | 26 74 65 6d 70 2c 20 26 |ct.Get( |&temp, &| |00002640| 64 62 6c 50 74 72 20 29 | 20 29 0d 09 09 09 09 69 |dblPtr )| ).....i| |00002650| 6e 56 4d 2e 4c 6f 61 64 | 69 28 20 64 62 6c 50 74 |nVM.Load|i( dblPt| |00002660| 72 20 29 3b 0d 09 09 7d | 20 7d 0d 09 09 0d 09 2f |r );...}| }...../| |00002670| 2f 20 49 66 20 74 68 65 | 72 65 20 6d 6f 72 65 20 |/ If the|re more | |00002680| 74 68 61 6e 20 6f 6e 65 | 20 65 78 70 72 65 73 73 |than one| express| |00002690| 69 6f 6e 0d 09 65 6c 73 | 65 20 7b 0d 09 0d 09 09 |ion..els|e {.....| |000026a0| 2f 2f 20 50 75 73 68 20 | 72 65 67 69 73 74 65 72 |// Push |register| |000026b0| 73 20 30 20 74 68 72 75 | 20 28 6e 75 6d 45 78 70 |s 0 thru| (numExp| |000026c0| 73 2d 31 29 2c 20 74 68 | 65 20 72 65 67 69 73 74 |s-1), th|e regist| |000026d0| 65 72 73 20 69 6e 20 75 | 73 65 0d 09 09 69 6e 56 |ers in u|se...inV| |000026e0| 4d 2e 4d 61 73 73 50 75 | 73 68 28 20 6e 75 6d 45 |M.MassPu|sh( numE| |000026f0| 78 70 73 20 2d 20 31 20 | 29 3b 0d 09 09 09 0d 09 |xps - 1 |);......| |00002700| 09 2f 2f 20 46 69 6e 69 | 73 68 20 74 68 65 20 63 |.// Fini|sh the c| |00002710| 75 72 72 65 6e 74 20 65 | 78 70 72 0d 09 09 69 66 |urrent e|xpr...if| |00002720| 20 28 20 73 74 61 72 74 | 50 6f 73 20 3c 20 69 6e | ( start|Pos < in| |00002730| 4c 65 6e 20 29 20 7b 0d | 09 09 09 43 6f 6d 70 69 |Len ) {.|...Compi| |00002740| 6c 65 28 20 69 6e 53 74 | 72 20 2b 20 73 74 61 72 |le( inSt|r + star| |00002750| 74 50 6f 73 2c 20 69 6e | 4c 65 6e 20 2d 20 73 74 |tPos, in|Len - st| |00002760| 61 72 74 50 6f 73 2c 20 | 69 6e 44 69 63 74 2c 20 |artPos, |inDict, | |00002770| 69 6e 56 4d 20 29 3b 0d | 09 09 09 6e 75 6d 45 78 |inVM );.|...numEx| |00002780| 70 73 2b 2b 3b 0d 09 09 | 7d 0d 09 09 0d 09 09 2f |ps++;...|}....../| |00002790| 2f 20 54 68 65 20 72 65 | 74 75 72 6e 20 76 61 6c |/ The re|turn val| |000027a0| 75 65 20 69 73 20 69 6e | 20 72 65 67 20 30 2e 20 |ue is in| reg 0. | |000027b0| 41 6c 73 6f 20 70 6f 70 | 2f 72 65 73 74 6f 72 65 |Also pop|/restore| |000027c0| 20 74 68 65 20 46 50 20 | 72 65 67 69 73 74 65 72 | the FP |register| |000027d0| 73 20 69 6e 20 75 73 65 | 0d 09 09 69 6e 56 4d 2e |s in use|...inVM.| |000027e0| 4d 6f 76 65 28 20 6e 75 | 6d 45 78 70 73 20 2d 20 |Move( nu|mExps - | |000027f0| 31 20 29 3b 0d 09 09 69 | 6e 56 4d 2e 4d 61 73 73 |1 );...i|nVM.Mass| |00002800| 50 6f 70 28 20 6e 75 6d | 45 78 70 73 20 2d 20 32 |Pop( num|Exps - 2| |00002810| 20 29 3b 0d 0d 09 09 2f | 2f 20 57 68 65 6e 20 74 | );..../|/ When t| |00002820| 68 65 72 65 27 6c 6c 20 | 62 65 20 6e 6f 20 6d 6f |here'll |be no mo| |00002830| 72 65 20 65 78 70 72 73 | 2c 20 77 65 27 72 65 20 |re exprs|, we're | |00002840| 66 72 65 65 20 74 6f 20 | 63 6f 6c 6c 61 70 73 65 |free to |collapse| |00002850| 20 61 6c 6c 20 74 68 65 | 20 65 78 70 72 73 20 69 | all the| exprs i| |00002860| 6e 74 6f 20 6f 6e 65 0d | 09 09 77 68 69 6c 65 20 |nto one.|..while | |00002870| 28 20 6e 75 6d 45 78 70 | 73 20 3e 20 31 20 29 20 |( numExp|s > 1 ) | |00002880| 7b 0d 09 09 09 5f 5f 63 | 6f 6c 6c 61 70 73 65 54 |{....__c|ollapseT| |00002890| 77 6f 0d 09 09 7d 0d 0d | 09 7d 0d 09 09 09 09 0d |wo...}..|.}......| |000028a0| 09 2f 2f 20 52 65 67 69 | 73 74 65 72 20 30 20 69 |.// Regi|ster 0 i| |000028b0| 73 20 74 68 65 20 72 65 | 74 75 72 6e 20 76 61 6c |s the re|turn val| |000028c0| 75 65 20 62 79 20 63 6f | 6e 76 65 6e 74 69 6f 6e |ue by co|nvention| |000028d0| 0d 7d 0d 0d 0d 2a 2f 0d | 0d 0d 0d 0d 62 6f 6f 6c |.}...*/.|....bool| |000028e0| 20 45 78 70 72 65 73 73 | 69 6f 6e 3a 3a 49 73 44 | Express|ion::IsD| |000028f0| 65 70 65 6e 64 65 6e 74 | 28 20 63 68 61 72 2a 20 |ependent|( char* | |00002900| 69 6e 53 74 72 20 29 20 | 7b 0d 20 09 6c 6f 6e 67 |inStr ) |{. .long| |00002910| 20 70 6f 73 2c 20 6c 65 | 6e 20 3d 20 30 2c 20 63 | pos, le|n = 0, c| |00002920| 3b 0d 20 09 0d 20 09 77 | 68 69 6c 65 20 28 20 69 |;. .. .w|hile ( i| |00002930| 6e 53 74 72 5b 20 6c 65 | 6e 20 5d 20 29 20 0d 20 |nStr[ le|n ] ) . | |00002940| 09 09 6c 65 6e 2b 2b 3b | 0d 20 09 0d 20 09 70 6f |..len++;|. .. .po| |00002950| 73 20 3d 20 6d 45 71 75 | 61 74 69 6f 6e 2e 63 6f |s = mEqu|ation.co| |00002960| 6e 74 61 69 6e 73 28 20 | 69 6e 53 74 72 2c 20 6c |ntains( |inStr, l| |00002970| 65 6e 2c 20 30 2c 20 66 | 61 6c 73 65 20 29 3b 0d |en, 0, f|alse );.| |00002980| 20 09 77 68 69 6c 65 20 | 28 20 70 6f 73 20 3e 20 | .while |( pos > | |00002990| 30 20 29 20 7b 0d 20 09 | 0d 20 09 09 2f 2f 20 54 |0 ) {. .|. ..// T| |000029a0| 68 69 73 20 65 78 70 72 | 20 69 73 20 64 65 70 6e |his expr| is depn| |000029b0| 64 65 6e 74 20 6f 6e 20 | 69 6e 53 74 72 20 77 68 |dent on |inStr wh| |000029c0| 65 6e 20 77 65 20 66 69 | 6e 64 20 61 20 73 75 62 |en we fi|nd a sub| |000029d0| 73 74 72 69 6e 67 20 6d | 61 74 63 68 20 74 68 61 |string m|atch tha| |000029e0| 74 20 2a 69 73 6e 27 74 | 2a 20 61 20 73 75 62 73 |t *isn't|* a subs| |000029f0| 74 72 69 6e 67 20 6f 66 | 20 61 6e 6f 74 68 65 72 |tring of| another| |00002a00| 20 69 64 65 6e 74 69 66 | 69 65 72 0d 20 09 09 63 | identif|ier. ..c| |00002a10| 20 3d 20 6d 45 71 75 61 | 74 69 6f 6e 2e 67 65 74 | = mEqua|tion.get| |00002a20| 43 68 61 72 28 20 70 6f | 73 20 2d 20 31 20 29 3b |Char( po|s - 1 );| |00002a30| 0d 20 09 09 69 66 20 28 | 20 63 20 3c 20 27 41 27 |. ..if (| c < 'A'| |00002a40| 20 7c 7c 20 63 20 3e 20 | 27 5a 27 20 29 20 7b 0d | || c > |'Z' ) {.| |00002a50| 20 09 09 09 63 20 3d 20 | 6d 45 71 75 61 74 69 6f | ...c = |mEquatio| |00002a60| 6e 2e 67 65 74 43 68 61 | 72 28 20 70 6f 73 20 2b |n.getCha|r( pos +| |00002a70| 20 6c 65 6e 20 29 3b 0d | 20 09 09 09 69 66 20 28 | len );.| ...if (| |00002a80| 20 63 20 3c 20 27 41 27 | 20 7c 7c 20 63 20 3e 20 | c < 'A'| || c > | |00002a90| 27 5a 27 20 29 0d 20 09 | 09 09 09 72 65 74 75 72 |'Z' ). .|...retur| |00002aa0| 6e 20 74 72 75 65 3b 0d | 20 09 09 7d 09 0d 20 09 |n true;.| ..}.. .| |00002ab0| 09 70 6f 73 20 3d 20 6d | 45 71 75 61 74 69 6f 6e |.pos = m|Equation| |00002ac0| 2e 63 6f 6e 74 61 69 6e | 73 28 20 69 6e 53 74 72 |.contain|s( inStr| |00002ad0| 2c 20 6c 65 6e 2c 20 70 | 6f 73 2c 20 66 61 6c 73 |, len, p|os, fals| |00002ae0| 65 20 29 3b 0d 20 09 7d | 0d 20 09 0d 20 09 72 65 |e );. .}|. .. .re| |00002af0| 74 75 72 6e 20 66 61 6c | 73 65 3b 0d 7d 0d 0d 0d |turn fal|se;.}...| |00002b00| 0d 0d 62 6f 6f 6c 20 45 | 78 70 72 65 73 73 69 6f |..bool E|xpressio| |00002b10| 6e 3a 3a 57 65 69 67 68 | 74 28 20 45 78 70 72 65 |n::Weigh|t( Expre| |00002b20| 73 73 69 6f 6e 26 20 69 | 6e 45 78 70 72 2c 20 66 |ssion& i|nExpr, f| |00002b30| 6c 6f 61 74 2a 20 69 6e | 54 72 61 6e 73 69 74 69 |loat* in|Transiti| |00002b40| 6f 6e 4c 69 6e 6b 20 29 | 20 7b 0d 0d 09 69 66 20 |onLink )| {...if | |00002b50| 28 20 6d 49 73 43 6f 6d | 70 69 6c 65 64 20 26 26 |( mIsCom|piled &&| |00002b60| 20 69 6e 45 78 70 72 2e | 6d 49 73 43 6f 6d 70 69 | inExpr.|mIsCompi| |00002b70| 6c 65 64 20 29 20 7b 0d | 09 09 43 68 61 69 6e 28 |led ) {.|..Chain(| |00002b80| 20 69 6e 45 78 70 72 2c | 20 69 6e 54 72 61 6e 73 | inExpr,| inTrans| |00002b90| 69 74 69 6f 6e 4c 69 6e | 6b 20 29 3b 0d 09 09 72 |itionLin|k );...r| |00002ba0| 65 74 75 72 6e 20 74 72 | 75 65 3b 20 7d 0d 09 65 |eturn tr|ue; }..e| |00002bb0| 6c 73 65 0d 09 09 72 65 | 74 75 72 6e 20 66 61 6c |lse...re|turn fal| |00002bc0| 73 65 3b 0d 7d 0d 0d 0d | 0d 0d 76 6f 69 64 20 45 |se;.}...|..void E| |00002bd0| 78 70 72 65 73 73 69 6f | 6e 3a 3a 41 73 73 69 67 |xpressio|n::Assig| |00002be0| 6e 28 20 45 78 70 72 65 | 73 73 69 6f 6e 26 20 69 |n( Expre|ssion& i| |00002bf0| 6e 45 78 70 72 20 29 20 | 7b 0d 0d 09 6d 45 71 75 |nExpr ) |{...mEqu| |00002c00| 61 74 69 6f 6e 2e 41 73 | 73 69 67 6e 28 20 69 6e |ation.As|sign( in| |00002c10| 45 78 70 72 2e 6d 45 71 | 75 61 74 69 6f 6e 20 29 |Expr.mEq|uation )| |00002c20| 3b 0d 09 6d 49 73 43 6f | 6d 70 69 6c 65 64 20 3d |;..mIsCo|mpiled =| |00002c30| 20 69 6e 45 78 70 72 2e | 6d 49 73 43 6f 6d 70 69 | inExpr.|mIsCompi| |00002c40| 6c 65 64 3b 0d 0d 09 69 | 66 20 28 20 69 6e 45 78 |led;...i|f ( inEx| |00002c50| 70 72 2e 6d 49 73 43 6f | 6d 70 69 6c 65 64 20 29 |pr.mIsCo|mpiled )| |00002c60| 0d 09 09 45 78 70 72 56 | 69 72 74 75 61 6c 4d 61 |...ExprV|irtualMa| |00002c70| 63 68 69 6e 65 3a 3a 41 | 73 73 69 67 6e 28 20 69 |chine::A|ssign( i| |00002c80| 6e 45 78 70 72 20 29 3b | 0d 7d 0d 0d 0d 20 0d 20 |nExpr );|.}... . | |00002c90| 0d 62 6f 6f 6c 20 45 78 | 70 72 65 73 73 69 6f 6e |.bool Ex|pression| |00002ca0| 3a 3a 43 6f 6d 70 69 6c | 65 28 20 63 6f 6e 73 74 |::Compil|e( const| |00002cb0| 20 55 74 69 6c 53 74 72 | 26 20 69 6e 53 74 72 2c | UtilStr|& inStr,| |00002cc0| 20 45 78 70 72 65 73 73 | 69 6f 6e 44 69 63 74 26 | Express|ionDict&| |00002cd0| 20 69 6e 44 69 63 74 20 | 29 20 7b 0d 09 69 6e 74 | inDict |) {..int| |00002ce0| 20 69 2c 20 63 2c 20 70 | 61 72 65 6e 73 2c 20 6c | i, c, p|arens, l| |00002cf0| 65 6e 3b 0d 09 0d 09 6d | 45 71 75 61 74 69 6f 6e |en;....m|Equation| |00002d00| 2e 41 73 73 69 67 6e 28 | 20 69 6e 53 74 72 20 29 |.Assign(| inStr )| |00002d10| 3b 0d 09 0d 09 2f 2f 20 | 43 61 73 65 20 69 6e 73 |;....// |Case ins| |00002d20| 65 6e 73 69 74 69 76 65 | 2c 20 72 65 6d 6f 76 65 |ensitive|, remove| |00002d30| 20 61 6c 6c 20 73 70 61 | 63 65 73 0d 09 6d 45 71 | all spa|ces..mEq| |00002d40| 75 61 74 69 6f 6e 2e 43 | 61 70 69 74 61 6c 69 7a |uation.C|apitaliz| |00002d50| 65 28 29 3b 20 0d 09 6d | 45 71 75 61 74 69 6f 6e |e(); ..m|Equation| |00002d60| 2e 52 65 6d 6f 76 65 28 | 20 22 20 22 20 29 3b 0d |.Remove(| " " );.| |00002d70| 09 6d 45 71 75 61 74 69 | 6f 6e 2e 52 65 6d 6f 76 |.mEquati|on.Remov| |00002d80| 65 28 20 22 5c 74 22 20 | 29 3b 0d 09 0d 09 2f 2f |e( "\t" |);....//| |00002d90| 20 43 68 65 63 6b 20 66 | 6f 72 20 62 61 6c 65 6e | Check f|or balen| |00002da0| 63 65 64 20 70 61 72 65 | 6e 73 0d 09 70 61 72 65 |ced pare|ns..pare| |00002db0| 6e 73 20 3d 20 30 3b 0d | 09 6c 65 6e 20 3d 20 6d |ns = 0;.|.len = m| |00002dc0| 45 71 75 61 74 69 6f 6e | 2e 6c 65 6e 67 74 68 28 |Equation|.length(| |00002dd0| 29 3b 0d 09 66 6f 72 20 | 28 20 69 20 3d 20 31 3b |);..for |( i = 1;| |00002de0| 20 69 20 3c 3d 20 6c 65 | 6e 20 26 26 20 70 61 72 | i <= le|n && par| |00002df0| 65 6e 73 20 3e 3d 20 30 | 3b 20 69 2b 2b 20 29 20 |ens >= 0|; i++ ) | |00002e00| 7b 0d 09 09 63 20 3d 20 | 6d 45 71 75 61 74 69 6f |{...c = |mEquatio| |00002e10| 6e 2e 67 65 74 43 68 61 | 72 28 20 69 20 29 3b 0d |n.getCha|r( i );.| |00002e20| 09 09 0d 09 09 73 77 69 | 74 63 68 20 28 20 63 20 |.....swi|tch ( c | |00002e30| 29 20 7b 0d 09 09 09 63 | 61 73 65 20 27 28 27 3a |) {....c|ase '(':| |00002e40| 09 70 61 72 65 6e 73 2b | 2b 3b 09 62 72 65 61 6b |.parens+|+;.break| |00002e50| 3b 0d 09 09 09 63 61 73 | 65 20 27 29 27 3a 09 70 |;....cas|e ')':.p| |00002e60| 61 72 65 6e 73 2d 2d 3b | 09 62 72 65 61 6b 3b 0d |arens--;|.break;.| |00002e70| 09 09 7d 0d 09 7d 0d 0d | 09 69 66 20 28 20 70 61 |..}..}..|.if ( pa| |00002e80| 72 65 6e 73 20 21 3d 20 | 30 20 29 20 7b 0d 09 09 |rens != |0 ) {...| |00002e90| 6d 45 71 75 61 74 69 6f | 6e 2e 57 69 70 65 28 29 |mEquatio|n.Wipe()| |00002ea0| 3b 0d 09 09 6d 49 73 43 | 6f 6d 70 69 6c 65 64 20 |;...mIsC|ompiled | |00002eb0| 3d 20 66 61 6c 73 65 3b | 20 7d 0d 09 65 6c 73 65 |= false;| }..else| |00002ec0| 20 7b 0d 09 0d 09 09 2f | 2f 20 57 69 70 65 20 77 | {...../|/ Wipe w| |00002ed0| 68 61 74 65 76 65 72 20 | 70 72 6f 67 72 61 6d 20 |hatever |program | |00002ee0| 77 61 73 20 69 6e 20 74 | 68 65 20 56 4d 20 62 65 |was in t|he VM be| |00002ef0| 66 6f 72 65 0d 09 09 43 | 6c 65 61 72 28 29 3b 0d |fore...C|lear();.| |00002f00| 09 09 0d 09 09 69 66 20 | 28 20 6c 65 6e 20 3e 20 |.....if |( len > | |00002f10| 30 20 29 20 7b 0d 09 09 | 0d 09 09 09 2f 2f 20 47 |0 ) {...|....// G| |00002f20| 65 6e 65 72 61 74 65 20 | 69 6e 73 74 73 20 66 6f |enerate |insts fo| |00002f30| 72 20 74 68 65 20 56 4d | 20 74 68 61 74 20 65 76 |r the VM| that ev| |00002f40| 61 6c 75 61 74 65 20 6d | 45 71 75 61 74 69 6f 6e |aluate m|Equation| |00002f50| 0d 09 09 09 69 6e 74 20 | 72 65 74 52 65 67 4e 75 |....int |retRegNu| |00002f60| 6d 20 3d 20 43 6f 6d 70 | 69 6c 65 28 20 6d 45 71 |m = Comp|ile( mEq| |00002f70| 75 61 74 69 6f 6e 2e 67 | 65 74 43 53 74 72 28 29 |uation.g|etCStr()| |00002f80| 2c 20 6d 45 71 75 61 74 | 69 6f 6e 2e 6c 65 6e 67 |, mEquat|ion.leng| |00002f90| 74 68 28 29 2c 20 69 6e | 44 69 63 74 2c 20 2a 74 |th(), in|Dict, *t| |00002fa0| 68 69 73 20 29 3b 0d 09 | 09 09 4d 6f 76 65 28 20 |his );..|..Move( | |00002fb0| 72 65 74 52 65 67 4e 75 | 6d 2c 20 30 20 29 3b 20 |retRegNu|m, 0 ); | |00002fc0| 20 7d 0d 09 09 65 6c 73 | 65 20 7b 0d 09 09 0d 09 | }...els|e {.....| |00002fd0| 09 09 2f 2f 20 43 6f 6c | 6f 72 20 72 65 67 69 73 |..// Col|or regis| |00002fe0| 74 65 72 20 30 20 61 73 | 20 75 73 65 64 0d 09 09 |ter 0 as| used...| |00002ff0| 09 41 6c 6c 6f 63 52 65 | 67 28 29 3b 0d 09 09 09 |.AllocRe|g();....| |00003000| 0d 09 09 09 2f 2f 20 49 | 66 20 74 68 65 20 65 78 |....// I|f the ex| |00003010| 70 72 65 73 73 69 6f 6e | 20 69 73 20 62 6c 61 6e |pression| is blan| |00003020| 6b 2c 20 6d 61 6b 65 20 | 69 74 20 72 65 74 75 72 |k, make |it retur| |00003030| 6e 20 30 0d 09 09 09 4c | 6f 61 64 69 28 20 30 2e |n 0....L|oadi( 0.| |00003040| 30 2c 20 30 20 29 3b 0d | 09 09 7d 0d 09 09 0d 09 |0, 0 );.|..}.....| |00003050| 09 0d 09 09 50 72 65 70 | 46 6f 72 45 78 65 63 75 |....Prep|ForExecu| |00003060| 74 69 6f 6e 28 29 3b 0d | 09 09 6d 49 73 43 6f 6d |tion();.|..mIsCom| |00003070| 70 69 6c 65 64 20 3d 20 | 74 72 75 65 3b 0d 09 7d |piled = |true;..}| |00003080| 0d 09 09 0d 09 72 65 74 | 75 72 6e 20 6d 49 73 43 |.....ret|urn mIsC| |00003090| 6f 6d 70 69 6c 65 64 3b | 0d 7d 0d 0d 0d 00 00 00 |ompiled;|.}......| |000030a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000030b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000030c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000030d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000030e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000030f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00003100| 00 00 01 00 00 00 01 54 | 00 00 00 54 00 00 00 46 |.......T|...T...F| |00003110| 73 65 72 44 61 74 61 3b | 09 09 09 2f 2f 20 55 73 |serData;|...// Us| |00003120| 65 72 20 64 61 74 61 20 | 66 6f 72 20 68 6f 6f 6b |er data |for hook| |00003130| 20 66 75 6e 63 74 69 6f | 6e 0d 09 75 73 65 72 44 | functio|n..userD| |00003140| 61 74 61 2e 72 65 70 6c | 79 09 09 09 3d 20 26 6d |ata.repl|y...= &m| |00003150| 53 46 52 65 70 6c 79 3b | 0d 09 75 73 65 72 44 61 |SFReply;|..userDa| |00003160| 74 61 2e 64 65 66 61 75 | 6c 74 53 70 65 63 09 3d |ta.defau|ltSpec.=| |00003170| 20 26 6d 44 65 66 61 75 | 6c 74 4c 6f 63 61 74 69 | &mDefau|ltLocati| |00003180| 6f 6e 3b 0d 09 75 73 65 | 72 44 61 74 61 2e 73 65 |on;..use|rData.se| |00003190| 6c 65 63 74 44 65 66 61 | 75 6c 74 09 3d 20 6d 53 |lectDefa|ult.= mS| |000031a0| 65 6c 65 63 74 44 65 66 | 61 75 6c 74 3b 0d 0d 09 |electDef|ault;...| |000031b0| 55 44 65 73 6b 74 6f 70 | 3a 3a 44 65 61 63 74 69 |UDesktop|::Deacti| |000031c0| 76 61 74 65 28 29 3b 0d | 0d 09 3a 3a 43 75 73 74 |vate();.|..::Cust| |000031d0| 6f 6d 47 65 74 46 69 6c | 65 28 0d 09 09 09 6e 69 |omGetFil|e(....ni| |000031e0| 6c 2c 09 09 09 09 09 09 | 2f 2f 20 46 69 6c 65 20 |l,......|// File | |000031f0| 46 69 6c 74 65 72 0d 09 | 09 09 69 6e 46 69 6c 65 |Filter..|..inFile| |00003200| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....| |00003210| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00003220| 00 00 00 00 00 00 00 03 | 00 04 00 2e 00 67 02 5c |........|.....g.\| |00003230| 02 c2 00 2e 00 67 02 5c | 02 c2 b3 e5 99 f7 00 00 |.....g.\|........| |00003240| 2f c7 00 00 2f c7 00 00 | 2d 0b 01 00 00 00 00 04 |/.../...|-.......| |00003250| 00 01 00 01 00 00 01 00 | 00 00 01 54 00 00 00 54 |........|...T...T| |00003260| 00 00 00 46 04 fa b1 10 | 18 fa 00 00 00 1c 00 46 |...F....|.......F| |00003270| 00 01 4d 50 53 52 00 00 | 00 12 4d 57 42 42 00 00 |..MPSR..|..MWBB..| |00003280| 00 1e 03 ed ff ff 00 00 | 00 00 00 00 00 00 03 f0 |........|........| |00003290| ff ff 00 00 00 4c 00 00 | 00 00 00 00 00 00 00 00 |.....L..|........| |000032a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000032b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000032c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000032d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000032e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000032f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| +--------+-------------------------+-------------------------+--------+--------+