home *** CD-ROM | disk | FTP | other *** search
- program TestP3;
-
- { This is a simple test program I used for POSTFIX.INC (TURBO VERSION 3)}
-
- {$I DFSTR.INC}
- {$I POSTFIX.INC}
-
- var
-
- MyReal : real;
- MyExpr : AnyStr;
- MyErr,
- MyBool : boolean;
- MyAddr : Str20;
-
- begin
-
- writeln('This program should give a result of 24');
-
- InitializeEE;
-
- {init test variables}
- MyReal := 0;
- MyErr := false;
-
- {add 2 and 2 and put the result (4) in FRED}
- MyAddr := 'FRED';
- MyExpr := '2 2 +';
- CalcAndStore(MyExpr,MyAddr,MyErr);
-
- {multiply 3 by 7 and put the result (21) in WILMA}
- MyAddr := 'WILMA';
- MyExpr := '3 7 *';
- CalcAndStore(MyExpr,MyAddr,MyErr);
-
- {add FRED (4) and WILMA (21), subtract 1 (24), and store in DINO}
- MyAddr := 'DINO';
- MyExpr := 'FRED WILMA + 1 -';
- CalcAndStore(MyExpr,MyAddr,MyErr);
-
- {look in DINO}
- ReadVariable(MyAddr,MyReal,MyBool);
-
- if MyBool then
- MyReal := 0;
-
- {DINO has 24 in it here -- check for yourself using TD or writeln}
-
- writeln;
- writeln('Answer = ',MyReal);
- writeln;
-
- {deallocate linked list's memory}
- DestroyList;
-
- end. {TestI}