BBS: Inland Empire Archive
Date: 03-13-93 (22:25) Number: 336
From: QUINN TYLER JACKSON Refer#: NONE
To: ALL Recvd: NO
Subj: formula solver 3/7 Conf: (2) Quik_Bas
'>>> Start of page 3.
DO
INPUT Test$
PRINT funEvaluate(Test$)
LOOP
FUNCTION fqjFetchVar (VarName$)
FOR i% = 1 TO VariPtr
IF RTRIM$(VarMem(i%).Nom) = VarName$ THEN
fqjFetchVar = VarMem(i%).Valu
FLAG% = TRUE
EXIT FOR
END IF
NEXT i%
END FUNCTION
FUNCTION fqjInOpList (OpTyp$, Op$)
SELECT CASE LEN(Op$)
CASE 1
FOR i% = 1 TO LEN(OpTyp$)
IF MID$(OpTyp$, i%, 1) = Op$ THEN
fqjInOpList = -1
EXIT FUNCTION
END IF
NEXT i%
CASE 2
FOR i% = 1 TO LEN(OpTyp$)
IF MID$(OpTyp$, i%, 2) = Op$ THEN
fqjInOpList = -1
EXIT FUNCTION
END IF
NEXT i%
END SELECT
END FUNCTION
FUNCTION funEvaluate (Exp$)
OPERATOR$ = ADDSUB + MULTDIV + POWER + LOGICAL
expression$ = LCASE$(Exp$)
Ptr = 1
AssignmentPtr% = INSTR(expression$, ASSIGNMENT)
IF AssignmentPtr% = 0 THEN
CALL sqjGetOp
CALL sqjLevel1(r)
funEvaluate = r
ELSE
VariableName$ = LTRIM$(RTRIM$(LEFT$(expression$, AssignmentPtr% -_
1)))
Valu = funEvaluate(MID$(expression$, AssignmentPtr% + 2))
CALL sqjAssignVar(VariableName$, Valu)
funEvaluate = Valu
END IF
END FUNCTION
'>>> Continued on page 4.
--- Maximus/2 2.01wb
* Origin: The Nibble's Roost, Richmond BC Canada 604-244-8009 (1:153/918)