From f8383c3417e0bc4addc8427f0acff32b5344455b Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 25 Jun 2012 14:08:38 +0200 Subject: [PATCH] jscript: Don't use DISPPARAMS for internal arguments. --- dlls/jscript/activex.c | 8 +- dlls/jscript/array.c | 107 ++++++++-------- dlls/jscript/bool.c | 12 +- dlls/jscript/date.c | 277 ++++++++++++++++++++-------------------- dlls/jscript/dispex.c | 224 ++++++++++++++++---------------- dlls/jscript/engine.c | 47 ++----- dlls/jscript/error.c | 48 +++---- dlls/jscript/function.c | 154 +++++++++------------- dlls/jscript/global.c | 168 ++++++++++++------------ dlls/jscript/jscript.h | 16 +-- dlls/jscript/jsutils.c | 5 +- dlls/jscript/math.c | 116 ++++++++--------- dlls/jscript/number.c | 40 +++--- dlls/jscript/object.c | 32 ++--- dlls/jscript/regexp.c | 49 ++++--- dlls/jscript/string.c | 244 +++++++++++++++++------------------ dlls/jscript/vbarray.c | 42 +++--- 17 files changed, 744 insertions(+), 845 deletions(-) diff --git a/dlls/jscript/activex.c b/dlls/jscript/activex.c index 8e2eed4e3c8..16b6b4213b4 100644 --- a/dlls/jscript/activex.c +++ b/dlls/jscript/activex.c @@ -138,7 +138,7 @@ static IUnknown *create_activex_object(script_ctx_t *ctx, const WCHAR *progid) return obj; } -static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { IDispatch *disp; @@ -159,12 +159,12 @@ static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag return E_NOTIMPL; } - if(arg_cnt(dp) != 1) { - FIXME("unsupported arg_cnt %d\n", arg_cnt(dp)); + if(argc != 1) { + FIXME("unsupported argc %d\n", argc); return E_NOTIMPL; } - hres = to_string(ctx, get_arg(dp,0), ei, &progid); + hres = to_string(ctx, argv, ei, &progid); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c index 139b04d6388..5004eb58788 100644 --- a/dlls/jscript/array.c +++ b/dlls/jscript/array.c @@ -116,7 +116,7 @@ static WCHAR *idx_to_str(DWORD idx, WCHAR *ptr) return ptr+1; } -static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { ArrayInstance *This = array_from_vdisp(jsthis); @@ -132,7 +132,7 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP DWORD i; HRESULT hres; - hres = to_number(ctx, get_arg(dp, 0), ei, &len); + hres = to_number(ctx, argv, ei, &len); if(FAILED(hres)) return hres; @@ -201,7 +201,7 @@ static HRESULT concat_obj(jsdisp_t *array, IDispatch *obj, DWORD *len, jsexcept_ return jsdisp_propput_idx(array, (*len)++, &var, ei); } -static HRESULT Array_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *ret; @@ -219,8 +219,8 @@ static HRESULT Array_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP VARIANT *arg; DWORD i; - for(i=0; i < arg_cnt(dp); i++) { - arg = get_arg(dp, i); + for(i=0; i < argc; i++) { + arg = argv+i; if(V_VT(arg) == VT_DISPATCH) hres = concat_obj(ret, V_DISPATCH(arg), &len, ei); else @@ -340,7 +340,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons } /* ECMA-262 3rd Edition 15.4.4.5 */ -static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *jsthis; @@ -353,10 +353,10 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR if(FAILED(hres)) return hres; - if(arg_cnt(dp)) { + if(argc) { BSTR sep; - hres = to_string(ctx, get_arg(dp,0), ei, &sep); + hres = to_string(ctx, argv, ei, &sep); if(FAILED(hres)) return hres; @@ -370,7 +370,7 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR return hres; } -static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *jsthis; @@ -421,12 +421,12 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARA } /* ECMA-262 3rd Edition 15.4.4.7 */ -static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *jsthis; DWORD length = 0; - int i, n; + unsigned i; HRESULT hres; TRACE("\n"); @@ -435,23 +435,22 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR if(FAILED(hres)) return hres; - n = arg_cnt(dp); - for(i=0; i < n; i++) { - hres = jsdisp_propput_idx(jsthis, length+i, get_arg(dp, i), ei); + for(i=0; i < argc; i++) { + hres = jsdisp_propput_idx(jsthis, length+i, argv+i, ei); if(FAILED(hres)) return hres; } - hres = set_length(jsthis, ei, length+n); + hres = set_length(jsthis, ei, length+argc); if(FAILED(hres)) return hres; if(retv) - num_set_int(retv, length+n); + num_set_int(retv, length+argc); return S_OK; } -static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *jsthis; @@ -509,7 +508,7 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISP } /* ECMA-262 3rd Edition 15.4.4.9 */ -static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *jsthis; @@ -563,7 +562,7 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPA } /* ECMA-262 3rd Edition 15.4.4.10 */ -static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *arr, *jsthis; @@ -577,8 +576,8 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPA if(FAILED(hres)) return hres; - if(arg_cnt(dp)) { - hres = to_number(ctx, get_arg(dp, 0), ei, &range); + if(argc) { + hres = to_number(ctx, argv, ei, &range); if(FAILED(hres)) return hres; @@ -590,8 +589,8 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPA } else start = 0; - if(arg_cnt(dp)>1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &range); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &range); if(FAILED(hres)) return hres; @@ -639,14 +638,13 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, VARIANT *v1, VARI if(cmp_func) { VARIANTARG args[2]; - DISPPARAMS dp = {args, NULL, 2, 0}; double n; VARIANT res; - args[0] = *v2; - args[1] = *v1; + args[0] = *v1; + args[1] = *v2; - hres = jsdisp_call_value(cmp_func, NULL, DISPATCH_METHOD, &dp, &res, ei); + hres = jsdisp_call_value(cmp_func, NULL, DISPATCH_METHOD, 2, args, &res, ei); if(FAILED(hres)) return hres; @@ -689,7 +687,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, VARIANT *v1, VARI } /* ECMA-262 3rd Edition 15.4.4.11 */ -static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *jsthis, *cmp_func = NULL; @@ -704,21 +702,19 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - WARN("invalid arg_cnt %d\n", arg_cnt(dp)); + if(argc > 1) { + WARN("invalid arg_cnt %d\n", argc); return E_FAIL; } - if(arg_cnt(dp) == 1) { - VARIANT *arg = get_arg(dp, 0); - - if(V_VT(arg) != VT_DISPATCH) { + if(argc == 1) { + if(V_VT(argv) != VT_DISPATCH) { WARN("arg is not dispatch\n"); return E_FAIL; } - cmp_func = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg)); + cmp_func = iface_to_jsdisp((IUnknown*)V_DISPATCH(argv)); if(!cmp_func || !is_class(cmp_func, JSCLASS_FUNCTION)) { WARN("cmp_func is not a function\n"); if(cmp_func) @@ -844,10 +840,10 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPAR } /* ECMA-262 3rd Edition 15.4.4.12 */ -static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { - DWORD length, start=0, delete_cnt=0, argc, i, add_args = 0; + DWORD length, start=0, delete_cnt=0, i, add_args = 0; jsdisp_t *ret_array = NULL, *jsthis; VARIANT v; double d; @@ -860,9 +856,8 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPP if(FAILED(hres)) return hres; - argc = arg_cnt(dp); - if(argc >= 1) { - hres = to_integer(ctx, get_arg(dp,0), ei, &d); + if(argc) { + hres = to_integer(ctx, argv, ei, &d); if(FAILED(hres)) return hres; @@ -877,7 +872,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPP } if(argc >= 2) { - hres = to_integer(ctx, get_arg(dp,1), ei, &d); + hres = to_integer(ctx, argv+1, ei, &d); if(FAILED(hres)) return hres; @@ -932,7 +927,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPP } for(i=0; SUCCEEDED(hres) && i < add_args; i++) - hres = jsdisp_propput_idx(jsthis, start+i, get_arg(dp,i+2), ei); + hres = jsdisp_propput_idx(jsthis, start+i, argv+i+2, ei); if(SUCCEEDED(hres)) { num_set_int(&v, length-delete_cnt+add_args); @@ -951,7 +946,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPP } /* ECMA-262 3rd Edition 15.4.4.2 */ -static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { ArrayInstance *array; @@ -965,7 +960,7 @@ static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI return array_join(ctx, &array->dispex, array->length, default_separatorW, retv, ei); } -static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); @@ -973,12 +968,12 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flag } /* ECMA-262 3rd Edition 15.4.4.13 */ -static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp, +static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *jsthis; WCHAR buf[14], *buf_end, *str; - DWORD argc, i, length; + DWORD i, length; VARIANT var; DISPID id; HRESULT hres; @@ -989,7 +984,6 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISP if(FAILED(hres)) return hres; - argc = arg_cnt(dp); if(argc) { buf_end = buf + sizeof(buf)/sizeof(WCHAR)-1; *buf_end-- = 0; @@ -1016,7 +1010,7 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISP } for(i=0; itime, date)); if(st.wYear<1601 || st.wYear>9999) - return Date_toTimeString(ctx, jsthis, flags, dp, retv, ei); + return Date_toTimeString(ctx, jsthis, flags, argc, argv, retv, ei); if(retv) { len = GetTimeFormatW(ctx->lcid, 0, &st, NULL, NULL, 0); @@ -1050,7 +1050,7 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD } /* ECMA-262 3rd Edition 15.9.5.9 */ -static HRESULT Date_getTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1066,7 +1066,7 @@ static HRESULT Date_getTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP } /* ECMA-262 3rd Edition 15.9.5.10 */ -static HRESULT Date_getFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1085,7 +1085,7 @@ static HRESULT Date_getFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } /* ECMA-262 3rd Edition 15.9.5.11 */ -static HRESULT Date_getUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1101,7 +1101,7 @@ static HRESULT Date_getUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag } /* ECMA-262 3rd Edition 15.9.5.12 */ -static HRESULT Date_getMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1120,7 +1120,7 @@ static HRESULT Date_getMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS } /* ECMA-262 3rd Edition 15.9.5.13 */ -static HRESULT Date_getUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1136,7 +1136,7 @@ static HRESULT Date_getUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } /* ECMA-262 3rd Edition 15.9.5.14 */ -static HRESULT Date_getDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1155,7 +1155,7 @@ static HRESULT Date_getDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP } /* ECMA-262 3rd Edition 15.9.5.15 */ -static HRESULT Date_getUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1171,7 +1171,7 @@ static HRESULT Date_getUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D } /* ECMA-262 3rd Edition 15.9.5.16 */ -static HRESULT Date_getDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1190,7 +1190,7 @@ static HRESULT Date_getDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPP } /* ECMA-262 3rd Edition 15.9.5.17 */ -static HRESULT Date_getUTCDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getUTCDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1206,7 +1206,7 @@ static HRESULT Date_getUTCDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI } /* ECMA-262 3rd Edition 15.9.5.18 */ -static HRESULT Date_getHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1225,7 +1225,7 @@ static HRESULT Date_getHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS } /* ECMA-262 3rd Edition 15.9.5.19 */ -static HRESULT Date_getUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1241,7 +1241,7 @@ static HRESULT Date_getUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } /* ECMA-262 3rd Edition 15.9.5.20 */ -static HRESULT Date_getMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1260,7 +1260,7 @@ static HRESULT Date_getMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D } /* ECMA-262 3rd Edition 15.9.5.21 */ -static HRESULT Date_getUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1276,7 +1276,7 @@ static HRESULT Date_getUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags } /* ECMA-262 3rd Edition 15.9.5.22 */ -static HRESULT Date_getSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1295,7 +1295,7 @@ static HRESULT Date_getSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D } /* ECMA-262 3rd Edition 15.9.5.23 */ -static HRESULT Date_getUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1311,7 +1311,7 @@ static HRESULT Date_getUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags } /* ECMA-262 3rd Edition 15.9.5.24 */ -static HRESULT Date_getMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1330,7 +1330,7 @@ static HRESULT Date_getMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla } /* ECMA-262 3rd Edition 15.9.5.25 */ -static HRESULT Date_getUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1346,7 +1346,7 @@ static HRESULT Date_getUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD } /* ECMA-262 3rd Edition 15.9.5.26 */ -static HRESULT Date_getTimezoneOffset(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getTimezoneOffset(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1363,7 +1363,7 @@ static HRESULT Date_getTimezoneOffset(script_ctx_t *ctx, vdisp_t *jsthis, WORD f } /* ECMA-262 3rd Edition 15.9.5.27 */ -static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double n; @@ -1375,10 +1375,10 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); - hres = to_number(ctx, get_arg(dp, 0), ei, &n); + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) return hres; @@ -1391,7 +1391,7 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP } /* ECMA-262 3rd Edition 15.9.5.28 */ -static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1403,10 +1403,10 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); - hres = to_number(ctx, get_arg(dp, 0), ei, &n); + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) return hres; @@ -1422,7 +1422,7 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla } /* ECMA-262 3rd Edition 15.9.5.29 */ -static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1434,10 +1434,10 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); - hres = to_number(ctx, get_arg(dp, 0), ei, &n); + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) return hres; @@ -1453,7 +1453,7 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD } /* ECMA-262 3rd Edition 15.9.5.30 */ -static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1465,17 +1465,17 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = local_time(date->time, date); - hres = to_number(ctx, get_arg(dp, 0), ei, &sec); + hres = to_number(ctx, argv, ei, &sec); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &ms); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &ms); if(FAILED(hres)) return hres; }else { @@ -1493,7 +1493,7 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D } /* ECMA-262 3rd Edition 15.9.5.31 */ -static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1505,17 +1505,17 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = date->time; - hres = to_number(ctx, get_arg(dp, 0), ei, &sec); + hres = to_number(ctx, argv, ei, &sec); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &ms); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &ms); if(FAILED(hres)) return hres; }else { @@ -1533,7 +1533,7 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags } /* ECMA-262 3rd Edition 15.9.5.33 */ -static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1545,25 +1545,25 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = local_time(date->time, date); - hres = to_number(ctx, get_arg(dp, 0), ei, &min); + hres = to_number(ctx, argv, ei, &min); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &sec); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &sec); if(FAILED(hres)) return hres; }else { sec = sec_from_time(t); } - if(arg_cnt(dp) > 2) { - hres = to_number(ctx, get_arg(dp, 2), ei, &ms); + if(argc > 2) { + hres = to_number(ctx, argv+2, ei, &ms); if(FAILED(hres)) return hres; }else { @@ -1581,7 +1581,7 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D } /* ECMA-262 3rd Edition 15.9.5.34 */ -static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1593,25 +1593,25 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = date->time; - hres = to_number(ctx, get_arg(dp, 0), ei, &min); + hres = to_number(ctx, argv, ei, &min); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &sec); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &sec); if(FAILED(hres)) return hres; }else { sec = sec_from_time(t); } - if(arg_cnt(dp) > 2) { - hres = to_number(ctx, get_arg(dp, 2), ei, &ms); + if(argc > 2) { + hres = to_number(ctx, argv+2, ei, &ms); if(FAILED(hres)) return hres; }else { @@ -1629,7 +1629,7 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags } /* ECMA-262 3rd Edition 15.9.5.35 */ -static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1641,33 +1641,33 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = local_time(date->time, date); - hres = to_number(ctx, get_arg(dp, 0), ei, &hour); + hres = to_number(ctx, argv, ei, &hour); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &min); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &min); if(FAILED(hres)) return hres; }else { min = min_from_time(t); } - if(arg_cnt(dp) > 2) { - hres = to_number(ctx, get_arg(dp, 2), ei, &sec); + if(argc > 2) { + hres = to_number(ctx, argv+2, ei, &sec); if(FAILED(hres)) return hres; }else { sec = sec_from_time(t); } - if(arg_cnt(dp) > 3) { - hres = to_number(ctx, get_arg(dp, 3), ei, &ms); + if(argc > 3) { + hres = to_number(ctx, argv+3, ei, &ms); if(FAILED(hres)) return hres; }else { @@ -1684,7 +1684,7 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS } /* ECMA-262 3rd Edition 15.9.5.36 */ -static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1696,33 +1696,33 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = date->time; - hres = to_number(ctx, get_arg(dp, 0), ei, &hour); + hres = to_number(ctx, argv, ei, &hour); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &min); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &min); if(FAILED(hres)) return hres; }else { min = min_from_time(t); } - if(arg_cnt(dp) > 2) { - hres = to_number(ctx, get_arg(dp, 2), ei, &sec); + if(argc > 2) { + hres = to_number(ctx, argv+2, ei, &sec); if(FAILED(hres)) return hres; }else { sec = sec_from_time(t); } - if(arg_cnt(dp) > 3) { - hres = to_number(ctx, get_arg(dp, 3), ei, &ms); + if(argc > 3) { + hres = to_number(ctx, argv+3, ei, &ms); if(FAILED(hres)) return hres; }else { @@ -1739,7 +1739,7 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } /* ECMA-262 3rd Edition 15.9.5.36 */ -static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1751,10 +1751,10 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); - hres = to_number(ctx, get_arg(dp, 0), ei, &n); + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) return hres; @@ -1769,7 +1769,7 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP } /* ECMA-262 3rd Edition 15.9.5.37 */ -static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1781,10 +1781,10 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); - hres = to_number(ctx, get_arg(dp, 0), ei, &n); + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) return hres; @@ -1799,7 +1799,7 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D } /* ECMA-262 3rd Edition 15.9.5.38 */ -static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1811,17 +1811,17 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = local_time(date->time, date); - hres = to_number(ctx, get_arg(dp, 0), ei, &month); + hres = to_number(ctx, argv, ei, &month); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &ddate); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &ddate); if(FAILED(hres)) return hres; }else { @@ -1839,7 +1839,7 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS } /* ECMA-262 3rd Edition 15.9.5.39 */ -static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1851,17 +1851,17 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = date->time; - hres = to_number(ctx, get_arg(dp, 0), ei, &month); + hres = to_number(ctx, argv, ei, &month); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &ddate); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &ddate); if(FAILED(hres)) return hres; }else { @@ -1879,7 +1879,7 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } /* ECMA-262 3rd Edition 15.9.5.40 */ -static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1891,25 +1891,25 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = local_time(date->time, date); - hres = to_number(ctx, get_arg(dp, 0), ei, &year); + hres = to_number(ctx, argv, ei, &year); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &month); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &month); if(FAILED(hres)) return hres; }else { month = month_from_time(t); } - if(arg_cnt(dp) > 2) { - hres = to_number(ctx, get_arg(dp, 2), ei, &ddate); + if(argc > 2) { + hres = to_number(ctx, argv+2, ei, &ddate); if(FAILED(hres)) return hres; }else { @@ -1926,7 +1926,7 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } /* ECMA-262 3rd Edition 15.9.5.41 */ -static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1938,25 +1938,25 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = date->time; - hres = to_number(ctx, get_arg(dp, 0), ei, &year); + hres = to_number(ctx, argv, ei, &year); if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &month); + if(argc > 1) { + hres = to_number(ctx, argv+1, ei, &month); if(FAILED(hres)) return hres; }else { month = month_from_time(t); } - if(arg_cnt(dp) > 2) { - hres = to_number(ctx, get_arg(dp, 2), ei, &ddate); + if(argc > 2) { + hres = to_number(ctx, argv+2, ei, &ddate); if(FAILED(hres)) return hres; }else { @@ -1973,7 +1973,7 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag } /* ECMA-262 3rd Edition B2.4 */ -static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -1999,7 +1999,7 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP } /* ECMA-262 3rd Edition B2.5 */ -static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DateInstance *date; @@ -2011,12 +2011,12 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP if(!(date = date_this(jsthis))) return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL); - if(!arg_cnt(dp)) + if(!argc) return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); t = local_time(date->time, date); - hres = to_number(ctx, get_arg(dp, 0), ei, &year); + hres = to_number(ctx, argv, ei, &year); if(FAILED(hres)) return hres; @@ -2038,7 +2038,7 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP return S_OK; } -static HRESULT Date_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Date_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -2403,7 +2403,7 @@ static inline HRESULT date_parse(BSTR input, double *ret) { return S_OK; } -static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR parse_str; @@ -2412,13 +2412,13 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_string(ctx, get_arg(dp,0), ei, &parse_str); + hres = to_string(ctx, argv, ei, &parse_str); if(FAILED(hres)) return hres; @@ -2431,16 +2431,15 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, return S_OK; } -static HRESULT date_utc(script_ctx_t *ctx, DISPPARAMS *dp, double *ret, jsexcept_t *ei) +static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, VARIANT *argv, double *ret, jsexcept_t *ei) { double year, month, vdate, hours, minutes, seconds, ms; - int arg_no = arg_cnt(dp); HRESULT hres; TRACE("\n"); - if(arg_no>0) { - hres = to_number(ctx, get_arg(dp, 0), ei, &year); + if(argc) { + hres = to_number(ctx, argv, ei, &year); if(FAILED(hres)) return hres; if(0 <= year && year <= 99) @@ -2449,48 +2448,48 @@ static HRESULT date_utc(script_ctx_t *ctx, DISPPARAMS *dp, double *ret, jsexcept year = 1900; } - if(arg_no>1) { - hres = to_number(ctx, get_arg(dp, 1), ei, &month); + if(argc>1) { + hres = to_number(ctx, argv+1, ei, &month); if(FAILED(hres)) return hres; }else { month = 0; } - if(arg_no>2) { - hres = to_number(ctx, get_arg(dp, 2), ei, &vdate); + if(argc>2) { + hres = to_number(ctx, argv+2, ei, &vdate); if(FAILED(hres)) return hres; }else { vdate = 1; } - if(arg_no>3) { - hres = to_number(ctx, get_arg(dp, 3), ei, &hours); + if(argc>3) { + hres = to_number(ctx, argv+3, ei, &hours); if(FAILED(hres)) return hres; }else { hours = 0; } - if(arg_no>4) { - hres = to_number(ctx, get_arg(dp, 4), ei, &minutes); + if(argc>4) { + hres = to_number(ctx, argv+4, ei, &minutes); if(FAILED(hres)) return hres; }else { minutes = 0; } - if(arg_no>5) { - hres = to_number(ctx, get_arg(dp, 5), ei, &seconds); + if(argc>5) { + hres = to_number(ctx, argv+5, ei, &seconds); if(FAILED(hres)) return hres; }else { seconds = 0; } - if(arg_no>6) { - hres = to_number(ctx, get_arg(dp, 6), ei, &ms); + if(argc>6) { + hres = to_number(ctx, argv+6, ei, &ms); if(FAILED(hres)) return hres; } else { @@ -2502,7 +2501,7 @@ static HRESULT date_utc(script_ctx_t *ctx, DISPPARAMS *dp, double *ret, jsexcept return S_OK; } -static HRESULT DateConstr_UTC(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT DateConstr_UTC(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double n; @@ -2510,13 +2509,13 @@ static HRESULT DateConstr_UTC(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI TRACE("\n"); - hres = date_utc(ctx, dp, &n, ei); + hres = date_utc(ctx, argc, argv, &n, ei); if(SUCCEEDED(hres) && retv) num_set_val(retv, n); return hres; } -static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *date; @@ -2526,7 +2525,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, switch(flags) { case DISPATCH_CONSTRUCT: - switch(arg_cnt(dp)) { + switch(argc) { /* ECMA-262 3rd Edition 15.9.3.3 */ case 0: { FILETIME time; @@ -2547,7 +2546,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, VARIANT prim; double n; - hres = to_primitive(ctx, get_arg(dp,0), ei, &prim, NO_HINT); + hres = to_primitive(ctx, argv, ei, &prim, NO_HINT); if(FAILED(hres)) return hres; @@ -2571,7 +2570,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, double ret_date; DateInstance *di; - hres = date_utc(ctx, dp, &ret_date, ei); + hres = date_utc(ctx, argc, argv, &ret_date, ei); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index c52ac7d431e..5bec3d4b03d 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -291,48 +291,6 @@ static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, BOOL search_p return hres; } -static HRESULT set_this(DISPPARAMS *dp, const DISPPARAMS *olddp, IDispatch *jsthis) -{ - VARIANTARG *oldargs; - int i; - - static DISPID this_id = DISPID_THIS; - - *dp = *olddp; - - for(i = 0; i < dp->cNamedArgs; i++) { - if(dp->rgdispidNamedArgs[i] == DISPID_THIS) - return S_OK; - } - - oldargs = dp->rgvarg; - dp->rgvarg = heap_alloc((dp->cArgs+1) * sizeof(VARIANTARG)); - if(!dp->rgvarg) - return E_OUTOFMEMORY; - memcpy(dp->rgvarg+1, oldargs, dp->cArgs*sizeof(VARIANTARG)); - V_VT(dp->rgvarg) = VT_DISPATCH; - V_DISPATCH(dp->rgvarg) = jsthis; - dp->cArgs++; - - if(dp->cNamedArgs) { - DISPID *old = dp->rgdispidNamedArgs; - dp->rgdispidNamedArgs = heap_alloc((dp->cNamedArgs+1)*sizeof(DISPID)); - if(!dp->rgdispidNamedArgs) { - heap_free(dp->rgvarg); - return E_OUTOFMEMORY; - } - - memcpy(dp->rgdispidNamedArgs+1, old, dp->cNamedArgs*sizeof(DISPID)); - dp->rgdispidNamedArgs[0] = DISPID_THIS; - dp->cNamedArgs++; - }else { - dp->rgdispidNamedArgs = &this_id; - dp->cNamedArgs = 1; - } - - return S_OK; -} - static IDispatch *get_this(DISPPARAMS *dp) { DWORD i; @@ -351,60 +309,46 @@ static IDispatch *get_this(DISPPARAMS *dp) return NULL; } -static HRESULT convert_params(const DISPPARAMS *dp, VARIANT *buf, DISPPARAMS *ret) +static HRESULT convert_params(const DISPPARAMS *dp, VARIANT *buf, unsigned *argc, VARIANT **ret) { - BOOL need_conversion = FALSE; const VARIANT *s; - VARIANT *d; + VARIANT *argv; + unsigned cnt; unsigned i; - ret->cArgs = dp->cArgs - dp->cNamedArgs; - ret->cNamedArgs = 0; + cnt = dp->cArgs - dp->cNamedArgs; - for(i = 0; i < ret->cArgs && !need_conversion; i++) { - switch(V_VT(get_arg(dp, i))) { - case VT_I2: - case VT_INT: - need_conversion = TRUE; - break; - } - } - - if(!need_conversion) { - ret->rgvarg = dp->rgvarg + dp->cNamedArgs; - return S_OK; - } - - if(ret->cArgs > 6) { - ret->rgvarg = heap_alloc(ret->cArgs * sizeof(VARIANT)); - if(!ret->rgvarg) + if(cnt > 6) { + argv = heap_alloc(cnt * sizeof(VARIANT)); + if(!argv) return E_OUTOFMEMORY; }else { - ret->rgvarg = buf; + argv = buf; } - for(i = 0; i < ret->cArgs; i++) { + for(i = 0; i < cnt; i++) { s = get_arg(dp, i); - d = get_arg(ret, i); switch(V_VT(s)) { case VT_I2: - V_VT(d) = VT_I4; - V_I4(d) = V_I2(s); + V_VT(argv+i) = VT_I4; + V_I4(argv+i) = V_I2(s); break; case VT_INT: - V_VT(d) = VT_I4; - V_I4(d) = V_INT(s); + V_VT(argv+i) = VT_I4; + V_I4(argv+i) = V_INT(s); break; default: - *d = *s; + argv[i] = *s; } } + *argc = cnt; + *ret = argv; return S_OK; } static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) { HRESULT hres; @@ -422,16 +366,17 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t set_disp(&vthis, jsthis); else set_jsdisp(&vthis, This); - hres = prop->u.p->invoke(This->ctx, &vthis, flags, dp, retv, ei); + hres = prop->u.p->invoke(This->ctx, &vthis, flags, argc, argv, retv, ei); vdisp_release(&vthis); }else { /* Function object calls are special case */ - hres = Function_invoke(This, jsthis, flags, dp, retv, ei); + hres = Function_invoke(This, jsthis, flags, argc, argv, retv, ei); } return hres; } case PROP_PROTREF: - return invoke_prop_func(This->prototype, jsthis, This->prototype->props+prop->u.ref, flags, dp, retv, ei, caller); + return invoke_prop_func(This->prototype, jsthis, This->prototype->props+prop->u.ref, + flags, argc, argv, retv, ei, caller); case PROP_VARIANT: { if(V_VT(&prop->u.var) != VT_DISPATCH) { FIXME("invoke vt %d\n", V_VT(&prop->u.var)); @@ -440,7 +385,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t TRACE("call %s %p\n", debugstr_w(prop->name), V_DISPATCH(&prop->u.var)); - return disp_call_value(This->ctx, V_DISPATCH(&prop->u.var), jsthis, flags, dp, retv, ei); + return disp_call_value(This->ctx, V_DISPATCH(&prop->u.var), jsthis, flags, argc, argv, retv, ei); } default: ERR("type %d\n", prop->type); @@ -470,7 +415,7 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, DISPPARAMS *dp, vdisp_t vthis; set_jsdisp(&vthis, This); - hres = prop->u.p->invoke(This->ctx, &vthis, DISPATCH_PROPERTYGET, dp, retv, ei); + hres = prop->u.p->invoke(This->ctx, &vthis, DISPATCH_PROPERTYGET, 0, NULL, retv, ei); vdisp_release(&vthis); } break; @@ -505,11 +450,10 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, VARIANT *val, switch(prop->type) { case PROP_BUILTIN: if(!(prop->flags & PROPF_METHOD)) { - DISPPARAMS dp = {val, NULL, 1, 0}; vdisp_t vthis; set_jsdisp(&vthis, This); - hres = prop->u.p->invoke(This->ctx, &vthis, DISPATCH_PROPERTYPUT, &dp, NULL, ei); + hres = prop->u.p->invoke(This->ctx, &vthis, DISPATCH_PROPERTYPUT, 1, val, NULL, ei); vdisp_release(&vthis); return hres; } @@ -733,16 +677,17 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc /* fall through */ case DISPATCH_METHOD: case DISPATCH_CONSTRUCT: { - DISPPARAMS params; + VARIANT *argv; + unsigned argc; VARIANT buf[6]; - hres = convert_params(pdp, buf, ¶ms); + hres = convert_params(pdp, buf, &argc, &argv); if(FAILED(hres)) return hres; - hres = invoke_prop_func(This, get_this(pdp), prop, wFlags, ¶ms, pvarRes, &jsexcept, pspCaller); - if(params.rgvarg != buf && params.rgvarg != pdp->rgvarg) - heap_free(params.rgvarg); + hres = invoke_prop_func(This, get_this(pdp), prop, wFlags, argc, argv, pvarRes, &jsexcept, pspCaller); + if(argv != buf) + heap_free(argv); break; } case DISPATCH_PROPERTYGET: @@ -1066,25 +1011,24 @@ HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID * return DISP_E_UNKNOWNNAME; } -HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) +HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, + jsexcept_t *ei) { HRESULT hres; - TRACE("args %p\n", dp->rgvarg); - if(is_class(jsfunc, JSCLASS_FUNCTION)) { - hres = Function_invoke(jsfunc, jsthis, flags, dp, retv, ei); + hres = Function_invoke(jsfunc, jsthis, flags, argc, argv, retv, ei); }else { vdisp_t vdisp; set_disp(&vdisp, jsthis); - hres = jsfunc->builtin_info->value_prop.invoke(jsfunc->ctx, &vdisp, flags, dp, retv, ei); + hres = jsfunc->builtin_info->value_prop.invoke(jsfunc->ctx, &vdisp, flags, argc, argv, retv, ei); vdisp_release(&vdisp); } return hres; } -HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) +HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { dispex_prop_t *prop; @@ -1096,10 +1040,10 @@ HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, DISPPARAMS *dp, VARIA if(!prop) return DISP_E_MEMBERNOTFOUND; - return invoke_prop_func(disp, to_disp(disp), prop, flags, dp, retv, ei, NULL); + return invoke_prop_func(disp, to_disp(disp), prop, flags, argc, argv, retv, ei, NULL); } -HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, DISPPARAMS *dp, VARIANT *retv, +HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { dispex_prop_t *prop; @@ -1113,13 +1057,17 @@ HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, DISPPARA if(retv) V_VT(retv) = VT_EMPTY; - return invoke_prop_func(disp, to_disp(disp), prop, flags, dp, retv, ei, NULL); + return invoke_prop_func(disp, to_disp(disp), prop, flags, argc, argv, retv, ei, NULL); } -HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) +HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, unsigned argc, VARIANT *argv, + VARIANT *retv, jsexcept_t *ei) { - jsdisp_t *jsdisp; IDispatchEx *dispex; + jsdisp_t *jsdisp; + VARIANT buf[6]; + DISPPARAMS dp; + unsigned i; HRESULT hres; jsdisp = iface_to_jsdisp((IUnknown*)disp); @@ -1129,20 +1077,44 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DIS return E_FAIL; } - hres = jsdisp_call(jsdisp, id, flags, dp, retv, ei); + hres = jsdisp_call(jsdisp, id, flags, argc, argv, retv, ei); jsdisp_release(jsdisp); return hres; } memset(ei, 0, sizeof(*ei)); - if(retv && arg_cnt(dp)) + if(retv && argc) flags |= DISPATCH_PROPERTYGET; + dp.cArgs = argc; + + if(flags & DISPATCH_PROPERTYPUT) { + static DISPID propput_dispid = DISPID_PROPERTYPUT; + + dp.cNamedArgs = 1; + dp.rgdispidNamedArgs = &propput_dispid; + }else { + dp.cNamedArgs = 0; + dp.rgdispidNamedArgs = NULL; + } + + if(argc > 6) { + dp.rgvarg = heap_alloc(argc*sizeof(VARIANT)); + if(!dp.rgvarg) + return E_OUTOFMEMORY; + }else { + dp.rgvarg = buf; + } + + for(i=0; ilcid, flags, dp, retv, &ei->ei, &ctx->jscaller->IServiceProvider_iface); + hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, &dp, retv, &ei->ei, &ctx->jscaller->IServiceProvider_iface); IDispatchEx_Release(dispex); }else { UINT err = 0; @@ -1153,9 +1125,11 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DIS } TRACE("using IDispatch\n"); - hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, dp, retv, &ei->ei, &err); + hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, &dp, retv, &ei->ei, &err); } + if(dp.rgvarg != buf) + heap_free(dp.rgvarg); if(FAILED(hres)) return hres; @@ -1164,12 +1138,14 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DIS return S_OK; } -HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, WORD flags, DISPPARAMS *dp, +HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { - DISPPARAMS params; jsdisp_t *jsdisp; IDispatchEx *dispex; + VARIANT buf[6]; + DISPPARAMS dp; + unsigned i; HRESULT hres; jsdisp = iface_to_jsdisp((IUnknown*)disp); @@ -1179,28 +1155,48 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W return E_FAIL; } - hres = jsdisp_call_value(jsdisp, jsthis, flags, dp, retv, ei); + hres = jsdisp_call_value(jsdisp, jsthis, flags, argc, argv, retv, ei); jsdisp_release(jsdisp); return hres; } memset(ei, 0, sizeof(*ei)); - if(retv && arg_cnt(dp)) + if(retv && argc) flags |= DISPATCH_PROPERTYGET; + if(jsthis) { - hres = set_this(¶ms, dp, jsthis); - if(FAILED(hres)) - return hres; + static DISPID this_id = DISPID_THIS; + + dp.cArgs = argc+1; + dp.cNamedArgs = 1; + dp.rgdispidNamedArgs = &this_id; }else { - params = *dp; + dp.cArgs = argc; + dp.cNamedArgs = 0; + dp.rgdispidNamedArgs = NULL; + } + + if(dp.cArgs > sizeof(buf)/sizeof(*buf)) { + dp.rgvarg = heap_alloc(dp.cArgs*sizeof(VARIANT)); + if(!dp.rgvarg) + return E_OUTOFMEMORY; + }else { + dp.rgvarg = buf; + } + + for(i=0; ilcid, flags, ¶ms, retv, &ei->ei, + hres = IDispatchEx_InvokeEx(dispex, DISPID_VALUE, ctx->lcid, flags, &dp, retv, &ei->ei, &ctx->jscaller->IServiceProvider_iface); IDispatchEx_Release(dispex); }else { @@ -1212,15 +1208,11 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W } TRACE("using IDispatch\n"); - hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, ctx->lcid, flags, ¶ms, retv, &ei->ei, &err); - } - - if(params.rgvarg != dp->rgvarg) { - heap_free(params.rgvarg); - if(params.cNamedArgs > 1) - heap_free(params.rgdispidNamedArgs); + hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, ctx->lcid, flags, &dp, retv, &ei->ei, &err); } + if(dp.rgvarg != buf) + heap_free(dp.rgvarg); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 3b20e6aede4..e6c26462b45 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -133,6 +133,14 @@ static inline VARIANT *stack_topn(exec_ctx_t *ctx, unsigned n) return ctx->stack + ctx->top-1-n; } +static inline VARIANT *stack_args(exec_ctx_t *ctx, unsigned n) +{ + if(!n) + return NULL; + assert(ctx->top > n-1); + return ctx->stack + ctx->top-n; +} + static inline VARIANT *stack_pop(exec_ctx_t *ctx) { assert(ctx->top); @@ -972,32 +980,11 @@ static HRESULT interp_refval(exec_ctx_t *ctx) return stack_push(ctx, &v); } -static void jsstack_to_dp(exec_ctx_t *ctx, unsigned arg_cnt, DISPPARAMS *dp) -{ - VARIANT tmp; - unsigned i; - - dp->cArgs = arg_cnt; - dp->rgdispidNamedArgs = NULL; - dp->cNamedArgs = 0; - - assert(ctx->top >= arg_cnt); - - for(i=1; i*2 <= arg_cnt; i++) { - tmp = ctx->stack[ctx->top-i]; - ctx->stack[ctx->top-i] = ctx->stack[ctx->top-arg_cnt+i-1]; - ctx->stack[ctx->top-arg_cnt+i-1] = tmp; - } - - dp->rgvarg = ctx->stack + ctx->top-arg_cnt; -} - /* ECMA-262 3rd Edition 11.2.2 */ static HRESULT interp_new(exec_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); VARIANT *constr, v; - DISPPARAMS dp; HRESULT hres; TRACE("%d\n", arg); @@ -1013,8 +1000,7 @@ static HRESULT interp_new(exec_ctx_t *ctx) else if(!V_DISPATCH(constr)) return throw_type_error(ctx->script, ctx->ei, JS_E_INVALID_PROPERTY, NULL); - jsstack_to_dp(ctx, arg, &dp); - hres = disp_call_value(ctx->script, V_DISPATCH(constr), NULL, DISPATCH_CONSTRUCT, &dp, &v, ctx->ei); + hres = disp_call_value(ctx->script, V_DISPATCH(constr), NULL, DISPATCH_CONSTRUCT, arg, stack_args(ctx, arg), &v, ctx->ei); if(FAILED(hres)) return hres; @@ -1028,7 +1014,6 @@ static HRESULT interp_call(exec_ctx_t *ctx) const unsigned argn = get_op_uint(ctx, 0); const int do_ret = get_op_int(ctx, 1); VARIANT v, *objv; - DISPPARAMS dp; HRESULT hres; TRACE("%d %d\n", argn, do_ret); @@ -1037,8 +1022,7 @@ static HRESULT interp_call(exec_ctx_t *ctx) if(V_VT(objv) != VT_DISPATCH) return throw_type_error(ctx->script, ctx->ei, JS_E_INVALID_PROPERTY, NULL); - jsstack_to_dp(ctx, argn, &dp); - hres = disp_call_value(ctx->script, V_DISPATCH(objv), NULL, DISPATCH_METHOD, &dp, + hres = disp_call_value(ctx->script, V_DISPATCH(objv), NULL, DISPATCH_METHOD, argn, stack_args(ctx, argn), do_ret ? &v : NULL, ctx->ei); if(FAILED(hres)) return hres; @@ -1054,7 +1038,6 @@ static HRESULT interp_call_member(exec_ctx_t *ctx) const unsigned argn = get_op_uint(ctx, 0); const int do_ret = get_op_int(ctx, 1); IDispatch *obj; - DISPPARAMS dp; VARIANT v; DISPID id; HRESULT hres; @@ -1065,8 +1048,7 @@ static HRESULT interp_call_member(exec_ctx_t *ctx) if(!obj) return throw_type_error(ctx->script, ctx->ei, id, NULL); - jsstack_to_dp(ctx, argn, &dp); - hres = disp_call(ctx->script, obj, id, DISPATCH_METHOD, &dp, do_ret ? &v : NULL, ctx->ei); + hres = disp_call(ctx->script, obj, id, DISPATCH_METHOD, argn, stack_args(ctx, argn), do_ret ? &v : NULL, ctx->ei); if(FAILED(hres)) return hres; @@ -2398,9 +2380,7 @@ static HRESULT interp_assign(exec_ctx_t *ctx) static HRESULT interp_assign_call(exec_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); - DISPID propput_dispid = DISPID_PROPERTYPUT; IDispatch *disp; - DISPPARAMS dp; VARIANT *v; DISPID id; HRESULT hres; @@ -2411,10 +2391,7 @@ static HRESULT interp_assign_call(exec_ctx_t *ctx) if(!disp) return throw_reference_error(ctx->script, ctx->ei, JS_E_ILLEGAL_ASSIGN, NULL); - jsstack_to_dp(ctx, arg+1, &dp); - dp.cNamedArgs = 1; - dp.rgdispidNamedArgs = &propput_dispid; - hres = disp_call(ctx->script, disp, id, DISPATCH_PROPERTYPUT, &dp, NULL, ctx->ei); + hres = disp_call(ctx->script, disp, id, DISPATCH_PROPERTYPUT, arg+1, stack_args(ctx,arg+1), NULL, ctx->ei); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 31117149b40..aa948c685b7 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -35,7 +35,7 @@ static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0}; /* ECMA-262 3rd Edition 15.11.4.4 */ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *jsthis; BSTR name = NULL, msg = NULL, ret = NULL; @@ -127,7 +127,7 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, } static HRESULT Error_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -226,28 +226,28 @@ static HRESULT create_error(script_ctx_t *ctx, jsdisp_t *constr, return S_OK; } -static HRESULT error_constr(script_ctx_t *ctx, WORD flags, DISPPARAMS *dp, +static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei, jsdisp_t *constr) { jsdisp_t *err; UINT num = 0; BSTR msg = NULL; HRESULT hres; - if(arg_cnt(dp)) { + if(argc) { double n; - hres = to_number(ctx, get_arg(dp, 0), ei, &n); + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) /* FIXME: really? */ n = NAN; if(isnan(n)) - hres = to_string(ctx, get_arg(dp, 0), ei, &msg); + hres = to_string(ctx, argv, ei, &msg); if(FAILED(hres)) return hres; num = n; } - if(arg_cnt(dp)>1 && !msg) { - hres = to_string(ctx, get_arg(dp, 1), ei, &msg); + if(argc>1 && !msg) { + hres = to_string(ctx, argv+1, ei, &msg); if(FAILED(hres)) return hres; } @@ -275,59 +275,59 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, DISPPARAMS *dp, } static HRESULT ErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return error_constr(ctx, flags, dp, retv, ei, ctx->error_constr); + return error_constr(ctx, flags, argc, argv, retv, ei, ctx->error_constr); } static HRESULT EvalErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return error_constr(ctx, flags, dp, retv, ei, ctx->eval_error_constr); + return error_constr(ctx, flags, argc, argv, retv, ei, ctx->eval_error_constr); } static HRESULT RangeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return error_constr(ctx, flags, dp, retv, ei, ctx->range_error_constr); + return error_constr(ctx, flags, argc, argv, retv, ei, ctx->range_error_constr); } static HRESULT ReferenceErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return error_constr(ctx, flags, dp, retv, ei, ctx->reference_error_constr); + return error_constr(ctx, flags, argc, argv, retv, ei, ctx->reference_error_constr); } static HRESULT RegExpErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return error_constr(ctx, flags, dp, retv, ei, ctx->regexp_error_constr); + return error_constr(ctx, flags, argc, argv, retv, ei, ctx->regexp_error_constr); } static HRESULT SyntaxErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return error_constr(ctx, flags, dp, retv, ei, ctx->syntax_error_constr); + return error_constr(ctx, flags, argc, argv, retv, ei, ctx->syntax_error_constr); } static HRESULT TypeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return error_constr(ctx, flags, dp, retv, ei, ctx->type_error_constr); + return error_constr(ctx, flags, argc, argv, retv, ei, ctx->type_error_constr); } static HRESULT URIErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return error_constr(ctx, flags, dp, retv, ei, ctx->uri_error_constr); + return error_constr(ctx, flags, argc, argv, retv, ei, ctx->uri_error_constr); } HRESULT init_error_constr(script_ctx_t *ctx, jsdisp_t *object_prototype) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 5cde865725b..618831b4a97 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -55,37 +55,18 @@ static const WCHAR applyW[] = {'a','p','p','l','y',0}; static const WCHAR callW[] = {'c','a','l','l',0}; static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0}; -static IDispatch *get_this(DISPPARAMS *dp) -{ - DWORD i; - - for(i=0; i < dp->cNamedArgs; i++) { - if(dp->rgdispidNamedArgs[i] == DISPID_THIS) { - if(V_VT(dp->rgvarg+i) == VT_DISPATCH) - return V_DISPATCH(dp->rgvarg+i); - - WARN("This is not VT_DISPATCH\n"); - return NULL; - } - } - - TRACE("no this passed\n"); - return NULL; -} - -static HRESULT init_parameters(jsdisp_t *var_disp, FunctionInstance *function, DISPPARAMS *dp, +static HRESULT init_parameters(jsdisp_t *var_disp, FunctionInstance *function, unsigned argc, VARIANT *argv, jsexcept_t *ei) { VARIANT var_empty; - DWORD cargs, i=0; + DWORD i=0; HRESULT hres; V_VT(&var_empty) = VT_EMPTY; - cargs = arg_cnt(dp); for(i=0; i < function->func_code->param_cnt; i++) { hres = jsdisp_propput_name(var_disp, function->func_code->params[i], - i < cargs ? get_arg(dp,i) : &var_empty, ei); + i < argc ? argv+i : &var_empty, ei); if(FAILED(hres)) return hres; } @@ -93,7 +74,7 @@ static HRESULT init_parameters(jsdisp_t *var_disp, FunctionInstance *function, D return S_OK; } -static HRESULT Arguments_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Arguments_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); @@ -108,7 +89,7 @@ static const builtin_info_t Arguments_info = { NULL }; -static HRESULT create_arguments(script_ctx_t *ctx, IDispatch *calee, DISPPARAMS *dp, +static HRESULT create_arguments(script_ctx_t *ctx, IDispatch *calee, unsigned argc, VARIANT *argv, jsexcept_t *ei, jsdisp_t **ret) { jsdisp_t *args; @@ -128,14 +109,14 @@ static HRESULT create_arguments(script_ctx_t *ctx, IDispatch *calee, DISPPARAMS return hres; } - for(i=0; i < arg_cnt(dp); i++) { - hres = jsdisp_propput_idx(args, i, get_arg(dp,i), ei); + for(i=0; i < argc; i++) { + hres = jsdisp_propput_idx(args, i, argv+i, ei); if(FAILED(hres)) break; } if(SUCCEEDED(hres)) { - num_set_int(&var, arg_cnt(dp)); + num_set_int(&var, argc); hres = jsdisp_propput_name(args, lengthW, &var, ei); if(SUCCEEDED(hres)) { @@ -155,7 +136,7 @@ static HRESULT create_arguments(script_ctx_t *ctx, IDispatch *calee, DISPPARAMS } static HRESULT create_var_disp(script_ctx_t *ctx, FunctionInstance *function, jsdisp_t *arg_disp, - DISPPARAMS *dp, jsexcept_t *ei, jsdisp_t **ret) + unsigned argc, VARIANT *argv, jsexcept_t *ei, jsdisp_t **ret) { jsdisp_t *var_disp; VARIANT var; @@ -168,7 +149,7 @@ static HRESULT create_var_disp(script_ctx_t *ctx, FunctionInstance *function, js var_set_jsdisp(&var, arg_disp); hres = jsdisp_propput_name(var_disp, argumentsW, &var, ei); if(SUCCEEDED(hres)) - hres = init_parameters(var_disp, function, dp, ei); + hres = init_parameters(var_disp, function, argc, argv, ei); if(FAILED(hres)) { jsdisp_release(var_disp); return hres; @@ -178,7 +159,7 @@ static HRESULT create_var_disp(script_ctx_t *ctx, FunctionInstance *function, js return S_OK; } -static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, DISPPARAMS *dp, +static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *var_disp, *arg_disp; @@ -191,11 +172,11 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis return E_FAIL; } - hres = create_arguments(ctx, to_disp(&function->dispex), dp, ei, &arg_disp); + hres = create_arguments(ctx, to_disp(&function->dispex), argc, argv, ei, &arg_disp); if(FAILED(hres)) return hres; - hres = create_var_disp(ctx, function, arg_disp, dp, ei, &var_disp); + hres = create_var_disp(ctx, function, arg_disp, argc, argv, ei, &var_disp); if(FAILED(hres)) { jsdisp_release(arg_disp); return hres; @@ -222,7 +203,7 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis return hres; } -static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function, DISPPARAMS *dp, +static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *this_obj; @@ -233,7 +214,7 @@ static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function, if(FAILED(hres)) return hres; - hres = invoke_source(ctx, function, to_disp(this_obj), dp, &var, ei); + hres = invoke_source(ctx, function, to_disp(this_obj), argc, argv, &var, ei); if(FAILED(hres)) { jsdisp_release(this_obj); return hres; @@ -250,7 +231,7 @@ static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function, return S_OK; } -static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, WORD flags, DISPPARAMS *dp, +static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { vdisp_t vthis; @@ -263,19 +244,19 @@ static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, else set_jsdisp(&vthis, ctx->global); - hres = function->value_proc(ctx, &vthis, flags, dp, retv, ei); + hres = function->value_proc(ctx, &vthis, flags, argc, argv, retv, ei); vdisp_release(&vthis); return hres; } -static HRESULT call_function(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, DISPPARAMS *args, - VARIANT *retv, jsexcept_t *ei) +static HRESULT call_function(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { if(function->value_proc) - return invoke_value_proc(ctx, function, this_obj, DISPATCH_METHOD, args, retv, ei); + return invoke_value_proc(ctx, function, this_obj, DISPATCH_METHOD, argc, argv, retv, ei); - return invoke_source(ctx, function, this_obj, args, retv, ei); + return invoke_source(ctx, function, this_obj, argc, argv, retv, ei); } static HRESULT function_to_string(FunctionInstance *function, BSTR *ret) @@ -307,7 +288,7 @@ static HRESULT function_to_string(FunctionInstance *function, BSTR *ret) return S_OK; } -HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) +HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FunctionInstance *function; @@ -317,16 +298,16 @@ HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, DISP function = (FunctionInstance*)func_this; if(function->value_proc) - return invoke_value_proc(function->dispex.ctx, function, jsthis, flags, dp, retv, ei); + return invoke_value_proc(function->dispex.ctx, function, jsthis, flags, argc, argv, retv, ei); if(flags == DISPATCH_CONSTRUCT) - return invoke_constructor(function->dispex.ctx, function, dp, retv, ei); + return invoke_constructor(function->dispex.ctx, function, argc, argv, retv, ei); assert(flags == DISPATCH_METHOD); - return invoke_source(function->dispex.ctx, function, jsthis, dp, retv, ei); + return invoke_source(function->dispex.ctx, function, jsthis, argc, argv, retv, ei); } -static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FunctionInstance *This = function_from_vdisp(jsthis); @@ -345,7 +326,7 @@ static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D return S_OK; } -static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FunctionInstance *function; @@ -370,7 +351,7 @@ static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, return S_OK; } -static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t *ei, DISPPARAMS *args) +static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t *ei, unsigned *argc, VARIANT **ret) { VARIANT var, *argv; DWORD length, i; @@ -401,17 +382,17 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, jsexcept_t } } - args->cArgs = length; - args->rgvarg = argv; + *argc = length; + *ret = argv; return S_OK; } -static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FunctionInstance *function; - DISPPARAMS args = {NULL,NULL,0,0}; - DWORD argc, i; + VARIANT *args = NULL; + unsigned i, cnt = 0; IDispatch *this_obj = NULL; HRESULT hres = S_OK; @@ -420,12 +401,9 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI if(!(function = function_this(jsthis))) return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL); - argc = arg_cnt(dp); if(argc) { - VARIANT *v = get_arg(dp,0); - - if(V_VT(v) != VT_EMPTY && V_VT(v) != VT_NULL) { - hres = to_object(ctx, v, &this_obj); + if(V_VT(argv) != VT_EMPTY && V_VT(argv) != VT_NULL) { + hres = to_object(ctx, argv, &this_obj); if(FAILED(hres)) return hres; } @@ -434,8 +412,8 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI if(argc >= 2) { jsdisp_t *arg_array = NULL; - if(V_VT(get_arg(dp,1)) == VT_DISPATCH) { - arg_array = iface_to_jsdisp((IUnknown*)V_DISPATCH(get_arg(dp,1))); + if(V_VT(argv+1) == VT_DISPATCH) { + arg_array = iface_to_jsdisp((IUnknown*)V_DISPATCH(argv+1)); if(arg_array && (!is_class(arg_array, JSCLASS_ARRAY) && !is_class(arg_array, JSCLASS_ARGUMENTS) )) { jsdisp_release(arg_array); @@ -444,7 +422,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI } if(arg_array) { - hres = array_to_args(ctx, arg_array, ei, &args); + hres = array_to_args(ctx, arg_array, ei, &cnt, &args); jsdisp_release(arg_array); }else { FIXME("throw TypeError\n"); @@ -453,23 +431,22 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI } if(SUCCEEDED(hres)) - hres = call_function(ctx, function, this_obj, &args, retv, ei); + hres = call_function(ctx, function, this_obj, cnt, args, retv, ei); if(this_obj) IDispatch_Release(this_obj); - for(i=0; irgvarg + dp->cArgs - args.cArgs-1; - - hres = call_function(ctx, function, this_obj, &args, retv, ei); + hres = call_function(ctx, function, this_obj, cnt, argv+1, retv, ei); if(this_obj) IDispatch_Release(this_obj); return hres; } -HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FunctionInstance *function; @@ -516,10 +487,8 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAM switch(flags) { case DISPATCH_METHOD: - if(function->value_proc) - return invoke_value_proc(ctx, function, get_this(dp), flags, dp, retv, ei); - - return invoke_source(ctx, function, get_this(dp), dp, retv, ei); + assert(function->value_proc != NULL); + return invoke_value_proc(ctx, function, NULL, flags, argc, argv, retv, ei); case DISPATCH_PROPERTYGET: { HRESULT hres; @@ -535,10 +504,8 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAM } case DISPATCH_CONSTRUCT: - if(function->value_proc) - return invoke_value_proc(ctx, function, get_this(dp), flags, dp, retv, ei); - - return invoke_constructor(ctx, function, dp, retv, ei); + assert(function->value_proc != NULL); + return invoke_value_proc(ctx, function, NULL, flags, argc, argv, retv, ei); default: FIXME("not implemented flags %x\n", flags); @@ -549,7 +516,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAM } static HRESULT Function_arguments(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FunctionInstance *function = (FunctionInstance*)jsthis->u.jsdisp; HRESULT hres = S_OK; @@ -707,10 +674,10 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod return S_OK; } -static HRESULT construct_function(script_ctx_t *ctx, DISPPARAMS *dp, jsexcept_t *ei, IDispatch **ret) +static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, VARIANT *argv, jsexcept_t *ei, IDispatch **ret) { WCHAR *str = NULL, *ptr; - DWORD argc, len = 0, l; + DWORD len = 0, l; bytecode_t *code; jsdisp_t *function; BSTR *params = NULL; @@ -721,7 +688,6 @@ static HRESULT construct_function(script_ctx_t *ctx, DISPPARAMS *dp, jsexcept_t static const WCHAR function_beginW[] = {')',' ','{','\n'}; static const WCHAR function_endW[] = {'\n','}',0}; - argc = arg_cnt(dp); if(argc) { params = heap_alloc(argc*sizeof(BSTR)); if(!params) @@ -730,7 +696,7 @@ static HRESULT construct_function(script_ctx_t *ctx, DISPPARAMS *dp, jsexcept_t if(argc > 2) len = (argc-2)*2; /* separating commas */ for(i=0; i < argc; i++) { - hres = to_string(ctx, get_arg(dp,i), ei, params+i); + hres = to_string(ctx, argv+i, ei, params+i); if(FAILED(hres)) break; len += SysStringLen(params[i]); @@ -795,7 +761,7 @@ static HRESULT construct_function(script_ctx_t *ctx, DISPPARAMS *dp, jsexcept_t return S_OK; } -static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { HRESULT hres; @@ -806,7 +772,7 @@ static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla case DISPATCH_CONSTRUCT: { IDispatch *ret; - hres = construct_function(ctx, dp, ei, &ret); + hres = construct_function(ctx, argc, argv, ei, &ret); if(FAILED(hres)) return hres; @@ -822,7 +788,7 @@ static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla return S_OK; } -static HRESULT FunctionProt_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT FunctionProt_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c index ce1c5411823..f50debf63a1 100644 --- a/dlls/jscript/global.c +++ b/dlls/jscript/global.c @@ -113,161 +113,161 @@ static WCHAR int_to_char(int i) return 'A'+i-10; } -static HRESULT constructor_call(jsdisp_t *constr, WORD flags, DISPPARAMS *dp, +static HRESULT constructor_call(jsdisp_t *constr, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { if(flags != DISPATCH_PROPERTYGET) - return jsdisp_call_value(constr, NULL, flags, dp, retv, ei); + return jsdisp_call_value(constr, NULL, flags, argc, argv, retv, ei); jsdisp_addref(constr); var_set_jsdisp(retv, constr); return S_OK; } -static HRESULT JSGlobal_Array(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_Array(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->array_constr, flags, dp, retv, ei); + return constructor_call(ctx->array_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_Boolean(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_Boolean(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->bool_constr, flags, dp, retv, ei); + return constructor_call(ctx->bool_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_Date(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_Date(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->date_constr, flags, dp, retv, ei); + return constructor_call(ctx->date_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_Error(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_Error(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->error_constr, flags, dp, retv, ei); + return constructor_call(ctx->error_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_EvalError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_EvalError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->eval_error_constr, flags, dp, retv, ei); + return constructor_call(ctx->eval_error_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_RangeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_RangeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->range_error_constr, flags, dp, retv, ei); + return constructor_call(ctx->range_error_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_ReferenceError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_ReferenceError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->reference_error_constr, flags, dp, retv, ei); + return constructor_call(ctx->reference_error_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_SyntaxError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_SyntaxError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->syntax_error_constr, flags, dp, retv, ei); + return constructor_call(ctx->syntax_error_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_TypeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_TypeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->type_error_constr, flags, dp, retv, ei); + return constructor_call(ctx->type_error_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_URIError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_URIError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->uri_error_constr, flags, dp, retv, ei); + return constructor_call(ctx->uri_error_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_Function(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_Function(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->function_constr, flags, dp, retv, ei); + return constructor_call(ctx->function_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_Number(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_Number(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->number_constr, flags, dp, retv, ei); + return constructor_call(ctx->number_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_Object(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_Object(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->object_constr, flags, dp, retv, ei); + return constructor_call(ctx->object_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_String(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_String(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->string_constr, flags, dp, retv, ei); + return constructor_call(ctx->string_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->regexp_constr, flags, dp, retv, ei); + return constructor_call(ctx->regexp_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->activex_constr, flags, dp, retv, ei); + return constructor_call(ctx->activex_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_VBArray(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_VBArray(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); - return constructor_call(ctx->vbarray_constr, flags, dp, retv, ei); + return constructor_call(ctx->vbarray_constr, flags, argc, argv, retv, ei); } -static HRESULT JSGlobal_Enumerator(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_Enumerator(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR ret, str; @@ -277,7 +277,7 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) { ret = SysAllocString(undefinedW); if(!ret) @@ -290,7 +290,7 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D return S_OK; } - hres = to_string(ctx, get_arg(dp, 0), ei, &str); + hres = to_string(ctx, argv, ei, &str); if(FAILED(hres)) return hres; @@ -341,26 +341,24 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D } /* ECMA-262 3rd Edition 15.1.2.1 */ -static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { bytecode_t *code; - VARIANT *arg; HRESULT hres; TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) V_VT(retv) = VT_EMPTY; return S_OK; } - arg = get_arg(dp, 0); - if(V_VT(arg) != VT_BSTR) { + if(V_VT(argv) != VT_BSTR) { if(retv) { V_VT(retv) = VT_EMPTY; - return VariantCopy(retv, arg); + return VariantCopy(retv, argv); } return S_OK; } @@ -370,10 +368,10 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS return E_UNEXPECTED; } - TRACE("parsing %s\n", debugstr_w(V_BSTR(arg))); - hres = compile_script(ctx, V_BSTR(arg), NULL, TRUE, FALSE, &code); + TRACE("parsing %s\n", debugstr_w(V_BSTR(argv))); + hres = compile_script(ctx, V_BSTR(argv), NULL, TRUE, FALSE, &code); if(FAILED(hres)) { - WARN("parse (%s) failed: %08x\n", debugstr_w(V_BSTR(arg)), hres); + WARN("parse (%s) failed: %08x\n", debugstr_w(V_BSTR(argv)), hres); return throw_syntax_error(ctx, ei, hres, NULL); } @@ -383,7 +381,7 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS return hres; } -static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { VARIANT_BOOL ret = VARIANT_TRUE; @@ -392,8 +390,8 @@ static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI TRACE("\n"); - if(arg_cnt(dp)) { - hres = to_number(ctx, get_arg(dp,0), ei, &n); + if(argc) { + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) return hres; @@ -408,7 +406,7 @@ static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI return S_OK; } -static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { VARIANT_BOOL ret = VARIANT_FALSE; @@ -416,10 +414,10 @@ static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, TRACE("\n"); - if(arg_cnt(dp)) { + if(argc) { double n; - hres = to_number(ctx, get_arg(dp,0), ei, &n); + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) return hres; @@ -445,7 +443,7 @@ static INT char_to_int(WCHAR c) return 100; } -static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BOOL neg = FALSE, empty = TRUE; @@ -455,13 +453,13 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, BSTR str; HRESULT hres; - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - if(arg_cnt(dp) >= 2) { - hres = to_int32(ctx, get_arg(dp, 1), ei, &radix); + if(argc >= 2) { + hres = to_int32(ctx, argv+1, ei, &radix); if(FAILED(hres)) return hres; @@ -473,7 +471,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } } - hres = to_string(ctx, get_arg(dp, 0), ei, &str); + hres = to_string(ctx, argv, ei, &str); if(FAILED(hres)) return hres; @@ -524,25 +522,23 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, return S_OK; } -static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { LONGLONG d = 0, hlp; int exp = 0; - VARIANT *arg; WCHAR *str; BSTR val_str = NULL; BOOL ret_nan = TRUE, positive = TRUE; HRESULT hres; - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - arg = get_arg(dp, 0); - hres = to_string(ctx, arg, ei, &val_str); + hres = to_string(ctx, argv, ei, &val_str); if(FAILED(hres)) return hres; @@ -633,7 +629,7 @@ static inline int hex_to_int(const WCHAR wch) { return -1; } -static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR ret, str; @@ -643,7 +639,7 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) { ret = SysAllocString(undefinedW); if(!ret) @@ -656,7 +652,7 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, return S_OK; } - hres = to_string(ctx, get_arg(dp, 0), ei, &str); + hres = to_string(ctx, argv, ei, &str); if(FAILED(hres)) return hres; @@ -712,14 +708,14 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, return S_OK; } -static HRESULT JSGlobal_GetObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_GetObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT JSGlobal_ScriptEngine(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_ScriptEngine(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR JScriptW[] = {'J','S','c','r','i','p','t',0}; @@ -740,7 +736,7 @@ static HRESULT JSGlobal_ScriptEngine(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl return S_OK; } -static HRESULT JSGlobal_ScriptEngineMajorVersion(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_ScriptEngineMajorVersion(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -750,7 +746,7 @@ static HRESULT JSGlobal_ScriptEngineMajorVersion(script_ctx_t *ctx, vdisp_t *jst return S_OK; } -static HRESULT JSGlobal_ScriptEngineMinorVersion(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_ScriptEngineMinorVersion(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -760,7 +756,7 @@ static HRESULT JSGlobal_ScriptEngineMinorVersion(script_ctx_t *ctx, vdisp_t *jst return S_OK; } -static HRESULT JSGlobal_ScriptEngineBuildVersion(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_ScriptEngineBuildVersion(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -770,14 +766,14 @@ static HRESULT JSGlobal_ScriptEngineBuildVersion(script_ctx_t *ctx, vdisp_t *jst return S_OK; } -static HRESULT JSGlobal_CollectGarbage(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_CollectGarbage(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { const WCHAR *ptr; @@ -789,7 +785,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) { ret = SysAllocString(undefinedW); if(!ret) @@ -802,7 +798,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags return S_OK; } - hres = to_string(ctx, get_arg(dp,0), ei, &str); + hres = to_string(ctx, argv, ei, &str); if(FAILED(hres)) return hres; @@ -851,7 +847,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags return S_OK; } -static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR str, ret; @@ -863,7 +859,7 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) { ret = SysAllocString(undefinedW); if(!ret) @@ -876,7 +872,7 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags return S_OK; } - hres = to_string(ctx, get_arg(dp,0), ei, &str); + hres = to_string(ctx, argv, ei, &str); if(FAILED(hres)) return hres; @@ -947,7 +943,7 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags return S_OK; } -static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR str, ret; @@ -958,7 +954,7 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) { ret = SysAllocString(undefinedW); if(!ret) @@ -971,7 +967,7 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W return S_OK; } - hres = to_string(ctx, get_arg(dp, 0), ei, &str); + hres = to_string(ctx, argv, ei, &str); if(FAILED(hres)) return hres; @@ -1021,7 +1017,7 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W } /* ECMA-262 3rd Edition 15.1.3.2 */ -static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR str, ret; @@ -1032,7 +1028,7 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) { ret = SysAllocString(undefinedW); if(!ret) @@ -1045,7 +1041,7 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W return S_OK; } - hres = to_string(ctx, get_arg(dp, 0), ei, &str); + hres = to_string(ctx, argv, ei, &str); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index b1366518c2a..f36dcf33077 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -152,7 +152,7 @@ static inline jsdisp_t *get_jsdisp(vdisp_t *vdisp) return is_jsdisp(vdisp) ? vdisp->u.jsdisp : NULL; } -typedef HRESULT (*builtin_invoke_t)(script_ctx_t*,vdisp_t*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*); +typedef HRESULT (*builtin_invoke_t)(script_ctx_t*,vdisp_t*,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*); typedef struct { const WCHAR *name; @@ -206,11 +206,11 @@ HRESULT create_dispex(script_ctx_t*,const builtin_info_t*,jsdisp_t*,jsdisp_t**) HRESULT init_dispex(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*) DECLSPEC_HIDDEN; HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*) DECLSPEC_HIDDEN; -HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; -HRESULT disp_call_value(script_ctx_t*,IDispatch*,IDispatch*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; -HRESULT jsdisp_call_value(jsdisp_t*,IDispatch*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; -HRESULT jsdisp_call(jsdisp_t*,DISPID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; -HRESULT jsdisp_call_name(jsdisp_t*,const WCHAR*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; +HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; +HRESULT disp_call_value(script_ctx_t*,IDispatch*,IDispatch*,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; +HRESULT jsdisp_call_value(jsdisp_t*,IDispatch*,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; +HRESULT jsdisp_call(jsdisp_t*,DISPID,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; +HRESULT jsdisp_call_name(jsdisp_t*,const WCHAR*,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; HRESULT disp_propget(script_ctx_t*,IDispatch*,DISPID,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; HRESULT jsdisp_propget(jsdisp_t*,DISPID,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; @@ -225,8 +225,8 @@ VARIANT_BOOL jsdisp_is_own_prop(jsdisp_t *obj, BSTR name) DECLSPEC_HIDDEN; HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD, jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN; -HRESULT Function_value(script_ctx_t*,vdisp_t*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; -HRESULT Function_invoke(jsdisp_t*,IDispatch*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*); +HRESULT Function_value(script_ctx_t*,vdisp_t*,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN; +HRESULT Function_invoke(jsdisp_t*,IDispatch*,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*); HRESULT throw_eval_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN; HRESULT throw_generic_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*) DECLSPEC_HIDDEN; diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index fbc82e7a2aa..0e8e3047c61 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -203,7 +203,6 @@ HRESULT to_primitive(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret case VT_DISPATCH: { jsdisp_t *jsdisp; DISPID id; - DISPPARAMS dp = {NULL, NULL, 0, 0}; HRESULT hres; static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0}; @@ -227,7 +226,7 @@ HRESULT to_primitive(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret hres = jsdisp_get_id(jsdisp, hint == HINT_STRING ? toStringW : valueOfW, 0, &id); if(SUCCEEDED(hres)) { - hres = jsdisp_call(jsdisp, id, DISPATCH_METHOD, &dp, ret, ei); + hres = jsdisp_call(jsdisp, id, DISPATCH_METHOD, 0, NULL, ret, ei); if(FAILED(hres)) { WARN("call error - forwarding exception\n"); jsdisp_release(jsdisp); @@ -243,7 +242,7 @@ HRESULT to_primitive(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret hres = jsdisp_get_id(jsdisp, hint == HINT_STRING ? valueOfW : toStringW, 0, &id); if(SUCCEEDED(hres)) { - hres = jsdisp_call(jsdisp, id, DISPATCH_METHOD, &dp, ret, ei); + hres = jsdisp_call(jsdisp, id, DISPATCH_METHOD, 0, NULL, ret, ei); if(FAILED(hres)) { WARN("call error - forwarding exception\n"); jsdisp_release(jsdisp); diff --git a/dlls/jscript/math.c b/dlls/jscript/math.c index d0eab57fc88..658ce7b9c12 100644 --- a/dlls/jscript/math.c +++ b/dlls/jscript/math.c @@ -58,7 +58,7 @@ static const WCHAR sqrtW[] = {'s','q','r','t',0}; static const WCHAR tanW[] = {'t','a','n',0}; /* ECMA-262 3rd Edition 15.8.2.12 */ -static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double d; @@ -66,13 +66,13 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &d); + hres = to_number(ctx, argv, ei, &d); if(FAILED(hres)) return hres; @@ -81,7 +81,7 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA return S_OK; } -static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -89,12 +89,12 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -103,7 +103,7 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR return S_OK; } -static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -111,12 +111,12 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -125,7 +125,7 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR return S_OK; } -static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -133,12 +133,12 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -146,7 +146,7 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR return S_OK; } -static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x, y; @@ -154,16 +154,16 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA TRACE("\n"); - if(arg_cnt(dp)<2) { + if(argc<2) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &y); + hres = to_number(ctx, argv, ei, &y); if(FAILED(hres)) return hres; - hres = to_number(ctx, get_arg(dp, 1), ei, &x); + hres = to_number(ctx, argv+1, ei, &x); if(FAILED(hres)) return hres; @@ -172,7 +172,7 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA } /* ECMA-262 3rd Edition 15.8.2.6 */ -static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -180,13 +180,13 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -195,7 +195,7 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR return S_OK; } -static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -203,12 +203,12 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -216,7 +216,7 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA return S_OK; } -static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -224,12 +224,12 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -237,7 +237,7 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA return S_OK; } -static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -245,13 +245,13 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -260,7 +260,7 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA return S_OK; } -static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -268,13 +268,13 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -284,7 +284,7 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA } /* ECMA-262 3rd Edition 15.8.2.11 */ -static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DOUBLE max, d; @@ -293,18 +293,18 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, -INFINITY); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &max); + hres = to_number(ctx, argv, ei, &max); if(FAILED(hres)) return hres; - for(i=1; i < arg_cnt(dp); i++) { - hres = to_number(ctx, get_arg(dp, i), ei, &d); + for(i=1; i < argc; i++) { + hres = to_number(ctx, argv+i, ei, &d); if(FAILED(hres)) return hres; @@ -318,7 +318,7 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA } /* ECMA-262 3rd Edition 15.8.2.12 */ -static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DOUBLE min, d; @@ -327,18 +327,18 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, INFINITY); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &min); + hres = to_number(ctx, argv, ei, &min); if(FAILED(hres)) return hres; - for(i=1; i < arg_cnt(dp); i++) { - hres = to_number(ctx, get_arg(dp, i), ei, &d); + for(i=1; i < argc; i++) { + hres = to_number(ctx, argv+i, ei, &d); if(FAILED(hres)) return hres; @@ -352,7 +352,7 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA } /* ECMA-262 3rd Edition 15.8.2.13 */ -static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x, y; @@ -360,16 +360,16 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA TRACE("\n"); - if(arg_cnt(dp) < 2) { + if(argc < 2) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; - hres = to_number(ctx, get_arg(dp, 1), ei, &y); + hres = to_number(ctx, argv+1, ei, &y); if(FAILED(hres)) return hres; @@ -379,7 +379,7 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA } /* ECMA-262 3rd Edition 15.8.2.14 */ -static HRESULT Math_random(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_random(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { UINT r; @@ -396,7 +396,7 @@ static HRESULT Math_random(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPP } /* ECMA-262 3rd Edition 15.8.2.15 */ -static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -404,13 +404,13 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -419,7 +419,7 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA return S_OK; } -static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -427,12 +427,12 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -440,7 +440,7 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA return S_OK; } -static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -448,12 +448,12 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; @@ -461,7 +461,7 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR return S_OK; } -static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double x; @@ -469,12 +469,12 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_val(retv, NAN); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &x); + hres = to_number(ctx, argv, ei, &x); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/number.c b/dlls/jscript/number.c index 3d2283aec34..c62d985f4da 100644 --- a/dlls/jscript/number.c +++ b/dlls/jscript/number.c @@ -218,7 +218,7 @@ static inline void number_to_exponential(double val, int prec, BSTR *out) } /* ECMA-262 3rd Edition 15.7.4.2 */ -static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { NumberInstance *number; @@ -232,8 +232,8 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D if(!(number = number_this(jsthis))) return throw_type_error(ctx, ei, JS_E_NUMBER_EXPECTED, NULL); - if(arg_cnt(dp)) { - hres = to_int32(ctx, get_arg(dp, 0), ei, &radix); + if(argc) { + hres = to_int32(ctx, argv, ei, &radix); if(FAILED(hres)) return hres; @@ -343,14 +343,14 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D return S_OK; } -static HRESULT Number_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Number_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { NumberInstance *number; @@ -364,8 +364,8 @@ static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI if(!(number = number_this(jsthis))) return throw_type_error(ctx, ei, JS_E_NUMBER_EXPECTED, NULL); - if(arg_cnt(dp)) { - hres = to_int32(ctx, get_arg(dp, 0), ei, &prec); + if(argc) { + hres = to_int32(ctx, argv, ei, &prec); if(FAILED(hres)) return hres; @@ -394,7 +394,7 @@ static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI return S_OK; } -static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { NumberInstance *number; @@ -408,8 +408,8 @@ static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla if(!(number = number_this(jsthis))) return throw_type_error(ctx, ei, JS_E_NUMBER_EXPECTED, NULL); - if(arg_cnt(dp)) { - hres = to_int32(ctx, get_arg(dp, 0), ei, &prec); + if(argc) { + hres = to_int32(ctx, argv, ei, &prec); if(FAILED(hres)) return hres; @@ -440,7 +440,7 @@ static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla return S_OK; } -static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { NumberInstance *number; @@ -452,8 +452,8 @@ static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags if(!(number = number_this(jsthis))) return throw_type_error(ctx, ei, JS_E_NUMBER_EXPECTED, NULL); - if(arg_cnt(dp)) { - hres = to_int32(ctx, get_arg(dp, 0), ei, &prec); + if(argc) { + hres = to_int32(ctx, argv, ei, &prec); if(FAILED(hres)) return hres; @@ -490,7 +490,7 @@ static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags return S_OK; } -static HRESULT Number_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Number_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { NumberInstance *number; @@ -505,7 +505,7 @@ static HRESULT Number_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI return S_OK; } -static HRESULT Number_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Number_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { NumberInstance *number = number_from_vdisp(jsthis); @@ -543,7 +543,7 @@ static const builtin_info_t Number_info = { NULL }; -static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { double n; @@ -553,13 +553,13 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags switch(flags) { case INVOKE_FUNC: - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_int(retv, 0); return S_OK; } - hres = to_number(ctx, get_arg(dp, 0), ei, &n); + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) return hres; @@ -570,8 +570,8 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags case DISPATCH_CONSTRUCT: { jsdisp_t *obj; - if(arg_cnt(dp)) { - hres = to_number(ctx, get_arg(dp, 0), ei, &n); + if(argc) { + hres = to_number(ctx, argv, ei, &n); if(FAILED(hres)) return hres; }else { diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index a1afac2f965..b1a83de86fd 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -32,7 +32,7 @@ static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p',' static const WCHAR default_valueW[] = {'[','o','b','j','e','c','t',' ','O','b','j','e','c','t',']',0}; -static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *jsdisp; @@ -78,11 +78,9 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D return S_OK; } -static HRESULT Object_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Object_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { - DISPPARAMS params = {NULL, NULL, 0, 0}; - TRACE("\n"); if(!is_jsdisp(jsthis)) { @@ -90,10 +88,10 @@ static HRESULT Object_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl return E_FAIL; } - return jsdisp_call_name(jsthis->u.jsdisp, toStringW, DISPATCH_METHOD, ¶ms, retv, ei); + return jsdisp_call_name(jsthis->u.jsdisp, toStringW, DISPATCH_METHOD, 0, NULL, retv, ei); } -static HRESULT Object_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Object_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -108,7 +106,7 @@ static HRESULT Object_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI return S_OK; } -static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR name; @@ -118,7 +116,7 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) { V_VT(retv) = VT_BOOL; V_BOOL(retv) = VARIANT_FALSE; @@ -127,7 +125,7 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl return S_OK; } - hres = to_string(ctx, get_arg(dp, 0), ei, &name); + hres = to_string(ctx, argv, ei, &name); if(FAILED(hres)) return hres; @@ -154,21 +152,21 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl return S_OK; } -static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Object_isPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Object_isPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT Object_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT Object_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -213,7 +211,7 @@ static const builtin_info_t Object_info = { NULL }; -static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { HRESULT hres; @@ -222,13 +220,11 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags switch(flags) { case DISPATCH_METHOD: - if(arg_cnt(dp)) { - VARIANT *arg = get_arg(dp,0); - - if(V_VT(arg) != VT_EMPTY && V_VT(arg) != VT_NULL && (V_VT(arg) != VT_DISPATCH || V_DISPATCH(arg))) { + if(argc) { + if(V_VT(argv) != VT_EMPTY && V_VT(argv) != VT_NULL && (V_VT(argv) != VT_DISPATCH || V_DISPATCH(argv))) { IDispatch *disp; - hres = to_object(ctx, arg, &disp); + hres = to_object(ctx, argv, &disp); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/regexp.c b/dlls/jscript/regexp.c index 399635ec8c2..8e5445f2671 100644 --- a/dlls/jscript/regexp.c +++ b/dlls/jscript/regexp.c @@ -3473,7 +3473,7 @@ HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, const WCHAR *str, DWOR return S_OK; } -static HRESULT RegExp_source(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExp_source(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -3496,21 +3496,21 @@ static HRESULT RegExp_source(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS return S_OK; } -static HRESULT RegExp_global(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExp_global(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT RegExp_ignoreCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExp_ignoreCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT RegExp_multiline(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExp_multiline(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); @@ -3534,7 +3534,7 @@ static INT index_from_var(script_ctx_t *ctx, VARIANT *v) return is_int32(n) ? n : 0; } -static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -3548,15 +3548,13 @@ static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } case DISPATCH_PROPERTYPUT: { RegExpInstance *regexp = regexp_from_vdisp(jsthis); - VARIANT *arg; HRESULT hres; - arg = get_arg(dp,0); - hres = VariantCopy(®exp->last_index_var, arg); + hres = VariantCopy(®exp->last_index_var, argv); if(FAILED(hres)) return hres; - regexp->last_index = index_from_var(ctx, arg); + regexp->last_index = index_from_var(ctx, argv); break; } default: @@ -3567,7 +3565,7 @@ static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, return S_OK; } -static HRESULT RegExp_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExp_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); @@ -3698,7 +3696,7 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, VARIANT *arg, jsexce return S_OK; } -static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { match_result_t *parens = NULL, match; @@ -3709,7 +3707,7 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPP TRACE("\n"); - hres = run_exec(ctx, jsthis, arg_cnt(dp) ? get_arg(dp,0) : NULL, ei, &string, &match, &parens, &parens_cnt, &b); + hres = run_exec(ctx, jsthis, argc ? argv : NULL, ei, &string, &match, &parens, &parens_cnt, &b); if(FAILED(hres)) return hres; @@ -3732,18 +3730,16 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPP return hres; } -static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { match_result_t match; VARIANT undef_var; VARIANT_BOOL b; - DWORD argc; HRESULT hres; TRACE("\n"); - argc = arg_cnt(dp); if(!argc) { V_VT(&undef_var) = VT_BSTR; V_BSTR(&undef_var) = SysAllocString(undefinedW); @@ -3751,7 +3747,7 @@ static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPP return E_OUTOFMEMORY; } - hres = run_exec(ctx, jsthis, argc ? get_arg(dp,0) : &undef_var, ei, NULL, &match, NULL, NULL, &b); + hres = run_exec(ctx, jsthis, argc ? argv : &undef_var, ei, NULL, &match, NULL, NULL, &b); if(!argc) SysFreeString(V_BSTR(&undef_var)); if(FAILED(hres)) @@ -3764,7 +3760,7 @@ static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPP return S_OK; } -static HRESULT RegExp_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExp_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -4014,7 +4010,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, BSTR str, } static HRESULT RegExpConstr_leftContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -4041,7 +4037,7 @@ static HRESULT RegExpConstr_leftContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD } static HRESULT RegExpConstr_rightContext(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -4067,20 +4063,19 @@ static HRESULT RegExpConstr_rightContext(script_ctx_t *ctx, vdisp_t *jsthis, WOR return S_OK; } -static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); switch(flags) { case DISPATCH_METHOD: - if(arg_cnt(dp)) { - VARIANT *arg = get_arg(dp,0); - if(V_VT(arg) == VT_DISPATCH) { - jsdisp_t *jsdisp = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg)); + if(argc) { + if(V_VT(argv) == VT_DISPATCH) { + jsdisp_t *jsdisp = iface_to_jsdisp((IUnknown*)V_DISPATCH(argv)); if(jsdisp) { if(is_class(jsdisp, JSCLASS_REGEXP)) { - if(arg_cnt(dp) > 1 && V_VT(get_arg(dp,1)) != VT_EMPTY) { + if(argc > 1 && V_VT(argv+1) != VT_EMPTY) { jsdisp_release(jsdisp); return throw_regexp_error(ctx, ei, JS_E_REGEXP_SYNTAX, NULL); } @@ -4100,12 +4095,12 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags jsdisp_t *ret; HRESULT hres; - if(!arg_cnt(dp)) { + if(!argc) { FIXME("no args\n"); return E_NOTIMPL; } - hres = create_regexp_var(ctx, get_arg(dp,0), arg_cnt(dp) > 1 ? get_arg(dp,1) : NULL, &ret); + hres = create_regexp_var(ctx, argv, argc > 1 ? argv+1 : NULL, &ret); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 1cc20488d9e..46d779a93aa 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -102,7 +102,7 @@ static HRESULT get_string_val(script_ctx_t *ctx, vdisp_t *jsthis, jsexcept_t *ei return S_OK; } -static HRESULT String_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("%p\n", jsthis); @@ -143,7 +143,7 @@ static HRESULT stringobj_to_string(vdisp_t *jsthis, VARIANT *retv) } /* ECMA-262 3rd Edition 15.5.4.2 */ -static HRESULT String_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -152,7 +152,7 @@ static HRESULT String_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D } /* ECMA-262 3rd Edition 15.5.4.2 */ -static HRESULT String_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { TRACE("\n"); @@ -191,7 +191,7 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, V return S_OK; } -static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, DISPPARAMS *dp, VARIANT *retv, +static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei, const WCHAR *tagname, const WCHAR *attr) { static const WCHAR tagfmtW[] @@ -222,8 +222,8 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, DISPP length = string->length; } - if(arg_cnt(dp)) { - hres = to_string(ctx, get_arg(dp, 0), ei, &attr_value); + if(argc) { + hres = to_string(ctx, argv, ei, &attr_value); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -257,30 +257,30 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, DISPP return S_OK; } -static HRESULT String_anchor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_anchor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR fontW[] = {'A',0}; static const WCHAR colorW[] = {'N','A','M','E',0}; - return do_attribute_tag_format(ctx, jsthis, dp, retv, ei, fontW, colorW); + return do_attribute_tag_format(ctx, jsthis, argc, argv, retv, ei, fontW, colorW); } -static HRESULT String_big(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_big(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR bigtagW[] = {'B','I','G',0}; return do_attributeless_tag_format(ctx, jsthis, retv, ei, bigtagW); } -static HRESULT String_blink(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_blink(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR blinktagW[] = {'B','L','I','N','K',0}; return do_attributeless_tag_format(ctx, jsthis, retv, ei, blinktagW); } -static HRESULT String_bold(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_bold(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR boldtagW[] = {'B',0}; @@ -288,7 +288,7 @@ static HRESULT String_bold(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPP } /* ECMA-262 3rd Edition 15.5.4.5 */ -static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { const WCHAR *str; @@ -303,10 +303,10 @@ static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS if(FAILED(hres)) return hres; - if(arg_cnt(dp)) { + if(argc) { double d; - hres = to_integer(ctx, get_arg(dp, 0), ei, &d); + hres = to_integer(ctx, argv, ei, &d); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -334,7 +334,7 @@ static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS } /* ECMA-262 3rd Edition 15.5.4.5 */ -static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { const WCHAR *str; @@ -348,10 +348,10 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, if(FAILED(hres)) return hres; - if(arg_cnt(dp) > 0) { + if(argc > 0) { double d; - hres = to_integer(ctx, get_arg(dp, 0), ei, &d); + hres = to_integer(ctx, argv, ei, &d); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -375,7 +375,7 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } /* ECMA-262 3rd Edition 15.5.4.6 */ -static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR *strs = NULL, ret = NULL; @@ -386,7 +386,7 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS TRACE("\n"); - str_cnt = arg_cnt(dp)+1; + str_cnt = argc+1; strs = heap_alloc_zero(str_cnt * sizeof(BSTR)); if(!strs) return E_OUTOFMEMORY; @@ -396,8 +396,8 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS hres = to_string(ctx, &var, ei, strs); if(SUCCEEDED(hres)) { - for(i=0; i < arg_cnt(dp); i++) { - hres = to_string(ctx, get_arg(dp, i), ei, strs+i+1); + for(i=0; i < argc; i++) { + hres = to_string(ctx, argv+i, ei, strs+i+1); if(FAILED(hres)) break; } @@ -432,32 +432,32 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS return S_OK; } -static HRESULT String_fixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_fixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR fixedtagW[] = {'T','T',0}; return do_attributeless_tag_format(ctx, jsthis, retv, ei, fixedtagW); } -static HRESULT String_fontcolor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_fontcolor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR fontW[] = {'F','O','N','T',0}; static const WCHAR colorW[] = {'C','O','L','O','R',0}; - return do_attribute_tag_format(ctx, jsthis, dp, retv, ei, fontW, colorW); + return do_attribute_tag_format(ctx, jsthis, argc, argv, retv, ei, fontW, colorW); } -static HRESULT String_fontsize(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_fontsize(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR fontW[] = {'F','O','N','T',0}; static const WCHAR colorW[] = {'S','I','Z','E',0}; - return do_attribute_tag_format(ctx, jsthis, dp, retv, ei, fontW, colorW); + return do_attribute_tag_format(ctx, jsthis, argc, argv, retv, ei, fontW, colorW); } -static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DWORD length, pos = 0; @@ -472,23 +472,23 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI if(FAILED(hres)) return hres; - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_int(retv, -1); SysFreeString(val_str); return S_OK; } - hres = to_string(ctx, get_arg(dp,0), ei, &search_str); + hres = to_string(ctx, argv, ei, &search_str); if(FAILED(hres)) { SysFreeString(val_str); return hres; } - if(arg_cnt(dp) >= 2) { + if(argc >= 2) { double d; - hres = to_integer(ctx, get_arg(dp,1), ei, &d); + hres = to_integer(ctx, argv+1, ei, &d); if(SUCCEEDED(hres) && d > 0.0) pos = is_int32(d) ? min(length, d) : length; } @@ -513,7 +513,7 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI return S_OK; } -static HRESULT String_italics(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_italics(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR italicstagW[] = {'I',0}; @@ -521,7 +521,7 @@ static HRESULT String_italics(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI } /* ECMA-262 3rd Edition 15.5.4.8 */ -static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR search_str, val_str; @@ -536,14 +536,14 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags if(FAILED(hres)) return hres; - if(!arg_cnt(dp)) { + if(!argc) { if(retv) num_set_int(retv, -1); SysFreeString(val_str); return S_OK; } - hres = to_string(ctx, get_arg(dp,0), ei, &search_str); + hres = to_string(ctx, argv, ei, &search_str); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -551,10 +551,10 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags search_len = SysStringLen(search_str); - if(arg_cnt(dp) >= 2) { + if(argc >= 2) { double d; - hres = to_integer(ctx, get_arg(dp,1), ei, &d); + hres = to_integer(ctx, argv+1, ei, &d); if(SUCCEEDED(hres) && d > 0) pos = is_int32(d) ? min(length, d) : length; }else { @@ -582,29 +582,28 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags return S_OK; } -static HRESULT String_link(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_link(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR fontW[] = {'A',0}; static const WCHAR colorW[] = {'H','R','E','F',0}; - return do_attribute_tag_format(ctx, jsthis, dp, retv, ei, fontW, colorW); + return do_attribute_tag_format(ctx, jsthis, argc, argv, retv, ei, fontW, colorW); } /* ECMA-262 3rd Edition 15.5.4.10 */ -static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { const WCHAR *str; jsdisp_t *regexp; - VARIANT *arg_var; DWORD length; BSTR val_str = NULL; HRESULT hres = S_OK; TRACE("\n"); - if(!arg_cnt(dp)) { + if(!argc) { if(retv) { V_VT(retv) = VT_NULL; } @@ -612,10 +611,9 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP return S_OK; } - arg_var = get_arg(dp, 0); - switch(V_VT(arg_var)) { + switch(V_VT(argv)) { case VT_DISPATCH: - regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg_var)); + regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(argv)); if(regexp) { if(is_class(regexp, JSCLASS_REGEXP)) break; @@ -624,7 +622,7 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP default: { BSTR match_str; - hres = to_string(ctx, arg_var, ei, &match_str); + hres = to_string(ctx, argv, ei, &match_str); if(FAILED(hres)) return hres; @@ -687,29 +685,27 @@ static HRESULT strbuf_append(strbuf_t *buf, const WCHAR *str, DWORD len) static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, match_result_t *match, match_result_t *parens, DWORD parens_cnt, BSTR *ret, jsexcept_t *ei) { - DISPPARAMS dp = {NULL, NULL, 0, 0}; - VARIANTARG *args, *arg; + VARIANT *argv; + unsigned argc; VARIANT var; DWORD i; HRESULT hres = S_OK; - dp.cArgs = parens_cnt+3; - dp.rgvarg = args = heap_alloc_zero(sizeof(VARIANT)*dp.cArgs); - if(!args) + argc = parens_cnt+3; + argv = heap_alloc_zero(sizeof(VARIANT)*argc); + if(!argv) return E_OUTOFMEMORY; - arg = get_arg(&dp,0); - V_VT(arg) = VT_BSTR; - V_BSTR(arg) = SysAllocStringLen(match->str, match->len); - if(!V_BSTR(arg)) + V_VT(argv) = VT_BSTR; + V_BSTR(argv) = SysAllocStringLen(match->str, match->len); + if(!V_BSTR(argv)) hres = E_OUTOFMEMORY; if(SUCCEEDED(hres)) { for(i=0; i < parens_cnt; i++) { - arg = get_arg(&dp,i+1); - V_VT(arg) = VT_BSTR; - V_BSTR(arg) = SysAllocStringLen(parens[i].str, parens[i].len); - if(!V_BSTR(arg)) { + V_VT(argv+i+1) = VT_BSTR; + V_BSTR(argv+i+1) = SysAllocStringLen(parens[i].str, parens[i].len); + if(!V_BSTR(argv+i+1)) { hres = E_OUTOFMEMORY; break; } @@ -717,24 +713,22 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat } if(SUCCEEDED(hres)) { - arg = get_arg(&dp,parens_cnt+1); - num_set_int(arg, match->str - str); + num_set_int(argv+parens_cnt+1, match->str - str); - arg = get_arg(&dp,parens_cnt+2); - V_VT(arg) = VT_BSTR; - V_BSTR(arg) = SysAllocString(str); - if(!V_BSTR(arg)) + V_VT(argv+parens_cnt+2) = VT_BSTR; + V_BSTR(argv+parens_cnt+2) = SysAllocString(str); + if(!V_BSTR(argv+parens_cnt+2)) hres = E_OUTOFMEMORY; } if(SUCCEEDED(hres)) - hres = jsdisp_call_value(func, NULL, DISPATCH_METHOD, &dp, &var, ei); + hres = jsdisp_call_value(func, NULL, DISPATCH_METHOD, argc, argv, &var, ei); for(i=0; i < parens_cnt+3; i++) { if(i != parens_cnt+1) - SysFreeString(V_BSTR(get_arg(&dp,i))); + SysFreeString(V_BSTR(argv+i)); } - heap_free(args); + heap_free(argv); if(FAILED(hres)) return hres; @@ -745,7 +739,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat } /* ECMA-262 3rd Edition 15.5.4.11 */ -static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { const WCHAR *str; @@ -755,7 +749,6 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI match_result_t *parens = NULL, match = {NULL,0}, **parens_ptr = &parens; strbuf_t ret = {NULL,0,0}; DWORD re_flags = REM_NO_CTX_UPDATE; - VARIANT *arg_var; HRESULT hres = S_OK; TRACE("\n"); @@ -764,7 +757,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI if(FAILED(hres)) return hres; - if(!arg_cnt(dp)) { + if(!argc) { if(retv) { if(!val_str) { val_str = SysAllocStringLen(str, length); @@ -778,10 +771,9 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI return S_OK; } - arg_var = get_arg(dp, 0); - switch(V_VT(arg_var)) { + switch(V_VT(argv)) { case VT_DISPATCH: - regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg_var)); + regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(argv)); if(regexp) { if(is_class(regexp, JSCLASS_REGEXP)) { break; @@ -792,18 +784,17 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI } default: - hres = to_string(ctx, arg_var, ei, &match_str); + hres = to_string(ctx, argv, ei, &match_str); if(FAILED(hres)) { SysFreeString(val_str); return hres; } } - if(arg_cnt(dp) >= 2) { - arg_var = get_arg(dp,1); - switch(V_VT(arg_var)) { + if(argc >= 2) { + switch(V_VT(argv+1)) { case VT_DISPATCH: - rep_func = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg_var)); + rep_func = iface_to_jsdisp((IUnknown*)V_DISPATCH(argv+1)); if(rep_func) { if(is_class(rep_func, JSCLASS_FUNCTION)) { break; @@ -814,7 +805,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI } default: - hres = to_string(ctx, arg_var, ei, &rep_str); + hres = to_string(ctx, argv+1, ei, &rep_str); if(FAILED(hres)) break; @@ -984,13 +975,12 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI return hres; } -static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { jsdisp_t *regexp = NULL; const WCHAR *str, *cp; match_result_t match; - VARIANT *arg; DWORD length; BSTR val_str; HRESULT hres; @@ -1001,16 +991,15 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS if(FAILED(hres)) return hres; - if(!arg_cnt(dp)) { + if(!argc) { if(retv) V_VT(retv) = VT_NULL; SysFreeString(val_str); return S_OK; } - arg = get_arg(dp,0); - if(V_VT(arg) == VT_DISPATCH) { - regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg)); + if(V_VT(argv) == VT_DISPATCH) { + regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(argv)); if(regexp) { if(!is_class(regexp, JSCLASS_REGEXP)) { jsdisp_release(regexp); @@ -1020,7 +1009,7 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS } if(!regexp) { - hres = create_regexp_var(ctx, arg, NULL, ®exp); + hres = create_regexp_var(ctx, argv, NULL, ®exp); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -1040,7 +1029,7 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS } /* ECMA-262 3rd Edition 15.5.4.13 */ -static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { const WCHAR *str; @@ -1056,8 +1045,8 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP if(FAILED(hres)) return hres; - if(arg_cnt(dp)) { - hres = to_integer(ctx, get_arg(dp,0), ei, &d); + if(argc) { + hres = to_integer(ctx, argv, ei, &d); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -1077,8 +1066,8 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP } } - if(arg_cnt(dp) >= 2) { - hres = to_integer(ctx, get_arg(dp,1), ei, &d); + if(argc >= 2) { + hres = to_integer(ctx, argv+1, ei, &d); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -1118,28 +1107,28 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP return S_OK; } -static HRESULT String_small(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_small(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR smalltagW[] = {'S','M','A','L','L',0}; return do_attributeless_tag_format(ctx, jsthis, retv, ei, smalltagW); } -static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { match_result_t *match_result = NULL; DWORD length, match_cnt, i, match_len = 0; const WCHAR *str, *ptr, *ptr2; BOOL use_regexp = FALSE; - VARIANT *arg, var; + VARIANT var; jsdisp_t *array; BSTR val_str, match_str = NULL; HRESULT hres; TRACE("\n"); - if(arg_cnt(dp) != 1) { + if(argc != 1) { FIXME("unsupported args\n"); return E_NOTIMPL; } @@ -1148,12 +1137,11 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP if(FAILED(hres)) return hres; - arg = get_arg(dp, 0); - switch(V_VT(arg)) { + switch(V_VT(argv)) { case VT_DISPATCH: { jsdisp_t *regexp; - regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg)); + regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(argv)); if(regexp) { if(is_class(regexp, JSCLASS_REGEXP)) { use_regexp = TRUE; @@ -1169,7 +1157,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP } } default: - hres = to_string(ctx, arg, ei, &match_str); + hres = to_string(ctx, argv, ei, &match_str); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -1250,14 +1238,14 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP return hres; } -static HRESULT String_strike(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_strike(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR striketagW[] = {'S','T','R','I','K','E',0}; return do_attributeless_tag_format(ctx, jsthis, retv, ei, striketagW); } -static HRESULT String_sub(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_sub(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR subtagW[] = {'S','U','B',0}; @@ -1265,7 +1253,7 @@ static HRESULT String_sub(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA } /* ECMA-262 3rd Edition 15.5.4.15 */ -static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { const WCHAR *str; @@ -1281,8 +1269,8 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, if(FAILED(hres)) return hres; - if(arg_cnt(dp) >= 1) { - hres = to_integer(ctx, get_arg(dp,0), ei, &d); + if(argc >= 1) { + hres = to_integer(ctx, argv, ei, &d); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -1292,8 +1280,8 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, start = is_int32(d) ? min(length, d) : length; } - if(arg_cnt(dp) >= 2) { - hres = to_integer(ctx, get_arg(dp,1), ei, &d); + if(argc >= 2) { + hres = to_integer(ctx, argv+1, ei, &d); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -1326,7 +1314,7 @@ static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, } /* ECMA-262 3rd Edition B.2.3 */ -static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { BSTR val_str; @@ -1342,8 +1330,8 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS if(FAILED(hres)) return hres; - if(arg_cnt(dp) >= 1) { - hres = to_integer(ctx, get_arg(dp,0), ei, &d); + if(argc >= 1) { + hres = to_integer(ctx, argv, ei, &d); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -1353,8 +1341,8 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS start = is_int32(d) ? min(length, d) : length; } - if(arg_cnt(dp) >= 2) { - hres = to_integer(ctx, get_arg(dp,1), ei, &d); + if(argc >= 2) { + hres = to_integer(ctx, argv+1, ei, &d); if(FAILED(hres)) { SysFreeString(val_str); return hres; @@ -1380,14 +1368,14 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS return hres; } -static HRESULT String_sup(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_sup(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { static const WCHAR suptagW[] = {'S','U','P',0}; return do_attributeless_tag_format(ctx, jsthis, retv, ei, suptagW); } -static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { const WCHAR* str; @@ -1417,7 +1405,7 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags return S_OK; } -static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { const WCHAR* str; @@ -1447,28 +1435,28 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags return S_OK; } -static HRESULT String_toLocaleLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_toLocaleLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT String_toLocaleUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_toLocaleUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT String_localeCompare(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_localeCompare(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT String_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, +static HRESULT String_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { StringInstance *This = string_from_vdisp(jsthis); @@ -1550,18 +1538,18 @@ static const builtin_info_t String_info = { /* ECMA-262 3rd Edition 15.5.3.2 */ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, - DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei) + unsigned argc, VARIANT *argv, VARIANT *retv, jsexcept_t *ei) { DWORD i, code; BSTR ret; HRESULT hres; - ret = SysAllocStringLen(NULL, arg_cnt(dp)); + ret = SysAllocStringLen(NULL, argc); if(!ret) return E_OUTOFMEMORY; - for(i=0; isafearray)) + if(argc < SafeArrayGetDim(vbarray->safearray)) return throw_range_error(ctx, ei, JS_E_SUBSCRIPT_OUT_OF_RANGE, NULL); - indexes = heap_alloc(sizeof(int)*size); + indexes = heap_alloc(sizeof(int)*argc); if(!indexes) return E_OUTOFMEMORY; - for(i=0; isafearray); + hres = SafeArrayCopy(V_ARRAY(argv), &vbarray->safearray); if(FAILED(hres)) { jsdisp_release(&vbarray->dispex); return hres;