diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-25 10:28:23 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-25 10:28:23 +0000 |
commit | a24cee11b718603fbc681e4a7a23f50c8d785ad7 (patch) | |
tree | a192855ad3f853e1b75fcdeab6c9d56e9e7299da /conf.c | |
parent | 838ab14a17a60116d6fd51ebcf12416d736af546 (diff) | |
download | rsyslog-a24cee11b718603fbc681e4a7a23f50c8d785ad7.tar.gz rsyslog-a24cee11b718603fbc681e4a7a23f50c8d785ad7.tar.xz rsyslog-a24cee11b718603fbc681e4a7a23f50c8d785ad7.zip |
- 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
Diffstat (limited to 'conf.c')
-rw-r--r-- | conf.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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; |