summaryrefslogtreecommitdiffstats
path: root/vm.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-25 14:44:16 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-25 14:44:16 +0000
commitd03bf9c18cd0a150490eb375bd22d99d52b4832f (patch)
treee625d65af141ea96dee618ae6aa5e6b764918761 /vm.c
parent5ebc0db1a6d4c75ce9c26449ef2a2e3d7b340e10 (diff)
downloadrsyslog-d03bf9c18cd0a150490eb375bd22d99d52b4832f.tar.gz
rsyslog-d03bf9c18cd0a150490eb375bd22d99d52b4832f.tar.xz
rsyslog-d03bf9c18cd0a150490eb375bd22d99d52b4832f.zip
- added sysvar class
- added PUSHSYSVAR operation to vm
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index 389a3cd1..c85df45f 100644
--- a/vm.c
+++ b/vm.c
@@ -29,12 +29,14 @@
#include "rsyslog.h"
#include "obj.h"
#include "vm.h"
+#include "sysvar.h"
#include "stringbuf.h"
/* static data */
DEFobjStaticHelpers
DEFobjCurrIf(vmstk)
DEFobjCurrIf(var)
+DEFobjCurrIf(sysvar)
/* ------------------------------ instruction set implementation ------------------------------ *
@@ -242,18 +244,24 @@ CODESTARTop(PUSHMSGVAR)
CHKiRet(var.SetString(pVal, pstrVal));
} else {
/* we have a message, so pull value from there */
-var.DebugPrint(pOp->operand.pVar);
CHKiRet(msgGetMsgVar(pThis->pMsg, pOp->operand.pVar->val.pStr, &pVal));
}
/* if we reach this point, we have a valid pVal and can push it */
vmstk.Push(pThis->pStk, pVal);
-RUNLOG_STR("msgvar:");
-var.DebugPrint(pVal);
finalize_it:
ENDop(PUSHMSGVAR)
+BEGINop(PUSHSYSVAR) /* remember to set the instruction also in the ENDop macro! */
+ var_t *pVal; /* the value to push */
+CODESTARTop(PUSHSYSVAR)
+ CHKiRet(sysvar.GetVar(pOp->operand.pVar->val.pStr, &pVal));
+ vmstk.Push(pThis->pStk, pVal);
+finalize_it:
+ENDop(PUSHSYSVAR)
+
+
/* ------------------------------ end instruction set implementation ------------------------------ */
@@ -323,6 +331,7 @@ execProg(vm_t *pThis, vmprg_t *pProg)
doOP(NOT);
doOP(PUSHCONSTANT);
doOP(PUSHMSGVAR);
+ doOP(PUSHSYSVAR);
doOP(PLUS);
doOP(MINUS);
doOP(TIMES);
@@ -433,6 +442,7 @@ BEGINObjClassInit(vm, 1) /* class, version */
/* request objects we use */
CHKiRet(objUse(vmstk));
CHKiRet(objUse(var));
+ CHKiRet(objUse(sysvar));
/* set our own handlers */
OBJSetMethodHandler(objMethod_DEBUGPRINT, vmDebugPrint);