From 7f9464ce2759eb96ccc0bb7b782ce029689f692d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 9 Sep 2011 14:47:45 +0200 Subject: [PATCH] vbscript: Added compiler support for |not| expression. --- dlls/vbscript/compile.c | 13 +++++++++++++ dlls/vbscript/interp.c | 6 ++++++ dlls/vbscript/vbscript.h | 1 + 3 files changed, 20 insertions(+) diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index ea5517711ab..c64c30c1315 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -165,11 +165,24 @@ static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t return hres; } +static HRESULT compile_unary_expression(compile_ctx_t *ctx, unary_expression_t *expr, vbsop_t op) +{ + HRESULT hres; + + hres = compile_expression(ctx, expr->subexpr); + if(FAILED(hres)) + return hres; + + return push_instr(ctx, op) == -1 ? E_OUTOFMEMORY : S_OK; +} + static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr) { switch(expr->type) { case EXPR_BOOL: return push_instr_int(ctx, OP_bool, ((bool_expression_t*)expr)->value); + case EXPR_NOT: + return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_not); case EXPR_STRING: return push_instr_str(ctx, OP_string, ((string_expression_t*)expr)->value); default: diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index a33ff90e9dc..f582e8069e1 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -198,6 +198,12 @@ static HRESULT interp_string(exec_ctx_t *ctx) return stack_push(ctx, &v); } +static HRESULT interp_not(exec_ctx_t *ctx) +{ + FIXME("\n"); + return E_NOTIMPL; +} + static const instr_func_t op_funcs[] = { #define X(x,n,a,b) interp_ ## x, OP_LIST diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 54d7da5c2c7..3f55b4024ef 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -77,6 +77,7 @@ typedef enum { #define OP_LIST \ X(bool, 1, ARG_INT, 0) \ X(icallv, 1, ARG_BSTR, ARG_UINT) \ + X(not, 1, 0, 0) \ X(ret, 0, 0, 0) \ X(string, 1, ARG_STR, 0)