Jacek Caban : vbscript: Added interp_equal implementation.

Alexandre Julliard julliard at winehq.org
Fri Sep 9 10:56:47 CDT 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Sep  9 14:48:35 2011 +0200

vbscript: Added interp_equal implementation.

---

 dlls/vbscript/interp.c       |   32 ++++++++++++++++++++++++++++++--
 dlls/vbscript/tests/lang.vbs |    5 +++++
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index 29fed74..42bef36 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -253,10 +253,38 @@ static HRESULT interp_not(exec_ctx_t *ctx)
     return stack_push(ctx, &v);
 }
 
+static HRESULT cmp_oper(exec_ctx_t *ctx)
+{
+    variant_val_t l, r;
+    HRESULT hres;
+
+    hres = stack_pop_val(ctx, &r);
+    if(FAILED(hres))
+        return hres;
+
+    hres = stack_pop_val(ctx, &l);
+    if(SUCCEEDED(hres))
+        hres = VarCmp(l.v, r.v, ctx->script->lcid, 0);
+
+    release_val(&r);
+    release_val(&l);
+    return hres;
+}
+
 static HRESULT interp_equal(exec_ctx_t *ctx)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    VARIANT v;
+    HRESULT hres;
+
+    TRACE("\n");
+
+    hres = cmp_oper(ctx);
+    if(FAILED(hres))
+        return hres;
+
+    V_VT(&v) = VT_BOOL;
+    V_BOOL(&v) = hres == VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
+    return stack_push(ctx, &v);
 }
 
 static const instr_func_t op_funcs[] = {
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 8f13c9c..6f8b815 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -25,4 +25,9 @@ call ok((true), "true is not true?")
 ok not false, "not false but not true?"
 ok not not true, "not not true but not true?"
 
+Call ok(true = true, "true = true is false")
+Call ok(false = false, "false = false is false")
+Call ok(not (true = false), "true = false is true")
+Call ok("x" = "x", """x"" = ""x"" is false")
+
 reportSuccess()




More information about the wine-cvs mailing list