Piotr Caban : jscript: Added Boolean constructor implementation.

Alexandre Julliard julliard at winehq.org
Mon Jul 6 09:33:59 CDT 2009


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

Author: Piotr Caban <piotr.caban at gmail.com>
Date:   Mon Jul  6 10:38:36 2009 +0200

jscript: Added Boolean constructor implementation.

---

 dlls/jscript/bool.c |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/bool.c b/dlls/jscript/bool.c
index 7e3bf7a..be36787 100644
--- a/dlls/jscript/bool.c
+++ b/dlls/jscript/bool.c
@@ -106,8 +106,41 @@ static const builtin_info_t Bool_info = {
 static HRESULT BoolConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
         VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    HRESULT hres;
+    VARIANT_BOOL value = VARIANT_FALSE;
+
+    if(arg_cnt(dp)) {
+        hres = to_boolean(get_arg(dp,0), &value);
+        if(FAILED(hres))
+            return hres;
+    }
+
+    switch(flags) {
+    case DISPATCH_CONSTRUCT: {
+        DispatchEx *bool;
+
+        hres = create_bool(dispex->ctx, value, &bool);
+        if(FAILED(hres))
+            return hres;
+
+        V_VT(retv) = VT_DISPATCH;
+        V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(bool);
+        return S_OK;
+    }
+
+    case INVOKE_FUNC:
+        if(retv) {
+            V_VT(retv) = VT_BOOL;
+            V_BOOL(retv) = value;
+        }
+        return S_OK;
+
+    default:
+        FIXME("unimplemented flags %x\n", flags);
+        return E_NOTIMPL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT alloc_bool(script_ctx_t *ctx, BOOL use_constr, BoolInstance **ret)




More information about the wine-cvs mailing list