--- /dev/null
+/*
+ * Copyright 2009 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include "jscript.h"
+#include "objsafe.h"
+#include "mshtmhst.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(jscript);
+
+/* Defined as extern in urlmon.idl, but not exported by uuid.lib */
+const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY =
+ {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}};
+
+static IInternetHostSecurityManager *get_sec_mgr(script_ctx_t *ctx)
+{
+ IInternetHostSecurityManager *secmgr;
+ IServiceProvider *sp;
+ HRESULT hres;
+
+ if(!ctx->site)
+ return NULL;
+
+ if(ctx->secmgr)
+ return ctx->secmgr;
+
+ hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IServiceProvider, (void**)&sp);
+ if(FAILED(hres))
+ return NULL;
+
+ hres = IServiceProvider_QueryService(sp, &SID_SInternetHostSecurityManager, &IID_IInternetHostSecurityManager,
+ (void**)&secmgr);
+ IServiceProvider_Release(sp);
+ if(FAILED(hres))
+ return NULL;
+
+ return ctx->secmgr = secmgr;
+}
+
+static IUnknown *create_activex_object(script_ctx_t *ctx, const WCHAR *progid)
+{
+ IInternetHostSecurityManager *secmgr;
+ IObjectWithSite *obj_site;
+ struct CONFIRMSAFETY cs;
+ IClassFactoryEx *cfex;
+ IClassFactory *cf;
+ DWORD policy_size;
+ BYTE *bpolicy;
+ IUnknown *obj;
+ DWORD policy;
+ GUID guid;
+ HRESULT hres;
+
+ hres = CLSIDFromProgID(progid, &guid);
+ if(FAILED(hres))
+ return NULL;
+
+ TRACE("GUID %s\n", debugstr_guid(&guid));
+
+ secmgr = get_sec_mgr(ctx);
+ if(!secmgr)
+ return NULL;
+
+ policy = 0;
+ hres = IInternetHostSecurityManager_ProcessUrlAction(secmgr, URLACTION_ACTIVEX_RUN, (BYTE*)&policy, sizeof(policy),
+ (BYTE*)&guid, sizeof(GUID), 0, 0);
+ if(FAILED(hres) || policy != URLPOLICY_ALLOW)
+ return NULL;
+
+ hres = CoGetClassObject(&guid, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, NULL, &IID_IClassFactory, (void**)&cf);
+ if(FAILED(hres))
+ return NULL;
+
+ hres = IClassFactory_QueryInterface(cf, &IID_IClassFactoryEx, (void**)&cfex);
+ if(SUCCEEDED(hres)) {
+ FIXME("Use IClassFactoryEx\n");
+ IClassFactoryEx_Release(cfex);
+ }
+
+ hres = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void**)&obj);
+ if(FAILED(hres))
+ return NULL;
+
+ cs.clsid = guid;
+ cs.pUnk = obj;
+ cs.dwFlags = 0;
+ hres = IInternetHostSecurityManager_QueryCustomPolicy(secmgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY, &bpolicy, &policy_size,
+ (BYTE*)&cs, sizeof(cs), 0);
+ if(SUCCEEDED(hres)) {
+ policy = policy_size >= sizeof(DWORD) ? *(DWORD*)bpolicy : URLPOLICY_DISALLOW;
+ CoTaskMemFree(bpolicy);
+ }
+
+ if(FAILED(hres) || policy != URLPOLICY_ALLOW) {
+ IUnknown_Release(obj);
+ return NULL;
+ }
+
+ hres = IUnknown_QueryInterface(obj, &IID_IObjectWithSite, (void**)&obj_site);
+ if(SUCCEEDED(hres)) {
+ IUnknown *ax_site;
+
+ ax_site = create_ax_site(ctx);
+ if(ax_site) {
+ hres = IObjectWithSite_SetSite(obj_site, ax_site);
+ IUnknown_Release(ax_site);
+ }
+ IObjectWithSite_Release(obj_site);
+ if(!ax_site || FAILED(hres)) {
+ IObjectWithSite_Release(obj_site);
+ IUnknown_Release(obj);
+ return NULL;
+ }
+ }
+
+ return obj;
+}
+
+static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
+{
+ IDispatch *disp;
+ IUnknown *obj;
+ BSTR progid;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ if(flags != DISPATCH_CONSTRUCT) {
+ FIXME("unsupported flags %x\n", flags);
+ return E_NOTIMPL;
+ }
+
+ if(ctx->safeopt != (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER)) {
+ FIXME("Unsupported safeopt %x\n", ctx->safeopt);
+ return E_NOTIMPL;
+ }
+
+ if(arg_cnt(dp) != 1) {
+ FIXME("unsupported arg_cnt %d\n", arg_cnt(dp));
+ return E_NOTIMPL;
+ }
+
+ hres = to_string(ctx, get_arg(dp,0), ei, &progid);
+ if(FAILED(hres))
+ return hres;
+
+ obj = create_activex_object(ctx, progid);
+ SysFreeString(progid);
+ if(!obj)
+ return throw_generic_error(ctx, ei, IDS_CREATE_OBJ_ERROR, NULL);
+
+ hres = IUnknown_QueryInterface(obj, &IID_IDispatch, (void**)&disp);
+ IUnknown_Release(obj);
+ if(FAILED(hres)) {
+ FIXME("Object does not support IDispatch\n");
+ return E_NOTIMPL;
+ }
+
+ V_VT(retv) = VT_DISPATCH;
+ V_DISPATCH(retv) = disp;
+ return S_OK;
+}
+
+HRESULT create_activex_constr(script_ctx_t *ctx, DispatchEx **ret)
+{
+ DispatchEx *prototype;
+ HRESULT hres;
+
+ static const WCHAR ActiveXObjectW[] = {'A','c','t','i','v','e','X','O','b','j','e','c','t',0};
+
+ hres = create_object(ctx, NULL, &prototype);
+ if(FAILED(hres))
+ return hres;
+
+ hres = create_builtin_function(ctx, ActiveXObject_value, ActiveXObjectW, NULL, PROPF_CONSTR, prototype, ret);
+
+ jsdisp_release(prototype);
+ return hres;
+}
static const WCHAR default_separatorW[] = {',',0};
-static HRESULT Array_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static inline ArrayInstance *array_from_vdisp(vdisp_t *vdisp)
+{
+ return (ArrayInstance*)vdisp->u.jsdisp;
+}
+
+static inline ArrayInstance *array_this(vdisp_t *jsthis)
+{
+ return is_vclass(jsthis, JSCLASS_ARRAY) ? array_from_vdisp(jsthis) : NULL;
+}
+
+static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsexcept_t *ei, DispatchEx **jsthis, DWORD *ret)
+{
+ ArrayInstance *array;
+ VARIANT var;
+ HRESULT hres;
+
+ array = array_this(vdisp);
+ if(array) {
+ *jsthis = &array->dispex;
+ *ret = array->length;
+ return S_OK;
+ }
+
+ if(!is_jsdisp(vdisp))
+ return throw_type_error(ctx, ei, IDS_JSCRIPT_EXPECTED, NULL);
+
+ hres = jsdisp_propget_name(vdisp->u.jsdisp, lengthW, &var, ei, NULL/*FIXME*/);
+ if(FAILED(hres))
+ return hres;
+
+ hres = to_uint32(ctx, &var, ei, ret);
+ VariantClear(&var);
+ if(FAILED(hres))
+ return hres;
+
+ *jsthis = vdisp->u.jsdisp;
+ return S_OK;
+}
+
+static HRESULT set_length(DispatchEx *obj, jsexcept_t *ei, DWORD length)
+{
+ VARIANT var;
+
+ if(is_class(obj, JSCLASS_ARRAY)) {
+ ((ArrayInstance*)obj)->length = length;
+ return S_OK;
+ }
+
+ V_VT(&var) = VT_I4;
+ V_I4(&var) = length;
+ return jsdisp_propput_name(obj, lengthW, &var, ei, NULL/*FIXME*/);
+}
+
+static WCHAR *idx_to_str(DWORD idx, WCHAR *ptr)
+{
+ if(!idx) {
+ *ptr = '0';
+ return ptr;
+ }
+
+ while(idx) {
+ *ptr-- = '0' + (idx%10);
+ idx /= 10;
+ }
+
+ return ptr+1;
+}
+
+static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- ArrayInstance *This = (ArrayInstance*)dispex;
+ ArrayInstance *This = array_from_vdisp(jsthis);
TRACE("%p %d\n", This, This->length);
DWORD i;
HRESULT hres;
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &num);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &num);
if(V_VT(&num) == VT_I4)
len = V_I4(&num);
else
len = floor(V_R8(&num));
if(len!=(DWORD)len)
- return throw_range_error(dispex->ctx, ei, IDS_INVALID_LENGTH, NULL);
+ return throw_range_error(ctx, ei, IDS_INVALID_LENGTH, NULL);
for(i=len; i<This->length; i++) {
- hres = jsdisp_delete_idx(dispex, i);
+ hres = jsdisp_delete_idx(&This->dispex, i);
if(FAILED(hres))
return hres;
}
return S_OK;
}
-static HRESULT concat_array(DispatchEx *array, ArrayInstance *obj, DWORD *len, LCID lcid,
+static HRESULT concat_array(DispatchEx *array, ArrayInstance *obj, DWORD *len,
jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT var;
HRESULT hres;
for(i=0; i < obj->length; i++) {
- hres = jsdisp_propget_idx(&obj->dispex, i, lcid, &var, ei, caller);
+ hres = jsdisp_propget_idx(&obj->dispex, i, &var, ei, caller);
if(hres == DISP_E_UNKNOWNNAME)
continue;
if(FAILED(hres))
return hres;
- hres = jsdisp_propput_idx(array, *len+i, lcid, &var, ei, caller);
+ hres = jsdisp_propput_idx(array, *len+i, &var, ei, caller);
VariantClear(&var);
if(FAILED(hres))
return hres;
return S_OK;
}
-static HRESULT concat_obj(DispatchEx *array, IDispatch *obj, DWORD *len, LCID lcid, jsexcept_t *ei, IServiceProvider *caller)
+static HRESULT concat_obj(DispatchEx *array, IDispatch *obj, DWORD *len, jsexcept_t *ei, IServiceProvider *caller)
{
DispatchEx *jsobj;
VARIANT var;
jsobj = iface_to_jsdisp((IUnknown*)obj);
if(jsobj) {
if(is_class(jsobj, JSCLASS_ARRAY)) {
- hres = concat_array(array, (ArrayInstance*)jsobj, len, lcid, ei, caller);
+ hres = concat_array(array, (ArrayInstance*)jsobj, len, ei, caller);
jsdisp_release(jsobj);
return hres;
}
V_VT(&var) = VT_DISPATCH;
V_DISPATCH(&var) = obj;
- return jsdisp_propput_idx(array, (*len)++, lcid, &var, ei, caller);
+ return jsdisp_propput_idx(array, (*len)++, &var, ei, caller);
}
-static HRESULT Array_concat(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Array_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
DispatchEx *ret;
TRACE("\n");
- hres = create_array(dispex->ctx, 0, &ret);
+ hres = create_array(ctx, 0, &ret);
if(FAILED(hres))
return hres;
- hres = concat_obj(ret, (IDispatch*)_IDispatchEx_(dispex), &len, lcid, ei, caller);
+ hres = concat_obj(ret, jsthis->u.disp, &len, ei, caller);
if(SUCCEEDED(hres)) {
VARIANT *arg;
DWORD i;
for(i=0; i < arg_cnt(dp); i++) {
arg = get_arg(dp, i);
if(V_VT(arg) == VT_DISPATCH)
- hres = concat_obj(ret, V_DISPATCH(arg), &len, lcid, ei, caller);
+ hres = concat_obj(ret, V_DISPATCH(arg), &len, ei, caller);
else
- hres = jsdisp_propput_idx(ret, len++, lcid, arg, ei, caller);
+ hres = jsdisp_propput_idx(ret, len++, arg, ei, caller);
if(FAILED(hres))
break;
}
return S_OK;
}
-static HRESULT array_join(DispatchEx *array, LCID lcid, DWORD length, const WCHAR *sep, VARIANT *retv,
+static HRESULT array_join(script_ctx_t *ctx, DispatchEx *array, DWORD length, const WCHAR *sep, VARIANT *retv,
jsexcept_t *ei, IServiceProvider *caller)
{
BSTR *str_tab, ret = NULL;
return E_OUTOFMEMORY;
for(i=0; i < length; i++) {
- hres = jsdisp_propget_idx(array, i, lcid, &var, ei, caller);
+ hres = jsdisp_propget_idx(array, i, &var, ei, caller);
if(FAILED(hres))
break;
if(V_VT(&var) != VT_EMPTY && V_VT(&var) != VT_NULL)
- hres = to_string(array->ctx, &var, ei, str_tab+i);
+ hres = to_string(ctx, &var, ei, str_tab+i);
VariantClear(&var);
if(FAILED(hres))
break;
}
/* ECMA-262 3rd Edition 15.4.4.5 */
-static HRESULT Array_join(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
DWORD length;
TRACE("\n");
- if(is_class(dispex, JSCLASS_ARRAY)) {
- length = ((ArrayInstance*)dispex)->length;
+ if(is_vclass(jsthis, JSCLASS_ARRAY)) {
+ length = array_from_vdisp(jsthis)->length;
}else {
FIXME("dispid is not Array\n");
return E_NOTIMPL;
if(arg_cnt(dp)) {
BSTR sep;
- hres = to_string(dispex->ctx, dp->rgvarg + dp->cArgs-1, ei, &sep);
+ hres = to_string(ctx, get_arg(dp,0), ei, &sep);
if(FAILED(hres))
return hres;
- hres = array_join(dispex, lcid, length, sep, retv, ei, caller);
+ hres = array_join(ctx, jsthis->u.jsdisp, length, sep, retv, ei, caller);
SysFreeString(sep);
}else {
- hres = array_join(dispex, lcid, length, default_separatorW, retv, ei, caller);
+ hres = array_join(ctx, jsthis->u.jsdisp, length, default_separatorW, retv, ei, caller);
}
return hres;
}
-static HRESULT Array_pop(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT val;
TRACE("\n");
- if(is_class(dispex, JSCLASS_ARRAY)) {
- ArrayInstance *array = (ArrayInstance*)dispex;
+ if(is_vclass(jsthis, JSCLASS_ARRAY)) {
+ ArrayInstance *array = array_from_vdisp(jsthis);
length = array->length;
}else {
FIXME("not Array this\n");
}
sprintfW(buf, formatW, --length);
- hres = jsdisp_get_id(dispex, buf, 0, &id);
+ hres = jsdisp_get_id(jsthis->u.jsdisp, buf, 0, &id);
if(SUCCEEDED(hres)) {
- hres = jsdisp_propget(dispex, id, lcid, &val, ei, caller);
+ hres = jsdisp_propget(jsthis->u.jsdisp, id, &val, ei, caller);
if(FAILED(hres))
return hres;
- hres = IDispatchEx_DeleteMemberByDispID(_IDispatchEx_(dispex), id);
+ hres = IDispatchEx_DeleteMemberByDispID(jsthis->u.dispex, id);
}else if(hres == DISP_E_UNKNOWNNAME) {
V_VT(&val) = VT_EMPTY;
hres = S_OK;
}
if(SUCCEEDED(hres)) {
- if(is_class(dispex, JSCLASS_ARRAY)) {
- ArrayInstance *array = (ArrayInstance*)dispex;
- array->length = length;
- }
+ ArrayInstance *array = array_from_vdisp(jsthis);
+ array->length = length;
}
if(FAILED(hres)) {
}
/* ECMA-262 3rd Edition 15.4.4.7 */
-static HRESULT Array_push(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
+ DispatchEx *jsthis;
DWORD length = 0;
int i, n;
HRESULT hres;
TRACE("\n");
- if(dispex->builtin_info->class == JSCLASS_ARRAY) {
- length = ((ArrayInstance*)dispex)->length;
- }else {
- FIXME("not Array this\n");
- return E_NOTIMPL;
- }
+ hres = get_length(ctx, vthis, ei, &jsthis, &length);
+ if(FAILED(hres))
+ return hres;
- n = dp->cArgs - dp->cNamedArgs;
+ n = arg_cnt(dp);
for(i=0; i < n; i++) {
- hres = jsdisp_propput_idx(dispex, length+i, lcid, get_arg(dp, i), ei, sp);
+ hres = jsdisp_propput_idx(jsthis, length+i, get_arg(dp, i), ei, sp);
if(FAILED(hres))
return hres;
}
+ hres = set_length(jsthis, ei, length+n);
+ if(FAILED(hres))
+ return hres;
+
if(retv) {
V_VT(retv) = VT_I4;
V_I4(retv) = length+n;
return S_OK;
}
-static HRESULT Array_reverse(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT Array_shift(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+/* ECMA-262 3rd Edition 15.4.4.9 */
+static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
- FIXME("\n");
- return E_NOTIMPL;
+ DispatchEx *jsthis;
+ DWORD length = 0, i;
+ VARIANT v, ret;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ hres = get_length(ctx, vthis, ei, &jsthis, &length);
+ if(FAILED(hres))
+ return hres;
+
+ if(!length) {
+ hres = set_length(jsthis, ei, 0);
+ if(FAILED(hres))
+ return hres;
+ }
+
+ if(!length) {
+ if(retv)
+ V_VT(retv) = VT_EMPTY;
+ return S_OK;
+ }
+
+ hres = jsdisp_propget_idx(jsthis, 0, &ret, ei, caller);
+ if(hres == DISP_E_UNKNOWNNAME) {
+ V_VT(&ret) = VT_EMPTY;
+ hres = S_OK;
+ }
+
+ for(i=1; SUCCEEDED(hres) && i<length; i++) {
+ hres = jsdisp_propget_idx(jsthis, i, &v, ei, caller);
+ if(hres == DISP_E_UNKNOWNNAME)
+ hres = jsdisp_delete_idx(jsthis, i-1);
+ else if(SUCCEEDED(hres))
+ hres = jsdisp_propput_idx(jsthis, i-1, &v, ei, caller);
+ }
+
+ if(SUCCEEDED(hres)) {
+ hres = jsdisp_delete_idx(jsthis, length-1);
+ if(SUCCEEDED(hres))
+ hres = set_length(jsthis, ei, length-1);
+ }
+
+ if(SUCCEEDED(hres) && retv)
+ *retv = ret;
+ else
+ VariantClear(&ret);
+ return hres;
}
-static HRESULT Array_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+/* ECMA-262 3rd Edition 15.4.4.10 */
+static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- DispatchEx *arr;
+ DispatchEx *arr, *jsthis;
VARIANT v;
DOUBLE range;
DWORD length, start, end, idx;
TRACE("\n");
- if(is_class(dispex, JSCLASS_ARRAY)) {
- length = ((ArrayInstance*)dispex)->length;
- }else {
- FIXME("not Array this\n");
- return E_NOTIMPL;
- }
+ hres = get_length(ctx, vthis, ei, &jsthis, &length);
+ if(FAILED(hres))
+ return hres;
if(arg_cnt(dp)) {
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
else start = 0;
if(arg_cnt(dp)>1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
}
else end = length;
- hres = create_array(dispex->ctx, (end>start)?end-start:0, &arr);
+ hres = create_array(ctx, (end>start)?end-start:0, &arr);
if(FAILED(hres))
return hres;
for(idx=start; idx<end; idx++) {
- hres = jsdisp_propget_idx(dispex, idx, lcid, &v, ei, sp);
+ hres = jsdisp_propget_idx(jsthis, idx, &v, ei, sp);
if(hres == DISP_E_UNKNOWNNAME)
continue;
if(SUCCEEDED(hres))
- hres = jsdisp_propput_idx(arr, idx-start, lcid, &v, ei, sp);
+ hres = jsdisp_propput_idx(arr, idx-start, &v, ei, sp);
if(FAILED(hres)) {
jsdisp_release(arr);
args[0] = *v2;
args[1] = *v1;
- hres = jsdisp_call_value(cmp_func, ctx->lcid, DISPATCH_METHOD, &dp, &res, ei, caller);
+ hres = jsdisp_call_value(cmp_func, DISPATCH_METHOD, &dp, &res, ei, caller);
if(FAILED(hres))
return hres;
}
/* ECMA-262 3rd Edition 15.4.4.11 */
-static HRESULT Array_sort(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
DispatchEx *cmp_func = NULL;
TRACE("\n");
- if(is_class(dispex, JSCLASS_ARRAY)) {
- length = ((ArrayInstance*)dispex)->length;
+ if(is_vclass(jsthis, JSCLASS_ARRAY)) {
+ length = array_from_vdisp(jsthis)->length;
}else {
FIXME("unsupported this not array\n");
return E_NOTIMPL;
jsdisp_release(cmp_func);
if(retv) {
V_VT(retv) = VT_DISPATCH;
- V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(dispex);
- IDispatchEx_AddRef(_IDispatchEx_(dispex));
+ V_DISPATCH(retv) = jsthis->u.disp;
+ IDispatch_AddRef(jsthis->u.disp);
}
return S_OK;
}
vtab = heap_alloc_zero(length * sizeof(VARIANT));
if(vtab) {
for(i=0; i<length; i++) {
- hres = jsdisp_propget_idx(dispex, i, lcid, vtab+i, ei, caller);
+ hres = jsdisp_propget_idx(jsthis->u.jsdisp, i, vtab+i, ei, caller);
if(FAILED(hres) && hres != DISP_E_UNKNOWNNAME) {
WARN("Could not get elem %d: %08x\n", i, hres);
break;
sorttab[i] = vtab+i;
for(i=0; i < length/2; i++) {
- hres = sort_cmp(dispex->ctx, cmp_func, sorttab[2*i+1], sorttab[2*i], ei, caller, &cmp);
+ hres = sort_cmp(ctx, cmp_func, sorttab[2*i+1], sorttab[2*i], ei, caller, &cmp);
if(FAILED(hres))
break;
memcpy(tmpbuf, sorttab+i, k*sizeof(VARIANT*));
while(a < k && b < bend) {
- hres = sort_cmp(dispex->ctx, cmp_func, tmpbuf[a], sorttab[i+k+b], ei, caller, &cmp);
+ hres = sort_cmp(ctx, cmp_func, tmpbuf[a], sorttab[i+k+b], ei, caller, &cmp);
if(FAILED(hres))
break;
}
for(i=0; SUCCEEDED(hres) && i < length; i++)
- hres = jsdisp_propput_idx(dispex, i, lcid, sorttab[i], ei, caller);
+ hres = jsdisp_propput_idx(jsthis->u.jsdisp, i, sorttab[i], ei, caller);
}
if(vtab) {
if(retv) {
V_VT(retv) = VT_DISPATCH;
- V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(dispex);
- IDispatch_AddRef(_IDispatchEx_(dispex));
+ V_DISPATCH(retv) = jsthis->u.disp;
+ IDispatch_AddRef(jsthis->u.disp);
}
return S_OK;
}
-static HRESULT Array_splice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+/* ECMA-262 3rd Edition 15.4.4.12 */
+static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
- FIXME("\n");
- return E_NOTIMPL;
+ DWORD length, start=0, delete_cnt=0, argc, i, add_args = 0;
+ DispatchEx *ret_array = NULL, *jsthis;
+ VARIANT v;
+ HRESULT hres = S_OK;
+
+ TRACE("\n");
+
+ hres = get_length(ctx, vthis, ei, &jsthis, &length);
+ if(FAILED(hres))
+ return hres;
+
+ argc = arg_cnt(dp);
+ if(argc >= 1) {
+ hres = to_integer(ctx, get_arg(dp,0), ei, &v);
+ if(FAILED(hres))
+ return hres;
+
+ if(V_VT(&v) == VT_I4) {
+ if(V_I4(&v) >= 0)
+ start = min(V_I4(&v), length);
+ else
+ start = -V_I4(&v) > length ? 0 : length + V_I4(&v);
+ }else {
+ start = V_R8(&v) < 0.0 ? 0 : length;
+ }
+ }
+
+ if(argc >= 2) {
+ hres = to_integer(ctx, get_arg(dp,1), ei, &v);
+ if(FAILED(hres))
+ return hres;
+
+ if(V_VT(&v) == VT_I4) {
+ if(V_I4(&v) > 0)
+ delete_cnt = min(V_I4(&v), length-start);
+ }else if(V_R8(&v) > 0.0) {
+ delete_cnt = length-start;
+ }
+
+ add_args = argc-2;
+ }
+
+ if(retv) {
+ hres = create_array(ctx, 0, &ret_array);
+ if(FAILED(hres))
+ return hres;
+
+ for(i=0; SUCCEEDED(hres) && i < delete_cnt; i++) {
+ hres = jsdisp_propget_idx(jsthis, start+i, &v, ei, caller);
+ if(hres == DISP_E_UNKNOWNNAME)
+ hres = S_OK;
+ else if(SUCCEEDED(hres))
+ hres = jsdisp_propput_idx(ret_array, i, &v, ei, caller);
+ }
+
+ if(SUCCEEDED(hres)) {
+ V_VT(&v) = VT_I4;
+ V_I4(&v) = delete_cnt;
+
+ hres = jsdisp_propput_name(ret_array, lengthW, &v, ei, caller);
+ }
+ }
+
+ if(add_args < delete_cnt) {
+ for(i = start; SUCCEEDED(hres) && i < length-delete_cnt; i++) {
+ hres = jsdisp_propget_idx(jsthis, i+delete_cnt, &v, ei, caller);
+ if(hres == DISP_E_UNKNOWNNAME)
+ hres = jsdisp_delete_idx(jsthis, i+add_args);
+ else if(SUCCEEDED(hres))
+ hres = jsdisp_propput_idx(jsthis, i+add_args, &v, ei, caller);
+ }
+
+ for(i=length; SUCCEEDED(hres) && i != length-delete_cnt+add_args; i--)
+ hres = jsdisp_delete_idx(jsthis, i-1);
+ }else if(add_args > delete_cnt) {
+ for(i=length-delete_cnt; SUCCEEDED(hres) && i != start; i--) {
+ hres = jsdisp_propget_idx(jsthis, i+delete_cnt-1, &v, ei, caller);
+ if(hres == DISP_E_UNKNOWNNAME)
+ hres = jsdisp_delete_idx(jsthis, i+add_args-1);
+ else if(SUCCEEDED(hres))
+ hres = jsdisp_propput_idx(jsthis, i+add_args-1, &v, ei, caller);
+ }
+ }
+
+ for(i=0; SUCCEEDED(hres) && i < add_args; i++)
+ hres = jsdisp_propput_idx(jsthis, start+i, get_arg(dp,i+2), ei, caller);
+
+ if(SUCCEEDED(hres)) {
+ V_VT(&v) = VT_I4;
+ V_I4(&v) = length-delete_cnt+add_args;
+ hres = jsdisp_propput_name(jsthis, lengthW, &v, ei, caller);
+ }
+
+ if(FAILED(hres)) {
+ if(ret_array)
+ jsdisp_release(ret_array);
+ return hres;
+ }
+
+ if(retv) {
+ V_VT(retv) = VT_DISPATCH;
+ V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(ret_array);
+ }
+ return S_OK;
}
/* ECMA-262 3rd Edition 15.4.4.2 */
-static HRESULT Array_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
+ ArrayInstance *array;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_ARRAY)) {
- WARN("not Array object\n");
- return E_FAIL;
- }
+ array = array_this(jsthis);
+ if(!array)
+ return throw_type_error(ctx, ei, IDS_ARRAY_EXPECTED, NULL);
- return array_join(dispex, lcid, ((ArrayInstance*)dispex)->length, default_separatorW, retv, ei, sp);
+ return array_join(ctx, &array->dispex, array->length, default_separatorW, retv, ei, sp);
}
-static HRESULT Array_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT Array_unshift(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+/* ECMA-262 3rd Edition 15.4.4.13 */
+static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
- FIXME("\n");
- return E_NOTIMPL;
+ DispatchEx *jsthis;
+ WCHAR buf[14], *buf_end, *str;
+ DWORD argc, i, length;
+ VARIANT var;
+ DISPID id;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ hres = get_length(ctx, vthis, ei, &jsthis, &length);
+ if(FAILED(hres))
+ return hres;
+
+ argc = arg_cnt(dp);
+ if(!argc) {
+ if(retv)
+ V_VT(retv) = VT_EMPTY;
+ return S_OK;
+ }
+
+ buf_end = buf + sizeof(buf)/sizeof(WCHAR)-1;
+ *buf_end-- = 0;
+ i = length;
+
+ while(i--) {
+ str = idx_to_str(i, buf_end);
+
+ hres = jsdisp_get_id(jsthis, str, 0, &id);
+ if(SUCCEEDED(hres)) {
+ hres = jsdisp_propget(jsthis, id, &var, ei, caller);
+ if(FAILED(hres))
+ return hres;
+
+ hres = jsdisp_propput_idx(jsthis, i+argc, &var, ei, caller);
+ VariantClear(&var);
+ }else if(hres == DISP_E_UNKNOWNNAME) {
+ hres = IDispatchEx_DeleteMemberByDispID(vthis->u.dispex, id);
+ }
+
+ if(FAILED(hres))
+ return hres;
+ }
+
+ for(i=0; i<argc; i++) {
+ hres = jsdisp_propput_idx(jsthis, i, get_arg(dp,i), ei, caller);
+ if(FAILED(hres))
+ return hres;
+ }
+
+ hres = set_length(jsthis, ei, length+argc);
+ if(FAILED(hres))
+ return hres;
+
+ if(retv)
+ V_VT(retv) = VT_EMPTY;
+ return S_OK;
}
-static HRESULT Array_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Array_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
switch(flags) {
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 INVOKE_PROPERTYGET:
- return array_join(dispex, lcid, ((ArrayInstance*)dispex)->length, default_separatorW, retv, ei, sp);
+ return array_join(ctx, jsthis->u.jsdisp, array_from_vdisp(jsthis)->length, default_separatorW, retv, ei, sp);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
Array_on_put
};
-static HRESULT ArrayConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
DispatchEx *obj;
case DISPATCH_CONSTRUCT: {
if(arg_cnt(dp) == 1 && V_VT((arg_var = get_arg(dp, 0))) == VT_I4) {
if(V_I4(arg_var) < 0)
- return throw_range_error(dispex->ctx, ei, IDS_INVALID_LENGTH, NULL);
+ return throw_range_error(ctx, ei, IDS_INVALID_LENGTH, NULL);
- hres = create_array(dispex->ctx, V_I4(arg_var), &obj);
+ hres = create_array(ctx, V_I4(arg_var), &obj);
if(FAILED(hres))
return hres;
return S_OK;
}
- hres = create_array(dispex->ctx, arg_cnt(dp), &obj);
+ hres = create_array(ctx, arg_cnt(dp), &obj);
if(FAILED(hres))
return hres;
for(i=0; i < arg_cnt(dp); i++) {
- hres = jsdisp_propput_idx(obj, i, lcid, get_arg(dp, i), ei, caller);
+ hres = jsdisp_propput_idx(obj, i, get_arg(dp, i), ei, caller);
if(FAILED(hres))
break;
}
if(object_prototype)
hres = init_dispex(&array->dispex, ctx, &Array_info, object_prototype);
else
- hres = init_dispex_from_constr(&array->dispex, ctx, &Array_info, ctx->object_constr);
+ hres = init_dispex_from_constr(&array->dispex, ctx, &Array_info, ctx->array_constr);
if(FAILED(hres)) {
heap_free(array);
ArrayInstance *array;
HRESULT hres;
+ static const WCHAR ArrayW[] = {'A','r','r','a','y',0};
+
hres = alloc_array(ctx, object_prototype, &array);
if(FAILED(hres))
return hres;
- hres = create_builtin_function(ctx, ArrayConstr_value, NULL, PROPF_CONSTR, &array->dispex, ret);
+ hres = create_builtin_function(ctx, ArrayConstr_value, ArrayW, NULL, PROPF_CONSTR, &array->dispex, ret);
- IDispatchEx_Release(_IDispatchEx_(&array->dispex));
+ jsdisp_release(&array->dispex);
return hres;
}
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
+static inline BoolInstance *bool_this(vdisp_t *jsthis)
+{
+ return is_vclass(jsthis, JSCLASS_BOOLEAN) ? (BoolInstance*)jsthis->u.jsdisp : NULL;
+}
+
/* ECMA-262 3rd Edition 15.6.4.2 */
-static HRESULT Bool_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
+ BoolInstance *bool;
+
static const WCHAR trueW[] = {'t','r','u','e',0};
static const WCHAR falseW[] = {'f','a','l','s','e',0};
TRACE("\n");
- if(!is_class(dispex, JSCLASS_BOOLEAN))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_BOOL, NULL);
+ if(!(bool = bool_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_BOOL, NULL);
if(retv) {
- BoolInstance *bool = (BoolInstance*)dispex;
BSTR val;
if(bool->val) val = SysAllocString(trueW);
}
/* ECMA-262 3rd Edition 15.6.4.3 */
-static HRESULT Bool_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Bool_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
+ BoolInstance *bool;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_BOOLEAN))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_BOOL, NULL);
+ if(!(bool = bool_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_BOOL, NULL);
if(retv) {
- BoolInstance *bool = (BoolInstance*)dispex;
-
V_VT(retv) = VT_BOOL;
V_BOOL(retv) = bool->val;
}
return S_OK;
}
-static HRESULT Bool_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Bool_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
switch(flags) {
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:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
NULL
};
-static HRESULT BoolConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT BoolConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
HRESULT hres;
case DISPATCH_CONSTRUCT: {
DispatchEx *bool;
- hres = create_bool(dispex->ctx, value, &bool);
+ hres = create_bool(ctx, value, &bool);
if(FAILED(hres))
return hres;
BoolInstance *bool;
HRESULT hres;
+ static const WCHAR BooleanW[] = {'B','o','o','l','e','a','n',0};
+
hres = alloc_bool(ctx, object_prototype, &bool);
if(FAILED(hres))
return hres;
- hres = create_builtin_function(ctx, BoolConstr_value, NULL, PROPF_CONSTR, &bool->dispex, ret);
+ hres = create_builtin_function(ctx, BoolConstr_value, BooleanW, NULL, PROPF_CONSTR, &bool->dispex, ret);
jsdisp_release(&bool->dispex);
return hres;
static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','e','O','f',0};
static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
static const WCHAR toUTCStringW[] = {'t','o','U','T','C','S','t','r','i','n','g',0};
+static const WCHAR toGMTStringW[] = {'t','o','G','M','T','S','t','r','i','n','g',0};
static const WCHAR toDateStringW[] = {'t','o','D','a','t','e','S','t','r','i','n','g',0};
static const WCHAR toTimeStringW[] = {'t','o','T','i','m','e','S','t','r','i','n','g',0};
static const WCHAR toLocaleDateStringW[] = {'t','o','L','o','c','a','l','e','D','a','t','e','S','t','r','i','n','g',0};
static const WCHAR UTCW[] = {'U','T','C',0};
static const WCHAR parseW[] = {'p','a','r','s','e',0};
+static inline DateInstance *date_this(vdisp_t *jsthis)
+{
+ return is_vclass(jsthis, JSCLASS_DATE) ? (DateInstance*)jsthis->u.jsdisp : NULL;
+}
+
/*ECMA-262 3rd Edition 15.9.1.2 */
#define MS_PER_DAY 86400000
#define MS_PER_HOUR 3600000
}
/* ECMA-262 3rd Edition 15.9.1.2 */
-static HRESULT Date_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
+static HRESULT dateobj_to_string(DateInstance *date, VARIANT *retv)
{
- DateInstance *date;
DOUBLE time;
int offset;
- TRACE("\n");
-
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
-
- date = (DateInstance*)dispex;
time = local_time(date->time, date);
offset = date->bias +
daylight_saving_ta(time, date);
return date_to_string(time, TRUE, offset, retv);
}
+static HRESULT Date_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
+{
+ DateInstance *date;
+
+ TRACE("\n");
+
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
+
+ return dateobj_to_string(date, retv);
+}
+
/* ECMA-262 3rd Edition 15.9.1.5 */
-static HRESULT Date_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
static const WCHAR NaNW[] = { 'N','a','N',0 };
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
-
- date = (DateInstance*)dispex;
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(isnan(date->time)) {
if(retv) {
st = create_systemtime(local_time(date->time, date));
if(st.wYear<1601 || st.wYear>9999)
- return Date_toString(dispex, lcid, flags, dp, retv, ei, caller);
+ return dateobj_to_string(date, retv);
if(retv) {
- date_len = GetDateFormatW(lcid, DATE_LONGDATE, &st, NULL, NULL, 0);
- time_len = GetTimeFormatW(lcid, 0, &st, NULL, NULL, 0);
+ date_len = GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, NULL, 0);
+ time_len = GetTimeFormatW(ctx->lcid, 0, &st, NULL, NULL, 0);
date_str = SysAllocStringLen(NULL, date_len+time_len-1);
if(!date_str)
return E_OUTOFMEMORY;
- GetDateFormatW(lcid, DATE_LONGDATE, &st, NULL, date_str, date_len);
- GetTimeFormatW(lcid, 0, &st, NULL, &date_str[date_len], time_len);
+ GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, date_str, date_len);
+ GetTimeFormatW(ctx->lcid, 0, &st, NULL, &date_str[date_len], time_len);
date_str[date_len-1] = ' ';
V_VT(retv) = VT_BSTR;
return S_OK;
}
-static HRESULT Date_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, date->time);
- }
return S_OK;
}
-/* ECMA-262 3rd Edition 15.9.5.42 */
-static HRESULT Date_toUTCString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
+static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis,
+ VARIANT *retv, jsexcept_t *ei)
{
static const WCHAR NaNW[] = { 'N','a','N',0 };
static const WCHAR formatADW[] = { '%','s',',',' ','%','d',' ','%','s',' ','%','d',' ',
int len, size, year, day;
DWORD lcid_en, week_id, month_id;
- TRACE("\n");
-
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
-
- date = (DateInstance*)dispex;
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(isnan(date->time)) {
if(retv) {
return S_OK;
}
-/* ECMA-262 3rd Edition 15.9.5.3 */
-static HRESULT Date_toDateString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+/* ECMA-262 3rd Edition 15.9.5.42 */
+static HRESULT Date_toUTCString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
+{
+ TRACE("\n");
+ return create_utc_string(ctx, jsthis, retv, ei);
+}
+
+static HRESULT Date_toGMTString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
+{
+ TRACE("\n");
+ return create_utc_string(ctx, jsthis, retv, ei);
+}
+
+/* ECMA-262 3rd Edition 15.9.5.3 */
+static HRESULT dateobj_to_date_string(DateInstance *date, VARIANT *retv)
{
static const WCHAR NaNW[] = { 'N','a','N',0 };
static const WCHAR formatADW[] = { '%','s',' ','%','s',' ','%','d',' ','%','d',0 };
BOOL formatAD = TRUE;
BSTR week, month;
- DateInstance *date;
BSTR date_str;
DOUBLE time;
int len, size, year, day;
DWORD lcid_en, week_id, month_id;
- TRACE("\n");
-
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
-
- date = (DateInstance*)dispex;
-
if(isnan(date->time)) {
if(retv) {
V_VT(retv) = VT_BSTR;
return S_OK;
}
+static HRESULT Date_toDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
+{
+ DateInstance *date;
+
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
+
+ return dateobj_to_date_string(date, retv);
+}
+
/* ECMA-262 3rd Edition 15.9.5.4 */
-static HRESULT Date_toTimeString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
static const WCHAR NaNW[] = { 'N','a','N',0 };
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
-
- date = (DateInstance*)dispex;
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(isnan(date->time)) {
if(retv) {
}
/* ECMA-262 3rd Edition 15.9.5.6 */
-static HRESULT Date_toLocaleDateString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
static const WCHAR NaNW[] = { 'N','a','N',0 };
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
-
- date = (DateInstance*)dispex;
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(isnan(date->time)) {
if(retv) {
st = create_systemtime(local_time(date->time, date));
if(st.wYear<1601 || st.wYear>9999)
- return Date_toDateString(dispex, lcid, flags, dp, retv, ei, caller);
+ return dateobj_to_date_string(date, retv);
if(retv) {
- len = GetDateFormatW(lcid, DATE_LONGDATE, &st, NULL, NULL, 0);
+ len = GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, NULL, 0);
date_str = SysAllocStringLen(NULL, len);
if(!date_str)
return E_OUTOFMEMORY;
- GetDateFormatW(lcid, DATE_LONGDATE, &st, NULL, date_str, len);
+ GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, date_str, len);
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = date_str;
}
/* ECMA-262 3rd Edition 15.9.5.7 */
-static HRESULT Date_toLocaleTimeString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
static const WCHAR NaNW[] = { 'N','a','N',0 };
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
-
- date = (DateInstance*)dispex;
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(isnan(date->time)) {
if(retv) {
st = create_systemtime(local_time(date->time, date));
if(st.wYear<1601 || st.wYear>9999)
- return Date_toTimeString(dispex, lcid, flags, dp, retv, ei, caller);
+ return Date_toTimeString(ctx, jsthis, flags, dp, retv, ei, caller);
if(retv) {
- len = GetTimeFormatW(lcid, 0, &st, NULL, NULL, 0);
+ len = GetTimeFormatW(ctx->lcid, 0, &st, NULL, NULL, 0);
date_str = SysAllocStringLen(NULL, len);
if(!date_str)
return E_OUTOFMEMORY;
- GetTimeFormatW(lcid, 0, &st, NULL, date_str, len);
+ GetTimeFormatW(ctx->lcid, 0, &st, NULL, date_str, len);
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = date_str;
}
/* ECMA-262 3rd Edition 15.9.5.9 */
-static HRESULT Date_getTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, date->time);
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.10 */
-static HRESULT Date_getFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
- DateInstance *date = (DateInstance*)dispex;
DOUBLE time = local_time(date->time, date);
num_set_val(retv, year_from_time(time));
}
/* ECMA-262 3rd Edition 15.9.5.11 */
-static HRESULT Date_getUTCFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, year_from_time(date->time));
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.12 */
-static HRESULT Date_getMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
- DateInstance *date = (DateInstance*)dispex;
DOUBLE time = local_time(date->time, date);
num_set_val(retv, month_from_time(time));
}
/* ECMA-262 3rd Edition 15.9.5.13 */
-static HRESULT Date_getUTCMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, month_from_time(date->time));
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.14 */
-static HRESULT Date_getDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
- DateInstance *date = (DateInstance*)dispex;
DOUBLE time = local_time(date->time, date);
num_set_val(retv, date_from_time(time));
}
/* ECMA-262 3rd Edition 15.9.5.15 */
-static HRESULT Date_getUTCDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, date_from_time(date->time));
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.16 */
-static HRESULT Date_getDay(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
- DateInstance *date = (DateInstance*)dispex;
DOUBLE time = local_time(date->time, date);
num_set_val(retv, week_day(time));
}
/* ECMA-262 3rd Edition 15.9.5.17 */
-static HRESULT Date_getUTCDay(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getUTCDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, week_day(date->time));
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.18 */
-static HRESULT Date_getHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
- DateInstance *date = (DateInstance*)dispex;
DOUBLE time = local_time(date->time, date);
num_set_val(retv, hour_from_time(time));
}
/* ECMA-262 3rd Edition 15.9.5.19 */
-static HRESULT Date_getUTCHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, hour_from_time(date->time));
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.20 */
-static HRESULT Date_getMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
- DateInstance *date = (DateInstance*)dispex;
DOUBLE time = local_time(date->time, date);
num_set_val(retv, min_from_time(time));
}
/* ECMA-262 3rd Edition 15.9.5.21 */
-static HRESULT Date_getUTCMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, min_from_time(date->time));
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.22 */
-static HRESULT Date_getSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
- DateInstance *date = (DateInstance*)dispex;
DOUBLE time = local_time(date->time, date);
num_set_val(retv, sec_from_time(time));
}
/* ECMA-262 3rd Edition 15.9.5.23 */
-static HRESULT Date_getUTCSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, sec_from_time(date->time));
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.24 */
-static HRESULT Date_getMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
- DateInstance *date = (DateInstance*)dispex;
DOUBLE time = local_time(date->time, date);
num_set_val(retv, ms_from_time(time));
}
/* ECMA-262 3rd Edition 15.9.5.25 */
-static HRESULT Date_getUTCMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, ms_from_time(date->time));
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.26 */
-static HRESULT Date_getTimezoneOffset(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getTimezoneOffset(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- if(retv) {
- DateInstance *date = (DateInstance*)dispex;
+ if(retv)
num_set_val(retv, floor(
(date->time-local_time(date->time, date))/MS_PER_MINUTE));
- }
return S_OK;
}
/* ECMA-262 3rd Edition 15.9.5.27 */
-static HRESULT Date_setTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
- date = (DateInstance*)dispex;
date->time = time_clip(num_val(&v));
if(retv)
}
/* ECMA-262 3rd Edition 15.9.5.28 */
-static HRESULT Date_setMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
- date = (DateInstance*)dispex;
t = local_time(date->time, date);
t = make_date(day(t), make_time(hour_from_time(t), min_from_time(t),
sec_from_time(t), num_val(&v)));
}
/* ECMA-262 3rd Edition 15.9.5.29 */
-static HRESULT Date_setUTCMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
- date = (DateInstance*)dispex;
t = date->time;
t = make_date(day(t), make_time(hour_from_time(t), min_from_time(t),
sec_from_time(t), num_val(&v)));
}
/* ECMA-262 3rd Edition 15.9.5.30 */
-static HRESULT Date_setSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = local_time(date->time, date);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
sec = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
ms = num_val(&v);
}
/* ECMA-262 3rd Edition 15.9.5.31 */
-static HRESULT Date_setUTCSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = date->time;
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
sec = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
ms = num_val(&v);
}
/* ECMA-262 3rd Edition 15.9.5.33 */
-static HRESULT Date_setMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = local_time(date->time, date);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
min = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
sec = num_val(&v);
else sec = sec_from_time(t);
if(arg_cnt(dp) > 2) {
- hres = to_number(dispex->ctx, get_arg(dp, 2), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 2), ei, &v);
if(FAILED(hres))
return hres;
ms = num_val(&v);
}
/* ECMA-262 3rd Edition 15.9.5.34 */
-static HRESULT Date_setUTCMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = date->time;
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
min = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
sec = num_val(&v);
else sec = sec_from_time(t);
if(arg_cnt(dp) > 2) {
- hres = to_number(dispex->ctx, get_arg(dp, 2), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 2), ei, &v);
if(FAILED(hres))
return hres;
ms = num_val(&v);
}
/* ECMA-262 3rd Edition 15.9.5.35 */
-static HRESULT Date_setHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = local_time(date->time, date);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
hour = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
min = num_val(&v);
else min = min_from_time(t);
if(arg_cnt(dp) > 2) {
- hres = to_number(dispex->ctx, get_arg(dp, 2), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 2), ei, &v);
if(FAILED(hres))
return hres;
sec = num_val(&v);
else sec = sec_from_time(t);
if(arg_cnt(dp) > 3) {
- hres = to_number(dispex->ctx, get_arg(dp, 3), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 3), ei, &v);
if(FAILED(hres))
return hres;
ms = num_val(&v);
}
/* ECMA-262 3rd Edition 15.9.5.36 */
-static HRESULT Date_setUTCHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
+ DateInstance *date;
VARIANT v;
HRESULT hres;
- DateInstance *date;
DOUBLE t, hour, min, sec, ms;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = date->time;
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
hour = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
min = num_val(&v);
else min = min_from_time(t);
if(arg_cnt(dp) > 2) {
- hres = to_number(dispex->ctx, get_arg(dp, 2), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 2), ei, &v);
if(FAILED(hres))
return hres;
sec = num_val(&v);
else sec = sec_from_time(t);
if(arg_cnt(dp) > 3) {
- hres = to_number(dispex->ctx, get_arg(dp, 3), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 3), ei, &v);
if(FAILED(hres))
return hres;
ms = num_val(&v);
}
/* ECMA-262 3rd Edition 15.9.5.36 */
-static HRESULT Date_setDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
- date = (DateInstance*)dispex;
t = local_time(date->time, date);
t = make_date(make_day(year_from_time(t), month_from_time(t),
num_val(&v)), time_within_day(t));
}
/* ECMA-262 3rd Edition 15.9.5.37 */
-static HRESULT Date_setUTCDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
- date = (DateInstance*)dispex;
t = date->time;
t = make_date(make_day(year_from_time(t), month_from_time(t),
num_val(&v)), time_within_day(t));
}
/* ECMA-262 3rd Edition 15.9.5.38 */
-static HRESULT Date_setMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = local_time(date->time, date);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
month = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
ddate = num_val(&v);
}
/* ECMA-262 3rd Edition 15.9.5.39 */
-static HRESULT Date_setUTCMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = date->time;
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
month = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
ddate = num_val(&v);
}
/* ECMA-262 3rd Edition 15.9.5.40 */
-static HRESULT Date_setFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = local_time(date->time, date);
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
year = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
month = num_val(&v);
else month = month_from_time(t);
if(arg_cnt(dp) > 2) {
- hres = to_number(dispex->ctx, get_arg(dp, 2), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 2), ei, &v);
if(FAILED(hres))
return hres;
ddate = num_val(&v);
}
/* ECMA-262 3rd Edition 15.9.5.41 */
-static HRESULT Date_setUTCFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp))
- return throw_type_error(dispex->ctx, ei, IDS_ARG_NOT_OPT, NULL);
+ return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
- date = (DateInstance*)dispex;
t = date->time;
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
return hres;
year = num_val(&v);
if(arg_cnt(dp) > 1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &v);
if(FAILED(hres))
return hres;
month = num_val(&v);
else month = month_from_time(t);
if(arg_cnt(dp) > 2) {
- hres = to_number(dispex->ctx, get_arg(dp, 2), ei, &v);
+ hres = to_number(ctx, get_arg(dp, 2), ei, &v);
if(FAILED(hres))
return hres;
ddate = num_val(&v);
}
/* ECMA-262 3rd Edition B2.4 */
-static HRESULT Date_getYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
DateInstance *date;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_DATE))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
+ if(!(date = date_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
- date = (DateInstance*)dispex;
t = local_time(date->time, date);
-
-
if(isnan(t)) {
if(retv)
num_set_nan(retv);
return S_OK;
}
-static HRESULT Date_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Date_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
TRACE("\n");
switch(flags) {
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:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
{setUTCMonthW, Date_setUTCMonth, PROPF_METHOD|2},
{setUTCSecondsW, Date_setUTCSeconds, PROPF_METHOD|2},
{toDateStringW, Date_toDateString, PROPF_METHOD},
+ {toGMTStringW, Date_toGMTString, PROPF_METHOD},
{toLocaleDateStringW, Date_toLocaleDateString, PROPF_METHOD},
{toLocaleStringW, Date_toLocaleString, PROPF_METHOD},
{toLocaleTimeStringW, Date_toLocaleTimeString, PROPF_METHOD},
return S_OK;
}
-static HRESULT DateConstr_parse(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
BSTR parse_str;
return S_OK;
}
- hres = to_string(dispex->ctx, get_arg(dp,0), ei, &parse_str);
+ hres = to_string(ctx, get_arg(dp,0), ei, &parse_str);
if(FAILED(hres))
return hres;
return hres;
}
-static HRESULT DateConstr_UTC(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+static HRESULT date_utc(script_ctx_t *ctx, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei)
{
VARIANT year, month, vdate, hours, minutes, seconds, ms;
DOUBLE y;
TRACE("\n");
if(arg_no>0) {
- hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &year);
+ hres = to_number(ctx, get_arg(dp, 0), ei, &year);
if(FAILED(hres))
return hres;
y = num_val(&year);
else y = 1900;
if(arg_no>1) {
- hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &month);
+ hres = to_number(ctx, get_arg(dp, 1), ei, &month);
if(FAILED(hres))
return hres;
}
}
if(arg_no>2) {
- hres = to_number(dispex->ctx, get_arg(dp, 2), ei, &vdate);
+ hres = to_number(ctx, get_arg(dp, 2), ei, &vdate);
if(FAILED(hres))
return hres;
}
}
if(arg_no>3) {
- hres = to_number(dispex->ctx, get_arg(dp, 3), ei, &hours);
+ hres = to_number(ctx, get_arg(dp, 3), ei, &hours);
if(FAILED(hres))
return hres;
}
}
if(arg_no>4) {
- hres = to_number(dispex->ctx, get_arg(dp, 4), ei, &minutes);
+ hres = to_number(ctx, get_arg(dp, 4), ei, &minutes);
if(FAILED(hres))
return hres;
}
}
if(arg_no>5) {
- hres = to_number(dispex->ctx, get_arg(dp, 5), ei, &seconds);
+ hres = to_number(ctx, get_arg(dp, 5), ei, &seconds);
if(FAILED(hres))
return hres;
}
}
if(arg_no>6) {
- hres = to_number(dispex->ctx, get_arg(dp, 6), ei, &ms);
+ hres = to_number(ctx, get_arg(dp, 6), ei, &ms);
if(FAILED(hres))
return hres;
}
return S_OK;
}
-static HRESULT DateConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT DateConstr_UTC(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+{
+ TRACE("\n");
+
+ return date_utc(ctx, dp, retv, ei);
+}
+
+static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
DispatchEx *date;
lltime = ((LONGLONG)time.dwHighDateTime<<32)
+ time.dwLowDateTime;
- hres = create_date(dispex->ctx, NULL, lltime/10000-TIME_EPOCH, &date);
+ hres = create_date(ctx, NULL, lltime/10000-TIME_EPOCH, &date);
if(FAILED(hres))
return hres;
break;
case 1: {
VARIANT prim, num;
- hres = to_primitive(dispex->ctx, get_arg(dp,0), ei, &prim, NO_HINT);
+ hres = to_primitive(ctx, get_arg(dp,0), ei, &prim, NO_HINT);
if(FAILED(hres))
return hres;
if(V_VT(&prim) == VT_BSTR)
hres = date_parse(V_BSTR(&prim), &num);
else
- hres = to_number(dispex->ctx, &prim, ei, &num);
+ hres = to_number(ctx, &prim, ei, &num);
VariantClear(&prim);
if(FAILED(hres))
return hres;
- hres = create_date(dispex->ctx, NULL, time_clip(num_val(&num)), &date);
+ hres = create_date(ctx, NULL, time_clip(num_val(&num)), &date);
if(FAILED(hres))
return hres;
break;
VARIANT ret_date;
DateInstance *di;
- DateConstr_UTC(dispex, lcid, flags, dp, &ret_date, ei, sp);
+ hres = date_utc(ctx, dp, &ret_date, ei);
+ if(FAILED(hres))
+ return hres;
- hres = create_date(dispex->ctx, NULL, num_val(&ret_date), &date);
+ hres = create_date(ctx, NULL, num_val(&ret_date), &date);
if(FAILED(hres))
return hres;
DispatchEx *date;
HRESULT hres;
+ static const WCHAR DateW[] = {'D','a','t','e',0};
+
hres = create_date(ctx, object_prototype, 0.0, &date);
if(FAILED(hres))
return hres;
- hres = create_builtin_function(ctx, DateConstr_value, &DateConstr_info, PROPF_CONSTR, date, ret);
+ hres = create_builtin_function(ctx, DateConstr_value, DateW, &DateConstr_info, PROPF_CONSTR, date, ret);
jsdisp_release(date);
return hres;
return S_OK;
}
-static HRESULT invoke_prop_func(DispatchEx *This, DispatchEx *jsthis, dispex_prop_t *prop, LCID lcid, WORD flags,
+static HRESULT invoke_prop_func(DispatchEx *This, DispatchEx *jsthis, dispex_prop_t *prop, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
HRESULT hres;
switch(prop->type) {
- case PROP_BUILTIN:
+ case PROP_BUILTIN: {
+ vdisp_t vthis;
+
if(flags == DISPATCH_CONSTRUCT && (prop->flags & DISPATCH_METHOD)) {
WARN("%s is not a constructor\n", debugstr_w(prop->name));
return E_INVALIDARG;
}
- return prop->u.p->invoke(jsthis, lcid, flags, dp, retv, ei, caller);
+
+ set_jsdisp(&vthis, jsthis);
+ hres = prop->u.p->invoke(This->ctx, &vthis, flags, dp, retv, ei, caller);
+ vdisp_release(&vthis);
+ return hres;
+ }
case PROP_PROTREF:
- return invoke_prop_func(This->prototype, jsthis, This->prototype->props+prop->u.ref, lcid, flags, dp, retv, ei, caller);
+ return invoke_prop_func(This->prototype, jsthis, This->prototype->props+prop->u.ref, flags, dp, retv, ei, caller);
case PROP_VARIANT: {
DISPPARAMS new_dp;
if(FAILED(hres))
return hres;
- hres = disp_call(V_DISPATCH(&prop->u.var), DISPID_VALUE, lcid, flags, &new_dp, retv, ei, caller);
+ hres = disp_call(This->ctx, V_DISPATCH(&prop->u.var), DISPID_VALUE, flags, &new_dp, retv, ei, caller);
if(new_dp.rgvarg != dp->rgvarg) {
heap_free(new_dp.rgvarg);
return E_FAIL;
}
-static HRESULT prop_get(DispatchEx *This, dispex_prop_t *prop, LCID lcid, DISPPARAMS *dp,
+static HRESULT prop_get(DispatchEx *This, dispex_prop_t *prop, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
HRESULT hres;
case PROP_BUILTIN:
if(prop->u.p->flags & PROPF_METHOD) {
DispatchEx *obj;
- hres = create_builtin_function(This->ctx, prop->u.p->invoke, NULL, prop->u.p->flags, NULL, &obj);
+ hres = create_builtin_function(This->ctx, prop->u.p->invoke, prop->u.p->name, NULL,
+ prop->u.p->flags, NULL, &obj);
if(FAILED(hres))
break;
hres = VariantCopy(retv, &prop->u.var);
}else {
- hres = prop->u.p->invoke(This, lcid, DISPATCH_PROPERTYGET, dp, retv, ei, caller);
+ vdisp_t vthis;
+
+ set_jsdisp(&vthis, This);
+ hres = prop->u.p->invoke(This->ctx, &vthis, DISPATCH_PROPERTYGET, dp, retv, ei, caller);
+ vdisp_release(&vthis);
}
break;
case PROP_PROTREF:
- hres = prop_get(This->prototype, This->prototype->props+prop->u.ref, lcid, dp, retv, ei, caller);
+ hres = prop_get(This->prototype, This->prototype->props+prop->u.ref, dp, retv, ei, caller);
break;
case PROP_VARIANT:
hres = VariantCopy(retv, &prop->u.var);
return hres;
}
-static HRESULT prop_put(DispatchEx *This, dispex_prop_t *prop, LCID lcid, DISPPARAMS *dp,
+static HRESULT prop_put(DispatchEx *This, dispex_prop_t *prop, DISPPARAMS *dp,
jsexcept_t *ei, IServiceProvider *caller)
{
DWORD i;
switch(prop->type) {
case PROP_BUILTIN:
- if(!(prop->flags & PROPF_METHOD))
- return prop->u.p->invoke(This, lcid, DISPATCH_PROPERTYPUT, dp, NULL, ei, caller);
+ if(!(prop->flags & PROPF_METHOD)) {
+ vdisp_t vthis;
+
+ set_jsdisp(&vthis, This);
+ hres = prop->u.p->invoke(This->ctx, &vthis, DISPATCH_PROPERTYPUT, dp, NULL, ei, caller);
+ vdisp_release(&vthis);
+ return hres;
+ }
case PROP_PROTREF:
prop->type = PROP_VARIANT;
prop->flags = PROPF_ENUM;
return S_OK;
}
-static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
- LCID lcid, ITypeInfo **ppTInfo)
+static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid,
+ ITypeInfo **ppTInfo)
{
DispatchEx *This = DISPATCHEX_THIS(iface);
FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
}
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
- LPOLESTR *rgszNames, UINT cNames,
- LCID lcid, DISPID *rgDispId)
+ LPOLESTR *rgszNames, UINT cNames, LCID lcid,
+ DISPID *rgDispId)
{
DispatchEx *This = DISPATCHEX_THIS(iface);
UINT i;
}
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
- REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
+ REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
DispatchEx *This = DISPATCHEX_THIS(iface);
switch(wFlags) {
case DISPATCH_METHOD:
case DISPATCH_CONSTRUCT:
- hres = invoke_prop_func(This, This, prop, lcid, wFlags, pdp, pvarRes, &jsexcept, pspCaller);
+ hres = invoke_prop_func(This, This, prop, wFlags, pdp, pvarRes, &jsexcept, pspCaller);
break;
case DISPATCH_PROPERTYGET:
- hres = prop_get(This, prop, lcid, pdp, pvarRes, &jsexcept, pspCaller);
+ hres = prop_get(This, prop, pdp, pvarRes, &jsexcept, pspCaller);
break;
case DISPATCH_PROPERTYPUT:
- hres = prop_put(This, prop, lcid, pdp, &jsexcept, pspCaller);
+ hres = prop_put(This, prop, pdp, &jsexcept, pspCaller);
break;
default:
FIXME("Unimplemented flags %x\n", wFlags);
V_VT(&var) = VT_EMPTY;
memset(&jsexcept, 0, sizeof(jsexcept));
- hres = prop_get(constr, prop, ctx->lcid, NULL, &var, &jsexcept, NULL/*FIXME*/);
+ hres = prop_get(constr, prop, NULL, &var, &jsexcept, NULL/*FIXME*/);
if(FAILED(hres)) {
ERR("Could not get prototype\n");
return hres;
hres = init_dispex(dispex, ctx, builtin_info, prot);
if(prot)
- IDispatchEx_Release(_IDispatchEx_(prot));
+ jsdisp_release(prot);
return hres;
}
return DISP_E_UNKNOWNNAME;
}
-HRESULT jsdisp_call_value(DispatchEx *disp, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv,
+HRESULT jsdisp_call_value(DispatchEx *jsthis, WORD flags, DISPPARAMS *dp, VARIANT *retv,
jsexcept_t *ei, IServiceProvider *caller)
{
- return disp->builtin_info->value_prop.invoke(disp, lcid, flags, dp, retv, ei, caller);
+ vdisp_t vdisp;
+ HRESULT hres;
+
+ set_jsdisp(&vdisp, jsthis);
+ hres = jsthis->builtin_info->value_prop.invoke(jsthis->ctx, &vdisp, flags, dp, retv, ei, caller);
+ vdisp_release(&vdisp);
+ return hres;
}
-HRESULT jsdisp_call(DispatchEx *disp, DISPID id, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv,
+HRESULT jsdisp_call(DispatchEx *disp, DISPID id, WORD flags, DISPPARAMS *dp, VARIANT *retv,
jsexcept_t *ei, IServiceProvider *caller)
{
dispex_prop_t *prop;
if(!prop)
return DISP_E_MEMBERNOTFOUND;
- return invoke_prop_func(disp, disp, prop, lcid, flags, dp, retv, ei, caller);
+ return invoke_prop_func(disp, disp, prop, flags, dp, retv, ei, caller);
}
-HRESULT jsdisp_call_name(DispatchEx *disp, const WCHAR *name, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv,
+HRESULT jsdisp_call_name(DispatchEx *disp, const WCHAR *name, WORD flags, DISPPARAMS *dp, VARIANT *retv,
jsexcept_t *ei, IServiceProvider *caller)
{
dispex_prop_t *prop;
if(retv)
V_VT(retv) = VT_EMPTY;
- return invoke_prop_func(disp, disp, prop, lcid, flags, dp, retv, ei, caller);
+ return invoke_prop_func(disp, disp, prop, flags, dp, retv, ei, caller);
}
-HRESULT disp_call(IDispatch *disp, DISPID id, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv,
+HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DISPPARAMS *dp, VARIANT *retv,
jsexcept_t *ei, IServiceProvider *caller)
{
DispatchEx *jsdisp;
jsdisp = iface_to_jsdisp((IUnknown*)disp);
if(jsdisp) {
- hres = jsdisp_call(jsdisp, id, lcid, flags, dp, retv, ei, caller);
- IDispatchEx_Release(_IDispatchEx_(jsdisp));
+ hres = jsdisp_call(jsdisp, id, flags, dp, retv, ei, caller);
+ jsdisp_release(jsdisp);
return hres;
}
}
TRACE("using IDispatch\n");
- return IDispatch_Invoke(disp, id, &IID_NULL, lcid, flags, dp, retv, &ei->ei, &err);
+ return IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, dp, retv, &ei->ei, &err);
}
- hres = IDispatchEx_InvokeEx(dispex, id, lcid, flags, dp, retv, &ei->ei, caller);
+ hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, dp, retv, &ei->ei, caller);
IDispatchEx_Release(dispex);
return hres;
}
-HRESULT jsdisp_propput_name(DispatchEx *obj, const WCHAR *name, LCID lcid, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
+HRESULT jsdisp_propput_name(DispatchEx *obj, const WCHAR *name, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
{
DISPID named_arg = DISPID_PROPERTYPUT;
DISPPARAMS dp = {val, &named_arg, 1, 1};
if(FAILED(hres))
return hres;
- return prop_put(obj, prop, lcid, &dp, ei, caller);
+ return prop_put(obj, prop, &dp, ei, caller);
}
-HRESULT jsdisp_propput_idx(DispatchEx *obj, DWORD idx, LCID lcid, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
+HRESULT jsdisp_propput_idx(DispatchEx *obj, DWORD idx, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
{
WCHAR buf[12];
static const WCHAR formatW[] = {'%','d',0};
sprintfW(buf, formatW, idx);
- return jsdisp_propput_name(obj, buf, lcid, val, ei, caller);
+ return jsdisp_propput_name(obj, buf, val, ei, caller);
}
-HRESULT disp_propput(IDispatch *disp, DISPID id, LCID lcid, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
+HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
{
DISPID dispid = DISPID_PROPERTYPUT;
DISPPARAMS dp = {val, &dispid, 1, 1};
prop = get_prop(jsdisp, id);
if(prop)
- hres = prop_put(jsdisp, prop, lcid, &dp, ei, caller);
+ hres = prop_put(jsdisp, prop, &dp, ei, caller);
else
hres = DISP_E_MEMBERNOTFOUND;
- IDispatchEx_Release(_IDispatchEx_(jsdisp));
+ jsdisp_release(jsdisp);
return hres;
}
ULONG err = 0;
TRACE("using IDispatch\n");
- return IDispatch_Invoke(disp, id, &IID_NULL, DISPATCH_PROPERTYPUT, lcid, &dp, NULL, &ei->ei, &err);
+ return IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, DISPATCH_PROPERTYPUT, &dp, NULL, &ei->ei, &err);
}
- hres = IDispatchEx_InvokeEx(dispex, id, lcid, DISPATCH_PROPERTYPUT, &dp, NULL, &ei->ei, caller);
+ hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, DISPATCH_PROPERTYPUT, &dp, NULL, &ei->ei, caller);
IDispatchEx_Release(dispex);
return hres;
}
-HRESULT jsdisp_propget_name(DispatchEx *obj, const WCHAR *name, LCID lcid, VARIANT *var,
- jsexcept_t *ei, IServiceProvider *caller)
+HRESULT jsdisp_propget_name(DispatchEx *obj, const WCHAR *name, VARIANT *var, jsexcept_t *ei, IServiceProvider *caller)
{
DISPPARAMS dp = {NULL, NULL, 0, 0};
dispex_prop_t *prop;
if(!prop)
return S_OK;
- return prop_get(obj, prop, lcid, &dp, var, ei, caller);
+ return prop_get(obj, prop, &dp, var, ei, caller);
}
-HRESULT jsdisp_propget_idx(DispatchEx *obj, DWORD idx, LCID lcid, VARIANT *var, jsexcept_t *ei, IServiceProvider *caller)
+HRESULT jsdisp_propget_idx(DispatchEx *obj, DWORD idx, VARIANT *var, jsexcept_t *ei, IServiceProvider *caller)
{
WCHAR buf[12];
static const WCHAR formatW[] = {'%','d',0};
sprintfW(buf, formatW, idx);
- return jsdisp_propget_name(obj, buf, lcid, var, ei, caller);
+ return jsdisp_propget_name(obj, buf, var, ei, caller);
}
-HRESULT jsdisp_propget(DispatchEx *jsdisp, DISPID id, LCID lcid, VARIANT *val, jsexcept_t *ei,
- IServiceProvider *caller)
+HRESULT jsdisp_propget(DispatchEx *jsdisp, DISPID id, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
{
DISPPARAMS dp = {NULL,NULL,0,0};
dispex_prop_t *prop;
return DISP_E_MEMBERNOTFOUND;
V_VT(val) = VT_EMPTY;
- return prop_get(jsdisp, prop, lcid, &dp, val, ei, caller);
+ return prop_get(jsdisp, prop, &dp, val, ei, caller);
}
-HRESULT disp_propget(IDispatch *disp, DISPID id, LCID lcid, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
+HRESULT disp_propget(script_ctx_t *ctx, IDispatch *disp, DISPID id, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
{
DISPPARAMS dp = {NULL,NULL,0,0};
IDispatchEx *dispex;
jsdisp = iface_to_jsdisp((IUnknown*)disp);
if(jsdisp) {
- hres = jsdisp_propget(jsdisp, id, lcid, val, ei, caller);
- IDispatchEx_Release(_IDispatchEx_(jsdisp));
+ hres = jsdisp_propget(jsdisp, id, val, ei, caller);
+ jsdisp_release(jsdisp);
return hres;
}
ULONG err = 0;
TRACE("using IDispatch\n");
- return IDispatch_Invoke(disp, id, &IID_NULL, lcid, INVOKE_PROPERTYGET, &dp, val, &ei->ei, &err);
+ return IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, INVOKE_PROPERTYGET, &dp, val, &ei->ei, &err);
}
- hres = IDispatchEx_InvokeEx(dispex, id, lcid, INVOKE_PROPERTYGET, &dp, val, &ei->ei, caller);
+ hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, INVOKE_PROPERTYGET, &dp, val, &ei->ei, caller);
IDispatchEx_Release(dispex);
return hres;
if(val->u.nameref.disp)
IDispatch_Release(val->u.nameref.disp);
SysFreeString(val->u.nameref.name);
+ return;
+ case EXPRVAL_INVALID:
+ SysFreeString(val->u.identifier);
}
}
return E_FAIL;
}
- return disp_propget(val->u.idref.disp, val->u.idref.id, ctx->lcid, ret, ei, NULL/*FIXME*/);
- default:
- ERR("type %d\n", val->type);
- return E_FAIL;
+ return disp_propget(ctx, val->u.idref.disp, val->u.idref.id, ret, ei, NULL/*FIXME*/);
+ case EXPRVAL_NAMEREF:
+ break;
+ case EXPRVAL_INVALID:
+ return throw_type_error(ctx, ei, IDS_UNDEFINED, val->u.identifier);
}
+
+ ERR("type %d\n", val->type);
+ return E_FAIL;
}
static HRESULT exprval_to_value(script_ctx_t *ctx, exprval_t *val, jsexcept_t *ei, VARIANT *ret)
if(scope->next)
scope_release(scope->next);
- IDispatchEx_Release(_IDispatchEx_(scope->obj));
+ jsdisp_release(scope->obj);
heap_free(scope);
}
-HRESULT create_exec_ctx(IDispatch *this_obj, DispatchEx *var_disp, scope_chain_t *scope, exec_ctx_t **ret)
+HRESULT create_exec_ctx(script_ctx_t *script_ctx, IDispatch *this_obj, DispatchEx *var_disp,
+ scope_chain_t *scope, exec_ctx_t **ret)
{
exec_ctx_t *ctx;
ctx->ref = 1;
- IDispatch_AddRef(this_obj);
- ctx->this_obj = this_obj;
+ if(this_obj)
+ ctx->this_obj = this_obj;
+ else if(script_ctx->host_global)
+ ctx->this_obj = script_ctx->host_global;
+ else
+ ctx->this_obj = (IDispatch*)_IDispatchEx_(script_ctx->global);
+ IDispatch_AddRef(ctx->this_obj);
IDispatchEx_AddRef(_IDispatchEx_(var_disp));
ctx->var_disp = var_disp;
if(ctx->scope_chain)
scope_release(ctx->scope_chain);
if(ctx->var_disp)
- IDispatchEx_Release(_IDispatchEx_(ctx->var_disp));
+ jsdisp_release(ctx->var_disp);
if(ctx->this_obj)
IDispatch_Release(ctx->this_obj);
heap_free(ctx);
if(ref->type != EXPRVAL_IDREF)
return throw_reference_error(ctx, ei, IDS_ILLEGAL_ASSIGN, NULL);
- return disp_propput(ref->u.idref.disp, ref->u.idref.id, ctx->lcid, v, ei, NULL/*FIXME*/);
+ return disp_propput(ctx, ref->u.idref.disp, ref->u.idref.id, v, ei, NULL/*FIXME*/);
+}
+
+static inline BOOL is_null(const VARIANT *v)
+{
+ return V_VT(v) == VT_NULL || (V_VT(v) == VT_DISPATCH && !V_DISPATCH(v));
}
static HRESULT disp_cmp(IDispatch *disp1, IDispatch *disp2, BOOL *ret)
return S_OK;
}
+ if(!disp1 || !disp2) {
+ *ret = FALSE;
+ return S_OK;
+ }
+
hres = IDispatch_QueryInterface(disp1, &IID_IUnknown, (void**)&unk1);
if(FAILED(hres))
return hres;
TRACE("\n");
if(V_VT(lval) != V_VT(rval)) {
- if(is_num_vt(V_VT(lval)) && is_num_vt(V_VT(rval))) {
+ if(is_num_vt(V_VT(lval)) && is_num_vt(V_VT(rval)))
*ret = num_val(lval) == num_val(rval);
- return S_OK;
- }
-
- *ret = FALSE;
+ else if(is_null(lval))
+ *ret = is_null(rval);
+ else
+ *ret = FALSE;
return S_OK;
}
V_VT(&var) = VT_DISPATCH;
V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(func_obj);
- hres = jsdisp_propput_name(ctx->var_disp, func->expr->identifier, script->lcid, &var, ei, NULL);
+ hres = jsdisp_propput_name(ctx->var_disp, func->expr->identifier, &var, ei, NULL);
jsdisp_release(func_obj);
if(FAILED(hres))
return hres;
}
}
- hres = jsdisp_get_id(ctx->parser->script->script_disp, identifier, 0, &id);
- if(SUCCEEDED(hres)) {
- exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->parser->script->script_disp), id);
- return S_OK;
- }
-
if(lookup_global_members(ctx->parser->script, identifier, ret))
return S_OK;
if(flags & EXPR_NEWREF) {
- hres = jsdisp_get_id(ctx->var_disp, identifier, fdexNameEnsure, &id);
+ hres = jsdisp_get_id(ctx->parser->script->global, identifier, fdexNameEnsure, &id);
if(FAILED(hres))
return hres;
- exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->var_disp), id);
+ exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->parser->script->global), id);
return S_OK;
}
- return throw_type_error(ctx->var_disp->ctx, ei, IDS_UNDEFINED, identifier);
+ ret->type = EXPRVAL_INVALID;
+ ret->u.identifier = SysAllocString(identifier);
+ if(!ret->u.identifier)
+ return E_OUTOFMEMORY;
+
+ return S_OK;
}
/* ECMA-262 3rd Edition 12.1 */
if(FAILED(hres))
break;
- hres = jsdisp_propput_name(ctx->var_disp, iter->identifier, ctx->parser->script->lcid, &val, ei, NULL/*FIXME*/);
+ hres = jsdisp_propput_name(ctx->var_disp, iter->identifier, &val, ei, NULL/*FIXME*/);
VariantClear(&val);
if(FAILED(hres))
break;
if(FAILED(hres))
return hres;
- hres = to_object(ctx, &val, &disp);
+ hres = to_object(ctx->parser->script, &val, &disp);
VariantClear(&val);
if(FAILED(hres))
return hres;
hres = create_dispex(ctx->parser->script, NULL, NULL, &var_disp);
if(SUCCEEDED(hres)) {
- hres = jsdisp_propput_name(var_disp, block->identifier, ctx->parser->script->lcid,
- &ex, &rt->ei, NULL/*FIXME*/);
+ hres = jsdisp_propput_name(var_disp, block->identifier, &ex, &rt->ei, NULL/*FIXME*/);
if(SUCCEEDED(hres)) {
hres = scope_push(ctx->scope_chain, var_disp, &ctx->scope_chain);
if(SUCCEEDED(hres)) {
TRACE("\n");
if(expr->identifier) {
- hres = jsdisp_propget_name(ctx->var_disp, expr->identifier, ctx->parser->script->lcid, &var, ei, NULL/*FIXME*/);
+ hres = jsdisp_propget_name(ctx->var_disp, expr->identifier, &var, ei, NULL/*FIXME*/);
if(FAILED(hres))
return hres;
}else {
}
if(SUCCEEDED(hres))
- hres = to_object(ctx, &member, &obj);
+ hres = to_object(ctx->parser->script, &member, &obj);
VariantClear(&member);
if(SUCCEEDED(hres)) {
hres = to_string(ctx->parser->script, &val, ei, &str);
if(FAILED(hres))
return hres;
- hres = to_object(ctx, &member, &obj);
+ hres = to_object(ctx->parser->script, &member, &obj);
VariantClear(&member);
if(FAILED(hres))
return hres;
return E_FAIL;
}
- hres = disp_call(V_DISPATCH(&constr), DISPID_VALUE, ctx->parser->script->lcid,
+ hres = disp_call(ctx->parser->script, V_DISPATCH(&constr), DISPID_VALUE,
DISPATCH_CONSTRUCT, &dp, &var, ei, NULL/*FIXME*/);
IDispatch_Release(V_DISPATCH(&constr));
if(FAILED(hres))
if(SUCCEEDED(hres)) {
switch(exprval.type) {
case EXPRVAL_VARIANT:
- if(V_VT(&exprval.u.var) != VT_DISPATCH)
- return throw_type_error(ctx->var_disp->ctx, ei, IDS_NO_PROPERTY, NULL);
-
- hres = disp_call(V_DISPATCH(&exprval.u.var), DISPID_VALUE, ctx->parser->script->lcid,
- DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
+ if(V_VT(&exprval.u.var) == VT_DISPATCH)
+ hres = disp_call(ctx->parser->script, V_DISPATCH(&exprval.u.var), DISPID_VALUE,
+ DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
+ else
+ hres = throw_type_error(ctx->parser->script, ei, IDS_NO_PROPERTY, NULL);
break;
case EXPRVAL_IDREF:
- hres = disp_call(exprval.u.idref.disp, exprval.u.idref.id, ctx->parser->script->lcid,
+ 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*/);
break;
+ case EXPRVAL_INVALID:
+ hres = throw_type_error(ctx->parser->script, ei, IDS_OBJECT_EXPECTED, NULL);
+ break;
default:
FIXME("unimplemented type %d\n", exprval.type);
hres = E_NOTIMPL;
if(FAILED(hres))
break;
- hres = jsdisp_propput_idx(array, i, ctx->parser->script->lcid, &val, ei, NULL/*FIXME*/);
+ hres = jsdisp_propput_idx(array, i, &val, ei, NULL/*FIXME*/);
VariantClear(&val);
if(FAILED(hres))
break;
hres = exprval_to_value(ctx->parser->script, &exprval, ei, &val);
exprval_release(&exprval);
if(SUCCEEDED(hres)) {
- hres = jsdisp_propput_name(obj, name, ctx->parser->script->lcid, &val, ei, NULL/*FIXME*/);
+ hres = jsdisp_propput_name(obj, name, &val, ei, NULL/*FIXME*/);
VariantClear(&val);
}
}
}
/* ECMA-262 3rd Edition 11.8.6 */
-HRESULT instanceof_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+static HRESULT instanceof_eval(exec_ctx_t *ctx, VARIANT *inst, VARIANT *objv, jsexcept_t *ei, VARIANT *retv)
{
- FIXME("\n");
- return E_NOTIMPL;
+ DispatchEx *obj, *iter, *tmp = NULL;
+ VARIANT_BOOL ret = VARIANT_FALSE;
+ BOOL b;
+ VARIANT var;
+ HRESULT hres;
+
+ static const WCHAR prototypeW[] = {'p','r','o','t','o','t', 'y', 'p','e',0};
+
+ if(V_VT(objv) != VT_DISPATCH) {
+ FIXME("throw TypeError\n");
+ return E_FAIL;
+ }
+
+ obj = iface_to_jsdisp((IUnknown*)V_DISPATCH(objv));
+ if(!obj) {
+ FIXME("throw TypeError\n");
+ return E_FAIL;
+ }
+
+ if(is_class(obj, JSCLASS_FUNCTION)) {
+ hres = jsdisp_propget_name(obj, prototypeW, &var, ei, NULL/*FIXME*/);
+ }else {
+ FIXME("throw TypeError\n");
+ hres = E_FAIL;
+ }
+ jsdisp_release(obj);
+ if(FAILED(hres))
+ return hres;
+
+ if(V_VT(&var) == VT_DISPATCH) {
+ if(V_VT(inst) == VT_DISPATCH)
+ tmp = iface_to_jsdisp((IUnknown*)V_DISPATCH(inst));
+ for(iter = tmp; iter; iter = iter->prototype) {
+ hres = disp_cmp(V_DISPATCH(&var), (IDispatch*)_IDispatchEx_(iter), &b);
+ if(FAILED(hres))
+ break;
+ if(b) {
+ ret = VARIANT_TRUE;
+ break;
+ }
+ }
+
+ if(tmp)
+ jsdisp_release(tmp);
+ }else {
+ FIXME("prototype is not an object\n");
+ hres = E_FAIL;
+ }
+
+ VariantClear(&var);
+ if(FAILED(hres))
+ return hres;
+
+ V_VT(retv) = VT_BOOL;
+ V_BOOL(retv) = ret;
+ return S_OK;
+}
+
+/* ECMA-262 3rd Edition 11.8.6 */
+HRESULT instanceof_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+{
+ binary_expression_t *expr = (binary_expression_t*)_expr;
+
+ TRACE("\n");
+
+ return binary_expr_eval(ctx, expr, instanceof_eval, ei, ret);
}
/* ECMA-262 3rd Edition 11.8.7 */
-HRESULT in_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+static HRESULT in_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *obj, jsexcept_t *ei, VARIANT *retv)
{
- FIXME("\n");
- return E_NOTIMPL;
+ VARIANT_BOOL ret;
+ DISPID id;
+ BSTR str;
+ HRESULT hres;
+
+ if(V_VT(obj) != VT_DISPATCH) {
+ FIXME("throw TypeError\n");
+ return E_FAIL;
+ }
+
+ hres = to_string(ctx->parser->script, lval, ei, &str);
+ if(FAILED(hres))
+ return hres;
+
+ hres = disp_get_id(V_DISPATCH(obj), str, 0, &id);
+ SysFreeString(str);
+ if(SUCCEEDED(hres))
+ ret = VARIANT_TRUE;
+ else if(hres == DISP_E_UNKNOWNNAME)
+ ret = VARIANT_FALSE;
+ else
+ return hres;
+
+ V_VT(retv) = VT_BOOL;
+ V_BOOL(retv) = ret;
+ return S_OK;
+}
+
+/* ECMA-262 3rd Edition 11.8.7 */
+HRESULT in_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+{
+ binary_expression_t *expr = (binary_expression_t*)_expr;
+
+ TRACE("\n");
+
+ return binary_expr_eval(ctx, expr, in_eval, ei, ret);
}
/* ECMA-262 3rd Edition 11.6.1 */
}
/* ECMA-262 3rd Edition 11.4.3 */
-HRESULT typeof_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+static HRESULT typeof_exprval(exec_ctx_t *ctx, exprval_t *exprval, jsexcept_t *ei, const WCHAR **ret)
{
- unary_expression_t *expr = (unary_expression_t*)_expr;
- const WCHAR *str;
- exprval_t exprval;
VARIANT val;
HRESULT hres;
static const WCHAR stringW[] = {'s','t','r','i','n','g',0};
static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d',0};
- TRACE("\n");
-
- hres = expr_eval(ctx, expr->expression, 0, ei, &exprval);
- if(FAILED(hres))
- return hres;
+ if(exprval->type == EXPRVAL_INVALID) {
+ *ret = undefinedW;
+ return S_OK;
+ }
- hres = exprval_to_value(ctx->parser->script, &exprval, ei, &val);
- exprval_release(&exprval);
+ hres = exprval_to_value(ctx->parser->script, exprval, ei, &val);
if(FAILED(hres))
return hres;
switch(V_VT(&val)) {
case VT_EMPTY:
- str = undefinedW;
+ *ret = undefinedW;
break;
case VT_NULL:
- str = objectW;
+ *ret = objectW;
break;
case VT_BOOL:
- str = booleanW;
+ *ret = booleanW;
break;
case VT_I4:
case VT_R8:
- str = numberW;
+ *ret = numberW;
break;
case VT_BSTR:
- str = stringW;
+ *ret = stringW;
break;
case VT_DISPATCH: {
DispatchEx *dispex;
- dispex = iface_to_jsdisp((IUnknown*)V_DISPATCH(&val));
- if(dispex) {
- str = dispex->builtin_info->class == JSCLASS_FUNCTION ? functionW : objectW;
- IDispatchEx_Release(_IDispatchEx_(dispex));
+ if(V_DISPATCH(&val) && (dispex = iface_to_jsdisp((IUnknown*)V_DISPATCH(&val)))) {
+ *ret = is_class(dispex, JSCLASS_FUNCTION) ? functionW : objectW;
+ jsdisp_release(dispex);
}else {
- str = objectW;
+ *ret = objectW;
}
break;
}
default:
FIXME("unhandled vt %d\n", V_VT(&val));
- VariantClear(&val);
- return E_NOTIMPL;
+ hres = E_NOTIMPL;
}
VariantClear(&val);
+ return S_OK;
+}
+
+HRESULT typeof_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+{
+ unary_expression_t *expr = (unary_expression_t*)_expr;
+ const WCHAR *str = NULL;
+ exprval_t exprval;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ hres = expr_eval(ctx, expr->expression, 0, ei, &exprval);
+ if(FAILED(hres))
+ return hres;
+
+ hres = typeof_exprval(ctx, &exprval, ei, &str);
+ exprval_release(&exprval);
+ if(FAILED(hres))
+ return hres;
ret->type = EXPRVAL_VARIANT;
V_VT(&ret->u.var) = VT_BSTR;
V_BSTR(&ret->u.var) = SysAllocString(str);
+ if(!V_BSTR(&ret->u.var))
+ return E_OUTOFMEMORY;
+
return S_OK;
}
}
void exec_release(exec_ctx_t*);
-HRESULT create_exec_ctx(IDispatch*,DispatchEx*,scope_chain_t*,exec_ctx_t**);
+HRESULT create_exec_ctx(script_ctx_t*,IDispatch*,DispatchEx*,scope_chain_t*,exec_ctx_t**);
HRESULT exec_source(exec_ctx_t*,parser_ctx_t*,source_elements_t*,jsexcept_t*,VARIANT*);
typedef struct _statement_t statement_t;
enum {
EXPRVAL_VARIANT,
EXPRVAL_IDREF,
- EXPRVAL_NAMEREF
+ EXPRVAL_NAMEREF,
+ EXPRVAL_INVALID
} type;
union {
VARIANT var;
IDispatch *disp;
BSTR name;
} nameref;
+ BSTR identifier;
} u;
} exprval_t;
static const WCHAR numberW[] = {'n','u','m','b','e','r',0};
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
-static HRESULT Error_number(DispatchEx *dispex, LCID lcid, WORD flags,
+static inline ErrorInstance *error_from_vdisp(vdisp_t *vdisp)
+{
+ return (ErrorInstance*)vdisp->u.jsdisp;
+}
+
+static HRESULT Error_number(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- ErrorInstance *This = (ErrorInstance*)dispex;
+ ErrorInstance *This = error_from_vdisp(jsthis);
TRACE("\n");
}
}
-static HRESULT Error_description(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT Error_description(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- ErrorInstance *This = (ErrorInstance*)dispex;
+ ErrorInstance *This = error_from_vdisp(jsthis);
TRACE("\n");
}
/* ECMA-262 3rd Edition 15.11.4.3 */
-static HRESULT Error_message(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT Error_message(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- ErrorInstance *This = (ErrorInstance*)dispex;
+ ErrorInstance *This = error_from_vdisp(jsthis);
TRACE("\n");
}
/* ECMA-262 3rd Edition 15.11.4.4 */
-static HRESULT Error_toString(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR str[] = {'[','o','b','j','e','c','t',' ','E','r','r','o','r',']',0};
return S_OK;
}
-static HRESULT Error_value(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT Error_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
switch(flags) {
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:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
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) {
DispatchEx *err;
VARIANT numv;
V_VT(&numv) = VT_NULL;
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))))
- 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)
num = V_I4(&numv);
else
}
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))
return hres;
}
case INVOKE_FUNC:
case DISPATCH_CONSTRUCT:
if(V_VT(&numv) == VT_NULL)
- hres = create_error(dispex->ctx, constr, NULL, msg, &err);
+ hres = create_error(ctx, constr, NULL, msg, &err);
else
- hres = create_error(dispex->ctx, constr, &num, msg, &err);
+ hres = create_error(ctx, constr, &num, msg, &err);
if(FAILED(hres))
return hres;
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(err);
}
else
- IDispatchEx_Release(_IDispatchEx_(err));
+ jsdisp_release(err);
return S_OK;
}
}
-static HRESULT ErrorConstr_value(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT ErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return error_constr(dispex, flags, dp, retv, ei,
- dispex->ctx->error_constr);
+ return error_constr(ctx, flags, dp, retv, ei, ctx->error_constr);
}
-static HRESULT EvalErrorConstr_value(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT EvalErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return error_constr(dispex, flags, dp, retv, ei,
- dispex->ctx->eval_error_constr);
+ return error_constr(ctx, flags, dp, retv, ei, ctx->eval_error_constr);
}
-static HRESULT RangeErrorConstr_value(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT RangeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return error_constr(dispex, flags, dp, retv, ei,
- dispex->ctx->range_error_constr);
+ return error_constr(ctx, flags, dp, retv, ei, ctx->range_error_constr);
}
-static HRESULT ReferenceErrorConstr_value(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT ReferenceErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return error_constr(dispex, flags, dp, retv, ei,
- dispex->ctx->reference_error_constr);
+ return error_constr(ctx, flags, dp, retv, ei, ctx->reference_error_constr);
}
-static HRESULT SyntaxErrorConstr_value(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT RegExpErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return error_constr(dispex, flags, dp, retv, ei,
- dispex->ctx->syntax_error_constr);
+ return error_constr(ctx, flags, dp, retv, ei, ctx->regexp_error_constr);
}
-static HRESULT TypeErrorConstr_value(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT SyntaxErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return error_constr(dispex, flags, dp, retv, ei,
- dispex->ctx->type_error_constr);
+ return error_constr(ctx, flags, dp, retv, ei, ctx->syntax_error_constr);
}
-static HRESULT URIErrorConstr_value(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT TypeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return error_constr(dispex, flags, dp, retv, ei,
- dispex->ctx->uri_error_constr);
+ return error_constr(ctx, flags, dp, 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, IServiceProvider *sp)
+{
+ TRACE("\n");
+ return error_constr(ctx, flags, dp, retv, ei, ctx->uri_error_constr);
}
HRESULT init_error_constr(script_ctx_t *ctx, DispatchEx *object_prototype)
static const WCHAR EvalErrorW[] = {'E','v','a','l','E','r','r','o','r',0};
static const WCHAR RangeErrorW[] = {'R','a','n','g','e','E','r','r','o','r',0};
static const WCHAR ReferenceErrorW[] = {'R','e','f','e','r','e','n','c','e','E','r','r','o','r',0};
+ static const WCHAR RegExpErrorW[] = {'R','e','g','E','x','p','E','r','r','o','r',0};
static const WCHAR SyntaxErrorW[] = {'S','y','n','t','a','x','E','r','r','o','r',0};
static const WCHAR TypeErrorW[] = {'T','y','p','e','E','r','r','o','r',0};
static const WCHAR URIErrorW[] = {'U','R','I','E','r','r','o','r',0};
static const WCHAR *names[] = {ErrorW, EvalErrorW, RangeErrorW,
- ReferenceErrorW, SyntaxErrorW, TypeErrorW, URIErrorW};
+ ReferenceErrorW, RegExpErrorW, SyntaxErrorW, TypeErrorW, URIErrorW};
DispatchEx **constr_addr[] = {&ctx->error_constr, &ctx->eval_error_constr,
- &ctx->range_error_constr, &ctx->reference_error_constr,
+ &ctx->range_error_constr, &ctx->reference_error_constr, &ctx->regexp_error_constr,
&ctx->syntax_error_constr, &ctx->type_error_constr,
&ctx->uri_error_constr};
static builtin_invoke_t constr_val[] = {ErrorConstr_value, EvalErrorConstr_value,
- RangeErrorConstr_value, ReferenceErrorConstr_value, SyntaxErrorConstr_value,
- TypeErrorConstr_value, URIErrorConstr_value};
+ RangeErrorConstr_value, ReferenceErrorConstr_value, RegExpErrorConstr_value,
+ SyntaxErrorConstr_value, TypeErrorConstr_value, URIErrorConstr_value};
ErrorInstance *err;
INT i;
VARIANT v;
HRESULT hres;
- for(i=0; i<7; i++) {
+ for(i=0; i < sizeof(names)/sizeof(names[0]); i++) {
hres = alloc_error(ctx, i==0 ? object_prototype : NULL, NULL, &err);
if(FAILED(hres))
return hres;
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = SysAllocString(names[i]);
if(!V_BSTR(&v)) {
- IDispatchEx_Release(_IDispatchEx_(&err->dispex));
+ jsdisp_release(&err->dispex);
return E_OUTOFMEMORY;
}
- hres = jsdisp_propput_name(&err->dispex, nameW, ctx->lcid, &v, NULL/*FIXME*/, NULL/*FIXME*/);
+ hres = jsdisp_propput_name(&err->dispex, nameW, &v, NULL/*FIXME*/, NULL/*FIXME*/);
if(SUCCEEDED(hres))
- hres = create_builtin_function(ctx, constr_val[i], NULL,
+ hres = create_builtin_function(ctx, constr_val[i], names[i], NULL,
PROPF_CONSTR, &err->dispex, constr_addr[i]);
- IDispatchEx_Release(_IDispatchEx_(&err->dispex));
+ jsdisp_release(&err->dispex);
VariantClear(&v);
if(FAILED(hres))
return hres;
return throw_error(ctx, ei, id, str, ctx->eval_error_constr);
}
+HRESULT throw_generic_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
+{
+ return throw_error(ctx, ei, id, str, ctx->error_constr);
+}
+
HRESULT throw_range_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
{
return throw_error(ctx, ei, id, str, ctx->range_error_constr);
return throw_error(ctx, ei, id, str, ctx->reference_error_constr);
}
+HRESULT throw_regexp_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
+{
+ return throw_error(ctx, ei, id, str, ctx->regexp_error_constr);
+}
+
HRESULT throw_syntax_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
{
return throw_error(ctx, ei, id, str, ctx->syntax_error_constr);
typedef struct {
DispatchEx dispex;
builtin_invoke_t value_proc;
+ const WCHAR *name;
DWORD flags;
source_elements_t *source;
parameter_t *parameters;
DWORD length;
} FunctionInstance;
+static inline FunctionInstance *function_from_vdisp(vdisp_t *vdisp)
+{
+ return (FunctionInstance*)vdisp->u.jsdisp;
+}
+
+static inline FunctionInstance *function_this(vdisp_t *jsthis)
+{
+ return is_vclass(jsthis, JSCLASS_FUNCTION) ? function_from_vdisp(jsthis) : NULL;
+}
+
static const WCHAR prototypeW[] = {'p','r','o','t','o','t', 'y', 'p','e',0};
static const WCHAR lengthW[] = {'l','e','n','g','t','h',0};
return NULL;
}
-static HRESULT init_parameters(DispatchEx *var_disp, FunctionInstance *function, LCID lcid, DISPPARAMS *dp,
+static HRESULT init_parameters(DispatchEx *var_disp, FunctionInstance *function, DISPPARAMS *dp,
jsexcept_t *ei, IServiceProvider *caller)
{
parameter_t *param;
HRESULT hres;
V_VT(&var_empty) = VT_EMPTY;
- cargs = dp->cArgs - dp->cNamedArgs;
+ cargs = arg_cnt(dp);
for(param = function->parameters; param; param = param->next) {
- hres = jsdisp_propput_name(var_disp, param->identifier, lcid,
- i < cargs ? dp->rgvarg + dp->cArgs-1 - i : &var_empty,
- ei, caller);
+ hres = jsdisp_propput_name(var_disp, param->identifier,
+ i < cargs ? get_arg(dp,i) : &var_empty, ei, caller);
if(FAILED(hres))
return hres;
return S_OK;
}
-static HRESULT init_arguments(DispatchEx *arg_disp, FunctionInstance *function, LCID lcid, DISPPARAMS *dp,
- jsexcept_t *ei, IServiceProvider *caller)
+static HRESULT Arguments_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
+{
+ FIXME("\n");
+ return E_NOTIMPL;
+}
+
+static const builtin_info_t Arguments_info = {
+ JSCLASS_ARGUMENTS,
+ {NULL, Arguments_value, 0},
+ 0, NULL,
+ NULL,
+ NULL
+};
+
+static HRESULT create_arguments(script_ctx_t *ctx, IDispatch *calee, DISPPARAMS *dp,
+ jsexcept_t *ei, IServiceProvider *caller, DispatchEx **ret)
{
+ DispatchEx *args;
VARIANT var;
DWORD i;
HRESULT hres;
- for(i=0; i < dp->cArgs-dp->cNamedArgs; i++) {
- hres = jsdisp_propput_idx(arg_disp, i, lcid, dp->rgvarg+dp->cArgs-1-i, ei, caller);
+ static const WCHAR caleeW[] = {'c','a','l','l','e','e',0};
+
+ args = heap_alloc_zero(sizeof(DispatchEx));
+ if(!args)
+ return E_OUTOFMEMORY;
+
+ hres = init_dispex_from_constr(args, ctx, &Arguments_info, ctx->object_constr);
+ if(FAILED(hres)) {
+ heap_free(args);
+ return hres;
+ }
+
+ for(i=0; i < arg_cnt(dp); i++) {
+ hres = jsdisp_propput_idx(args, i, get_arg(dp,i), ei, caller);
if(FAILED(hres))
- return hres;
+ break;
+ }
+
+ if(SUCCEEDED(hres)) {
+ V_VT(&var) = VT_I4;
+ V_I4(&var) = arg_cnt(dp);
+ hres = jsdisp_propput_name(args, lengthW, &var, ei, caller);
+
+ if(SUCCEEDED(hres)) {
+ V_VT(&var) = VT_DISPATCH;
+ V_DISPATCH(&var) = calee;
+ hres = jsdisp_propput_name(args, caleeW, &var, ei, caller);
+ }
}
- V_VT(&var) = VT_I4;
- V_I4(&var) = dp->cArgs - dp->cNamedArgs;
- return jsdisp_propput_name(arg_disp, lengthW, lcid, &var, ei, caller);
+ if(FAILED(hres)) {
+ jsdisp_release(args);
+ return hres;
+ }
+
+ *ret = args;
+ return S_OK;
}
-static HRESULT create_var_disp(FunctionInstance *function, LCID lcid, DISPPARAMS *dp, jsexcept_t *ei,
+static HRESULT create_var_disp(script_ctx_t *ctx, FunctionInstance *function, DISPPARAMS *dp, jsexcept_t *ei,
IServiceProvider *caller, DispatchEx **ret)
{
DispatchEx *var_disp, *arg_disp;
static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0};
- hres = create_dispex(function->dispex.ctx, NULL, NULL, &var_disp);
+ hres = create_dispex(ctx, NULL, NULL, &var_disp);
if(FAILED(hres))
return hres;
- hres = create_dispex(function->dispex.ctx, NULL, NULL, &arg_disp);
+ hres = create_arguments(ctx, (IDispatch*)_IDispatchEx_(&function->dispex),
+ dp, ei, caller, &arg_disp);
if(SUCCEEDED(hres)) {
- hres = init_arguments(arg_disp, function, lcid, dp, ei, caller);
- if(SUCCEEDED(hres)) {
- VARIANT var;
-
- V_VT(&var) = VT_DISPATCH;
- V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(arg_disp);
- hres = jsdisp_propput_name(var_disp, argumentsW, lcid, &var, ei, caller);
- }
+ VARIANT var;
+ V_VT(&var) = VT_DISPATCH;
+ V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(arg_disp);
+ hres = jsdisp_propput_name(var_disp, argumentsW, &var, ei, caller);
jsdisp_release(arg_disp);
}
if(SUCCEEDED(hres))
- hres = init_parameters(var_disp, function, lcid, dp, ei, caller);
+ hres = init_parameters(var_disp, function, dp, ei, caller);
if(FAILED(hres)) {
jsdisp_release(var_disp);
return hres;
return S_OK;
}
-static HRESULT invoke_source(FunctionInstance *function, IDispatch *this_obj, LCID lcid, DISPPARAMS *dp,
+static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
DispatchEx *var_disp;
return E_FAIL;
}
- hres = create_var_disp(function, lcid, dp, ei, caller, &var_disp);
+ hres = create_var_disp(ctx, function, dp, ei, caller, &var_disp);
if(FAILED(hres))
return hres;
hres = scope_push(function->scope_chain, var_disp, &scope);
if(SUCCEEDED(hres)) {
- hres = create_exec_ctx(this_obj, var_disp, scope, &exec_ctx);
+ hres = create_exec_ctx(ctx, this_obj, var_disp, scope, &exec_ctx);
scope_release(scope);
}
if(FAILED(hres))
return hres;
}
-static HRESULT invoke_function(FunctionInstance *function, LCID lcid, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
-{
- IDispatch *this_obj;
-
- if(!(this_obj = get_this(dp)))
- this_obj = (IDispatch*)_IDispatchEx_(function->dispex.ctx->script_disp);
-
- return invoke_source(function, this_obj, lcid, dp, retv, ei, caller);
-}
-
-static HRESULT invoke_constructor(FunctionInstance *function, LCID lcid, DISPPARAMS *dp,
+static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
DispatchEx *this_obj;
HRESULT hres;
- hres = create_object(function->dispex.ctx, &function->dispex, &this_obj);
+ hres = create_object(ctx, &function->dispex, &this_obj);
if(FAILED(hres))
return hres;
- hres = invoke_source(function, (IDispatch*)_IDispatchEx_(this_obj), lcid, dp, retv, ei, caller);
+ hres = invoke_source(ctx, function, (IDispatch*)_IDispatchEx_(this_obj), dp, retv, ei, caller);
if(FAILED(hres)) {
jsdisp_release(this_obj);
return hres;
return S_OK;
}
-static HRESULT invoke_value_proc(FunctionInstance *function, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
- DispatchEx *this_obj = NULL;
- IDispatch *this_disp;
+ vdisp_t vthis;
HRESULT hres;
- this_disp = get_this(dp);
if(this_disp)
- this_obj = iface_to_jsdisp((IUnknown*)this_disp);
+ set_disp(&vthis, this_disp);
+ else if(ctx->host_global)
+ set_disp(&vthis, ctx->host_global);
+ else
+ set_jsdisp(&vthis, ctx->global);
- hres = function->value_proc(this_obj ? this_obj : function->dispex.ctx->script_disp, lcid,
- flags, dp, retv, ei, caller);
+ hres = function->value_proc(ctx, &vthis, flags, dp, retv, ei, caller);
- if(this_obj)
- jsdisp_release(this_obj);
+ 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, IServiceProvider *caller)
+{
+ if(function->value_proc)
+ return invoke_value_proc(ctx, function, this_obj, DISPATCH_METHOD, args, retv, ei, caller);
+
+ return invoke_source(ctx, function, this_obj, args, retv, ei, caller);
+}
+
static HRESULT function_to_string(FunctionInstance *function, BSTR *ret)
{
BSTR str;
+ static const WCHAR native_prefixW[] = {'\n','f','u','n','c','t','i','o','n',' '};
+ static const WCHAR native_suffixW[] =
+ {'(',')',' ','{','\n',' ',' ',' ',' ','[','n','a','t','i','v','e',' ','c','o','d','e',']','\n','}','\n'};
+
if(function->value_proc) {
- FIXME("Builtin functions not implemented\n");
- return E_NOTIMPL;
- }
+ DWORD name_len;
- str = SysAllocStringLen(function->src_str, function->src_len);
- if(!str)
- return E_OUTOFMEMORY;
+ name_len = strlenW(function->name);
+ str = SysAllocStringLen(NULL, sizeof(native_prefixW) + name_len*sizeof(WCHAR) + sizeof(native_suffixW));
+ if(!str)
+ return E_OUTOFMEMORY;
+
+ memcpy(str, native_prefixW, sizeof(native_prefixW));
+ memcpy(str + sizeof(native_prefixW)/sizeof(WCHAR), function->name, name_len*sizeof(WCHAR));
+ memcpy(str + sizeof(native_prefixW)/sizeof(WCHAR) + name_len, native_suffixW, sizeof(native_suffixW));
+ }else {
+ str = SysAllocStringLen(function->src_str, function->src_len);
+ if(!str)
+ return E_OUTOFMEMORY;
+ }
*ret = str;
return S_OK;
}
-static HRESULT Function_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Function_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- FunctionInstance *This = (FunctionInstance*)dispex;
+ FunctionInstance *This = function_from_vdisp(jsthis);
TRACE("%p %d\n", This, This->length);
return S_OK;
}
-static HRESULT Function_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FunctionInstance *function;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_FUNCTION))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
-
- function = (FunctionInstance*)dispex;
+ if(!(function = function_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
hres = function_to_string(function, &str);
if(FAILED(hres))
return S_OK;
}
-static HRESULT Function_apply(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+static HRESULT array_to_args(script_ctx_t *ctx, DispatchEx *arg_array, jsexcept_t *ei, IServiceProvider *caller,
+ DISPPARAMS *args)
{
- FIXME("\n");
- return E_NOTIMPL;
+ VARIANT var, *argv;
+ DWORD length, i;
+ HRESULT hres;
+
+ hres = jsdisp_propget_name(arg_array, lengthW, &var, ei, NULL/*FIXME*/);
+ if(FAILED(hres))
+ return hres;
+
+ hres = to_uint32(ctx, &var, ei, &length);
+ VariantClear(&var);
+ if(FAILED(hres))
+ return hres;
+
+ argv = heap_alloc(length * sizeof(VARIANT));
+ if(!argv)
+ return E_OUTOFMEMORY;
+
+ for(i=0; i<length; i++) {
+ hres = jsdisp_propget_idx(arg_array, i, argv+i, ei, caller);
+ if(FAILED(hres)) {
+ while(i--)
+ VariantClear(argv+i);
+ heap_free(argv);
+ return hres;
+ }
+ }
+
+ args->cArgs = length;
+ args->rgvarg = argv;
+ return S_OK;
}
-static HRESULT Function_call(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
- FIXME("\n");
- return E_NOTIMPL;
+ FunctionInstance *function;
+ DISPPARAMS args = {NULL,NULL,0,0};
+ DWORD argc, i;
+ IDispatch *this_obj = NULL;
+ HRESULT hres = S_OK;
+
+ TRACE("\n");
+
+ if(!(function = function_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
+
+ argc = arg_cnt(dp);
+ if(argc) {
+ hres = to_object(ctx, get_arg(dp,0), &this_obj);
+ if(FAILED(hres))
+ return hres;
+ }
+
+ if(argc >= 2) {
+ DispatchEx *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(arg_array && (
+ !is_class(arg_array, JSCLASS_ARRAY) && !is_class(arg_array, JSCLASS_ARGUMENTS) )) {
+ jsdisp_release(arg_array);
+ arg_array = NULL;
+ }
+ }
+
+ if(arg_array) {
+ hres = array_to_args(ctx, arg_array, ei, caller, &args);
+ jsdisp_release(arg_array);
+ }else {
+ FIXME("throw TypeError\n");
+ hres = E_FAIL;
+ }
+ }
+
+ hres = call_function(ctx, function, this_obj, &args, retv, ei, caller);
+
+ if(this_obj)
+ IDispatch_Release(this_obj);
+ for(i=0; i<args.cArgs; i++)
+ VariantClear(args.rgvarg+i);
+ heap_free(args.rgvarg);
+ return hres;
+}
+
+static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
+{
+ FunctionInstance *function;
+ DISPPARAMS args = {NULL,NULL,0,0};
+ IDispatch *this_obj = NULL;
+ DWORD argc;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ if(!(function = function_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
+
+ argc = arg_cnt(dp);
+ if(argc) {
+ hres = to_object(ctx, get_arg(dp,0), &this_obj);
+ if(FAILED(hres))
+ return hres;
+ args.cArgs = argc-1;
+ }
+
+ if(args.cArgs)
+ args.rgvarg = dp->rgvarg + dp->cArgs - args.cArgs-1;
+
+ hres = call_function(ctx, function, this_obj, &args, retv, ei, caller);
+
+ if(this_obj)
+ IDispatch_Release(this_obj);
+ return hres;
}
-HRESULT Function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
FunctionInstance *function;
TRACE("\n");
- if(dispex->builtin_info->class != JSCLASS_FUNCTION) {
+ if(!is_vclass(jsthis, JSCLASS_FUNCTION)) {
ERR("dispex is not a function\n");
return E_FAIL;
}
- function = (FunctionInstance*)dispex;
+ function = (FunctionInstance*)jsthis->u.jsdisp;
switch(flags) {
case DISPATCH_METHOD:
if(function->value_proc)
- return invoke_value_proc(function, lcid, flags, dp, retv, ei, caller);
+ return invoke_value_proc(ctx, function, get_this(dp), flags, dp, retv, ei, caller);
- return invoke_function(function, lcid, dp, retv, ei, caller);
+ return invoke_source(ctx, function, get_this(dp), dp, retv, ei, caller);
case DISPATCH_PROPERTYGET: {
HRESULT hres;
case DISPATCH_CONSTRUCT:
if(function->value_proc)
- return invoke_value_proc(function, lcid, flags, dp, retv, ei, caller);
+ return invoke_value_proc(ctx, function, get_this(dp), flags, dp, retv, ei, caller);
- return invoke_constructor(function, lcid, dp, retv, ei, caller);
+ return invoke_constructor(ctx, function, dp, retv, ei, caller);
default:
FIXME("not implemented flags %x\n", flags);
}
static const builtin_prop_t Function_props[] = {
- {applyW, Function_apply, PROPF_METHOD},
- {callW, Function_call, PROPF_METHOD},
+ {applyW, Function_apply, PROPF_METHOD|2},
+ {callW, Function_call, PROPF_METHOD|1},
{lengthW, Function_length, 0},
{toStringW, Function_toString, PROPF_METHOD}
};
NULL
};
-static HRESULT FunctionConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT FunctionProt_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT FunctionProt_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(prototype);
memset(&jsexcept, 0, sizeof(jsexcept));
- return jsdisp_propput_name(dispex, prototypeW, ctx->lcid, &var, &jsexcept, NULL/*FIXME*/);
+ return jsdisp_propput_name(dispex, prototypeW, &var, &jsexcept, NULL/*FIXME*/);
}
-HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
+HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name,
const builtin_info_t *builtin_info, DWORD flags, DispatchEx *prototype, DispatchEx **ret)
{
FunctionInstance *function;
}
function->value_proc = value_proc;
+ function->name = name;
*ret = &function->dispex;
return S_OK;
FunctionInstance *prot, *constr;
HRESULT hres;
+ static const WCHAR FunctionW[] = {'F','u','n','c','t','i','o','n',0};
+
hres = create_function(ctx, NULL, PROPF_CONSTR, TRUE, object_prototype, &prot);
if(FAILED(hres))
return hres;
prot->value_proc = FunctionProt_value;
+ prot->name = prototypeW;
hres = create_function(ctx, NULL, PROPF_CONSTR, TRUE, &prot->dispex, &constr);
if(SUCCEEDED(hres)) {
constr->value_proc = FunctionConstr_value;
+ constr->name = FunctionW;
hres = set_prototype(ctx, &constr->dispex, &prot->dispex);
if(FAILED(hres))
jsdisp_release(&constr->dispex);
static const WCHAR CollectGarbageW[] = {'C','o','l','l','e','c','t','G','a','r','b','a','g','e',0};
static const WCHAR MathW[] = {'M','a','t','h',0};
static const WCHAR encodeURIW[] = {'e','n','c','o','d','e','U','R','I',0};
+static const WCHAR decodeURIW[] = {'d','e','c','o','d','e','U','R','I',0};
+static const WCHAR encodeURIComponentW[] = {'e','n','c','o','d','e','U','R','I','C','o','m','p','o','n','e','n','t',0};
+static const WCHAR decodeURIComponentW[] = {'d','e','c','o','d','e','U','R','I','C','o','m','p','o','n','e','n','t',0};
static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d',0};
return 'A'+i-10;
}
-static HRESULT constructor_call(DispatchEx *constr, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT constructor_call(DispatchEx *constr, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
if(flags != DISPATCH_PROPERTYGET)
- return jsdisp_call_value(constr, lcid, flags, dp, retv, ei, sp);
+ return jsdisp_call_value(constr, flags, dp, retv, ei, sp);
V_VT(retv) = VT_DISPATCH;
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(constr);
return S_OK;
}
-static HRESULT JSGlobal_NaN(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_NaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
return S_OK;
}
-static HRESULT JSGlobal_Infinity(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_Infinity(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
return S_OK;
}
-static HRESULT JSGlobal_Array(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_Array(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->array_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->array_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_Boolean(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_Boolean(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->bool_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->bool_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_Date(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_Date(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->date_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->date_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_Error(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_Error(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->error_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->error_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_EvalError(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_EvalError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->eval_error_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->eval_error_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_RangeError(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_RangeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->range_error_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->range_error_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_ReferenceError(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_ReferenceError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->reference_error_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->reference_error_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_SyntaxError(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_SyntaxError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->syntax_error_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->syntax_error_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_TypeError(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_TypeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->type_error_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->type_error_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_URIError(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_URIError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->uri_error_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->uri_error_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_Function(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_Function(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->function_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->function_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_Number(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_Number(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->number_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->number_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_Object(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_Object(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->object_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->object_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_String(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_String(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->string_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->string_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_RegExp(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return constructor_call(dispex->ctx->regexp_constr, lcid, flags, dp, retv, ei, sp);
+ return constructor_call(ctx->regexp_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_ActiveXObject(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- FIXME("\n");
- return E_NOTIMPL;
+ TRACE("\n");
+
+ return constructor_call(ctx->activex_constr, flags, dp, retv, ei, sp);
}
-static HRESULT JSGlobal_VBArray(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_VBArray(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT JSGlobal_Enumerator(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_Enumerator(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT JSGlobal_escape(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- FIXME("\n");
- return E_NOTIMPL;
+ BSTR ret, str;
+ const WCHAR *ptr;
+ DWORD len = 0;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ if(!arg_cnt(dp)) {
+ if(retv) {
+ ret = SysAllocString(undefinedW);
+ if(!ret)
+ return E_OUTOFMEMORY;
+
+ V_VT(retv) = VT_BSTR;
+ V_BSTR(retv) = ret;
+ }
+
+ return S_OK;
+ }
+
+ hres = to_string(ctx, get_arg(dp, 0), ei, &str);
+ if(FAILED(hres))
+ return hres;
+
+ for(ptr=str; *ptr; ptr++) {
+ if(*ptr > 0xff)
+ len += 6;
+ else if(isalnum((char)*ptr) || *ptr=='*' || *ptr=='@' || *ptr=='-'
+ || *ptr=='_' || *ptr=='+' || *ptr=='.' || *ptr=='/')
+ len++;
+ else
+ len += 3;
+ }
+
+ ret = SysAllocStringLen(NULL, len);
+ if(!ret)
+ return E_OUTOFMEMORY;
+
+ len = 0;
+ for(ptr=str; *ptr; ptr++) {
+ if(*ptr > 0xff) {
+ ret[len++] = '%';
+ ret[len++] = 'u';
+ ret[len++] = int_to_char(*ptr >> 12);
+ ret[len++] = int_to_char((*ptr >> 8) & 0xf);
+ ret[len++] = int_to_char((*ptr >> 4) & 0xf);
+ ret[len++] = int_to_char(*ptr & 0xf);
+ }
+ else if(isalnum((char)*ptr) || *ptr=='*' || *ptr=='@' || *ptr=='-'
+ || *ptr=='_' || *ptr=='+' || *ptr=='.' || *ptr=='/')
+ ret[len++] = *ptr;
+ else {
+ ret[len++] = '%';
+ ret[len++] = int_to_char(*ptr >> 4);
+ ret[len++] = int_to_char(*ptr & 0xf);
+ }
+ }
+
+ if(retv) {
+ V_VT(retv) = VT_BSTR;
+ V_BSTR(retv) = ret;
+ }
+ else
+ SysFreeString(ret);
+
+ return S_OK;
}
/* ECMA-262 3rd Edition 15.1.2.1 */
-static HRESULT JSGlobal_eval(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
parser_ctx_t *parser_ctx;
return S_OK;
}
- if(!dispex->ctx->exec_ctx) {
+ if(!ctx->exec_ctx) {
FIXME("No active exec_ctx\n");
return E_UNEXPECTED;
}
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)) {
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);
return hres;
}
-static HRESULT JSGlobal_isNaN(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT_BOOL ret = VARIANT_FALSE;
TRACE("\n");
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))
return hres;
return S_OK;
}
-static HRESULT JSGlobal_isFinite(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT_BOOL ret = VARIANT_FALSE;
if(arg_cnt(dp)) {
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))
return hres;
return 100;
}
-static HRESULT JSGlobal_parseInt(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
DOUBLE ret = 0.0;
}
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))
return hres;
}
}
- hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &str);
+ hres = to_string(ctx, get_arg(dp, 0), ei, &str);
if(FAILED(hres))
return hres;
return S_OK;
}
-static HRESULT JSGlobal_parseFloat(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
LONGLONG d = 0, hlp;
}
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))
return hres;
return S_OK;
}
-static HRESULT JSGlobal_unescape(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static inline int hex_to_int(const WCHAR wch) {
+ if(toupperW(wch)>='A' && toupperW(wch)<='F') return toupperW(wch)-'A'+10;
+ if(isdigitW(wch)) return wch-'0';
+ return -1;
+}
+
+static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- FIXME("\n");
- return E_NOTIMPL;
+ BSTR ret, str;
+ const WCHAR *ptr;
+ DWORD len = 0;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ if(!arg_cnt(dp)) {
+ if(retv) {
+ ret = SysAllocString(undefinedW);
+ if(!ret)
+ return E_OUTOFMEMORY;
+
+ V_VT(retv) = VT_BSTR;
+ V_BSTR(retv) = ret;
+ }
+
+ return S_OK;
+ }
+
+ hres = to_string(ctx, get_arg(dp, 0), ei, &str);
+ if(FAILED(hres))
+ return hres;
+
+ for(ptr=str; *ptr; ptr++) {
+ if(*ptr == '%') {
+ if(hex_to_int(*(ptr+1))!=-1 && hex_to_int(*(ptr+2))!=-1)
+ ptr += 2;
+ else if(*(ptr+1)=='u' && hex_to_int(*(ptr+2))!=-1 && hex_to_int(*(ptr+3))!=-1
+ && hex_to_int(*(ptr+4))!=-1 && hex_to_int(*(ptr+5))!=-1)
+ ptr += 5;
+ }
+
+ len++;
+ }
+
+ ret = SysAllocStringLen(NULL, len);
+ if(!ret)
+ return E_OUTOFMEMORY;
+
+ len = 0;
+ for(ptr=str; *ptr; ptr++) {
+ if(*ptr == '%') {
+ if(hex_to_int(*(ptr+1))!=-1 && hex_to_int(*(ptr+2))!=-1) {
+ ret[len] = (hex_to_int(*(ptr+1))<<4) + hex_to_int(*(ptr+2));
+ ptr += 2;
+ }
+ else if(*(ptr+1)=='u' && hex_to_int(*(ptr+2))!=-1 && hex_to_int(*(ptr+3))!=-1
+ && hex_to_int(*(ptr+4))!=-1 && hex_to_int(*(ptr+5))!=-1) {
+ ret[len] = (hex_to_int(*(ptr+2))<<12) + (hex_to_int(*(ptr+3))<<8)
+ + (hex_to_int(*(ptr+4))<<4) + hex_to_int(*(ptr+5));
+ ptr += 5;
+ }
+ else
+ ret[len] = *ptr;
+ }
+ else
+ ret[len] = *ptr;
+
+ len++;
+ }
+
+ if(retv) {
+ V_VT(retv) = VT_BSTR;
+ V_BSTR(retv) = ret;
+ }
+ else
+ SysFreeString(ret);
+
+ return S_OK;
}
-static HRESULT JSGlobal_GetObject(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_GetObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT JSGlobal_ScriptEngine(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_ScriptEngine(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT JSGlobal_ScriptEngineMajorVersion(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_ScriptEngineMajorVersion(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT JSGlobal_ScriptEngineMinorVersion(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_ScriptEngineMinorVersion(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT JSGlobal_ScriptEngineBuildVersion(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_ScriptEngineBuildVersion(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT JSGlobal_CollectGarbage(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_CollectGarbage(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT JSGlobal_encodeURI(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
const WCHAR *ptr;
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))
return hres;
return S_OK;
}
+static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+{
+ FIXME("\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+{
+ FIXME("\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+{
+ FIXME("\n");
+ return E_NOTIMPL;
+}
+
static const builtin_prop_t JSGlobal_props[] = {
- {ActiveXObjectW, JSGlobal_ActiveXObject, PROPF_METHOD},
+ {ActiveXObjectW, JSGlobal_ActiveXObject, PROPF_CONSTR},
{ArrayW, JSGlobal_Array, PROPF_CONSTR},
{BooleanW, JSGlobal_Boolean, PROPF_CONSTR},
{CollectGarbageW, JSGlobal_CollectGarbage, PROPF_METHOD},
{TypeErrorW, JSGlobal_TypeError, PROPF_CONSTR},
{URIErrorW, JSGlobal_URIError, PROPF_CONSTR},
{VBArrayW, JSGlobal_VBArray, PROPF_METHOD},
+ {decodeURIW, JSGlobal_decodeURI, PROPF_METHOD},
+ {decodeURIComponentW, JSGlobal_decodeURIComponent, PROPF_METHOD},
{encodeURIW, JSGlobal_encodeURI, PROPF_METHOD},
+ {encodeURIComponentW, JSGlobal_encodeURIComponent, PROPF_METHOD},
{escapeW, JSGlobal_escape, PROPF_METHOD},
{evalW, JSGlobal_eval, PROPF_METHOD|1},
{isFiniteW, JSGlobal_isFinite, PROPF_METHOD},
if(FAILED(hres))
return hres;
+ hres = create_activex_constr(ctx, &ctx->activex_constr);
+ if(FAILED(hres))
+ return hres;
+
hres = create_array_constr(ctx, object_prototype, &ctx->array_constr);
if(FAILED(hres))
return hres;
V_VT(&var) = VT_DISPATCH;
V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(math);
- hres = jsdisp_propput_name(ctx->global, MathW, ctx->lcid, &var, NULL/*FIXME*/, NULL/*FIXME*/);
+ hres = jsdisp_propput_name(ctx->global, MathW, &var, NULL/*FIXME*/, NULL/*FIXME*/);
jsdisp_release(math);
return hres;
VARIANT var;
HRESULT hres;
- hres = create_exec_ctx((IDispatch*)_IDispatchEx_(This->ctx->script_disp), This->ctx->script_disp, NULL, &exec_ctx);
+ hres = create_exec_ctx(This->ctx, NULL, This->ctx->global, NULL, &exec_ctx);
if(FAILED(hres))
return hres;
This->ctx->lcid = This->lcid;
- if(!This->ctx->script_disp) {
- hres = create_dispex(This->ctx, NULL, NULL, &This->ctx->script_disp);
- if(FAILED(hres))
- return hres;
- }
-
hres = init_global(This->ctx);
if(FAILED(hres))
return hres;
return S_OK;
}
+typedef struct {
+ const IServiceProviderVtbl *lpIServiceProviderVtbl;
+
+ LONG ref;
+
+ IServiceProvider *sp;
+} AXSite;
+
+#define SERVPROV(x) ((IServiceProvider*) &(x)->lpIServiceProviderVtbl)
+
+#define SERVPROV_THIS(iface) DEFINE_THIS(AXSite, IServiceProvider, iface)
+
+static HRESULT WINAPI AXSite_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
+{
+ AXSite *This = SERVPROV_THIS(iface);
+
+ if(IsEqualGUID(&IID_IUnknown, riid)) {
+ TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+ *ppv = SERVPROV(This);
+ }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
+ TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
+ *ppv = SERVPROV(This);
+ }else {
+ TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
+}
+
+static ULONG WINAPI AXSite_AddRef(IServiceProvider *iface)
+{
+ AXSite *This = SERVPROV_THIS(iface);
+ LONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI AXSite_Release(IServiceProvider *iface)
+{
+ AXSite *This = SERVPROV_THIS(iface);
+ LONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ if(!ref)
+ heap_free(This);
+
+ return ref;
+}
+
+static HRESULT WINAPI AXSite_QueryService(IServiceProvider *iface,
+ REFGUID guidService, REFIID riid, void **ppv)
+{
+ AXSite *This = SERVPROV_THIS(iface);
+
+ TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
+
+ return IServiceProvider_QueryService(This->sp, guidService, riid, ppv);
+}
+
+#undef SERVPROV_THIS
+
+static IServiceProviderVtbl AXSiteVtbl = {
+ AXSite_QueryInterface,
+ AXSite_AddRef,
+ AXSite_Release,
+ AXSite_QueryService
+};
+
+IUnknown *create_ax_site(script_ctx_t *ctx)
+{
+ IServiceProvider *sp;
+ AXSite *ret;
+ HRESULT hres;
+
+ hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IServiceProvider, (void**)&sp);
+ if(FAILED(hres)) {
+ ERR("Could not get IServiceProvider iface: %08x\n", hres);
+ return NULL;
+ }
+
+ ret = heap_alloc(sizeof(AXSite));
+ if(!ret) {
+ IServiceProvider_Release(sp);
+ return NULL;
+ }
+
+ ret->lpIServiceProviderVtbl = &AXSiteVtbl;
+ ret->ref = 1;
+ ret->sp = sp;
+
+ return (IUnknown*)SERVPROV(ret);
+}
+
#define ACTSCRIPT_THIS(iface) DEFINE_THIS(JScript, IActiveScript, iface)
static HRESULT WINAPI JScript_QueryInterface(IActiveScript *iface, REFIID riid, void **ppv)
if(This->ctx->state == SCRIPTSTATE_DISCONNECTED)
change_state(This, SCRIPTSTATE_INITIALIZED);
+ if(This->ctx->host_global) {
+ IDispatch_Release(This->ctx->host_global);
+ This->ctx->host_global = NULL;
+ }
+
if(This->ctx->named_items) {
named_item_t *iter, *iter2;
This->ctx->named_items = NULL;
}
+ if(This->ctx->secmgr) {
+ IInternetHostSecurityManager_Release(This->ctx->secmgr);
+ This->ctx->secmgr = NULL;
+ }
+
if(This->ctx->site) {
IActiveScriptSite_Release(This->ctx->site);
This->ctx->site = NULL;
if (This->site)
change_state(This, SCRIPTSTATE_CLOSED);
- if(This->ctx->script_disp) {
- IDispatchEx_Release(_IDispatchEx_(This->ctx->script_disp));
- This->ctx->script_disp = NULL;
- }
-
if(This->ctx->global) {
- IDispatchEx_Release(_IDispatchEx_(This->ctx->global));
+ jsdisp_release(This->ctx->global);
This->ctx->global = NULL;
}
}
WARN("object does not implement IDispatch\n");
return hres;
}
+
+ if(This->ctx->host_global)
+ IDispatch_Release(This->ctx->host_global);
+ IDispatch_AddRef(disp);
+ This->ctx->host_global = disp;
}
item = heap_alloc(sizeof(*item));
if(!ppdisp)
return E_POINTER;
- if(This->thread_id != GetCurrentThreadId() || !This->ctx->script_disp) {
+ if(This->thread_id != GetCurrentThreadId() || !This->ctx->global) {
*ppdisp = NULL;
return E_UNEXPECTED;
}
- *ppdisp = (IDispatch*)_IDispatchEx_(This->ctx->script_disp);
+ *ppdisp = (IDispatch*)_IDispatchEx_(This->ctx->global);
IDispatch_AddRef(*ppdisp);
return S_OK;
}
ctx->ref = 1;
ctx->state = SCRIPTSTATE_UNINITIALIZED;
+ ctx->safeopt = This->safeopt;
jsheap_init(&ctx->tmp_heap);
ctx = InterlockedCompareExchangePointer((void**)&This->ctx, ctx, NULL);
/*
- * Copyright 2008 Jacek Caban for CodeWeavers
+ * Copyright 2008-2009 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#define PROPF_ENUM 0x0200
#define PROPF_CONSTR 0x0400
+/* NOTE: Keep in sync with names in Object.toString implementation */
typedef enum {
JSCLASS_NONE,
JSCLASS_ARRAY,
JSCLASS_NUMBER,
JSCLASS_OBJECT,
JSCLASS_REGEXP,
- JSCLASS_STRING
+ JSCLASS_STRING,
+ JSCLASS_ARGUMENTS
} jsclass_t;
-typedef HRESULT (*builtin_invoke_t)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
+DispatchEx *iface_to_jsdisp(IUnknown*);
+
+typedef struct {
+ union {
+ IDispatch *disp;
+ IDispatchEx *dispex;
+ DispatchEx *jsdisp;
+ } u;
+ DWORD flags;
+} vdisp_t;
+
+#define VDISP_DISPEX 0x0001
+#define VDISP_JSDISP 0x0002
+
+static inline void vdisp_release(vdisp_t *vdisp)
+{
+ IDispatch_Release(vdisp->u.disp);
+}
+
+static inline BOOL is_jsdisp(vdisp_t *vdisp)
+{
+ return (vdisp->flags & VDISP_JSDISP) != 0;
+}
+
+static inline BOOL is_dispex(vdisp_t *vdisp)
+{
+ return (vdisp->flags & VDISP_DISPEX) != 0;
+}
+
+static inline void set_jsdisp(vdisp_t *vdisp, DispatchEx *jsdisp)
+{
+ vdisp->u.jsdisp = jsdisp;
+ vdisp->flags = VDISP_JSDISP | VDISP_DISPEX;
+ IDispatch_AddRef(vdisp->u.disp);
+}
+
+static inline void set_disp(vdisp_t *vdisp, IDispatch *disp)
+{
+ IDispatchEx *dispex;
+ DispatchEx *jsdisp;
+ HRESULT hres;
+
+ jsdisp = iface_to_jsdisp((IUnknown*)disp);
+ if(jsdisp) {
+ vdisp->u.jsdisp = jsdisp;
+ vdisp->flags = VDISP_JSDISP | VDISP_DISPEX;
+ return;
+ }
+
+ hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
+ if(SUCCEEDED(hres)) {
+ vdisp->u.dispex = dispex;
+ vdisp->flags = VDISP_DISPEX;
+ return;
+ }
+
+ IDispatch_AddRef(disp);
+ vdisp->u.disp = disp;
+ vdisp->flags = 0;
+}
+
+static inline DispatchEx *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*,IServiceProvider*);
typedef struct {
const WCHAR *name;
HRESULT create_dispex(script_ctx_t*,const builtin_info_t*,DispatchEx*,DispatchEx**);
HRESULT init_dispex(DispatchEx*,script_ctx_t*,const builtin_info_t*,DispatchEx*);
HRESULT init_dispex_from_constr(DispatchEx*,script_ctx_t*,const builtin_info_t*,DispatchEx*);
-DispatchEx *iface_to_jsdisp(IUnknown*);
-HRESULT disp_call(IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT jsdisp_call_value(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT jsdisp_call(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT jsdisp_call_name(DispatchEx*,const WCHAR*,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT disp_propget(IDispatch*,DISPID,LCID,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT disp_propput(IDispatch*,DISPID,LCID,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT jsdisp_propget(DispatchEx*,DISPID,LCID,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT jsdisp_propput_name(DispatchEx*,const WCHAR*,LCID,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT jsdisp_propput_idx(DispatchEx*,DWORD,LCID,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT jsdisp_propget_name(DispatchEx*,LPCWSTR,LCID,VARIANT*,jsexcept_t*,IServiceProvider*);
-HRESULT jsdisp_propget_idx(DispatchEx*,DWORD,LCID,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT jsdisp_call_value(DispatchEx*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT jsdisp_call(DispatchEx*,DISPID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT jsdisp_call_name(DispatchEx*,const WCHAR*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT disp_propget(script_ctx_t*,IDispatch*,DISPID,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT jsdisp_propget(DispatchEx*,DISPID,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT jsdisp_propput_name(DispatchEx*,const WCHAR*,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT jsdisp_propput_idx(DispatchEx*,DWORD,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT jsdisp_propget_name(DispatchEx*,LPCWSTR,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT jsdisp_propget_idx(DispatchEx*,DWORD,VARIANT*,jsexcept_t*,IServiceProvider*);
HRESULT jsdisp_get_id(DispatchEx*,const WCHAR*,DWORD,DISPID*);
HRESULT jsdisp_delete_idx(DispatchEx*,DWORD);
-HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const builtin_info_t*,DWORD,
+HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD,
DispatchEx*,DispatchEx**);
-HRESULT Function_value(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
+HRESULT Function_value(script_ctx_t*,vdisp_t*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
HRESULT throw_eval_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
+HRESULT throw_generic_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_range_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_reference_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
+HRESULT throw_regexp_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_syntax_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_type_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_uri_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
-
HRESULT create_object(script_ctx_t*,DispatchEx*,DispatchEx**);
HRESULT create_math(script_ctx_t*,DispatchEx**);
HRESULT create_array(script_ctx_t*,DWORD,DispatchEx**);
HRESULT to_int32(script_ctx_t*,VARIANT*,jsexcept_t*,INT*);
HRESULT to_uint32(script_ctx_t*,VARIANT*,jsexcept_t*,DWORD*);
HRESULT to_string(script_ctx_t*,VARIANT*,jsexcept_t*,BSTR*);
-HRESULT to_object(exec_ctx_t*,VARIANT*,IDispatch**);
+HRESULT to_object(script_ctx_t*,VARIANT*,IDispatch**);
typedef struct named_item_t {
IDispatch *disp;
exec_ctx_t *exec_ctx;
named_item_t *named_items;
IActiveScriptSite *site;
+ IInternetHostSecurityManager *secmgr;
+ DWORD safeopt;
LCID lcid;
jsheap_t tmp_heap;
- DispatchEx *script_disp;
+ IDispatch *host_global;
+
DispatchEx *global;
DispatchEx *function_constr;
+ DispatchEx *activex_constr;
DispatchEx *array_constr;
DispatchEx *bool_constr;
DispatchEx *date_constr;
DispatchEx *eval_error_constr;
DispatchEx *range_error_constr;
DispatchEx *reference_error_constr;
+ DispatchEx *regexp_error_constr;
DispatchEx *syntax_error_constr;
DispatchEx *type_error_constr;
DispatchEx *uri_error_constr;
HRESULT init_function_constr(script_ctx_t*,DispatchEx*);
HRESULT create_object_prototype(script_ctx_t*,DispatchEx**);
+HRESULT create_activex_constr(script_ctx_t*,DispatchEx**);
HRESULT create_array_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
HRESULT create_bool_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
HRESULT create_date_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
HRESULT create_regexp_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
HRESULT create_string_constr(script_ctx_t*,DispatchEx*,DispatchEx**);
+IUnknown *create_ax_site(script_ctx_t*);
+
typedef struct {
const WCHAR *str;
DWORD len;
} 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*);
-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)
{
return jsdisp->builtin_info->class == class;
}
+static inline BOOL is_vclass(vdisp_t *vdisp, jsclass_t class)
+{
+ return is_jsdisp(vdisp) && is_class(vdisp->u.jsdisp, class);
+}
+
static inline BOOL is_num_vt(enum VARENUM vt)
{
return vt == VT_I4 || vt == VT_R8;
#endif
}
-static inline DOUBLE ret_nan()
+static inline DOUBLE ret_nan(void)
{
VARIANT v;
num_set_nan(&v);
<library>wine</library>
<library>kernel32</library>
<library>user32</library>
+ <library>ole32</library>
<library>oleaut32</library>
<library>advapi32</library>
+ <file>activex.c</file>
<file>date.c</file>
<file>dispex.c</file>
<file>engine.c</file>
{
IDS_TO_PRIMITIVE "Fehler beim umwandeln des Objektes in einen Grundtyp"
IDS_INVALID_CALL_ARG "Ungültiger Funktionsaufruf oder Argument"
+ IDS_CREATE_OBJ_ERROR "Automatisierungsserver konnte das Objekt nicht erstellen"
IDS_NO_PROPERTY "Das Objekt unterstützt diese Eigenschaft oder Methode nicht"
IDS_ARG_NOT_OPT "Argument nicht optional"
IDS_SYNTAX_ERROR "Syntax Fehler"
IDS_NOT_FUNC "Funktion erwartet"
IDS_NOT_DATE "'[Objekt]' ist kein Datums-Objekt"
IDS_NOT_NUM "Nummer erwartet"
+ IDS_OBJECT_EXPECTED "Objekt erwartet"
IDS_ILLEGAL_ASSIGN "Unzulässige Zuweisung"
IDS_UNDEFINED "'|' nicht definiert"
IDS_NOT_BOOL "Boolisches Objekt erwartet"
+ IDS_JSCRIPT_EXPECTED "JScript Objekt erwartet"
+ IDS_REGEXP_SYNTAX_ERROR "Syntax Fehler in regulärem Ausdruck"
IDS_INVALID_LENGTH "Array-Größe muss eine endliche, positive Ganzzahl sein"
+ IDS_ARRAY_EXPECTED "Array Objekt erwartet"
}
{
IDS_TO_PRIMITIVE "Error converting object to primitive type"
IDS_INVALID_CALL_ARG "Invalid procedure call or argument"
+ IDS_CREATE_OBJ_ERROR "Automation server can't create object"
IDS_NO_PROPERTY "Object doesn't support this property or method"
IDS_ARG_NOT_OPT "Argument not optional"
IDS_SYNTAX_ERROR "Syntax error"
IDS_NOT_FUNC "Function expected"
IDS_NOT_DATE "'[object]' is not a date object"
IDS_NOT_NUM "Number expected"
+ IDS_OBJECT_EXPECTED "Object expected"
IDS_ILLEGAL_ASSIGN "Illegal assignment"
IDS_UNDEFINED "'|' is undefined"
IDS_NOT_BOOL "Boolean object expected"
+ IDS_JSCRIPT_EXPECTED "JScript object expected"
+ IDS_REGEXP_SYNTAX_ERROR "Syntax error in regular expression"
IDS_INVALID_LENGTH "Array length must be a finite positive integer"
+ IDS_ARRAY_EXPECTED "Array object expected"
}
{
IDS_TO_PRIMITIVE "Erreur lors de la conversion de l'objet vers un type primitif"
IDS_INVALID_CALL_ARG "Appel de procédure ou argument invalide"
+ IDS_CREATE_OBJ_ERROR "Le serveur d'automatisation ne peut créer l'objet"
IDS_NO_PROPERTY "Cet objet ne supporte pas cette propriété ou méthode"
IDS_ARG_NOT_OPT "Argument non optionnel"
IDS_SYNTAX_ERROR "Erreur de syntaxe"
IDS_NOT_FUNC "Fonction attendue"
IDS_NOT_DATE "« [objet] » n'est pas un objet de type date"
IDS_NOT_NUM "Nombre attendu"
+ IDS_OBJECT_EXPECTED "Objet attendu"
IDS_ILLEGAL_ASSIGN "Affectation illégale"
IDS_UNDEFINED "« | » n'est pas défini"
- IDS_NOT_BOOL "Booléen attendu"
+ IDS_NOT_BOOL "Objet booléen attendu"
+ IDS_JSCRIPT_EXPECTED "Objet JScript attendu"
+ IDS_REGEXP_SYNTAX_ERROR "Erreur de syntaxe dans l'expression rationnelle"
IDS_INVALID_LENGTH "La longueur d'un tableau doit être un entier positif"
+ IDS_ARRAY_EXPECTED "Objet tableau attendu"
}
{
IDS_TO_PRIMITIVE "Klaida keičiant objektą į primityvų tipą"
IDS_INVALID_CALL_ARG "Netinkamas kreipinys į procedūrą ar argumentas"
+ IDS_CREATE_OBJ_ERROR "Automatizacijos serveriui nepavyko sukurti objekto"
IDS_NO_PROPERTY "Objektas nepalaiko šios savybės ar metodo"
IDS_ARG_NOT_OPT "Argumentas nėra neprivalomas"
IDS_SYNTAX_ERROR "Sintaksės klaida"
IDS_NOT_FUNC "Tikėtasi funkcijos"
IDS_NOT_DATE "„[objektas]“ nėra datos objektas"
IDS_NOT_NUM "Tikėtasi skaičiaus"
+ IDS_OBJECT_EXPECTED "Tikėtasi objekto"
IDS_ILLEGAL_ASSIGN "Neleistinas priskyrimas"
IDS_UNDEFINED "„|“ yra neapibrėžtas"
IDS_NOT_BOOL "Tikėtasi loginio objekto"
+ IDS_JSCRIPT_EXPECTED "Tikėtasi JScript objekto"
+ IDS_REGEXP_SYNTAX_ERROR "Sintaksės klaida reguliariajame reiškinyje"
IDS_INVALID_LENGTH "Masyvo dydis turi būti teigiamas sveikasis skaičius"
+ IDS_ARRAY_EXPECTED "Tikėtasi masyvo objekto"
}
IDS_NOT_FUNC "Functie verwacht"
IDS_NOT_DATE "'[object]' is geen datum object"
IDS_NOT_NUM "Getal verwacht"
+ IDS_OBJECT_EXPECTED "Object verwacht"
IDS_ILLEGAL_ASSIGN "Ongeldige toekenning"
IDS_UNDEFINED "'|' is ongedefinieerd"
IDS_NOT_BOOL "Boolean object verwacht"
+ IDS_JSCRIPT_EXPECTED "JScript object verwacht"
+ IDS_REGEXP_SYNTAX_ERROR "Syntax fout in reguliere expressie"
IDS_INVALID_LENGTH "Array lengte moet een eindig, positief geheel getal zijn"
+ IDS_ARRAY_EXPECTED "Array object verwacht"
}
#include "advpub.h"
#include "activaut.h"
#include "objsafe.h"
+#include "mshtmhst.h"
#include "wine/debug.h"
const char *debugstr_variant(const VARIANT *v)
{
+ if(!v)
+ return "(null)";
+
switch(V_VT(v)) {
case VT_EMPTY:
- return wine_dbg_sprintf("{VT_EMPTY}");
+ return "{VT_EMPTY}";
case VT_NULL:
- return wine_dbg_sprintf("{VT_NULL}");
+ return "{VT_NULL}";
case VT_I4:
return wine_dbg_sprintf("{VT_I4: %d}", V_I4(v));
case VT_R8:
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
+ if(!V_DISPATCH(v)) {
+ V_VT(ret) = VT_NULL;
+ break;
+ }
+
jsdisp = iface_to_jsdisp((IUnknown*)V_DISPATCH(v));
- if(!jsdisp)
- return disp_propget(V_DISPATCH(v), DISPID_VALUE, ctx->lcid, ret, ei, NULL /*FIXME*/);
+ if(!jsdisp) {
+ V_VT(ret) = VT_EMPTY;
+ return disp_propget(ctx, V_DISPATCH(v), DISPID_VALUE, ret, ei, NULL /*FIXME*/);
+ }
if(hint == NO_HINT)
hint = is_class(jsdisp, JSCLASS_DATE) ? HINT_STRING : HINT_NUMBER;
hres = jsdisp_get_id(jsdisp, hint == HINT_STRING ? toStringW : valueOfW, 0, &id);
if(SUCCEEDED(hres)) {
- hres = jsdisp_call(jsdisp, id, ctx->lcid, DISPATCH_METHOD, &dp, ret, ei, NULL /*FIXME*/);
+ hres = jsdisp_call(jsdisp, id, DISPATCH_METHOD, &dp, ret, ei, NULL /*FIXME*/);
if(FAILED(hres)) {
WARN("call error - forwarding exception\n");
jsdisp_release(jsdisp);
hres = jsdisp_get_id(jsdisp, hint == HINT_STRING ? valueOfW : toStringW, 0, &id);
if(SUCCEEDED(hres)) {
- hres = jsdisp_call(jsdisp, id, ctx->lcid, DISPATCH_METHOD, &dp, ret, ei, NULL /*FIXME*/);
+ hres = jsdisp_call(jsdisp, id, DISPATCH_METHOD, &dp, ret, ei, NULL /*FIXME*/);
if(FAILED(hres)) {
WARN("call error - forwarding exception\n");
jsdisp_release(jsdisp);
}
/* ECMA-262 3rd Edition 9.9 */
-HRESULT to_object(exec_ctx_t *ctx, VARIANT *v, IDispatch **disp)
+HRESULT to_object(script_ctx_t *ctx, VARIANT *v, IDispatch **disp)
{
DispatchEx *dispex;
HRESULT hres;
switch(V_VT(v)) {
case VT_BSTR:
- hres = create_string(ctx->parser->script, V_BSTR(v), SysStringLen(V_BSTR(v)), &dispex);
+ hres = create_string(ctx, V_BSTR(v), SysStringLen(V_BSTR(v)), &dispex);
if(FAILED(hres))
return hres;
break;
case VT_I4:
case VT_R8:
- hres = create_number(ctx->parser->script, v, &dispex);
+ hres = create_number(ctx, v, &dispex);
if(FAILED(hres))
return hres;
*disp = (IDispatch*)_IDispatchEx_(dispex);
break;
case VT_DISPATCH:
- IDispatch_AddRef(V_DISPATCH(v));
- *disp = V_DISPATCH(v);
+ if(V_DISPATCH(v)) {
+ IDispatch_AddRef(V_DISPATCH(v));
+ *disp = V_DISPATCH(v);
+ }else {
+ DispatchEx *obj;
+
+ hres = create_object(ctx, NULL, &obj);
+ if(FAILED(hres))
+ return hres;
+
+ *disp = (IDispatch*)_IDispatchEx_(obj);
+ }
break;
case VT_BOOL:
- hres = create_bool(ctx->parser->script, V_BOOL(v), &dispex);
+ hres = create_bool(ctx, V_BOOL(v), &dispex);
if(FAILED(hres))
return hres;
return -1;
}
+/* ECMA-262 3rd Edition 7.6 */
+static BOOL is_identifier_char(WCHAR c)
+{
+ return isalnumW(c) || c == '$' || c == '_' || c == '\\';
+}
+
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
{
const WCHAR *p1 = ctx->ptr;
p2++;
}
- if(*p2 || (p1 < ctx->end && isalnumW(*p1)))
+ if(*p2 || (p1 < ctx->end && is_identifier_char(*p1)))
return 1;
*lval = ctx->ptr;
return c == '\n' || c == '\r' || c == 0x2028 || c == 0x2029;
}
-static BOOL is_identifier_char(WCHAR c)
-{
- return isalnumW(c) || c == '$' || c == '_' || c == '\\';
-}
-
static int hex_to_int(WCHAR c)
{
if('0' <= c && c <= '9')
i = hex_to_int(*++p);
if(i == -1)
return FALSE;
- c += 1 << 4;
+ c += i << 4;
i = hex_to_int(*++p);
if(i == -1)
default:
if(isdigitW(*p)) {
c = *p++ - '0';
- while(isdigitW(*p))
- c = c*10 + (*p++ - '0');
- *pd++ = c;
- continue;
+ if(isdigitW(*p)) {
+ c = c*8 + (*p++ - '0');
+ if(isdigitW(*p))
+ c = c*8 + (*p++ - '0');
+ }
+ p--;
}
-
- c = *p;
+ else
+ c = *p;
}
*pd++ = c;
if(*ctx->ptr == '=') { /* /= */
ctx->ptr++;
*(int*)lval = EXPR_ASSIGNDIV;
- return tAssignOper;
+ return kDIVEQ;
}
}
return '/';
TRACE("\n");
- re = ctx->ptr;
+ while(*ctx->ptr != '/')
+ ctx->ptr--;
+
+ re = ++ctx->ptr;
while(ctx->ptr < ctx->end && *ctx->ptr != '/') {
if(*ctx->ptr++ == '\\' && ctx->ptr < ctx->end)
ctx->ptr++;
}
/* ECMA-262 3rd Edition 15.8.1.1 */
-static HRESULT Math_E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_E(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
}
/* ECMA-262 3rd Edition 15.8.1.4 */
-static HRESULT Math_LOG2E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_LOG2E(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
}
/* ECMA-262 3rd Edition 15.8.1.4 */
-static HRESULT Math_LOG10E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_LOG10E(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
return math_constant(M_LOG10E, flags, retv);
}
-static HRESULT Math_LN2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_LN2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
return math_constant(M_LN2, flags, retv);
}
-static HRESULT Math_LN10(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_LN10(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
}
/* ECMA-262 3rd Edition 15.8.1.6 */
-static HRESULT Math_PI(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_PI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
return math_constant(M_PI, flags, retv);
}
-static HRESULT Math_SQRT2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_SQRT2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
return math_constant(M_SQRT2, flags, retv);
}
-static HRESULT Math_SQRT1_2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_SQRT1_2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
}
/* ECMA-262 3rd Edition 15.8.2.12 */
-static HRESULT Math_abs(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_acos(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_asin(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_atan(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_atan2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v1, v2;
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))
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))
return hres;
}
/* ECMA-262 3rd Edition 15.8.2.6 */
-static HRESULT Math_ceil(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_cos(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_exp(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_floor(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_log(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
}
/* ECMA-262 3rd Edition 15.8.2.11 */
-static HRESULT Math_max(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
DOUBLE max, d;
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))
return hres;
max = num_val(&v);
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))
return hres;
}
/* ECMA-262 3rd Edition 15.8.2.12 */
-static HRESULT Math_min(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
DOUBLE min, d;
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))
return hres;
min = num_val(&v);
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))
return hres;
}
/* ECMA-262 3rd Edition 15.8.2.13 */
-static HRESULT Math_pow(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT x, y;
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))
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))
return hres;
}
/* ECMA-262 3rd Edition 15.8.2.14 */
-static HRESULT Math_random(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_random(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
UINT r;
}
/* ECMA-262 3rd Edition 15.8.2.15 */
-static HRESULT Math_round(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_sin(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_sqrt(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
return S_OK;
}
-static HRESULT Math_tan(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT v;
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))
return hres;
static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
#define NUMBER_TOSTRING_BUF_SIZE 64
+
+static inline NumberInstance *number_from_vdisp(vdisp_t *vdisp)
+{
+ return (NumberInstance*)vdisp->u.jsdisp;
+}
+
+static inline NumberInstance *number_this(vdisp_t *jsthis)
+{
+ return is_vclass(jsthis, JSCLASS_NUMBER) ? number_from_vdisp(jsthis) : NULL;
+}
+
/* ECMA-262 3rd Edition 15.7.4.2 */
-static HRESULT Number_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
NumberInstance *number;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_NUMBER))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_NUM, NULL);
-
- number = (NumberInstance*)dispex;
+ if(!(number = number_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_NUM, NULL);
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))
return hres;
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)
val = V_R8(&number->num);
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))
return hres;
}
return S_OK;
}
-static HRESULT Number_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Number_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT Number_toFixed(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT Number_toExponential(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT Number_toPrecision(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT Number_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Number_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
+ NumberInstance *number;
+
TRACE("\n");
- if(!is_class(dispex, JSCLASS_NUMBER))
- return throw_type_error(dispex->ctx, ei, IDS_NOT_NUM, NULL);
+ if(!(number = number_this(jsthis)))
+ return throw_type_error(ctx, ei, IDS_NOT_NUM, NULL);
- if(retv) {
- NumberInstance *number = (NumberInstance*)dispex;
+ if(retv)
*retv = number->num;
- }
return S_OK;
}
-static HRESULT Number_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Number_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- NumberInstance *number = (NumberInstance*)dispex;
+ NumberInstance *number = number_from_vdisp(jsthis);
switch(flags) {
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:
*retv = number->num;
break;
NULL
};
-static HRESULT NumberConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
VARIANT num;
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))
return hres;
DispatchEx *obj;
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))
return hres;
}else {
V_I4(&num) = 0;
}
- hres = create_number(dispex->ctx, &num, &obj);
+ hres = create_number(ctx, &num, &obj);
if(FAILED(hres))
return hres;
NumberInstance *number;
HRESULT hres;
+ static const WCHAR NumberW[] = {'N','u','m','b','e','r',0};
+
hres = alloc_number(ctx, object_prototype, &number);
if(FAILED(hres))
return hres;
V_VT(&number->num) = VT_I4;
- hres = create_builtin_function(ctx, NumberConstr_value, NULL, PROPF_CONSTR, &number->dispex, ret);
+ hres = create_builtin_function(ctx, NumberConstr_value, NumberW, NULL, PROPF_CONSTR, &number->dispex, ret);
jsdisp_release(&number->dispex);
return hres;
static const WCHAR default_valueW[] = {'[','o','b','j','e','c','t',' ','O','b','j','e','c','t',']',0};
-static HRESULT Object_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
+ DispatchEx *jsdisp;
+ const WCHAR *str;
+
static const WCHAR formatW[] = {'[','o','b','j','e','c','t',' ','%','s',']',0};
static const WCHAR arrayW[] = {'A','r','r','a','y',0};
static const WCHAR regexpW[] = {'R','e','g','E','x','p',0};
static const WCHAR stringW[] = {'S','t','r','i','n','g',0};
/* Keep in sync with jsclass_t enum */
- static const WCHAR *names[] = {NULL, arrayW, booleanW, dateW, errorW,
- functionW, NULL, mathW, numberW, objectW, regexpW, stringW};
+ static const WCHAR *names[] = {objectW, arrayW, booleanW, dateW, errorW,
+ functionW, NULL, mathW, numberW, objectW, regexpW, stringW, objectW};
TRACE("\n");
- if(names[dispex->builtin_info->class] == NULL) {
- ERR("dispex->builtin_info->class = %d\n",
- dispex->builtin_info->class);
+ jsdisp = get_jsdisp(jsthis);
+ if(!jsdisp) {
+ str = objectW;
+ }else if(names[jsdisp->builtin_info->class]) {
+ str = names[jsdisp->builtin_info->class];
+ }else {
+ FIXME("jdisp->builtin_info->class = %d\n", jsdisp->builtin_info->class);
return E_FAIL;
}
if(retv) {
V_VT(retv) = VT_BSTR;
- V_BSTR(retv) = SysAllocStringLen(NULL, 9+strlenW(names[dispex->builtin_info->class]));
+ V_BSTR(retv) = SysAllocStringLen(NULL, 9+strlenW(str));
if(!V_BSTR(retv))
return E_OUTOFMEMORY;
- sprintfW(V_BSTR(retv), formatW, names[dispex->builtin_info->class]);
+ sprintfW(V_BSTR(retv), formatW, str);
}
return S_OK;
}
-static HRESULT Object_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Object_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
DISPPARAMS params = {NULL, NULL, 0, 0};
TRACE("\n");
- return jsdisp_call_name(dispex, toStringW, lcid, DISPATCH_METHOD, ¶ms, retv, ei, sp);
+ if(!is_jsdisp(jsthis)) {
+ FIXME("Host object this\n");
+ return E_FAIL;
+ }
+
+ return jsdisp_call_name(jsthis->u.jsdisp, toStringW, DISPATCH_METHOD, ¶ms, retv, ei, sp);
}
-static HRESULT Object_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Object_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
if(retv) {
- IDispatchEx_AddRef(_IDispatchEx_(dispex));
+ IDispatch_AddRef(jsthis->u.disp);
V_VT(retv) = VT_DISPATCH;
- V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(dispex);
+ V_DISPATCH(retv) = jsthis->u.disp;
}
return S_OK;
}
-static HRESULT Object_hasOwnProperty(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT Object_propertyIsEnumerable(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT Object_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Object_isPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT Object_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT Object_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
switch(flags) {
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:
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = SysAllocString(default_valueW);
NULL
};
-static HRESULT ObjectConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
HRESULT hres;
TRACE("\n");
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) {
+ IDispatch *disp;
+
+ hres = to_object(ctx, arg, &disp);
+ if(FAILED(hres))
+ return hres;
+
+ if(retv) {
+ V_VT(retv) = VT_DISPATCH;
+ V_DISPATCH(retv) = disp;
+ }else {
+ IDispatch_Release(disp);
+ }
+ return S_OK;
+ }
+ }
+ /* fall through */
case DISPATCH_CONSTRUCT: {
DispatchEx *obj;
- hres = create_object(dispex->ctx, NULL, &obj);
+ hres = create_object(ctx, NULL, &obj);
if(FAILED(hres))
return hres;
HRESULT create_object_constr(script_ctx_t *ctx, DispatchEx *object_prototype, DispatchEx **ret)
{
- return create_builtin_function(ctx, ObjectConstr_value, NULL, PROPF_CONSTR,
+ static const WCHAR ObjectW[] = {'O','b','j','e','c','t',0};
+
+ return create_builtin_function(ctx, ObjectConstr_value, ObjectW, NULL, PROPF_CONSTR,
object_prototype, ret);
}
tINC = 288,
tDEC = 289,
tHTMLCOMMENT = 290,
- kFUNCTION = 291,
- tIdentifier = 292,
- tAssignOper = 293,
- tEqOper = 294,
- tShiftOper = 295,
- tRelOper = 296,
- tNumericLiteral = 297,
- tStringLiteral = 298,
- LOWER_THAN_ELSE = 299
+ kDIVEQ = 291,
+ kFUNCTION = 292,
+ tIdentifier = 293,
+ tAssignOper = 294,
+ tEqOper = 295,
+ tShiftOper = 296,
+ tRelOper = 297,
+ tNumericLiteral = 298,
+ tStringLiteral = 299,
+ LOWER_THAN_ELSE = 300
};
#endif
/* Line 214 of yacc.c */
-#line 314 "parser.tab.c"
+#line 315 "parser.tab.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
/* Line 264 of yacc.c */
-#line 326 "parser.tab.c"
+#line 327 "parser.tab.c"
#ifdef short
# undef short
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 3
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 942
+#define YYLAST 1042
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 67
+#define YYNTOKENS 68
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 94
+#define YYNNTS 95
/* YYNRULES -- Number of rules. */
-#define YYNRULES 211
+#define YYNRULES 215
/* YYNRULES -- Number of states. */
-#define YYNSTATES 370
+#define YYNSTATES 374
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 299
+#define YYMAXUTOK 300
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 61, 2, 2, 2, 59, 54, 2,
- 65, 66, 57, 55, 47, 56, 64, 58, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 50, 49,
- 2, 48, 2, 51, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 62, 2, 2, 2, 60, 55, 2,
+ 66, 67, 58, 56, 48, 57, 65, 59, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 51, 50,
+ 2, 49, 2, 52, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 62, 2, 63, 53, 2, 2, 2, 2, 2,
+ 2, 63, 2, 64, 54, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 46, 52, 37, 60, 2, 2, 2,
+ 2, 2, 2, 47, 53, 38, 61, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 38, 39, 40, 41, 42, 43, 44, 45
+ 35, 36, 37, 39, 40, 41, 42, 43, 44, 45,
+ 46
};
#if YYDEBUG
0, 0, 3, 6, 8, 9, 10, 13, 22, 24,
26, 28, 32, 33, 35, 37, 39, 41, 43, 45,
47, 49, 51, 53, 55, 57, 59, 61, 63, 65,
- 68, 69, 71, 75, 78, 82, 84, 88, 90, 94,
- 97, 100, 101, 103, 106, 107, 109, 112, 114, 117,
- 125, 131, 139, 145, 146, 147, 159, 160, 161, 174,
- 182, 191, 195, 199, 203, 209, 213, 219, 223, 229,
- 230, 232, 234, 237, 242, 246, 250, 254, 258, 263,
- 269, 272, 273, 275, 277, 279, 281, 285, 286, 288,
- 290, 294, 296, 300, 304, 306, 310, 314, 316, 322,
- 324, 330, 332, 336, 338, 342, 344, 348, 350, 354,
- 356, 360, 362, 366, 368, 372, 374, 378, 380, 384,
- 386, 390, 392, 396, 398, 402, 404, 408, 412, 416,
- 418, 422, 426, 428, 432, 434, 438, 442, 444, 448,
- 452, 456, 458, 461, 464, 467, 470, 473, 476, 479,
- 482, 485, 487, 490, 493, 495, 497, 499, 502, 504,
- 506, 511, 515, 519, 522, 525, 530, 534, 537, 541,
- 543, 547, 549, 551, 553, 555, 557, 561, 564, 568,
- 572, 578, 581, 586, 588, 591, 592, 594, 597, 601,
- 605, 611, 613, 615, 617, 618, 620, 622, 624, 626,
+ 67, 70, 71, 73, 77, 80, 84, 86, 90, 92,
+ 96, 99, 102, 103, 105, 108, 109, 111, 114, 116,
+ 119, 127, 133, 141, 147, 148, 149, 161, 162, 163,
+ 176, 184, 193, 197, 201, 205, 211, 215, 221, 225,
+ 231, 232, 234, 236, 239, 244, 248, 252, 256, 260,
+ 265, 271, 274, 275, 277, 279, 281, 283, 287, 288,
+ 290, 292, 296, 298, 300, 302, 306, 310, 312, 316,
+ 320, 322, 328, 330, 336, 338, 342, 344, 348, 350,
+ 354, 356, 360, 362, 366, 368, 372, 374, 378, 380,
+ 384, 386, 390, 392, 396, 398, 402, 404, 408, 410,
+ 414, 418, 422, 424, 428, 432, 434, 438, 440, 444,
+ 448, 450, 454, 458, 462, 464, 467, 470, 473, 476,
+ 479, 482, 485, 488, 491, 493, 496, 499, 501, 503,
+ 505, 508, 510, 512, 517, 521, 525, 528, 531, 536,
+ 540, 543, 547, 549, 553, 555, 557, 559, 561, 563,
+ 567, 570, 574, 578, 584, 587, 592, 594, 597, 598,
+ 600, 603, 607, 611, 617, 619, 621, 623, 624, 626,
628, 630, 632, 634, 636, 638, 640, 642, 644, 646,
- 648, 650
+ 648, 650, 652, 654, 656, 658
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int16 yyrhs[] =
{
- 68, 0, -1, 70, 69, -1, 35, -1, -1, -1,
- 70, 76, -1, 72, 154, 158, 75, 159, 46, 73,
- 37, -1, 36, -1, 70, -1, 38, -1, 74, 47,
- 38, -1, -1, 74, -1, 79, -1, 80, -1, 89,
- -1, 90, -1, 91, -1, 92, -1, 97, -1, 98,
- -1, 99, -1, 100, -1, 101, -1, 102, -1, 108,
- -1, 109, -1, 76, -1, 77, 76, -1, -1, 77,
- -1, 46, 77, 37, -1, 46, 37, -1, 27, 81,
- 157, -1, 83, -1, 81, 47, 83, -1, 84, -1,
- 82, 47, 84, -1, 38, 85, -1, 38, 87, -1,
- -1, 86, -1, 48, 117, -1, -1, 88, -1, 48,
- 118, -1, 49, -1, 114, 157, -1, 11, 158, 113,
- 159, 76, 10, 76, -1, 11, 158, 113, 159, 76,
- -1, 9, 76, 29, 158, 113, 159, 157, -1, 29,
- 158, 113, 159, 76, -1, -1, -1, 13, 158, 115,
- 93, 160, 112, 94, 160, 112, 159, 76, -1, -1,
- -1, 13, 158, 27, 82, 95, 160, 112, 96, 160,
- 112, 159, 76, -1, 13, 158, 140, 14, 113, 159,
- 76, -1, 13, 158, 27, 84, 14, 113, 159, 76,
- -1, 6, 154, 157, -1, 3, 154, 157, -1, 19,
- 112, 157, -1, 30, 158, 114, 159, 76, -1, 38,
- 50, 76, -1, 20, 158, 114, 159, 103, -1, 46,
- 104, 37, -1, 46, 104, 107, 104, 37, -1, -1,
- 105, -1, 106, -1, 105, 106, -1, 4, 114, 50,
- 78, -1, 7, 50, 78, -1, 22, 114, 157, -1,
- 25, 79, 110, -1, 25, 79, 111, -1, 25, 79,
- 110, 111, -1, 5, 158, 38, 159, 79, -1, 12,
- 79, -1, -1, 114, -1, 114, -1, 1, -1, 117,
- -1, 114, 47, 117, -1, -1, 116, -1, 118, -1,
- 116, 47, 118, -1, 119, -1, 140, 48, 117, -1,
- 140, 39, 117, -1, 120, -1, 140, 48, 118, -1,
- 140, 39, 118, -1, 121, -1, 121, 51, 117, 50,
- 117, -1, 122, -1, 122, 51, 118, 50, 118, -1,
- 123, -1, 121, 32, 123, -1, 124, -1, 122, 32,
- 124, -1, 125, -1, 123, 31, 125, -1, 126, -1,
- 124, 31, 126, -1, 127, -1, 125, 52, 127, -1,
- 128, -1, 126, 52, 128, -1, 129, -1, 127, 53,
- 129, -1, 130, -1, 128, 53, 130, -1, 131, -1,
- 129, 54, 131, -1, 132, -1, 130, 54, 132, -1,
- 133, -1, 131, 40, 133, -1, 134, -1, 132, 40,
- 134, -1, 135, -1, 133, 42, 135, -1, 133, 15,
- 135, -1, 133, 14, 135, -1, 135, -1, 134, 42,
- 135, -1, 134, 15, 135, -1, 136, -1, 135, 41,
- 136, -1, 137, -1, 136, 55, 137, -1, 136, 56,
- 137, -1, 138, -1, 137, 57, 138, -1, 137, 58,
- 138, -1, 137, 59, 138, -1, 139, -1, 8, 138,
- -1, 28, 138, -1, 26, 138, -1, 33, 138, -1,
- 34, 138, -1, 55, 138, -1, 56, 138, -1, 60,
- 138, -1, 61, 138, -1, 140, -1, 140, 33, -1,
- 140, 34, -1, 141, -1, 143, -1, 142, -1, 16,
- 141, -1, 146, -1, 71, -1, 142, 62, 114, 63,
- -1, 142, 64, 38, -1, 16, 142, 144, -1, 142,
- 144, -1, 143, 144, -1, 143, 62, 114, 63, -1,
- 143, 64, 38, -1, 65, 66, -1, 65, 145, 66,
- -1, 117, -1, 145, 47, 117, -1, 21, -1, 38,
- -1, 155, -1, 147, -1, 151, -1, 65, 114, 66,
- -1, 62, 63, -1, 62, 149, 63, -1, 62, 148,
- 63, -1, 62, 148, 47, 150, 63, -1, 150, 117,
- -1, 148, 47, 150, 117, -1, 47, -1, 149, 47,
- -1, -1, 149, -1, 46, 37, -1, 46, 152, 37,
- -1, 153, 50, 117, -1, 152, 47, 153, 50, 117,
- -1, 38, -1, 44, -1, 43, -1, -1, 38, -1,
- 17, -1, 18, -1, 156, -1, 43, -1, 44, -1,
- 58, -1, 23, -1, 24, -1, 49, -1, 1, -1,
- 65, -1, 1, -1, 66, -1, 1, -1, 49, -1,
- 1, -1
+ 69, 0, -1, 71, 70, -1, 35, -1, -1, -1,
+ 71, 77, -1, 73, 156, 160, 76, 161, 47, 74,
+ 38, -1, 37, -1, 71, -1, 39, -1, 75, 48,
+ 39, -1, -1, 75, -1, 80, -1, 81, -1, 90,
+ -1, 72, -1, 91, -1, 92, -1, 93, -1, 98,
+ -1, 99, -1, 100, -1, 101, -1, 102, -1, 103,
+ -1, 109, -1, 110, -1, 77, -1, 78, 77, -1,
+ -1, 78, -1, 47, 78, 38, -1, 47, 38, -1,
+ 27, 82, 159, -1, 84, -1, 82, 48, 84, -1,
+ 85, -1, 83, 48, 85, -1, 39, 86, -1, 39,
+ 88, -1, -1, 87, -1, 49, 119, -1, -1, 89,
+ -1, 49, 120, -1, 50, -1, 115, 159, -1, 11,
+ 160, 114, 161, 77, 10, 77, -1, 11, 160, 114,
+ 161, 77, -1, 9, 77, 29, 160, 114, 161, 159,
+ -1, 29, 160, 114, 161, 77, -1, -1, -1, 13,
+ 160, 116, 94, 162, 113, 95, 162, 113, 161, 77,
+ -1, -1, -1, 13, 160, 27, 83, 96, 162, 113,
+ 97, 162, 113, 161, 77, -1, 13, 160, 142, 14,
+ 114, 161, 77, -1, 13, 160, 27, 85, 14, 114,
+ 161, 77, -1, 6, 156, 159, -1, 3, 156, 159,
+ -1, 19, 113, 159, -1, 30, 160, 115, 161, 77,
+ -1, 39, 51, 77, -1, 20, 160, 115, 161, 104,
+ -1, 47, 105, 38, -1, 47, 105, 108, 105, 38,
+ -1, -1, 106, -1, 107, -1, 106, 107, -1, 4,
+ 115, 51, 79, -1, 7, 51, 79, -1, 22, 115,
+ 159, -1, 25, 80, 111, -1, 25, 80, 112, -1,
+ 25, 80, 111, 112, -1, 5, 160, 39, 161, 80,
+ -1, 12, 80, -1, -1, 115, -1, 115, -1, 1,
+ -1, 119, -1, 115, 48, 119, -1, -1, 117, -1,
+ 120, -1, 117, 48, 120, -1, 40, -1, 36, -1,
+ 121, -1, 142, 49, 119, -1, 142, 118, 119, -1,
+ 122, -1, 142, 49, 120, -1, 142, 118, 120, -1,
+ 123, -1, 123, 52, 119, 51, 119, -1, 124, -1,
+ 124, 52, 120, 51, 120, -1, 125, -1, 123, 32,
+ 125, -1, 126, -1, 124, 32, 126, -1, 127, -1,
+ 125, 31, 127, -1, 128, -1, 126, 31, 128, -1,
+ 129, -1, 127, 53, 129, -1, 130, -1, 128, 53,
+ 130, -1, 131, -1, 129, 54, 131, -1, 132, -1,
+ 130, 54, 132, -1, 133, -1, 131, 55, 133, -1,
+ 134, -1, 132, 55, 134, -1, 135, -1, 133, 41,
+ 135, -1, 136, -1, 134, 41, 136, -1, 137, -1,
+ 135, 43, 137, -1, 135, 15, 137, -1, 135, 14,
+ 137, -1, 137, -1, 136, 43, 137, -1, 136, 15,
+ 137, -1, 138, -1, 137, 42, 138, -1, 139, -1,
+ 138, 56, 139, -1, 138, 57, 139, -1, 140, -1,
+ 139, 58, 140, -1, 139, 59, 140, -1, 139, 60,
+ 140, -1, 141, -1, 8, 140, -1, 28, 140, -1,
+ 26, 140, -1, 33, 140, -1, 34, 140, -1, 56,
+ 140, -1, 57, 140, -1, 61, 140, -1, 62, 140,
+ -1, 142, -1, 142, 33, -1, 142, 34, -1, 143,
+ -1, 145, -1, 144, -1, 16, 143, -1, 148, -1,
+ 72, -1, 144, 63, 115, 64, -1, 144, 65, 39,
+ -1, 16, 144, 146, -1, 144, 146, -1, 145, 146,
+ -1, 145, 63, 115, 64, -1, 145, 65, 39, -1,
+ 66, 67, -1, 66, 147, 67, -1, 119, -1, 147,
+ 48, 119, -1, 21, -1, 39, -1, 157, -1, 149,
+ -1, 153, -1, 66, 115, 67, -1, 63, 64, -1,
+ 63, 151, 64, -1, 63, 150, 64, -1, 63, 150,
+ 48, 152, 64, -1, 152, 119, -1, 150, 48, 152,
+ 119, -1, 48, -1, 151, 48, -1, -1, 151, -1,
+ 47, 38, -1, 47, 154, 38, -1, 155, 51, 119,
+ -1, 154, 48, 155, 51, 119, -1, 39, -1, 45,
+ -1, 44, -1, -1, 39, -1, 17, -1, 18, -1,
+ 158, -1, 44, -1, 45, -1, 59, -1, 36, -1,
+ 23, -1, 24, -1, 50, -1, 1, -1, 66, -1,
+ 1, -1, 67, -1, 1, -1, 50, -1, 1, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 256, 256, 260, 261, 265, 266, 271, 275, 279,
- 283, 284, 289, 290, 294, 295, 296, 297, 298, 299,
- 300, 301, 302, 303, 304, 305, 306, 307, 311, 312,
- 317, 318, 322, 323, 327, 332, 333, 338, 340, 345,
- 350, 355, 356, 360, 365, 366, 370, 375, 379, 384,
- 386, 391, 393, 396, 398, 395, 402, 404, 401, 407,
- 409, 414, 419, 424, 429, 434, 439, 444, 446, 451,
- 452, 456, 457, 462, 467, 472, 477, 478, 479, 484,
- 489, 493, 494, 497, 498, 502, 503, 508, 509, 513,
- 515, 520, 521, 523, 528, 530, 532, 537, 538, 543,
- 545, 550, 551, 556, 558, 563, 564, 569, 571, 576,
- 577, 582, 584, 589, 590, 595, 597, 602, 603, 608,
- 610, 615, 616, 621, 622, 627, 628, 630, 632, 637,
- 638, 640, 645, 646, 651, 653, 655, 660, 661, 663,
- 665, 670, 671, 673, 674, 676, 677, 678, 679, 680,
- 681, 685, 687, 689, 695, 696, 700, 701, 705, 706,
- 707, 709, 711, 716, 718, 720, 722, 727, 728, 732,
- 733, 738, 739, 740, 741, 742, 743, 747, 748, 749,
- 750, 755, 757, 762, 763, 767, 768, 772, 773, 778,
- 780, 785, 786, 787, 791, 792, 796, 797, 798, 799,
- 800, 801, 806, 807, 810, 811, 814, 815, 818, 819,
- 822, 823
+ 0, 257, 257, 261, 262, 266, 267, 272, 276, 280,
+ 284, 285, 290, 291, 295, 296, 297, 298, 299, 300,
+ 301, 302, 303, 304, 305, 306, 307, 308, 309, 313,
+ 314, 319, 320, 324, 325, 329, 334, 335, 340, 342,
+ 347, 352, 357, 358, 362, 367, 368, 372, 377, 381,
+ 386, 388, 393, 395, 398, 400, 397, 404, 406, 403,
+ 409, 411, 416, 421, 426, 431, 436, 441, 446, 448,
+ 453, 454, 458, 459, 464, 469, 474, 479, 480, 481,
+ 486, 491, 495, 496, 499, 500, 504, 505, 510, 511,
+ 515, 517, 521, 522, 526, 527, 529, 534, 536, 538,
+ 543, 544, 549, 551, 556, 557, 562, 564, 569, 570,
+ 575, 577, 582, 583, 588, 590, 595, 596, 601, 603,
+ 608, 609, 614, 616, 621, 622, 627, 628, 633, 634,
+ 636, 638, 643, 644, 646, 651, 652, 657, 659, 661,
+ 666, 667, 669, 671, 676, 677, 679, 680, 682, 683,
+ 684, 685, 686, 687, 691, 693, 695, 701, 702, 706,
+ 707, 711, 712, 713, 715, 717, 722, 724, 726, 728,
+ 733, 734, 738, 739, 744, 745, 746, 747, 748, 749,
+ 753, 754, 755, 756, 761, 763, 768, 769, 773, 774,
+ 778, 779, 784, 786, 791, 792, 793, 797, 798, 802,
+ 803, 804, 805, 806, 807, 809, 814, 815, 818, 819,
+ 822, 823, 826, 827, 830, 831
};
#endif
"kINSTANCEOF", "kNEW", "kNULL", "kUNDEFINED", "kRETURN", "kSWITCH",
"kTHIS", "kTHROW", "kTRUE", "kFALSE", "kTRY", "kTYPEOF", "kVAR", "kVOID",
"kWHILE", "kWITH", "tANDAND", "tOROR", "tINC", "tDEC", "tHTMLCOMMENT",
- "kFUNCTION", "'}'", "tIdentifier", "tAssignOper", "tEqOper",
+ "kDIVEQ", "kFUNCTION", "'}'", "tIdentifier", "tAssignOper", "tEqOper",
"tShiftOper", "tRelOper", "tNumericLiteral", "tStringLiteral",
"LOWER_THAN_ELSE", "'{'", "','", "'='", "';'", "':'", "'?'", "'|'",
"'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'", "'~'", "'!'", "'['",
"LabelledStatement", "SwitchStatement", "CaseBlock", "CaseClausules_opt",
"CaseClausules", "CaseClausule", "DefaultClausule", "ThrowStatement",
"TryStatement", "Catch", "Finally", "Expression_opt", "Expression_err",
- "Expression", "ExpressionNoIn_opt", "ExpressionNoIn",
+ "Expression", "ExpressionNoIn_opt", "ExpressionNoIn", "AssignOper",
"AssignmentExpression", "AssignmentExpressionNoIn",
"ConditionalExpression", "ConditionalExpressionNoIn",
"LogicalORExpression", "LogicalORExpressionNoIn", "LogicalANDExpression",
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 125, 292, 293,
- 294, 295, 296, 297, 298, 299, 123, 44, 61, 59,
- 58, 63, 124, 94, 38, 43, 45, 42, 47, 37,
- 126, 33, 91, 93, 46, 40, 41
+ 285, 286, 287, 288, 289, 290, 291, 292, 125, 293,
+ 294, 295, 296, 297, 298, 299, 300, 123, 44, 61,
+ 59, 58, 63, 124, 94, 38, 43, 45, 42, 47,
+ 37, 126, 33, 91, 93, 46, 40, 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 67, 68, 69, 69, 70, 70, 71, 72, 73,
- 74, 74, 75, 75, 76, 76, 76, 76, 76, 76,
- 76, 76, 76, 76, 76, 76, 76, 76, 77, 77,
- 78, 78, 79, 79, 80, 81, 81, 82, 82, 83,
- 84, 85, 85, 86, 87, 87, 88, 89, 90, 91,
- 91, 92, 92, 93, 94, 92, 95, 96, 92, 92,
- 92, 97, 98, 99, 100, 101, 102, 103, 103, 104,
- 104, 105, 105, 106, 107, 108, 109, 109, 109, 110,
- 111, 112, 112, 113, 113, 114, 114, 115, 115, 116,
- 116, 117, 117, 117, 118, 118, 118, 119, 119, 120,
- 120, 121, 121, 122, 122, 123, 123, 124, 124, 125,
- 125, 126, 126, 127, 127, 128, 128, 129, 129, 130,
- 130, 131, 131, 132, 132, 133, 133, 133, 133, 134,
- 134, 134, 135, 135, 136, 136, 136, 137, 137, 137,
- 137, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 139, 139, 139, 140, 140, 141, 141, 142, 142,
- 142, 142, 142, 143, 143, 143, 143, 144, 144, 145,
- 145, 146, 146, 146, 146, 146, 146, 147, 147, 147,
- 147, 148, 148, 149, 149, 150, 150, 151, 151, 152,
- 152, 153, 153, 153, 154, 154, 155, 155, 155, 155,
- 155, 155, 156, 156, 157, 157, 158, 158, 159, 159,
- 160, 160
+ 0, 68, 69, 70, 70, 71, 71, 72, 73, 74,
+ 75, 75, 76, 76, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 78,
+ 78, 79, 79, 80, 80, 81, 82, 82, 83, 83,
+ 84, 85, 86, 86, 87, 88, 88, 89, 90, 91,
+ 92, 92, 93, 93, 94, 95, 93, 96, 97, 93,
+ 93, 93, 98, 99, 100, 101, 102, 103, 104, 104,
+ 105, 105, 106, 106, 107, 108, 109, 110, 110, 110,
+ 111, 112, 113, 113, 114, 114, 115, 115, 116, 116,
+ 117, 117, 118, 118, 119, 119, 119, 120, 120, 120,
+ 121, 121, 122, 122, 123, 123, 124, 124, 125, 125,
+ 126, 126, 127, 127, 128, 128, 129, 129, 130, 130,
+ 131, 131, 132, 132, 133, 133, 134, 134, 135, 135,
+ 135, 135, 136, 136, 136, 137, 137, 138, 138, 138,
+ 139, 139, 139, 139, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 141, 141, 141, 142, 142, 143,
+ 143, 144, 144, 144, 144, 144, 145, 145, 145, 145,
+ 146, 146, 147, 147, 148, 148, 148, 148, 148, 148,
+ 149, 149, 149, 149, 150, 150, 151, 151, 152, 152,
+ 153, 153, 154, 154, 155, 155, 155, 156, 156, 157,
+ 157, 157, 157, 157, 157, 157, 158, 158, 159, 159,
+ 160, 160, 161, 161, 162, 162
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
{
0, 2, 2, 1, 0, 0, 2, 8, 1, 1,
1, 3, 0, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 0, 1, 3, 2, 3, 1, 3, 1, 3, 2,
- 2, 0, 1, 2, 0, 1, 2, 1, 2, 7,
- 5, 7, 5, 0, 0, 11, 0, 0, 12, 7,
- 8, 3, 3, 3, 5, 3, 5, 3, 5, 0,
- 1, 1, 2, 4, 3, 3, 3, 3, 4, 5,
- 2, 0, 1, 1, 1, 1, 3, 0, 1, 1,
- 3, 1, 3, 3, 1, 3, 3, 1, 5, 1,
- 5, 1, 3, 1, 3, 1, 3, 1, 3, 1,
- 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
- 3, 1, 3, 1, 3, 1, 3, 3, 3, 1,
- 3, 3, 1, 3, 1, 3, 3, 1, 3, 3,
- 3, 1, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 1, 2, 2, 1, 1, 1, 2, 1, 1,
- 4, 3, 3, 2, 2, 4, 3, 2, 3, 1,
- 3, 1, 1, 1, 1, 1, 3, 2, 3, 3,
- 5, 2, 4, 1, 2, 0, 1, 2, 3, 3,
- 5, 1, 1, 1, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1
+ 2, 0, 1, 3, 2, 3, 1, 3, 1, 3,
+ 2, 2, 0, 1, 2, 0, 1, 2, 1, 2,
+ 7, 5, 7, 5, 0, 0, 11, 0, 0, 12,
+ 7, 8, 3, 3, 3, 5, 3, 5, 3, 5,
+ 0, 1, 1, 2, 4, 3, 3, 3, 3, 4,
+ 5, 2, 0, 1, 1, 1, 1, 3, 0, 1,
+ 1, 3, 1, 1, 1, 3, 3, 1, 3, 3,
+ 1, 5, 1, 5, 1, 3, 1, 3, 1, 3,
+ 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
+ 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
+ 3, 3, 1, 3, 3, 1, 3, 1, 3, 3,
+ 1, 3, 3, 3, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 1, 2, 2, 1, 1, 1,
+ 2, 1, 1, 4, 3, 3, 2, 2, 4, 3,
+ 2, 3, 1, 3, 1, 1, 1, 1, 1, 3,
+ 2, 3, 3, 5, 2, 4, 1, 2, 0, 1,
+ 2, 3, 3, 5, 1, 1, 1, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 5, 0, 4, 1, 194, 194, 0, 0, 0, 0,
- 0, 196, 197, 81, 0, 171, 0, 202, 203, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 8, 172,
- 199, 200, 0, 47, 0, 0, 201, 0, 0, 185,
- 0, 2, 159, 194, 6, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 0,
- 85, 91, 97, 101, 105, 109, 113, 117, 121, 125,
- 132, 134, 137, 141, 151, 154, 156, 155, 158, 174,
- 175, 173, 198, 195, 0, 0, 172, 0, 142, 151,
- 0, 207, 206, 0, 87, 157, 156, 0, 82, 0,
- 0, 0, 0, 144, 41, 0, 35, 143, 0, 0,
- 145, 146, 0, 33, 172, 199, 200, 28, 0, 0,
- 0, 147, 148, 149, 150, 183, 177, 0, 186, 0,
- 0, 0, 205, 0, 204, 48, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 152, 153, 0, 0, 0, 0, 0, 163,
- 0, 0, 164, 62, 61, 187, 191, 193, 192, 0,
- 84, 0, 83, 0, 53, 88, 89, 94, 99, 103,
- 107, 111, 115, 119, 123, 129, 151, 162, 63, 0,
- 75, 33, 0, 0, 76, 77, 0, 39, 42, 0,
- 34, 0, 0, 65, 32, 29, 188, 0, 0, 185,
- 179, 184, 178, 181, 176, 12, 86, 102, 0, 106,
- 110, 114, 118, 122, 128, 127, 126, 133, 135, 136,
- 138, 139, 140, 93, 92, 0, 161, 167, 169, 0,
- 0, 166, 0, 209, 208, 0, 44, 56, 37, 0,
+ 5, 0, 4, 1, 197, 197, 0, 0, 0, 0,
+ 0, 199, 200, 82, 0, 174, 0, 206, 207, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 205, 8,
+ 175, 202, 203, 0, 48, 0, 0, 204, 0, 0,
+ 188, 0, 2, 17, 197, 6, 14, 15, 16, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 0, 86, 94, 100, 104, 108, 112, 116, 120, 124,
+ 128, 135, 137, 140, 144, 154, 157, 159, 158, 161,
+ 177, 178, 176, 201, 198, 0, 0, 175, 0, 162,
+ 145, 154, 0, 211, 210, 0, 88, 160, 159, 0,
+ 83, 0, 0, 0, 0, 147, 42, 0, 36, 146,
+ 0, 0, 148, 149, 0, 34, 175, 202, 203, 29,
+ 0, 0, 0, 150, 151, 152, 153, 186, 180, 0,
+ 189, 0, 0, 0, 209, 0, 208, 49, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 80, 78, 43, 36, 0,
- 0, 0, 189, 186, 0, 10, 13, 0, 0, 160,
- 0, 168, 165, 0, 50, 0, 40, 45, 0, 0,
- 0, 211, 210, 81, 90, 151, 104, 0, 108, 112,
- 116, 120, 124, 131, 130, 0, 96, 95, 69, 66,
- 0, 52, 64, 0, 180, 182, 0, 0, 98, 170,
- 0, 0, 46, 38, 81, 0, 54, 0, 0, 0,
- 0, 70, 71, 0, 190, 11, 5, 51, 49, 57,
- 0, 0, 100, 59, 0, 0, 67, 69, 72, 79,
- 9, 0, 0, 60, 81, 30, 30, 0, 7, 81,
- 0, 31, 73, 74, 68, 0, 0, 0, 55, 58
+ 0, 0, 0, 0, 155, 156, 93, 92, 0, 0,
+ 0, 0, 0, 166, 0, 0, 167, 63, 62, 190,
+ 194, 196, 195, 0, 85, 0, 84, 0, 54, 89,
+ 90, 97, 102, 106, 110, 114, 118, 122, 126, 132,
+ 154, 165, 64, 0, 76, 34, 0, 0, 77, 78,
+ 0, 40, 43, 0, 35, 0, 0, 66, 33, 30,
+ 191, 0, 0, 188, 182, 187, 181, 184, 179, 12,
+ 87, 105, 0, 109, 113, 117, 121, 125, 131, 130,
+ 129, 136, 138, 139, 141, 142, 143, 95, 96, 0,
+ 164, 170, 172, 0, 0, 169, 0, 213, 212, 0,
+ 45, 57, 38, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 81,
+ 79, 44, 37, 0, 0, 0, 192, 189, 0, 10,
+ 13, 0, 0, 163, 0, 171, 168, 0, 51, 0,
+ 41, 46, 0, 0, 0, 215, 214, 82, 91, 154,
+ 107, 0, 111, 115, 119, 123, 127, 134, 133, 0,
+ 98, 99, 70, 67, 0, 53, 65, 0, 183, 185,
+ 0, 0, 101, 173, 0, 0, 47, 39, 82, 0,
+ 55, 0, 0, 0, 0, 71, 72, 0, 193, 11,
+ 5, 52, 50, 58, 0, 0, 103, 60, 0, 0,
+ 68, 70, 73, 80, 9, 0, 0, 61, 82, 31,
+ 31, 0, 7, 82, 0, 32, 74, 75, 69, 0,
+ 0, 0, 56, 59
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 1, 41, 2, 42, 43, 351, 276, 277, 117,
- 118, 362, 45, 46, 105, 247, 106, 248, 197, 198,
- 286, 287, 47, 48, 49, 50, 249, 341, 289, 352,
- 51, 52, 53, 54, 55, 56, 309, 330, 331, 332,
- 347, 57, 58, 194, 195, 97, 171, 59, 174, 175,
- 60, 176, 61, 177, 62, 178, 63, 179, 64, 180,
- 65, 181, 66, 182, 67, 183, 68, 184, 69, 70,
- 71, 72, 73, 74, 75, 76, 77, 159, 239, 78,
- 79, 127, 128, 129, 80, 119, 120, 84, 81, 82,
- 135, 93, 245, 293
+ -1, 1, 42, 2, 89, 44, 355, 280, 281, 119,
+ 120, 366, 46, 47, 107, 251, 108, 252, 201, 202,
+ 290, 291, 48, 49, 50, 51, 253, 345, 293, 356,
+ 52, 53, 54, 55, 56, 57, 313, 334, 335, 336,
+ 351, 58, 59, 198, 199, 99, 175, 60, 178, 179,
+ 266, 61, 180, 62, 181, 63, 182, 64, 183, 65,
+ 184, 66, 185, 67, 186, 68, 187, 69, 188, 70,
+ 71, 72, 73, 74, 75, 76, 77, 78, 163, 243,
+ 79, 80, 129, 130, 131, 81, 121, 122, 85, 82,
+ 83, 137, 95, 249, 297
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -278
+#define YYPACT_NINF -273
static const yytype_int16 yypact[] =
{
- -278, 20, 433, -278, -3, -3, 877, 673, 12, 12,
- 196, -278, -278, 877, 12, -278, 877, -278, -278, 15,
- 877, 28, 877, 12, 12, 877, 877, -278, -278, 1,
- -278, -278, 493, -278, 877, 877, -278, 877, 877, 59,
- 877, -278, -278, -3, -278, -278, -278, -278, -278, -278,
- -278, -278, -278, -278, -278, -278, -278, -278, -278, 16,
- -278, -278, -13, 83, 72, 32, 85, 102, 88, 114,
- 153, 104, -278, -278, 98, -278, -40, -28, -278, -278,
- -278, -278, -278, -278, 8, 8, -278, 113, -278, 182,
- 135, -278, -278, 345, 775, -278, -40, 8, 119, 877,
- 16, 553, 131, -278, 120, 51, -278, -278, 345, 877,
- -278, -278, 673, 381, 1, 136, 149, -278, 613, 62,
- 156, -278, -278, -278, -278, -278, -278, 60, 70, 877,
- -26, 12, -278, 877, -278, -278, 877, 877, 877, 877,
- 877, 877, 877, 877, 877, 877, 877, 877, 877, 877,
- 877, 877, -278, -278, 877, 877, 877, 173, 724, -278,
- 877, 180, -278, -278, -278, -278, -278, -278, -278, 12,
- -278, 6, 119, 185, -278, 186, -278, -278, -6, 210,
- 192, 193, 191, 207, 14, 114, 87, -278, -278, 7,
- -278, -278, 12, 15, 237, -278, 877, -278, -278, 28,
- -278, 6, 7, -278, -278, -278, -278, 116, 877, 203,
- -278, -278, -278, -278, -278, 213, -278, 83, 202, 72,
- 32, 85, 102, 88, 114, 114, 114, 153, 104, 104,
- -278, -278, -278, -278, -278, 71, -278, -278, -278, -17,
- 82, -278, 345, -278, -278, 673, 205, 208, 242, 13,
- 877, 877, 877, 877, 877, 877, 877, 877, 877, 877,
- 345, 877, 877, 211, 221, -278, -278, -278, -278, 673,
- 673, 212, -278, 216, 826, -278, 217, 6, 877, -278,
- 877, -278, -278, 6, 250, 877, -278, -278, 185, 13,
- 345, -278, -278, 877, -278, 188, 210, 215, 192, 193,
- 191, 207, 14, 114, 114, 6, -278, -278, 265, -278,
- 6, -278, -278, 877, -278, -278, 233, 226, -278, -278,
- 8, 673, -278, -278, 877, 6, -278, 877, 673, 877,
- 9, 265, -278, 15, -278, -278, -278, -278, -278, -278,
- 673, 13, -278, -278, 91, 223, -278, 265, -278, -278,
- 673, 238, 13, -278, 877, 673, 673, 239, -278, 877,
- 6, 673, -278, -278, -278, 6, 673, 673, -278, -278
+ -273, 19, 524, -273, -7, -7, 976, 768, 12, 12,
+ 192, -273, -273, 976, 12, -273, 976, -273, -273, 57,
+ 976, 24, 976, 12, 12, 976, 976, -273, -273, -273,
+ -3, -273, -273, 585, -273, 976, 976, -273, 976, 976,
+ 22, 976, -273, 416, -7, -273, -273, -273, -273, -273,
+ -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,
+ 40, -273, -273, 8, 30, 49, 54, 61, 84, 21,
+ 96, 155, 83, -273, -273, 88, -273, 99, 140, -273,
+ -273, -273, -273, -273, -273, 17, 17, -273, 115, -273,
+ -273, 184, 118, -273, -273, 379, 872, -273, 99, 17,
+ 107, 976, 40, 646, 134, -273, 109, 55, -273, -273,
+ 379, 976, -273, -273, 768, 471, -3, 119, 121, -273,
+ 707, 58, 153, -273, -273, -273, -273, -273, -273, 45,
+ 59, 976, -45, 12, -273, 976, -273, -273, 976, 976,
+ 976, 976, 976, 976, 976, 976, 976, 976, 976, 976,
+ 976, 976, 976, 976, -273, -273, -273, -273, 976, 976,
+ 976, 127, 820, -273, 976, 168, -273, -273, -273, -273,
+ -273, -273, -273, 12, -273, 7, 107, 175, -273, 171,
+ -273, -273, 14, 194, 174, 176, 177, 197, 34, 96,
+ 77, -273, -273, 9, -273, -273, 12, 57, 221, -273,
+ 976, -273, -273, 24, -273, 7, 9, -273, -273, -273,
+ -273, 112, 976, 187, -273, -273, -273, -273, -273, 203,
+ -273, 30, 193, 49, 54, 61, 84, 21, 96, 96,
+ 96, 155, 83, 83, -273, -273, -273, -273, -273, 67,
+ -273, -273, -273, 27, 71, -273, 379, -273, -273, 768,
+ 196, 195, 232, 37, 976, 976, 976, 976, 976, 976,
+ 976, 976, 976, 976, 379, 976, 976, 207, 217, -273,
+ -273, -273, -273, 768, 768, 206, -273, 211, 924, -273,
+ 212, 7, 976, -273, 976, -273, -273, 7, 251, 976,
+ -273, -273, 175, 37, 379, -273, -273, 976, -273, 100,
+ 194, 213, 174, 176, 177, 197, 34, 96, 96, 7,
+ -273, -273, 258, -273, 7, -273, -273, 976, -273, -273,
+ 224, 219, -273, -273, 17, 768, -273, -273, 976, 7,
+ -273, 976, 768, 976, 16, 258, -273, 57, -273, -273,
+ -273, -273, -273, -273, 768, 37, -273, -273, 79, 216,
+ -273, 258, -273, -273, 768, 231, 37, -273, 976, 768,
+ 768, 237, -273, 976, 7, 768, -273, -273, -273, 7,
+ 768, 768, -273, -273
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -278, -278, -278, -62, -278, -278, -278, -278, -278, -2,
- -130, -79, -8, -278, -278, -278, 80, 10, -278, -278,
- -278, -278, -278, -278, -278, -278, -278, -278, -278, -278,
- -278, -278, -278, -278, -278, -278, -278, -67, -278, -49,
- -278, -278, -278, -278, 99, -246, -102, -12, -278, -278,
- -43, -157, -278, -278, -278, -278, 160, 46, 161, 47,
- 162, 48, 163, 49, 164, 50, 165, 52, -61, 167,
- 81, 54, -278, 33, 298, 300, -278, -27, -278, -278,
- -278, -278, 105, 106, -278, -278, 109, 5, -278, -278,
- -82, 18, -158, -277
+ -273, -273, -273, -70, -2, -273, -273, -273, -273, 0,
+ -138, -84, -10, -273, -273, -273, 74, -14, -273, -273,
+ -273, -273, -273, -273, -273, -273, -273, -273, -273, -273,
+ -273, -273, -273, -273, -273, -273, -273, -72, -273, -55,
+ -273, -273, -273, -273, 85, -263, -96, -12, -273, -273,
+ 209, -115, -239, -273, -273, -273, -273, 143, 31, 157,
+ 43, 160, 44, 162, 46, 163, 47, 165, 50, -66,
+ 164, 91, 353, -273, 33, 300, 303, -273, -16, -273,
+ -273, -273, -273, 101, 102, -273, -273, 106, 1, -273,
+ -273, -74, 28, -61, -272
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -194
+#define YYTABLE_NINF -197
static const yytype_int16 yytable[] =
{
- 44, 98, 163, 164, 100, 90, 201, 243, 243, 132,
- 85, 102, 324, 91, 291, 188, 345, 132, 190, 136,
- 3, 133, 156, 200, 157, 158, 251, 94, 130, 258,
- 280, 263, 99, 185, 160, 83, 161, 158, 137, 89,
- 214, 108, 109, 269, 270, 252, 346, 326, 131, 281,
- 162, 112, 132, 89, 133, 89, 259, 134, 89, 89,
- 88, 101, 292, 133, 354, 134, 104, 89, 89, 187,
- 89, 89, 244, 244, 103, 359, 107, 92, 339, 110,
- 111, 172, 224, 225, 226, 140, 213, 189, 121, 122,
- 216, 123, 124, 294, 218, 297, 172, 202, 199, 206,
- 134, 260, 143, 144, 306, 307, 125, 209, 360, 207,
- 203, 233, 234, 365, 138, 238, 205, 211, 133, 317,
- 152, 153, 126, 210, 139, 320, 261, 186, 322, 133,
- 145, 152, 153, 212, 279, 262, 192, 154, 133, 141,
- 283, 355, 142, 193, 235, 282, 155, 328, 240, 215,
- 165, 166, 333, 267, 166, 146, 167, 168, 305, 167,
- 168, 149, 150, 151, 169, 272, 133, 340, 196, 89,
- 342, 89, 89, 89, 89, 89, 89, 89, 89, 89,
- 89, 89, 89, 89, 89, 265, -193, 242, 325, 185,
- 185, 185, 185, 185, 185, 185, 185, 303, 304, -192,
- 185, 185, 366, 230, 231, 232, 208, 367, 147, 148,
- 264, 236, 10, 11, 12, 152, 153, 15, 241, 17,
- 18, 152, 153, 246, 185, 361, 361, 261, 228, 229,
- 172, 315, 28, 250, 86, 318, 262, 319, 337, 30,
- 31, 253, 87, 284, 254, 256, 255, 257, 172, 193,
- 125, 275, 278, 285, 36, 288, 290, 308, 39, 310,
- 321, 40, 313, 211, 316, 327, 185, 311, 312, 329,
- 334, 335, 336, 356, 350, 358, 364, 363, 172, 268,
- 357, 98, 348, 295, 89, 295, 89, 89, 89, 89,
- 89, 89, 89, 266, 295, 295, 217, 296, 323, 219,
- 298, 220, 299, 221, 300, 222, 301, 223, 95, 302,
- 96, 0, 98, 227, 273, 274, 271, 344, 295, 338,
- 0, 0, 0, 0, 0, 349, 343, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 353, 0,
- 0, 0, 98, 0, 0, 0, 170, 98, 44, 0,
- 0, 0, 0, 6, 0, 0, 0, 0, 0, 205,
- 295, 10, 11, 12, 368, 369, 15, 0, 17, 18,
- 0, 20, 0, 22, 0, 0, 0, 0, 25, 26,
- 0, 28, -187, 86, 0, 0, 0, 0, 30, 31,
- 0, 87, 0, 0, 0, -187, -187, 0, 0, 0,
- 34, 35, 0, 36, 0, 37, 38, 39, 0, 0,
- 40, 0, -187, -187, 0, 0, 0, 0, 0, 0,
- -187, -187, -187, -187, 0, 0, 0, 0, -187, -187,
- 0, 0, -187, -187, -187, -187, 4, 0, -187, 5,
- -187, 6, 7, 0, 8, -187, 9, 0, 0, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 0, 0, 25, 26, 27, 28,
- 0, 29, 0, 0, 0, 0, 30, 31, 0, 32,
- 0, 0, 33, 0, 0, 0, 0, 0, 34, 35,
- 0, 36, 0, 37, 38, 39, 4, 0, 40, 5,
- 0, 6, 7, 0, 8, 0, 9, 0, 0, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 0, 0, 25, 26, 0, 28,
- 113, 114, 0, 0, 0, 0, 115, 116, 0, 32,
- 0, 0, 33, 0, 0, 0, 0, 0, 34, 35,
- 0, 36, 0, 37, 38, 39, 4, 0, 40, 5,
- 0, 6, 7, 0, 8, 0, 9, 0, 0, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 0, 0, 25, 26, 0, 28,
- 191, 29, 0, 0, 0, 0, 30, 31, 0, 32,
- 0, 0, 33, 0, 0, 0, 0, 0, 34, 35,
- 0, 36, 0, 37, 38, 39, 4, 0, 40, 5,
- 0, 6, 7, 0, 8, 0, 9, 0, 0, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 0, 0, 25, 26, 0, 28,
- 204, 29, 0, 0, 0, 0, 30, 31, 0, 32,
- 0, 0, 33, 0, 0, 0, 0, 0, 34, 35,
- 0, 36, 0, 37, 38, 39, 4, 0, 40, 5,
- 0, 6, 7, 0, 8, 0, 9, 0, 0, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 0, 0, 25, 26, 0, 28,
- 0, 29, 0, 0, 0, 0, 30, 31, 0, 32,
- 0, 0, 33, 0, 0, 0, 0, 0, 34, 35,
- 0, 36, 6, 37, 38, 39, 0, 0, 40, 0,
+ 43, 100, 45, 135, 102, 43, 86, 92, 247, 104,
+ 247, 167, 168, 93, 205, 298, 217, 301, 134, 3,
+ 220, 328, 218, 349, 222, 192, 310, 311, 194, 132,
+ 189, 43, 84, 204, 330, 145, 146, 96, 295, 91,
+ 138, 134, 101, 237, 238, 133, 255, 242, 114, 262,
+ 326, 110, 111, 91, 350, 91, 134, 135, 91, 91,
+ 139, 140, 166, 106, 147, 343, 256, 136, 91, 91,
+ 127, 91, 91, 358, 248, 284, 248, 263, 94, 228,
+ 229, 230, 191, 176, 363, 271, 128, 296, 135, 193,
+ 136, 264, 346, 213, 285, 364, 210, 276, 176, 206,
+ 369, 43, 141, 203, 103, 136, 211, 215, 142, 214,
+ 154, 155, 43, 156, 207, 135, 143, 157, 43, 135,
+ 209, 154, 155, 216, 156, 144, 265, 135, 157, 190,
+ 359, 283, 267, 154, 155, 286, 156, 158, 148, 196,
+ 157, 151, 152, 153, 273, 274, 197, 173, 239, 265,
+ 287, 170, 244, 169, 170, 135, 171, 172, 200, 171,
+ 172, 219, 160, 319, 161, 162, 240, 322, 309, 323,
+ -196, 91, -195, 91, 91, 91, 91, 91, 91, 91,
+ 91, 91, 91, 91, 91, 91, 91, 269, 189, 189,
+ 189, 189, 189, 189, 189, 189, 307, 308, 329, 189,
+ 189, 246, 338, 164, 212, 165, 162, 245, 10, 11,
+ 12, 149, 150, 15, 250, 17, 18, 154, 155, 254,
+ 321, 365, 365, 189, 268, 257, 324, 258, 28, 29,
+ 259, 87, 260, 197, 176, 127, 31, 32, 261, 88,
+ 232, 233, 279, 292, 282, 289, 294, 43, 332, 288,
+ 341, 37, 176, 337, 312, 40, 314, 317, 41, 215,
+ 320, 325, 333, 339, 331, 189, 340, 360, 344, 362,
+ 354, 43, 43, 315, 316, 368, 367, 272, 327, 361,
+ 352, 221, 176, 270, 159, 100, 300, 299, 91, 299,
+ 91, 91, 91, 91, 91, 91, 91, 223, 299, 299,
+ 302, 224, 303, 370, 225, 304, 226, 305, 371, 227,
+ 97, 306, 231, 98, 277, 278, 100, 275, 0, 0,
+ 0, 348, 299, 43, 0, 342, 0, 353, 0, 0,
+ 43, 0, 347, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 43, 0, 357, 0, 100, 0, 0, 0,
+ 0, 100, 43, 0, 45, 0, 0, 43, 43, 90,
+ 0, 0, 0, 43, 299, 209, 0, 0, 43, 43,
+ 372, 373, 0, 105, 0, 109, 0, 0, 112, 113,
+ 174, 0, 0, 0, 0, 0, 0, 6, 123, 124,
+ 0, 125, 126, 0, 0, 10, 11, 12, 0, 0,
+ 15, 0, 17, 18, 0, 20, 0, 22, 0, 0,
+ 0, 0, 25, 26, 0, 28, 29, -162, 87, 0,
+ 0, 0, 0, 31, 32, 0, 88, 0, 0, 0,
+ -162, -162, 0, 0, 0, 35, 36, 0, 37, 0,
+ 38, 39, 40, 0, 0, 41, 0, -162, -162, 0,
+ 0, 0, 0, 0, 0, 0, -162, -162, -162, -162,
+ 0, 0, 0, 0, -162, -162, 0, 0, -162, -162,
+ -162, -162, -190, 0, -162, 0, -162, 0, 0, 0,
+ 0, -162, 0, 0, 0, -190, -190, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -190, -190, 234, 235, 236, 0, 0, 0,
+ 0, -190, -190, -190, -190, 0, 0, 0, 0, -190,
+ -190, 0, 0, -190, -190, -190, -190, 4, 0, -190,
+ 5, -190, 6, 7, 0, 8, -190, 9, 0, 0,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 0, 0, 25, 26, 27,
+ 28, 29, 0, 30, 0, 0, 0, 0, 31, 32,
+ 0, 33, 0, 0, 34, 0, 0, 0, 0, 0,
+ 35, 36, 0, 37, 0, 38, 39, 40, 4, 0,
+ 41, 5, 0, 6, 7, 0, 8, 0, 9, 0,
+ 0, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 0, 0, 25, 26,
+ 0, 28, 29, 115, 116, 0, 0, 0, 0, 117,
+ 118, 0, 33, 0, 0, 34, 0, 0, 0, 0,
+ 0, 35, 36, 0, 37, 0, 38, 39, 40, 4,
+ 0, 41, 5, 0, 6, 7, 0, 8, 0, 9,
+ 0, 0, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 0, 0, 25,
+ 26, 0, 28, 29, 195, 30, 0, 0, 0, 0,
+ 31, 32, 0, 33, 0, 0, 34, 0, 0, 0,
+ 0, 0, 35, 36, 0, 37, 0, 38, 39, 40,
+ 4, 0, 41, 5, 0, 6, 7, 0, 8, 0,
+ 9, 0, 0, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 0, 0,
+ 25, 26, 0, 28, 29, 208, 30, 0, 0, 0,
+ 0, 31, 32, 0, 33, 0, 0, 34, 0, 0,
+ 0, 0, 0, 35, 36, 0, 37, 0, 38, 39,
+ 40, 4, 0, 41, 5, 0, 6, 7, 0, 8,
+ 0, 9, 0, 0, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 0,
+ 0, 25, 26, 0, 28, 29, 0, 30, 0, 0,
+ 0, 0, 31, 32, 0, 33, 0, 0, 34, 0,
+ 0, 0, 0, 0, 35, 36, 0, 37, 6, 38,
+ 39, 40, 0, 0, 41, 0, 10, 11, 12, 0,
+ 0, 15, 0, 17, 18, 0, 20, 0, 22, 0,
+ 0, 0, 0, 25, 26, 0, 28, 29, 0, 87,
+ 0, 0, 0, 0, 31, 32, 0, 88, 0, 0,
+ 0, 0, 0, 0, 0, 0, 35, 36, 0, 37,
+ 6, 38, 39, 40, 0, 0, 41, 241, 10, 11,
+ 12, 0, 0, 15, 0, 17, 18, 0, 20, 177,
+ 22, 0, 0, 0, 0, 25, 26, 0, 28, 29,
+ 0, 87, 0, 0, 0, 0, 31, 32, 0, 88,
+ 0, 0, 0, 0, 0, 0, 0, 0, 35, 36,
+ 0, 37, 6, 38, 39, 40, 0, 0, 41, 0,
10, 11, 12, 0, 0, 15, 0, 17, 18, 0,
20, 0, 22, 0, 0, 0, 0, 25, 26, 0,
- 28, 0, 86, 0, 0, 0, 0, 30, 31, 0,
- 87, 0, 0, 0, 0, 0, 0, 0, 0, 34,
- 35, 0, 36, 6, 37, 38, 39, 0, 0, 40,
- 237, 10, 11, 12, 0, 0, 15, 0, 17, 18,
- 0, 20, 173, 22, 0, 0, 0, 0, 25, 26,
- 0, 28, 0, 86, 0, 0, 0, 0, 30, 31,
- 0, 87, 0, 0, 0, 0, 0, 0, 0, 0,
- 34, 35, 0, 36, 6, 37, 38, 39, 0, 0,
- 40, 0, 10, 11, 12, 0, 0, 15, 0, 17,
+ 28, 29, 0, 87, 0, 0, 0, 0, 31, 32,
+ 0, 88, 0, 0, 0, 0, 0, 0, 0, 0,
+ 35, 36, 0, 37, 6, 38, 39, 40, 318, 0,
+ 41, 0, 10, 11, 12, 0, 0, 15, 0, 17,
18, 0, 20, 0, 22, 0, 0, 0, 0, 25,
- 26, 0, 28, 0, 86, 0, 0, 0, 0, 30,
- 31, 0, 87, 0, 0, 0, 0, 0, 0, 0,
- 0, 34, 35, 0, 36, 6, 37, 38, 39, 314,
- 0, 40, 0, 10, 11, 12, 0, 0, 15, 0,
- 17, 18, 0, 20, 0, 22, 0, 0, 0, 0,
- 25, 26, 0, 28, 0, 86, 0, 0, 0, 0,
- 30, 31, 0, 87, 0, 0, 0, 0, 0, 0,
- 0, 0, 34, 35, 0, 36, 0, 37, 38, 39,
- 0, 0, 40
+ 26, 0, 28, 29, 0, 87, 0, 0, 0, 0,
+ 31, 32, 0, 88, 0, 0, 0, 0, 0, 0,
+ 0, 0, 35, 36, 0, 37, 0, 38, 39, 40,
+ 0, 0, 41
};
static const yytype_int16 yycheck[] =
{
- 2, 13, 84, 85, 16, 7, 108, 1, 1, 1,
- 5, 19, 289, 1, 1, 97, 7, 1, 100, 32,
- 0, 47, 62, 105, 64, 65, 32, 9, 40, 15,
- 47, 189, 14, 94, 62, 38, 64, 65, 51, 6,
- 66, 23, 24, 201, 202, 51, 37, 293, 43, 66,
- 77, 50, 1, 20, 47, 22, 42, 49, 25, 26,
- 6, 46, 49, 47, 341, 49, 38, 34, 35, 96,
- 37, 38, 66, 66, 20, 352, 22, 65, 324, 25,
- 26, 93, 143, 144, 145, 53, 129, 99, 34, 35,
- 133, 37, 38, 250, 137, 252, 108, 109, 47, 37,
- 49, 14, 14, 15, 261, 262, 47, 47, 354, 47,
- 112, 154, 155, 359, 31, 158, 118, 47, 47, 277,
- 33, 34, 63, 63, 52, 283, 39, 94, 285, 47,
- 42, 33, 34, 63, 63, 48, 5, 39, 47, 54,
- 242, 50, 40, 12, 156, 63, 48, 305, 160, 131,
- 37, 38, 310, 196, 38, 41, 43, 44, 260, 43,
- 44, 57, 58, 59, 29, 208, 47, 325, 48, 136,
- 327, 138, 139, 140, 141, 142, 143, 144, 145, 146,
- 147, 148, 149, 150, 151, 193, 50, 169, 290, 250,
- 251, 252, 253, 254, 255, 256, 257, 258, 259, 50,
- 261, 262, 360, 149, 150, 151, 50, 365, 55, 56,
- 192, 38, 16, 17, 18, 33, 34, 21, 38, 23,
- 24, 33, 34, 38, 285, 355, 356, 39, 147, 148,
- 242, 274, 36, 47, 38, 278, 48, 280, 320, 43,
- 44, 31, 46, 245, 52, 54, 53, 40, 260, 12,
- 47, 38, 50, 48, 58, 47, 14, 46, 62, 38,
- 10, 65, 50, 47, 47, 50, 327, 269, 270, 4,
- 313, 38, 46, 50, 336, 37, 37, 356, 290, 199,
- 347, 293, 331, 250, 251, 252, 253, 254, 255, 256,
- 257, 258, 259, 194, 261, 262, 136, 251, 288, 138,
- 253, 139, 254, 140, 255, 141, 256, 142, 10, 257,
- 10, -1, 324, 146, 209, 209, 207, 329, 285, 321,
- -1, -1, -1, -1, -1, 333, 328, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 340, -1,
- -1, -1, 354, -1, -1, -1, 1, 359, 350, -1,
- -1, -1, -1, 8, -1, -1, -1, -1, -1, 361,
- 327, 16, 17, 18, 366, 367, 21, -1, 23, 24,
- -1, 26, -1, 28, -1, -1, -1, -1, 33, 34,
- -1, 36, 1, 38, -1, -1, -1, -1, 43, 44,
- -1, 46, -1, -1, -1, 14, 15, -1, -1, -1,
- 55, 56, -1, 58, -1, 60, 61, 62, -1, -1,
- 65, -1, 31, 32, -1, -1, -1, -1, -1, -1,
- 39, 40, 41, 42, -1, -1, -1, -1, 47, 48,
- -1, -1, 51, 52, 53, 54, 3, -1, 57, 6,
- 59, 8, 9, -1, 11, 64, 13, -1, -1, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, -1, -1, 33, 34, 35, 36,
- -1, 38, -1, -1, -1, -1, 43, 44, -1, 46,
- -1, -1, 49, -1, -1, -1, -1, -1, 55, 56,
- -1, 58, -1, 60, 61, 62, 3, -1, 65, 6,
- -1, 8, 9, -1, 11, -1, 13, -1, -1, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, -1, -1, 33, 34, -1, 36,
- 37, 38, -1, -1, -1, -1, 43, 44, -1, 46,
- -1, -1, 49, -1, -1, -1, -1, -1, 55, 56,
- -1, 58, -1, 60, 61, 62, 3, -1, 65, 6,
- -1, 8, 9, -1, 11, -1, 13, -1, -1, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, -1, -1, 33, 34, -1, 36,
- 37, 38, -1, -1, -1, -1, 43, 44, -1, 46,
- -1, -1, 49, -1, -1, -1, -1, -1, 55, 56,
- -1, 58, -1, 60, 61, 62, 3, -1, 65, 6,
- -1, 8, 9, -1, 11, -1, 13, -1, -1, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, -1, -1, 33, 34, -1, 36,
- 37, 38, -1, -1, -1, -1, 43, 44, -1, 46,
- -1, -1, 49, -1, -1, -1, -1, -1, 55, 56,
- -1, 58, -1, 60, 61, 62, 3, -1, 65, 6,
- -1, 8, 9, -1, 11, -1, 13, -1, -1, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, -1, -1, 33, 34, -1, 36,
- -1, 38, -1, -1, -1, -1, 43, 44, -1, 46,
- -1, -1, 49, -1, -1, -1, -1, -1, 55, 56,
- -1, 58, 8, 60, 61, 62, -1, -1, 65, -1,
+ 2, 13, 2, 48, 16, 7, 5, 7, 1, 19,
+ 1, 85, 86, 1, 110, 254, 131, 256, 1, 0,
+ 135, 293, 67, 7, 139, 99, 265, 266, 102, 41,
+ 96, 33, 39, 107, 297, 14, 15, 9, 1, 6,
+ 32, 1, 14, 158, 159, 44, 32, 162, 51, 15,
+ 289, 23, 24, 20, 38, 22, 1, 48, 25, 26,
+ 52, 31, 78, 39, 43, 328, 52, 50, 35, 36,
+ 48, 38, 39, 345, 67, 48, 67, 43, 66, 145,
+ 146, 147, 98, 95, 356, 200, 64, 50, 48, 101,
+ 50, 14, 331, 48, 67, 358, 38, 212, 110, 111,
+ 363, 103, 53, 48, 47, 50, 48, 48, 54, 64,
+ 33, 34, 114, 36, 114, 48, 55, 40, 120, 48,
+ 120, 33, 34, 64, 36, 41, 49, 48, 40, 96,
+ 51, 64, 193, 33, 34, 64, 36, 49, 42, 5,
+ 40, 58, 59, 60, 205, 206, 12, 29, 160, 49,
+ 246, 39, 164, 38, 39, 48, 44, 45, 49, 44,
+ 45, 133, 63, 278, 65, 66, 39, 282, 264, 284,
+ 51, 138, 51, 140, 141, 142, 143, 144, 145, 146,
+ 147, 148, 149, 150, 151, 152, 153, 197, 254, 255,
+ 256, 257, 258, 259, 260, 261, 262, 263, 294, 265,
+ 266, 173, 317, 63, 51, 65, 66, 39, 16, 17,
+ 18, 56, 57, 21, 39, 23, 24, 33, 34, 48,
+ 281, 359, 360, 289, 196, 31, 287, 53, 36, 37,
+ 54, 39, 55, 12, 246, 48, 44, 45, 41, 47,
+ 149, 150, 39, 48, 51, 49, 14, 249, 309, 249,
+ 324, 59, 264, 314, 47, 63, 39, 51, 66, 48,
+ 48, 10, 4, 39, 51, 331, 47, 51, 329, 38,
+ 340, 273, 274, 273, 274, 38, 360, 203, 292, 351,
+ 335, 138, 294, 198, 75, 297, 255, 254, 255, 256,
+ 257, 258, 259, 260, 261, 262, 263, 140, 265, 266,
+ 257, 141, 258, 364, 142, 259, 143, 260, 369, 144,
+ 10, 261, 148, 10, 213, 213, 328, 211, -1, -1,
+ -1, 333, 289, 325, -1, 325, -1, 337, -1, -1,
+ 332, -1, 332, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 344, -1, 344, -1, 358, -1, -1, -1,
+ -1, 363, 354, -1, 354, -1, -1, 359, 360, 6,
+ -1, -1, -1, 365, 331, 365, -1, -1, 370, 371,
+ 370, 371, -1, 20, -1, 22, -1, -1, 25, 26,
+ 1, -1, -1, -1, -1, -1, -1, 8, 35, 36,
+ -1, 38, 39, -1, -1, 16, 17, 18, -1, -1,
+ 21, -1, 23, 24, -1, 26, -1, 28, -1, -1,
+ -1, -1, 33, 34, -1, 36, 37, 1, 39, -1,
+ -1, -1, -1, 44, 45, -1, 47, -1, -1, -1,
+ 14, 15, -1, -1, -1, 56, 57, -1, 59, -1,
+ 61, 62, 63, -1, -1, 66, -1, 31, 32, -1,
+ -1, -1, -1, -1, -1, -1, 40, 41, 42, 43,
+ -1, -1, -1, -1, 48, 49, -1, -1, 52, 53,
+ 54, 55, 1, -1, 58, -1, 60, -1, -1, -1,
+ -1, 65, -1, -1, -1, 14, 15, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 31, 32, 151, 152, 153, -1, -1, -1,
+ -1, 40, 41, 42, 43, -1, -1, -1, -1, 48,
+ 49, -1, -1, 52, 53, 54, 55, 3, -1, 58,
+ 6, 60, 8, 9, -1, 11, 65, 13, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, -1, -1, 33, 34, 35,
+ 36, 37, -1, 39, -1, -1, -1, -1, 44, 45,
+ -1, 47, -1, -1, 50, -1, -1, -1, -1, -1,
+ 56, 57, -1, 59, -1, 61, 62, 63, 3, -1,
+ 66, 6, -1, 8, 9, -1, 11, -1, 13, -1,
+ -1, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, -1, -1, 33, 34,
+ -1, 36, 37, 38, 39, -1, -1, -1, -1, 44,
+ 45, -1, 47, -1, -1, 50, -1, -1, -1, -1,
+ -1, 56, 57, -1, 59, -1, 61, 62, 63, 3,
+ -1, 66, 6, -1, 8, 9, -1, 11, -1, 13,
+ -1, -1, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, -1, -1, 33,
+ 34, -1, 36, 37, 38, 39, -1, -1, -1, -1,
+ 44, 45, -1, 47, -1, -1, 50, -1, -1, -1,
+ -1, -1, 56, 57, -1, 59, -1, 61, 62, 63,
+ 3, -1, 66, 6, -1, 8, 9, -1, 11, -1,
+ 13, -1, -1, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, -1, -1,
+ 33, 34, -1, 36, 37, 38, 39, -1, -1, -1,
+ -1, 44, 45, -1, 47, -1, -1, 50, -1, -1,
+ -1, -1, -1, 56, 57, -1, 59, -1, 61, 62,
+ 63, 3, -1, 66, 6, -1, 8, 9, -1, 11,
+ -1, 13, -1, -1, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, -1,
+ -1, 33, 34, -1, 36, 37, -1, 39, -1, -1,
+ -1, -1, 44, 45, -1, 47, -1, -1, 50, -1,
+ -1, -1, -1, -1, 56, 57, -1, 59, 8, 61,
+ 62, 63, -1, -1, 66, -1, 16, 17, 18, -1,
+ -1, 21, -1, 23, 24, -1, 26, -1, 28, -1,
+ -1, -1, -1, 33, 34, -1, 36, 37, -1, 39,
+ -1, -1, -1, -1, 44, 45, -1, 47, -1, -1,
+ -1, -1, -1, -1, -1, -1, 56, 57, -1, 59,
+ 8, 61, 62, 63, -1, -1, 66, 67, 16, 17,
+ 18, -1, -1, 21, -1, 23, 24, -1, 26, 27,
+ 28, -1, -1, -1, -1, 33, 34, -1, 36, 37,
+ -1, 39, -1, -1, -1, -1, 44, 45, -1, 47,
+ -1, -1, -1, -1, -1, -1, -1, -1, 56, 57,
+ -1, 59, 8, 61, 62, 63, -1, -1, 66, -1,
16, 17, 18, -1, -1, 21, -1, 23, 24, -1,
26, -1, 28, -1, -1, -1, -1, 33, 34, -1,
- 36, -1, 38, -1, -1, -1, -1, 43, 44, -1,
- 46, -1, -1, -1, -1, -1, -1, -1, -1, 55,
- 56, -1, 58, 8, 60, 61, 62, -1, -1, 65,
- 66, 16, 17, 18, -1, -1, 21, -1, 23, 24,
- -1, 26, 27, 28, -1, -1, -1, -1, 33, 34,
- -1, 36, -1, 38, -1, -1, -1, -1, 43, 44,
- -1, 46, -1, -1, -1, -1, -1, -1, -1, -1,
- 55, 56, -1, 58, 8, 60, 61, 62, -1, -1,
- 65, -1, 16, 17, 18, -1, -1, 21, -1, 23,
+ 36, 37, -1, 39, -1, -1, -1, -1, 44, 45,
+ -1, 47, -1, -1, -1, -1, -1, -1, -1, -1,
+ 56, 57, -1, 59, 8, 61, 62, 63, 64, -1,
+ 66, -1, 16, 17, 18, -1, -1, 21, -1, 23,
24, -1, 26, -1, 28, -1, -1, -1, -1, 33,
- 34, -1, 36, -1, 38, -1, -1, -1, -1, 43,
- 44, -1, 46, -1, -1, -1, -1, -1, -1, -1,
- -1, 55, 56, -1, 58, 8, 60, 61, 62, 63,
- -1, 65, -1, 16, 17, 18, -1, -1, 21, -1,
- 23, 24, -1, 26, -1, 28, -1, -1, -1, -1,
- 33, 34, -1, 36, -1, 38, -1, -1, -1, -1,
- 43, 44, -1, 46, -1, -1, -1, -1, -1, -1,
- -1, -1, 55, 56, -1, 58, -1, 60, 61, 62,
- -1, -1, 65
+ 34, -1, 36, 37, -1, 39, -1, -1, -1, -1,
+ 44, 45, -1, 47, -1, -1, -1, -1, -1, -1,
+ -1, -1, 56, 57, -1, 59, -1, 61, 62, 63,
+ -1, -1, 66
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 68, 70, 0, 3, 6, 8, 9, 11, 13,
+ 0, 69, 71, 0, 3, 6, 8, 9, 11, 13,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 33, 34, 35, 36, 38,
- 43, 44, 46, 49, 55, 56, 58, 60, 61, 62,
- 65, 69, 71, 72, 76, 79, 80, 89, 90, 91,
- 92, 97, 98, 99, 100, 101, 102, 108, 109, 114,
- 117, 119, 121, 123, 125, 127, 129, 131, 133, 135,
- 136, 137, 138, 139, 140, 141, 142, 143, 146, 147,
- 151, 155, 156, 38, 154, 154, 38, 46, 138, 140,
- 76, 1, 65, 158, 158, 141, 142, 112, 114, 158,
- 114, 46, 79, 138, 38, 81, 83, 138, 158, 158,
- 138, 138, 50, 37, 38, 43, 44, 76, 77, 152,
- 153, 138, 138, 138, 138, 47, 63, 148, 149, 150,
- 114, 154, 1, 47, 49, 157, 32, 51, 31, 52,
- 53, 54, 40, 14, 15, 42, 41, 55, 56, 57,
- 58, 59, 33, 34, 39, 48, 62, 64, 65, 144,
- 62, 64, 144, 157, 157, 37, 38, 43, 44, 29,
- 1, 113, 114, 27, 115, 116, 118, 120, 122, 124,
- 126, 128, 130, 132, 134, 135, 140, 144, 157, 114,
- 157, 37, 5, 12, 110, 111, 48, 85, 86, 47,
- 157, 113, 114, 76, 37, 76, 37, 47, 50, 47,
- 63, 47, 63, 117, 66, 158, 117, 123, 117, 125,
- 127, 129, 131, 133, 135, 135, 135, 136, 137, 137,
- 138, 138, 138, 117, 117, 114, 38, 66, 117, 145,
- 114, 38, 158, 1, 66, 159, 38, 82, 84, 93,
- 47, 32, 51, 31, 52, 53, 54, 40, 15, 42,
- 14, 39, 48, 159, 158, 79, 111, 117, 83, 159,
- 159, 153, 117, 149, 150, 38, 74, 75, 50, 63,
- 47, 66, 63, 113, 76, 48, 87, 88, 47, 95,
- 14, 1, 49, 160, 118, 140, 124, 118, 126, 128,
- 130, 132, 134, 135, 135, 113, 118, 118, 46, 103,
- 38, 76, 76, 50, 63, 117, 47, 159, 117, 117,
- 159, 10, 118, 84, 160, 113, 112, 50, 159, 4,
- 104, 105, 106, 159, 117, 38, 46, 157, 76, 112,
- 159, 94, 118, 76, 114, 7, 37, 107, 106, 79,
- 70, 73, 96, 76, 160, 50, 50, 104, 37, 160,
- 112, 77, 78, 78, 37, 112, 159, 159, 76, 76
+ 26, 27, 28, 29, 30, 33, 34, 35, 36, 37,
+ 39, 44, 45, 47, 50, 56, 57, 59, 61, 62,
+ 63, 66, 70, 72, 73, 77, 80, 81, 90, 91,
+ 92, 93, 98, 99, 100, 101, 102, 103, 109, 110,
+ 115, 119, 121, 123, 125, 127, 129, 131, 133, 135,
+ 137, 138, 139, 140, 141, 142, 143, 144, 145, 148,
+ 149, 153, 157, 158, 39, 156, 156, 39, 47, 72,
+ 140, 142, 77, 1, 66, 160, 160, 143, 144, 113,
+ 115, 160, 115, 47, 80, 140, 39, 82, 84, 140,
+ 160, 160, 140, 140, 51, 38, 39, 44, 45, 77,
+ 78, 154, 155, 140, 140, 140, 140, 48, 64, 150,
+ 151, 152, 115, 156, 1, 48, 50, 159, 32, 52,
+ 31, 53, 54, 55, 41, 14, 15, 43, 42, 56,
+ 57, 58, 59, 60, 33, 34, 36, 40, 49, 118,
+ 63, 65, 66, 146, 63, 65, 146, 159, 159, 38,
+ 39, 44, 45, 29, 1, 114, 115, 27, 116, 117,
+ 120, 122, 124, 126, 128, 130, 132, 134, 136, 137,
+ 142, 146, 159, 115, 159, 38, 5, 12, 111, 112,
+ 49, 86, 87, 48, 159, 114, 115, 77, 38, 77,
+ 38, 48, 51, 48, 64, 48, 64, 119, 67, 160,
+ 119, 125, 119, 127, 129, 131, 133, 135, 137, 137,
+ 137, 138, 139, 139, 140, 140, 140, 119, 119, 115,
+ 39, 67, 119, 147, 115, 39, 160, 1, 67, 161,
+ 39, 83, 85, 94, 48, 32, 52, 31, 53, 54,
+ 55, 41, 15, 43, 14, 49, 118, 161, 160, 80,
+ 112, 119, 84, 161, 161, 155, 119, 151, 152, 39,
+ 75, 76, 51, 64, 48, 67, 64, 114, 77, 49,
+ 88, 89, 48, 96, 14, 1, 50, 162, 120, 142,
+ 126, 120, 128, 130, 132, 134, 136, 137, 137, 114,
+ 120, 120, 47, 104, 39, 77, 77, 51, 64, 119,
+ 48, 161, 119, 119, 161, 10, 120, 85, 162, 114,
+ 113, 51, 161, 4, 105, 106, 107, 161, 119, 39,
+ 47, 159, 77, 113, 161, 95, 120, 77, 115, 7,
+ 38, 108, 107, 80, 71, 74, 97, 77, 162, 51,
+ 51, 105, 38, 162, 113, 78, 79, 79, 38, 113,
+ 161, 161, 77, 77
};
#define yyerrok (yyerrstatus = 0)
case 2:
/* Line 1455 of yacc.c */
-#line 257 "parser.y"
+#line 258 "parser.y"
{ program_parsed(ctx, (yyvsp[(1) - (2)].source_elements)); ;}
break;
case 3:
/* Line 1455 of yacc.c */
-#line 260 "parser.y"
+#line 261 "parser.y"
{;}
break;
case 4:
/* Line 1455 of yacc.c */
-#line 261 "parser.y"
+#line 262 "parser.y"
{;}
break;
case 5:
/* Line 1455 of yacc.c */
-#line 265 "parser.y"
+#line 266 "parser.y"
{ (yyval.source_elements) = new_source_elements(ctx); ;}
break;
case 6:
/* Line 1455 of yacc.c */
-#line 267 "parser.y"
+#line 268 "parser.y"
{ (yyval.source_elements) = source_elements_add_statement((yyvsp[(1) - (2)].source_elements), (yyvsp[(2) - (2)].statement)); ;}
break;
case 7:
/* Line 1455 of yacc.c */
-#line 272 "parser.y"
+#line 273 "parser.y"
{ (yyval.expr) = new_function_expression(ctx, (yyvsp[(2) - (8)].identifier), (yyvsp[(4) - (8)].parameter_list), (yyvsp[(7) - (8)].source_elements), (yyvsp[(1) - (8)].srcptr), (yyvsp[(8) - (8)].srcptr)-(yyvsp[(1) - (8)].srcptr)+1); ;}
break;
case 8:
/* Line 1455 of yacc.c */
-#line 275 "parser.y"
+#line 276 "parser.y"
{ push_func(ctx); (yyval.srcptr) = (yyvsp[(1) - (1)].srcptr); ;}
break;
case 9:
/* Line 1455 of yacc.c */
-#line 279 "parser.y"
+#line 280 "parser.y"
{ (yyval.source_elements) = function_body_parsed(ctx, (yyvsp[(1) - (1)].source_elements)); ;}
break;
case 10:
/* Line 1455 of yacc.c */
-#line 283 "parser.y"
+#line 284 "parser.y"
{ (yyval.parameter_list) = new_parameter_list(ctx, (yyvsp[(1) - (1)].identifier)); ;}
break;
case 11:
/* Line 1455 of yacc.c */
-#line 285 "parser.y"
+#line 286 "parser.y"
{ (yyval.parameter_list) = parameter_list_add(ctx, (yyvsp[(1) - (3)].parameter_list), (yyvsp[(3) - (3)].identifier)); ;}
break;
case 12:
/* Line 1455 of yacc.c */
-#line 289 "parser.y"
+#line 290 "parser.y"
{ (yyval.parameter_list) = NULL; ;}
break;
case 13:
/* Line 1455 of yacc.c */
-#line 290 "parser.y"
+#line 291 "parser.y"
{ (yyval.parameter_list) = (yyvsp[(1) - (1)].parameter_list); ;}
break;
case 14:
/* Line 1455 of yacc.c */
-#line 294 "parser.y"
+#line 295 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 15:
/* Line 1455 of yacc.c */
-#line 295 "parser.y"
+#line 296 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 16:
/* Line 1455 of yacc.c */
-#line 296 "parser.y"
+#line 297 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 17:
/* Line 1455 of yacc.c */
-#line 297 "parser.y"
- { (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
+#line 298 "parser.y"
+ { (yyval.statement) = new_empty_statement(ctx); ;}
break;
case 18:
/* Line 1455 of yacc.c */
-#line 298 "parser.y"
+#line 299 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 19:
/* Line 1455 of yacc.c */
-#line 299 "parser.y"
+#line 300 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 20:
/* Line 1455 of yacc.c */
-#line 300 "parser.y"
+#line 301 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 21:
/* Line 1455 of yacc.c */
-#line 301 "parser.y"
+#line 302 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 22:
/* Line 1455 of yacc.c */
-#line 302 "parser.y"
+#line 303 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 23:
/* Line 1455 of yacc.c */
-#line 303 "parser.y"
+#line 304 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 24:
/* Line 1455 of yacc.c */
-#line 304 "parser.y"
+#line 305 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 25:
/* Line 1455 of yacc.c */
-#line 305 "parser.y"
+#line 306 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 26:
/* Line 1455 of yacc.c */
-#line 306 "parser.y"
+#line 307 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 27:
/* Line 1455 of yacc.c */
-#line 307 "parser.y"
+#line 308 "parser.y"
{ (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 28:
/* Line 1455 of yacc.c */
-#line 311 "parser.y"
- { (yyval.statement_list) = new_statement_list(ctx, (yyvsp[(1) - (1)].statement)); ;}
+#line 309 "parser.y"
+ { (yyval.statement) = (yyvsp[(1) - (1)].statement); ;}
break;
case 29:
/* Line 1455 of yacc.c */
#line 313 "parser.y"
- { (yyval.statement_list) = statement_list_add((yyvsp[(1) - (2)].statement_list), (yyvsp[(2) - (2)].statement)); ;}
+ { (yyval.statement_list) = new_statement_list(ctx, (yyvsp[(1) - (1)].statement)); ;}
break;
case 30:
/* Line 1455 of yacc.c */
-#line 317 "parser.y"
- { (yyval.statement_list) = NULL; ;}
+#line 315 "parser.y"
+ { (yyval.statement_list) = statement_list_add((yyvsp[(1) - (2)].statement_list), (yyvsp[(2) - (2)].statement)); ;}
break;
case 31:
/* Line 1455 of yacc.c */
-#line 318 "parser.y"
- { (yyval.statement_list) = (yyvsp[(1) - (1)].statement_list); ;}
+#line 319 "parser.y"
+ { (yyval.statement_list) = NULL; ;}
break;
case 32:
/* Line 1455 of yacc.c */
-#line 322 "parser.y"
- { (yyval.statement) = new_block_statement(ctx, (yyvsp[(2) - (3)].statement_list)); ;}
+#line 320 "parser.y"
+ { (yyval.statement_list) = (yyvsp[(1) - (1)].statement_list); ;}
break;
case 33:
/* Line 1455 of yacc.c */
-#line 323 "parser.y"
- { (yyval.statement) = new_block_statement(ctx, NULL); ;}
+#line 324 "parser.y"
+ { (yyval.statement) = new_block_statement(ctx, (yyvsp[(2) - (3)].statement_list)); ;}
break;
case 34:
/* Line 1455 of yacc.c */
-#line 328 "parser.y"
- { (yyval.statement) = new_var_statement(ctx, (yyvsp[(2) - (3)].variable_list)); ;}
+#line 325 "parser.y"
+ { (yyval.statement) = new_block_statement(ctx, NULL); ;}
break;
case 35:
/* Line 1455 of yacc.c */
-#line 332 "parser.y"
- { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[(1) - (1)].variable_declaration)); ;}
+#line 330 "parser.y"
+ { (yyval.statement) = new_var_statement(ctx, (yyvsp[(2) - (3)].variable_list)); ;}
break;
case 36:
/* Line 1455 of yacc.c */
#line 334 "parser.y"
- { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[(1) - (3)].variable_list), (yyvsp[(3) - (3)].variable_declaration)); ;}
+ { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[(1) - (1)].variable_declaration)); ;}
break;
case 37:
/* Line 1455 of yacc.c */
-#line 339 "parser.y"
- { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[(1) - (1)].variable_declaration)); ;}
+#line 336 "parser.y"
+ { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[(1) - (3)].variable_list), (yyvsp[(3) - (3)].variable_declaration)); ;}
break;
case 38:
/* Line 1455 of yacc.c */
#line 341 "parser.y"
- { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[(1) - (3)].variable_list), (yyvsp[(3) - (3)].variable_declaration)); ;}
+ { (yyval.variable_list) = new_variable_list(ctx, (yyvsp[(1) - (1)].variable_declaration)); ;}
break;
case 39:
/* Line 1455 of yacc.c */
-#line 346 "parser.y"
- { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[(1) - (2)].identifier), (yyvsp[(2) - (2)].expr)); ;}
+#line 343 "parser.y"
+ { (yyval.variable_list) = variable_list_add(ctx, (yyvsp[(1) - (3)].variable_list), (yyvsp[(3) - (3)].variable_declaration)); ;}
break;
case 40:
/* Line 1455 of yacc.c */
-#line 351 "parser.y"
+#line 348 "parser.y"
{ (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[(1) - (2)].identifier), (yyvsp[(2) - (2)].expr)); ;}
break;
case 41:
/* Line 1455 of yacc.c */
-#line 355 "parser.y"
- { (yyval.expr) = NULL; ;}
+#line 353 "parser.y"
+ { (yyval.variable_declaration) = new_variable_declaration(ctx, (yyvsp[(1) - (2)].identifier), (yyvsp[(2) - (2)].expr)); ;}
break;
case 42:
/* Line 1455 of yacc.c */
-#line 356 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 357 "parser.y"
+ { (yyval.expr) = NULL; ;}
break;
case 43:
/* Line 1455 of yacc.c */
-#line 361 "parser.y"
- { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
+#line 358 "parser.y"
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 44:
/* Line 1455 of yacc.c */
-#line 365 "parser.y"
- { (yyval.expr) = NULL; ;}
+#line 363 "parser.y"
+ { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
break;
case 45:
/* Line 1455 of yacc.c */
-#line 366 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 367 "parser.y"
+ { (yyval.expr) = NULL; ;}
break;
case 46:
/* Line 1455 of yacc.c */
-#line 371 "parser.y"
- { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
+#line 368 "parser.y"
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 47:
/* Line 1455 of yacc.c */
-#line 375 "parser.y"
- { (yyval.statement) = new_empty_statement(ctx); ;}
+#line 373 "parser.y"
+ { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
break;
case 48:
/* Line 1455 of yacc.c */
-#line 380 "parser.y"
- { (yyval.statement) = new_expression_statement(ctx, (yyvsp[(1) - (2)].expr)); ;}
+#line 377 "parser.y"
+ { (yyval.statement) = new_empty_statement(ctx); ;}
break;
case 49:
/* Line 1455 of yacc.c */
-#line 385 "parser.y"
- { (yyval.statement) = new_if_statement(ctx, (yyvsp[(3) - (7)].expr), (yyvsp[(5) - (7)].statement), (yyvsp[(7) - (7)].statement)); ;}
+#line 382 "parser.y"
+ { (yyval.statement) = new_expression_statement(ctx, (yyvsp[(1) - (2)].expr)); ;}
break;
case 50:
/* Line 1455 of yacc.c */
#line 387 "parser.y"
- { (yyval.statement) = new_if_statement(ctx, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].statement), NULL); ;}
+ { (yyval.statement) = new_if_statement(ctx, (yyvsp[(3) - (7)].expr), (yyvsp[(5) - (7)].statement), (yyvsp[(7) - (7)].statement)); ;}
break;
case 51:
/* Line 1455 of yacc.c */
-#line 392 "parser.y"
- { (yyval.statement) = new_while_statement(ctx, TRUE, (yyvsp[(5) - (7)].expr), (yyvsp[(2) - (7)].statement)); ;}
+#line 389 "parser.y"
+ { (yyval.statement) = new_if_statement(ctx, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].statement), NULL); ;}
break;
case 52:
/* Line 1455 of yacc.c */
#line 394 "parser.y"
- { (yyval.statement) = new_while_statement(ctx, FALSE, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].statement)); ;}
+ { (yyval.statement) = new_while_statement(ctx, TRUE, (yyvsp[(5) - (7)].expr), (yyvsp[(2) - (7)].statement)); ;}
break;
case 53:
/* Line 1455 of yacc.c */
#line 396 "parser.y"
- { if(!explicit_error(ctx, (yyvsp[(3) - (3)].expr), ';')) YYABORT; ;}
+ { (yyval.statement) = new_while_statement(ctx, FALSE, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].statement)); ;}
break;
case 54:
/* Line 1455 of yacc.c */
#line 398 "parser.y"
- { if(!explicit_error(ctx, (yyvsp[(6) - (6)].expr), ';')) YYABORT; ;}
+ { if(!explicit_error(ctx, (yyvsp[(3) - (3)].expr), ';')) YYABORT; ;}
break;
case 55:
/* Line 1455 of yacc.c */
#line 400 "parser.y"
- { (yyval.statement) = new_for_statement(ctx, NULL, (yyvsp[(3) - (11)].expr), (yyvsp[(6) - (11)].expr), (yyvsp[(9) - (11)].expr), (yyvsp[(11) - (11)].statement)); ;}
+ { if(!explicit_error(ctx, (yyvsp[(6) - (6)].expr), ';')) YYABORT; ;}
break;
case 56:
/* Line 1455 of yacc.c */
#line 402 "parser.y"
- { if(!explicit_error(ctx, (yyvsp[(4) - (4)].variable_list), ';')) YYABORT; ;}
+ { (yyval.statement) = new_for_statement(ctx, NULL, (yyvsp[(3) - (11)].expr), (yyvsp[(6) - (11)].expr), (yyvsp[(9) - (11)].expr), (yyvsp[(11) - (11)].statement)); ;}
break;
case 57:
/* Line 1455 of yacc.c */
#line 404 "parser.y"
- { if(!explicit_error(ctx, (yyvsp[(7) - (7)].expr), ';')) YYABORT; ;}
+ { if(!explicit_error(ctx, (yyvsp[(4) - (4)].variable_list), ';')) YYABORT; ;}
break;
case 58:
/* Line 1455 of yacc.c */
#line 406 "parser.y"
- { (yyval.statement) = new_for_statement(ctx, (yyvsp[(4) - (12)].variable_list), NULL, (yyvsp[(7) - (12)].expr), (yyvsp[(10) - (12)].expr), (yyvsp[(12) - (12)].statement)); ;}
+ { if(!explicit_error(ctx, (yyvsp[(7) - (7)].expr), ';')) YYABORT; ;}
break;
case 59:
/* Line 1455 of yacc.c */
#line 408 "parser.y"
- { (yyval.statement) = new_forin_statement(ctx, NULL, (yyvsp[(3) - (7)].expr), (yyvsp[(5) - (7)].expr), (yyvsp[(7) - (7)].statement)); ;}
+ { (yyval.statement) = new_for_statement(ctx, (yyvsp[(4) - (12)].variable_list), NULL, (yyvsp[(7) - (12)].expr), (yyvsp[(10) - (12)].expr), (yyvsp[(12) - (12)].statement)); ;}
break;
case 60:
/* Line 1455 of yacc.c */
#line 410 "parser.y"
- { (yyval.statement) = new_forin_statement(ctx, (yyvsp[(4) - (8)].variable_declaration), NULL, (yyvsp[(6) - (8)].expr), (yyvsp[(8) - (8)].statement)); ;}
+ { (yyval.statement) = new_forin_statement(ctx, NULL, (yyvsp[(3) - (7)].expr), (yyvsp[(5) - (7)].expr), (yyvsp[(7) - (7)].statement)); ;}
break;
case 61:
/* Line 1455 of yacc.c */
-#line 415 "parser.y"
- { (yyval.statement) = new_continue_statement(ctx, (yyvsp[(2) - (3)].identifier)); ;}
+#line 412 "parser.y"
+ { (yyval.statement) = new_forin_statement(ctx, (yyvsp[(4) - (8)].variable_declaration), NULL, (yyvsp[(6) - (8)].expr), (yyvsp[(8) - (8)].statement)); ;}
break;
case 62:
/* Line 1455 of yacc.c */
-#line 420 "parser.y"
- { (yyval.statement) = new_break_statement(ctx, (yyvsp[(2) - (3)].identifier)); ;}
+#line 417 "parser.y"
+ { (yyval.statement) = new_continue_statement(ctx, (yyvsp[(2) - (3)].identifier)); ;}
break;
case 63:
/* Line 1455 of yacc.c */
-#line 425 "parser.y"
- { (yyval.statement) = new_return_statement(ctx, (yyvsp[(2) - (3)].expr)); ;}
+#line 422 "parser.y"
+ { (yyval.statement) = new_break_statement(ctx, (yyvsp[(2) - (3)].identifier)); ;}
break;
case 64:
/* Line 1455 of yacc.c */
-#line 430 "parser.y"
- { (yyval.statement) = new_with_statement(ctx, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].statement)); ;}
+#line 427 "parser.y"
+ { (yyval.statement) = new_return_statement(ctx, (yyvsp[(2) - (3)].expr)); ;}
break;
case 65:
/* Line 1455 of yacc.c */
-#line 435 "parser.y"
- { (yyval.statement) = new_labelled_statement(ctx, (yyvsp[(1) - (3)].identifier), (yyvsp[(3) - (3)].statement)); ;}
+#line 432 "parser.y"
+ { (yyval.statement) = new_with_statement(ctx, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].statement)); ;}
break;
case 66:
/* Line 1455 of yacc.c */
-#line 440 "parser.y"
- { (yyval.statement) = new_switch_statement(ctx, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].case_clausule)); ;}
+#line 437 "parser.y"
+ { (yyval.statement) = new_labelled_statement(ctx, (yyvsp[(1) - (3)].identifier), (yyvsp[(3) - (3)].statement)); ;}
break;
case 67:
/* Line 1455 of yacc.c */
-#line 445 "parser.y"
- { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[(2) - (3)].case_list), NULL, NULL); ;}
+#line 442 "parser.y"
+ { (yyval.statement) = new_switch_statement(ctx, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].case_clausule)); ;}
break;
case 68:
/* Line 1455 of yacc.c */
#line 447 "parser.y"
- { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[(2) - (5)].case_list), (yyvsp[(3) - (5)].case_clausule), (yyvsp[(4) - (5)].case_list)); ;}
+ { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[(2) - (3)].case_list), NULL, NULL); ;}
break;
case 69:
/* Line 1455 of yacc.c */
-#line 451 "parser.y"
- { (yyval.case_list) = NULL; ;}
+#line 449 "parser.y"
+ { (yyval.case_clausule) = new_case_block(ctx, (yyvsp[(2) - (5)].case_list), (yyvsp[(3) - (5)].case_clausule), (yyvsp[(4) - (5)].case_list)); ;}
break;
case 70:
/* Line 1455 of yacc.c */
-#line 452 "parser.y"
- { (yyval.case_list) = (yyvsp[(1) - (1)].case_list); ;}
+#line 453 "parser.y"
+ { (yyval.case_list) = NULL; ;}
break;
case 71:
/* Line 1455 of yacc.c */
-#line 456 "parser.y"
- { (yyval.case_list) = new_case_list(ctx, (yyvsp[(1) - (1)].case_clausule)); ;}
+#line 454 "parser.y"
+ { (yyval.case_list) = (yyvsp[(1) - (1)].case_list); ;}
break;
case 72:
/* Line 1455 of yacc.c */
#line 458 "parser.y"
- { (yyval.case_list) = case_list_add(ctx, (yyvsp[(1) - (2)].case_list), (yyvsp[(2) - (2)].case_clausule)); ;}
+ { (yyval.case_list) = new_case_list(ctx, (yyvsp[(1) - (1)].case_clausule)); ;}
break;
case 73:
/* Line 1455 of yacc.c */
-#line 463 "parser.y"
- { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[(2) - (4)].expr), (yyvsp[(4) - (4)].statement_list)); ;}
+#line 460 "parser.y"
+ { (yyval.case_list) = case_list_add(ctx, (yyvsp[(1) - (2)].case_list), (yyvsp[(2) - (2)].case_clausule)); ;}
break;
case 74:
/* Line 1455 of yacc.c */
-#line 468 "parser.y"
- { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[(3) - (3)].statement_list)); ;}
+#line 465 "parser.y"
+ { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[(2) - (4)].expr), (yyvsp[(4) - (4)].statement_list)); ;}
break;
case 75:
/* Line 1455 of yacc.c */
-#line 473 "parser.y"
- { (yyval.statement) = new_throw_statement(ctx, (yyvsp[(2) - (3)].expr)); ;}
+#line 470 "parser.y"
+ { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[(3) - (3)].statement_list)); ;}
break;
case 76:
/* Line 1455 of yacc.c */
-#line 477 "parser.y"
- { (yyval.statement) = new_try_statement(ctx, (yyvsp[(2) - (3)].statement), (yyvsp[(3) - (3)].catch_block), NULL); ;}
+#line 475 "parser.y"
+ { (yyval.statement) = new_throw_statement(ctx, (yyvsp[(2) - (3)].expr)); ;}
break;
case 77:
/* Line 1455 of yacc.c */
-#line 478 "parser.y"
- { (yyval.statement) = new_try_statement(ctx, (yyvsp[(2) - (3)].statement), NULL, (yyvsp[(3) - (3)].statement)); ;}
+#line 479 "parser.y"
+ { (yyval.statement) = new_try_statement(ctx, (yyvsp[(2) - (3)].statement), (yyvsp[(3) - (3)].catch_block), NULL); ;}
break;
case 78:
/* Line 1455 of yacc.c */
#line 480 "parser.y"
- { (yyval.statement) = new_try_statement(ctx, (yyvsp[(2) - (4)].statement), (yyvsp[(3) - (4)].catch_block), (yyvsp[(4) - (4)].statement)); ;}
+ { (yyval.statement) = new_try_statement(ctx, (yyvsp[(2) - (3)].statement), NULL, (yyvsp[(3) - (3)].statement)); ;}
break;
case 79:
/* Line 1455 of yacc.c */
-#line 485 "parser.y"
- { (yyval.catch_block) = new_catch_block(ctx, (yyvsp[(3) - (5)].identifier), (yyvsp[(5) - (5)].statement)); ;}
+#line 482 "parser.y"
+ { (yyval.statement) = new_try_statement(ctx, (yyvsp[(2) - (4)].statement), (yyvsp[(3) - (4)].catch_block), (yyvsp[(4) - (4)].statement)); ;}
break;
case 80:
/* Line 1455 of yacc.c */
-#line 489 "parser.y"
- { (yyval.statement) = (yyvsp[(2) - (2)].statement); ;}
+#line 487 "parser.y"
+ { (yyval.catch_block) = new_catch_block(ctx, (yyvsp[(3) - (5)].identifier), (yyvsp[(5) - (5)].statement)); ;}
break;
case 81:
/* Line 1455 of yacc.c */
-#line 493 "parser.y"
- { (yyval.expr) = NULL; ;}
+#line 491 "parser.y"
+ { (yyval.statement) = (yyvsp[(2) - (2)].statement); ;}
break;
case 82:
/* Line 1455 of yacc.c */
-#line 494 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 495 "parser.y"
+ { (yyval.expr) = NULL; ;}
break;
case 83:
/* Line 1455 of yacc.c */
-#line 497 "parser.y"
+#line 496 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 84:
/* Line 1455 of yacc.c */
-#line 498 "parser.y"
- { set_error(ctx, IDS_SYNTAX_ERROR); YYABORT; ;}
+#line 499 "parser.y"
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 85:
/* Line 1455 of yacc.c */
-#line 502 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 500 "parser.y"
+ { set_error(ctx, IDS_SYNTAX_ERROR); YYABORT; ;}
break;
case 86:
/* Line 1455 of yacc.c */
#line 504 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 87:
/* Line 1455 of yacc.c */
-#line 508 "parser.y"
- { (yyval.expr) = NULL; ;}
+#line 506 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 88:
/* Line 1455 of yacc.c */
-#line 509 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 510 "parser.y"
+ { (yyval.expr) = NULL; ;}
break;
case 89:
/* Line 1455 of yacc.c */
-#line 514 "parser.y"
+#line 511 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
/* Line 1455 of yacc.c */
#line 516 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 91:
/* Line 1455 of yacc.c */
-#line 520 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 518 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_COMMA, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 92:
/* Line 1455 of yacc.c */
-#line 522 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+#line 521 "parser.y"
+ { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;}
break;
case 93:
/* Line 1455 of yacc.c */
-#line 524 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+#line 522 "parser.y"
+ { (yyval.ival) = EXPR_ASSIGNDIV; ;}
break;
case 94:
/* Line 1455 of yacc.c */
-#line 529 "parser.y"
+#line 526 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 95:
/* Line 1455 of yacc.c */
-#line 531 "parser.y"
+#line 528 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 96:
/* Line 1455 of yacc.c */
-#line 533 "parser.y"
+#line 530 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 97:
/* Line 1455 of yacc.c */
-#line 537 "parser.y"
+#line 535 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 98:
/* Line 1455 of yacc.c */
-#line 539 "parser.y"
- { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;}
+#line 537 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_ASSIGN, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 99:
/* Line 1455 of yacc.c */
-#line 544 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 539 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 100:
/* Line 1455 of yacc.c */
-#line 546 "parser.y"
- { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;}
+#line 543 "parser.y"
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 101:
+/* Line 1455 of yacc.c */
+#line 545 "parser.y"
+ { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;}
+ break;
+
+ case 102:
+
/* Line 1455 of yacc.c */
#line 550 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 102:
+ case 103:
/* Line 1455 of yacc.c */
#line 552 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = new_conditional_expression(ctx, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;}
break;
- case 103:
+ case 104:
/* Line 1455 of yacc.c */
-#line 557 "parser.y"
+#line 556 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 104:
+ case 105:
/* Line 1455 of yacc.c */
-#line 559 "parser.y"
+#line 558 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 105:
+ case 106:
/* Line 1455 of yacc.c */
#line 563 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 106:
+ case 107:
/* Line 1455 of yacc.c */
#line 565 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 107:
+ case 108:
/* Line 1455 of yacc.c */
-#line 570 "parser.y"
+#line 569 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 108:
+ case 109:
/* Line 1455 of yacc.c */
-#line 572 "parser.y"
+#line 571 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 109:
+ case 110:
/* Line 1455 of yacc.c */
#line 576 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 110:
+ case 111:
/* Line 1455 of yacc.c */
#line 578 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 111:
+ case 112:
/* Line 1455 of yacc.c */
-#line 583 "parser.y"
+#line 582 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 112:
+ case 113:
/* Line 1455 of yacc.c */
-#line 585 "parser.y"
+#line 584 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 113:
+ case 114:
/* Line 1455 of yacc.c */
#line 589 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 114:
+ case 115:
/* Line 1455 of yacc.c */
#line 591 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_BOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 115:
+ case 116:
/* Line 1455 of yacc.c */
-#line 596 "parser.y"
+#line 595 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 116:
+ case 117:
/* Line 1455 of yacc.c */
-#line 598 "parser.y"
+#line 597 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 117:
+ case 118:
/* Line 1455 of yacc.c */
#line 602 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 118:
+ case 119:
/* Line 1455 of yacc.c */
#line 604 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_BXOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 119:
+ case 120:
/* Line 1455 of yacc.c */
-#line 609 "parser.y"
+#line 608 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 120:
+ case 121:
/* Line 1455 of yacc.c */
-#line 611 "parser.y"
+#line 610 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 121:
+ case 122:
/* Line 1455 of yacc.c */
#line 615 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 122:
+ case 123:
/* Line 1455 of yacc.c */
#line 617 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_BAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 123:
+ case 124:
/* Line 1455 of yacc.c */
#line 621 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 124:
+ case 125:
/* Line 1455 of yacc.c */
#line 623 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 125:
+ case 126:
/* Line 1455 of yacc.c */
#line 627 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
- case 126:
+ case 127:
/* Line 1455 of yacc.c */
#line 629 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
- case 127:
-
-/* Line 1455 of yacc.c */
-#line 631 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
- break;
-
case 128:
/* Line 1455 of yacc.c */
#line 633 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_IN, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 129:
/* Line 1455 of yacc.c */
-#line 637 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 635 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 130:
/* Line 1455 of yacc.c */
-#line 639 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+#line 637 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 131:
/* Line 1455 of yacc.c */
-#line 641 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+#line 639 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_IN, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 132:
/* Line 1455 of yacc.c */
-#line 645 "parser.y"
+#line 643 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 133:
/* Line 1455 of yacc.c */
-#line 647 "parser.y"
+#line 645 "parser.y"
{ (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 134:
/* Line 1455 of yacc.c */
-#line 652 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 647 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_INSTANCEOF, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 135:
/* Line 1455 of yacc.c */
-#line 654 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+#line 651 "parser.y"
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 136:
/* Line 1455 of yacc.c */
-#line 656 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+#line 653 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, (yyvsp[(2) - (3)].ival), (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 137:
/* Line 1455 of yacc.c */
-#line 660 "parser.y"
+#line 658 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 138:
/* Line 1455 of yacc.c */
-#line 662 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+#line 660 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 139:
/* Line 1455 of yacc.c */
-#line 664 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+#line 662 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 140:
/* Line 1455 of yacc.c */
#line 666 "parser.y"
- { (yyval.expr) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 141:
/* Line 1455 of yacc.c */
-#line 670 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 668 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 142:
/* Line 1455 of yacc.c */
-#line 672 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_DELETE, (yyvsp[(2) - (2)].expr)); ;}
+#line 670 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 143:
/* Line 1455 of yacc.c */
-#line 673 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_VOID, (yyvsp[(2) - (2)].expr)); ;}
+#line 672 "parser.y"
+ { (yyval.expr) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
break;
case 144:
/* Line 1455 of yacc.c */
-#line 675 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_TYPEOF, (yyvsp[(2) - (2)].expr)); ;}
+#line 676 "parser.y"
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 145:
/* Line 1455 of yacc.c */
-#line 676 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_PREINC, (yyvsp[(2) - (2)].expr)); ;}
+#line 678 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_DELETE, (yyvsp[(2) - (2)].expr)); ;}
break;
case 146:
/* Line 1455 of yacc.c */
-#line 677 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_PREDEC, (yyvsp[(2) - (2)].expr)); ;}
+#line 679 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_VOID, (yyvsp[(2) - (2)].expr)); ;}
break;
case 147:
/* Line 1455 of yacc.c */
-#line 678 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_PLUS, (yyvsp[(2) - (2)].expr)); ;}
+#line 681 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_TYPEOF, (yyvsp[(2) - (2)].expr)); ;}
break;
case 148:
/* Line 1455 of yacc.c */
-#line 679 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_MINUS, (yyvsp[(2) - (2)].expr)); ;}
+#line 682 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_PREINC, (yyvsp[(2) - (2)].expr)); ;}
break;
case 149:
/* Line 1455 of yacc.c */
-#line 680 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_BITNEG, (yyvsp[(2) - (2)].expr)); ;}
+#line 683 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_PREDEC, (yyvsp[(2) - (2)].expr)); ;}
break;
case 150:
/* Line 1455 of yacc.c */
-#line 681 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_LOGNEG, (yyvsp[(2) - (2)].expr)); ;}
+#line 684 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_PLUS, (yyvsp[(2) - (2)].expr)); ;}
break;
case 151:
/* Line 1455 of yacc.c */
-#line 686 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 685 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_MINUS, (yyvsp[(2) - (2)].expr)); ;}
break;
case 152:
/* Line 1455 of yacc.c */
-#line 688 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTINC, (yyvsp[(1) - (2)].expr)); ;}
+#line 686 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_BITNEG, (yyvsp[(2) - (2)].expr)); ;}
break;
case 153:
/* Line 1455 of yacc.c */
-#line 690 "parser.y"
- { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTDEC, (yyvsp[(1) - (2)].expr)); ;}
+#line 687 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_LOGNEG, (yyvsp[(2) - (2)].expr)); ;}
break;
case 154:
/* Line 1455 of yacc.c */
-#line 695 "parser.y"
+#line 692 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 155:
/* Line 1455 of yacc.c */
-#line 696 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 694 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTINC, (yyvsp[(1) - (2)].expr)); ;}
break;
case 156:
/* Line 1455 of yacc.c */
-#line 700 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 696 "parser.y"
+ { (yyval.expr) = new_unary_expression(ctx, EXPR_POSTDEC, (yyvsp[(1) - (2)].expr)); ;}
break;
case 157:
/* Line 1455 of yacc.c */
#line 701 "parser.y"
- { (yyval.expr) = new_new_expression(ctx, (yyvsp[(2) - (2)].expr), NULL); ;}
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 158:
/* Line 1455 of yacc.c */
-#line 705 "parser.y"
+#line 702 "parser.y"
{ (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 160:
/* Line 1455 of yacc.c */
-#line 708 "parser.y"
- { (yyval.expr) = new_array_expression(ctx, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;}
+#line 707 "parser.y"
+ { (yyval.expr) = new_new_expression(ctx, (yyvsp[(2) - (2)].expr), NULL); ;}
break;
case 161:
/* Line 1455 of yacc.c */
-#line 710 "parser.y"
- { (yyval.expr) = new_member_expression(ctx, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].identifier)); ;}
+#line 711 "parser.y"
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 162:
/* Line 1455 of yacc.c */
#line 712 "parser.y"
- { (yyval.expr) = new_new_expression(ctx, (yyvsp[(2) - (3)].expr), (yyvsp[(3) - (3)].argument_list)); ;}
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 163:
/* Line 1455 of yacc.c */
-#line 717 "parser.y"
- { (yyval.expr) = new_call_expression(ctx, (yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].argument_list)); ;}
+#line 714 "parser.y"
+ { (yyval.expr) = new_array_expression(ctx, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;}
break;
case 164:
/* Line 1455 of yacc.c */
-#line 719 "parser.y"
- { (yyval.expr) = new_call_expression(ctx, (yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].argument_list)); ;}
+#line 716 "parser.y"
+ { (yyval.expr) = new_member_expression(ctx, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].identifier)); ;}
break;
case 165:
/* Line 1455 of yacc.c */
-#line 721 "parser.y"
- { (yyval.expr) = new_array_expression(ctx, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;}
+#line 718 "parser.y"
+ { (yyval.expr) = new_new_expression(ctx, (yyvsp[(2) - (3)].expr), (yyvsp[(3) - (3)].argument_list)); ;}
break;
case 166:
/* Line 1455 of yacc.c */
#line 723 "parser.y"
- { (yyval.expr) = new_member_expression(ctx, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].identifier)); ;}
+ { (yyval.expr) = new_call_expression(ctx, (yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].argument_list)); ;}
break;
case 167:
/* Line 1455 of yacc.c */
-#line 727 "parser.y"
- { (yyval.argument_list) = NULL; ;}
+#line 725 "parser.y"
+ { (yyval.expr) = new_call_expression(ctx, (yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].argument_list)); ;}
break;
case 168:
/* Line 1455 of yacc.c */
-#line 728 "parser.y"
- { (yyval.argument_list) = (yyvsp[(2) - (3)].argument_list); ;}
+#line 727 "parser.y"
+ { (yyval.expr) = new_array_expression(ctx, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;}
break;
case 169:
/* Line 1455 of yacc.c */
-#line 732 "parser.y"
- { (yyval.argument_list) = new_argument_list(ctx, (yyvsp[(1) - (1)].expr)); ;}
+#line 729 "parser.y"
+ { (yyval.expr) = new_member_expression(ctx, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].identifier)); ;}
break;
case 170:
/* Line 1455 of yacc.c */
-#line 734 "parser.y"
- { (yyval.argument_list) = argument_list_add(ctx, (yyvsp[(1) - (3)].argument_list), (yyvsp[(3) - (3)].expr)); ;}
+#line 733 "parser.y"
+ { (yyval.argument_list) = NULL; ;}
break;
case 171:
/* Line 1455 of yacc.c */
-#line 738 "parser.y"
- { (yyval.expr) = new_this_expression(ctx); ;}
+#line 734 "parser.y"
+ { (yyval.argument_list) = (yyvsp[(2) - (3)].argument_list); ;}
break;
case 172:
/* Line 1455 of yacc.c */
-#line 739 "parser.y"
- { (yyval.expr) = new_identifier_expression(ctx, (yyvsp[(1) - (1)].identifier)); ;}
+#line 738 "parser.y"
+ { (yyval.argument_list) = new_argument_list(ctx, (yyvsp[(1) - (1)].expr)); ;}
break;
case 173:
/* Line 1455 of yacc.c */
#line 740 "parser.y"
- { (yyval.expr) = new_literal_expression(ctx, (yyvsp[(1) - (1)].literal)); ;}
+ { (yyval.argument_list) = argument_list_add(ctx, (yyvsp[(1) - (3)].argument_list), (yyvsp[(3) - (3)].expr)); ;}
break;
case 174:
/* Line 1455 of yacc.c */
-#line 741 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 744 "parser.y"
+ { (yyval.expr) = new_this_expression(ctx); ;}
break;
case 175:
/* Line 1455 of yacc.c */
-#line 742 "parser.y"
- { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
+#line 745 "parser.y"
+ { (yyval.expr) = new_identifier_expression(ctx, (yyvsp[(1) - (1)].identifier)); ;}
break;
case 176:
/* Line 1455 of yacc.c */
-#line 743 "parser.y"
- { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
+#line 746 "parser.y"
+ { (yyval.expr) = new_literal_expression(ctx, (yyvsp[(1) - (1)].literal)); ;}
break;
case 177:
/* Line 1455 of yacc.c */
#line 747 "parser.y"
- { (yyval.expr) = new_array_literal_expression(ctx, NULL, 0); ;}
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 178:
/* Line 1455 of yacc.c */
#line 748 "parser.y"
- { (yyval.expr) = new_array_literal_expression(ctx, NULL, (yyvsp[(2) - (3)].ival)+1); ;}
+ { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;}
break;
case 179:
/* Line 1455 of yacc.c */
#line 749 "parser.y"
- { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[(2) - (3)].element_list), 0); ;}
+ { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
break;
case 180:
/* Line 1455 of yacc.c */
-#line 751 "parser.y"
- { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[(2) - (5)].element_list), (yyvsp[(4) - (5)].ival)+1); ;}
+#line 753 "parser.y"
+ { (yyval.expr) = new_array_literal_expression(ctx, NULL, 0); ;}
break;
case 181:
/* Line 1455 of yacc.c */
-#line 756 "parser.y"
- { (yyval.element_list) = new_element_list(ctx, (yyvsp[(1) - (2)].ival), (yyvsp[(2) - (2)].expr)); ;}
+#line 754 "parser.y"
+ { (yyval.expr) = new_array_literal_expression(ctx, NULL, (yyvsp[(2) - (3)].ival)+1); ;}
break;
case 182:
/* Line 1455 of yacc.c */
-#line 758 "parser.y"
- { (yyval.element_list) = element_list_add(ctx, (yyvsp[(1) - (4)].element_list), (yyvsp[(3) - (4)].ival), (yyvsp[(4) - (4)].expr)); ;}
+#line 755 "parser.y"
+ { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[(2) - (3)].element_list), 0); ;}
break;
case 183:
/* Line 1455 of yacc.c */
-#line 762 "parser.y"
- { (yyval.ival) = 1; ;}
+#line 757 "parser.y"
+ { (yyval.expr) = new_array_literal_expression(ctx, (yyvsp[(2) - (5)].element_list), (yyvsp[(4) - (5)].ival)+1); ;}
break;
case 184:
/* Line 1455 of yacc.c */
-#line 763 "parser.y"
- { (yyval.ival) = (yyvsp[(1) - (2)].ival) + 1; ;}
+#line 762 "parser.y"
+ { (yyval.element_list) = new_element_list(ctx, (yyvsp[(1) - (2)].ival), (yyvsp[(2) - (2)].expr)); ;}
break;
case 185:
/* Line 1455 of yacc.c */
-#line 767 "parser.y"
- { (yyval.ival) = 0; ;}
+#line 764 "parser.y"
+ { (yyval.element_list) = element_list_add(ctx, (yyvsp[(1) - (4)].element_list), (yyvsp[(3) - (4)].ival), (yyvsp[(4) - (4)].expr)); ;}
break;
case 186:
/* Line 1455 of yacc.c */
#line 768 "parser.y"
- { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;}
+ { (yyval.ival) = 1; ;}
break;
case 187:
/* Line 1455 of yacc.c */
-#line 772 "parser.y"
- { (yyval.expr) = new_prop_and_value_expression(ctx, NULL); ;}
+#line 769 "parser.y"
+ { (yyval.ival) = (yyvsp[(1) - (2)].ival) + 1; ;}
break;
case 188:
/* Line 1455 of yacc.c */
-#line 774 "parser.y"
- { (yyval.expr) = new_prop_and_value_expression(ctx, (yyvsp[(2) - (3)].property_list)); ;}
+#line 773 "parser.y"
+ { (yyval.ival) = 0; ;}
break;
case 189:
/* Line 1455 of yacc.c */
-#line 779 "parser.y"
- { (yyval.property_list) = new_property_list(ctx, (yyvsp[(1) - (3)].literal), (yyvsp[(3) - (3)].expr)); ;}
+#line 774 "parser.y"
+ { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;}
break;
case 190:
/* Line 1455 of yacc.c */
-#line 781 "parser.y"
- { (yyval.property_list) = property_list_add(ctx, (yyvsp[(1) - (5)].property_list), (yyvsp[(3) - (5)].literal), (yyvsp[(5) - (5)].expr)); ;}
+#line 778 "parser.y"
+ { (yyval.expr) = new_prop_and_value_expression(ctx, NULL); ;}
break;
case 191:
/* Line 1455 of yacc.c */
-#line 785 "parser.y"
- { (yyval.literal) = new_string_literal(ctx, (yyvsp[(1) - (1)].identifier)); ;}
+#line 780 "parser.y"
+ { (yyval.expr) = new_prop_and_value_expression(ctx, (yyvsp[(2) - (3)].property_list)); ;}
break;
case 192:
/* Line 1455 of yacc.c */
-#line 786 "parser.y"
- { (yyval.literal) = new_string_literal(ctx, (yyvsp[(1) - (1)].wstr)); ;}
+#line 785 "parser.y"
+ { (yyval.property_list) = new_property_list(ctx, (yyvsp[(1) - (3)].literal), (yyvsp[(3) - (3)].expr)); ;}
break;
case 193:
/* Line 1455 of yacc.c */
#line 787 "parser.y"
- { (yyval.literal) = (yyvsp[(1) - (1)].literal); ;}
+ { (yyval.property_list) = property_list_add(ctx, (yyvsp[(1) - (5)].property_list), (yyvsp[(3) - (5)].literal), (yyvsp[(5) - (5)].expr)); ;}
break;
case 194:
/* Line 1455 of yacc.c */
#line 791 "parser.y"
- { (yyval.identifier) = NULL; ;}
+ { (yyval.literal) = new_string_literal(ctx, (yyvsp[(1) - (1)].identifier)); ;}
break;
case 195:
/* Line 1455 of yacc.c */
#line 792 "parser.y"
- { (yyval.identifier) = (yyvsp[(1) - (1)].identifier); ;}
+ { (yyval.literal) = new_string_literal(ctx, (yyvsp[(1) - (1)].wstr)); ;}
break;
case 196:
/* Line 1455 of yacc.c */
-#line 796 "parser.y"
- { (yyval.literal) = new_null_literal(ctx); ;}
+#line 793 "parser.y"
+ { (yyval.literal) = (yyvsp[(1) - (1)].literal); ;}
break;
case 197:
/* Line 1455 of yacc.c */
#line 797 "parser.y"
- { (yyval.literal) = new_undefined_literal(ctx); ;}
+ { (yyval.identifier) = NULL; ;}
break;
case 198:
/* Line 1455 of yacc.c */
#line 798 "parser.y"
- { (yyval.literal) = (yyvsp[(1) - (1)].literal); ;}
+ { (yyval.identifier) = (yyvsp[(1) - (1)].identifier); ;}
break;
case 199:
/* Line 1455 of yacc.c */
-#line 799 "parser.y"
- { (yyval.literal) = (yyvsp[(1) - (1)].literal); ;}
+#line 802 "parser.y"
+ { (yyval.literal) = new_null_literal(ctx); ;}
break;
case 200:
/* Line 1455 of yacc.c */
-#line 800 "parser.y"
- { (yyval.literal) = new_string_literal(ctx, (yyvsp[(1) - (1)].wstr)); ;}
+#line 803 "parser.y"
+ { (yyval.literal) = new_undefined_literal(ctx); ;}
break;
case 201:
/* Line 1455 of yacc.c */
-#line 801 "parser.y"
- { (yyval.literal) = parse_regexp(ctx);
- if(!(yyval.literal)) YYABORT; ;}
+#line 804 "parser.y"
+ { (yyval.literal) = (yyvsp[(1) - (1)].literal); ;}
break;
case 202:
/* Line 1455 of yacc.c */
-#line 806 "parser.y"
- { (yyval.literal) = new_boolean_literal(ctx, TRUE); ;}
+#line 805 "parser.y"
+ { (yyval.literal) = (yyvsp[(1) - (1)].literal); ;}
break;
case 203:
+/* Line 1455 of yacc.c */
+#line 806 "parser.y"
+ { (yyval.literal) = new_string_literal(ctx, (yyvsp[(1) - (1)].wstr)); ;}
+ break;
+
+ case 204:
+
/* Line 1455 of yacc.c */
#line 807 "parser.y"
- { (yyval.literal) = new_boolean_literal(ctx, FALSE); ;}
+ { (yyval.literal) = parse_regexp(ctx);
+ if(!(yyval.literal)) YYABORT; ;}
break;
case 205:
/* Line 1455 of yacc.c */
-#line 811 "parser.y"
- { if(!allow_auto_semicolon(ctx)) {YYABORT;} ;}
+#line 809 "parser.y"
+ { (yyval.literal) = parse_regexp(ctx);
+ if(!(yyval.literal)) YYABORT; ;}
+ break;
+
+ case 206:
+
+/* Line 1455 of yacc.c */
+#line 814 "parser.y"
+ { (yyval.literal) = new_boolean_literal(ctx, VARIANT_TRUE); ;}
break;
case 207:
/* Line 1455 of yacc.c */
#line 815 "parser.y"
- { set_error(ctx, IDS_LBRACKET); YYABORT; ;}
+ { (yyval.literal) = new_boolean_literal(ctx, VARIANT_FALSE); ;}
break;
case 209:
/* Line 1455 of yacc.c */
#line 819 "parser.y"
- { set_error(ctx, IDS_RBRACKET); YYABORT; ;}
+ { if(!allow_auto_semicolon(ctx)) {YYABORT;} ;}
break;
case 211:
/* Line 1455 of yacc.c */
#line 823 "parser.y"
+ { set_error(ctx, IDS_LBRACKET); YYABORT; ;}
+ break;
+
+ case 213:
+
+/* Line 1455 of yacc.c */
+#line 827 "parser.y"
+ { set_error(ctx, IDS_RBRACKET); YYABORT; ;}
+ break;
+
+ case 215:
+
+/* Line 1455 of yacc.c */
+#line 831 "parser.y"
{ set_error(ctx, IDS_SEMICOLON); YYABORT; ;}
break;
/* Line 1455 of yacc.c */
-#line 3455 "parser.tab.c"
+#line 3509 "parser.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
/* Line 1675 of yacc.c */
-#line 825 "parser.y"
+#line 833 "parser.y"
static BOOL allow_auto_semicolon(parser_ctx_t *ctx)
tINC = 288,
tDEC = 289,
tHTMLCOMMENT = 290,
- kFUNCTION = 291,
- tIdentifier = 292,
- tAssignOper = 293,
- tEqOper = 294,
- tShiftOper = 295,
- tRelOper = 296,
- tNumericLiteral = 297,
- tStringLiteral = 298,
- LOWER_THAN_ELSE = 299
+ kDIVEQ = 291,
+ kFUNCTION = 292,
+ tIdentifier = 293,
+ tAssignOper = 294,
+ tEqOper = 295,
+ tShiftOper = 296,
+ tRelOper = 297,
+ tNumericLiteral = 298,
+ tStringLiteral = 299,
+ LOWER_THAN_ELSE = 300
};
#endif
/* Line 1676 of yacc.c */
-#line 119 "parser.tab.h"
+#line 120 "parser.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
/* keywords */
%token kBREAK kCASE kCATCH kCONTINUE kDEFAULT kDELETE kDO kELSE kIF kFINALLY kFOR kIN
%token kINSTANCEOF kNEW kNULL kUNDEFINED kRETURN kSWITCH kTHIS kTHROW kTRUE kFALSE kTRY kTYPEOF kVAR kVOID kWHILE kWITH
-%token tANDAND tOROR tINC tDEC tHTMLCOMMENT
+%token tANDAND tOROR tINC tDEC tHTMLCOMMENT kDIVEQ
%token <srcptr> kFUNCTION '}'
%type <literal> PropertyName
%type <literal> BooleanLiteral
%type <srcptr> KFunction
+%type <ival> AssignOper
%nonassoc LOWER_THAN_ELSE
%nonassoc kELSE
: Block { $$ = $1; }
| VariableStatement { $$ = $1; }
| EmptyStatement { $$ = $1; }
+ | FunctionExpression { $$ = new_empty_statement(ctx); } /* FIXME: return NULL */
| ExpressionStatement { $$ = $1; }
| IfStatement { $$ = $1; }
| IterationStatement { $$ = $1; }
| ExpressionNoIn ',' AssignmentExpressionNoIn
{ $$ = new_binary_expression(ctx, EXPR_COMMA, $1, $3); }
+AssignOper
+ : tAssignOper { $$ = $1; }
+ | kDIVEQ { $$ = EXPR_ASSIGNDIV; }
+
/* ECMA-262 3rd Edition 11.13 */
AssignmentExpression
: ConditionalExpression { $$ = $1; }
| LeftHandSideExpression '=' AssignmentExpression
{ $$ = new_binary_expression(ctx, EXPR_ASSIGN, $1, $3); }
- | LeftHandSideExpression tAssignOper AssignmentExpression
+ | LeftHandSideExpression AssignOper AssignmentExpression
{ $$ = new_binary_expression(ctx, $2, $1, $3); }
/* ECMA-262 3rd Edition 11.13 */
{ $$ = $1; }
| LeftHandSideExpression '=' AssignmentExpressionNoIn
{ $$ = new_binary_expression(ctx, EXPR_ASSIGN, $1, $3); }
- | LeftHandSideExpression tAssignOper AssignmentExpressionNoIn
+ | LeftHandSideExpression AssignOper AssignmentExpressionNoIn
{ $$ = new_binary_expression(ctx, $2, $1, $3); }
/* ECMA-262 3rd Edition 11.12 */
| tStringLiteral { $$ = new_string_literal(ctx, $1); }
| '/' { $$ = parse_regexp(ctx);
if(!$$) YYABORT; }
+ | kDIVEQ { $$ = parse_regexp(ctx);
+ if(!$$) YYABORT; }
/* ECMA-262 3rd Edition 7.8.2 */
BooleanLiteral
- : kTRUE { $$ = new_boolean_literal(ctx, TRUE); }
- | kFALSE { $$ = new_boolean_literal(ctx, FALSE); }
+ : kTRUE { $$ = new_boolean_literal(ctx, VARIANT_TRUE); }
+ | kFALSE { $$ = new_boolean_literal(ctx, VARIANT_FALSE); }
semicolon_opt
: ';'
JSRegExp *jsregexp;
BSTR str;
+ DWORD last_index;
} RegExpInstance;
static const WCHAR sourceW[] = {'s','o','u','r','c','e',0};
return re;
}
-static HRESULT do_regexp_match_next(RegExpInstance *regexp, const WCHAR *str, DWORD len,
+static inline RegExpInstance *regexp_from_vdisp(vdisp_t *vdisp)
+{
+ return (RegExpInstance*)vdisp->u.jsdisp;
+}
+
+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)
{
REMatchState *x, *result;
gData.cpend = str + len;
gData.start = *cp-str;
gData.skipped = 0;
- gData.pool = ®exp->dispex.ctx->tmp_heap;
+ gData.pool = &ctx->tmp_heap;
x = InitMatch(NULL, &gData, regexp->jsregexp, gData.cpend - gData.cpbegin);
if(!x) {
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)
{
RegExpInstance *regexp = (RegExpInstance*)dispex;
if(gcheck && !(regexp->jsregexp->flags & JSREG_GLOB))
return S_FALSE;
- mark = jsheap_mark(®exp->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);
return hres;
}
-HRESULT regexp_match(DispatchEx *dispex, const WCHAR *str, DWORD len, BOOL gflag, match_result_t **match_result,
- DWORD *result_cnt)
+HRESULT regexp_match(script_ctx_t *ctx, DispatchEx *dispex, const WCHAR *str, DWORD len, BOOL gflag,
+ match_result_t **match_result, DWORD *result_cnt)
{
RegExpInstance *This = (RegExpInstance*)dispex;
match_result_t *ret = NULL, cres;
jsheap_t *mark;
HRESULT hres;
- mark = jsheap_mark(&This->dispex.ctx->tmp_heap);
+ mark = jsheap_mark(&ctx->tmp_heap);
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) {
hres = S_OK;
break;
return S_OK;
}
-static HRESULT RegExp_source(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT RegExp_source(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
switch(flags) {
case DISPATCH_PROPERTYGET: {
- RegExpInstance *This = (RegExpInstance*)dispex;
+ RegExpInstance *This = regexp_from_vdisp(jsthis);
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = SysAllocString(This->str);
return S_OK;
}
-static HRESULT RegExp_global(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT RegExp_global(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT RegExp_ignoreCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT RegExp_ignoreCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT RegExp_multiline(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT RegExp_multiline(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT RegExp_lastIndex(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- FIXME("\n");
- return E_NOTIMPL;
+ TRACE("\n");
+
+ switch(flags) {
+ case DISPATCH_PROPERTYGET: {
+ RegExpInstance *regexp = regexp_from_vdisp(jsthis);
+ V_VT(retv) = VT_I4;
+ V_I4(retv) = regexp->last_index;
+ break;
+ }
+ default:
+ FIXME("unimplemented flags: %x\n", flags);
+ return E_NOTIMPL;
+ }
+
+ return S_OK;
}
-static HRESULT RegExp_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT RegExp_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT RegExp_exec(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT create_match_array(script_ctx_t *ctx, BSTR input, const match_result_t *result,
+ const match_result_t *parens, DWORD parens_cnt, jsexcept_t *ei, IDispatch **ret)
+{
+ DispatchEx *array;
+ VARIANT var;
+ int i;
+ HRESULT hres = S_OK;
+
+ static const WCHAR indexW[] = {'i','n','d','e','x',0};
+ static const WCHAR inputW[] = {'i','n','p','u','t',0};
+ static const WCHAR zeroW[] = {'0',0};
+
+ hres = create_array(ctx, parens_cnt+1, &array);
+ if(FAILED(hres))
+ return hres;
+
+ for(i=0; i < parens_cnt; i++) {
+ V_VT(&var) = VT_BSTR;
+ V_BSTR(&var) = SysAllocStringLen(parens[i].str, parens[i].len);
+ if(!V_BSTR(&var)) {
+ hres = E_OUTOFMEMORY;
+ break;
+ }
+
+ hres = jsdisp_propput_idx(array, i+1, &var, ei, NULL/*FIXME*/);
+ SysFreeString(V_BSTR(&var));
+ if(FAILED(hres))
+ break;
+ }
+
+ while(SUCCEEDED(hres)) {
+ V_VT(&var) = VT_I4;
+ V_I4(&var) = result->str-input;
+ hres = jsdisp_propput_name(array, indexW, &var, ei, NULL/*FIXME*/);
+ if(FAILED(hres))
+ break;
+
+ V_VT(&var) = VT_BSTR;
+ V_BSTR(&var) = input;
+ hres = jsdisp_propput_name(array, inputW, &var, ei, NULL/*FIXME*/);
+ if(FAILED(hres))
+ break;
+
+ V_BSTR(&var) = SysAllocStringLen(result->str, result->len);
+ if(!V_BSTR(&var)) {
+ hres = E_OUTOFMEMORY;
+ break;
+ }
+ hres = jsdisp_propput_name(array, zeroW, &var, ei, NULL/*FIXME*/);
+ SysFreeString(V_BSTR(&var));
+ break;
+ }
+
+ if(FAILED(hres)) {
+ jsdisp_release(array);
+ return hres;
+ }
+
+ *ret = (IDispatch*)_IDispatchEx_(array);
+ return S_OK;
+}
+
+static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, VARIANT *arg, jsexcept_t *ei, BSTR *input,
+ match_result_t *match, match_result_t **parens, DWORD *parens_cnt, VARIANT_BOOL *ret)
+{
+ RegExpInstance *regexp;
+ DWORD parens_size = 0, last_index = 0, length;
+ const WCHAR *cp;
+ BSTR string;
+ HRESULT hres;
+
+ if(!is_vclass(jsthis, JSCLASS_REGEXP)) {
+ FIXME("Not a RegExp\n");
+ return E_NOTIMPL;
+ }
+
+ regexp = regexp_from_vdisp(jsthis);
+
+ if(arg) {
+ hres = to_string(ctx, arg, ei, &string);
+ if(FAILED(hres))
+ return hres;
+ }else {
+ string = SysAllocStringLen(NULL, 0);
+ if(!string)
+ return E_OUTOFMEMORY;
+ }
+
+ length = SysStringLen(string);
+ if(regexp->jsregexp->flags & JSREG_GLOB)
+ last_index = regexp->last_index;
+
+ cp = string + last_index;
+ hres = regexp_match_next(ctx, ®exp->dispex, FALSE, string, length, &cp, parens, parens ? &parens_size : NULL,
+ parens_cnt, match);
+ if(FAILED(hres)) {
+ SysFreeString(string);
+ return hres;
+ }
+
+ if(hres == S_OK) {
+ regexp->last_index = cp-string;
+ *ret = VARIANT_TRUE;
+ }else {
+ regexp->last_index = 0;
+ *ret = VARIANT_FALSE;
+ }
+
+ if(input)
+ *input = string;
+ return S_OK;
+}
+
+static HRESULT RegExp_exec(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- FIXME("\n");
- return E_NOTIMPL;
+ match_result_t *parens = NULL, match;
+ DWORD parens_cnt = 0;
+ VARIANT_BOOL b;
+ BSTR string;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ hres = run_exec(ctx, jsthis, arg_cnt(dp) ? get_arg(dp,0) : NULL, ei, &string, &match, &parens, &parens_cnt, &b);
+ if(FAILED(hres))
+ return hres;
+
+ if(retv) {
+ if(b) {
+ IDispatch *ret;
+
+ hres = create_match_array(ctx, string, &match, parens, parens_cnt, ei, &ret);
+ if(SUCCEEDED(hres)) {
+ V_VT(retv) = VT_DISPATCH;
+ V_DISPATCH(retv) = ret;
+ }
+ }else {
+ V_VT(retv) = VT_NULL;
+ }
+ }
+
+ heap_free(parens);
+ SysFreeString(string);
+ return hres;
}
-static HRESULT RegExp_test(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT RegExp_test(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- FIXME("\n");
- return E_NOTIMPL;
+ match_result_t match;
+ VARIANT_BOOL b;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ hres = run_exec(ctx, jsthis, arg_cnt(dp) ? get_arg(dp,0) : NULL, ei, NULL, &match, NULL, NULL, &b);
+ if(FAILED(hres))
+ return hres;
+
+ if(retv) {
+ V_VT(retv) = VT_BOOL;
+ V_BOOL(retv) = b;
+ }
+ return S_OK;
}
-static HRESULT RegExp_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT RegExp_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
switch(flags) {
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:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
if(FAILED(hres))
return hres;
- V_VT(retv) = VT_DISPATCH;
- V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(ret);
+ if(retv) {
+ V_VT(retv) = VT_DISPATCH;
+ V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(ret);
+ }else {
+ jsdisp_release(ret);
+ }
return S_OK;
}
-static HRESULT RegExpConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
switch(flags) {
+ case DISPATCH_METHOD:
+ if(arg_cnt(dp)) {
+ VARIANT *arg = get_arg(dp,0);
+ if(V_VT(arg) == VT_DISPATCH) {
+ DispatchEx *jsdisp = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg));
+ if(jsdisp) {
+ if(is_class(jsdisp, JSCLASS_REGEXP)) {
+ if(arg_cnt(dp) > 1 && V_VT(get_arg(dp,1)) != VT_EMPTY) {
+ jsdisp_release(jsdisp);
+ return throw_regexp_error(ctx, ei, IDS_REGEXP_SYNTAX_ERROR, NULL);
+ }
+
+ if(retv) {
+ V_VT(retv) = VT_DISPATCH;
+ V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(jsdisp);
+ }else {
+ jsdisp_release(jsdisp);
+ }
+ return S_OK;
+ }
+ jsdisp_release(jsdisp);
+ }
+ }
+ }
+ /* fall through */
case DISPATCH_CONSTRUCT:
- return regexp_constructor(dispex->ctx, dp, retv);
+ return regexp_constructor(ctx, dp, retv);
default:
FIXME("unimplemented flags: %x\n", flags);
return E_NOTIMPL;
RegExpInstance *regexp;
HRESULT hres;
+ static const WCHAR RegExpW[] = {'R','e','g','E','x','p',0};
+
hres = alloc_regexp(ctx, object_prototype, ®exp);
if(FAILED(hres))
return hres;
- hres = create_builtin_function(ctx, RegExpConstr_value, NULL, PROPF_CONSTR, ®exp->dispex, ret);
+ hres = create_builtin_function(ctx, RegExpConstr_value, RegExpW, NULL, PROPF_CONSTR, ®exp->dispex, ret);
jsdisp_release(®exp->dispex);
return hres;
#define IDS_TO_PRIMITIVE 0x0001
#define IDS_INVALID_CALL_ARG 0x0005
+#define IDS_CREATE_OBJ_ERROR 0x01AD
#define IDS_NO_PROPERTY 0x01B6
#define IDS_ARG_NOT_OPT 0x01c1
#define IDS_SYNTAX_ERROR 0x03EA
#define IDS_NOT_FUNC 0x138A
#define IDS_NOT_DATE 0x138E
#define IDS_NOT_NUM 0x1389
+#define IDS_OBJECT_EXPECTED 0x138F
#define IDS_ILLEGAL_ASSIGN 0x1390
#define IDS_UNDEFINED 0x1391
#define IDS_NOT_BOOL 0x1392
+#define IDS_JSCRIPT_EXPECTED 0x1396
+#define IDS_REGEXP_SYNTAX_ERROR 0x1399
#define IDS_INVALID_LENGTH 0x13A5
+#define IDS_ARRAY_EXPECTED 0x13A7
static const WCHAR localeCompareW[] = {'l','o','c','a','l','e','C','o','m','p','a','r','e',0};
static const WCHAR fromCharCodeW[] = {'f','r','o','m','C','h','a','r','C','o','d','e',0};
-static HRESULT String_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static inline StringInstance *string_from_vdisp(vdisp_t *vdisp)
+{
+ return (StringInstance*)vdisp->u.jsdisp;
+}
+
+static inline StringInstance *string_this(vdisp_t *jsthis)
+{
+ return is_vclass(jsthis, JSCLASS_STRING) ? string_from_vdisp(jsthis) : NULL;
+}
+
+static HRESULT get_string_val(script_ctx_t *ctx, vdisp_t *jsthis, jsexcept_t *ei,
+ const WCHAR **str, DWORD *len, BSTR *val_str)
+{
+ StringInstance *string;
+ VARIANT this_var;
+ HRESULT hres;
+
+ if((string = string_this(jsthis))) {
+ *str = string->str;
+ *len = string->length;
+ *val_str = NULL;
+ return S_OK;
+ }
+
+ V_VT(&this_var) = VT_DISPATCH;
+ V_DISPATCH(&this_var) = jsthis->u.disp;
+ hres = to_string(ctx, &this_var, ei, val_str);
+ if(FAILED(hres))
+ return hres;
+
+ *str = *val_str;
+ *len = SysStringLen(*val_str);
+ return S_OK;
+}
+
+static HRESULT String_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- TRACE("%p\n", dispex);
+ TRACE("%p\n", jsthis);
switch(flags) {
case DISPATCH_PROPERTYGET: {
- StringInstance *jsthis = (StringInstance*)dispex;
+ StringInstance *string = string_from_vdisp(jsthis);
V_VT(retv) = VT_I4;
- V_I4(retv) = jsthis->length;
+ V_I4(retv) = string->length;
break;
}
default:
return S_OK;
}
-/* ECMA-262 3rd Edition 15.5.4.2 */
-static HRESULT String_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
- VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+static HRESULT stringobj_to_string(vdisp_t *jsthis, VARIANT *retv)
{
StringInstance *string;
- TRACE("\n");
-
- if(!is_class(dispex, JSCLASS_STRING)) {
+ if(!(string = string_this(jsthis))) {
WARN("this is not a string object\n");
return E_FAIL;
}
- string = (StringInstance*)dispex;
-
if(retv) {
BSTR str = SysAllocString(string->str);
if(!str)
}
/* ECMA-262 3rd Edition 15.5.4.2 */
-static HRESULT String_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
+ VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
+{
+ TRACE("\n");
+
+ return stringobj_to_string(jsthis, retv);
+}
+
+/* ECMA-262 3rd Edition 15.5.4.2 */
+static HRESULT String_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
TRACE("\n");
- return String_toString(dispex, lcid, flags, dp, retv, ei, sp);
+ return stringobj_to_string(jsthis, retv);
}
-static HRESULT do_attributeless_tag_format(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp, const WCHAR *tagname)
{
- static const WCHAR tagfmt[] = {'<','%','s','>','%','s','<','/','%','s','>',0};
const WCHAR *str;
DWORD length;
BSTR val_str = NULL;
HRESULT hres;
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
+ static const WCHAR tagfmt[] = {'<','%','s','>','%','s','<','/','%','s','>',0};
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
if(retv) {
BSTR ret = SysAllocStringLen(NULL, length + 2*strlenW(tagname) + 5);
return S_OK;
}
-static HRESULT do_attribute_tag_format(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp,
const WCHAR *tagname, const WCHAR *attr)
{
= {'<','%','s',' ','%','s','=','\"','%','s','\"','>','%','s','<','/','%','s','>',0};
static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d',0};
+ StringInstance *string;
const WCHAR *str;
DWORD length;
BSTR attr_value, val_str = NULL;
HRESULT hres;
- if(!is_class(dispex, JSCLASS_STRING)) {
+ if(!(string = string_this(jsthis))) {
VARIANT this;
V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
+ V_DISPATCH(&this) = jsthis->u.disp;
- hres = to_string(dispex->ctx, &this, ei, &val_str);
+ hres = to_string(ctx, &this, ei, &val_str);
if(FAILED(hres))
return hres;
length = SysStringLen(val_str);
}
else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
+ str = string->str;
+ length = string->length;
}
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)) {
SysFreeString(val_str);
return hres;
return S_OK;
}
-static HRESULT String_anchor(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_anchor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR fontW[] = {'A',0};
static const WCHAR colorW[] = {'N','A','M','E',0};
- return do_attribute_tag_format(dispex, lcid, flags, dp, retv, ei, sp, fontW, colorW);
+ return do_attribute_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, fontW, colorW);
}
-static HRESULT String_big(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_big(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR bigtagW[] = {'B','I','G',0};
- return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, bigtagW);
+ return do_attributeless_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, bigtagW);
}
-static HRESULT String_blink(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_blink(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR blinktagW[] = {'B','L','I','N','K',0};
- return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, blinktagW);
+ return do_attributeless_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, blinktagW);
}
-static HRESULT String_bold(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_bold(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR boldtagW[] = {'B',0};
- return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, boldtagW);
+ return do_attributeless_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, boldtagW);
}
/* ECMA-262 3rd Edition 15.5.4.5 */
-static HRESULT String_charAt(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_charAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
const WCHAR *str;
DWORD length;
- BSTR ret, val_str = NULL;
+ BSTR ret, val_str;
INT pos = 0;
HRESULT hres;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
if(arg_cnt(dp)) {
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)) {
SysFreeString(val_str);
return hres;
}
/* ECMA-262 3rd Edition 15.5.4.5 */
-static HRESULT String_charCodeAt(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
const WCHAR *str;
- BSTR val_str = NULL;
+ BSTR val_str;
DWORD length, idx = 0;
HRESULT hres;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
if(arg_cnt(dp) > 0) {
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)) {
SysFreeString(val_str);
return hres;
}
/* ECMA-262 3rd Edition 15.5.4.6 */
-static HRESULT String_concat(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
BSTR *strs = NULL, ret = NULL;
return E_OUTOFMEMORY;
V_VT(&var) = VT_DISPATCH;
- V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(dispex);
+ V_DISPATCH(&var) = jsthis->u.disp;
- hres = to_string(dispex->ctx, &var, ei, strs);
+ hres = to_string(ctx, &var, ei, strs);
if(SUCCEEDED(hres)) {
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))
break;
}
return S_OK;
}
-static HRESULT String_fixed(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_fixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR fixedtagW[] = {'T','T',0};
- return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, fixedtagW);
+ return do_attributeless_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, fixedtagW);
}
-static HRESULT String_fontcolor(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_fontcolor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR fontW[] = {'F','O','N','T',0};
static const WCHAR colorW[] = {'C','O','L','O','R',0};
- return do_attribute_tag_format(dispex, lcid, flags, dp, retv, ei, sp, fontW, colorW);
+ return do_attribute_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, fontW, colorW);
}
-static HRESULT String_fontsize(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_fontsize(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR fontW[] = {'F','O','N','T',0};
static const WCHAR colorW[] = {'S','I','Z','E',0};
- return do_attribute_tag_format(dispex, lcid, flags, dp, retv, ei, sp, fontW, colorW);
+ return do_attribute_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, fontW, colorW);
}
-static HRESULT String_indexOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
DWORD length, pos = 0;
const WCHAR *str;
- BSTR search_str, val_str = NULL;
+ BSTR search_str, val_str;
INT ret = -1;
HRESULT hres;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
if(!arg_cnt(dp)) {
if(retv) {
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)) {
SysFreeString(val_str);
return hres;
if(arg_cnt(dp) >= 2) {
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(V_VT(&ival) == VT_I4)
pos = V_VT(&ival) > 0 ? V_I4(&ival) : 0;
return S_OK;
}
-static HRESULT String_italics(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_italics(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR italicstagW[] = {'I',0};
- return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, italicstagW);
+ return do_attributeless_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, italicstagW);
}
-static HRESULT String_lastIndexOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+/* ECMA-262 3rd Edition 15.5.4.8 */
+static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- FIXME("\n");
- return E_NOTIMPL;
+ BSTR search_str, val_str;
+ DWORD length, pos, search_len;
+ const WCHAR *str;
+ INT ret = -1;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
+
+ if(!arg_cnt(dp)) {
+ if(retv) {
+ V_VT(retv) = VT_I4;
+ V_I4(retv) = -1;
+ }
+ SysFreeString(val_str);
+ return S_OK;
+ }
+
+ hres = to_string(ctx, get_arg(dp,0), ei, &search_str);
+ if(FAILED(hres)) {
+ SysFreeString(val_str);
+ return hres;
+ }
+
+ search_len = SysStringLen(search_str);
+
+ if(arg_cnt(dp) >= 2) {
+ VARIANT ival;
+
+ hres = to_integer(ctx, get_arg(dp,1), ei, &ival);
+ if(SUCCEEDED(hres)) {
+ if(V_VT(&ival) == VT_I4)
+ pos = V_VT(&ival) > 0 ? V_I4(&ival) : 0;
+ else
+ pos = V_R8(&ival) > 0.0 ? length : 0;
+ if(pos > length)
+ pos = length;
+ }
+ }else {
+ pos = length;
+ }
+
+ if(SUCCEEDED(hres) && length >= search_len) {
+ const WCHAR *ptr;
+
+ for(ptr = str+min(pos, length-search_len); ptr >= str; ptr--) {
+ if(!memcmp(ptr, search_str, search_len*sizeof(WCHAR))) {
+ ret = ptr-str;
+ break;
+ }
+ }
+ }
+
+ SysFreeString(search_str);
+ SysFreeString(val_str);
+ if(FAILED(hres))
+ return hres;
+
+ if(retv) {
+ V_VT(retv) = VT_I4;
+ V_I4(retv) = ret;
+ }
+ return S_OK;
}
-static HRESULT String_link(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_link(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR fontW[] = {'A',0};
static const WCHAR colorW[] = {'H','R','E','F',0};
- return do_attribute_tag_format(dispex, lcid, flags, dp, retv, ei, sp, fontW, colorW);
+ return do_attribute_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, fontW, colorW);
}
/* ECMA-262 3rd Edition 15.5.4.10 */
-static HRESULT String_match(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
const WCHAR *str;
default: {
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))
return hres;
- hres = create_regexp_str(dispex->ctx, match_str, SysStringLen(match_str), NULL, 0, ®exp);
+ hres = create_regexp_str(ctx, match_str, SysStringLen(match_str), NULL, 0, ®exp);
SysFreeString(match_str);
if(FAILED(hres))
return hres;
}
}
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres)) {
- jsdisp_release(regexp);
- return hres;
- }
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
-
- hres = regexp_match(regexp, str, length, FALSE, &match_result, &match_cnt);
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(SUCCEEDED(hres))
+ hres = regexp_match(ctx, regexp, str, length, FALSE, &match_result, &match_cnt);
jsdisp_release(regexp);
if(FAILED(hres)) {
SysFreeString(val_str);
return S_OK;
}
- hres = create_array(dispex->ctx, match_cnt, &array);
+ hres = create_array(ctx, match_cnt, &array);
if(FAILED(hres)) {
SysFreeString(val_str);
return hres;
break;
}
- hres = jsdisp_propput_idx(array, i, lcid, &var, ei, NULL/*FIXME*/);
+ hres = jsdisp_propput_idx(array, i, &var, ei, NULL/*FIXME*/);
SysFreeString(V_BSTR(&var));
if(FAILED(hres))
break;
return S_OK;
}
-static HRESULT rep_call(DispatchEx *func, const WCHAR *str, match_result_t *match, match_result_t *parens,
- DWORD parens_cnt, LCID lcid, BSTR *ret, jsexcept_t *ei, IServiceProvider *caller)
+static HRESULT rep_call(script_ctx_t *ctx, DispatchEx *func, const WCHAR *str, match_result_t *match,
+ match_result_t *parens, DWORD parens_cnt, BSTR *ret, jsexcept_t *ei, IServiceProvider *caller)
{
DISPPARAMS dp = {NULL, NULL, 0, 0};
VARIANTARG *args, *arg;
}
if(SUCCEEDED(hres))
- hres = jsdisp_call_value(func, lcid, DISPATCH_METHOD, &dp, &var, ei, caller);
+ hres = jsdisp_call_value(func, DISPATCH_METHOD, &dp, &var, ei, caller);
for(i=0; i < parens_cnt+1; i++) {
if(i != parens_cnt+1)
if(FAILED(hres))
return hres;
- hres = to_string(func->ctx, &var, ei, ret);
+ hres = to_string(ctx, &var, ei, ret);
VariantClear(&var);
return hres;
}
/* ECMA-262 3rd Edition 15.5.4.11 */
-static HRESULT String_replace(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
const WCHAR *str;
DWORD parens_cnt = 0, parens_size=0, rep_len=0, length;
- BSTR rep_str = NULL, match_str = NULL, ret_str, val_str = NULL;
+ BSTR rep_str = NULL, match_str = NULL, ret_str, val_str;
DispatchEx *rep_func = NULL, *regexp = NULL;
match_result_t *parens = NULL, match, **parens_ptr = &parens;
strbuf_t ret = {NULL,0,0};
TRACE("\n");
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
if(!arg_cnt(dp)) {
if(retv) {
}
default:
- hres = to_string(dispex->ctx, arg_var, ei, &match_str);
+ hres = to_string(ctx, arg_var, ei, &match_str);
if(FAILED(hres)) {
SysFreeString(val_str);
return hres;
}
default:
- hres = to_string(dispex->ctx, arg_var, ei, &rep_str);
+ hres = to_string(ctx, arg_var, ei, &rep_str);
if(FAILED(hres))
break;
while(1) {
if(regexp) {
- hres = regexp_match_next(regexp, gcheck, str, length, &cp, parens_ptr,
- &parens_size, &parens_cnt, &match);
+ hres = regexp_match_next(ctx, regexp, gcheck, str, length, &cp, parens_ptr,
+ &parens_size, &parens_cnt, &match);
gcheck = TRUE;
if(hres == S_FALSE) {
if(rep_func) {
BSTR cstr;
- hres = rep_call(rep_func, str, &match, parens, parens_cnt, lcid, &cstr, ei, caller);
+ hres = rep_call(ctx, rep_func, str, &match, parens, parens_cnt, &cstr, ei, caller);
if(FAILED(hres))
break;
return hres;
}
-static HRESULT String_search(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
}
/* ECMA-262 3rd Edition 15.5.4.13 */
-static HRESULT String_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
const WCHAR *str;
- BSTR val_str = NULL;
+ BSTR val_str;
DWORD length;
INT start=0, end;
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
if(arg_cnt(dp)) {
- hres = to_integer(dispex->ctx, dp->rgvarg + dp->cArgs-1, ei, &v);
+ hres = to_integer(ctx, get_arg(dp,0), ei, &v);
if(FAILED(hres)) {
SysFreeString(val_str);
return hres;
}
if(arg_cnt(dp) >= 2) {
- hres = to_integer(dispex->ctx, dp->rgvarg + dp->cArgs-2, ei, &v);
+ hres = to_integer(ctx, get_arg(dp,1), ei, &v);
if(FAILED(hres)) {
SysFreeString(val_str);
return hres;
return S_OK;
}
-static HRESULT String_small(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_small(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR smalltagW[] = {'S','M','A','L','L',0};
- return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, smalltagW);
+ return do_attributeless_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, smalltagW);
}
-static HRESULT String_split(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
match_result_t *match_result = NULL;
const WCHAR *str, *ptr, *ptr2;
VARIANT *arg, var;
DispatchEx *array;
- BSTR val_str = NULL, match_str = NULL;
+ BSTR val_str, match_str = NULL;
HRESULT hres;
TRACE("\n");
return E_NOTIMPL;
}
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
arg = get_arg(dp, 0);
switch(V_VT(arg)) {
regexp = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg));
if(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);
if(FAILED(hres)) {
SysFreeString(val_str);
}
}
default:
- hres = to_string(dispex->ctx, arg, ei, &match_str);
+ hres = to_string(ctx, arg, ei, &match_str);
if(FAILED(hres)) {
SysFreeString(val_str);
return hres;
}
}
- hres = create_array(dispex->ctx, 0, &array);
+ hres = create_array(ctx, 0, &array);
if(SUCCEEDED(hres)) {
ptr = str;
break;
}
- hres = jsdisp_propput_idx(array, i, lcid, &var, ei, sp);
+ hres = jsdisp_propput_idx(array, i, &var, ei, sp);
SysFreeString(V_BSTR(&var));
if(FAILED(hres))
break;
V_BSTR(&var) = SysAllocStringLen(ptr, len);
if(V_BSTR(&var)) {
- hres = jsdisp_propput_idx(array, i, lcid, &var, ei, sp);
+ hres = jsdisp_propput_idx(array, i, &var, ei, sp);
SysFreeString(V_BSTR(&var));
}else {
hres = E_OUTOFMEMORY;
return hres;
}
-static HRESULT String_strike(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_strike(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR striketagW[] = {'S','T','R','I','K','E',0};
- return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, striketagW);
+ return do_attributeless_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, striketagW);
}
-static HRESULT String_sub(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_sub(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR subtagW[] = {'S','U','B',0};
- return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, subtagW);
+ return do_attributeless_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, subtagW);
}
/* ECMA-262 3rd Edition 15.5.4.15 */
-static HRESULT String_substring(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_substring(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
const WCHAR *str;
- BSTR val_str = NULL;
+ BSTR val_str;
INT start=0, end;
DWORD length;
VARIANT v;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
if(arg_cnt(dp) >= 1) {
- hres = to_integer(dispex->ctx, dp->rgvarg + dp->cArgs-1, ei, &v);
+ hres = to_integer(ctx, get_arg(dp,0), ei, &v);
if(FAILED(hres)) {
SysFreeString(val_str);
return hres;
}
if(arg_cnt(dp) >= 2) {
- hres = to_integer(dispex->ctx, dp->rgvarg + dp->cArgs-2, ei, &v);
+ hres = to_integer(ctx, get_arg(dp,1), ei, &v);
if(FAILED(hres)) {
SysFreeString(val_str);
return hres;
return S_OK;
}
-static HRESULT String_substr(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+/* ECMA-262 3rd Edition B.2.3 */
+static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- FIXME("\n");
- return E_NOTIMPL;
+ BSTR val_str;
+ const WCHAR *str;
+ INT start=0, len;
+ DWORD length;
+ VARIANT v;
+ HRESULT hres;
+
+ TRACE("\n");
+
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
+
+ if(arg_cnt(dp) >= 1) {
+ hres = to_integer(ctx, get_arg(dp,0), ei, &v);
+ if(FAILED(hres)) {
+ SysFreeString(val_str);
+ return hres;
+ }
+
+ if(V_VT(&v) == VT_I4) {
+ start = V_I4(&v);
+ if(start < 0)
+ start = 0;
+ else if(start >= length)
+ start = length;
+ }else {
+ start = V_R8(&v) < 0.0 ? 0 : length;
+ }
+ }
+
+ if(arg_cnt(dp) >= 2) {
+ hres = to_integer(ctx, get_arg(dp,1), ei, &v);
+ if(FAILED(hres)) {
+ SysFreeString(val_str);
+ return hres;
+ }
+
+ if(V_VT(&v) == VT_I4) {
+ len = V_I4(&v);
+ if(len < 0)
+ len = 0;
+ else if(len > length-start)
+ len = length-start;
+ }else {
+ len = V_R8(&v) < 0.0 ? 0 : length-start;
+ }
+ }else {
+ len = length-start;
+ }
+
+ hres = S_OK;
+ if(retv) {
+ V_VT(retv) = VT_BSTR;
+ V_BSTR(retv) = SysAllocStringLen(str+start, len);
+ if(!V_BSTR(retv))
+ hres = E_OUTOFMEMORY;
+ }
+
+ SysFreeString(val_str);
+ return hres;
}
-static HRESULT String_sup(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_sup(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
static const WCHAR suptagW[] = {'S','U','P',0};
- return do_attributeless_tag_format(dispex, lcid, flags, dp, retv, ei, sp, suptagW);
+ return do_attributeless_tag_format(ctx, jsthis, flags, dp, retv, ei, sp, suptagW);
}
-static HRESULT String_toLowerCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
const WCHAR* str;
DWORD length;
- BSTR val_str = NULL;
+ BSTR val_str;
HRESULT hres;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
if(retv) {
if(!val_str) {
return S_OK;
}
-static HRESULT String_toUpperCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
const WCHAR* str;
DWORD length;
- BSTR val_str = NULL;
+ BSTR val_str;
HRESULT hres;
TRACE("\n");
- if(!is_class(dispex, JSCLASS_STRING)) {
- VARIANT this;
-
- V_VT(&this) = VT_DISPATCH;
- V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
-
- hres = to_string(dispex->ctx, &this, ei, &val_str);
- if(FAILED(hres))
- return hres;
-
- str = val_str;
- length = SysStringLen(val_str);
- }
- else {
- StringInstance *this = (StringInstance*)dispex;
-
- str = this->str;
- length = this->length;
- }
+ hres = get_string_val(ctx, jsthis, ei, &str, &length, &val_str);
+ if(FAILED(hres))
+ return hres;
if(retv) {
if(!val_str) {
return S_OK;
}
-static HRESULT String_toLocaleLowerCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_toLocaleLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT String_toLocaleUpperCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_toLocaleUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT String_localeCompare(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_localeCompare(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
}
-static HRESULT String_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT String_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
- StringInstance *This = (StringInstance*)dispex;
+ StringInstance *This = string_from_vdisp(jsthis);
TRACE("\n");
switch(flags) {
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: {
BSTR str = SysAllocString(This->str);
if(!str)
};
/* ECMA-262 3rd Edition 15.5.3.2 */
-static HRESULT StringConstr_fromCharCode(DispatchEx *dispex, LCID lcid, WORD flags,
+static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
DWORD i, code;
return E_OUTOFMEMORY;
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)) {
SysFreeString(ret);
return hres;
return S_OK;
}
-static HRESULT StringConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
+static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
HRESULT hres;
BSTR str;
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))
return hres;
}else {
if(arg_cnt(dp)) {
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))
return hres;
- hres = create_string(dispex->ctx, str, SysStringLen(str), &ret);
+ hres = create_string(ctx, str, SysStringLen(str), &ret);
SysFreeString(str);
}else {
- hres = create_string(dispex->ctx, NULL, 0, &ret);
+ hres = create_string(ctx, NULL, 0, &ret);
}
if(FAILED(hres))
StringInstance *string;
HRESULT hres;
+ static const WCHAR StringW[] = {'S','t','r','i','n','g',0};
+
hres = string_alloc(ctx, object_prototype, &string);
if(FAILED(hres))
return hres;
- hres = create_builtin_function(ctx, StringConstr_value, &StringConstr_info, PROPF_CONSTR, &string->dispex, ret);
+ hres = create_builtin_function(ctx, StringConstr_value, StringW, &StringConstr_info,
+ PROPF_CONSTR, &string->dispex, ret);
jsdisp_release(&string->dispex);
return hres;
interface IDebugDocumentContext;
interface IRemoteDebugApplication;
+interface IEnumDebugCodeContexts;
/* FIXME: */
interface IEnumDebugStackFrames;
ERRORRESUMEACTION_SkipErrorStatement,
} ERRORRESUMEACTION;
+typedef WORD SOURCE_TEXT_ATTR;
+
+#ifdef INTEROPLIB
+enum enum_SOURCE_TEXT_ATTR
+{
+ SOURCETEXT_ATTR_KEYWORD = 0x01,
+ SOURCETEXT_ATTR_COMMENT = 0x02,
+ SOURCETEXT_ATTR_NONSOURCE = 0x04,
+ SOURCETEXT_ATTR_OPERATOR = 0x08,
+ SOURCETEXT_ATTR_NUMBER = 0x10,
+ SOURCETEXT_ATTR_STRING = 0x20,
+ SOURCETEXT_ATTR_FUNCTION_START = 0x40
+};
+#endif
+
+const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_KEYWORD = 0x01;
+const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_COMMENT = 0x02;
+const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_NONSOURCE = 0x04;
+const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_OPERATOR = 0x08;
+const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_NUMBER = 0x10;
+const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_STRING = 0x20;
+const SOURCE_TEXT_ATTR SOURCETEXT_ATTR_FUNCTION_START = 0x40;
+
+/************************************************************
+ * interface IActiveScriptDebug32
+ */
+[
+ object,
+ uuid(51973c10-cb0c-11d0-b5c9-00a0244a0e7a),
+ pointer_default(unique)
+]
+interface IActiveScriptDebug32 : IUnknown
+{
+ HRESULT GetScriptTextAttributes(
+ [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode,
+ [in] ULONG uNumCodeChars,
+ [in] LPCOLESTR pstrDelimiter,
+ [in] DWORD dwFlags,
+ [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr);
+
+ HRESULT GetScriptletTextAttributes(
+ [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode,
+ [in] ULONG uNumCodeChars,
+ [in] LPCOLESTR pstrDelimiter,
+ [in] DWORD dwFlags,
+ [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr);
+
+ HRESULT EnumCodeContextsOfPosition(
+ [in] DWORD dwSourceContext,
+ [in] ULONG uCharacterOffset,
+ [in] ULONG uNumChars,
+ [out] IEnumDebugCodeContexts **ppescc);
+}
+
+[
+ object,
+ uuid(bc437e23-f5b8-47f4-bb79-7d1ce5483b86),
+ pointer_default(unique)
+]
+interface IActiveScriptDebug64 : IUnknown
+{
+ HRESULT GetScriptTextAttributes(
+ [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode,
+ [in] ULONG uNumCodeChars,
+ [in] LPCOLESTR pstrDelimiter,
+ [in] DWORD dwFlags,
+ [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr);
+
+ HRESULT GetScriptletTextAttributes(
+ [in, size_is(uNumCodeChars)] LPCOLESTR pstrCode,
+ [in] ULONG uNumCodeChars,
+ [in] LPCOLESTR pstrDelimiter,
+ [in] DWORD dwFlags,
+ [in, out, size_is(uNumCodeChars)] SOURCE_TEXT_ATTR *pattr);
+
+ HRESULT EnumCodeContextsOfPosition(
+ [in] DWORDLONG dwSourceContext,
+ [in] ULONG uCharacterOffset,
+ [in] ULONG uNumChars,
+ [out] IEnumDebugCodeContexts **ppescc);
+}
+
/************************************************************
* interface IDebugDocumentInfo
*/
cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
cpp_quote("#ifdef _WIN64")
+cpp_quote("#define IActiveScriptDebug IActiveScriptDebug64")
+cpp_quote("#define IID_IActiveScriptDebug IID_IActiveScriptDebug64")
+
cpp_quote("#define IActiveScriptSiteDebug IActiveScriptSiteDebug64")
cpp_quote("#define IID_IActiveScriptSiteDebug IID_IActiveScriptSiteDebug64")
cpp_quote("#else")
+cpp_quote("#define IActiveScriptDebug IActiveScriptDebug32")
+cpp_quote("#define IID_IActiveScriptDebug IID_IActiveScriptDebug32")
+
cpp_quote("#define IActiveScriptSiteDebug IActiveScriptSiteDebug32")
cpp_quote("#define IID_IActiveScriptSiteDebug IID_IActiveScriptSiteDebug32")
[in, iid_is(riid)] IUnknown* punk);
}
+/*****************************************************************************
+ * IBindStatusCallbackEx interface
+ */
+[
+ object,
+ uuid(aaa74ef9-8ee7-4659-88d9-f8c504da73cc),
+ pointer_default(unique)
+]
+interface IBindStatusCallbackEx : IBindStatusCallback
+{
+ typedef [unique] IBindStatusCallbackEx *LPBINDSTATUSCALLBACKEX;
+
+ typedef enum {
+ BINDF2_DISABLEBASICOVERHTTP = 0x00000001,
+ BINDF2_DISABLEAUTOCOOKIEHANDLING = 0x00000002,
+ BINDF2_READ_DATA_GREATER_THAN_4GB = 0x00000004,
+ BINDF2_DISABLE_HTTP_REDIRECT_XSECURITYID = 0x00000008,
+ BINDF2_RESERVED_3 = 0x20000000,
+ BINDF2_RESERVED_2 = 0x40000000,
+ BINDF2_RESERVED_1 = 0x80000000,
+ } BINDF2;
+
+ [local]
+ HRESULT GetBindInfoEx(
+ [out] DWORD *grfBINDF,
+ [in, out, unique] BINDINFO *pbindinfo,
+ [out] DWORD *grfBINDF2,
+ [out] DWORD *pdwReserved);
+
+ [call_as(GetBindInfoEx)]
+ HRESULT RemoteGetBindInfoEx(
+ [out] DWORD *grfBINDF,
+ [in, out, unique] RemBINDINFO *pbindinfo,
+ [in, out, unique] RemSTGMEDIUM *pstgmed,
+ [out] DWORD *grfBINDF2,
+ [out] DWORD *pdwReserved);
+}
+
+
/*****************************************************************************
* IAuthenticate interface
*/
[in] DWORD dwFlags);
}
+/*****************************************************************************
+ * IInternetHostSecurityManager interface
+ */
+cpp_quote("#define SID_SInternetHostSecurityManager IID_IInternetHostSecurityManager")
+
+[
+ local,
+ object,
+ uuid(3af280b6-cb3f-11d0-891e-00c04fb6bfc4),
+ pointer_default(unique)
+]
+interface IInternetHostSecurityManager : IUnknown
+{
+ HRESULT GetSecurityId(
+ [out, size_is(*pcbSecurityId)] BYTE *pbSecurityId,
+ [in, out] DWORD *pcbSecurityId,
+ [in] DWORD_PTR dwReserved);
+
+ HRESULT ProcessUrlAction(
+ [in] DWORD dwAction,
+ [out, size_is(cbPolicy)] BYTE *pPolicy,
+ [in] DWORD cbPolicy,
+ [in] BYTE *pContext,
+ [in] DWORD cbContext,
+ [in] DWORD dwFlags,
+ [in] DWORD dwReserved);
+
+ HRESULT QueryCustomPolicy(
+ [in] REFGUID guidKey,
+ [out, size_is(,*pcbPolicy)] BYTE **ppPolicy,
+ [out] DWORD *pcbPolicy,
+ [in] BYTE *pContext,
+ [in] DWORD cbContext,
+ [in] DWORD dwReserved);
+}
+
cpp_quote("#define URLACTION_MIN 0x00001000")
cpp_quote("#define URLACTION_DOWNLOAD_MIN 0x00001000")
cpp_quote("#define URLACTION_DOWNLOAD_SIGNED_ACTIVEX 0x00001001")
URLTEMPLATE_CUSTOM = 0x00000,
URLTEMPLATE_PREDEFINED_MIN = 0x10000,
URLTEMPLATE_LOW = 0x10000,
+ URLTEMPLATE_MEDLOW = 0x10500,
URLTEMPLATE_MEDIUM = 0x11000,
+ URLTEMPLATE_MEDHIGH = 0x11500,
URLTEMPLATE_HIGH = 0x12000,
URLTEMPLATE_PREDEFINED_MAX = 0x20000,
} URLTEMPLATE ;
typedef enum {
- ZAFLAGS_CUSTOM_EDIT = 0x00000001,
- ZAFLAGS_ADD_SITES = 0x00000002,
- ZAFLAGS_REQUIRE_VERIFICATION = 0x00000004,
- ZAFLAGS_INCLUDE_PROXY_OVERRIDE = 0x00000008,
- ZAFLAGS_INCLUDE_INTRANET_SITES = 0x00000010,
- ZAFLAGS_NO_UI = 0x00000020,
- ZAFLAGS_SUPPORTS_VERIFICATION = 0x00000040,
- ZAFLAGS_UNC_AS_INTRANET = 0x00000080,
+ ZAFLAGS_CUSTOM_EDIT = 0x00000001,
+ ZAFLAGS_ADD_SITES = 0x00000002,
+ ZAFLAGS_REQUIRE_VERIFICATION = 0x00000004,
+ ZAFLAGS_INCLUDE_PROXY_OVERRIDE = 0x00000008,
+ ZAFLAGS_INCLUDE_INTRANET_SITES = 0x00000010,
+ ZAFLAGS_NO_UI = 0x00000020,
+ ZAFLAGS_SUPPORTS_VERIFICATION = 0x00000040,
+ ZAFLAGS_UNC_AS_INTRANET = 0x00000080,
+ ZAFLAGS_DETECT_INTRANET = 0x00000100,
+ ZAFLAGS_USE_LOCKED_ZONES = 0x00010000,
+ ZAFLAGS_VERIFY_TEMPLATE_SETTINGS = 0x00020000,
+ ZAFLAGS_NO_CACHE = 0x00040000,
} ZAFLAGS ;
enum {
[in] DWORD dwReserved);
}
+/*****************************************************************************
+ * IInternetZoneManagerEx interface
+ */
+[
+ local,
+ object,
+ uuid(A4C23339-8E06-431E-9BF4-7E711C085648),
+ pointer_default(unique)
+]
+interface IInternetZoneManagerEx : IInternetZoneManager
+{
+ HRESULT GetZoneActionPolicyEx(
+ [in] DWORD dwZone,
+ [in] DWORD dwAction,
+ [out] BYTE* pPolicy,
+ [in] DWORD cbPolicy,
+ [in] URLZONEREG urlZoneReg,
+ [in] DWORD dwFlags);
+
+ HRESULT SetZoneActionPolicyEx(
+ [in] DWORD dwZone,
+ [in] DWORD dwAction,
+ [in] BYTE* pPolicy,
+ [in] DWORD cbPolicy,
+ [in] URLZONEREG urlZoneReg,
+ [in] DWORD dwFlags);
+
+}
+
+/*****************************************************************************
+ * IInternetZoneManagerEx2 interface
+ */
+
+cpp_quote("#define SECURITY_IE_STATE_GREEN 0")
+cpp_quote("#define SECURITY_IE_STATE_RED 1")
+
+[
+ local,
+ object,
+ uuid(EDC17559-DD5D-4846-8EEF-8BECBA5A4ABF),
+ pointer_default(unique)
+]
+interface IInternetZoneManagerEx2 : IInternetZoneManagerEx
+{
+ HRESULT GetZoneAttributesEx(
+ [in] DWORD dwZone,
+ [in, out, unique] ZONEATTRIBUTES* pZoneAttributes,
+ [in] DWORD dwFlags);
+
+ HRESULT GetZoneSecurityState(
+ [in] DWORD dwZoneIndex,
+ [in] BOOL fRespectPolicy,
+ [in, out] LPDWORD pdwState,
+ [in, out] BOOL *pfPolicyEncountered);
+
+ HRESULT GetIESecurityState(
+ [in] BOOL fRespectPolicy,
+ [in, out] LPDWORD pdwState,
+ [in, out] BOOL *pfPolicyEncountered,
+ [in] BOOL fNoCache);
+
+ HRESULT FixInsecureSettings(void);
+
+}
+
+
typedef struct _tagSOFTDISTINFO
{
ULONG cbSize;
[in] HANDLE *dwReserved);
}
+cpp_quote("#define CONFIRMSAFETYACTION_LOADOBJECT 0x00000001")
+
+struct CONFIRMSAFETY
+{
+ CLSID clsid;
+ IUnknown *pUnk;
+ DWORD dwFlags;
+};
+
+cpp_quote("EXTERN_C const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY;")
+
cpp_quote("DEFINE_GUID(CLSID_InternetSecurityManager, 0x7b8a2d94, 0x0ac9, 0x11d1, 0x89, 0x6c, 0x00, 0xc0, 0x4f, 0xB6, 0xbf, 0xc4);")
cpp_quote("DEFINE_GUID(CLSID_InternetZoneManager, 0x7B8A2D95, 0x0AC9, 0x11D1, 0x89, 0x6C, 0x00, 0xC0, 0x4F, 0xB6, 0xBF, 0xC4);")
cpp_quote("DEFINE_GUID(IID_IAsyncMoniker, 0x79EAC9D3, 0xBAF9, 0x11CE, 0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B);")