jscript: Avoid using dispex->ctx.

This commit is contained in:
Jacek Caban 2009-09-23 16:17:17 +02:00 committed by Alexandre Julliard
parent a9dc89a3e1
commit 5dcd182e8f
10 changed files with 165 additions and 173 deletions

View File

@ -42,7 +42,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
TRACE("\n"); TRACE("\n");
if(!is_class(dispex, JSCLASS_BOOLEAN)) if(!is_class(dispex, JSCLASS_BOOLEAN))
return throw_type_error(dispex->ctx, ei, IDS_NOT_BOOL, NULL); return throw_type_error(ctx, ei, IDS_NOT_BOOL, NULL);
if(retv) { if(retv) {
BoolInstance *bool = (BoolInstance*)dispex; BoolInstance *bool = (BoolInstance*)dispex;
@ -68,7 +68,7 @@ static HRESULT Bool_valueOf(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
TRACE("\n"); TRACE("\n");
if(!is_class(dispex, JSCLASS_BOOLEAN)) if(!is_class(dispex, JSCLASS_BOOLEAN))
return throw_type_error(dispex->ctx, ei, IDS_NOT_BOOL, NULL); return throw_type_error(ctx, ei, IDS_NOT_BOOL, NULL);
if(retv) { if(retv) {
BoolInstance *bool = (BoolInstance*)dispex; BoolInstance *bool = (BoolInstance*)dispex;
@ -87,7 +87,7 @@ static HRESULT Bool_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DIS
switch(flags) { switch(flags) {
case INVOKE_FUNC: case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL); return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
default: default:
FIXME("unimplemented flags %x\n", flags); FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL; return E_NOTIMPL;
@ -127,7 +127,7 @@ static HRESULT BoolConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flag
case DISPATCH_CONSTRUCT: { case DISPATCH_CONSTRUCT: {
DispatchEx *bool; DispatchEx *bool;
hres = create_bool(dispex->ctx, value, &bool); hres = create_bool(ctx, value, &bool);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;

View File

@ -1583,14 +1583,14 @@ HRESULT call_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags,
hres = disp_call(ctx->parser->script, V_DISPATCH(&exprval.u.var), DISPID_VALUE, hres = disp_call(ctx->parser->script, V_DISPATCH(&exprval.u.var), DISPID_VALUE,
DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/); DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
else else
hres = throw_type_error(ctx->var_disp->ctx, ei, IDS_NO_PROPERTY, NULL); hres = throw_type_error(ctx->parser->script, ei, IDS_NO_PROPERTY, NULL);
break; break;
case EXPRVAL_IDREF: case EXPRVAL_IDREF:
hres = disp_call(ctx->parser->script, exprval.u.idref.disp, exprval.u.idref.id, hres = disp_call(ctx->parser->script, exprval.u.idref.disp, exprval.u.idref.id,
DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/); DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
break; break;
case EXPRVAL_INVALID: case EXPRVAL_INVALID:
hres = throw_type_error(ctx->var_disp->ctx, ei, IDS_OBJECT_EXPECTED, NULL); hres = throw_type_error(ctx->parser->script, ei, IDS_OBJECT_EXPECTED, NULL);
break; break;
default: default:
FIXME("unimplemented type %d\n", exprval.type); FIXME("unimplemented type %d\n", exprval.type);

View File

@ -119,7 +119,7 @@ static HRESULT Error_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
switch(flags) { switch(flags) {
case INVOKE_FUNC: case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL); return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
default: default:
FIXME("unimplemented flags %x\n", flags); FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL; return E_NOTIMPL;
@ -223,7 +223,7 @@ static HRESULT create_error(script_ctx_t *ctx, DispatchEx *constr,
return S_OK; return S_OK;
} }
static HRESULT error_constr(DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT error_constr(script_ctx_t *ctx, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, DispatchEx *constr) { VARIANT *retv, jsexcept_t *ei, DispatchEx *constr) {
DispatchEx *err; DispatchEx *err;
VARIANT numv; VARIANT numv;
@ -234,9 +234,9 @@ static HRESULT error_constr(DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
V_VT(&numv) = VT_NULL; V_VT(&numv) = VT_NULL;
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &numv); hres = to_number(ctx, get_arg(dp, 0), ei, &numv);
if(FAILED(hres) || (V_VT(&numv)==VT_R8 && isnan(V_R8(&numv)))) if(FAILED(hres) || (V_VT(&numv)==VT_R8 && isnan(V_R8(&numv))))
hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &msg); hres = to_string(ctx, get_arg(dp, 0), ei, &msg);
else if(V_VT(&numv) == VT_I4) else if(V_VT(&numv) == VT_I4)
num = V_I4(&numv); num = V_I4(&numv);
else else
@ -247,7 +247,7 @@ static HRESULT error_constr(DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
} }
if(arg_cnt(dp)>1 && !msg) { if(arg_cnt(dp)>1 && !msg) {
hres = to_string(dispex->ctx, get_arg(dp, 1), ei, &msg); hres = to_string(ctx, get_arg(dp, 1), ei, &msg);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
} }
@ -256,9 +256,9 @@ static HRESULT error_constr(DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
case INVOKE_FUNC: case INVOKE_FUNC:
case DISPATCH_CONSTRUCT: case DISPATCH_CONSTRUCT:
if(V_VT(&numv) == VT_NULL) if(V_VT(&numv) == VT_NULL)
hres = create_error(dispex->ctx, constr, NULL, msg, &err); hres = create_error(ctx, constr, NULL, msg, &err);
else else
hres = create_error(dispex->ctx, constr, &num, msg, &err); hres = create_error(ctx, constr, &num, msg, &err);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -282,64 +282,56 @@ static HRESULT ErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fla
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
TRACE("\n"); TRACE("\n");
return error_constr(dispex, flags, dp, retv, ei, return error_constr(ctx, flags, dp, retv, ei, ctx->error_constr);
dispex->ctx->error_constr);
} }
static HRESULT EvalErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, static HRESULT EvalErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
TRACE("\n"); TRACE("\n");
return error_constr(dispex, flags, dp, retv, ei, return error_constr(ctx, flags, dp, retv, ei, ctx->eval_error_constr);
dispex->ctx->eval_error_constr);
} }
static HRESULT RangeErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, static HRESULT RangeErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
TRACE("\n"); TRACE("\n");
return error_constr(dispex, flags, dp, retv, ei, return error_constr(ctx, flags, dp, retv, ei, ctx->range_error_constr);
dispex->ctx->range_error_constr);
} }
static HRESULT ReferenceErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, static HRESULT ReferenceErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
TRACE("\n"); TRACE("\n");
return error_constr(dispex, flags, dp, retv, ei, return error_constr(ctx, flags, dp, retv, ei, ctx->reference_error_constr);
dispex->ctx->reference_error_constr);
} }
static HRESULT RegExpErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, static HRESULT RegExpErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
TRACE("\n"); TRACE("\n");
return error_constr(dispex, flags, dp, retv, ei, return error_constr(ctx, flags, dp, retv, ei, ctx->regexp_error_constr);
dispex->ctx->regexp_error_constr);
} }
static HRESULT SyntaxErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, static HRESULT SyntaxErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
TRACE("\n"); TRACE("\n");
return error_constr(dispex, flags, dp, retv, ei, return error_constr(ctx, flags, dp, retv, ei, ctx->syntax_error_constr);
dispex->ctx->syntax_error_constr);
} }
static HRESULT TypeErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, static HRESULT TypeErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
TRACE("\n"); TRACE("\n");
return error_constr(dispex, flags, dp, retv, ei, return error_constr(ctx, flags, dp, retv, ei, ctx->type_error_constr);
dispex->ctx->type_error_constr);
} }
static HRESULT URIErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, static HRESULT URIErrorConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
TRACE("\n"); TRACE("\n");
return error_constr(dispex, flags, dp, retv, ei, return error_constr(ctx, flags, dp, retv, ei, ctx->uri_error_constr);
dispex->ctx->uri_error_constr);
} }
HRESULT init_error_constr(script_ctx_t *ctx, DispatchEx *object_prototype) HRESULT init_error_constr(script_ctx_t *ctx, DispatchEx *object_prototype)

View File

@ -156,7 +156,7 @@ static HRESULT JSGlobal_Array(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->array_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->array_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_Boolean(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_Boolean(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -164,7 +164,7 @@ static HRESULT JSGlobal_Boolean(script_ctx_t *ctx, DispatchEx *dispex, WORD flag
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->bool_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->bool_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_Date(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_Date(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -172,7 +172,7 @@ static HRESULT JSGlobal_Date(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->date_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->date_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_Error(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_Error(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -180,7 +180,7 @@ static HRESULT JSGlobal_Error(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->error_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->error_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_EvalError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_EvalError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -188,7 +188,7 @@ static HRESULT JSGlobal_EvalError(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->eval_error_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->eval_error_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_RangeError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_RangeError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -196,7 +196,7 @@ static HRESULT JSGlobal_RangeError(script_ctx_t *ctx, DispatchEx *dispex, WORD f
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->range_error_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->range_error_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_ReferenceError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_ReferenceError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -204,7 +204,7 @@ static HRESULT JSGlobal_ReferenceError(script_ctx_t *ctx, DispatchEx *dispex, WO
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->reference_error_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->reference_error_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_SyntaxError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_SyntaxError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -212,7 +212,7 @@ static HRESULT JSGlobal_SyntaxError(script_ctx_t *ctx, DispatchEx *dispex, WORD
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->syntax_error_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->syntax_error_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_TypeError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_TypeError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -220,7 +220,7 @@ static HRESULT JSGlobal_TypeError(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->type_error_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->type_error_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_URIError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_URIError(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -228,7 +228,7 @@ static HRESULT JSGlobal_URIError(script_ctx_t *ctx, DispatchEx *dispex, WORD fla
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->uri_error_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->uri_error_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_Function(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_Function(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -236,7 +236,7 @@ static HRESULT JSGlobal_Function(script_ctx_t *ctx, DispatchEx *dispex, WORD fla
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->function_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->function_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_Number(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_Number(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -244,7 +244,7 @@ static HRESULT JSGlobal_Number(script_ctx_t *ctx, DispatchEx *dispex, WORD flags
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->number_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->number_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_Object(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_Object(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -252,7 +252,7 @@ static HRESULT JSGlobal_Object(script_ctx_t *ctx, DispatchEx *dispex, WORD flags
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->object_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->object_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_String(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_String(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -260,7 +260,7 @@ static HRESULT JSGlobal_String(script_ctx_t *ctx, DispatchEx *dispex, WORD flags
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->string_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->string_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -268,7 +268,7 @@ static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, DispatchEx *dispex, WORD flags
{ {
TRACE("\n"); TRACE("\n");
return constructor_call(dispex->ctx->regexp_constr, flags, dp, retv, ei, sp); return constructor_call(ctx->regexp_constr, flags, dp, retv, ei, sp);
} }
static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -324,19 +324,19 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
return S_OK; return S_OK;
} }
if(!dispex->ctx->exec_ctx) { if(!ctx->exec_ctx) {
FIXME("No active exec_ctx\n"); FIXME("No active exec_ctx\n");
return E_UNEXPECTED; return E_UNEXPECTED;
} }
TRACE("parsing %s\n", debugstr_w(V_BSTR(arg))); TRACE("parsing %s\n", debugstr_w(V_BSTR(arg)));
hres = script_parse(dispex->ctx, V_BSTR(arg), NULL, &parser_ctx); hres = script_parse(ctx, V_BSTR(arg), NULL, &parser_ctx);
if(FAILED(hres)) { 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(arg)), hres);
return throw_syntax_error(dispex->ctx, ei, hres, NULL); return throw_syntax_error(ctx, ei, hres, NULL);
} }
hres = exec_source(dispex->ctx->exec_ctx, parser_ctx, parser_ctx->source, ei, retv); hres = exec_source(ctx->exec_ctx, parser_ctx, parser_ctx->source, ei, retv);
parser_release(parser_ctx); parser_release(parser_ctx);
return hres; return hres;
@ -352,7 +352,7 @@ static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
TRACE("\n"); TRACE("\n");
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
hres = to_number(dispex->ctx, get_arg(dp,0), ei, &num); hres = to_number(ctx, get_arg(dp,0), ei, &num);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -380,7 +380,7 @@ static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, DispatchEx *dispex, WORD fla
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
VARIANT num; VARIANT num;
hres = to_number(dispex->ctx, get_arg(dp,0), ei, &num); hres = to_number(ctx, get_arg(dp,0), ei, &num);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -422,7 +422,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, DispatchEx *dispex, WORD fla
} }
if(arg_cnt(dp) >= 2) { if(arg_cnt(dp) >= 2) {
hres = to_int32(dispex->ctx, get_arg(dp, 1), ei, &radix); hres = to_int32(ctx, get_arg(dp, 1), ei, &radix);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -434,7 +434,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, DispatchEx *dispex, WORD fla
} }
} }
hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &str); hres = to_string(ctx, get_arg(dp, 0), ei, &str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -492,7 +492,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, DispatchEx *dispex, WORD f
} }
arg = get_arg(dp, 0); arg = get_arg(dp, 0);
hres = to_string(dispex->ctx, arg, ei, &val_str); hres = to_string(ctx, arg, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -605,7 +605,7 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, DispatchEx *dispex, WORD fla
return S_OK; return S_OK;
} }
hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &str); hres = to_string(ctx, get_arg(dp, 0), ei, &str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -724,7 +724,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
return S_OK; return S_OK;
} }
hres = to_string(dispex->ctx, get_arg(dp,0), ei, &str); hres = to_string(ctx, get_arg(dp,0), ei, &str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;

View File

@ -244,9 +244,9 @@ typedef struct {
DWORD len; DWORD len;
} match_result_t; } match_result_t;
HRESULT regexp_match_next(DispatchEx*,BOOL,const WCHAR*,DWORD,const WCHAR**,match_result_t**, HRESULT regexp_match_next(script_ctx_t*,DispatchEx*,BOOL,const WCHAR*,DWORD,const WCHAR**,match_result_t**,
DWORD*,DWORD*,match_result_t*); DWORD*,DWORD*,match_result_t*);
HRESULT regexp_match(DispatchEx*,const WCHAR*,DWORD,BOOL,match_result_t**,DWORD*); HRESULT regexp_match(script_ctx_t*,DispatchEx*,const WCHAR*,DWORD,BOOL,match_result_t**,DWORD*);
static inline VARIANT *get_arg(DISPPARAMS *dp, DWORD i) static inline VARIANT *get_arg(DISPPARAMS *dp, DWORD i)
{ {

View File

@ -148,7 +148,7 @@ static HRESULT Math_abs(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -171,7 +171,7 @@ static HRESULT Math_acos(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -192,7 +192,7 @@ static HRESULT Math_asin(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -213,7 +213,7 @@ static HRESULT Math_atan(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -234,11 +234,11 @@ static HRESULT Math_atan2(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DIS
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v1); hres = to_number(ctx, get_arg(dp, 0), ei, &v1);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v2); hres = to_number(ctx, get_arg(dp, 1), ei, &v2);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -261,7 +261,7 @@ static HRESULT Math_ceil(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -283,7 +283,7 @@ static HRESULT Math_cos(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -304,7 +304,7 @@ static HRESULT Math_exp(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -326,7 +326,7 @@ static HRESULT Math_floor(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DIS
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -349,7 +349,7 @@ static HRESULT Math_log(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -375,13 +375,13 @@ static HRESULT Math_max(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
max = num_val(&v); max = num_val(&v);
for(i=1; i < arg_cnt(dp); i++) { for(i=1; i < arg_cnt(dp); i++) {
hres = to_number(dispex->ctx, get_arg(dp, i), ei, &v); hres = to_number(ctx, get_arg(dp, i), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -412,13 +412,13 @@ static HRESULT Math_min(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
min = num_val(&v); min = num_val(&v);
for(i=1; i < arg_cnt(dp); i++) { for(i=1; i < arg_cnt(dp); i++) {
hres = to_number(dispex->ctx, get_arg(dp, i), ei, &v); hres = to_number(ctx, get_arg(dp, i), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -446,11 +446,11 @@ static HRESULT Math_pow(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &x); hres = to_number(ctx, get_arg(dp, 0), ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &y); hres = to_number(ctx, get_arg(dp, 1), ei, &y);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -490,7 +490,7 @@ static HRESULT Math_round(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DIS
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -512,7 +512,7 @@ static HRESULT Math_sin(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -533,7 +533,7 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -554,7 +554,7 @@ static HRESULT Math_tan(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;

View File

@ -54,17 +54,17 @@ static HRESULT Number_toString(script_ctx_t *ctx, DispatchEx *dispex, WORD flags
TRACE("\n"); TRACE("\n");
if(!is_class(dispex, JSCLASS_NUMBER)) if(!is_class(dispex, JSCLASS_NUMBER))
return throw_type_error(dispex->ctx, ei, IDS_NOT_NUM, NULL); return throw_type_error(ctx, ei, IDS_NOT_NUM, NULL);
number = (NumberInstance*)dispex; number = (NumberInstance*)dispex;
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
hres = to_int32(dispex->ctx, get_arg(dp, 0), ei, &radix); hres = to_int32(ctx, get_arg(dp, 0), ei, &radix);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(radix<2 || radix>36) if(radix<2 || radix>36)
return throw_type_error(dispex->ctx, ei, IDS_INVALID_CALL_ARG, NULL); return throw_type_error(ctx, ei, IDS_INVALID_CALL_ARG, NULL);
} }
if(V_VT(&number->num) == VT_I4) if(V_VT(&number->num) == VT_I4)
@ -73,7 +73,7 @@ static HRESULT Number_toString(script_ctx_t *ctx, DispatchEx *dispex, WORD flags
val = V_R8(&number->num); val = V_R8(&number->num);
if(radix==10 || isnan(val) || isinf(val)) { if(radix==10 || isnan(val) || isinf(val)) {
hres = to_string(dispex->ctx, &number->num, ei, &str); hres = to_string(ctx, &number->num, ei, &str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
} }
@ -204,7 +204,7 @@ static HRESULT Number_valueOf(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
TRACE("\n"); TRACE("\n");
if(!is_class(dispex, JSCLASS_NUMBER)) if(!is_class(dispex, JSCLASS_NUMBER))
return throw_type_error(dispex->ctx, ei, IDS_NOT_NUM, NULL); return throw_type_error(ctx, ei, IDS_NOT_NUM, NULL);
if(retv) { if(retv) {
NumberInstance *number = (NumberInstance*)dispex; NumberInstance *number = (NumberInstance*)dispex;
@ -220,7 +220,7 @@ static HRESULT Number_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
switch(flags) { switch(flags) {
case INVOKE_FUNC: case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL); return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
case DISPATCH_PROPERTYGET: case DISPATCH_PROPERTYGET:
*retv = number->num; *retv = number->num;
break; break;
@ -269,7 +269,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
return S_OK; return S_OK;
} }
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &num); hres = to_number(ctx, get_arg(dp, 0), ei, &num);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -281,7 +281,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
DispatchEx *obj; DispatchEx *obj;
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &num); hres = to_number(ctx, get_arg(dp, 0), ei, &num);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
@ -289,7 +289,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
V_I4(&num) = 0; V_I4(&num) = 0;
} }
hres = create_number(dispex->ctx, &num, &obj); hres = create_number(ctx, &num, &obj);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;

View File

@ -124,7 +124,7 @@ static HRESULT Object_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
switch(flags) { switch(flags) {
case INVOKE_FUNC: case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL); return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
case DISPATCH_PROPERTYGET: case DISPATCH_PROPERTYGET:
V_VT(retv) = VT_BSTR; V_VT(retv) = VT_BSTR;
V_BSTR(retv) = SysAllocString(default_valueW); V_BSTR(retv) = SysAllocString(default_valueW);
@ -177,7 +177,7 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
if(V_VT(arg) != VT_EMPTY && V_VT(arg) != VT_NULL) { if(V_VT(arg) != VT_EMPTY && V_VT(arg) != VT_NULL) {
IDispatch *disp; IDispatch *disp;
hres = to_object(dispex->ctx, arg, &disp); hres = to_object(ctx, arg, &disp);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -194,7 +194,7 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
case DISPATCH_CONSTRUCT: { case DISPATCH_CONSTRUCT: {
DispatchEx *obj; DispatchEx *obj;
hres = create_object(dispex->ctx, NULL, &obj); hres = create_object(ctx, NULL, &obj);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;

View File

@ -3294,7 +3294,7 @@ out:
return re; return re;
} }
static HRESULT do_regexp_match_next(RegExpInstance *regexp, const WCHAR *str, DWORD len, static HRESULT do_regexp_match_next(script_ctx_t *ctx, RegExpInstance *regexp, const WCHAR *str, DWORD len,
const WCHAR **cp, match_result_t **parens, DWORD *parens_size, DWORD *parens_cnt, match_result_t *ret) const WCHAR **cp, match_result_t **parens, DWORD *parens_size, DWORD *parens_cnt, match_result_t *ret)
{ {
REMatchState *x, *result; REMatchState *x, *result;
@ -3305,7 +3305,7 @@ static HRESULT do_regexp_match_next(RegExpInstance *regexp, const WCHAR *str, DW
gData.cpend = str + len; gData.cpend = str + len;
gData.start = *cp-str; gData.start = *cp-str;
gData.skipped = 0; gData.skipped = 0;
gData.pool = &regexp->dispex.ctx->tmp_heap; gData.pool = &ctx->tmp_heap;
x = InitMatch(NULL, &gData, regexp->jsregexp, gData.cpend - gData.cpbegin); x = InitMatch(NULL, &gData, regexp->jsregexp, gData.cpend - gData.cpbegin);
if(!x) { if(!x) {
@ -3355,7 +3355,7 @@ static HRESULT do_regexp_match_next(RegExpInstance *regexp, const WCHAR *str, DW
return S_OK; return S_OK;
} }
HRESULT regexp_match_next(DispatchEx *dispex, BOOL gcheck, const WCHAR *str, DWORD len, HRESULT regexp_match_next(script_ctx_t *ctx, DispatchEx *dispex, BOOL gcheck, const WCHAR *str, DWORD len,
const WCHAR **cp, match_result_t **parens, DWORD *parens_size, DWORD *parens_cnt, match_result_t *ret) const WCHAR **cp, match_result_t **parens, DWORD *parens_size, DWORD *parens_cnt, match_result_t *ret)
{ {
RegExpInstance *regexp = (RegExpInstance*)dispex; RegExpInstance *regexp = (RegExpInstance*)dispex;
@ -3365,16 +3365,16 @@ HRESULT regexp_match_next(DispatchEx *dispex, BOOL gcheck, const WCHAR *str, DWO
if(gcheck && !(regexp->jsregexp->flags & JSREG_GLOB)) if(gcheck && !(regexp->jsregexp->flags & JSREG_GLOB))
return S_FALSE; return S_FALSE;
mark = jsheap_mark(&regexp->dispex.ctx->tmp_heap); mark = jsheap_mark(&ctx->tmp_heap);
hres = do_regexp_match_next(regexp, str, len, cp, parens, parens_size, parens_cnt, ret); hres = do_regexp_match_next(ctx, regexp, str, len, cp, parens, parens_size, parens_cnt, ret);
jsheap_clear(mark); jsheap_clear(mark);
return hres; return hres;
} }
HRESULT regexp_match(DispatchEx *dispex, const WCHAR *str, DWORD len, BOOL gflag, match_result_t **match_result, HRESULT regexp_match(script_ctx_t *ctx, DispatchEx *dispex, const WCHAR *str, DWORD len, BOOL gflag,
DWORD *result_cnt) match_result_t **match_result, DWORD *result_cnt)
{ {
RegExpInstance *This = (RegExpInstance*)dispex; RegExpInstance *This = (RegExpInstance*)dispex;
match_result_t *ret = NULL, cres; match_result_t *ret = NULL, cres;
@ -3383,10 +3383,10 @@ HRESULT regexp_match(DispatchEx *dispex, const WCHAR *str, DWORD len, BOOL gflag
jsheap_t *mark; jsheap_t *mark;
HRESULT hres; HRESULT hres;
mark = jsheap_mark(&This->dispex.ctx->tmp_heap); mark = jsheap_mark(&ctx->tmp_heap);
while(1) { while(1) {
hres = do_regexp_match_next(This, str, len, &cp, NULL, NULL, NULL, &cres); hres = do_regexp_match_next(ctx, This, str, len, &cp, NULL, NULL, NULL, &cres);
if(hres == S_FALSE) { if(hres == S_FALSE) {
hres = S_OK; hres = S_OK;
break; break;
@ -3558,7 +3558,7 @@ static HRESULT create_match_array(script_ctx_t *ctx, BSTR input, const match_res
return S_OK; return S_OK;
} }
static HRESULT run_exec(DispatchEx *dispex, VARIANT *arg, jsexcept_t *ei, BSTR *input, static HRESULT run_exec(script_ctx_t *ctx, DispatchEx *dispex, VARIANT *arg, jsexcept_t *ei, BSTR *input,
match_result_t *match, match_result_t **parens, DWORD *parens_cnt, VARIANT_BOOL *ret) match_result_t *match, match_result_t **parens, DWORD *parens_cnt, VARIANT_BOOL *ret)
{ {
RegExpInstance *regexp; RegExpInstance *regexp;
@ -3575,7 +3575,7 @@ static HRESULT run_exec(DispatchEx *dispex, VARIANT *arg, jsexcept_t *ei, BSTR *
regexp = (RegExpInstance*)dispex; regexp = (RegExpInstance*)dispex;
if(arg) { if(arg) {
hres = to_string(regexp->dispex.ctx, arg, ei, &string); hres = to_string(ctx, arg, ei, &string);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
@ -3589,7 +3589,7 @@ static HRESULT run_exec(DispatchEx *dispex, VARIANT *arg, jsexcept_t *ei, BSTR *
last_index = regexp->last_index; last_index = regexp->last_index;
cp = string + last_index; cp = string + last_index;
hres = regexp_match_next(&regexp->dispex, FALSE, string, length, &cp, parens, parens ? &parens_size : NULL, hres = regexp_match_next(ctx, &regexp->dispex, FALSE, string, length, &cp, parens, parens ? &parens_size : NULL,
parens_cnt, match); parens_cnt, match);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(string); SysFreeString(string);
@ -3620,7 +3620,7 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DI
TRACE("\n"); TRACE("\n");
hres = run_exec(dispex, arg_cnt(dp) ? get_arg(dp,0) : NULL, ei, &string, &match, &parens, &parens_cnt, &b); hres = run_exec(ctx, dispex, arg_cnt(dp) ? get_arg(dp,0) : NULL, ei, &string, &match, &parens, &parens_cnt, &b);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -3628,7 +3628,7 @@ static HRESULT RegExp_exec(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DI
if(b) { if(b) {
IDispatch *ret; IDispatch *ret;
hres = create_match_array(dispex->ctx, string, &match, parens, parens_cnt, ei, &ret); hres = create_match_array(ctx, string, &match, parens, parens_cnt, ei, &ret);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
V_VT(retv) = VT_DISPATCH; V_VT(retv) = VT_DISPATCH;
V_DISPATCH(retv) = ret; V_DISPATCH(retv) = ret;
@ -3652,7 +3652,7 @@ static HRESULT RegExp_test(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DI
TRACE("\n"); TRACE("\n");
hres = run_exec(dispex, arg_cnt(dp) ? get_arg(dp,0) : NULL, ei, NULL, &match, NULL, NULL, &b); hres = run_exec(ctx, dispex, arg_cnt(dp) ? get_arg(dp,0) : NULL, ei, NULL, &match, NULL, NULL, &b);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -3670,7 +3670,7 @@ static HRESULT RegExp_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
switch(flags) { switch(flags) {
case INVOKE_FUNC: case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL); return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
default: default:
FIXME("unimplemented flags %x\n", flags); FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL; return E_NOTIMPL;
@ -3843,7 +3843,7 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
if(is_class(jsdisp, JSCLASS_REGEXP)) { if(is_class(jsdisp, JSCLASS_REGEXP)) {
if(arg_cnt(dp) > 1 && V_VT(get_arg(dp,1)) != VT_EMPTY) { if(arg_cnt(dp) > 1 && V_VT(get_arg(dp,1)) != VT_EMPTY) {
jsdisp_release(jsdisp); jsdisp_release(jsdisp);
return throw_regexp_error(dispex->ctx, ei, IDS_REGEXP_SYNTAX_ERROR, NULL); return throw_regexp_error(ctx, ei, IDS_REGEXP_SYNTAX_ERROR, NULL);
} }
if(retv) { if(retv) {
@ -3860,7 +3860,7 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
} }
/* fall through */ /* fall through */
case DISPATCH_CONSTRUCT: case DISPATCH_CONSTRUCT:
return regexp_constructor(dispex->ctx, dp, retv); return regexp_constructor(ctx, dp, retv);
default: default:
FIXME("unimplemented flags: %x\n", flags); FIXME("unimplemented flags: %x\n", flags);
return E_NOTIMPL; return E_NOTIMPL;

View File

@ -125,7 +125,7 @@ static HRESULT String_valueOf(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
return stringobj_to_string(dispex, retv); return stringobj_to_string(dispex, retv);
} }
static HRESULT do_attributeless_tag_format(DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp, const WCHAR *tagname) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp, const WCHAR *tagname)
{ {
static const WCHAR tagfmt[] = {'<','%','s','>','%','s','<','/','%','s','>',0}; static const WCHAR tagfmt[] = {'<','%','s','>','%','s','<','/','%','s','>',0};
@ -140,7 +140,7 @@ static HRESULT do_attributeless_tag_format(DispatchEx *dispex, WORD flags, DISPP
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -171,7 +171,7 @@ static HRESULT do_attributeless_tag_format(DispatchEx *dispex, WORD flags, DISPP
return S_OK; return S_OK;
} }
static HRESULT do_attribute_tag_format(DispatchEx *dispex, WORD flags, static HRESULT do_attribute_tag_format(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp,
const WCHAR *tagname, const WCHAR *attr) const WCHAR *tagname, const WCHAR *attr)
{ {
@ -190,7 +190,7 @@ static HRESULT do_attribute_tag_format(DispatchEx *dispex, WORD flags,
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -205,7 +205,7 @@ static HRESULT do_attribute_tag_format(DispatchEx *dispex, WORD flags,
} }
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &attr_value); hres = to_string(ctx, get_arg(dp, 0), ei, &attr_value);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -245,28 +245,28 @@ static HRESULT String_anchor(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
static const WCHAR fontW[] = {'A',0}; static const WCHAR fontW[] = {'A',0};
static const WCHAR colorW[] = {'N','A','M','E',0}; static const WCHAR colorW[] = {'N','A','M','E',0};
return do_attribute_tag_format(dispex, flags, dp, retv, ei, sp, fontW, colorW); return do_attribute_tag_format(ctx, dispex, flags, dp, retv, ei, sp, fontW, colorW);
} }
static HRESULT String_big(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT String_big(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
static const WCHAR bigtagW[] = {'B','I','G',0}; static const WCHAR bigtagW[] = {'B','I','G',0};
return do_attributeless_tag_format(dispex, flags, dp, retv, ei, sp, bigtagW); return do_attributeless_tag_format(ctx, dispex, flags, dp, retv, ei, sp, bigtagW);
} }
static HRESULT String_blink(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT String_blink(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
static const WCHAR blinktagW[] = {'B','L','I','N','K',0}; static const WCHAR blinktagW[] = {'B','L','I','N','K',0};
return do_attributeless_tag_format(dispex, flags, dp, retv, ei, sp, blinktagW); return do_attributeless_tag_format(ctx, dispex, flags, dp, retv, ei, sp, blinktagW);
} }
static HRESULT String_bold(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT String_bold(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
static const WCHAR boldtagW[] = {'B',0}; static const WCHAR boldtagW[] = {'B',0};
return do_attributeless_tag_format(dispex, flags, dp, retv, ei, sp, boldtagW); return do_attributeless_tag_format(ctx, dispex, flags, dp, retv, ei, sp, boldtagW);
} }
/* ECMA-262 3rd Edition 15.5.4.5 */ /* ECMA-262 3rd Edition 15.5.4.5 */
@ -287,7 +287,7 @@ static HRESULT String_charAt(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -304,7 +304,7 @@ static HRESULT String_charAt(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
VARIANT num; VARIANT num;
hres = to_integer(dispex->ctx, get_arg(dp, 0), ei, &num); hres = to_integer(ctx, get_arg(dp, 0), ei, &num);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -354,7 +354,7 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, DispatchEx *dispex, WORD fla
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -371,7 +371,7 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, DispatchEx *dispex, WORD fla
if(arg_cnt(dp) > 0) { if(arg_cnt(dp) > 0) {
VARIANT v; VARIANT v;
hres = to_integer(dispex->ctx, get_arg(dp, 0), ei, &v); hres = to_integer(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -415,10 +415,10 @@ static HRESULT String_concat(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
V_VT(&var) = VT_DISPATCH; V_VT(&var) = VT_DISPATCH;
V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &var, ei, strs); hres = to_string(ctx, &var, ei, strs);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
for(i=0; i < arg_cnt(dp); i++) { for(i=0; i < arg_cnt(dp); i++) {
hres = to_string(dispex->ctx, get_arg(dp, i), ei, strs+i+1); hres = to_string(ctx, get_arg(dp, i), ei, strs+i+1);
if(FAILED(hres)) if(FAILED(hres))
break; break;
} }
@ -457,7 +457,7 @@ static HRESULT String_fixed(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
static const WCHAR fixedtagW[] = {'T','T',0}; static const WCHAR fixedtagW[] = {'T','T',0};
return do_attributeless_tag_format(dispex, flags, dp, retv, ei, sp, fixedtagW); return do_attributeless_tag_format(ctx, dispex, flags, dp, retv, ei, sp, fixedtagW);
} }
static HRESULT String_fontcolor(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT String_fontcolor(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -466,7 +466,7 @@ static HRESULT String_fontcolor(script_ctx_t *ctx, DispatchEx *dispex, WORD flag
static const WCHAR fontW[] = {'F','O','N','T',0}; static const WCHAR fontW[] = {'F','O','N','T',0};
static const WCHAR colorW[] = {'C','O','L','O','R',0}; static const WCHAR colorW[] = {'C','O','L','O','R',0};
return do_attribute_tag_format(dispex, flags, dp, retv, ei, sp, fontW, colorW); return do_attribute_tag_format(ctx, dispex, flags, dp, retv, ei, sp, fontW, colorW);
} }
static HRESULT String_fontsize(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT String_fontsize(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -475,7 +475,7 @@ static HRESULT String_fontsize(script_ctx_t *ctx, DispatchEx *dispex, WORD flags
static const WCHAR fontW[] = {'F','O','N','T',0}; static const WCHAR fontW[] = {'F','O','N','T',0};
static const WCHAR colorW[] = {'S','I','Z','E',0}; static const WCHAR colorW[] = {'S','I','Z','E',0};
return do_attribute_tag_format(dispex, flags, dp, retv, ei, sp, fontW, colorW); return do_attribute_tag_format(ctx, dispex, flags, dp, retv, ei, sp, fontW, colorW);
} }
static HRESULT String_indexOf(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT String_indexOf(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -495,7 +495,7 @@ static HRESULT String_indexOf(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -518,7 +518,7 @@ static HRESULT String_indexOf(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
return S_OK; return S_OK;
} }
hres = to_string(dispex->ctx, get_arg(dp,0), ei, &search_str); hres = to_string(ctx, get_arg(dp,0), ei, &search_str);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -527,7 +527,7 @@ static HRESULT String_indexOf(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
if(arg_cnt(dp) >= 2) { if(arg_cnt(dp) >= 2) {
VARIANT ival; VARIANT ival;
hres = to_integer(dispex->ctx, get_arg(dp,1), ei, &ival); hres = to_integer(ctx, get_arg(dp,1), ei, &ival);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
if(V_VT(&ival) == VT_I4) if(V_VT(&ival) == VT_I4)
pos = V_VT(&ival) > 0 ? V_I4(&ival) : 0; pos = V_VT(&ival) > 0 ? V_I4(&ival) : 0;
@ -564,7 +564,7 @@ static HRESULT String_italics(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
static const WCHAR italicstagW[] = {'I',0}; static const WCHAR italicstagW[] = {'I',0};
return do_attributeless_tag_format(dispex, flags, dp, retv, ei, sp, italicstagW); return do_attributeless_tag_format(ctx, dispex, flags, dp, retv, ei, sp, italicstagW);
} }
/* ECMA-262 3rd Edition 15.5.4.8 */ /* ECMA-262 3rd Edition 15.5.4.8 */
@ -590,7 +590,7 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -607,7 +607,7 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
return S_OK; return S_OK;
} }
hres = to_string(dispex->ctx, get_arg(dp,0), ei, &search_str); hres = to_string(ctx, get_arg(dp,0), ei, &search_str);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -618,7 +618,7 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
if(arg_cnt(dp) >= 2) { if(arg_cnt(dp) >= 2) {
VARIANT ival; VARIANT ival;
hres = to_integer(dispex->ctx, get_arg(dp,1), ei, &ival); hres = to_integer(ctx, get_arg(dp,1), ei, &ival);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
if(V_VT(&ival) == VT_I4) if(V_VT(&ival) == VT_I4)
pos = V_VT(&ival) > 0 ? V_I4(&ival) : 0; pos = V_VT(&ival) > 0 ? V_I4(&ival) : 0;
@ -660,7 +660,7 @@ static HRESULT String_link(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DI
static const WCHAR fontW[] = {'A',0}; static const WCHAR fontW[] = {'A',0};
static const WCHAR colorW[] = {'H','R','E','F',0}; static const WCHAR colorW[] = {'H','R','E','F',0};
return do_attribute_tag_format(dispex, flags, dp, retv, ei, sp, fontW, colorW); return do_attribute_tag_format(ctx, dispex, flags, dp, retv, ei, sp, fontW, colorW);
} }
/* ECMA-262 3rd Edition 15.5.4.10 */ /* ECMA-262 3rd Edition 15.5.4.10 */
@ -698,11 +698,11 @@ static HRESULT String_match(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
default: { default: {
BSTR match_str; BSTR match_str;
hres = to_string(dispex->ctx, arg_var, ei, &match_str); hres = to_string(ctx, arg_var, ei, &match_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = create_regexp_str(dispex->ctx, match_str, SysStringLen(match_str), NULL, 0, &regexp); hres = create_regexp_str(ctx, match_str, SysStringLen(match_str), NULL, 0, &regexp);
SysFreeString(match_str); SysFreeString(match_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -715,7 +715,7 @@ static HRESULT String_match(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) { if(FAILED(hres)) {
jsdisp_release(regexp); jsdisp_release(regexp);
return hres; return hres;
@ -731,7 +731,7 @@ static HRESULT String_match(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
length = this->length; length = this->length;
} }
hres = regexp_match(regexp, str, length, FALSE, &match_result, &match_cnt); hres = regexp_match(ctx, regexp, str, length, FALSE, &match_result, &match_cnt);
jsdisp_release(regexp); jsdisp_release(regexp);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
@ -748,7 +748,7 @@ static HRESULT String_match(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
return S_OK; return S_OK;
} }
hres = create_array(dispex->ctx, match_cnt, &array); hres = create_array(ctx, match_cnt, &array);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -814,8 +814,8 @@ static HRESULT strbuf_append(strbuf_t *buf, const WCHAR *str, DWORD len)
return S_OK; return S_OK;
} }
static HRESULT rep_call(DispatchEx *func, const WCHAR *str, match_result_t *match, match_result_t *parens, static HRESULT rep_call(script_ctx_t *ctx, DispatchEx *func, const WCHAR *str, match_result_t *match,
DWORD parens_cnt, BSTR *ret, jsexcept_t *ei, IServiceProvider *caller) match_result_t *parens, DWORD parens_cnt, BSTR *ret, jsexcept_t *ei, IServiceProvider *caller)
{ {
DISPPARAMS dp = {NULL, NULL, 0, 0}; DISPPARAMS dp = {NULL, NULL, 0, 0};
VARIANTARG *args, *arg; VARIANTARG *args, *arg;
@ -870,7 +870,7 @@ static HRESULT rep_call(DispatchEx *func, const WCHAR *str, match_result_t *matc
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = to_string(func->ctx, &var, ei, ret); hres = to_string(ctx, &var, ei, ret);
VariantClear(&var); VariantClear(&var);
return hres; return hres;
} }
@ -897,7 +897,7 @@ static HRESULT String_replace(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -939,7 +939,7 @@ static HRESULT String_replace(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
} }
default: default:
hres = to_string(dispex->ctx, arg_var, ei, &match_str); hres = to_string(ctx, arg_var, ei, &match_str);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -961,7 +961,7 @@ static HRESULT String_replace(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
} }
default: default:
hres = to_string(dispex->ctx, arg_var, ei, &rep_str); hres = to_string(ctx, arg_var, ei, &rep_str);
if(FAILED(hres)) if(FAILED(hres))
break; break;
@ -978,8 +978,8 @@ static HRESULT String_replace(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
while(1) { while(1) {
if(regexp) { if(regexp) {
hres = regexp_match_next(regexp, gcheck, str, length, &cp, parens_ptr, hres = regexp_match_next(ctx, regexp, gcheck, str, length, &cp, parens_ptr,
&parens_size, &parens_cnt, &match); &parens_size, &parens_cnt, &match);
gcheck = TRUE; gcheck = TRUE;
if(hres == S_FALSE) { if(hres == S_FALSE) {
@ -1004,7 +1004,7 @@ static HRESULT String_replace(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
if(rep_func) { if(rep_func) {
BSTR cstr; BSTR cstr;
hres = rep_call(rep_func, str, &match, parens, parens_cnt, &cstr, ei, caller); hres = rep_call(ctx, rep_func, str, &match, parens, parens_cnt, &cstr, ei, caller);
if(FAILED(hres)) if(FAILED(hres))
break; break;
@ -1136,7 +1136,7 @@ static HRESULT String_slice(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -1151,7 +1151,7 @@ static HRESULT String_slice(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
} }
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
hres = to_integer(dispex->ctx, get_arg(dp,0), ei, &v); hres = to_integer(ctx, get_arg(dp,0), ei, &v);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -1174,7 +1174,7 @@ static HRESULT String_slice(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
} }
if(arg_cnt(dp) >= 2) { if(arg_cnt(dp) >= 2) {
hres = to_integer(dispex->ctx, get_arg(dp,1), ei, &v); hres = to_integer(ctx, get_arg(dp,1), ei, &v);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -1218,7 +1218,7 @@ static HRESULT String_small(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
static const WCHAR smalltagW[] = {'S','M','A','L','L',0}; static const WCHAR smalltagW[] = {'S','M','A','L','L',0};
return do_attributeless_tag_format(dispex, flags, dp, retv, ei, sp, smalltagW); return do_attributeless_tag_format(ctx, dispex, flags, dp, retv, ei, sp, smalltagW);
} }
static HRESULT String_split(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT String_split(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -1245,7 +1245,7 @@ static HRESULT String_split(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -1267,7 +1267,7 @@ static HRESULT String_split(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg)); regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg));
if(regexp) { if(regexp) {
if(is_class(regexp, JSCLASS_REGEXP)) { if(is_class(regexp, JSCLASS_REGEXP)) {
hres = regexp_match(regexp, str, length, TRUE, &match_result, &match_cnt); hres = regexp_match(ctx, regexp, str, length, TRUE, &match_result, &match_cnt);
jsdisp_release(regexp); jsdisp_release(regexp);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
@ -1279,7 +1279,7 @@ static HRESULT String_split(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
} }
} }
default: default:
hres = to_string(dispex->ctx, arg, ei, &match_str); hres = to_string(ctx, arg, ei, &match_str);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -1292,7 +1292,7 @@ static HRESULT String_split(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
} }
} }
hres = create_array(dispex->ctx, 0, &array); hres = create_array(ctx, 0, &array);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
ptr = str; ptr = str;
@ -1366,14 +1366,14 @@ static HRESULT String_strike(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
static const WCHAR striketagW[] = {'S','T','R','I','K','E',0}; static const WCHAR striketagW[] = {'S','T','R','I','K','E',0};
return do_attributeless_tag_format(dispex, flags, dp, retv, ei, sp, striketagW); return do_attributeless_tag_format(ctx, dispex, flags, dp, retv, ei, sp, striketagW);
} }
static HRESULT String_sub(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT String_sub(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
static const WCHAR subtagW[] = {'S','U','B',0}; static const WCHAR subtagW[] = {'S','U','B',0};
return do_attributeless_tag_format(dispex, flags, dp, retv, ei, sp, subtagW); return do_attributeless_tag_format(ctx, dispex, flags, dp, retv, ei, sp, subtagW);
} }
/* ECMA-262 3rd Edition 15.5.4.15 */ /* ECMA-262 3rd Edition 15.5.4.15 */
@ -1395,7 +1395,7 @@ static HRESULT String_substring(script_ctx_t *ctx, DispatchEx *dispex, WORD flag
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -1410,7 +1410,7 @@ static HRESULT String_substring(script_ctx_t *ctx, DispatchEx *dispex, WORD flag
} }
if(arg_cnt(dp) >= 1) { if(arg_cnt(dp) >= 1) {
hres = to_integer(dispex->ctx, get_arg(dp,0), ei, &v); hres = to_integer(ctx, get_arg(dp,0), ei, &v);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -1428,7 +1428,7 @@ static HRESULT String_substring(script_ctx_t *ctx, DispatchEx *dispex, WORD flag
} }
if(arg_cnt(dp) >= 2) { if(arg_cnt(dp) >= 2) {
hres = to_integer(dispex->ctx, get_arg(dp,1), ei, &v); hres = to_integer(ctx, get_arg(dp,1), ei, &v);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -1488,7 +1488,7 @@ static HRESULT String_substr(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -1497,7 +1497,7 @@ static HRESULT String_substr(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
} }
if(arg_cnt(dp) >= 1) { if(arg_cnt(dp) >= 1) {
hres = to_integer(dispex->ctx, get_arg(dp,0), ei, &v); hres = to_integer(ctx, get_arg(dp,0), ei, &v);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -1515,7 +1515,7 @@ static HRESULT String_substr(script_ctx_t *ctx, DispatchEx *dispex, WORD flags,
} }
if(arg_cnt(dp) >= 2) { if(arg_cnt(dp) >= 2) {
hres = to_integer(dispex->ctx, get_arg(dp,1), ei, &v); hres = to_integer(ctx, get_arg(dp,1), ei, &v);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(val_str); SysFreeString(val_str);
return hres; return hres;
@ -1550,7 +1550,7 @@ static HRESULT String_sup(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DIS
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
static const WCHAR suptagW[] = {'S','U','P',0}; static const WCHAR suptagW[] = {'S','U','P',0};
return do_attributeless_tag_format(dispex, flags, dp, retv, ei, sp, suptagW); return do_attributeless_tag_format(ctx, dispex, flags, dp, retv, ei, sp, suptagW);
} }
static HRESULT String_toLowerCase(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp, static HRESULT String_toLowerCase(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
@ -1569,7 +1569,7 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -1615,7 +1615,7 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
V_VT(&this) = VT_DISPATCH; V_VT(&this) = VT_DISPATCH;
V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex); V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
hres = to_string(dispex->ctx, &this, ei, &val_str); hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -1675,7 +1675,7 @@ static HRESULT String_value(script_ctx_t *ctx, DispatchEx *dispex, WORD flags, D
switch(flags) { switch(flags) {
case INVOKE_FUNC: case INVOKE_FUNC:
return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL); return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
case DISPATCH_PROPERTYGET: { case DISPATCH_PROPERTYGET: {
BSTR str = SysAllocString(This->str); BSTR str = SysAllocString(This->str);
if(!str) if(!str)
@ -1759,7 +1759,7 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, DispatchEx *dispex,
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
for(i=0; i<arg_cnt(dp); i++) { for(i=0; i<arg_cnt(dp); i++) {
hres = to_uint32(dispex->ctx, get_arg(dp, i), ei, &code); hres = to_uint32(ctx, get_arg(dp, i), ei, &code);
if(FAILED(hres)) { if(FAILED(hres)) {
SysFreeString(ret); SysFreeString(ret);
return hres; return hres;
@ -1789,7 +1789,7 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
BSTR str; BSTR str;
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &str); hres = to_string(ctx, get_arg(dp, 0), ei, &str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
@ -1808,14 +1808,14 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, DispatchEx *dispex, WORD fl
if(arg_cnt(dp)) { if(arg_cnt(dp)) {
BSTR str; BSTR str;
hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &str); hres = to_string(ctx, get_arg(dp, 0), ei, &str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = create_string(dispex->ctx, str, SysStringLen(str), &ret); hres = create_string(ctx, str, SysStringLen(str), &ret);
SysFreeString(str); SysFreeString(str);
}else { }else {
hres = create_string(dispex->ctx, NULL, 0, &ret); hres = create_string(ctx, NULL, 0, &ret);
} }
if(FAILED(hres)) if(FAILED(hres))