summaryrefslogtreecommitdiffstats
path: root/conf.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-25 10:28:23 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-25 10:28:23 +0000
commita24cee11b718603fbc681e4a7a23f50c8d785ad7 (patch)
treea192855ad3f853e1b75fcdeab6c9d56e9e7299da /conf.c
parent838ab14a17a60116d6fd51ebcf12416d736af546 (diff)
downloadrsyslog-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.c19
1 files changed, 19 insertions, 0 deletions
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;