Module: wine Branch: master Commit: 80eff04037e0639b2976ed67c6b0b08181aa99f1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=80eff04037e0639b2976ed67c6...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Sep 13 11:40:28 2011 +0200
vbscript: Added interp_idiv 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 602a259..925da12 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -668,8 +668,26 @@ static HRESULT interp_mod(exec_ctx_t *ctx)
static HRESULT interp_idiv(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 = VarIdiv(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 d5565bd..b6330b2 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -106,6 +106,11 @@ Call ok(getVT(2 mod null) = "VT_NULL", "getVT(2 mod null) = " & getVT(2 mod null Call ok(getVT(null mod 2) = "VT_NULL", "getVT(null mod 2) = " & getVT(null mod 2)) 'FIXME: Call ok(empty mod 2 = 0, "empty mod 2 = " & (empty mod 2))
+Call ok(5 \ 2 = 2, "5 \ 2 = " & (5\2)) +Call ok(4.6 \ 1.5 = 2, "4.6 \ 1.5 = " & (4.6\1.5)) +Call ok(4.6 \ 1.49 = 5, "4.6 \ 1.49 = " & (4.6\1.49)) +Call ok(2+3\4 = 2, "2+3\4 = " & (2+3\4)) + if false then ok false, "if false called" end if