78 #define X(n,a,b,c) {#n,b,c}, 91 TRACE_(vbscript_disas)(
"\t%d",
arg->uint);
95 TRACE_(vbscript_disas)(
"\t%u",
arg->uint);
98 TRACE_(vbscript_disas)(
"\t%lf", *
arg->dbl);
115 TRACE_(vbscript_disas)(
"\n");
320 #define LABEL_FLAG 0x80000000 330 unsigned *new_labels;
380 if(
error == SCRIPT_E_REPORTED)
433 if(ret_val && !
expr->args) {
565 unsigned cnd_jmp, endif_label = 0;
584 if(
stat->else_stat ||
stat->elseifs) {
594 for(elseif_decl =
stat->elseifs; elseif_decl; elseif_decl = elseif_decl->
next) {
619 if(
stat->else_stat) {
655 loop_ctx = &stat_ctx;
760 unsigned step_instr,
instr;
786 if(
stat->step_expr) {
841 unsigned end_label, case_cnt = 0, *case_labels =
NULL,
i;
860 for(case_iter =
stat->case_clausules; case_iter; case_iter = case_iter->
next)
864 case_labels =
heap_alloc(case_cnt*
sizeof(*case_labels));
869 for(case_iter =
stat->case_clausules,
i=0; case_iter; case_iter = case_iter->
next,
i++) {
871 if(!case_labels[
i]) {
879 for(expr_iter = case_iter->
expr; expr_iter; expr_iter = expr_iter->
next) {
912 for(case_iter =
stat->case_clausules,
i=0; case_iter; case_iter = case_iter->
next,
i++) {
945 op = is_set ? OP_set_member : OP_assign_member;
947 op = is_set ? OP_set_ident : OP_assign_ident;
985 WARN(
"converting call expr to assign expr\n");
1006 for(dim_decl = ctx->
dim_decls; dim_decl; dim_decl = dim_decl->
next) {
1050 dim_decl = dim_decl->
next;
1089 next_decl = decl->
next;
1100 FIXME(
"Function is not in the global code\n");
1112 unsigned pop_cnt = 0;
1120 FIXME(
"Exit Do outside Do Loop\n");
1138 unsigned pop_cnt = 0;
1146 FIXME(
"Exit For outside For loop\n");
1179 FIXME(
"Exit Sub outside Sub?\n");
1189 FIXME(
"Exit Function outside Function?\n");
1199 FIXME(
"Exit Property outside Property?\n");
1236 switch(
stat->type) {
1301 FIXME(
"Unimplemented statement type %d\n",
stat->type);
1335 unsigned dim_cnt = 0,
i;
1338 for(iter = dim_decl->
dims; iter; iter = iter->
next)
1345 array_desc->
dim_cnt = dim_cnt;
1347 for(iter = dim_decl->
dims,
i=0; iter; iter = iter->
next,
i++) {
1365 switch(
func->type) {
1416 for(dim_decl = ctx->
dim_decls; dim_decl; dim_decl = dim_decl->
next) {
1438 for(dim_decl = ctx->
dim_decls,
i=0; dim_decl; dim_decl = dim_decl->
next,
i++) {
1440 if(!
func->vars[
i].name)
1448 if(
func->array_cnt) {
1449 unsigned array_id = 0;
1453 if(!
func->array_descs)
1456 for(dim_decl = ctx->
dim_decls; dim_decl; dim_decl = dim_decl->
next) {
1474 for(iter = ctx->
funcs; iter; iter = iter->
next) {
1502 func->array_cnt = 0;
1521 if(!
func->args[
i].name)
1523 func->args[
i].by_ref =
arg->by_ref;
1541 for(iter = ctx->
classes; iter; iter = iter->
next) {
1559 for(funcprop_decl = func_decl; funcprop_decl; funcprop_decl = funcprop_decl->
next_prop_func) {
1560 switch(funcprop_decl->
type) {
1609 static const WCHAR class_initializeW[] = {
'c',
'l',
'a',
's',
's',
'_',
'i',
'n',
'i',
't',
'i',
'a',
'l',
'i',
'z',
'e',0};
1610 static const WCHAR class_terminateW[] = {
'c',
'l',
'a',
's',
's',
'_',
't',
'e',
'r',
'm',
'i',
'n',
'a',
't',
'e',0};
1623 if(!class_desc->
name)
1628 for(func_decl = class_decl->
funcs; func_decl; func_decl = func_decl->
next) {
1629 for(func_prop_decl = func_decl; func_prop_decl; func_prop_decl = func_prop_decl->
next_prop_func) {
1638 if(!class_desc->
funcs)
1642 for(func_decl = class_decl->
funcs,
i=1; func_decl; func_decl = func_decl->
next,
i++) {
1643 for(func_prop_decl = func_decl; func_prop_decl; func_prop_decl = func_prop_decl->
next_prop_func) {
1650 if(!
wcsicmp(class_initializeW, func_decl->
name)) {
1652 FIXME(
"class initializer is not sub\n");
1657 }
else if(!
wcsicmp(class_terminateW, func_decl->
name)) {
1659 FIXME(
"class terminator is not sub\n");
1671 for(prop_decl = class_decl->
props; prop_decl; prop_decl = prop_decl->
next)
1675 if(!class_desc->
props)
1678 for(prop_decl = class_decl->
props,
i=0; prop_decl; prop_decl = prop_decl->
next,
i++) {
1700 for(prop_decl = class_decl->
props,
i=0; prop_decl; prop_decl = prop_decl->
next) {
1720 for(var =
script->global_vars; var; var = var->
next) {
1730 for(
class =
script->classes;
class;
class =
class->next) {
1758 for(
class = ctx->
classes;
class;
class =
class->next) {
1774 for(
i=0;
i <
code->bstr_cnt;
i++)
1778 IDispatch_Release(
code->context);
1791 ret = heap_alloc_zero(
sizeof(*
ret));
1814 ret->main_code.code_ctx =
ret;
1864 for(func_decl = ctx.
func_decls; func_decl; func_decl = func_decl->
next) {
1872 ctx.
funcs = new_func;
1899 for(new_func = ctx.
funcs; new_func->
next; new_func = new_func->
next);
1915 class->next =
script->classes;
static BOOL lookup_script_identifier(script_ctx_t *script, const WCHAR *identifier)
#define DEFAULT_UNREACHABLE
#define VBS_COMPILE_ERROR
BSTR get_vbscript_string(int) DECLSPEC_HIDDEN
static BOOL lookup_class_funcs(class_desc_t *class_desc, const WCHAR *name)
static HRESULT compile_statement(compile_ctx_t *, statement_ctx_t *, statement_t *)
instr_arg_type_t arg1_type
static BOOL lookup_args_name(compile_ctx_t *ctx, const WCHAR *name)
static HRESULT push_instr_bstr(compile_ctx_t *ctx, vbsop_t op, const WCHAR *arg)
static HRESULT compile_dim_statement(compile_ctx_t *ctx, dim_statement_t *stat)
expression_t * value_expr
void release_vbscode(vbscode_t *code)
const_decl_t * global_consts
static HRESULT exit_label(compile_ctx_t *ctx, unsigned jmp_label)
struct _class_decl_t * next
struct _function_decl_t * next
void * heap_pool_alloc(heap_pool_t *, DWORD) __WINE_ALLOC_SIZE(2) DECLSPEC_HIDDEN
static HRESULT compile_function_statement(compile_ctx_t *ctx, function_statement_t *stat)
unsigned class_initialize_id
static HRESULT create_class_funcprop(compile_ctx_t *ctx, function_decl_t *func_decl, vbdisp_funcprop_desc_t *desc)
static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t *expr, BOOL ret_val)
statement_ctx_t * stat_ctx
static void dump_instr_arg(instr_arg_type_t type, instr_arg_t *arg)
GLuint GLuint GLsizei GLenum type
static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *stat)
static BOOL lookup_dim_decls(compile_ctx_t *ctx, const WCHAR *name)
static HRESULT compile_exitdo_statement(compile_ctx_t *ctx)
WINE_DEFAULT_DEBUG_CHANNEL(jscript)
void clear_ei(script_ctx_t *ctx)
struct _statement_ctx_t statement_ctx_t
static HRESULT compile_if_statement(compile_ctx_t *ctx, if_statement_t *stat)
static void * heap_realloc(void *mem, size_t len)
static HRESULT push_instr_uint_bstr(compile_ctx_t *ctx, vbsop_t op, unsigned arg1, const WCHAR *arg2)
static void * heap_alloc(size_t len)
#define DISP_E_PARAMNOTFOUND
static HRESULT compile_call_statement(compile_ctx_t *ctx, call_statement_t *stat)
struct _elseif_decl_t * next
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
static HRESULT compile_exitfor_statement(compile_ctx_t *ctx)
static BOOL emit_catch_jmp(compile_ctx_t *ctx, unsigned stack_off, unsigned code_off)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
struct _statement_ctx_t * next
struct _const_decl_t * next
static HRESULT compile_binary_expression(compile_ctx_t *ctx, binary_expression_t *expr, vbsop_t op)
GLuint GLuint GLuint GLuint arg1
static const WCHAR desc[]
static WCHAR * heap_strdupW(const WCHAR *str)
array_desc_t * array_descs
static HRESULT compile_exitfunc_statement(compile_ctx_t *ctx)
static void * compiler_alloc(vbscode_t *vbscode, size_t size)
struct _case_clausule_t * next
static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *func)
BSTR WINAPI SysAllocString(LPCOLESTR str)
static void resolve_labels(compile_ctx_t *ctx, unsigned off)
HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, const WCHAR *args, const WCHAR *delimiter, BOOL from_eval, BOOL use_decode, bytecode_t **ret)
static HRESULT compile_dowhile_statement(compile_ctx_t *ctx, while_statement_t *stat)
struct _dynamic_var_t * next
dim_decl_t * dim_decls_tail
static HRESULT compile_assign_statement(compile_ctx_t *ctx, assign_statement_t *stat, BOOL is_set)
static WCHAR * compiler_alloc_string(vbscode_t *vbscode, const WCHAR *str)
void parser_release(parser_ctx_t *) DECLSPEC_HIDDEN
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
BSTR get_vbscript_error_string(HRESULT) DECLSPEC_HIDDEN
static HRESULT push_instr_int(compile_ctx_t *ctx, vbsop_t op, LONG arg)
static HRESULT push_instr_uint(compile_ctx_t *ctx, vbsop_t op, unsigned arg)
static unsigned stack_offset(compile_ctx_t *ctx)
struct _function_decl_t * next_prop_func
static HRESULT compile_while_statement(compile_ctx_t *ctx, while_statement_t *stat)
static HRESULT compile_expression(compile_ctx_t *, expression_t *)
dynamic_var_t * global_vars
static vbscode_t * alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
struct _class_desc_t * next
static HRESULT compile_unary_expression(compile_ctx_t *ctx, unary_expression_t *expr, vbsop_t op)
const_decl_t * const_decls
static BOOL emit_catch(compile_ctx_t *ctx, unsigned off)
static expression_t * lookup_const_decls(compile_ctx_t *ctx, const WCHAR *name, BOOL lookup_global)
static HRESULT push_instr_bstr_uint(compile_ctx_t *ctx, vbsop_t op, const WCHAR *arg1, unsigned arg2)
static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
vbdisp_funcprop_desc_t * funcs
static HRESULT compile_retval_statement(compile_ctx_t *ctx, retval_statement_t *stat)
#define memcpy(s1, s2, n)
static HRESULT push_instr_double(compile_ctx_t *ctx, vbsop_t op, double arg)
static void release_compiler(compile_ctx_t *ctx)
HRESULT compile_procedure(script_ctx_t *script, const WCHAR *src, const WCHAR *delimiter, DWORD flags, class_desc_t **ret)
void heap_pool_init(heap_pool_t *) DECLSPEC_HIDDEN
static HRESULT compile_foreach_statement(compile_ctx_t *ctx, foreach_statement_t *stat)
static HRESULT compile_assignment(compile_ctx_t *ctx, member_expression_t *member_expr, expression_t *value_expr, BOOL is_set)
HRESULT report_script_error(script_ctx_t *ctx)
struct _dim_list_t * next
static unsigned arg_cnt(const DISPPARAMS *dp)
static void label_set_addr(compile_ctx_t *ctx, unsigned label)
static HRESULT push_instr_str(compile_ctx_t *ctx, vbsop_t op, const WCHAR *arg)
static unsigned __int64 next
static HRESULT compile_exitsub_statement(compile_ctx_t *ctx)
static HRESULT compile_const_statement(compile_ctx_t *ctx, const_statement_t *stat)
struct _expression_t * next
static HRESULT check_script_collisions(compile_ctx_t *ctx, script_ctx_t *script)
unsigned class_terminate_id
static BOOL lookup_funcs_name(compile_ctx_t *ctx, const WCHAR *name)
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
static HRESULT compile_error(script_ctx_t *ctx, HRESULT error)
static unsigned push_instr(compile_ctx_t *ctx, vbsop_t op)
struct _dim_decl_t * next
function_decl_t * func_decls
static HRESULT fill_array_desc(compile_ctx_t *ctx, dim_decl_t *dim_decl, array_desc_t *array_desc)
void heap_pool_free(heap_pool_t *) DECLSPEC_HIDDEN
instr_arg_type_t arg2_type
static HRESULT compile_args(compile_ctx_t *ctx, expression_t *args, unsigned *ret)
static HRESULT create_function(compile_ctx_t *ctx, function_decl_t *decl, function_t **ret)
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
vbdisp_prop_desc_t * props
class_decl_t * class_decls
static unsigned alloc_label(compile_ctx_t *ctx)
static instr_t * instr_ptr(compile_ctx_t *ctx, unsigned id)
static HRESULT compile_onerror_statement(compile_ctx_t *ctx, onerror_statement_t *stat)
static HRESULT compile_exitprop_statement(compile_ctx_t *ctx)
static void dump_code(compile_ctx_t *ctx)
static void * compiler_alloc_zero(vbscode_t *vbscode, size_t size)
static HRESULT compile_select_statement(compile_ctx_t *ctx, select_statement_t *stat)
static BOOL heap_free(void *mem)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
WINE_DECLARE_DEBUG_CHANNEL(jscript_disas)
static HRESULT push_instr_addr(compile_ctx_t *ctx, vbsop_t op, unsigned arg)
HRESULT parse_script(parser_ctx_t *, const WCHAR *, const WCHAR *, DWORD) DECLSPEC_HIDDEN
static BSTR alloc_bstr_arg(compile_ctx_t *ctx, const WCHAR *str)
static BOOL lookup_class_name(compile_ctx_t *ctx, const WCHAR *name)