diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-25 08:14:12 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-25 08:14:12 +0000 |
commit | b7f58acb515b102547976cc02bc3fcfcef18dd0c (patch) | |
tree | 09b39f5584577e921cc9b7510b324e5365a353d8 /vmstk.c | |
parent | 965c09147c8f87e4ed6ece46b9d54e612e35cf11 (diff) | |
download | rsyslog-b7f58acb515b102547976cc02bc3fcfcef18dd0c.tar.gz rsyslog-b7f58acb515b102547976cc02bc3fcfcef18dd0c.tar.bz2 rsyslog-b7f58acb515b102547976cc02bc3fcfcef18dd0c.zip |
implemented data type conversion
Diffstat (limited to 'vmstk.c')
-rw-r--r-- | vmstk.c | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -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) |