Jacek Caban : vbscript: Added interp_exp implementation.

Alexandre Julliard julliard at winehq.org
Tue Sep 13 12:18:10 CDT 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Sep 13 11:41:34 2011 +0200

vbscript: Added interp_exp implementation.

---

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

diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index 6cf50b9..593c83e 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -740,8 +740,26 @@ static HRESULT interp_mul(exec_ctx_t *ctx)
 
 static HRESULT interp_exp(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 = VarPow(l.v, r.v, &v);
+        release_val(&l);
+    }
+    release_val(&r);
+    if(FAILED(hres))
+        return hres;
+
+    return stack_push(ctx, &v);
 }
 
 static HRESULT interp_neg(exec_ctx_t *ctx)
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 661e2c9..12bdaf5 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -116,6 +116,11 @@ Call ok(3/2 = 1.5, "3/2 = " & (3/2))
 Call ok(5\4/2 = 2, "5\4/2 = " & (5\2/1))
 Call ok(12/3\2 = 2, "12/3\2 = " & (12/3\2))
 
+Call ok(2^3 = 8, "2^3 = " & (2^3))
+Call ok(2^3^2 = 64, "2^3^2 = " & (2^3^2))
+Call ok(-3^2 = 9, "-3^2 = " & (-3^2))
+Call ok(2*3^2 = 18, "2*3^2 = " & (2*3^2))
+
 if false then
     ok false, "if false called"
 end if




More information about the wine-cvs mailing list