From 838ab14a17a60116d6fd51ebcf12416d736af546 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 25 Feb 2008 09:20:09 +0000 Subject: implemented majority of comparison operations --- vmstk.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'vmstk.c') diff --git a/vmstk.c b/vmstk.c index 0e035543..6f8d36f6 100644 --- a/vmstk.c +++ b/vmstk.c @@ -160,6 +160,31 @@ finalize_it: } +/* pop two variables for a common operation, e.g. a compare. When this + * functions returns, both variables have the same type, but the type + * is not set to anything specific. + * The user is responsible for destructing the ppVar's returned. + * A quick note on the name: it means pop 2 variable for a common + * opertion - just in case you wonder (I don't really like the name, + * but I didn't come up with a better one...). + * rgerhards, 2008-02-25 + */ +static rsRetVal +pop2CommOp(vmstk_t *pThis, var_t **ppVar1, var_t **ppVar2) +{ + DEFiRet; + + /* assertions are done in pop(), we do not duplicate here */ + /* operand two must be popped first, because it is at the top of stack */ + CHKiRet(pop(pThis, ppVar2)); + CHKiRet(pop(pThis, ppVar1)); + CHKiRet(var.ConvForOperation(*ppVar1, *ppVar2)); + +finalize_it: + RETiRet; +} + + /* queryInterface function * rgerhards, 2008-02-21 */ @@ -185,6 +210,7 @@ CODESTARTobjQueryInterface(vmstk) pIf->PopBool = popBool; pIf->PopNumber = popNumber; pIf->PopString = popString; + pIf->Pop2CommOp = pop2CommOp; finalize_it: ENDobjQueryInterface(vmstk) -- cgit