Jacek Caban : vbscript: Added function invocation supprot to do_icall.

Alexandre Julliard julliard at winehq.org
Wed Sep 14 12:25:40 CDT 2011


Module: wine
Branch: master
Commit: 48d04b220b0e150f796dc47c3812cc72863574b7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=48d04b220b0e150f796dc47c3812cc72863574b7

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep 14 12:56:01 2011 +0200

vbscript: Added function invocation supprot to do_icall.

---

 dlls/vbscript/interp.c       |   18 +++++++++++++++---
 dlls/vbscript/tests/lang.vbs |    4 ++++
 dlls/vbscript/vbscript.c     |    2 +-
 dlls/vbscript/vbscript.h     |    7 ++++++-
 4 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index adec28f..b697988 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -266,8 +266,10 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
             return hres;
         break;
     case REF_FUNC:
-        FIXME("functions not implemented\n");
-        return E_NOTIMPL;
+        hres = exec_script(ctx->script, ref.u.f, &dp, res);
+        if(FAILED(hres))
+            return hres;
+        break;
     case REF_NONE:
         FIXME("%s not found\n", debugstr_w(identifier));
         return DISP_E_UNKNOWNNAME;
@@ -812,12 +814,22 @@ OP_LIST
 #undef X
 };
 
-HRESULT exec_script(script_ctx_t *ctx, function_t *func)
+HRESULT exec_script(script_ctx_t *ctx, function_t *func, DISPPARAMS *dp, VARIANT *res)
 {
     exec_ctx_t exec;
     vbsop_t op;
     HRESULT hres = S_OK;
 
+    if(res) {
+        FIXME("returning value is not implemented\n");
+        return E_NOTIMPL;
+    }
+
+    if(dp && arg_cnt(dp)) {
+        FIXME("arguments not implemented\n");
+        return E_NOTIMPL;
+    }
+
     exec.stack_size = 16;
     exec.top = 0;
     exec.stack = heap_alloc(exec.stack_size * sizeof(VARIANT));
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 60ca988..0c4c10f 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -175,4 +175,8 @@ Sub testsub
 End Sub
 end if
 
+x = false
+Call testsub
+Call ok(x, "x is false, testsub not called?")
+
 reportSuccess()
diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c
index f6891c7..cb28a9a 100644
--- a/dlls/vbscript/vbscript.c
+++ b/dlls/vbscript/vbscript.c
@@ -77,7 +77,7 @@ static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code)
     code->global_executed = TRUE;
 
     IActiveScriptSite_OnEnterScript(ctx->site);
-    hres = exec_script(ctx, &code->global_code);
+    hres = exec_script(ctx, &code->global_code, NULL, NULL);
     IActiveScriptSite_OnLeaveScript(ctx->site);
 
     return hres;
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index 32b19ab..d541e9d 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -65,6 +65,11 @@ HRESULT disp_get_id(IDispatch*,BSTR,DISPID*);
 HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,DISPPARAMS*,VARIANT*);
 HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,VARIANT*);
 
+static inline unsigned arg_cnt(const DISPPARAMS *dp)
+{
+    return dp->cArgs - dp->cNamedArgs;
+}
+
 typedef struct _dynamic_var_t {
     struct _dynamic_var_t *next;
     VARIANT v;
@@ -179,7 +184,7 @@ struct _vbscode_t {
 
 void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN;
 HRESULT compile_script(script_ctx_t*,const WCHAR*,vbscode_t**) DECLSPEC_HIDDEN;
-HRESULT exec_script(script_ctx_t*,function_t*) DECLSPEC_HIDDEN;
+HRESULT exec_script(script_ctx_t*,function_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
 
 HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);
 




More information about the wine-cvs mailing list