From a24cee11b718603fbc681e4a7a23f50c8d785ad7 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 25 Feb 2008 10:28:23 +0000 Subject: - added some temporary testing aids to conf.c, so that we can debug expression support as it is implemented - fixed a couple of bugs in expression system - added more operations to virtual machine - now works well with constants --- conf.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 56ba3837..a537d18a 100644 --- a/conf.c +++ b/conf.c @@ -57,6 +57,9 @@ /* static data */ DEFobjCurrIf(expr) DEFobjCurrIf(ctok) +#include "vm.h" +DEFobjCurrIf(vm) // TODO: remove, testing aid! rgerhards, 2008-02-25 + uchar *pModDir = NULL; /* read-only after startup */ /* The following global variables are used for building @@ -791,7 +794,22 @@ dbgprintf("calling expression parser, pp %p ('%s')\n", *pline, *pline); dbgprintf("expression parser successfully ended, pp %p ('%s')\n", *pline, *pline); +/* debug aid, try to exec - just now for testing the vm... -- rgerhards, 2008-02-25 */ +vm_t *pVM; +var_t *pResult; +CHKiRet(vm.Construct(&pVM)); +CHKiRet(vm.ConstructFinalize(pVM)); + +CHKiRet(vm.ExecProg(pVM, f->f_filterData.f_expr->pVmprg)); +CHKiRet(vm.PopBoolFromStack(pVM, &pResult)); +dbgprintf("result of expression run: %lld\n", pResult->val.num); + +CHKiRet(vm.Destruct(&pVM)); +/* ...end testing aid... */ + + finalize_it: +RUNLOG_VAR("%d", iRet); if(iRet == RS_RET_SYNTAX_ERROR) { logerror("syntax error in expression"); } @@ -1172,6 +1190,7 @@ rsRetVal confClassInit(void) /* request objects we use */ CHKiRet(objUse(expr)); CHKiRet(objUse(ctok)); + CHKiRet(objUse(vm)); // TODO: remove, testing aid! rgerhards, 2008-02-25 finalize_it: RETiRet; -- cgit v1.2.3