Jacek Caban : vbscript: Added object member call implementation.
Alexandre Julliard
julliard at winehq.org
Thu Sep 15 12:34:55 CDT 2011
Module: wine
Branch: master
Commit: a6ee830fd249ee96176e62c5261ed6cc70107b55
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a6ee830fd249ee96176e62c5261ed6cc70107b55
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Sep 15 14:19:41 2011 +0200
vbscript: Added object member call implementation.
---
dlls/vbscript/compile.c | 7 ++++-
dlls/vbscript/interp.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/vbscript/vbscript.h | 2 +
3 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c
index 36bf04c..698ea8d 100644
--- a/dlls/vbscript/compile.c
+++ b/dlls/vbscript/compile.c
@@ -318,8 +318,11 @@ static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t
return hres;
if(expr->obj_expr) {
- FIXME("obj_expr not implemented\n");
- hres = E_NOTIMPL;
+ hres = compile_expression(ctx, expr->obj_expr);
+ if(FAILED(hres))
+ return hres;
+
+ hres = push_instr_bstr_uint(ctx, ret_val ? OP_mcall : OP_mcallv, expr->identifier, arg_cnt);
}else {
hres = push_instr_bstr_uint(ctx, ret_val ? OP_icall : OP_icallv, expr->identifier, arg_cnt);
}
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index f8e0011..beacfe9 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -327,6 +327,57 @@ static HRESULT interp_icallv(exec_ctx_t *ctx)
return do_icall(ctx, NULL);
}
+static HRESULT do_mcall(exec_ctx_t *ctx, VARIANT *res)
+{
+ const BSTR identifier = ctx->instr->arg1.bstr;
+ const unsigned arg_cnt = ctx->instr->arg2.uint;
+ IDispatch *obj;
+ DISPPARAMS dp;
+ DISPID id;
+ HRESULT hres;
+
+ hres = stack_pop_disp(ctx, &obj);
+ if(FAILED(hres))
+ return hres;
+
+ if(!obj) {
+ FIXME("NULL obj\n");
+ return E_FAIL;
+ }
+
+ vbstack_to_dp(ctx, arg_cnt, &dp);
+
+ hres = disp_get_id(obj, identifier, &id);
+ if(SUCCEEDED(hres))
+ hres = disp_call(ctx->script, obj, id, &dp, res);
+ IDispatch_Release(obj);
+ if(FAILED(hres))
+ return hres;
+
+ stack_popn(ctx, arg_cnt);
+ return S_OK;
+}
+
+static HRESULT interp_mcall(exec_ctx_t *ctx)
+{
+ VARIANT res;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ hres = do_mcall(ctx, &res);
+ if(FAILED(hres))
+ return hres;
+
+ return stack_push(ctx, &res);
+}
+
+static HRESULT interp_mcallv(exec_ctx_t *ctx)
+{
+ FIXME("\n");
+ return E_NOTIMPL;
+}
+
static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, VARIANT *val, BOOL own_val)
{
ref_t ref;
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index 4c2d977..8defcd6 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -146,6 +146,8 @@ typedef enum {
X(jmp, 0, ARG_ADDR, 0) \
X(jmp_false, 0, ARG_ADDR, 0) \
X(long, 1, ARG_INT, 0) \
+ X(mcall, 1, ARG_BSTR, ARG_UINT) \
+ X(mcallv, 1, ARG_BSTR, ARG_UINT) \
X(mod, 1, 0, 0) \
X(mul, 1, 0, 0) \
X(neg, 1, 0, 0) \
More information about the wine-cvs
mailing list