******************************************************************************* * * STKMTH * * Module %M% Version %I% Date %H% * * (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved * This is unpublished proprietary source code of Ardent Software Inc. * The copyright notice above does not evidence any actual or intended * publication of such source code. * ******************************************************************************* * * Maintenence log - insert most recent change descriptions at top * * Date.... GTAR# WHO Description......................................... * 10/14/98 23801 SAP Change copyrights. * 07/25/88 - - Maintenence log purged at 5.2.1, see release 5.1.10. * ******************************************************************************* subroutine STKMATH( answer, stack) * This routine perform arithmetic and logical operations on a * postfix stack. Used by some of the Pro*verb user exits. IF stack = "" THEN RETURN IF NUM(stack<1>) THEN IF answer THEN answer:= @FM:stack<1> ELSE answer = stack<1> DEL stack<1> CALL $STKMATH(answer, stack) END ELSE op = stack<1> DEL stack<1> c = DCOUNT(answer,@FM)-1 BEGIN CASE CASE op = "+" t = answer+answer CASE op = "-" t = answer-answer CASE op = "*" t = answer*answer CASE op = "/" t = answer/answer CASE op = "&" IF answer and answer THEN t = 1 ELSE t = 0 CASE op = "!" IF answer or answer THEN t = 1 ELSE t = 0 CASE op = "#" * THE ONLY UNARY OPERATOR IF answer THEN t = 0 ELSE t = 1 IF c THEN answer:= @FM CASE op = "<" IF answer < answer THEN t = 1 ELSE t = 0 CASE op = "<=" IF answer <= answer THEN t = 1 ELSE t = 0 CASE op = ">" IF answer > answer THEN t = 1 ELSE t = 0 CASE op = ">=" IF answer >= answer THEN t = 1 ELSE t = 0 CASE op = "#<" IF answer >= answer THEN t = 1 ELSE t = 0 CASE op = "#>" IF answer <= answer THEN t = 1 ELSE t = 0 CASE op = "?" * terminator symbol stack = "" RETURN CASE 1 PRINT "ill formed string" stack = "" answer = "" RETURN END CASE DEL answer DEL answer IF answer THEN answer:= @FM:t ELSE answer = t IF stack THEN CALL $STKMATH( answer, stack) RETURN END END