Jacek Caban : vbscript: Added compiler support for numeric literals.
Alexandre Julliard
julliard at winehq.org
Mon Sep 12 11:42:59 CDT 2011
Module: wine
Branch: master
Commit: 880d706636b2f202470744c1d5bdc3be42a0fe39
URL: http://source.winehq.org/git/wine.git/?a=commit;h=880d706636b2f202470744c1d5bdc3be42a0fe39
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Sep 12 12:30:11 2011 +0200
vbscript: Added compiler support for numeric literals.
---
dlls/vbscript/compile.c | 24 ++++++++++++++++++++++++
dlls/vbscript/interp.c | 18 ++++++++++++++++++
dlls/vbscript/vbscript.h | 7 ++++++-
3 files changed, 48 insertions(+), 1 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c
index 450fa18..b398d85 100644
--- a/dlls/vbscript/compile.c
+++ b/dlls/vbscript/compile.c
@@ -107,6 +107,24 @@ static HRESULT push_instr_str(compile_ctx_t *ctx, vbsop_t op, const WCHAR *arg)
return S_OK;
}
+static HRESULT push_instr_double(compile_ctx_t *ctx, vbsop_t op, double arg)
+{
+ unsigned instr;
+ double *d;
+
+ d = compiler_alloc(ctx->code, sizeof(double));
+ if(!d)
+ return E_OUTOFMEMORY;
+
+ instr = push_instr(ctx, op);
+ if(instr == -1)
+ return E_OUTOFMEMORY;
+
+ *d = arg;
+ instr_ptr(ctx, instr)->arg1.dbl = d;
+ return S_OK;
+}
+
static BSTR alloc_bstr_arg(compile_ctx_t *ctx, const WCHAR *str)
{
if(!ctx->code->bstr_pool_size) {
@@ -218,6 +236,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr)
switch(expr->type) {
case EXPR_BOOL:
return push_instr_int(ctx, OP_bool, ((bool_expression_t*)expr)->value);
+ case EXPR_DOUBLE:
+ return push_instr_double(ctx, OP_double, ((double_expression_t*)expr)->value);
case EXPR_EMPTY:
return push_instr(ctx, OP_empty) != -1 ? S_OK : E_OUTOFMEMORY;
case EXPR_EQUAL:
@@ -230,6 +250,10 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr)
return push_instr(ctx, OP_null) != -1 ? S_OK : E_OUTOFMEMORY;
case EXPR_STRING:
return push_instr_str(ctx, OP_string, ((string_expression_t*)expr)->value);
+ case EXPR_USHORT:
+ return push_instr_int(ctx, OP_short, ((int_expression_t*)expr)->value);
+ case EXPR_ULONG:
+ return push_instr_int(ctx, OP_long, ((int_expression_t*)expr)->value);
default:
FIXME("Unimplemented expression type %d\n", expr->type);
return E_NOTIMPL;
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index d02516e..e7e3ab3 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -251,6 +251,24 @@ static HRESULT interp_string(exec_ctx_t *ctx)
return stack_push(ctx, &v);
}
+static HRESULT interp_long(exec_ctx_t *ctx)
+{
+ FIXME("\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT interp_short(exec_ctx_t *ctx)
+{
+ FIXME("\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT interp_double(exec_ctx_t *ctx)
+{
+ FIXME("\n");
+ return E_NOTIMPL;
+}
+
static HRESULT interp_empty(exec_ctx_t *ctx)
{
VARIANT v;
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index 9c047d1..7835eb2 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -83,18 +83,22 @@ typedef enum {
ARG_STR,
ARG_BSTR,
ARG_INT,
- ARG_UINT
+ ARG_UINT,
+ ARG_DOUBLE
} instr_arg_type_t;
#define OP_LIST \
X(bool, 1, ARG_INT, 0) \
+ X(double, 1, ARG_DOUBLE, 0) \
X(empty, 1, 0, 0) \
X(equal, 1, 0, 0) \
X(icall, 1, ARG_BSTR, ARG_UINT) \
X(icallv, 1, ARG_BSTR, ARG_UINT) \
+ X(long, 1, ARG_INT, 0) \
X(not, 1, 0, 0) \
X(null, 1, 0, 0) \
X(ret, 0, 0, 0) \
+ X(short, 1, ARG_INT, 0) \
X(string, 1, ARG_STR, 0)
typedef enum {
@@ -109,6 +113,7 @@ typedef union {
BSTR bstr;
unsigned uint;
LONG lng;
+ double *dbl;
} instr_arg_t;
typedef struct {
More information about the wine-cvs
mailing list