summaryrefslogtreecommitdiffstats
path: root/vmstk.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-25 08:14:12 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-25 08:14:12 +0000
commitb7f58acb515b102547976cc02bc3fcfcef18dd0c (patch)
tree09b39f5584577e921cc9b7510b324e5365a353d8 /vmstk.c
parent965c09147c8f87e4ed6ece46b9d54e612e35cf11 (diff)
downloadrsyslog-b7f58acb515b102547976cc02bc3fcfcef18dd0c.tar.gz
rsyslog-b7f58acb515b102547976cc02bc3fcfcef18dd0c.tar.xz
rsyslog-b7f58acb515b102547976cc02bc3fcfcef18dd0c.zip
implemented data type conversion
Diffstat (limited to 'vmstk.c')
-rw-r--r--vmstk.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/vmstk.c b/vmstk.c
index 6944b6f9..0e035543 100644
--- a/vmstk.c
+++ b/vmstk.c
@@ -109,6 +109,57 @@ finalize_it:
}
+/* pop a boolean value from the stack
+ * The user is responsible for destructing the ppVar returned.
+ */
+static rsRetVal
+popBool(vmstk_t *pThis, var_t **ppVar)
+{
+ DEFiRet;
+
+ /* assertions are done in pop(), we do not duplicate here */
+ CHKiRet(pop(pThis, ppVar));
+ CHKiRet(var.ConvToBool(*ppVar));
+
+finalize_it:
+ RETiRet;
+}
+
+
+/* pop a number value from the stack
+ * The user is responsible for destructing the ppVar returned.
+ */
+static rsRetVal
+popNumber(vmstk_t *pThis, var_t **ppVar)
+{
+ DEFiRet;
+
+ /* assertions are done in pop(), we do not duplicate here */
+ CHKiRet(pop(pThis, ppVar));
+ CHKiRet(var.ConvToNumber(*ppVar));
+
+finalize_it:
+ RETiRet;
+}
+
+
+/* pop a number value from the stack
+ * The user is responsible for destructing the ppVar returned.
+ */
+static rsRetVal
+popString(vmstk_t *pThis, var_t **ppVar)
+{
+ DEFiRet;
+
+ /* assertions are done in pop(), we do not duplicate here */
+ CHKiRet(pop(pThis, ppVar));
+ CHKiRet(var.ConvToString(*ppVar));
+
+finalize_it:
+ RETiRet;
+}
+
+
/* queryInterface function
* rgerhards, 2008-02-21
*/
@@ -131,6 +182,10 @@ CODESTARTobjQueryInterface(vmstk)
pIf->DebugPrint = vmstkDebugPrint;
pIf->Push = push;
pIf->Pop = pop;
+ pIf->PopBool = popBool;
+ pIf->PopNumber = popNumber;
+ pIf->PopString = popString;
+
finalize_it:
ENDobjQueryInterface(vmstk)