vbscript: Added interp_xor implementation.
authorJacek Caban <jacek@codeweavers.com>
Wed, 14 Sep 2011 11:00:02 +0000 (13:00 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 14 Sep 2011 15:00:19 +0000 (17:00 +0200)
dlls/vbscript/interp.c
dlls/vbscript/tests/lang.vbs

index e166b21ca844a9616063c597ec6f9b44f79ae511..8a875ee4021bf49e5bc5f3674b83f4f358744911 100644 (file)
@@ -614,8 +614,26 @@ static HRESULT interp_or(exec_ctx_t *ctx)
 
 static HRESULT interp_xor(exec_ctx_t *ctx)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    variant_val_t r, l;
+    VARIANT v;
+    HRESULT hres;
+
+    TRACE("\n");
+
+    hres = stack_pop_val(ctx, &r);
+    if(FAILED(hres))
+        return hres;
+
+    hres = stack_pop_val(ctx, &l);
+    if(SUCCEEDED(hres)) {
+        hres = VarXor(l.v, r.v, &v);
+        release_val(&l);
+    }
+    release_val(&r);
+    if(FAILED(hres))
+        return hres;
+
+    return stack_push(ctx, &v);
 }
 
 static HRESULT interp_eqv(exec_ctx_t *ctx)
index c6a336d36e5d8b7931e7d26a8c3fba707a732674..329df36cf1ff6452a039e7981e80a17f3993b5eb 100644 (file)
@@ -97,6 +97,11 @@ call ok(false and false or true, "false and false or true is false?")
 call ok(true or false and false, "true or false and false is false?")
 call ok(null or true, "null or true is false")
 
+call ok(true xor false, "true xor false is false?")
+call ok(not (false xor false), "false xor false is true?")
+call ok(not (true or false xor true), "true or false xor true is true?")
+call ok(not (true xor false or true), "true xor false or true is true?")
+
 x = 3
 Call ok(2+2 = 4, "2+2 = " & (2+2))
 Call ok(false + 6 + true = 5, "false + 6 + true <> 5")