mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 13:38:19 +00:00
sync shdocvw, mshtml and jscript to wine 1.1.15
svn path=/trunk/; revision=39589
This commit is contained in:
parent
27fb0f8623
commit
a95d7474d9
38 changed files with 5435 additions and 1365 deletions
|
@ -47,6 +47,7 @@ static const WCHAR propertyIsEnumerableW[] =
|
|||
{'p','r','o','p','e','r','t','y','I','s','E','n','u','m','e','r','a','b','l','e',0};
|
||||
static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','e','O','f',0};
|
||||
|
||||
static const WCHAR default_separatorW[] = {',',0};
|
||||
|
||||
static HRESULT Array_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
|
@ -68,32 +69,312 @@ static HRESULT Array_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Array_concat(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
static HRESULT concat_array(DispatchEx *array, ArrayInstance *obj, DWORD *len, LCID lcid,
|
||||
jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT var;
|
||||
DWORD i;
|
||||
HRESULT hres;
|
||||
|
||||
for(i=0; i < obj->length; i++) {
|
||||
hres = jsdisp_propget_idx(&obj->dispex, i, lcid, &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);
|
||||
VariantClear(&var);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
*len += obj->length;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Array_join(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
static HRESULT concat_obj(DispatchEx *array, IDispatch *obj, DWORD *len, LCID lcid, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
DispatchEx *jsobj;
|
||||
VARIANT var;
|
||||
HRESULT hres;
|
||||
|
||||
jsobj = iface_to_jsdisp((IUnknown*)obj);
|
||||
if(jsobj) {
|
||||
if(is_class(jsobj, JSCLASS_ARRAY)) {
|
||||
hres = concat_array(array, (ArrayInstance*)jsobj, len, lcid, ei, caller);
|
||||
jsdisp_release(jsobj);
|
||||
return hres;
|
||||
}
|
||||
jsdisp_release(jsobj);
|
||||
}
|
||||
|
||||
V_VT(&var) = VT_DISPATCH;
|
||||
V_DISPATCH(&var) = obj;
|
||||
return jsdisp_propput_idx(array, (*len)++, lcid, &var, ei, caller);
|
||||
}
|
||||
|
||||
static HRESULT Array_concat(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
DispatchEx *ret;
|
||||
DWORD len = 0;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
hres = create_array(dispex->ctx, 0, &ret);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = concat_obj(ret, (IDispatch*)_IDispatchEx_(dispex), &len, lcid, 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);
|
||||
else
|
||||
hres = jsdisp_propput_idx(ret, len++, lcid, arg, ei, caller);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_DISPATCH;
|
||||
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(ret);
|
||||
}else {
|
||||
jsdisp_release(ret);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT array_join(DispatchEx *array, LCID lcid, DWORD length, const WCHAR *sep, VARIANT *retv,
|
||||
jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
BSTR *str_tab, ret = NULL;
|
||||
VARIANT var;
|
||||
DWORD i;
|
||||
HRESULT hres = E_FAIL;
|
||||
|
||||
if(!length) {
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_BSTR;
|
||||
V_BSTR(retv) = SysAllocStringLen(NULL, 0);
|
||||
if(!V_BSTR(retv))
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
str_tab = heap_alloc_zero(length * sizeof(BSTR));
|
||||
if(!str_tab)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
for(i=0; i < length; i++) {
|
||||
hres = jsdisp_propget_idx(array, i, lcid, &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);
|
||||
VariantClear(&var);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
}
|
||||
|
||||
if(SUCCEEDED(hres)) {
|
||||
DWORD seplen = 0, len = 0;
|
||||
WCHAR *ptr;
|
||||
|
||||
seplen = strlenW(sep);
|
||||
|
||||
if(str_tab[0])
|
||||
len = SysStringLen(str_tab[0]);
|
||||
for(i=1; i < length; i++)
|
||||
len += seplen + SysStringLen(str_tab[i]);
|
||||
|
||||
ret = SysAllocStringLen(NULL, len);
|
||||
if(ret) {
|
||||
DWORD tmplen = 0;
|
||||
|
||||
if(str_tab[0]) {
|
||||
tmplen = SysStringLen(str_tab[0]);
|
||||
memcpy(ret, str_tab[0], tmplen*sizeof(WCHAR));
|
||||
}
|
||||
|
||||
ptr = ret + tmplen;
|
||||
for(i=1; i < length; i++) {
|
||||
if(seplen) {
|
||||
memcpy(ptr, sep, seplen*sizeof(WCHAR));
|
||||
ptr += seplen;
|
||||
}
|
||||
|
||||
if(str_tab[i]) {
|
||||
tmplen = SysStringLen(str_tab[i]);
|
||||
memcpy(ptr, str_tab[i], tmplen*sizeof(WCHAR));
|
||||
ptr += tmplen;
|
||||
}
|
||||
}
|
||||
*ptr=0;
|
||||
}else {
|
||||
hres = E_OUTOFMEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i < length; i++)
|
||||
SysFreeString(str_tab[i]);
|
||||
heap_free(str_tab);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
TRACE("= %s\n", debugstr_w(ret));
|
||||
|
||||
if(retv) {
|
||||
if(!ret) {
|
||||
ret = SysAllocStringLen(NULL, 0);
|
||||
if(!ret)
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
V_VT(retv) = VT_BSTR;
|
||||
V_BSTR(retv) = ret;
|
||||
}else {
|
||||
SysFreeString(ret);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.4.4.5 */
|
||||
static HRESULT Array_join(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
DWORD length;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(is_class(dispex, JSCLASS_ARRAY)) {
|
||||
length = ((ArrayInstance*)dispex)->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);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = array_join(dispex, lcid, length, sep, retv, ei, caller);
|
||||
|
||||
SysFreeString(sep);
|
||||
}else {
|
||||
hres = array_join(dispex, lcid, length, default_separatorW, retv, ei, caller);
|
||||
}
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT Array_pop(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT val;
|
||||
DWORD length;
|
||||
WCHAR buf[14];
|
||||
DISPID id;
|
||||
HRESULT hres;
|
||||
|
||||
static const WCHAR formatW[] = {'%','d',0};
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(is_class(dispex, JSCLASS_ARRAY)) {
|
||||
ArrayInstance *array = (ArrayInstance*)dispex;
|
||||
length = array->length;
|
||||
}else {
|
||||
FIXME("not Array this\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if(!length) {
|
||||
if(retv)
|
||||
V_VT(retv) = VT_EMPTY;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
sprintfW(buf, formatW, --length);
|
||||
hres = jsdisp_get_id(dispex, buf, 0, &id);
|
||||
if(SUCCEEDED(hres)) {
|
||||
hres = jsdisp_propget(dispex, id, lcid, &val, ei, caller);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = IDispatchEx_DeleteMemberByDispID(_IDispatchEx_(dispex), id);
|
||||
}else if(hres == DISP_E_UNKNOWNNAME) {
|
||||
V_VT(&val) = VT_EMPTY;
|
||||
hres = S_OK;
|
||||
}else {
|
||||
return hres;
|
||||
}
|
||||
|
||||
if(SUCCEEDED(hres)) {
|
||||
if(is_class(dispex, JSCLASS_ARRAY)) {
|
||||
ArrayInstance *array = (ArrayInstance*)dispex;
|
||||
array->length = length;
|
||||
}
|
||||
}
|
||||
|
||||
if(FAILED(hres)) {
|
||||
VariantClear(&val);
|
||||
return hres;
|
||||
}
|
||||
|
||||
if(retv)
|
||||
*retv = val;
|
||||
else
|
||||
VariantClear(&val);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.4.4.7 */
|
||||
static HRESULT Array_push(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
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;
|
||||
}
|
||||
|
||||
n = dp->cArgs - dp->cNamedArgs;
|
||||
for(i=0; i < n; i++) {
|
||||
hres = jsdisp_propput_idx(dispex, length+i, lcid, get_arg(dp, i), ei, sp);
|
||||
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,
|
||||
|
@ -117,11 +398,216 @@ static HRESULT Array_slice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Array_sort(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
static HRESULT sort_cmp(script_ctx_t *ctx, DispatchEx *cmp_func, VARIANT *v1, VARIANT *v2, jsexcept_t *ei,
|
||||
IServiceProvider *caller, INT *cmp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
|
||||
if(cmp_func) {
|
||||
VARIANTARG args[2];
|
||||
DISPPARAMS dp = {args, NULL, 2, 0};
|
||||
VARIANT tmp;
|
||||
VARIANT res;
|
||||
|
||||
args[0] = *v2;
|
||||
args[1] = *v1;
|
||||
|
||||
hres = jsdisp_call_value(cmp_func, ctx->lcid, DISPATCH_METHOD, &dp, &res, ei, caller);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = to_number(ctx, &res, ei, &tmp);
|
||||
VariantClear(&res);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(V_VT(&tmp) == VT_I4)
|
||||
*cmp = V_I4(&tmp);
|
||||
else
|
||||
*cmp = V_R8(&tmp) > 0.0 ? 1 : -1;
|
||||
}else if(is_num_vt(V_VT(v1))) {
|
||||
if(is_num_vt(V_VT(v2))) {
|
||||
DOUBLE d = num_val(v1)-num_val(v2);
|
||||
if(d > 0.0)
|
||||
*cmp = 1;
|
||||
else if(d < -0.0)
|
||||
*cmp = -1;
|
||||
else
|
||||
*cmp = 0;
|
||||
}else {
|
||||
*cmp = -1;
|
||||
}
|
||||
}else if(is_num_vt(V_VT(v2))) {
|
||||
*cmp = 1;
|
||||
}else if(V_VT(v1) == VT_BSTR) {
|
||||
if(V_VT(v2) == VT_BSTR)
|
||||
*cmp = strcmpW(V_BSTR(v1), V_BSTR(v2));
|
||||
else
|
||||
*cmp = -1;
|
||||
}else if(V_VT(v2) == VT_BSTR) {
|
||||
*cmp = 1;
|
||||
}else {
|
||||
*cmp = 0;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.4.4.11 */
|
||||
static HRESULT Array_sort(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
DispatchEx *cmp_func = NULL;
|
||||
VARIANT *vtab, **sorttab = NULL;
|
||||
DWORD length;
|
||||
DWORD i;
|
||||
HRESULT hres = S_OK;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(is_class(dispex, JSCLASS_ARRAY)) {
|
||||
length = ((ArrayInstance*)dispex)->length;
|
||||
}else {
|
||||
FIXME("unsupported this not array\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if(arg_cnt(dp) > 1) {
|
||||
WARN("invalid arg_cnt %d\n", arg_cnt(dp));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(arg_cnt(dp) == 1) {
|
||||
VARIANT *arg = get_arg(dp, 0);
|
||||
|
||||
if(V_VT(arg) != VT_DISPATCH) {
|
||||
WARN("arg is not dispatch\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
cmp_func = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg));
|
||||
if(!cmp_func || !is_class(cmp_func, JSCLASS_FUNCTION)) {
|
||||
WARN("cmp_func is not a function\n");
|
||||
if(cmp_func)
|
||||
jsdisp_release(cmp_func);
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if(!length) {
|
||||
if(cmp_func)
|
||||
jsdisp_release(cmp_func);
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_DISPATCH;
|
||||
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(dispex);
|
||||
IDispatchEx_AddRef(_IDispatchEx_(dispex));
|
||||
}
|
||||
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);
|
||||
if(FAILED(hres) && hres != DISP_E_UNKNOWNNAME) {
|
||||
WARN("Could not get elem %d: %08x\n", i, hres);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
hres = E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if(SUCCEEDED(hres)) {
|
||||
sorttab = heap_alloc(length*2*sizeof(VARIANT*));
|
||||
if(!sorttab)
|
||||
hres = E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
/* merge-sort */
|
||||
if(SUCCEEDED(hres)) {
|
||||
VARIANT *tmpv, **tmpbuf;
|
||||
INT cmp;
|
||||
|
||||
tmpbuf = sorttab + length;
|
||||
for(i=0; i < length; i++)
|
||||
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);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
if(cmp < 0) {
|
||||
tmpv = sorttab[2*i];
|
||||
sorttab[2*i] = sorttab[2*i+1];
|
||||
sorttab[2*i+1] = tmpv;
|
||||
}
|
||||
}
|
||||
|
||||
if(SUCCEEDED(hres)) {
|
||||
DWORD k, a, b, bend;
|
||||
|
||||
for(k=2; k < length; k *= 2) {
|
||||
for(i=0; i+k < length; i += 2*k) {
|
||||
a = b = 0;
|
||||
if(i+2*k <= length)
|
||||
bend = k;
|
||||
else
|
||||
bend = length - (i+k);
|
||||
|
||||
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);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
if(cmp < 0) {
|
||||
sorttab[i+a+b] = tmpbuf[a];
|
||||
a++;
|
||||
}else {
|
||||
sorttab[i+a+b] = sorttab[i+k+b];
|
||||
b++;
|
||||
}
|
||||
}
|
||||
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
if(a < k)
|
||||
memcpy(sorttab+i+a+b, tmpbuf+a, (k-a)*sizeof(VARIANT*));
|
||||
}
|
||||
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; SUCCEEDED(hres) && i < length; i++)
|
||||
hres = jsdisp_propput_idx(dispex, i, lcid, sorttab[i], ei, caller);
|
||||
}
|
||||
|
||||
if(vtab) {
|
||||
for(i=0; i < length; i++)
|
||||
VariantClear(vtab+i);
|
||||
heap_free(vtab);
|
||||
}
|
||||
heap_free(sorttab);
|
||||
if(cmp_func)
|
||||
jsdisp_release(cmp_func);
|
||||
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_DISPATCH;
|
||||
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(dispex);
|
||||
IDispatch_AddRef(_IDispatchEx_(dispex));
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Array_splice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -131,11 +617,18 @@ static HRESULT Array_splice(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.4.4.2 */
|
||||
static HRESULT Array_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
if(!is_class(dispex, JSCLASS_ARRAY)) {
|
||||
WARN("not Array object\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return array_join(dispex, lcid, ((ArrayInstance*)dispex)->length, default_separatorW, retv, ei, sp);
|
||||
}
|
||||
|
||||
static HRESULT Array_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -183,8 +676,17 @@ static HRESULT Array_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, DI
|
|||
static HRESULT Array_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
switch(flags) {
|
||||
case INVOKE_PROPERTYGET:
|
||||
return array_join(dispex, lcid, ((ArrayInstance*)dispex)->length, default_separatorW, retv, ei, sp);
|
||||
default:
|
||||
FIXME("unimplemented flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void Array_destructor(DispatchEx *dispex)
|
||||
|
@ -297,9 +799,13 @@ static HRESULT ArrayConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISP
|
|||
|
||||
static HRESULT alloc_array(script_ctx_t *ctx, BOOL use_constr, ArrayInstance **ret)
|
||||
{
|
||||
ArrayInstance *array = heap_alloc_zero(sizeof(ArrayInstance));
|
||||
ArrayInstance *array;
|
||||
HRESULT hres;
|
||||
|
||||
array = heap_alloc_zero(sizeof(ArrayInstance));
|
||||
if(!array)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if(use_constr)
|
||||
hres = init_dispex_from_constr(&array->dispex, ctx, &Array_info, ctx->array_constr);
|
||||
else
|
||||
|
|
579
reactos/dll/win32/jscript/date.c
Normal file
579
reactos/dll/win32/jscript/date.c
Normal file
|
@ -0,0 +1,579 @@
|
|||
/*
|
||||
* Copyright 2008 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 <limits.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "jscript.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
||||
|
||||
typedef struct {
|
||||
DispatchEx dispex;
|
||||
|
||||
/* ECMA-262 3rd Edition 15.9.1.1 */
|
||||
DOUBLE time;
|
||||
} DateInstance;
|
||||
|
||||
static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
|
||||
static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0};
|
||||
static const WCHAR hasOwnPropertyW[] = {'h','a','s','O','w','n','P','r','o','p','e','r','t','y',0};
|
||||
static const WCHAR propertyIsEnumerableW[] =
|
||||
{'p','r','o','p','e','r','t','y','I','s','E','n','u','m','e','r','a','b','l','e',0};
|
||||
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 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 toLocaleTimeStringW[] = {'t','o','L','o','c','a','l','e','T','i','m','e','S','t','r','i','n','g',0};
|
||||
static const WCHAR getTimeW[] = {'g','e','t','T','i','m','e',0};
|
||||
static const WCHAR getFullYearW[] = {'g','e','t','F','u','l','l','Y','e','a','r',0};
|
||||
static const WCHAR getUTCFullYearW[] = {'g','e','t','U','T','C','F','u','l','l','Y','e','a','r',0};
|
||||
static const WCHAR getMonthW[] = {'g','e','t','M','o','n','t','h',0};
|
||||
static const WCHAR getUTCMonthW[] = {'g','e','t','U','T','C','M','o','n','t','h',0};
|
||||
static const WCHAR getDateW[] = {'g','e','t','D','a','t','e',0};
|
||||
static const WCHAR getUTCDateW[] = {'g','e','t','U','T','C','D','a','t','e',0};
|
||||
static const WCHAR getDayW[] = {'g','e','t','D','a','y',0};
|
||||
static const WCHAR getUTCDayW[] = {'g','e','t','U','T','C','D','a','y',0};
|
||||
static const WCHAR getHoursW[] = {'g','e','t','H','o','u','r','s',0};
|
||||
static const WCHAR getUTCHoursW[] = {'g','e','t','U','T','C','H','o','u','r','s',0};
|
||||
static const WCHAR getMinutesW[] = {'g','e','t','M','i','n','u','t','e','s',0};
|
||||
static const WCHAR getUTCMinutesW[] = {'g','e','t','U','T','C','M','i','n','u','t','e','s',0};
|
||||
static const WCHAR getSecondsW[] = {'g','e','t','S','e','c','o','n','d','s',0};
|
||||
static const WCHAR getUTCSecondsW[] = {'g','e','t','U','T','C','S','e','c','o','n','d','s',0};
|
||||
static const WCHAR getMilisecondsW[] = {'g','e','t','M','i','l','i','s','e','c','o','n','d','s',0};
|
||||
static const WCHAR getUTCMilisecondsW[] = {'g','e','t','U','T','C','M','i','l','i','s','e','c','o','n','d','s',0};
|
||||
static const WCHAR getTimezoneOffsetW[] = {'g','e','t','T','i','m','e','z','o','n','e','O','f','f','s','e','t',0};
|
||||
static const WCHAR setTimeW[] = {'s','e','t','T','i','m','e',0};
|
||||
static const WCHAR setMilisecondsW[] = {'s','e','t','M','i','l','i','s','e','c','o','n','d','s',0};
|
||||
static const WCHAR setUTCMilisecondsW[] = {'s','e','t','U','T','C','M','i','l','i','s','e','c','o','n','d','s',0};
|
||||
static const WCHAR setSecondsW[] = {'s','e','t','S','e','c','o','n','d','s',0};
|
||||
static const WCHAR setUTCSecondsW[] = {'s','e','t','U','T','C','S','e','c','o','n','d','s',0};
|
||||
static const WCHAR setMinutesW[] = {'s','e','t','M','i','n','u','t','e','s',0};
|
||||
static const WCHAR setUTCMinutesW[] = {'s','e','t','U','T','C','M','i','n','u','t','e','s',0};
|
||||
static const WCHAR setHoursW[] = {'s','e','t','H','o','u','r','s',0};
|
||||
static const WCHAR setUTCHoursW[] = {'s','e','t','H','o','u','r','s',0};
|
||||
static const WCHAR setDateW[] = {'s','e','t','D','a','t','e',0};
|
||||
static const WCHAR setUTCDateW[] = {'s','e','t','U','T','C','D','a','t','e',0};
|
||||
static const WCHAR setMonthW[] = {'s','e','t','M','o','n','t','h',0};
|
||||
static const WCHAR setUTCMonthW[] = {'s','e','t','U','T','C','M','o','n','t','h',0};
|
||||
static const WCHAR setFullYearW[] = {'s','e','t','F','u','l','l','Y','e','a','r',0};
|
||||
static const WCHAR setUTCFullYearW[] = {'s','e','t','U','T','C','F','u','l','l','Y','e','a','r',0};
|
||||
|
||||
/* ECMA-262 3rd Edition 15.9.1.14 */
|
||||
static inline DOUBLE time_clip(DOUBLE time)
|
||||
{
|
||||
/* FIXME: Handle inf */
|
||||
|
||||
if(8.64e15 < time || time < -8.64e15) {
|
||||
FIXME("return NaN\n");
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return floor(time);
|
||||
}
|
||||
|
||||
static HRESULT Date_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_hasOwnProperty(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_propertyIsEnumerable(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_toUTCString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_toDateString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_toTimeString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_toLocaleDateString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_toLocaleTimeString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.9.5.9 */
|
||||
static HRESULT Date_getTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
TRACE("\n");
|
||||
|
||||
if(!is_class(dispex, JSCLASS_DATE)) {
|
||||
FIXME("throw TypeError\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(retv) {
|
||||
DateInstance *date = (DateInstance*)dispex;
|
||||
num_set_val(retv, date->time);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Date_getFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getUTCFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getUTCMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getUTCDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getDay(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getUTCDay(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getUTCHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getUTCMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getUTCSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getMiliseconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getUTCMiliseconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_getTimezoneOffset(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setMiliseconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setUTCMiliseconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setUTCSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setUTCMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setUTCHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setUTCDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setUTCMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_setUTCFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Date_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const builtin_prop_t Date_props[] = {
|
||||
{getDateW, Date_getDate, PROPF_METHOD},
|
||||
{getDayW, Date_getDay, PROPF_METHOD},
|
||||
{getFullYearW, Date_getFullYear, PROPF_METHOD},
|
||||
{getHoursW, Date_getHours, PROPF_METHOD},
|
||||
{getMilisecondsW, Date_getMiliseconds, PROPF_METHOD},
|
||||
{getMinutesW, Date_getMinutes, PROPF_METHOD},
|
||||
{getMonthW, Date_getMonth, PROPF_METHOD},
|
||||
{getSecondsW, Date_getSeconds, PROPF_METHOD},
|
||||
{getTimeW, Date_getTime, PROPF_METHOD},
|
||||
{getTimezoneOffsetW, Date_getTimezoneOffset, PROPF_METHOD},
|
||||
{getUTCDateW, Date_getUTCDate, PROPF_METHOD},
|
||||
{getUTCDayW, Date_getUTCDay, PROPF_METHOD},
|
||||
{getUTCFullYearW, Date_getUTCFullYear, PROPF_METHOD},
|
||||
{getUTCHoursW, Date_getUTCHours, PROPF_METHOD},
|
||||
{getUTCMilisecondsW, Date_getUTCMiliseconds, PROPF_METHOD},
|
||||
{getUTCMinutesW, Date_getUTCMinutes, PROPF_METHOD},
|
||||
{getUTCMonthW, Date_getUTCMonth, PROPF_METHOD},
|
||||
{getUTCSecondsW, Date_getUTCSeconds, PROPF_METHOD},
|
||||
{hasOwnPropertyW, Date_hasOwnProperty, PROPF_METHOD},
|
||||
{isPrototypeOfW, Date_isPrototypeOf, PROPF_METHOD},
|
||||
{propertyIsEnumerableW, Date_propertyIsEnumerable, PROPF_METHOD},
|
||||
{setDateW, Date_setDate, PROPF_METHOD},
|
||||
{setFullYearW, Date_setFullYear, PROPF_METHOD},
|
||||
{setHoursW, Date_setHours, PROPF_METHOD},
|
||||
{setMilisecondsW, Date_setMiliseconds, PROPF_METHOD},
|
||||
{setMinutesW, Date_setMinutes, PROPF_METHOD},
|
||||
{setMonthW, Date_setMonth, PROPF_METHOD},
|
||||
{setSecondsW, Date_setSeconds, PROPF_METHOD},
|
||||
{setTimeW, Date_setTime, PROPF_METHOD},
|
||||
{setUTCDateW, Date_setUTCDate, PROPF_METHOD},
|
||||
{setUTCFullYearW, Date_setUTCFullYear, PROPF_METHOD},
|
||||
{setUTCHoursW, Date_setUTCHours, PROPF_METHOD},
|
||||
{setUTCMilisecondsW, Date_setUTCMiliseconds, PROPF_METHOD},
|
||||
{setUTCMinutesW, Date_setUTCMinutes, PROPF_METHOD},
|
||||
{setUTCMonthW, Date_setUTCMonth, PROPF_METHOD},
|
||||
{setUTCSecondsW, Date_setUTCSeconds, PROPF_METHOD},
|
||||
{toDateStringW, Date_toDateString, PROPF_METHOD},
|
||||
{toLocaleDateStringW, Date_toLocaleDateString, PROPF_METHOD},
|
||||
{toLocaleStringW, Date_toLocaleString, PROPF_METHOD},
|
||||
{toLocaleTimeStringW, Date_toLocaleTimeString, PROPF_METHOD},
|
||||
{toStringW, Date_toString, PROPF_METHOD},
|
||||
{toTimeStringW, Date_toTimeString, PROPF_METHOD},
|
||||
{toUTCStringW, Date_toUTCString, PROPF_METHOD},
|
||||
{valueOfW, Date_valueOf, PROPF_METHOD},
|
||||
};
|
||||
|
||||
static const builtin_info_t Date_info = {
|
||||
JSCLASS_DATE,
|
||||
{NULL, Date_value, 0},
|
||||
sizeof(Date_props)/sizeof(*Date_props),
|
||||
Date_props,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static HRESULT create_date(script_ctx_t *ctx, BOOL use_constr, DOUBLE time, DispatchEx **ret)
|
||||
{
|
||||
DateInstance *date;
|
||||
HRESULT hres;
|
||||
|
||||
date = heap_alloc_zero(sizeof(DateInstance));
|
||||
if(!date)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if(use_constr)
|
||||
hres = init_dispex_from_constr(&date->dispex, ctx, &Date_info, ctx->date_constr);
|
||||
else
|
||||
hres = init_dispex(&date->dispex, ctx, &Date_info, NULL);
|
||||
if(FAILED(hres)) {
|
||||
heap_free(date);
|
||||
return hres;
|
||||
}
|
||||
|
||||
date->time = time;
|
||||
|
||||
*ret = &date->dispex;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT DateConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
DispatchEx *date;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_CONSTRUCT:
|
||||
switch(arg_cnt(dp)) {
|
||||
/* ECMA-262 3rd Edition 15.9.3.3 */
|
||||
case 0: {
|
||||
FILETIME time;
|
||||
|
||||
GetSystemTimeAsFileTime(&time);
|
||||
|
||||
hres = create_date(dispex->ctx, TRUE,
|
||||
floor((DOUBLE)(time.dwLowDateTime/1e6) + (DOUBLE)time.dwHighDateTime*((DOUBLE)UINT_MAX+1.0)/1.e6),
|
||||
&date);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
break;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.9.3.2 */
|
||||
case 1: {
|
||||
VARIANT prim, num;
|
||||
|
||||
hres = to_primitive(dispex->ctx, get_arg(dp,0), ei, &prim);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(V_VT(&prim) == VT_BSTR) {
|
||||
FIXME("VT_BSTR not supported\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = to_number(dispex->ctx, &prim, ei, &num);
|
||||
VariantClear(&prim);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = create_date(dispex->ctx, TRUE, time_clip(num_val(&num)), &date);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
FIXME("unimplemented argcnt %d\n", arg_cnt(dp));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
V_VT(retv) = VT_DISPATCH;
|
||||
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(date);
|
||||
return S_OK;
|
||||
|
||||
default:
|
||||
FIXME("unimplemented flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT create_date_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||
{
|
||||
DispatchEx *date;
|
||||
HRESULT hres;
|
||||
|
||||
hres = create_date(ctx, FALSE, 0.0, &date);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = create_builtin_function(ctx, DateConstr_value, PROPF_CONSTR, date, ret);
|
||||
|
||||
jsdisp_release(date);
|
||||
return hres;
|
||||
}
|
|
@ -517,8 +517,6 @@ static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
|||
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
||||
{
|
||||
DispatchEx *This = DISPATCHEX_THIS(iface);
|
||||
dispex_prop_t *prop;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
|
||||
|
||||
|
@ -527,16 +525,7 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = find_prop_name_prot(This, bstrName, (grfdex&fdexNameEnsure) != 0, &prop);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
if(prop) {
|
||||
*pid = prop_to_id(This, prop);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
TRACE("not found %s\n", debugstr_w(bstrName));
|
||||
return DISP_E_UNKNOWNNAME;
|
||||
return jsdisp_get_id(This, bstrName, grfdex, pid);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
||||
|
@ -582,6 +571,15 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
|
|||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT delete_prop(dispex_prop_t *prop)
|
||||
{
|
||||
heap_free(prop->name);
|
||||
prop->name = NULL;
|
||||
prop->type = PROP_DELETED;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
|
||||
{
|
||||
DispatchEx *This = DISPATCHEX_THIS(iface);
|
||||
|
@ -601,17 +599,23 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bst
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
heap_free(prop->name);
|
||||
prop->name = NULL;
|
||||
prop->type = PROP_DELETED;
|
||||
return S_OK;
|
||||
return delete_prop(prop);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
|
||||
{
|
||||
DispatchEx *This = DISPATCHEX_THIS(iface);
|
||||
FIXME("(%p)->(%x)\n", This, id);
|
||||
return E_NOTIMPL;
|
||||
dispex_prop_t *prop;
|
||||
|
||||
TRACE("(%p)->(%x)\n", This, id);
|
||||
|
||||
prop = get_prop(This, id);
|
||||
if(!prop) {
|
||||
WARN("invalid id\n");
|
||||
return DISP_E_MEMBERNOTFOUND;
|
||||
}
|
||||
|
||||
return delete_prop(prop);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
|
||||
|
@ -698,23 +702,6 @@ static IDispatchExVtbl DispatchExVtbl = {
|
|||
DispatchEx_GetNameSpaceParent
|
||||
};
|
||||
|
||||
HRESULT jsdisp_set_prototype(DispatchEx *dispex, DispatchEx *prototype)
|
||||
{
|
||||
VARIANT *var;
|
||||
|
||||
if(!dispex->props[1].name)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
dispex->props[1].type = PROP_VARIANT;
|
||||
dispex->props[1].flags = 0;
|
||||
|
||||
var = &dispex->props[1].u.var;
|
||||
V_VT(var) = VT_DISPATCH;
|
||||
V_DISPATCH(var) = (IDispatch*)_IDispatchEx_(prototype);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT init_dispex(DispatchEx *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, DispatchEx *prototype)
|
||||
{
|
||||
TRACE("%p (%p)\n", dispex, prototype);
|
||||
|
@ -817,13 +804,31 @@ DispatchEx *iface_to_jsdisp(IUnknown *iface)
|
|||
return ret;
|
||||
}
|
||||
|
||||
HRESULT jsdisp_get_id(DispatchEx *jsdisp, const WCHAR *name, DWORD flags, DISPID *id)
|
||||
{
|
||||
dispex_prop_t *prop;
|
||||
HRESULT hres;
|
||||
|
||||
hres = find_prop_name_prot(jsdisp, name, (flags&fdexNameEnsure) != 0, &prop);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(prop) {
|
||||
*id = prop_to_id(jsdisp, prop);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
TRACE("not found %s\n", debugstr_w(name));
|
||||
return DISP_E_UNKNOWNNAME;
|
||||
}
|
||||
|
||||
HRESULT jsdisp_call_value(DispatchEx *disp, LCID lcid, 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);
|
||||
}
|
||||
|
||||
HRESULT jsdisp_call(DispatchEx *disp, DISPID id, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv,
|
||||
static HRESULT jsdisp_call(DispatchEx *disp, DISPID id, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv,
|
||||
jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
dispex_prop_t *prop;
|
||||
|
@ -861,6 +866,11 @@ HRESULT disp_call(IDispatch *disp, DISPID id, LCID lcid, WORD flags, DISPPARAMS
|
|||
if(FAILED(hres)) {
|
||||
UINT err = 0;
|
||||
|
||||
if(flags == DISPATCH_CONSTRUCT) {
|
||||
WARN("IDispatch cannot be constructor\n");
|
||||
return DISP_E_MEMBERNOTFOUND;
|
||||
}
|
||||
|
||||
TRACE("using IDispatch\n");
|
||||
return IDispatch_Invoke(disp, id, &IID_NULL, lcid, flags, dp, retv, &ei->ei, &err);
|
||||
}
|
||||
|
@ -931,6 +941,48 @@ HRESULT disp_propput(IDispatch *disp, DISPID id, LCID lcid, VARIANT *val, jsexce
|
|||
return hres;
|
||||
}
|
||||
|
||||
HRESULT jsdisp_propget_name(DispatchEx *obj, const WCHAR *name, LCID lcid, VARIANT *var,
|
||||
jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
DISPPARAMS dp = {NULL, NULL, 0, 0};
|
||||
dispex_prop_t *prop;
|
||||
HRESULT hres;
|
||||
|
||||
hres = find_prop_name_prot(obj, name, FALSE, &prop);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(var) = VT_EMPTY;
|
||||
if(!prop)
|
||||
return S_OK;
|
||||
|
||||
return prop_get(obj, prop, lcid, &dp, var, ei, caller);
|
||||
}
|
||||
|
||||
HRESULT jsdisp_propget_idx(DispatchEx *obj, DWORD idx, LCID lcid, 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);
|
||||
}
|
||||
|
||||
HRESULT jsdisp_propget(DispatchEx *jsdisp, DISPID id, LCID lcid, VARIANT *val, jsexcept_t *ei,
|
||||
IServiceProvider *caller)
|
||||
{
|
||||
DISPPARAMS dp = {NULL,NULL,0,0};
|
||||
dispex_prop_t *prop;
|
||||
|
||||
prop = get_prop(jsdisp, id);
|
||||
if(!prop)
|
||||
return DISP_E_MEMBERNOTFOUND;
|
||||
|
||||
V_VT(val) = VT_EMPTY;
|
||||
return prop_get(jsdisp, prop, lcid, &dp, val, ei, caller);
|
||||
}
|
||||
|
||||
HRESULT disp_propget(IDispatch *disp, DISPID id, LCID lcid, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
DISPPARAMS dp = {NULL,NULL,0,0};
|
||||
|
@ -940,14 +992,7 @@ HRESULT disp_propget(IDispatch *disp, DISPID id, LCID lcid, VARIANT *val, jsexce
|
|||
|
||||
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
||||
if(jsdisp) {
|
||||
dispex_prop_t *prop;
|
||||
|
||||
prop = get_prop(jsdisp, id);
|
||||
if(prop)
|
||||
hres = prop_get(jsdisp, prop, lcid, &dp, val, ei, caller);
|
||||
else
|
||||
hres = DISP_E_MEMBERNOTFOUND;
|
||||
|
||||
hres = jsdisp_propget(jsdisp, id, lcid, val, ei, caller);
|
||||
IDispatchEx_Release(_IDispatchEx_(jsdisp));
|
||||
return hres;
|
||||
}
|
||||
|
@ -956,8 +1001,8 @@ HRESULT disp_propget(IDispatch *disp, DISPID id, LCID lcid, VARIANT *val, jsexce
|
|||
if(FAILED(hres)) {
|
||||
ULONG err = 0;
|
||||
|
||||
TRACE("uding IDispatch\n");
|
||||
return IDispatchEx_Invoke(dispex, id, &IID_NULL, lcid, INVOKE_PROPERTYGET, &dp, val, &ei->ei, &err);
|
||||
TRACE("using IDispatch\n");
|
||||
return IDispatch_Invoke(disp, id, &IID_NULL, lcid, INVOKE_PROPERTYGET, &dp, val, &ei->ei, &err);
|
||||
}
|
||||
|
||||
hres = IDispatchEx_InvokeEx(dispex, id, lcid, INVOKE_PROPERTYGET, &dp, val, &ei->ei, caller);
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "jscript.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
@ -203,13 +208,6 @@ void exec_release(exec_ctx_t *ctx)
|
|||
heap_free(ctx);
|
||||
}
|
||||
|
||||
static HRESULT dispex_get_id(IDispatchEx *dispex, BSTR name, DWORD flags, DISPID *id)
|
||||
{
|
||||
*id = 0;
|
||||
|
||||
return IDispatchEx_GetDispID(dispex, name, flags|fdexNameCaseSensitive, id);
|
||||
}
|
||||
|
||||
static HRESULT disp_get_id(IDispatch *disp, BSTR name, DWORD flags, DISPID *id)
|
||||
{
|
||||
IDispatchEx *dispex;
|
||||
|
@ -223,7 +221,8 @@ static HRESULT disp_get_id(IDispatch *disp, BSTR name, DWORD flags, DISPID *id)
|
|||
return IDispatch_GetIDsOfNames(disp, &IID_NULL, &name, 1, 0, id);
|
||||
}
|
||||
|
||||
hres = dispex_get_id(dispex, name, flags, id);
|
||||
*id = 0;
|
||||
hres = IDispatchEx_GetDispID(dispex, name, flags|fdexNameCaseSensitive, id);
|
||||
IDispatchEx_Release(dispex);
|
||||
return hres;
|
||||
}
|
||||
|
@ -278,18 +277,8 @@ static HRESULT disp_cmp(IDispatch *disp1, IDispatch *disp2, BOOL *ret)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static inline BOOL is_num_vt(enum VARENUM vt)
|
||||
{
|
||||
return vt == VT_I4 || vt == VT_R8;
|
||||
}
|
||||
|
||||
static inline DOUBLE num_val(const VARIANT *v)
|
||||
{
|
||||
return V_VT(v) == VT_I4 ? V_I4(v) : V_R8(v);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.9.6 */
|
||||
HRESULT equal2_values(VARIANT *lval, VARIANT *rval, BOOL *ret)
|
||||
static HRESULT equal2_values(VARIANT *lval, VARIANT *rval, BOOL *ret)
|
||||
{
|
||||
TRACE("\n");
|
||||
|
||||
|
@ -367,6 +356,7 @@ HRESULT exec_source(exec_ctx_t *ctx, parser_ctx_t *parser, source_elements_t *so
|
|||
script_ctx_t *script = parser->script;
|
||||
function_declaration_t *func;
|
||||
parser_ctx_t *prev_parser;
|
||||
var_list_t *var;
|
||||
VARIANT val, tmp;
|
||||
statement_t *stat;
|
||||
exec_ctx_t *prev_ctx;
|
||||
|
@ -377,14 +367,23 @@ HRESULT exec_source(exec_ctx_t *ctx, parser_ctx_t *parser, source_elements_t *so
|
|||
DispatchEx *func_obj;
|
||||
VARIANT var;
|
||||
|
||||
hres = create_source_function(parser, func->parameter_list, func->source_elements, ctx->scope_chain, &func_obj);
|
||||
hres = create_source_function(parser, func->expr->parameter_list, func->expr->source_elements,
|
||||
ctx->scope_chain, func->expr->src_str, func->expr->src_len, &func_obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(&var) = VT_DISPATCH;
|
||||
V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(func_obj);
|
||||
hres = jsdisp_propput_name(ctx->var_disp, func->identifier, script->lcid, &var, ei, NULL);
|
||||
IDispatchEx_Release(_IDispatchEx_(func_obj));
|
||||
hres = jsdisp_propput_name(ctx->var_disp, func->expr->identifier, script->lcid, &var, ei, NULL);
|
||||
jsdisp_release(func_obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
for(var = source->variables; var; var = var->next) {
|
||||
DISPID id = 0;
|
||||
|
||||
hres = jsdisp_get_id(ctx->var_disp, var->identifier, fdexNameEnsure, &id);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
@ -442,7 +441,7 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, ex
|
|||
TRACE("%s\n", debugstr_w(identifier));
|
||||
|
||||
for(scope = ctx->scope_chain; scope; scope = scope->next) {
|
||||
hres = dispex_get_id(_IDispatchEx_(scope->obj), identifier, 0, &id);
|
||||
hres = jsdisp_get_id(scope->obj, identifier, 0, &id);
|
||||
if(SUCCEEDED(hres))
|
||||
break;
|
||||
}
|
||||
|
@ -452,31 +451,64 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, ex
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
hres = dispex_get_id(_IDispatchEx_(ctx->parser->script->global), identifier, 0, &id);
|
||||
hres = jsdisp_get_id(ctx->parser->script->global, identifier, 0, &id);
|
||||
if(SUCCEEDED(hres)) {
|
||||
exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->parser->script->global), id);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
for(item = ctx->parser->script->named_items; item; item = item->next) {
|
||||
hres = disp_get_id(item->disp, identifier, 0, &id);
|
||||
if(SUCCEEDED(hres))
|
||||
break;
|
||||
if((item->flags & SCRIPTITEM_ISVISIBLE) && !strcmpW(item->name, identifier)) {
|
||||
if(!item->disp) {
|
||||
IUnknown *unk;
|
||||
|
||||
if(!ctx->parser->script->site)
|
||||
break;
|
||||
|
||||
hres = IActiveScriptSite_GetItemInfo(ctx->parser->script->site, identifier,
|
||||
SCRIPTINFO_IUNKNOWN, &unk, NULL);
|
||||
if(FAILED(hres)) {
|
||||
WARN("GetItemInfo failed: %08x\n", hres);
|
||||
break;
|
||||
}
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&item->disp);
|
||||
IUnknown_Release(unk);
|
||||
if(FAILED(hres)) {
|
||||
WARN("object does not implement IDispatch\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret->type = EXPRVAL_VARIANT;
|
||||
V_VT(&ret->u.var) = VT_DISPATCH;
|
||||
V_DISPATCH(&ret->u.var) = item->disp;
|
||||
IDispatch_AddRef(item->disp);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
for(item = ctx->parser->script->named_items; item; item = item->next) {
|
||||
if(item->flags & SCRIPTITEM_GLOBALMEMBERS) {
|
||||
hres = disp_get_id(item->disp, identifier, 0, &id);
|
||||
if(SUCCEEDED(hres))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(item) {
|
||||
exprval_set_idref(ret, (IDispatch*)item->disp, id);
|
||||
exprval_set_idref(ret, item->disp, id);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = dispex_get_id(_IDispatchEx_(ctx->parser->script->script_disp), identifier, 0, &id);
|
||||
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(flags & EXPR_NEWREF) {
|
||||
hres = dispex_get_id(_IDispatchEx_(ctx->var_disp), identifier, fdexNameEnsure, &id);
|
||||
hres = jsdisp_get_id(ctx->var_disp, identifier, fdexNameEnsure, &id);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
@ -523,25 +555,23 @@ HRESULT block_statement_eval(exec_ctx_t *ctx, statement_t *_stat, return_type_t
|
|||
static HRESULT variable_list_eval(exec_ctx_t *ctx, variable_declaration_t *var_list, jsexcept_t *ei)
|
||||
{
|
||||
variable_declaration_t *iter;
|
||||
HRESULT hres = E_FAIL;
|
||||
HRESULT hres = S_OK;
|
||||
|
||||
for(iter = var_list; iter; iter = iter->next) {
|
||||
exprval_t exprval;
|
||||
VARIANT val;
|
||||
|
||||
if(iter->expr) {
|
||||
exprval_t exprval;
|
||||
if(!iter->expr)
|
||||
continue;
|
||||
|
||||
hres = expr_eval(ctx, iter->expr, 0, ei, &exprval);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
hres = expr_eval(ctx, iter->expr, 0, ei, &exprval);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
hres = exprval_to_value(ctx->parser->script, &exprval, ei, &val);
|
||||
exprval_release(&exprval);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
}else {
|
||||
V_VT(&val) = VT_EMPTY;
|
||||
}
|
||||
hres = exprval_to_value(ctx->parser->script, &exprval, ei, &val);
|
||||
exprval_release(&exprval);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
hres = jsdisp_propput_name(ctx->var_disp, iter->identifier, ctx->parser->script->lcid, &val, ei, NULL/*FIXME*/);
|
||||
VariantClear(&val);
|
||||
|
@ -793,9 +823,10 @@ HRESULT forin_statement_eval(exec_ctx_t *ctx, statement_t *_stat, return_type_t
|
|||
return hres;
|
||||
|
||||
if(V_VT(&val) != VT_DISPATCH) {
|
||||
FIXME("in vt %d\n", V_VT(&val));
|
||||
TRACE("in vt %d\n", V_VT(&val));
|
||||
VariantClear(&val);
|
||||
return E_NOTIMPL;
|
||||
V_VT(ret) = VT_EMPTY;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = IDispatch_QueryInterface(V_DISPATCH(&val), &IID_IDispatchEx, (void**)&in_obj);
|
||||
|
@ -959,7 +990,8 @@ HRESULT with_statement_eval(exec_ctx_t *ctx, statement_t *_stat, return_type_t *
|
|||
|
||||
hres = scope_push(ctx->scope_chain, obj, &ctx->scope_chain);
|
||||
jsdisp_release(obj);
|
||||
if(FAILED(hres));
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = stat_eval(ctx, stat->statement, rt, ret);
|
||||
|
||||
|
@ -1245,25 +1277,25 @@ static HRESULT assign_oper_eval(exec_ctx_t *ctx, expression_t *lexpr, expression
|
|||
HRESULT function_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
||||
{
|
||||
function_expression_t *expr = (function_expression_t*)_expr;
|
||||
DispatchEx *dispex;
|
||||
VARIANT var;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
hres = create_source_function(ctx->parser, expr->parameter_list, expr->source_elements, ctx->scope_chain, &dispex);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(&var) = VT_DISPATCH;
|
||||
V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(dispex);
|
||||
|
||||
if(expr->identifier) {
|
||||
hres = jsdisp_propput_name(ctx->var_disp, expr->identifier, ctx->parser->script->lcid, &var, ei, NULL/*FIXME*/);
|
||||
if(FAILED(hres)) {
|
||||
jsdisp_release(dispex);
|
||||
hres = jsdisp_propget_name(ctx->var_disp, expr->identifier, ctx->parser->script->lcid, &var, ei, NULL/*FIXME*/);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
}else {
|
||||
DispatchEx *dispex;
|
||||
|
||||
hres = create_source_function(ctx->parser, expr->parameter_list, expr->source_elements, ctx->scope_chain,
|
||||
expr->src_str, expr->src_len, &dispex);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(&var) = VT_DISPATCH;
|
||||
V_DISPATCH(&var) = (IDispatch*)_IDispatchEx_(dispex);
|
||||
}
|
||||
|
||||
ret->type = EXPRVAL_VARIANT;
|
||||
|
@ -1490,7 +1522,7 @@ HRESULT new_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, j
|
|||
HRESULT call_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
||||
{
|
||||
call_expression_t *expr = (call_expression_t*)_expr;
|
||||
VARIANT func, var;
|
||||
VARIANT var;
|
||||
exprval_t exprval;
|
||||
DISPPARAMS dp;
|
||||
HRESULT hres;
|
||||
|
@ -1511,7 +1543,7 @@ HRESULT call_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags,
|
|||
V_VT(&var) = VT_EMPTY;
|
||||
break;
|
||||
default:
|
||||
FIXME("unimplemented type %d\n", V_VT(&func));
|
||||
FIXME("unimplemented type %d\n", exprval.type);
|
||||
hres = E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -1936,9 +1968,9 @@ static HRESULT add_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_
|
|||
memcpy(V_BSTR(retv)+len1, rstr, (len2+1)*sizeof(WCHAR));
|
||||
}
|
||||
|
||||
if(lstr && V_VT(&l) != VT_BSTR)
|
||||
if(V_VT(&l) != VT_BSTR)
|
||||
SysFreeString(lstr);
|
||||
if(rstr && V_VT(&r) != VT_BSTR)
|
||||
if(V_VT(&r) != VT_BSTR)
|
||||
SysFreeString(rstr);
|
||||
}else {
|
||||
VARIANT nl, nr;
|
||||
|
@ -2051,10 +2083,31 @@ HRESULT div_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, j
|
|||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.5.3 */
|
||||
HRESULT mod_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
||||
static HRESULT mod_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_t *ei, VARIANT *retv)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT lnum, rnum;
|
||||
HRESULT hres;
|
||||
|
||||
hres = to_number(ctx->parser->script, lval, ei, &lnum);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = to_number(ctx->parser->script, rval, ei, &rnum);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
num_set_val(retv, fmod(num_val(&lnum), num_val(&rnum)));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.5.3 */
|
||||
HRESULT mod_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, mod_eval, ei, ret);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.4.2 */
|
||||
|
@ -2072,6 +2125,17 @@ HRESULT delete_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags
|
|||
return hres;
|
||||
|
||||
switch(exprval.type) {
|
||||
case EXPRVAL_IDREF: {
|
||||
IDispatchEx *dispex;
|
||||
|
||||
hres = IDispatch_QueryInterface(exprval.u.nameref.disp, &IID_IDispatchEx, (void**)&dispex);
|
||||
if(SUCCEEDED(hres)) {
|
||||
hres = IDispatchEx_DeleteMemberByDispID(dispex, exprval.u.idref.id);
|
||||
b = VARIANT_TRUE;
|
||||
IDispatchEx_Release(dispex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EXPRVAL_NAMEREF: {
|
||||
IDispatchEx *dispex;
|
||||
|
||||
|
@ -2179,12 +2243,11 @@ HRESULT typeof_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags
|
|||
}
|
||||
default:
|
||||
FIXME("unhandled vt %d\n", V_VT(&val));
|
||||
hres = E_NOTIMPL;
|
||||
VariantClear(&val);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
VariantClear(&val);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
ret->type = EXPRVAL_VARIANT;
|
||||
V_VT(&ret->u.var) = VT_BSTR;
|
||||
|
@ -2570,7 +2633,7 @@ HRESULT not_equal2_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD f
|
|||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.8.5 */
|
||||
static HRESULT less_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_t *ei, BOOL *ret)
|
||||
static HRESULT less_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, BOOL greater, jsexcept_t *ei, BOOL *ret)
|
||||
{
|
||||
VARIANT l, r, ln, rn;
|
||||
HRESULT hres;
|
||||
|
@ -2586,7 +2649,7 @@ static HRESULT less_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept
|
|||
}
|
||||
|
||||
if(V_VT(&l) == VT_BSTR && V_VT(&r) == VT_BSTR) {
|
||||
*ret = strcmpW(V_BSTR(&l), V_BSTR(&r)) < 0;
|
||||
*ret = (strcmpW(V_BSTR(&l), V_BSTR(&r)) < 0) ^ greater;
|
||||
SysFreeString(V_BSTR(&l));
|
||||
SysFreeString(V_BSTR(&r));
|
||||
return S_OK;
|
||||
|
@ -2600,10 +2663,14 @@ static HRESULT less_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(V_VT(&ln) == VT_I4 && V_VT(&rn) == VT_I4)
|
||||
*ret = V_I4(&ln) < V_I4(&rn);
|
||||
else
|
||||
*ret = num_val(&ln) < num_val(&rn);
|
||||
if(V_VT(&ln) == VT_I4 && V_VT(&rn) == VT_I4) {
|
||||
*ret = (V_I4(&ln) < V_I4(&rn)) ^ greater;
|
||||
}else {
|
||||
DOUBLE ld = num_val(&ln);
|
||||
DOUBLE rd = num_val(&rn);
|
||||
|
||||
*ret = !isnan(ld) && !isnan(rd) && ((ld < rd) ^ greater);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -2622,7 +2689,7 @@ HRESULT less_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags,
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = less_eval(ctx, &lval, &rval, ei, &b);
|
||||
hres = less_eval(ctx, &lval, &rval, FALSE, ei, &b);
|
||||
VariantClear(&lval);
|
||||
VariantClear(&rval);
|
||||
if(FAILED(hres))
|
||||
|
@ -2645,13 +2712,13 @@ HRESULT lesseq_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = less_eval(ctx, &rval, &lval, ei, &b);
|
||||
hres = less_eval(ctx, &rval, &lval, TRUE, ei, &b);
|
||||
VariantClear(&lval);
|
||||
VariantClear(&rval);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return return_bool(ret, !b);
|
||||
return return_bool(ret, b);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.8.2 */
|
||||
|
@ -2668,7 +2735,7 @@ HRESULT greater_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flag
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = less_eval(ctx, &rval, &lval, ei, &b);
|
||||
hres = less_eval(ctx, &rval, &lval, FALSE, ei, &b);
|
||||
VariantClear(&lval);
|
||||
VariantClear(&rval);
|
||||
if(FAILED(hres))
|
||||
|
@ -2691,13 +2758,13 @@ HRESULT greatereq_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD fl
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = less_eval(ctx, &lval, &rval, ei, &b);
|
||||
hres = less_eval(ctx, &lval, &rval, TRUE, ei, &b);
|
||||
VariantClear(&lval);
|
||||
VariantClear(&rval);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return return_bool(ret, !b);
|
||||
return return_bool(ret, b);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.4.8 */
|
||||
|
@ -2865,10 +2932,8 @@ HRESULT assign_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags
|
|||
hres = put_value(ctx->parser->script, &exprval, &rval, ei);
|
||||
|
||||
exprval_release(&exprval);
|
||||
if(FAILED(hres)) {
|
||||
VariantClear(&rval);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
ret->type = EXPRVAL_VARIANT;
|
||||
ret->u.var = rval;
|
||||
|
@ -2946,10 +3011,13 @@ HRESULT assign_div_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD f
|
|||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.13.2 */
|
||||
HRESULT assign_mod_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
||||
HRESULT assign_mod_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
binary_expression_t *expr = (binary_expression_t*)_expr;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
return assign_oper_eval(ctx, expr->expression1, expr->expression2, mod_eval, ei, ret);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.13.2 */
|
||||
|
|
|
@ -17,12 +17,34 @@
|
|||
*/
|
||||
|
||||
typedef struct _source_elements_t source_elements_t;
|
||||
typedef struct _function_expression_t function_expression_t;
|
||||
|
||||
typedef struct _obj_literal_t {
|
||||
DispatchEx *obj;
|
||||
struct _obj_literal_t *next;
|
||||
} obj_literal_t;
|
||||
|
||||
typedef struct _function_declaration_t {
|
||||
function_expression_t *expr;
|
||||
|
||||
struct _function_declaration_t *next;
|
||||
} function_declaration_t;
|
||||
|
||||
typedef struct _var_list_t {
|
||||
const WCHAR *identifier;
|
||||
|
||||
struct _var_list_t *next;
|
||||
} var_list_t;
|
||||
|
||||
typedef struct _func_stack {
|
||||
function_declaration_t *func_head;
|
||||
function_declaration_t *func_tail;
|
||||
var_list_t *var_head;
|
||||
var_list_t *var_tail;
|
||||
|
||||
struct _func_stack *next;
|
||||
} func_stack_t;
|
||||
|
||||
typedef struct _parser_ctx_t {
|
||||
LONG ref;
|
||||
|
||||
|
@ -38,6 +60,7 @@ typedef struct _parser_ctx_t {
|
|||
jsheap_t heap;
|
||||
|
||||
obj_literal_t *obj_literals;
|
||||
func_stack_t *func_stack;
|
||||
|
||||
struct _parser_ctx_t *next;
|
||||
} parser_ctx_t;
|
||||
|
@ -98,7 +121,8 @@ typedef struct _statement_t statement_t;
|
|||
typedef struct _expression_t expression_t;
|
||||
typedef struct _parameter_t parameter_t;
|
||||
|
||||
HRESULT create_source_function(parser_ctx_t*,parameter_t*,source_elements_t*,scope_chain_t*,DispatchEx**);
|
||||
HRESULT create_source_function(parser_ctx_t*,parameter_t*,source_elements_t*,scope_chain_t*,
|
||||
const WCHAR*,DWORD,DispatchEx**);
|
||||
|
||||
typedef struct {
|
||||
VARTYPE vt;
|
||||
|
@ -273,27 +297,21 @@ struct _parameter_t {
|
|||
struct _parameter_t *next;
|
||||
};
|
||||
|
||||
typedef struct _function_declaration_t {
|
||||
const WCHAR *identifier;
|
||||
parameter_t *parameter_list;
|
||||
source_elements_t *source_elements;
|
||||
|
||||
struct _function_declaration_t *next;
|
||||
} function_declaration_t;
|
||||
|
||||
struct _source_elements_t {
|
||||
statement_t *statement;
|
||||
statement_t *statement_tail;
|
||||
function_declaration_t *functions;
|
||||
function_declaration_t *functions_tail;
|
||||
var_list_t *variables;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct _function_expression_t {
|
||||
expression_t expr;
|
||||
const WCHAR *identifier;
|
||||
parameter_t *parameter_list;
|
||||
source_elements_t *source_elements;
|
||||
} function_expression_t;
|
||||
const WCHAR *src_str;
|
||||
DWORD src_len;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
expression_t expr;
|
||||
|
|
|
@ -31,6 +31,8 @@ typedef struct {
|
|||
parameter_t *parameters;
|
||||
scope_chain_t *scope_chain;
|
||||
parser_ctx_t *parser;
|
||||
const WCHAR *src_str;
|
||||
DWORD src_len;
|
||||
DWORD length;
|
||||
} FunctionInstance;
|
||||
|
||||
|
@ -189,7 +191,6 @@ static HRESULT invoke_constructor(FunctionInstance *function, LCID lcid, DISPPAR
|
|||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
DispatchEx *this_obj;
|
||||
VARIANT var;
|
||||
HRESULT hres;
|
||||
|
||||
hres = create_object(function->dispex.ctx, &function->dispex, &this_obj);
|
||||
|
@ -201,7 +202,6 @@ static HRESULT invoke_constructor(FunctionInstance *function, LCID lcid, DISPPAR
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
VariantClear(&var);
|
||||
V_VT(retv) = VT_DISPATCH;
|
||||
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(this_obj);
|
||||
return S_OK;
|
||||
|
@ -226,6 +226,23 @@ static HRESULT invoke_value_proc(FunctionInstance *function, LCID lcid, WORD fla
|
|||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT function_to_string(FunctionInstance *function, BSTR *ret)
|
||||
{
|
||||
BSTR str;
|
||||
|
||||
if(function->value_proc) {
|
||||
FIXME("Builtin functions not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
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,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
|
@ -249,8 +266,30 @@ static HRESULT Function_length(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
|
|||
static HRESULT Function_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
FunctionInstance *function;
|
||||
BSTR str;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(!is_class(dispex, JSCLASS_FUNCTION)) {
|
||||
FIXME("throw TypeError\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
function = (FunctionInstance*)dispex;
|
||||
|
||||
hres = function_to_string(function, &str);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_BSTR;
|
||||
V_BSTR(retv) = str;
|
||||
}else {
|
||||
SysFreeString(str);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Function_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -323,6 +362,19 @@ static HRESULT Function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR
|
|||
|
||||
return invoke_function(function, lcid, dp, retv, ei, caller);
|
||||
|
||||
case DISPATCH_PROPERTYGET: {
|
||||
HRESULT hres;
|
||||
BSTR str;
|
||||
|
||||
hres = function_to_string(function, &str);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(retv) = VT_BSTR;
|
||||
V_BSTR(retv) = str;
|
||||
break;
|
||||
}
|
||||
|
||||
case DISPATCH_CONSTRUCT:
|
||||
if(function->value_proc)
|
||||
return invoke_value_proc(function, lcid, flags, dp, retv, ei, caller);
|
||||
|
@ -438,7 +490,7 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
|
|||
}
|
||||
|
||||
HRESULT create_source_function(parser_ctx_t *ctx, parameter_t *parameters, source_elements_t *source,
|
||||
scope_chain_t *scope_chain, DispatchEx **ret)
|
||||
scope_chain_t *scope_chain, const WCHAR *src_str, DWORD src_len, DispatchEx **ret)
|
||||
{
|
||||
FunctionInstance *function;
|
||||
DispatchEx *prototype;
|
||||
|
@ -470,6 +522,9 @@ HRESULT create_source_function(parser_ctx_t *ctx, parameter_t *parameters, sourc
|
|||
length++;
|
||||
function->length = length;
|
||||
|
||||
function->src_str = src_str;
|
||||
function->src_len = src_len;
|
||||
|
||||
*ret = &function->dispex;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "jscript.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
@ -43,7 +48,7 @@ static const WCHAR isFiniteW[] = {'i','s','F','i','n','i','t','e',0};
|
|||
static const WCHAR parseIntW[] = {'p','a','r','s','e','I','n','t',0};
|
||||
static const WCHAR parseFloatW[] = {'p','a','r','s','e','F','l','o','a','t',0};
|
||||
static const WCHAR unescapeW[] = {'u','n','e','s','c','a','p','e',0};
|
||||
static const WCHAR GetObjectW[] = {'G','e','t','O','b','j','e','c','t',0};
|
||||
static const WCHAR _GetObjectW[] = {'G','e','t','O','b','j','e','c','t',0};
|
||||
static const WCHAR ScriptEngineW[] = {'S','c','r','i','p','t','E','n','g','i','n','e',0};
|
||||
static const WCHAR ScriptEngineMajorVersionW[] =
|
||||
{'S','c','r','i','p','t','E','n','g','i','n','e','M','a','j','o','r','V','e','r','s','i','o','n',0};
|
||||
|
@ -53,6 +58,40 @@ static const WCHAR ScriptEngineBuildVersionW[] =
|
|||
{'S','c','r','i','p','t','E','n','g','i','n','e','B','u','i','l','d','V','e','r','s','i','o','n',0};
|
||||
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 undefinedW[] = {'u','n','d','e','f','i','n','e','d',0};
|
||||
|
||||
static int uri_char_table[] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 00-0f */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 10-1f */
|
||||
0,2,0,0,1,0,1,2,2,2,2,1,1,2,2,1, /* 20-2f */
|
||||
2,2,2,2,2,2,2,2,2,2,1,1,0,1,0,1, /* 30-3f */
|
||||
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, /* 40-4f */
|
||||
2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,2, /* 50-5f */
|
||||
0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, /* 60-6f */
|
||||
2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,0, /* 70-7f */
|
||||
};
|
||||
|
||||
/* 1 - reserved */
|
||||
/* 2 - unescaped */
|
||||
|
||||
static inline BOOL is_uri_reserved(WCHAR c)
|
||||
{
|
||||
return c < 128 && uri_char_table[c] == 1;
|
||||
}
|
||||
|
||||
static inline BOOL is_uri_unescaped(WCHAR c)
|
||||
{
|
||||
return c < 128 && uri_char_table[c] == 2;
|
||||
}
|
||||
|
||||
static WCHAR int_to_char(int i)
|
||||
{
|
||||
if(i < 10)
|
||||
return '0'+i;
|
||||
return 'A'+i-10;
|
||||
}
|
||||
|
||||
static HRESULT constructor_call(DispatchEx *constr, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
|
@ -69,15 +108,37 @@ static HRESULT constructor_call(DispatchEx *constr, LCID lcid, WORD flags, DISPP
|
|||
static HRESULT JSGlobal_NaN(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_PROPERTYGET:
|
||||
num_set_nan(retv);
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("unimplemented flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT JSGlobal_Infinity(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_PROPERTYGET:
|
||||
num_set_inf(retv, TRUE);
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("unimplemented flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT JSGlobal_Array(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -99,8 +160,9 @@ static HRESULT JSGlobal_Boolean(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
|
|||
static HRESULT JSGlobal_Date(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
return constructor_call(dispex->ctx->date_constr, lcid, flags, dp, retv, ei, sp);
|
||||
}
|
||||
|
||||
static HRESULT JSGlobal_Function(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -204,7 +266,7 @@ static HRESULT JSGlobal_eval(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
|
|||
TRACE("parsing %s\n", debugstr_w(V_BSTR(arg)));
|
||||
hres = script_parse(dispex->ctx, V_BSTR(arg), &parser_ctx);
|
||||
if(FAILED(hres)) {
|
||||
FIXME("parse failed: %08x\n", hres);
|
||||
WARN("parse (%s) failed: %08x\n", debugstr_w(V_BSTR(arg)), hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
@ -217,21 +279,133 @@ static HRESULT JSGlobal_eval(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
|
|||
static HRESULT JSGlobal_isNaN(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT_BOOL ret = VARIANT_FALSE;
|
||||
VARIANT num;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(arg_cnt(dp)) {
|
||||
hres = to_number(dispex->ctx, get_arg(dp,0), ei, &num);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(V_VT(&num) == VT_R8 && isnan(V_R8(&num)))
|
||||
ret = VARIANT_TRUE;
|
||||
}else {
|
||||
ret = VARIANT_TRUE;
|
||||
}
|
||||
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_BOOL;
|
||||
V_BOOL(retv) = ret;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT JSGlobal_isFinite(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT_BOOL ret = VARIANT_FALSE;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(arg_cnt(dp)) {
|
||||
VARIANT num;
|
||||
|
||||
hres = to_number(dispex->ctx, get_arg(dp,0), ei, &num);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(V_VT(&num) != VT_R8 || (!isinf(V_R8(&num)) && !isnan(V_R8(&num))))
|
||||
ret = VARIANT_TRUE;
|
||||
}
|
||||
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_BOOL;
|
||||
V_BOOL(retv) = ret;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static INT char_to_int(WCHAR c)
|
||||
{
|
||||
if('0' <= c && c <= '9')
|
||||
return c - '0';
|
||||
if('a' <= c && c <= 'z')
|
||||
return c - 'a' + 10;
|
||||
if('A' <= c && c <= 'Z')
|
||||
return c - 'A' + 10;
|
||||
return 100;
|
||||
}
|
||||
|
||||
static HRESULT JSGlobal_parseInt(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
DOUBLE ret = 0.0;
|
||||
INT radix=10, i;
|
||||
WCHAR *ptr;
|
||||
BOOL neg = FALSE;
|
||||
BSTR str;
|
||||
HRESULT hres;
|
||||
|
||||
if(!arg_cnt(dp)) {
|
||||
FIXME("NAN\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if(arg_cnt(dp) >= 2) {
|
||||
hres = to_int32(dispex->ctx, get_arg(dp, 1), ei, &radix);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(!radix) {
|
||||
radix = 10;
|
||||
}else if(radix < 2 || radix > 36) {
|
||||
WARN("radix %d out of range\n", radix);
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
hres = to_string(dispex->ctx, get_arg(dp, 0), ei, &str);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
for(ptr = str; isspaceW(*ptr); ptr++);
|
||||
|
||||
switch(*ptr) {
|
||||
case '+':
|
||||
ptr++;
|
||||
break;
|
||||
case '-':
|
||||
neg = TRUE;
|
||||
ptr++;
|
||||
break;
|
||||
case '0':
|
||||
ptr++;
|
||||
if(*ptr == 'x' || *ptr == 'X') {
|
||||
radix = 16;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
while(*ptr) {
|
||||
i = char_to_int(*ptr++);
|
||||
if(i > radix)
|
||||
break;
|
||||
|
||||
ret = ret*radix + i;
|
||||
}
|
||||
|
||||
SysFreeString(str);
|
||||
|
||||
if(neg)
|
||||
ret = -ret;
|
||||
|
||||
if(retv)
|
||||
num_set_val(retv, ret);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT JSGlobal_parseFloat(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -290,6 +464,76 @@ static HRESULT JSGlobal_CollectGarbage(DispatchEx *dispex, LCID lcid, WORD flags
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT JSGlobal_encodeURI(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
const WCHAR *ptr;
|
||||
DWORD len = 0, i;
|
||||
char buf[4];
|
||||
BSTR str, ret;
|
||||
WCHAR *rptr;
|
||||
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(dispex->ctx, get_arg(dp,0), ei, &str);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
for(ptr = str; *ptr; ptr++) {
|
||||
if(is_uri_unescaped(*ptr) || is_uri_reserved(*ptr) || *ptr == '#') {
|
||||
len++;
|
||||
}else {
|
||||
i = WideCharToMultiByte(CP_UTF8, 0, ptr, 1, NULL, 0, NULL, NULL)*3;
|
||||
if(!i) {
|
||||
FIXME("throw URIError\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
len += i;
|
||||
}
|
||||
}
|
||||
|
||||
rptr = ret = SysAllocStringLen(NULL, len);
|
||||
if(!ret)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
for(ptr = str; *ptr; ptr++) {
|
||||
if(is_uri_unescaped(*ptr) || is_uri_reserved(*ptr) || *ptr == '#') {
|
||||
*rptr++ = *ptr;
|
||||
}else {
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, ptr, 1, buf, sizeof(buf), NULL, NULL);
|
||||
for(i=0; i<len; i++) {
|
||||
*rptr++ = '%';
|
||||
*rptr++ = int_to_char((BYTE)buf[i] >> 4);
|
||||
*rptr++ = int_to_char(buf[i] & 0x0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("%s -> %s\n", debugstr_w(str), debugstr_w(ret));
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_BSTR;
|
||||
V_BSTR(retv) = ret;
|
||||
}else {
|
||||
SysFreeString(ret);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const builtin_prop_t JSGlobal_props[] = {
|
||||
{ActiveXObjectW, JSGlobal_ActiveXObject, PROPF_METHOD},
|
||||
{ArrayW, JSGlobal_Array, PROPF_CONSTR},
|
||||
|
@ -298,7 +542,7 @@ static const builtin_prop_t JSGlobal_props[] = {
|
|||
{DateW, JSGlobal_Date, PROPF_CONSTR},
|
||||
{EnumeratorW, JSGlobal_Enumerator, PROPF_METHOD},
|
||||
{FunctionW, JSGlobal_Function, PROPF_CONSTR},
|
||||
{GetObjectW, JSGlobal_GetObject, PROPF_METHOD},
|
||||
{_GetObjectW, JSGlobal_GetObject, PROPF_METHOD},
|
||||
{InfinityW, JSGlobal_Infinity, 0},
|
||||
/* {MathW, JSGlobal_Math, 0}, */
|
||||
{NaNW, JSGlobal_NaN, 0},
|
||||
|
@ -311,6 +555,7 @@ static const builtin_prop_t JSGlobal_props[] = {
|
|||
{ScriptEngineMinorVersionW, JSGlobal_ScriptEngineMinorVersion, PROPF_METHOD},
|
||||
{StringW, JSGlobal_String, PROPF_CONSTR},
|
||||
{VBArrayW, JSGlobal_VBArray, PROPF_METHOD},
|
||||
{encodeURIW, JSGlobal_encodeURI, PROPF_METHOD},
|
||||
{escapeW, JSGlobal_escape, PROPF_METHOD},
|
||||
{evalW, JSGlobal_eval, PROPF_METHOD|1},
|
||||
{isFiniteW, JSGlobal_isFinite, PROPF_METHOD},
|
||||
|
@ -345,6 +590,10 @@ static HRESULT init_constructors(script_ctx_t *ctx)
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = create_date_constr(ctx, &ctx->date_constr);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = create_number_constr(ctx, &ctx->number_constr);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
@ -353,7 +602,7 @@ static HRESULT init_constructors(script_ctx_t *ctx)
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = create_object_constr(ctx, &ctx->regexp_constr);
|
||||
hres = create_regexp_constr(ctx, &ctx->regexp_constr);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
|
|
@ -24,6 +24,20 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
||||
|
||||
#ifdef _WIN64
|
||||
|
||||
#define CTXARG_T DWORDLONG
|
||||
#define IActiveScriptParseVtbl IActiveScriptParse64Vtbl
|
||||
#define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_64Vtbl
|
||||
|
||||
#else
|
||||
|
||||
#define CTXARG_T DWORD
|
||||
#define IActiveScriptParseVtbl IActiveScriptParse32Vtbl
|
||||
#define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_32Vtbl
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
const IActiveScriptVtbl *lpIActiveScriptVtbl;
|
||||
const IActiveScriptParseVtbl *lpIActiveScriptParseVtbl;
|
||||
|
@ -36,6 +50,7 @@ typedef struct {
|
|||
DWORD safeopt;
|
||||
script_ctx_t *ctx;
|
||||
LONG thread_id;
|
||||
LCID lcid;
|
||||
|
||||
IActiveScriptSite *site;
|
||||
|
||||
|
@ -43,11 +58,11 @@ typedef struct {
|
|||
parser_ctx_t *queue_tail;
|
||||
} JScript;
|
||||
|
||||
#define ACTSCRIPT(x) ((IActiveScript*) &(x)->lpIActiveScriptVtbl)
|
||||
#define ASPARSE(x) ((IActiveScriptParse*) &(x)->lpIActiveScriptParseVtbl)
|
||||
#define ASPARSEPROC(x) ((IActiveScriptParseProcedure2*) &(x)->lpIActiveScriptParseProcedure2Vtbl)
|
||||
#define ACTSCPPROP(x) ((IActiveScriptProperty*) &(x)->lpIActiveScriptPropertyVtbl)
|
||||
#define OBJSAFETY(x) ((IObjectSafety*) &(x)->lpIObjectSafetyVtbl)
|
||||
#define ACTSCRIPT(x) ((IActiveScript*) &(x)->lpIActiveScriptVtbl)
|
||||
#define ASPARSE(x) (&(x)->lpIActiveScriptParseVtbl)
|
||||
#define ASPARSEPROC(x) (&(x)->lpIActiveScriptParseProcedure2Vtbl)
|
||||
#define ACTSCPPROP(x) (&(x)->lpIActiveScriptPropertyVtbl)
|
||||
#define OBJSAFETY(x) (&(x)->lpIObjectSafetyVtbl)
|
||||
|
||||
void script_release(script_ctx_t *ctx)
|
||||
{
|
||||
|
@ -127,6 +142,29 @@ static void exec_queued_code(JScript *This)
|
|||
clear_script_queue(This);
|
||||
}
|
||||
|
||||
static HRESULT set_ctx_site(JScript *This)
|
||||
{
|
||||
HRESULT 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;
|
||||
|
||||
IActiveScriptSite_AddRef(This->site);
|
||||
This->ctx->site = This->site;
|
||||
|
||||
change_state(This, SCRIPTSTATE_INITIALIZED);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#define ACTSCRIPT_THIS(iface) DEFINE_THIS(JScript, IActiveScript, iface)
|
||||
|
||||
static HRESULT WINAPI JScript_QueryInterface(IActiveScript *iface, REFIID riid, void **ppv)
|
||||
|
@ -211,22 +249,6 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface,
|
|||
if(This->site)
|
||||
return E_UNEXPECTED;
|
||||
|
||||
if(!This->ctx) {
|
||||
hres = IActiveScriptParse_InitNew(ASPARSE(This));
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if(InterlockedCompareExchange(&This->thread_id, GetCurrentThreadId(), 0))
|
||||
return E_UNEXPECTED;
|
||||
|
||||
|
@ -235,10 +257,9 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface,
|
|||
|
||||
hres = IActiveScriptSite_GetLCID(This->site, &lcid);
|
||||
if(hres == S_OK)
|
||||
This->ctx->lcid = lcid;
|
||||
This->lcid = lcid;
|
||||
|
||||
change_state(This, SCRIPTSTATE_INITIALIZED);
|
||||
return S_OK;
|
||||
return This->ctx ? set_ctx_site(This) : S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JScript_GetScriptSite(IActiveScript *iface, REFIID riid,
|
||||
|
@ -260,6 +281,7 @@ static HRESULT WINAPI JScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE s
|
|||
|
||||
switch(ss) {
|
||||
case SCRIPTSTATE_STARTED:
|
||||
case SCRIPTSTATE_CONNECTED: /* FIXME */
|
||||
if(This->ctx->state == SCRIPTSTATE_CLOSED)
|
||||
return E_UNEXPECTED;
|
||||
|
||||
|
@ -304,25 +326,39 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface)
|
|||
if(This->thread_id != GetCurrentThreadId())
|
||||
return E_UNEXPECTED;
|
||||
|
||||
clear_script_queue(This);
|
||||
if(This->ctx) {
|
||||
if(This->ctx->state == SCRIPTSTATE_CONNECTED)
|
||||
change_state(This, SCRIPTSTATE_DISCONNECTED);
|
||||
|
||||
if(This->ctx->named_items) {
|
||||
named_item_t *iter, *iter2;
|
||||
clear_script_queue(This);
|
||||
|
||||
iter = This->ctx->named_items;
|
||||
while(iter) {
|
||||
iter2 = iter->next;
|
||||
if(This->ctx->state == SCRIPTSTATE_DISCONNECTED)
|
||||
change_state(This, SCRIPTSTATE_INITIALIZED);
|
||||
|
||||
IDispatch_Release(iter->disp);
|
||||
heap_free(iter);
|
||||
iter = iter2;
|
||||
if(This->ctx->named_items) {
|
||||
named_item_t *iter, *iter2;
|
||||
|
||||
iter = This->ctx->named_items;
|
||||
while(iter) {
|
||||
iter2 = iter->next;
|
||||
|
||||
if(iter->disp)
|
||||
IDispatch_Release(iter->disp);
|
||||
heap_free(iter->name);
|
||||
heap_free(iter);
|
||||
iter = iter2;
|
||||
}
|
||||
|
||||
This->ctx->named_items = NULL;
|
||||
}
|
||||
|
||||
This->ctx->named_items = NULL;
|
||||
}
|
||||
if(This->ctx->site) {
|
||||
IActiveScriptSite_Release(This->ctx->site);
|
||||
This->ctx->site = NULL;
|
||||
}
|
||||
|
||||
if(This->ctx) {
|
||||
change_state(This, SCRIPTSTATE_CLOSED);
|
||||
if (This->site)
|
||||
change_state(This, SCRIPTSTATE_CLOSED);
|
||||
|
||||
if(This->ctx->script_disp) {
|
||||
IDispatchEx_Release(_IDispatchEx_(This->ctx->script_disp));
|
||||
|
@ -348,8 +384,7 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface,
|
|||
{
|
||||
JScript *This = ACTSCRIPT_THIS(iface);
|
||||
named_item_t *item;
|
||||
IDispatch *disp;
|
||||
IUnknown *unk;
|
||||
IDispatch *disp = NULL;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %x)\n", This, debugstr_w(pstrName), dwFlags);
|
||||
|
@ -357,27 +392,39 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface,
|
|||
if(This->thread_id != GetCurrentThreadId() || !This->ctx || This->ctx->state == SCRIPTSTATE_CLOSED)
|
||||
return E_UNEXPECTED;
|
||||
|
||||
hres = IActiveScriptSite_GetItemInfo(This->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL);
|
||||
if(FAILED(hres)) {
|
||||
WARN("GetItemInfo failed: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
if(dwFlags & SCRIPTITEM_GLOBALMEMBERS) {
|
||||
IUnknown *unk;
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp);
|
||||
IUnknown_Release(unk);
|
||||
if(FAILED(hres)) {
|
||||
WARN("object does not implement IDispatch\n");
|
||||
return hres;
|
||||
hres = IActiveScriptSite_GetItemInfo(This->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL);
|
||||
if(FAILED(hres)) {
|
||||
WARN("GetItemInfo failed: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp);
|
||||
IUnknown_Release(unk);
|
||||
if(FAILED(hres)) {
|
||||
WARN("object does not implement IDispatch\n");
|
||||
return hres;
|
||||
}
|
||||
}
|
||||
|
||||
item = heap_alloc(sizeof(*item));
|
||||
if(!item) {
|
||||
IDispatch_Release(disp);
|
||||
if(disp)
|
||||
IDispatch_Release(disp);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
item->disp = disp;
|
||||
item->flags = dwFlags;
|
||||
item->name = heap_strdupW(pstrName);
|
||||
if(!item->name) {
|
||||
IDispatch_Release(disp);
|
||||
heap_free(item);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
item->next = This->ctx->named_items;
|
||||
This->ctx->named_items = item;
|
||||
|
||||
|
@ -516,35 +563,35 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
|
|||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
return This->site ? set_ctx_site(This) : S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JScriptParse_AddScriptlet(IActiveScriptParse *iface,
|
||||
LPCOLESTR pstrDefaultName, LPCOLESTR pstrCode, LPCOLESTR pstrItemName,
|
||||
LPCOLESTR pstrSubItemName, LPCOLESTR pstrEventName, LPCOLESTR pstrDelimiter,
|
||||
DWORD dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags,
|
||||
CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags,
|
||||
BSTR *pbstrName, EXCEPINFO *pexcepinfo)
|
||||
{
|
||||
JScript *This = ASPARSE_THIS(iface);
|
||||
FIXME("(%p)->(%s %s %s %s %s %s %x %u %x %p %p)\n", This, debugstr_w(pstrDefaultName),
|
||||
FIXME("(%p)->(%s %s %s %s %s %s %s %u %x %p %p)\n", This, debugstr_w(pstrDefaultName),
|
||||
debugstr_w(pstrCode), debugstr_w(pstrItemName), debugstr_w(pstrSubItemName),
|
||||
debugstr_w(pstrEventName), debugstr_w(pstrDelimiter), dwSourceContextCookie,
|
||||
debugstr_w(pstrEventName), debugstr_w(pstrDelimiter), wine_dbgstr_longlong(dwSourceContextCookie),
|
||||
ulStartingLineNumber, dwFlags, pbstrName, pexcepinfo);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
|
||||
LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext,
|
||||
LPCOLESTR pstrDelimiter, DWORD dwSourceContextCookie, ULONG ulStartingLine,
|
||||
LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine,
|
||||
DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
|
||||
{
|
||||
JScript *This = ASPARSE_THIS(iface);
|
||||
parser_ctx_t *parser_ctx;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %s %p %s %x %u %x %p %p)\n", This, debugstr_w(pstrCode),
|
||||
TRACE("(%p)->(%s %s %p %s %s %u %x %p %p)\n", This, debugstr_w(pstrCode),
|
||||
debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
|
||||
dwSourceContextCookie, ulStartingLine, dwFlags, pvarResult, pexcepinfo);
|
||||
wine_dbgstr_longlong(dwSourceContextCookie), ulStartingLine, dwFlags, pvarResult, pexcepinfo);
|
||||
|
||||
if(This->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED)
|
||||
return E_UNEXPECTED;
|
||||
|
@ -601,16 +648,16 @@ static ULONG WINAPI JScriptParseProcedure_Release(IActiveScriptParseProcedure2 *
|
|||
static HRESULT WINAPI JScriptParseProcedure_ParseProcedureText(IActiveScriptParseProcedure2 *iface,
|
||||
LPCOLESTR pstrCode, LPCOLESTR pstrFormalParams, LPCOLESTR pstrProcedureName,
|
||||
LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter,
|
||||
DWORD dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, IDispatch **ppdisp)
|
||||
CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, IDispatch **ppdisp)
|
||||
{
|
||||
JScript *This = ASPARSEPROC_THIS(iface);
|
||||
parser_ctx_t *parser_ctx;
|
||||
DispatchEx *dispex;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %s %s %s %p %s %x %u %x %p)\n", This, debugstr_w(pstrCode), debugstr_w(pstrFormalParams),
|
||||
TRACE("(%p)->(%s %s %s %s %p %s %s %u %x %p)\n", This, debugstr_w(pstrCode), debugstr_w(pstrFormalParams),
|
||||
debugstr_w(pstrProcedureName), debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
|
||||
dwSourceContextCookie, ulStartingLineNumber, dwFlags, ppdisp);
|
||||
wine_dbgstr_longlong(dwSourceContextCookie), ulStartingLineNumber, dwFlags, ppdisp);
|
||||
|
||||
if(This->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED)
|
||||
return E_UNEXPECTED;
|
||||
|
@ -621,7 +668,7 @@ static HRESULT WINAPI JScriptParseProcedure_ParseProcedureText(IActiveScriptPars
|
|||
return hres;
|
||||
}
|
||||
|
||||
hres = create_source_function(parser_ctx, NULL, parser_ctx->source, NULL, &dispex);
|
||||
hres = create_source_function(parser_ctx, NULL, parser_ctx->source, NULL, NULL, 0, &dispex);
|
||||
parser_release(parser_ctx);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
@ -758,6 +805,8 @@ HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUn
|
|||
lock_module();
|
||||
|
||||
ret = heap_alloc_zero(sizeof(*ret));
|
||||
if(!ret)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
ret->lpIActiveScriptVtbl = &JScriptVtbl;
|
||||
ret->lpIActiveScriptParseVtbl = &JScriptParseVtbl;
|
||||
|
|
|
@ -67,6 +67,7 @@ typedef enum {
|
|||
JSCLASS_NONE,
|
||||
JSCLASS_ARRAY,
|
||||
JSCLASS_BOOLEAN,
|
||||
JSCLASS_DATE,
|
||||
JSCLASS_FUNCTION,
|
||||
JSCLASS_GLOBAL,
|
||||
JSCLASS_MATH,
|
||||
|
@ -124,8 +125,12 @@ HRESULT disp_call(IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,I
|
|||
HRESULT jsdisp_call_value(DispatchEx*,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 jsdisp_get_id(DispatchEx*,const WCHAR*,DWORD,DISPID*);
|
||||
|
||||
HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,DWORD,DispatchEx*,DispatchEx**);
|
||||
|
||||
|
@ -149,6 +154,7 @@ HRESULT to_object(exec_ctx_t*,VARIANT*,IDispatch**);
|
|||
typedef struct named_item_t {
|
||||
IDispatch *disp;
|
||||
DWORD flags;
|
||||
LPWSTR name;
|
||||
|
||||
struct named_item_t *next;
|
||||
} named_item_t;
|
||||
|
@ -159,6 +165,7 @@ struct _script_ctx_t {
|
|||
SCRIPTSTATE state;
|
||||
exec_ctx_t *exec_ctx;
|
||||
named_item_t *named_items;
|
||||
IActiveScriptSite *site;
|
||||
LCID lcid;
|
||||
|
||||
jsheap_t tmp_heap;
|
||||
|
@ -168,6 +175,7 @@ struct _script_ctx_t {
|
|||
DispatchEx *function_constr;
|
||||
DispatchEx *array_constr;
|
||||
DispatchEx *bool_constr;
|
||||
DispatchEx *date_constr;
|
||||
DispatchEx *number_constr;
|
||||
DispatchEx *object_constr;
|
||||
DispatchEx *regexp_constr;
|
||||
|
@ -186,6 +194,7 @@ HRESULT init_function_constr(script_ctx_t*);
|
|||
|
||||
HRESULT create_array_constr(script_ctx_t*,DispatchEx**);
|
||||
HRESULT create_bool_constr(script_ctx_t*,DispatchEx**);
|
||||
HRESULT create_date_constr(script_ctx_t*,DispatchEx**);
|
||||
HRESULT create_number_constr(script_ctx_t*,DispatchEx**);
|
||||
HRESULT create_object_constr(script_ctx_t*,DispatchEx**);
|
||||
HRESULT create_regexp_constr(script_ctx_t*,DispatchEx**);
|
||||
|
@ -196,6 +205,8 @@ typedef struct {
|
|||
DWORD len;
|
||||
} match_result_t;
|
||||
|
||||
HRESULT regexp_match_next(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*);
|
||||
|
||||
static inline VARIANT *get_arg(DISPPARAMS *dp, DWORD i)
|
||||
|
@ -208,6 +219,21 @@ static inline DWORD arg_cnt(const DISPPARAMS *dp)
|
|||
return dp->cArgs - dp->cNamedArgs;
|
||||
}
|
||||
|
||||
static inline BOOL is_class(DispatchEx *jsdisp, jsclass_t class)
|
||||
{
|
||||
return jsdisp->builtin_info->class == class;
|
||||
}
|
||||
|
||||
static inline BOOL is_num_vt(enum VARENUM vt)
|
||||
{
|
||||
return vt == VT_I4 || vt == VT_R8;
|
||||
}
|
||||
|
||||
static inline DOUBLE num_val(const VARIANT *v)
|
||||
{
|
||||
return V_VT(v) == VT_I4 ? V_I4(v) : V_R8(v);
|
||||
}
|
||||
|
||||
static inline void num_set_val(VARIANT *v, DOUBLE d)
|
||||
{
|
||||
if(d == (DOUBLE)(INT)d) {
|
||||
|
@ -219,6 +245,28 @@ static inline void num_set_val(VARIANT *v, DOUBLE d)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void num_set_nan(VARIANT *v)
|
||||
{
|
||||
V_VT(v) = VT_R8;
|
||||
#ifdef NAN
|
||||
V_R8(v) = NAN;
|
||||
#else
|
||||
V_UI8(v) = (ULONGLONG)0x7ff80000<<32;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void num_set_inf(VARIANT *v, BOOL positive)
|
||||
{
|
||||
V_VT(v) = VT_R8;
|
||||
#ifdef INFINITY
|
||||
V_R8(v) = positive ? INFINITY : -INFINITY;
|
||||
#else
|
||||
V_UI8(v) = (ULONGLONG)0x7ff00000<<32;
|
||||
if(!positive)
|
||||
V_R8(v) = -V_R8(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *debugstr_variant(const VARIANT*);
|
||||
|
||||
HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
<library>wine</library>
|
||||
<library>kernel32</library>
|
||||
<library>oleaut32</library>
|
||||
<library>advapi32</library>
|
||||
<file>date.c</file>
|
||||
<file>dispex.c</file>
|
||||
<file>engine.c</file>
|
||||
<file>jscript.c</file>
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "jscript.h"
|
||||
|
@ -217,10 +220,117 @@ HRESULT to_boolean(VARIANT *v, VARIANT_BOOL *b)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static int hex_to_int(WCHAR c)
|
||||
{
|
||||
if('0' <= c && c <= '9')
|
||||
return c-'0';
|
||||
|
||||
if('a' <= c && c <= 'f')
|
||||
return c-'a'+10;
|
||||
|
||||
if('A' <= c && c <= 'F')
|
||||
return c-'A'+10;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 9.3.1 */
|
||||
static HRESULT str_to_number(BSTR str, VARIANT *ret)
|
||||
{
|
||||
const WCHAR *ptr = str;
|
||||
BOOL neg = FALSE;
|
||||
DOUBLE d = 0.0;
|
||||
|
||||
static const WCHAR infinityW[] = {'I','n','f','i','n','i','t','y'};
|
||||
|
||||
while(isspaceW(*ptr))
|
||||
ptr++;
|
||||
|
||||
if(*ptr == '-') {
|
||||
neg = TRUE;
|
||||
ptr++;
|
||||
}else if(*ptr == '+') {
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if(!strncmpW(ptr, infinityW, sizeof(infinityW)/sizeof(WCHAR))) {
|
||||
ptr += sizeof(infinityW)/sizeof(WCHAR);
|
||||
while(*ptr && isspaceW(*ptr))
|
||||
ptr++;
|
||||
|
||||
if(*ptr)
|
||||
num_set_nan(ret);
|
||||
else
|
||||
num_set_inf(ret, !neg);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if(*ptr == '0' && ptr[1] == 'x') {
|
||||
DWORD l = 0;
|
||||
|
||||
ptr += 2;
|
||||
while((l = hex_to_int(*ptr)) != -1) {
|
||||
d = d*16 + l;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
num_set_val(ret, d);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
while(isdigitW(*ptr))
|
||||
d = d*10 + (*ptr++ - '0');
|
||||
|
||||
if(*ptr == 'e' || *ptr == 'E') {
|
||||
BOOL eneg = FALSE;
|
||||
LONG l = 0;
|
||||
|
||||
ptr++;
|
||||
if(*ptr == '-') {
|
||||
ptr++;
|
||||
eneg = TRUE;
|
||||
}else if(*ptr == '+') {
|
||||
ptr++;
|
||||
}
|
||||
|
||||
while(isdigitW(*ptr))
|
||||
l = l*10 + (*ptr++ - '0');
|
||||
if(eneg)
|
||||
l = -l;
|
||||
|
||||
d *= pow(10, l);
|
||||
}else if(*ptr == '.') {
|
||||
DOUBLE dec = 0.1;
|
||||
|
||||
ptr++;
|
||||
while(isdigitW(*ptr)) {
|
||||
d += dec * (*ptr++ - '0');
|
||||
dec *= 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
while(isspaceW(*ptr))
|
||||
ptr++;
|
||||
|
||||
if(*ptr) {
|
||||
num_set_nan(ret);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if(neg)
|
||||
d = -d;
|
||||
|
||||
num_set_val(ret, d);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 9.3 */
|
||||
HRESULT to_number(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret)
|
||||
{
|
||||
switch(V_VT(v)) {
|
||||
case VT_EMPTY:
|
||||
num_set_nan(ret);
|
||||
break;
|
||||
case VT_NULL:
|
||||
V_VT(ret) = VT_I4;
|
||||
V_I4(ret) = 0;
|
||||
|
@ -229,6 +339,20 @@ HRESULT to_number(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret)
|
|||
case VT_R8:
|
||||
*ret = *v;
|
||||
break;
|
||||
case VT_BSTR:
|
||||
return str_to_number(V_BSTR(v), ret);
|
||||
case VT_DISPATCH: {
|
||||
VARIANT prim;
|
||||
HRESULT hres;
|
||||
|
||||
hres = to_primitive(ctx, v, ei, &prim);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = to_number(ctx, &prim, ei, ret);
|
||||
VariantClear(&prim);
|
||||
return hres;
|
||||
}
|
||||
case VT_BOOL:
|
||||
V_VT(ret) = VT_I4;
|
||||
V_I4(ret) = V_BOOL(v) ? 1 : 0;
|
||||
|
@ -252,7 +376,7 @@ HRESULT to_integer(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret)
|
|||
return hres;
|
||||
|
||||
if(V_VT(&num) == VT_I4)
|
||||
*ret = *v;
|
||||
*ret = num;
|
||||
else
|
||||
num_set_val(ret, V_R8(&num) >= 0.0 ? floor(V_R8(&num)) : -floor(-V_R8(&num)));
|
||||
|
||||
|
@ -335,6 +459,18 @@ HRESULT to_string(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, BSTR *str)
|
|||
case VT_I4:
|
||||
*str = int_to_bstr(V_I4(v));
|
||||
break;
|
||||
case VT_R8: {
|
||||
VARIANT strv;
|
||||
HRESULT hres;
|
||||
|
||||
V_VT(&strv) = VT_EMPTY;
|
||||
hres = VariantChangeTypeEx(&strv, v, MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, VT_BSTR);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
*str = V_BSTR(&strv);
|
||||
return S_OK;
|
||||
}
|
||||
case VT_BSTR:
|
||||
*str = SysAllocString(V_BSTR(v));
|
||||
break;
|
||||
|
|
|
@ -101,7 +101,7 @@ static int lex_error(parser_ctx_t *ctx, HRESULT hres)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word)
|
||||
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
|
||||
{
|
||||
const WCHAR *p1 = ctx->ptr;
|
||||
const WCHAR *p2 = word;
|
||||
|
@ -116,6 +116,7 @@ static int check_keyword(parser_ctx_t *ctx, const WCHAR *word)
|
|||
if(*p2 || (p1 < ctx->end && isalnumW(*p1)))
|
||||
return 1;
|
||||
|
||||
*lval = ctx->ptr;
|
||||
ctx->ptr = p1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -145,14 +146,14 @@ static int hex_to_int(WCHAR c)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int check_keywords(parser_ctx_t *ctx)
|
||||
static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval)
|
||||
{
|
||||
int min = 0, max = sizeof(keywords)/sizeof(keywords[0])-1, r, i;
|
||||
|
||||
while(min <= max) {
|
||||
i = (min+max)/2;
|
||||
|
||||
r = check_keyword(ctx, keywords[i].word);
|
||||
r = check_keyword(ctx, keywords[i].word, lval);
|
||||
if(!r)
|
||||
return keywords[i].token;
|
||||
|
||||
|
@ -242,13 +243,11 @@ static BOOL unescape(WCHAR *str)
|
|||
case 'r':
|
||||
c = '\r';
|
||||
break;
|
||||
case '0':
|
||||
break;
|
||||
case 'x':
|
||||
i = hex_to_int(*++p);
|
||||
if(i == -1)
|
||||
return FALSE;
|
||||
c = i << 16;
|
||||
c = i << 4;
|
||||
|
||||
i = hex_to_int(*++p);
|
||||
if(i == -1)
|
||||
|
@ -259,17 +258,17 @@ static BOOL unescape(WCHAR *str)
|
|||
i = hex_to_int(*++p);
|
||||
if(i == -1)
|
||||
return FALSE;
|
||||
c = i << 24;
|
||||
c = i << 12;
|
||||
|
||||
i = hex_to_int(*++p);
|
||||
if(i == -1)
|
||||
return FALSE;
|
||||
c += i << 16;
|
||||
c += i << 8;
|
||||
|
||||
i = hex_to_int(*++p);
|
||||
if(i == -1)
|
||||
return FALSE;
|
||||
c += 1 << 8;
|
||||
c += 1 << 4;
|
||||
|
||||
i = hex_to_int(*++p);
|
||||
if(i == -1)
|
||||
|
@ -277,6 +276,14 @@ static BOOL unescape(WCHAR *str)
|
|||
c += i;
|
||||
break;
|
||||
default:
|
||||
if(isdigitW(*p)) {
|
||||
c = *p++ - '0';
|
||||
while(isdigitW(*p))
|
||||
c = c*10 + (*p++ - '0');
|
||||
*pd++ = c;
|
||||
continue;
|
||||
}
|
||||
|
||||
c = *p;
|
||||
}
|
||||
|
||||
|
@ -387,7 +394,7 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
|
|||
e = e*10 + *ctx->ptr++ - '0';
|
||||
e *= sign;
|
||||
|
||||
d = pow(d, e);
|
||||
d *= pow(10, e);
|
||||
}
|
||||
|
||||
*literal = parser_alloc(ctx, sizeof(literal_t));
|
||||
|
@ -468,11 +475,11 @@ int parser_lex(void *lval, parser_ctx_t *ctx)
|
|||
}while(skip_comment(ctx));
|
||||
|
||||
if(isalphaW(*ctx->ptr)) {
|
||||
ret = check_keywords(ctx);
|
||||
ret = check_keywords(ctx, lval);
|
||||
if(ret)
|
||||
return ret;
|
||||
|
||||
return parse_identifier(ctx, (const WCHAR**)lval);
|
||||
return parse_identifier(ctx, lval);
|
||||
}
|
||||
|
||||
if(isdigitW(*ctx->ptr))
|
||||
|
@ -480,7 +487,6 @@ int parser_lex(void *lval, parser_ctx_t *ctx)
|
|||
|
||||
switch(*ctx->ptr) {
|
||||
case '{':
|
||||
case '}':
|
||||
case '(':
|
||||
case ')':
|
||||
case '[':
|
||||
|
@ -492,6 +498,10 @@ int parser_lex(void *lval, parser_ctx_t *ctx)
|
|||
case ':':
|
||||
return *ctx->ptr++;
|
||||
|
||||
case '}':
|
||||
*(const WCHAR**)lval = ctx->ptr++;
|
||||
return '}';
|
||||
|
||||
case '.':
|
||||
if(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr))
|
||||
return parse_double_literal(ctx, 0, lval);
|
||||
|
@ -674,7 +684,7 @@ int parser_lex(void *lval, parser_ctx_t *ctx)
|
|||
|
||||
case '\"':
|
||||
case '\'':
|
||||
return parse_string_literal(ctx, (const WCHAR**)lval, *ctx->ptr);
|
||||
return parse_string_literal(ctx, lval, *ctx->ptr);
|
||||
|
||||
case '_':
|
||||
case '$':
|
||||
|
@ -705,8 +715,10 @@ literal_t *parse_regexp(parser_ctx_t *ctx)
|
|||
TRACE("\n");
|
||||
|
||||
re = ctx->ptr;
|
||||
while(ctx->ptr < ctx->end && (*ctx->ptr != '/' || *(ctx->ptr-1) == '\\'))
|
||||
ctx->ptr++;
|
||||
while(ctx->ptr < ctx->end && *ctx->ptr != '/') {
|
||||
if(*ctx->ptr++ == '\\' && ctx->ptr < ctx->end)
|
||||
ctx->ptr++;
|
||||
}
|
||||
|
||||
if(ctx->ptr == ctx->end) {
|
||||
WARN("unexpected end of file\n");
|
||||
|
|
|
@ -16,7 +16,14 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "jscript.h"
|
||||
#include "ntsecapi.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -24,7 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
|||
|
||||
static const WCHAR EW[] = {'E',0};
|
||||
static const WCHAR LOG2EW[] = {'L','O','G','2','E',0};
|
||||
static const WCHAR LOG10EW[] = {'L','O','G','1','0',0};
|
||||
static const WCHAR LOG10EW[] = {'L','O','G','1','0','E',0};
|
||||
static const WCHAR LN2W[] = {'L','N','2',0};
|
||||
static const WCHAR LN10W[] = {'L','N','1','0',0};
|
||||
static const WCHAR PIW[] = {'P','I',0};
|
||||
|
@ -49,25 +56,43 @@ static const WCHAR sinW[] = {'s','i','n',0};
|
|||
static const WCHAR sqrtW[] = {'s','q','r','t',0};
|
||||
static const WCHAR tanW[] = {'t','a','n',0};
|
||||
|
||||
static HRESULT math_constant(DOUBLE val, WORD flags, VARIANT *retv)
|
||||
{
|
||||
switch(flags) {
|
||||
case DISPATCH_PROPERTYGET:
|
||||
V_VT(retv) = VT_R8;
|
||||
V_R8(retv) = val;
|
||||
return S_OK;
|
||||
case DISPATCH_PROPERTYPUT:
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
FIXME("unhandled flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.1.1 */
|
||||
static HRESULT Math_E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
return math_constant(M_E, flags, retv);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.1.4 */
|
||||
static HRESULT Math_LOG2E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
return math_constant(M_LOG2E, flags, retv);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.1.4 */
|
||||
static HRESULT Math_LOG10E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
return math_constant(M_LOG10E, flags, retv);
|
||||
}
|
||||
|
||||
static HRESULT Math_LN2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -84,11 +109,12 @@ static HRESULT Math_LN10(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.1.6 */
|
||||
static HRESULT Math_PI(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
return math_constant(M_PI, flags, retv);
|
||||
}
|
||||
|
||||
static HRESULT Math_SQRT2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -105,11 +131,30 @@ static HRESULT Math_SQRT1_2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.2.12 */
|
||||
static HRESULT Math_abs(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT v;
|
||||
DOUBLE d;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(!arg_cnt(dp)) {
|
||||
if(retv)
|
||||
num_set_nan(retv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
d = num_val(&v);
|
||||
if(retv)
|
||||
num_set_val(retv, d < 0.0 ? -d : d);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Math_acos(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -140,11 +185,28 @@ static HRESULT Math_atan2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.2.6 */
|
||||
static HRESULT Math_ceil(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(!arg_cnt(dp)) {
|
||||
if(retv)
|
||||
num_set_nan(retv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(retv)
|
||||
num_set_val(retv, ceil(num_val(&v)));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Math_cos(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -164,8 +226,24 @@ static HRESULT Math_exp(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *d
|
|||
static HRESULT Math_floor(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(!arg_cnt(dp)) {
|
||||
if(retv)
|
||||
num_set_nan(retv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(retv)
|
||||
num_set_val(retv, floor(num_val(&v)));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Math_log(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -175,39 +253,145 @@ static HRESULT Math_log(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *d
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.2.11 */
|
||||
static HRESULT Math_max(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
DOUBLE max, d;
|
||||
VARIANT v;
|
||||
DWORD i;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(!arg_cnt(dp)) {
|
||||
if(retv)
|
||||
num_set_inf(retv, FALSE);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = to_number(dispex->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);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
d = num_val(&v);
|
||||
if(d > max || isnan(d))
|
||||
max = d;
|
||||
}
|
||||
|
||||
if(retv)
|
||||
num_set_val(retv, max);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.2.12 */
|
||||
static HRESULT Math_min(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
DOUBLE min, d;
|
||||
VARIANT v;
|
||||
DWORD i;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(!arg_cnt(dp)) {
|
||||
if(retv)
|
||||
num_set_inf(retv, TRUE);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = to_number(dispex->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);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
d = num_val(&v);
|
||||
if(d < min || isnan(d))
|
||||
min = d;
|
||||
}
|
||||
|
||||
if(retv)
|
||||
num_set_val(retv, min);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.2.13 */
|
||||
static HRESULT Math_pow(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT x, y;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(arg_cnt(dp) < 2) {
|
||||
FIXME("unimplemented arg_cnt %d\n", arg_cnt(dp));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &x);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &y);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(retv)
|
||||
num_set_val(retv, pow(num_val(&x), num_val(&y)));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.2.14 */
|
||||
static HRESULT Math_random(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
UINT r;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(!RtlGenRandom(&r, sizeof(r)))
|
||||
return E_UNEXPECTED;
|
||||
|
||||
if(retv)
|
||||
num_set_val(retv, (DOUBLE)r/(DOUBLE)UINT_MAX);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.8.2.15 */
|
||||
static HRESULT Math_round(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(!arg_cnt(dp)) {
|
||||
num_set_nan(retv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(retv)
|
||||
num_set_val(retv, floor(num_val(&v)+0.5));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Math_sin(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -233,10 +417,10 @@ static HRESULT Math_tan(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *d
|
|||
|
||||
static const builtin_prop_t Math_props[] = {
|
||||
{EW, Math_E, 0},
|
||||
{LOG2EW, Math_LOG2E, 0},
|
||||
{LOG10EW, Math_LOG10E, 0},
|
||||
{LN2W, Math_LN2, 0},
|
||||
{LN10W, Math_LN10, 0},
|
||||
{LN2W, Math_LN2, 0},
|
||||
{LOG10EW, Math_LOG10E, 0},
|
||||
{LOG2EW, Math_LOG2E, 0},
|
||||
{PIW, Math_PI, 0},
|
||||
{SQRT1_2W, Math_SQRT1_2, 0},
|
||||
{SQRT2W, Math_SQRT2, 0},
|
||||
|
|
|
@ -39,11 +39,39 @@ static const WCHAR propertyIsEnumerableW[] =
|
|||
{'p','r','o','p','e','r','t','y','I','s','E','n','u','m','e','r','a','b','l','e',0};
|
||||
static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','e','O','f',0};
|
||||
|
||||
/* ECMA-262 3rd Edition 15.7.4.2 */
|
||||
static HRESULT Number_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
NumberInstance *number;
|
||||
BSTR str;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(!is_class(dispex, JSCLASS_NUMBER)) {
|
||||
FIXME("throw TypeError\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
number = (NumberInstance*)dispex;
|
||||
|
||||
if(arg_cnt(dp) != 0) {
|
||||
FIXME("unsupported args\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = to_string(dispex->ctx, &number->num, ei, &str);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_BSTR;
|
||||
V_BSTR(retv) = str;
|
||||
}else {
|
||||
SysFreeString(str);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Number_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -77,8 +105,18 @@ static HRESULT Number_toPrecision(DispatchEx *dispex, LCID lcid, WORD flags, DIS
|
|||
static HRESULT Number_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
if(!is_class(dispex, JSCLASS_NUMBER)) {
|
||||
FIXME("throw TypeError\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(retv) {
|
||||
NumberInstance *number = (NumberInstance*)dispex;
|
||||
*retv = number->num;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Number_hasOwnProperty(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
@ -105,8 +143,19 @@ static HRESULT Number_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, D
|
|||
static HRESULT Number_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
NumberInstance *number = (NumberInstance*)dispex;
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_PROPERTYGET:
|
||||
*retv = number->num;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const builtin_prop_t Number_props[] = {
|
||||
|
@ -133,15 +182,66 @@ static const builtin_info_t Number_info = {
|
|||
static HRESULT NumberConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT num;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
switch(flags) {
|
||||
case INVOKE_FUNC:
|
||||
if(!arg_cnt(dp)) {
|
||||
if(retv) {
|
||||
V_VT(retv) = VT_I4;
|
||||
V_I4(retv) = 0;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &num);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(retv)
|
||||
*retv = num;
|
||||
break;
|
||||
|
||||
case DISPATCH_CONSTRUCT: {
|
||||
DispatchEx *obj;
|
||||
|
||||
if(arg_cnt(dp)) {
|
||||
hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &num);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
}else {
|
||||
V_VT(&num) = VT_I4;
|
||||
V_I4(&num) = 0;
|
||||
}
|
||||
|
||||
hres = create_number(dispex->ctx, &num, &obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(retv) = VT_DISPATCH;
|
||||
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(obj);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FIXME("unimplemented flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT alloc_number(script_ctx_t *ctx, BOOL use_constr, NumberInstance **ret)
|
||||
{
|
||||
NumberInstance *number = heap_alloc_zero(sizeof(NumberInstance));
|
||||
NumberInstance *number;
|
||||
HRESULT hres;
|
||||
|
||||
number = heap_alloc_zero(sizeof(NumberInstance));
|
||||
if(!number)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if(use_constr)
|
||||
hres = init_dispex_from_constr(&number->dispex, ctx, &Number_info, ctx->number_constr);
|
||||
else
|
||||
|
@ -162,6 +262,7 @@ HRESULT create_number_constr(script_ctx_t *ctx, DispatchEx **ret)
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(&number->num) = VT_I4;
|
||||
hres = create_builtin_function(ctx, NumberConstr_value, PROPF_CONSTR, &number->dispex, ret);
|
||||
|
||||
jsdisp_release(&number->dispex);
|
||||
|
|
|
@ -30,6 +30,8 @@ static const WCHAR propertyIsEnumerableW[] =
|
|||
{'p','r','o','p','e','r','t','y','I','s','E','n','u','m','e','r','a','b','l','e',0};
|
||||
static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','e','O','f',0};
|
||||
|
||||
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,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
|
@ -75,8 +77,21 @@ static HRESULT Object_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, D
|
|||
static HRESULT Object_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_PROPERTYGET:
|
||||
V_VT(retv) = VT_BSTR;
|
||||
V_BSTR(retv) = SysAllocString(default_valueW);
|
||||
if(!V_BSTR(retv))
|
||||
return E_OUTOFMEMORY;
|
||||
break;
|
||||
default:
|
||||
FIXME("unimplemented flags %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void Object_destructor(DispatchEx *dispex)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -40,35 +40,36 @@
|
|||
kIF = 266,
|
||||
kFINALLY = 267,
|
||||
kFOR = 268,
|
||||
kFUNCTION = 269,
|
||||
kIN = 270,
|
||||
kINSTANCEOF = 271,
|
||||
kNEW = 272,
|
||||
kNULL = 273,
|
||||
kUNDEFINED = 274,
|
||||
kRETURN = 275,
|
||||
kSWITCH = 276,
|
||||
kTHIS = 277,
|
||||
kTHROW = 278,
|
||||
kTRUE = 279,
|
||||
kFALSE = 280,
|
||||
kTRY = 281,
|
||||
kTYPEOF = 282,
|
||||
kVAR = 283,
|
||||
kVOID = 284,
|
||||
kWHILE = 285,
|
||||
kWITH = 286,
|
||||
tANDAND = 287,
|
||||
tOROR = 288,
|
||||
tINC = 289,
|
||||
tDEC = 290,
|
||||
kIN = 269,
|
||||
kINSTANCEOF = 270,
|
||||
kNEW = 271,
|
||||
kNULL = 272,
|
||||
kUNDEFINED = 273,
|
||||
kRETURN = 274,
|
||||
kSWITCH = 275,
|
||||
kTHIS = 276,
|
||||
kTHROW = 277,
|
||||
kTRUE = 278,
|
||||
kFALSE = 279,
|
||||
kTRY = 280,
|
||||
kTYPEOF = 281,
|
||||
kVAR = 282,
|
||||
kVOID = 283,
|
||||
kWHILE = 284,
|
||||
kWITH = 285,
|
||||
tANDAND = 286,
|
||||
tOROR = 287,
|
||||
tINC = 288,
|
||||
tDEC = 289,
|
||||
kFUNCTION = 290,
|
||||
tIdentifier = 291,
|
||||
tAssignOper = 292,
|
||||
tEqOper = 293,
|
||||
tShiftOper = 294,
|
||||
tRelOper = 295,
|
||||
tNumericLiteral = 296,
|
||||
tStringLiteral = 297
|
||||
tStringLiteral = 297,
|
||||
LOWER_THAN_ELSE = 298
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
|
@ -83,28 +84,28 @@
|
|||
#define kIF 266
|
||||
#define kFINALLY 267
|
||||
#define kFOR 268
|
||||
#define kFUNCTION 269
|
||||
#define kIN 270
|
||||
#define kINSTANCEOF 271
|
||||
#define kNEW 272
|
||||
#define kNULL 273
|
||||
#define kUNDEFINED 274
|
||||
#define kRETURN 275
|
||||
#define kSWITCH 276
|
||||
#define kTHIS 277
|
||||
#define kTHROW 278
|
||||
#define kTRUE 279
|
||||
#define kFALSE 280
|
||||
#define kTRY 281
|
||||
#define kTYPEOF 282
|
||||
#define kVAR 283
|
||||
#define kVOID 284
|
||||
#define kWHILE 285
|
||||
#define kWITH 286
|
||||
#define tANDAND 287
|
||||
#define tOROR 288
|
||||
#define tINC 289
|
||||
#define tDEC 290
|
||||
#define kIN 269
|
||||
#define kINSTANCEOF 270
|
||||
#define kNEW 271
|
||||
#define kNULL 272
|
||||
#define kUNDEFINED 273
|
||||
#define kRETURN 274
|
||||
#define kSWITCH 275
|
||||
#define kTHIS 276
|
||||
#define kTHROW 277
|
||||
#define kTRUE 278
|
||||
#define kFALSE 279
|
||||
#define kTRY 280
|
||||
#define kTYPEOF 281
|
||||
#define kVAR 282
|
||||
#define kVOID 283
|
||||
#define kWHILE 284
|
||||
#define kWITH 285
|
||||
#define tANDAND 286
|
||||
#define tOROR 287
|
||||
#define tINC 288
|
||||
#define tDEC 289
|
||||
#define kFUNCTION 290
|
||||
#define tIdentifier 291
|
||||
#define tAssignOper 292
|
||||
#define tEqOper 293
|
||||
|
@ -112,14 +113,16 @@
|
|||
#define tRelOper 295
|
||||
#define tNumericLiteral 296
|
||||
#define tStringLiteral 297
|
||||
#define LOWER_THAN_ELSE 298
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 147 "parser.y"
|
||||
#line 149 "parser.y"
|
||||
typedef union YYSTYPE {
|
||||
int ival;
|
||||
const WCHAR *srcptr;
|
||||
LPCWSTR wstr;
|
||||
literal_t *literal;
|
||||
struct _argument_list_t *argument_list;
|
||||
|
@ -129,7 +132,6 @@ typedef union YYSTYPE {
|
|||
struct _element_list_t *element_list;
|
||||
expression_t *expr;
|
||||
const WCHAR *identifier;
|
||||
function_declaration_t *function_declaration;
|
||||
struct _parameter_list_t *parameter_list;
|
||||
struct _property_list_t *property_list;
|
||||
source_elements_t *source_elements;
|
||||
|
@ -139,7 +141,7 @@ typedef union YYSTYPE {
|
|||
variable_declaration_t *variable_declaration;
|
||||
} YYSTYPE;
|
||||
/* Line 1447 of yacc.c. */
|
||||
#line 143 "parser.tab.h"
|
||||
#line 145 "parser.tab.h"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
|
|
|
@ -21,16 +21,13 @@
|
|||
#include "jscript.h"
|
||||
#include "engine.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
||||
|
||||
#define YYLEX_PARAM ctx
|
||||
#define YYPARSE_PARAM ctx
|
||||
|
||||
static int parser_error(const char*);
|
||||
static BOOL allow_auto_semicolon(parser_ctx_t*);
|
||||
static void program_parsed(parser_ctx_t*,source_elements_t*);
|
||||
static source_elements_t *function_body_parsed(parser_ctx_t*,source_elements_t*);
|
||||
|
||||
typedef struct _statement_list_t {
|
||||
statement_t *head;
|
||||
|
@ -109,8 +106,8 @@ struct statement_list_t {
|
|||
statement_t *tail;
|
||||
};
|
||||
|
||||
statement_list_t *new_statement_list(parser_ctx_t*,statement_t*);
|
||||
statement_list_t *statement_list_add(statement_list_t*,statement_t*);
|
||||
static statement_list_t *new_statement_list(parser_ctx_t*,statement_t*);
|
||||
static statement_list_t *statement_list_add(statement_list_t*,statement_t*);
|
||||
|
||||
typedef struct _parameter_list_t {
|
||||
parameter_t *head;
|
||||
|
@ -120,7 +117,14 @@ typedef struct _parameter_list_t {
|
|||
static parameter_list_t *new_parameter_list(parser_ctx_t*,const WCHAR*);
|
||||
static parameter_list_t *parameter_list_add(parser_ctx_t*,parameter_list_t*,const WCHAR*);
|
||||
|
||||
static expression_t *new_function_expression(parser_ctx_t*,const WCHAR*,parameter_list_t*,source_elements_t*);
|
||||
static void push_func(parser_ctx_t*);
|
||||
static inline void pop_func(parser_ctx_t *ctx)
|
||||
{
|
||||
ctx->func_stack = ctx->func_stack->next;
|
||||
}
|
||||
|
||||
static expression_t *new_function_expression(parser_ctx_t*,const WCHAR*,parameter_list_t*,
|
||||
source_elements_t*,const WCHAR*,DWORD);
|
||||
static expression_t *new_binary_expression(parser_ctx_t*,expression_type_t,expression_t*,expression_t*);
|
||||
static expression_t *new_unary_expression(parser_ctx_t*,expression_type_t,expression_t*);
|
||||
static expression_t *new_conditional_expression(parser_ctx_t*,expression_t*,expression_t*,expression_t*);
|
||||
|
@ -134,10 +138,8 @@ static expression_t *new_literal_expression(parser_ctx_t*,literal_t*);
|
|||
static expression_t *new_array_literal_expression(parser_ctx_t*,element_list_t*,int);
|
||||
static expression_t *new_prop_and_value_expression(parser_ctx_t*,property_list_t*);
|
||||
|
||||
static function_declaration_t *new_function_declaration(parser_ctx_t*,const WCHAR*,parameter_list_t*,source_elements_t*);
|
||||
static source_elements_t *new_source_elements(parser_ctx_t*);
|
||||
static source_elements_t *source_elements_add_statement(source_elements_t*,statement_t*);
|
||||
static source_elements_t *source_elements_add_function(source_elements_t*,function_declaration_t*);
|
||||
|
||||
%}
|
||||
|
||||
|
@ -146,6 +148,7 @@ static source_elements_t *source_elements_add_function(source_elements_t*,functi
|
|||
|
||||
%union {
|
||||
int ival;
|
||||
const WCHAR *srcptr;
|
||||
LPCWSTR wstr;
|
||||
literal_t *literal;
|
||||
struct _argument_list_t *argument_list;
|
||||
|
@ -155,7 +158,6 @@ static source_elements_t *source_elements_add_function(source_elements_t*,functi
|
|||
struct _element_list_t *element_list;
|
||||
expression_t *expr;
|
||||
const WCHAR *identifier;
|
||||
function_declaration_t *function_declaration;
|
||||
struct _parameter_list_t *parameter_list;
|
||||
struct _property_list_t *property_list;
|
||||
source_elements_t *source_elements;
|
||||
|
@ -166,10 +168,12 @@ static source_elements_t *source_elements_add_function(source_elements_t*,functi
|
|||
}
|
||||
|
||||
/* keywords */
|
||||
%token kBREAK kCASE kCATCH kCONTINUE kDEFAULT kDELETE kDO kELSE kIF kFINALLY kFOR kFUNCTION kIN
|
||||
%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
|
||||
|
||||
%token <srcptr> kFUNCTION '}'
|
||||
|
||||
/* tokens */
|
||||
%token <identifier> tIdentifier
|
||||
%token <ival> tAssignOper tEqOper tShiftOper tRelOper
|
||||
|
@ -195,7 +199,6 @@ static source_elements_t *source_elements_add_function(source_elements_t*,functi
|
|||
%type <statement> TryStatement
|
||||
%type <statement> Finally
|
||||
%type <statement_list> StatementList StatementList_opt
|
||||
%type <function_declaration> FunctionDeclaration
|
||||
%type <parameter_list> FormalParameterList FormalParameterList_opt
|
||||
%type <expr> Expression Expression_opt
|
||||
%type <expr> ExpressionNoIn ExpressionNoIn_opt
|
||||
|
@ -239,6 +242,10 @@ static source_elements_t *source_elements_add_function(source_elements_t*,functi
|
|||
%type <property_list> PropertyNameAndValueList
|
||||
%type <literal> PropertyName
|
||||
%type <literal> BooleanLiteral
|
||||
%type <srcptr> KFunction
|
||||
|
||||
%nonassoc LOWER_THAN_ELSE
|
||||
%nonassoc kELSE
|
||||
|
||||
%%
|
||||
|
||||
|
@ -251,22 +258,18 @@ SourceElements
|
|||
: /* empty */ { $$ = new_source_elements(ctx); }
|
||||
| SourceElements Statement
|
||||
{ $$ = source_elements_add_statement($1, $2); }
|
||||
| SourceElements FunctionDeclaration
|
||||
{ $$ = source_elements_add_function($1, $2); }
|
||||
|
||||
/* ECMA-262 3rd Edition 13 */
|
||||
FunctionDeclaration
|
||||
: kFUNCTION tIdentifier '(' FormalParameterList_opt ')' '{' FunctionBody '}'
|
||||
{ $$ = new_function_declaration(ctx, $2, $4, $7); }
|
||||
|
||||
/* ECMA-262 3rd Edition 13 */
|
||||
FunctionExpression
|
||||
: kFUNCTION Identifier_opt '(' FormalParameterList_opt ')' '{' FunctionBody '}'
|
||||
{ $$ = new_function_expression(ctx, $2, $4, $7); }
|
||||
: KFunction Identifier_opt '(' FormalParameterList_opt ')' '{' FunctionBody '}'
|
||||
{ $$ = new_function_expression(ctx, $2, $4, $7, $1, $8-$1+1); }
|
||||
|
||||
KFunction
|
||||
: kFUNCTION { push_func(ctx); $$ = $1; }
|
||||
|
||||
/* ECMA-262 3rd Edition 13 */
|
||||
FunctionBody
|
||||
: SourceElements { $$ = $1; }
|
||||
: SourceElements { $$ = function_body_parsed(ctx, $1); }
|
||||
|
||||
/* ECMA-262 3rd Edition 13 */
|
||||
FormalParameterList
|
||||
|
@ -309,8 +312,8 @@ StatementList_opt
|
|||
|
||||
/* ECMA-262 3rd Edition 12.1 */
|
||||
Block
|
||||
: '{' StatementList_opt '}'
|
||||
{ $$ = new_block_statement(ctx, $2); }
|
||||
: '{' StatementList '}' { $$ = new_block_statement(ctx, $2); }
|
||||
| '{' '}' { $$ = new_block_statement(ctx, NULL); }
|
||||
|
||||
/* ECMA-262 3rd Edition 12.2 */
|
||||
VariableStatement
|
||||
|
@ -373,7 +376,7 @@ ExpressionStatement
|
|||
IfStatement
|
||||
: kIF '(' Expression ')' Statement kELSE Statement
|
||||
{ $$ = new_if_statement(ctx, $3, $5, $7); }
|
||||
| kIF '(' Expression ')' Statement
|
||||
| kIF '(' Expression ')' Statement %prec LOWER_THAN_ELSE
|
||||
{ $$ = new_if_statement(ctx, $3, $5, NULL); }
|
||||
|
||||
/* ECMA-262 3rd Edition 12.6 */
|
||||
|
@ -722,10 +725,11 @@ PrimaryExpression
|
|||
|
||||
/* ECMA-262 3rd Edition 11.1.4 */
|
||||
ArrayLiteral
|
||||
: '[' Elision_opt ']' { $$ = new_array_literal_expression(ctx, NULL, $2); }
|
||||
: '[' ']' { $$ = new_array_literal_expression(ctx, NULL, 0); }
|
||||
| '[' Elision ']' { $$ = new_array_literal_expression(ctx, NULL, $2+1); }
|
||||
| '[' ElementList ']' { $$ = new_array_literal_expression(ctx, $2, 0); }
|
||||
| '[' ElementList ',' Elision_opt ']'
|
||||
{ $$ = new_array_literal_expression(ctx, $2, $4); }
|
||||
{ $$ = new_array_literal_expression(ctx, $2, $4+1); }
|
||||
|
||||
/* ECMA-262 3rd Edition 11.1.4 */
|
||||
ElementList
|
||||
|
@ -1013,11 +1017,20 @@ static statement_t *new_block_statement(parser_ctx_t *ctx, statement_list_t *lis
|
|||
static variable_declaration_t *new_variable_declaration(parser_ctx_t *ctx, const WCHAR *identifier, expression_t *expr)
|
||||
{
|
||||
variable_declaration_t *ret = parser_alloc(ctx, sizeof(variable_declaration_t));
|
||||
var_list_t *var_list = parser_alloc(ctx, sizeof(var_list_t));
|
||||
|
||||
ret->identifier = identifier;
|
||||
ret->expr = expr;
|
||||
ret->next = NULL;
|
||||
|
||||
var_list->identifier = identifier;
|
||||
var_list->next = NULL;
|
||||
|
||||
if(ctx->func_stack->var_tail)
|
||||
ctx->func_stack->var_tail = ctx->func_stack->var_tail->next = var_list;
|
||||
else
|
||||
ctx->func_stack->var_head = ctx->func_stack->var_tail = var_list;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1247,7 +1260,7 @@ static parameter_list_t *parameter_list_add(parser_ctx_t *ctx, parameter_list_t
|
|||
}
|
||||
|
||||
static expression_t *new_function_expression(parser_ctx_t *ctx, const WCHAR *identifier,
|
||||
parameter_list_t *parameter_list, source_elements_t *source_elements)
|
||||
parameter_list_t *parameter_list, source_elements_t *source_elements, const WCHAR *src_str, DWORD src_len)
|
||||
{
|
||||
function_expression_t *ret = parser_alloc(ctx, sizeof(function_expression_t));
|
||||
|
||||
|
@ -1255,6 +1268,20 @@ static expression_t *new_function_expression(parser_ctx_t *ctx, const WCHAR *ide
|
|||
ret->identifier = identifier;
|
||||
ret->parameter_list = parameter_list ? parameter_list->head : NULL;
|
||||
ret->source_elements = source_elements;
|
||||
ret->src_str = src_str;
|
||||
ret->src_len = src_len;
|
||||
|
||||
if(ret->identifier) {
|
||||
function_declaration_t *decl = parser_alloc(ctx, sizeof(function_declaration_t));
|
||||
|
||||
decl->expr = ret;
|
||||
decl->next = NULL;
|
||||
|
||||
if(ctx->func_stack->func_tail)
|
||||
ctx->func_stack->func_tail = ctx->func_stack->func_tail->next = decl;
|
||||
else
|
||||
ctx->func_stack->func_head = ctx->func_stack->func_tail = decl;
|
||||
}
|
||||
|
||||
return &ret->expr;
|
||||
}
|
||||
|
@ -1443,19 +1470,6 @@ static expression_t *new_literal_expression(parser_ctx_t *ctx, literal_t *litera
|
|||
return &ret->expr;
|
||||
}
|
||||
|
||||
static function_declaration_t *new_function_declaration(parser_ctx_t *ctx, const WCHAR *identifier,
|
||||
parameter_list_t *parameter_list, source_elements_t *source_elements)
|
||||
{
|
||||
function_declaration_t *ret = parser_alloc(ctx, sizeof(function_declaration_t));
|
||||
|
||||
ret->identifier = identifier;
|
||||
ret->parameter_list = parameter_list ? parameter_list->head : NULL;
|
||||
ret->source_elements = source_elements;
|
||||
ret->next = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static source_elements_t *new_source_elements(parser_ctx_t *ctx)
|
||||
{
|
||||
source_elements_t *ret = parser_alloc(ctx, sizeof(source_elements_t));
|
||||
|
@ -1475,18 +1489,7 @@ static source_elements_t *source_elements_add_statement(source_elements_t *sourc
|
|||
return source_elements;
|
||||
}
|
||||
|
||||
static source_elements_t *source_elements_add_function(source_elements_t *source_elements,
|
||||
function_declaration_t *function_declaration)
|
||||
{
|
||||
if(source_elements->functions_tail)
|
||||
source_elements->functions_tail = source_elements->functions_tail->next = function_declaration;
|
||||
else
|
||||
source_elements->functions = source_elements->functions_tail = function_declaration;
|
||||
|
||||
return source_elements;
|
||||
}
|
||||
|
||||
statement_list_t *new_statement_list(parser_ctx_t *ctx, statement_t *statement)
|
||||
static statement_list_t *new_statement_list(parser_ctx_t *ctx, statement_t *statement)
|
||||
{
|
||||
statement_list_t *ret = parser_alloc_tmp(ctx, sizeof(statement_list_t));
|
||||
|
||||
|
@ -1495,15 +1498,39 @@ statement_list_t *new_statement_list(parser_ctx_t *ctx, statement_t *statement)
|
|||
return ret;
|
||||
}
|
||||
|
||||
statement_list_t *statement_list_add(statement_list_t *list, statement_t *statement)
|
||||
static statement_list_t *statement_list_add(statement_list_t *list, statement_t *statement)
|
||||
{
|
||||
list->tail = list->tail->next = statement;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static void push_func(parser_ctx_t *ctx)
|
||||
{
|
||||
func_stack_t *new_func = parser_alloc_tmp(ctx, sizeof(func_stack_t));
|
||||
|
||||
new_func->func_head = new_func->func_tail = NULL;
|
||||
new_func->var_head = new_func->var_tail = NULL;
|
||||
|
||||
new_func->next = ctx->func_stack;
|
||||
ctx->func_stack = new_func;
|
||||
}
|
||||
|
||||
static source_elements_t *function_body_parsed(parser_ctx_t *ctx, source_elements_t *source)
|
||||
{
|
||||
source->functions = ctx->func_stack->func_head;
|
||||
source->variables = ctx->func_stack->var_head;
|
||||
pop_func(ctx);
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
static void program_parsed(parser_ctx_t *ctx, source_elements_t *source)
|
||||
{
|
||||
source->functions = ctx->func_stack->func_head;
|
||||
source->variables = ctx->func_stack->var_head;
|
||||
pop_func(ctx);
|
||||
|
||||
ctx->source = source;
|
||||
ctx->hres = S_OK;
|
||||
}
|
||||
|
@ -1544,6 +1571,8 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, parser_ctx_t **ret)
|
|||
mark = jsheap_mark(&ctx->tmp_heap);
|
||||
jsheap_init(&parser_ctx->heap);
|
||||
|
||||
push_func(parser_ctx);
|
||||
|
||||
parser_parse(parser_ctx);
|
||||
jsheap_clear(mark);
|
||||
if(FAILED(parser_ctx->hres)) {
|
||||
|
|
|
@ -181,7 +181,7 @@ typedef enum REOp {
|
|||
|
||||
#define REOP_IS_SIMPLE(op) ((op) <= REOP_NCLASS)
|
||||
|
||||
const char *reop_names[] = {
|
||||
static const char *reop_names[] = {
|
||||
"empty",
|
||||
"bol",
|
||||
"eol",
|
||||
|
@ -559,7 +559,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
|
|||
emitStateSP->jumpToJumpFlag = FALSE;
|
||||
++emitStateSP;
|
||||
assert((size_t)(emitStateSP - emitStateStack) <= treeDepth);
|
||||
t = (RENode *) t->kid;
|
||||
t = t->kid;
|
||||
op = t->op;
|
||||
assert(op < REOP_LIMIT);
|
||||
continue;
|
||||
|
@ -572,7 +572,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
|
|||
emitStateSP->continueOp = REOP_ENDALT;
|
||||
++emitStateSP;
|
||||
assert((size_t)(emitStateSP - emitStateStack) <= treeDepth);
|
||||
t = (RENode *) t->u.kid2;
|
||||
t = t->u.kid2;
|
||||
op = t->op;
|
||||
assert(op < REOP_LIMIT);
|
||||
continue;
|
||||
|
@ -676,7 +676,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
|
|||
emitStateSP->jumpToJumpFlag = FALSE;
|
||||
++emitStateSP;
|
||||
assert((size_t)(emitStateSP - emitStateStack) <= treeDepth);
|
||||
t = (RENode *) t->kid;
|
||||
t = t->kid;
|
||||
op = t->op;
|
||||
assert(op < REOP_LIMIT);
|
||||
continue;
|
||||
|
@ -699,7 +699,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
|
|||
while (t->next &&
|
||||
t->next->op == REOP_FLAT &&
|
||||
(WCHAR*)t->kid + t->u.flat.length ==
|
||||
(WCHAR*)t->next->kid) {
|
||||
t->next->kid) {
|
||||
t->u.flat.length += t->next->u.flat.length;
|
||||
t->next = t->next->next;
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
|
|||
emitStateSP->continueOp = REOP_RPAREN;
|
||||
++emitStateSP;
|
||||
assert((size_t)(emitStateSP - emitStateStack) <= treeDepth);
|
||||
t = (RENode *) t->kid;
|
||||
t = t->kid;
|
||||
op = t->op;
|
||||
continue;
|
||||
|
||||
|
@ -747,7 +747,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
|
|||
emitStateSP->continueOp = REOP_ASSERTTEST;
|
||||
++emitStateSP;
|
||||
assert((size_t)(emitStateSP - emitStateStack) <= treeDepth);
|
||||
t = (RENode *) t->kid;
|
||||
t = t->kid;
|
||||
op = t->op;
|
||||
continue;
|
||||
|
||||
|
@ -765,7 +765,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
|
|||
emitStateSP->continueOp = REOP_ASSERTNOTTEST;
|
||||
++emitStateSP;
|
||||
assert((size_t)(emitStateSP - emitStateStack) <= treeDepth);
|
||||
t = (RENode *) t->kid;
|
||||
t = t->kid;
|
||||
op = t->op;
|
||||
continue;
|
||||
|
||||
|
@ -793,7 +793,7 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
|
|||
emitStateSP->continueOp = REOP_ENDCHILD;
|
||||
++emitStateSP;
|
||||
assert((size_t)(emitStateSP - emitStateStack) <= treeDepth);
|
||||
t = (RENode *) t->kid;
|
||||
t = t->kid;
|
||||
op = t->op;
|
||||
continue;
|
||||
|
||||
|
@ -2571,7 +2571,7 @@ SimpleMatch(REGlobalData *gData, REMatchState *x, REOp op,
|
|||
if (!updatecp)
|
||||
x->cp = startcp;
|
||||
*startpc = pc;
|
||||
TRACE(" * \n");
|
||||
TRACE(" *\n");
|
||||
return result;
|
||||
}
|
||||
x->cp = startcp;
|
||||
|
@ -3001,7 +3001,7 @@ ExecuteREBytecode(REGlobalData *gData, REMatchState *x)
|
|||
}while(0)
|
||||
|
||||
if (!result) {
|
||||
TRACE(" - \n");
|
||||
TRACE(" -\n");
|
||||
/*
|
||||
* Non-greedy failure - try to consume another child.
|
||||
*/
|
||||
|
@ -3297,66 +3297,119 @@ out:
|
|||
return re;
|
||||
}
|
||||
|
||||
static HRESULT do_regexp_match_next(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;
|
||||
REGlobalData gData;
|
||||
DWORD matchlen;
|
||||
|
||||
gData.cpbegin = *cp;
|
||||
gData.cpend = str + len;
|
||||
gData.start = *cp-str;
|
||||
gData.skipped = 0;
|
||||
gData.pool = ®exp->dispex.ctx->tmp_heap;
|
||||
|
||||
x = InitMatch(NULL, &gData, regexp->jsregexp, gData.cpend - gData.cpbegin);
|
||||
if(!x) {
|
||||
WARN("InitMatch failed\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
x->cp = *cp;
|
||||
result = MatchRegExp(&gData, x);
|
||||
if(!gData.ok) {
|
||||
WARN("MatchRegExp failed\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(!result)
|
||||
return S_FALSE;
|
||||
|
||||
if(parens) {
|
||||
DWORD i;
|
||||
|
||||
if(regexp->jsregexp->parenCount > *parens_size) {
|
||||
match_result_t *new_parens;
|
||||
|
||||
if(*parens)
|
||||
new_parens = heap_realloc(*parens, sizeof(match_result_t)*regexp->jsregexp->parenCount);
|
||||
else
|
||||
new_parens = heap_alloc(sizeof(match_result_t)*regexp->jsregexp->parenCount);
|
||||
if(!new_parens)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
*parens = new_parens;
|
||||
}
|
||||
|
||||
*parens_cnt = regexp->jsregexp->parenCount;
|
||||
|
||||
for(i=0; i < regexp->jsregexp->parenCount; i++) {
|
||||
(*parens)[i].str = *cp + result->parens[i].index;
|
||||
(*parens)[i].len = result->parens[i].length;
|
||||
}
|
||||
}
|
||||
|
||||
matchlen = (result->cp-*cp) - gData.skipped;
|
||||
*cp = result->cp;
|
||||
ret->str = result->cp-matchlen;
|
||||
ret->len = matchlen;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT regexp_match_next(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;
|
||||
jsheap_t *mark;
|
||||
HRESULT hres;
|
||||
|
||||
if(gcheck && !(regexp->jsregexp->flags & JSREG_GLOB))
|
||||
return S_FALSE;
|
||||
|
||||
mark = jsheap_mark(®exp->dispex.ctx->tmp_heap);
|
||||
|
||||
hres = do_regexp_match_next(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)
|
||||
{
|
||||
RegExpInstance *This = (RegExpInstance*)dispex;
|
||||
match_result_t *ret = NULL;
|
||||
match_result_t *ret = NULL, cres;
|
||||
const WCHAR *cp = str;
|
||||
REGlobalData gData;
|
||||
REMatchState *x, *result;
|
||||
DWORD matchlen;
|
||||
DWORD i=0, ret_size = 0;
|
||||
jsheap_t *mark;
|
||||
size_t length;
|
||||
HRESULT hres = E_FAIL;
|
||||
|
||||
length = len;
|
||||
HRESULT hres;
|
||||
|
||||
mark = jsheap_mark(&This->dispex.ctx->tmp_heap);
|
||||
gData.pool = &This->dispex.ctx->tmp_heap;
|
||||
|
||||
while(1) {
|
||||
gData.cpbegin = cp;
|
||||
gData.cpend = str + len;
|
||||
gData.start = cp-str;
|
||||
gData.skipped = 0;
|
||||
|
||||
x = InitMatch(NULL, &gData, This->jsregexp, length);
|
||||
if(!x) {
|
||||
WARN("InitMatch failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
x->cp = cp;
|
||||
result = MatchRegExp(&gData, x);
|
||||
if(!gData.ok) {
|
||||
WARN("MatchRegExp failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if(!result) {
|
||||
hres = do_regexp_match_next(This, str, len, &cp, NULL, NULL, NULL, &cres);
|
||||
if(hres == S_FALSE) {
|
||||
hres = S_OK;
|
||||
break;
|
||||
}
|
||||
|
||||
matchlen = (result->cp-cp) - gData.skipped;
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(ret)
|
||||
ret = heap_realloc(ret, (ret_size <<= 1) * sizeof(match_result_t));
|
||||
else if(ret_size == i)
|
||||
ret = heap_alloc((ret_size=4) * sizeof(match_result_t));
|
||||
if(!ret) {
|
||||
hres = E_OUTOFMEMORY;
|
||||
break;
|
||||
if(ret_size == i) {
|
||||
if(ret)
|
||||
ret = heap_realloc(ret, (ret_size <<= 1) * sizeof(match_result_t));
|
||||
else
|
||||
ret = heap_alloc((ret_size=4) * sizeof(match_result_t));
|
||||
if(!ret) {
|
||||
hres = E_OUTOFMEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret[i].str = result->cp-matchlen;
|
||||
ret[i].len = matchlen;
|
||||
|
||||
length -= result->cp-cp;
|
||||
cp = result->cp;
|
||||
i++;
|
||||
ret[i++] = cres;
|
||||
|
||||
if(!gflag && !(This->jsregexp->flags & JSREG_GLOB)) {
|
||||
hres = S_OK;
|
||||
|
@ -3546,11 +3599,81 @@ static HRESULT create_regexp(script_ctx_t *ctx, const WCHAR *exp, int len, DWORD
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT regexp_constructor(script_ctx_t *ctx, DISPPARAMS *dp, VARIANT *retv)
|
||||
{
|
||||
const WCHAR *opt = emptyW, *src;
|
||||
DispatchEx *ret;
|
||||
VARIANT *arg;
|
||||
HRESULT hres;
|
||||
|
||||
if(!arg_cnt(dp)) {
|
||||
FIXME("no args\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
arg = get_arg(dp,0);
|
||||
if(V_VT(arg) == VT_DISPATCH) {
|
||||
DispatchEx *obj;
|
||||
|
||||
obj = iface_to_jsdisp((IUnknown*)V_DISPATCH(arg));
|
||||
if(obj) {
|
||||
if(is_class(obj, JSCLASS_REGEXP)) {
|
||||
RegExpInstance *regexp = (RegExpInstance*)obj;
|
||||
|
||||
hres = create_regexp(ctx, regexp->str, -1, regexp->jsregexp->flags, &ret);
|
||||
jsdisp_release(obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(retv) = VT_DISPATCH;
|
||||
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(ret);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
jsdisp_release(obj);
|
||||
}
|
||||
}
|
||||
|
||||
if(V_VT(arg) != VT_BSTR) {
|
||||
FIXME("vt arg0 = %d\n", V_VT(arg));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
src = V_BSTR(arg);
|
||||
|
||||
if(arg_cnt(dp) >= 2) {
|
||||
arg = get_arg(dp,1);
|
||||
if(V_VT(arg) != VT_BSTR) {
|
||||
FIXME("unimplemented for vt %d\n", V_VT(arg));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
opt = V_BSTR(arg);
|
||||
}
|
||||
|
||||
hres = create_regexp_str(ctx, src, -1, opt, strlenW(opt), &ret);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(retv) = VT_DISPATCH;
|
||||
V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(ret);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT RegExpConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_CONSTRUCT:
|
||||
return regexp_constructor(dispex->ctx, dp, retv);
|
||||
default:
|
||||
FIXME("unimplemented flags: %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT create_regexp_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -214,8 +214,10 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
|
|||
|
||||
ConnectionPointContainer_Destroy(&This->cp_container);
|
||||
|
||||
if(This->nsdoc)
|
||||
if(This->nsdoc) {
|
||||
remove_mutation_observer(This->nscontainer, This->nsdoc);
|
||||
nsIDOMHTMLDocument_Release(This->nsdoc);
|
||||
}
|
||||
if(This->nscontainer)
|
||||
NSContainer_Release(This->nscontainer);
|
||||
|
||||
|
|
|
@ -88,16 +88,14 @@ static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface)
|
|||
static HRESULT WINAPI HTMLLocation_GetTypeInfoCount(IHTMLLocation *iface, UINT *pctinfo)
|
||||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, pctinfo);
|
||||
return E_NOTIMPL;
|
||||
return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLLocation_GetTypeInfo(IHTMLLocation *iface, UINT iTInfo,
|
||||
LCID lcid, ITypeInfo **ppTInfo)
|
||||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||
return E_NOTIMPL;
|
||||
return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLLocation_GetIDsOfNames(IHTMLLocation *iface, REFIID riid,
|
||||
|
@ -105,9 +103,7 @@ static HRESULT WINAPI HTMLLocation_GetIDsOfNames(IHTMLLocation *iface, REFIID ri
|
|||
LCID lcid, DISPID *rgDispId)
|
||||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
|
||||
lcid, rgDispId);
|
||||
return E_NOTIMPL;
|
||||
return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLLocation_Invoke(IHTMLLocation *iface, DISPID dispIdMember,
|
||||
|
@ -115,9 +111,8 @@ static HRESULT WINAPI HTMLLocation_Invoke(IHTMLLocation *iface, DISPID dispIdMem
|
|||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
{
|
||||
HTMLLocation *This = HTMLLOCATION_THIS(iface);
|
||||
FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
||||
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
return E_NOTIMPL;
|
||||
return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
|
||||
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
|
||||
|
|
|
@ -468,6 +468,12 @@ static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, v
|
|||
}else if(IsEqualGUID(&IID_IHTMLStyle2, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLStyle2 %p)\n", This, ppv);
|
||||
*ppv = HTMLSTYLE2(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
|
||||
*ppv = HTMLSTYLE3(This);
|
||||
}else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
|
||||
TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
|
||||
*ppv = HTMLSTYLE4(This);
|
||||
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
|
||||
return *ppv ? S_OK : E_NOINTERFACE;
|
||||
}
|
||||
|
@ -612,8 +618,35 @@ static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)
|
|||
static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
static const WCHAR styleBold[] = {'b','o','l','d',0};
|
||||
static const WCHAR styleBolder[] = {'b','o','l','d','e','r',0};
|
||||
static const WCHAR styleLighter[] = {'l','i','g','h','t','e','r',0};
|
||||
static const WCHAR style100[] = {'1','0','0',0};
|
||||
static const WCHAR style200[] = {'2','0','0',0};
|
||||
static const WCHAR style300[] = {'3','0','0',0};
|
||||
static const WCHAR style400[] = {'4','0','0',0};
|
||||
static const WCHAR style500[] = {'5','0','0',0};
|
||||
static const WCHAR style600[] = {'6','0','0',0};
|
||||
static const WCHAR style700[] = {'7','0','0',0};
|
||||
static const WCHAR style800[] = {'8','0','0',0};
|
||||
static const WCHAR style900[] = {'9','0','0',0};
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
/* fontWeight can only be one of the following */
|
||||
if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
|
||||
strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
|
||||
strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
|
||||
strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
|
||||
strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
|
||||
strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
|
||||
strcmpiW(style900, v) == 0
|
||||
)
|
||||
{
|
||||
return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
|
||||
}
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
|
||||
|
@ -737,8 +770,10 @@ static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v
|
|||
static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
V_VT(p) = VT_BSTR;
|
||||
return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
|
||||
|
@ -890,8 +925,10 @@ static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIAN
|
|||
static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%x)\n", This, v);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%x)\n", This, v);
|
||||
|
||||
return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valUnderline : emptyW, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
|
||||
|
@ -920,8 +957,10 @@ static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VA
|
|||
static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%x)\n", This, v);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%x)\n", This, v);
|
||||
|
||||
return set_style_attr(This, STYLEID_TEXT_DECORATION, v ? valLineThrough : emptyW, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
|
||||
|
@ -1218,8 +1257,18 @@ static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
|
|||
static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
BSTR ret;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
V_VT(p) = VT_BSTR;
|
||||
V_BSTR(p) = ret;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
|
||||
|
@ -2425,6 +2474,7 @@ IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
|
|||
ret->ref = 1;
|
||||
ret->nsstyle = nsstyle;
|
||||
HTMLStyle2_Init(ret);
|
||||
HTMLStyle3_Init(ret);
|
||||
|
||||
nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ struct HTMLStyle {
|
|||
DispatchEx dispex;
|
||||
const IHTMLStyleVtbl *lpHTMLStyleVtbl;
|
||||
const IHTMLStyle2Vtbl *lpHTMLStyle2Vtbl;
|
||||
const IHTMLStyle3Vtbl *lpHTMLStyle3Vtbl;
|
||||
const IHTMLStyle4Vtbl *lpHTMLStyle4Vtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
|
@ -28,6 +30,8 @@ struct HTMLStyle {
|
|||
|
||||
#define HTMLSTYLE(x) ((IHTMLStyle*) &(x)->lpHTMLStyleVtbl)
|
||||
#define HTMLSTYLE2(x) ((IHTMLStyle2*) &(x)->lpHTMLStyle2Vtbl)
|
||||
#define HTMLSTYLE3(x) ((IHTMLStyle3*) &(x)->lpHTMLStyle3Vtbl)
|
||||
#define HTMLSTYLE4(x) ((IHTMLStyle4*) &(x)->lpHTMLStyle4Vtbl)
|
||||
|
||||
/* NOTE: Make sure to keep in sync with style_tbl in htmlstyle.c */
|
||||
typedef enum {
|
||||
|
@ -68,6 +72,7 @@ typedef enum {
|
|||
} styleid_t;
|
||||
|
||||
void HTMLStyle2_Init(HTMLStyle*);
|
||||
void HTMLStyle3_Init(HTMLStyle*);
|
||||
|
||||
HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,BSTR*);
|
||||
HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,LPCWSTR,DWORD);
|
||||
|
|
441
reactos/dll/win32/mshtml/htmlstyle3.c
Normal file
441
reactos/dll/win32/mshtml/htmlstyle3.c
Normal file
|
@ -0,0 +1,441 @@
|
|||
/*
|
||||
* Copyright 2009 Alistair Leslie-Hughes
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
|
||||
#include "mshtml_private.h"
|
||||
#include "htmlstyle.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
#define HTMLSTYLE3_THIS(iface) DEFINE_THIS(HTMLStyle, HTMLStyle3, iface)
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_QueryInterface(IHTMLStyle3 *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
|
||||
return IHTMLStyle_QueryInterface(HTMLSTYLE(This), riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI HTMLStyle3_AddRef(IHTMLStyle3 *iface)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
|
||||
return IHTMLStyle_AddRef(HTMLSTYLE(This));
|
||||
}
|
||||
|
||||
static ULONG WINAPI HTMLStyle3_Release(IHTMLStyle3 *iface)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
|
||||
return IHTMLStyle_Release(HTMLSTYLE(This));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_GetTypeInfoCount(IHTMLStyle3 *iface, UINT *pctinfo)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_GetTypeInfo(IHTMLStyle3 *iface, UINT iTInfo,
|
||||
LCID lcid, ITypeInfo **ppTInfo)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_GetIDsOfNames(IHTMLStyle3 *iface, REFIID riid,
|
||||
LPOLESTR *rgszNames, UINT cNames,
|
||||
LCID lcid, DISPID *rgDispId)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_Invoke(IHTMLStyle3 *iface, DISPID dispIdMember,
|
||||
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
|
||||
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_layoutFlow(IHTMLStyle3 *iface, BSTR v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_layoutFlow(IHTMLStyle3 *iface, BSTR *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_zoom(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_zoom(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_wordWrap(IHTMLStyle3 *iface, BSTR v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_wordWrap(IHTMLStyle3 *iface, BSTR *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_textUnderlinePosition(IHTMLStyle3 *iface, BSTR v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_textUnderlinePosition(IHTMLStyle3 *iface, BSTR *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_scrollbarBaseColor(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_scrollbarBaseColor(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_scrollbarFaceColor(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_scrollbarFaceColor(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_scrollbar3dLightColor(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_scrollbar3dLightColor(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_scrollbarShadowColor(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_scrollbarShadowColor(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_scrollbarHighlightColor(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_scrollbarHighlightColor(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_scrollbarDarkShadowColor(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_scrollbarDarkShadowColor(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_scrollbarArrowColor(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_scrollbarArrowColor(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_scrollbarTrackColor(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_scrollbarTrackColor(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_writingMode(IHTMLStyle3 *iface, BSTR v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_writingMode(IHTMLStyle3 *iface, BSTR *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_textAlignLast(IHTMLStyle3 *iface, BSTR v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_textAlignLast(IHTMLStyle3 *iface, BSTR *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_put_textKashidaSpace(IHTMLStyle3 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle3_get_textKashidaSpace(IHTMLStyle3 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE3_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IHTMLStyle3Vtbl HTMLStyle3Vtbl = {
|
||||
HTMLStyle3_QueryInterface,
|
||||
HTMLStyle3_AddRef,
|
||||
HTMLStyle3_Release,
|
||||
HTMLStyle3_GetTypeInfoCount,
|
||||
HTMLStyle3_GetTypeInfo,
|
||||
HTMLStyle3_GetIDsOfNames,
|
||||
HTMLStyle3_Invoke,
|
||||
HTMLStyle3_put_layoutFlow,
|
||||
HTMLStyle3_get_layoutFlow,
|
||||
HTMLStyle3_put_zoom,
|
||||
HTMLStyle3_get_zoom,
|
||||
HTMLStyle3_put_wordWrap,
|
||||
HTMLStyle3_get_wordWrap,
|
||||
HTMLStyle3_put_textUnderlinePosition,
|
||||
HTMLStyle3_get_textUnderlinePosition,
|
||||
HTMLStyle3_put_scrollbarBaseColor,
|
||||
HTMLStyle3_get_scrollbarBaseColor,
|
||||
HTMLStyle3_put_scrollbarFaceColor,
|
||||
HTMLStyle3_get_scrollbarFaceColor,
|
||||
HTMLStyle3_put_scrollbar3dLightColor,
|
||||
HTMLStyle3_get_scrollbar3dLightColor,
|
||||
HTMLStyle3_put_scrollbarShadowColor,
|
||||
HTMLStyle3_get_scrollbarShadowColor,
|
||||
HTMLStyle3_put_scrollbarHighlightColor,
|
||||
HTMLStyle3_get_scrollbarHighlightColor,
|
||||
HTMLStyle3_put_scrollbarDarkShadowColor,
|
||||
HTMLStyle3_get_scrollbarDarkShadowColor,
|
||||
HTMLStyle3_put_scrollbarArrowColor,
|
||||
HTMLStyle3_get_scrollbarArrowColor,
|
||||
HTMLStyle3_put_scrollbarTrackColor,
|
||||
HTMLStyle3_get_scrollbarTrackColor,
|
||||
HTMLStyle3_put_writingMode,
|
||||
HTMLStyle3_get_writingMode,
|
||||
HTMLStyle3_put_textAlignLast,
|
||||
HTMLStyle3_get_textAlignLast,
|
||||
HTMLStyle3_put_textKashidaSpace,
|
||||
HTMLStyle3_get_textKashidaSpace
|
||||
};
|
||||
|
||||
/*
|
||||
* IHTMLStyle4 Interface
|
||||
*/
|
||||
#define HTMLSTYLE4_THIS(iface) DEFINE_THIS(HTMLStyle, HTMLStyle4, iface)
|
||||
|
||||
static HRESULT WINAPI HTMLStyle4_QueryInterface(IHTMLStyle4 *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
|
||||
return IHTMLStyle_QueryInterface(HTMLSTYLE(This), riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI HTMLStyle4_AddRef(IHTMLStyle4 *iface)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
|
||||
return IHTMLStyle_AddRef(HTMLSTYLE(This));
|
||||
}
|
||||
|
||||
static ULONG WINAPI HTMLStyle4_Release(IHTMLStyle4 *iface)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
|
||||
return IHTMLStyle_Release(HTMLSTYLE(This));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle4_GetTypeInfoCount(IHTMLStyle4 *iface, UINT *pctinfo)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle4_GetTypeInfo(IHTMLStyle4 *iface, UINT iTInfo,
|
||||
LCID lcid, ITypeInfo **ppTInfo)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle4_GetIDsOfNames(IHTMLStyle4 *iface, REFIID riid,
|
||||
LPOLESTR *rgszNames, UINT cNames,
|
||||
LCID lcid, DISPID *rgDispId)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle4_Invoke(IHTMLStyle4 *iface, DISPID dispIdMember,
|
||||
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
|
||||
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle4_put_textOverflow(IHTMLStyle4 *iface, BSTR v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle4_get_textOverflow(IHTMLStyle4 *iface, BSTR *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle4_put_minHeight(IHTMLStyle4 *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle4_get_minHeight(IHTMLStyle4 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IHTMLStyle4Vtbl HTMLStyle4Vtbl = {
|
||||
HTMLStyle4_QueryInterface,
|
||||
HTMLStyle4_AddRef,
|
||||
HTMLStyle4_Release,
|
||||
HTMLStyle4_GetTypeInfoCount,
|
||||
HTMLStyle4_GetTypeInfo,
|
||||
HTMLStyle4_GetIDsOfNames,
|
||||
HTMLStyle4_Invoke,
|
||||
HTMLStyle4_put_textOverflow,
|
||||
HTMLStyle4_get_textOverflow,
|
||||
HTMLStyle4_put_minHeight,
|
||||
HTMLStyle4_get_minHeight
|
||||
};
|
||||
|
||||
void HTMLStyle3_Init(HTMLStyle *This)
|
||||
{
|
||||
This->lpHTMLStyle3Vtbl = &HTMLStyle3Vtbl;
|
||||
This->lpHTMLStyle4Vtbl = &HTMLStyle4Vtbl;
|
||||
}
|
|
@ -32,21 +32,21 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
typedef struct {
|
||||
struct HTMLStyleSheet {
|
||||
const IHTMLStyleSheetVtbl *lpHTMLStyleSheetVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
nsIDOMCSSStyleSheet *nsstylesheet;
|
||||
} HTMLStyleSheet;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct HTMLStyleSheetsCollection {
|
||||
const IHTMLStyleSheetsCollectionVtbl *lpHTMLStyleSheetsCollectionVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
nsIDOMStyleSheetList *nslist;
|
||||
} HTMLStyleSheetsCollection;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const IHTMLStyleSheetRulesCollectionVtbl *lpHTMLStyleSheetRulesCollectionVtbl;
|
||||
|
|
|
@ -54,11 +54,6 @@ static const WCHAR mshtml_keyW[] =
|
|||
'\\','W','i','n','e',
|
||||
'\\','M','S','H','T','M','L',0};
|
||||
|
||||
static const CHAR mshtml_keyA[] =
|
||||
{'S','o','f','t','w','a','r','e',
|
||||
'\\','W','i','n','e',
|
||||
'\\','M','S','H','T','M','L',0};
|
||||
|
||||
static HWND install_dialog = NULL;
|
||||
static LPWSTR tmp_file_name = NULL;
|
||||
static HANDLE tmp_file = INVALID_HANDLE_VALUE;
|
||||
|
@ -202,17 +197,17 @@ static BOOL install_from_unix_file(const char *file_name)
|
|||
wine_get_dos_file_name = (void*)GetProcAddress(GetModuleHandleW(kernel32W), "wine_get_dos_file_name");
|
||||
|
||||
if(wine_get_dos_file_name) { /* Wine UNIX mode */
|
||||
dos_file_name = wine_get_dos_file_name(file_name);
|
||||
if(!dos_file_name) {
|
||||
ERR("Could not get dos file name of %s\n", debugstr_a(file_name));
|
||||
return FALSE;
|
||||
}
|
||||
} else { /* ReactOS mode. */
|
||||
UINT res;
|
||||
WARN("Could not get wine_get_dos_file_name function, calling install_cab directly.\n");
|
||||
res = MultiByteToWideChar( CP_ACP, 0, file_name, -1, 0, 0);
|
||||
dos_file_name = heap_alloc (res*sizeof(WCHAR));
|
||||
MultiByteToWideChar( CP_ACP, 0, file_name, -1, dos_file_name, res);
|
||||
dos_file_name = wine_get_dos_file_name(file_name);
|
||||
if(!dos_file_name) {
|
||||
ERR("Could not get dos file name of %s\n", debugstr_a(file_name));
|
||||
return FALSE;
|
||||
}
|
||||
} else { /* Windows mode */
|
||||
UINT res;
|
||||
WARN("Could not get wine_get_dos_file_name function, calling install_cab directly.\n");
|
||||
res = MultiByteToWideChar( CP_ACP, 0, file_name, -1, 0, 0);
|
||||
dos_file_name = heap_alloc (res*sizeof(WCHAR));
|
||||
MultiByteToWideChar( CP_ACP, 0, file_name, -1, dos_file_name, res);
|
||||
}
|
||||
|
||||
ret = install_cab(dos_file_name);
|
||||
|
@ -224,18 +219,23 @@ static BOOL install_from_unix_file(const char *file_name)
|
|||
static BOOL install_from_registered_dir(void)
|
||||
{
|
||||
char *file_name;
|
||||
HKEY hkey;
|
||||
DWORD res, type, size = MAX_PATH;
|
||||
BOOL ret;
|
||||
|
||||
file_name = heap_alloc(size+sizeof(GECKO_FILE_NAME));
|
||||
/* @@ Wine registry key: HKCU\Software\Wine\MSHTML */
|
||||
res = RegGetValueA(HKEY_CURRENT_USER, mshtml_keyA, "GeckoCabDir", RRF_RT_ANY, &type, (PBYTE)file_name, &size);
|
||||
res = RegOpenKeyW(HKEY_CURRENT_USER, mshtml_keyW, &hkey);
|
||||
if(res != ERROR_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
file_name = heap_alloc(size+sizeof(GECKO_FILE_NAME));
|
||||
res = RegQueryValueExA(hkey, "GeckoCabDir", NULL, &type, (PBYTE)file_name, &size);
|
||||
if(res == ERROR_MORE_DATA) {
|
||||
file_name = heap_realloc(file_name, size+sizeof(GECKO_FILE_NAME));
|
||||
res = RegGetValueA(HKEY_CURRENT_USER, mshtml_keyA, "GeckoCabDir", RRF_RT_ANY, &type, (PBYTE)file_name, &size);
|
||||
res = RegQueryValueExA(hkey, "GeckoCabDir", NULL, &type, (PBYTE)file_name, &size);
|
||||
}
|
||||
|
||||
if(res != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ)) {
|
||||
RegCloseKey(hkey);
|
||||
if(res != ERROR_SUCCESS || type != REG_SZ) {
|
||||
heap_free(file_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -384,13 +384,14 @@ static HRESULT WINAPI InstallCallback_OnDataAvailable(IBindStatusCallback *iface
|
|||
BYTE buf[1024];
|
||||
DWORD size;
|
||||
HRESULT hres;
|
||||
DWORD dwBytesWritten;
|
||||
|
||||
do {
|
||||
DWORD written;
|
||||
|
||||
size = 0;
|
||||
hres = IStream_Read(str, buf, sizeof(buf), &size);
|
||||
if(size)
|
||||
WriteFile(tmp_file, buf, size, &dwBytesWritten, NULL);
|
||||
WriteFile(tmp_file, buf, size, &written, NULL);
|
||||
}while(hres == S_OK);
|
||||
|
||||
return S_OK;
|
||||
|
@ -446,7 +447,7 @@ static LPWSTR get_url(void)
|
|||
|
||||
if(size > sizeof(httpW) && !memcmp(url, httpW, sizeof(httpW))) {
|
||||
strcatW(url, v_formatW);
|
||||
MultiByteToWideChar(CP_ACP, 0, GECKO_VERSION, -1, url+strlenW(url), (size-strlenW(url)) / sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, GECKO_VERSION, -1, url+strlenW(url), size/sizeof(WCHAR)-strlenW(url));
|
||||
}
|
||||
|
||||
TRACE("Got URL %s\n", debugstr_w(url));
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<file>htmlselect.c</file>
|
||||
<file>htmlstyle.c</file>
|
||||
<file>htmlstyle2.c</file>
|
||||
<file>htmlstyle3.c</file>
|
||||
<file>htmlstylesheet.c</file>
|
||||
<file>htmltable.c</file>
|
||||
<file>htmltablerow.c</file>
|
||||
|
|
|
@ -199,14 +199,14 @@ struct ConnectionPoint {
|
|||
ConnectionPoint *next;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct HTMLLocation {
|
||||
DispatchEx dispex;
|
||||
const IHTMLLocationVtbl *lpHTMLLocationVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
HTMLDocument *doc;
|
||||
} HTMLLocation;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
|
||||
|
@ -510,6 +510,7 @@ void NSContainer_Release(NSContainer*);
|
|||
|
||||
void init_mutation(NSContainer*);
|
||||
void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
|
||||
void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
|
||||
|
||||
void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
|
||||
void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
|
||||
|
|
|
@ -55,6 +55,21 @@ void set_mutation_observer(NSContainer *nscontainer, nsIDOMHTMLDocument *nshtmld
|
|||
nsIDOMNSDocument_Release(nsdoc);
|
||||
}
|
||||
|
||||
void remove_mutation_observer(NSContainer *nscontainer, nsIDOMHTMLDocument *nshtmldoc)
|
||||
{
|
||||
nsIDOMNSDocument *nsdoc;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMHTMLDocument_QueryInterface(nshtmldoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get nsIDOMNSDocument: %08x\n", nsres);
|
||||
return;
|
||||
}
|
||||
|
||||
nsIDOMNSDocument_WineRemoveObserver(nsdoc, NSDOCOBS(nscontainer));
|
||||
nsIDOMNSDocument_Release(nsdoc);
|
||||
}
|
||||
|
||||
#define IE_MAJOR_VERSION 7
|
||||
#define IE_MINOR_VERSION 0
|
||||
|
||||
|
@ -358,7 +373,7 @@ static nsresult NSAPI nsDocumentObserver_QueryInterface(nsIDocumentObserver *ifa
|
|||
|
||||
if(IsEqualGUID(&IID_nsISupports, riid)) {
|
||||
TRACE("(%p)->(IID_nsISupports, %p)\n", This, result);
|
||||
*result = NSWBCHROME(This);
|
||||
*result = NSDOCOBS(This);
|
||||
}else if(IsEqualGUID(&IID_nsIMutationObserver, riid)) {
|
||||
TRACE("(%p)->(IID_nsIMutationObserver %p)\n", This, result);
|
||||
*result = NSDOCOBS(This);
|
||||
|
|
|
@ -857,8 +857,10 @@ void update_nsdocument(HTMLDocument *doc)
|
|||
return;
|
||||
}
|
||||
|
||||
if(doc->nsdoc)
|
||||
if(doc->nsdoc) {
|
||||
remove_mutation_observer(doc->nscontainer, doc->nsdoc);
|
||||
nsIDOMHTMLDocument_Release(doc->nsdoc);
|
||||
}
|
||||
|
||||
doc->nsdoc = nsdoc;
|
||||
|
||||
|
|
|
@ -23,11 +23,16 @@
|
|||
* compatible with XPCOM, usable in C code.
|
||||
*/
|
||||
|
||||
cpp_quote("#define GECKO_VERSION \"0.9.0\"")
|
||||
cpp_quote("#define GECKO_VERSION \"0.9.1\"")
|
||||
cpp_quote("#define GECKO_VERSION_STRING \"Wine Gecko \" GECKO_VERSION")
|
||||
|
||||
import "wtypes.idl";
|
||||
|
||||
cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
|
||||
cpp_quote("#undef GetForm")
|
||||
cpp_quote("#undef SetPort")
|
||||
cpp_quote("#endif")
|
||||
|
||||
typedef HRESULT nsresult;
|
||||
typedef ULONG nsrefcnt;
|
||||
|
||||
|
@ -873,6 +878,7 @@ interface nsIDOMNSDocument : nsISupports
|
|||
|
||||
/* Wine extensions */
|
||||
nsresult WineAddObserver(nsIDocumentObserver *aObserver);
|
||||
nsresult WineRemoveObserver(nsIDocumentObserver *aObserver);
|
||||
nsresult WineAddScriptRunner(nsIRunnable *aRunnable);
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ static BOOL init_script_engine(ScriptHost *script_host)
|
|||
WARN("Could not get IActiveScriptProperty: %08x\n", hres);
|
||||
}
|
||||
|
||||
hres = IActiveScriptParse_InitNew(script_host->parse);
|
||||
hres = IActiveScriptParse64_InitNew(script_host->parse);
|
||||
if(FAILED(hres)) {
|
||||
WARN("InitNew failed: %08x\n", hres);
|
||||
return FALSE;
|
||||
|
@ -175,12 +175,12 @@ static void release_script_engine(ScriptHost *This)
|
|||
|
||||
default:
|
||||
if(This->parse_proc) {
|
||||
IActiveScriptParseProcedure_Release(This->parse_proc);
|
||||
IUnknown_Release(This->parse_proc);
|
||||
This->parse_proc = NULL;
|
||||
}
|
||||
|
||||
if(This->parse) {
|
||||
IActiveScriptParse_Release(This->parse);
|
||||
IUnknown_Release(This->parse);
|
||||
This->parse = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ static void parse_text(ScriptHost *script_host, LPCWSTR text)
|
|||
|
||||
VariantInit(&var);
|
||||
memset(&excepinfo, 0, sizeof(excepinfo));
|
||||
hres = IActiveScriptParse_ParseScriptText(script_host->parse, text, windowW, NULL, script_endW,
|
||||
hres = IActiveScriptParse64_ParseScriptText(script_host->parse, text, windowW, NULL, script_endW,
|
||||
0, 0, SCRIPTTEXT_ISVISIBLE|SCRIPTTEXT_HOSTMANAGESSOURCE,
|
||||
&var, &excepinfo);
|
||||
if(FAILED(hres))
|
||||
|
@ -640,7 +640,7 @@ static BOOL get_guid_from_type(LPCWSTR type, GUID *guid)
|
|||
{'t','e','x','t','/','j','a','v','a','s','c','r','i','p','t',0};
|
||||
|
||||
/* FIXME: Handle more types */
|
||||
if(!strcmpW(type, text_javascriptW)) {
|
||||
if(!strcmpiW(type, text_javascriptW)) {
|
||||
*guid = CLSID_JScript;
|
||||
}else {
|
||||
FIXME("Unknown type %s\n", debugstr_w(type));
|
||||
|
@ -783,7 +783,7 @@ IDispatch *script_parse_event(HTMLDocument *doc, LPCWSTR text)
|
|||
if(!script_host || !script_host->parse_proc)
|
||||
return NULL;
|
||||
|
||||
hres = IActiveScriptParseProcedure_ParseProcedureText(script_host->parse_proc, ptr, NULL, emptyW,
|
||||
hres = IActiveScriptParseProcedure64_ParseProcedureText(script_host->parse_proc, ptr, NULL, emptyW,
|
||||
NULL, NULL, delimiterW, 0 /* FIXME */, 0,
|
||||
SCRIPTPROC_HOSTMANAGESSOURCE|SCRIPTPROC_IMPLICIT_THIS|SCRIPTPROC_IMPLICIT_PARENTS, &disp);
|
||||
if(FAILED(hres)) {
|
||||
|
|
|
@ -718,6 +718,11 @@ static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DIS
|
|||
TRACE("(%p)->(%d)\n", This, dispID);
|
||||
|
||||
switch(dispID) {
|
||||
case DISPID_UNKNOWN:
|
||||
/* Unknown means multiple properties changed, so check them all.
|
||||
* BUT the Webbrowser OleControl object doesn't appear to do this.
|
||||
*/
|
||||
return S_OK;
|
||||
case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
|
||||
return on_offlineconnected_change(This);
|
||||
case DISPID_AMBIENT_SILENT:
|
||||
|
|
|
@ -333,6 +333,85 @@ interface IDebugApplication32 : IRemoteDebugApplication
|
|||
[in] DWORD dwCookie);
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* interface IDebugApplication64
|
||||
*/
|
||||
[
|
||||
object,
|
||||
uuid(4dedc754-04c7-4f10-9e60-16a390fe6e62),
|
||||
pointer_default(unique),
|
||||
local
|
||||
]
|
||||
interface IDebugApplication64 : IRemoteDebugApplication
|
||||
{
|
||||
HRESULT SetName(
|
||||
[in] LPCOLESTR pstrName);
|
||||
|
||||
HRESULT StepOutComplete();
|
||||
|
||||
HRESULT DebugOutput(
|
||||
[in] LPCOLESTR pstr);
|
||||
|
||||
HRESULT StartDebugSession();
|
||||
|
||||
HRESULT HandleBreakPoint(
|
||||
[in] BREAKREASON br,
|
||||
[out] BREAKRESUMEACTION *pbra);
|
||||
|
||||
HRESULT Close();
|
||||
|
||||
HRESULT GetBreakFlags(
|
||||
[out] APPBREAKFLAGS *pabf,
|
||||
[out] IRemoteDebugApplicationThread **pprdatSteppingThread);
|
||||
|
||||
HRESULT GetCurrentThread(
|
||||
[out] IDebugApplicationThread **pat);
|
||||
|
||||
HRESULT CreateAsyncDebugOperation(
|
||||
[in] IDebugSyncOperation *psdo,
|
||||
[out] IDebugAsyncOperation **ppado);
|
||||
|
||||
HRESULT AddStackFrameSniffer(
|
||||
[in] IDebugStackFrameSniffer *pdsfs,
|
||||
[out] DWORD *pdwCookie);
|
||||
|
||||
HRESULT RemoveStackFrameSniffer(
|
||||
[in] DWORD dwCookie);
|
||||
|
||||
HRESULT QueryCurrentThreadIsDebuggerThread();
|
||||
|
||||
HRESULT SynchronousCallInDebuggerThread(
|
||||
[in] IDebugThreadCall32 *pptc,
|
||||
[in] DWORDLONG dwParam1,
|
||||
[in] DWORDLONG dwParam2,
|
||||
[in] DWORDLONG dwParam3);
|
||||
|
||||
HRESULT CreateApplicationNode(
|
||||
[out] IDebugApplicationNode **ppdanNew);
|
||||
|
||||
HRESULT FireDebuggerEvent(
|
||||
[in] REFGUID riid,
|
||||
[in] IUnknown *punk);
|
||||
|
||||
HRESULT HandleRuntimeError(
|
||||
[in] IActiveScriptErrorDebug *pErrorDebug,
|
||||
[in] IActiveScriptSite *pScriptSite,
|
||||
[out] BREAKRESUMEACTION *pbra,
|
||||
[out] ERRORRESUMEACTION *perra,
|
||||
[out] BOOL *pfCallOnScriptError);
|
||||
|
||||
BOOL FCanJitDebug();
|
||||
|
||||
BOOL FIsAutoJitDebugEnabled();
|
||||
|
||||
HRESULT AddGlobalExpressionContextProvider(
|
||||
[in] IProvideExpressionContexts *pdsfs,
|
||||
[out] DWORDLONG *pdwCookie);
|
||||
|
||||
HRESULT RemoveGlobalExpressionContextProvider(
|
||||
[in] DWORDLONG dwCookie);
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* interface IActiveScriptSiteDebug32
|
||||
*/
|
||||
|
@ -362,6 +441,35 @@ interface IActiveScriptSiteDebug32 : IUnknown
|
|||
[out] BOOL *pfCallOnScriptErrorWhenContinuing);
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* interface IActiveScriptSiteDebug64
|
||||
*/
|
||||
[
|
||||
object,
|
||||
uuid(d6b96b0a-7463-402c-92ac-89984226942f),
|
||||
pointer_default(unique),
|
||||
local
|
||||
]
|
||||
interface IActiveScriptSiteDebug64 : IUnknown
|
||||
{
|
||||
HRESULT GetDocumentContextFromPosition(
|
||||
[in] DWORDLONG dwSourceContext,
|
||||
[in] ULONG uCharacterOffset,
|
||||
[in] ULONG uNumChars,
|
||||
[out] IDebugDocumentContext **ppsc);
|
||||
|
||||
HRESULT GetApplication(
|
||||
[out] IDebugApplication64 **ppda);
|
||||
|
||||
HRESULT GetRootApplicationNode(
|
||||
[out] IDebugApplicationNode **ppdanRoot);
|
||||
|
||||
HRESULT OnScriptErrorDebug(
|
||||
[in] IActiveScriptErrorDebug *pErrorDebug,
|
||||
[out] BOOL *pfEnterDebugger,
|
||||
[out] BOOL *pfCallOnScriptErrorWhenContinuing);
|
||||
}
|
||||
|
||||
cpp_quote("#ifndef DISABLE_ACTIVDBG_INTERFACE_WRAPPERS")
|
||||
cpp_quote("#ifdef _WIN64")
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ object,
|
|||
uuid(BB1A2AE2-A4F9-11cf-8F20-00805F2CD064),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IActiveScriptParse : IUnknown
|
||||
interface IActiveScriptParse32 : IUnknown
|
||||
{
|
||||
HRESULT InitNew(void);
|
||||
|
||||
|
@ -299,6 +299,50 @@ interface IActiveScriptParse : IUnknown
|
|||
);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(c7ef7658-e1ee-480e-97ea-d52cb4d76d17),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IActiveScriptParse64 : IUnknown
|
||||
{
|
||||
HRESULT InitNew(void);
|
||||
|
||||
HRESULT AddScriptlet(
|
||||
[in] LPCOLESTR pstrDefaultName,
|
||||
[in] LPCOLESTR pstrCode,
|
||||
[in] LPCOLESTR pstrItemName,
|
||||
[in] LPCOLESTR pstrSubItemName,
|
||||
[in] LPCOLESTR pstrEventName,
|
||||
[in] LPCOLESTR pstrDelimiter,
|
||||
[in] DWORDLONG dwSourceContextCookie,
|
||||
[in] ULONG ulStartingLineNumber,
|
||||
[in] DWORD dwFlags,
|
||||
[out] BSTR *pbstrName,
|
||||
[out] EXCEPINFO *pexcepinfo
|
||||
);
|
||||
|
||||
HRESULT ParseScriptText(
|
||||
[in] LPCOLESTR pstrCode,
|
||||
[in] LPCOLESTR pstrItemName,
|
||||
[in] IUnknown *punkContext,
|
||||
[in] LPCOLESTR pstrDelimiter,
|
||||
[in] DWORDLONG dwSourceContextCookie,
|
||||
[in] ULONG ulStartingLineNumber,
|
||||
[in] DWORD dwFlags,
|
||||
[out] VARIANT *pvarResult,
|
||||
[out] EXCEPINFO *pexcepinfo
|
||||
);
|
||||
}
|
||||
|
||||
cpp_quote("#ifdef _WIN64")
|
||||
cpp_quote("#define IActiveScriptParse IActiveScriptParse64")
|
||||
cpp_quote("#define IID_IActiveScriptParse IID_IActiveScriptParse64")
|
||||
cpp_quote("#else")
|
||||
cpp_quote("#define IActiveScriptParse IActiveScriptParse32")
|
||||
cpp_quote("#define IID_IActiveScriptParse IID_IActiveScriptParse32")
|
||||
cpp_quote("#endif")
|
||||
|
||||
cpp_quote("typedef IActiveScriptParse *PIActiveScriptParse;")
|
||||
|
||||
[
|
||||
|
@ -306,7 +350,7 @@ object,
|
|||
uuid(1CFF0050-6FDD-11d0-9328-00A0C90DCAA9),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IActiveScriptParseProcedureOld : IUnknown
|
||||
interface IActiveScriptParseProcedureOld32 : IUnknown
|
||||
{
|
||||
HRESULT ParseProcedureText(
|
||||
[in] LPCOLESTR pstrCode,
|
||||
|
@ -321,12 +365,40 @@ interface IActiveScriptParseProcedureOld : IUnknown
|
|||
);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(21f57128-08c9-4638-ba12-22d15d88dc5c),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IActiveScriptParseProcedureOld64 : IUnknown
|
||||
{
|
||||
HRESULT ParseProcedureText(
|
||||
[in] LPCOLESTR pstrCode,
|
||||
[in] LPCOLESTR pstrFormalParams,
|
||||
[in] LPCOLESTR pstrItemName,
|
||||
[in] IUnknown *punkContext,
|
||||
[in] LPCOLESTR pstrDelimiter,
|
||||
[in] DWORDLONG dwSourceContextCookie,
|
||||
[in] ULONG ulStartingLineNumber,
|
||||
[in] DWORD dwFlags,
|
||||
[out] IDispatch **ppdisp
|
||||
);
|
||||
}
|
||||
|
||||
cpp_quote("#ifdef _WIN64")
|
||||
cpp_quote("#define IActiveScriptParseProcedureOld IActiveScriptParseProcedureOld64")
|
||||
cpp_quote("#define IID_IActiveScriptParseProcedureOld IID_IActiveScriptParseProcedureOld64")
|
||||
cpp_quote("#else")
|
||||
cpp_quote("#define IActiveScriptParseProcedureOld IActiveScriptParseProcedureOld32")
|
||||
cpp_quote("#define IID_IActiveScriptParseProcedureOld IID_IActiveScriptParseProcedureOld32")
|
||||
cpp_quote("#endif")
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(AA5B6A80-B834-11d0-932F-00A0C90DCAA9),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IActiveScriptParseProcedure : IUnknown
|
||||
interface IActiveScriptParseProcedure32 : IUnknown
|
||||
{
|
||||
HRESULT ParseProcedureText(
|
||||
[in] LPCOLESTR pstrCode,
|
||||
|
@ -342,15 +414,61 @@ interface IActiveScriptParseProcedure : IUnknown
|
|||
);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(c64713b6-e029-4cc5-9200-438b72890b6a),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IActiveScriptParseProcedure64 : IUnknown
|
||||
{
|
||||
HRESULT ParseProcedureText(
|
||||
[in] LPCOLESTR pstrCode,
|
||||
[in] LPCOLESTR pstrFormalParams,
|
||||
[in] LPCOLESTR pstrProcedureName,
|
||||
[in] LPCOLESTR pstrItemName,
|
||||
[in] IUnknown *punkContext,
|
||||
[in] LPCOLESTR pstrDelimiter,
|
||||
[in] DWORDLONG dwSourceContextCookie,
|
||||
[in] ULONG ulStartingLineNumber,
|
||||
[in] DWORD dwFlags,
|
||||
[out] IDispatch **ppdisp
|
||||
);
|
||||
}
|
||||
|
||||
cpp_quote("#ifdef _WIN64")
|
||||
cpp_quote("#define IActiveScriptParseProcedure IActiveScriptParseProcedure64")
|
||||
cpp_quote("#define IID_IActiveScriptParseProcedure IID_IActiveScriptParseProcedure64")
|
||||
cpp_quote("#else")
|
||||
cpp_quote("#define IActiveScriptParseProcedure IActiveScriptParseProcedure32")
|
||||
cpp_quote("#define IID_IActiveScriptParseProcedure IID_IActiveScriptParseProcedure32")
|
||||
cpp_quote("#endif")
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(71ee5b20-fb04-11d1-b3a8-00a0c911e8b2),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IActiveScriptParseProcedure2 : IActiveScriptParseProcedure
|
||||
interface IActiveScriptParseProcedure2_32 : IActiveScriptParseProcedure32
|
||||
{
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(fe7c4271-210c-448d-9f54-76dab7047b28),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IActiveScriptParseProcedure2_64 : IActiveScriptParseProcedure64
|
||||
{
|
||||
}
|
||||
|
||||
cpp_quote("#ifdef _WIN64")
|
||||
cpp_quote("#define IActiveScriptParseProcedure2 IActiveScriptParseProcedure2_64")
|
||||
cpp_quote("#define IID_IActiveScriptParseProcedure2 IID_IActiveScriptParseProcedure2_64")
|
||||
cpp_quote("#else")
|
||||
cpp_quote("#define IActiveScriptParseProcedure2 IActiveScriptParseProcedure2_32")
|
||||
cpp_quote("#define IID_IActiveScriptParseProcedure2 IID_IActiveScriptParseProcedure2_32")
|
||||
cpp_quote("#endif")
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(63CDBCB0-C1B1-11d0-9336-00A0C90DCAA9),
|
||||
|
|
|
@ -74,8 +74,10 @@
|
|||
#define DISPID_SCRIPT DISPID_NORMAL_FIRST
|
||||
#define DISPID_STYLESHEET DISPID_NORMAL_FIRST
|
||||
#define DISPID_STYLERULE DISPID_NORMAL_FIRST
|
||||
#define DISPID_STYLEPAGE DISPID_NORMAL_FIRST
|
||||
#define DISPID_STYLESHEETS_COL DISPID_NORMAL_FIRST
|
||||
#define DISPID_STYLERULES_COL DISPID_NORMAL_FIRST
|
||||
#define DISPID_STYLEPAGES_COL DISPID_NORMAL_FIRST
|
||||
#define DISPID_MIMETYPES_COL DISPID_NORMAL_FIRST
|
||||
#define DISPID_PLUGINS_COL DISPID_NORMAL_FIRST
|
||||
#define DISPID_2D DISPID_NORMAL_FIRST
|
||||
|
@ -1798,10 +1800,22 @@
|
|||
#define DISPID_IHTMLSTYLESHEET_RULES (DISPID_STYLESHEET+15)
|
||||
#define DISPID_IHTMLSTYLESHEET_DISABLED STDPROPID_XOBJ_DISABLED
|
||||
|
||||
/* IHTMLStyleSheet2 */
|
||||
#define DISPID_IHTMLSTYLESHEET2_PAGES (DISPID_STYLESHEET+16)
|
||||
#define DISPID_IHTMLSTYLESHEET2_ADDPAGERULE (DISPID_STYLESHEET+17)
|
||||
|
||||
/* IHTMLStyleSheetRulesCollection */
|
||||
#define DISPID_IHTMLSTYLESHEETRULESCOLLECTION_LENGTH (DISPID_STYLERULES_COL+1)
|
||||
#define DISPID_IHTMLSTYLESHEETRULESCOLLECTION_ITEM DISPID_VALUE
|
||||
|
||||
/* IHTMLStyleSheetPage */
|
||||
#define DISPID_IHTMLSTYLESHEETPAGE_SELECTOR (DISPID_STYLEPAGE+1)
|
||||
#define DISPID_IHTMLSTYLESHEETPAGE_PSEUDOCLASS (DISPID_STYLEPAGE+2)
|
||||
|
||||
/* IHTMLStyleSheetPagesCollection */
|
||||
#define DISPID_IHTMLSTYLESHEETPAGESCOLLECTION_LENGTH (DISPID_STYLEPAGES_COL+1)
|
||||
#define DISPID_IHTMLSTYLESHEETPAGESCOLLECTION_ITEM DISPID_VALUE
|
||||
|
||||
/* IHTMLStyleSheetRule */
|
||||
#define DISPID_IHTMLSTYLESHEETRULE_SELECTORTEXT (DISPID_STYLERULE+1)
|
||||
#define DISPID_IHTMLSTYLESHEETRULE_READONLY (DISPID_STYLERULE+2)
|
||||
|
|
|
@ -33,6 +33,10 @@ cpp_quote("DEFINE_GUID(SID_SHTMLEditServices, 0x3050f7f9,0x98b5,0x11cf,0xbb,0x
|
|||
cpp_quote("#define SID_SHTMLWindow IID_IHTMLWindow2")
|
||||
cpp_quote("#define SID_SElementBehaviorFactory IID_IElementBehaviorFactory")
|
||||
|
||||
cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
|
||||
cpp_quote("#undef FindText")
|
||||
cpp_quote("#endif")
|
||||
|
||||
typedef enum {
|
||||
POINTER_GRAVITY_Left,
|
||||
POINTER_GRAVITY_Right,
|
||||
|
@ -5393,6 +5397,38 @@ interface IHTMLStyleSheetRulesCollection : IDispatch
|
|||
[retval, out] IHTMLStyleSheetRule **ppHTMLStyleSheetRule);
|
||||
}
|
||||
|
||||
[
|
||||
odl,
|
||||
oleautomation,
|
||||
dual,
|
||||
uuid(3050f7ee-98b5-11cf-bb82-00aa00bdce0b)
|
||||
]
|
||||
interface IHTMLStyleSheetPage : IDispatch
|
||||
{
|
||||
[propget, id(DISPID_IHTMLSTYLESHEETPAGE_SELECTOR)]
|
||||
HRESULT selector([retval, out] BSTR *p);
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEETPAGE_PSEUDOCLASS)]
|
||||
HRESULT pseudoClass([retval, out] BSTR *p);
|
||||
}
|
||||
|
||||
[
|
||||
odl,
|
||||
oleautomation,
|
||||
dual,
|
||||
uuid(3050f7f0-98b5-11cf-bb82-00aa00bdce0b)
|
||||
]
|
||||
interface IHTMLStyleSheetPagesCollection : IDispatch
|
||||
{
|
||||
[propget, id(DISPID_IHTMLSTYLESHEETPAGESCOLLECTION_LENGTH)]
|
||||
HRESULT length([retval, out] long *p);
|
||||
|
||||
[id(DISPID_IHTMLSTYLESHEETPAGESCOLLECTION_ITEM)]
|
||||
HRESULT item(
|
||||
[in] long index,
|
||||
[retval, out] IHTMLStyleSheetPage **ppHTMLStyleSheetPage);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IHTMLStyleSheet interface
|
||||
*/
|
||||
|
@ -5475,6 +5511,125 @@ interface IHTMLStyleSheet : IDispatch
|
|||
HRESULT rules([retval, out] IHTMLStyleSheetRulesCollection **p);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IHTMLStyleSheet2 interface
|
||||
*/
|
||||
[
|
||||
odl,
|
||||
oleautomation,
|
||||
dual,
|
||||
uuid(3050f3d1-98b5-11cf-bb82-00aa00bdce0b)
|
||||
]
|
||||
interface IHTMLStyleSheet2 : IDispatch
|
||||
{
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET2_PAGES)]
|
||||
HRESULT pages([retval, out] IHTMLStyleSheetPagesCollection **p);
|
||||
|
||||
[id(DISPID_IHTMLSTYLESHEET2_ADDPAGERULE)]
|
||||
HRESULT addPageRule(
|
||||
[in] BSTR bstrSelector,
|
||||
[in] BSTR bstrStyle,
|
||||
[defaultvalue(-1), in] long lIndex,
|
||||
[retval, out] long *plNewIndex);
|
||||
}
|
||||
|
||||
[
|
||||
hidden,
|
||||
uuid(3050f58d-98b5-11cf-bb82-00aa00bdce0b)
|
||||
]
|
||||
dispinterface DispHTMLStyleSheet
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[propput, id(DISPID_IHTMLSTYLESHEET_TITLE)]
|
||||
void title(BSTR v);
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_TITLE)]
|
||||
BSTR title();
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_PARENTSTYLESHEET)]
|
||||
IHTMLStyleSheet* parentStyleSheet();
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_OWNINGELEMENT)]
|
||||
IHTMLElement* owningElement();
|
||||
|
||||
[propput, id(DISPID_IHTMLSTYLESHEET_DISABLED)]
|
||||
void disabled(VARIANT_BOOL v);
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_DISABLED)]
|
||||
VARIANT_BOOL disabled();
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_READONLY)]
|
||||
VARIANT_BOOL readOnly();
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_IMPORTS)]
|
||||
IHTMLStyleSheetsCollection* imports();
|
||||
|
||||
[propput, id(DISPID_IHTMLSTYLESHEET_HREF)]
|
||||
void href(BSTR v);
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_HREF)]
|
||||
BSTR href();
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_TYPE)]
|
||||
BSTR type();
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_ID)]
|
||||
BSTR id();
|
||||
|
||||
[id(DISPID_IHTMLSTYLESHEET_ADDIMPORT)]
|
||||
long addImport(
|
||||
[in] BSTR bstrURL,
|
||||
[defaultvalue(-1), in] long lIndex);
|
||||
|
||||
[id(DISPID_IHTMLSTYLESHEET_ADDRULE)]
|
||||
long addRule(
|
||||
[in] BSTR bstrSelector,
|
||||
[in] BSTR bstrStyle,
|
||||
[defaultvalue(-1), in] long lIndex);
|
||||
|
||||
[id(DISPID_IHTMLSTYLESHEET_REMOVEIMPORT)]
|
||||
void removeImport([in] long lIndex);
|
||||
|
||||
[id(DISPID_IHTMLSTYLESHEET_REMOVERULE)]
|
||||
void removeRule([in] long lIndex);
|
||||
|
||||
[propput, id(DISPID_IHTMLSTYLESHEET_MEDIA)]
|
||||
void media(BSTR v);
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_MEDIA)]
|
||||
BSTR media();
|
||||
|
||||
[propput, id(DISPID_IHTMLSTYLESHEET_CSSTEXT)]
|
||||
void cssText(BSTR v);
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_CSSTEXT)]
|
||||
BSTR cssText();
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET_RULES)]
|
||||
IHTMLStyleSheetRulesCollection* rules();
|
||||
|
||||
[propget, id(DISPID_IHTMLSTYLESHEET2_PAGES)]
|
||||
IHTMLStyleSheetPagesCollection* pages();
|
||||
|
||||
[id(DISPID_IHTMLSTYLESHEET2_ADDPAGERULE)]
|
||||
long addPageRule(
|
||||
[in] BSTR bstrSelector,
|
||||
[in] BSTR bstrStyle,
|
||||
[defaultvalue(-1), in] long lIndex);
|
||||
}
|
||||
|
||||
[
|
||||
noncreatable,
|
||||
uuid(3050f2e4-98b5-11cf-bb82-00aa00bdce0b)
|
||||
]
|
||||
coclass HTMLStyleSheet
|
||||
{
|
||||
[default] dispinterface DispHTMLStyleSheet;
|
||||
interface IHTMLStyleSheet;
|
||||
interface IHTMLStyleSheet2;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IHTMLStyleSheetsCollection interface
|
||||
*/
|
||||
|
@ -5646,6 +5801,15 @@ interface IHTMLTxtRange : IDispatch
|
|||
[retval, out] VARIANT_BOOL *pfRet);
|
||||
}
|
||||
|
||||
[
|
||||
noncreatable,
|
||||
uuid(3050f37f-98b5-11cf-bb82-00aa00bdce0b)
|
||||
]
|
||||
coclass HTMLStyleSheetsCollection
|
||||
{
|
||||
[default] interface IHTMLStyleSheetsCollection;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IHTMLFormElement interface
|
||||
*/
|
||||
|
@ -12622,6 +12786,15 @@ interface IOmHistory : IDispatch
|
|||
HRESULT go([optional, in] VARIANT *pvargdistance);
|
||||
}
|
||||
|
||||
[
|
||||
noncreatable,
|
||||
uuid(FECEAAA3-8405-11cf-8BA1-00AA00476DA6)
|
||||
]
|
||||
coclass HTMLHistory
|
||||
{
|
||||
[default] interface IOmHistory;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IHTMLMimeTypesCollection interface
|
||||
*/
|
||||
|
@ -12637,6 +12810,15 @@ interface IHTMLMimeTypesCollection : IDispatch
|
|||
HRESULT length([retval, out] long *p);
|
||||
}
|
||||
|
||||
[
|
||||
noncreatable,
|
||||
uuid(3050f3fe-98b5-11cf-bb82-00aa00bdce0b)
|
||||
]
|
||||
coclass CMimeTypes
|
||||
{
|
||||
[default] interface IHTMLMimeTypesCollection;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IHTMLPluginsCollection interface
|
||||
*/
|
||||
|
@ -12655,6 +12837,15 @@ interface IHTMLPluginsCollection : IDispatch
|
|||
HRESULT refresh([defaultvalue(0), in] VARIANT_BOOL reload);
|
||||
}
|
||||
|
||||
[
|
||||
noncreatable,
|
||||
uuid(3050f3ff-98b5-11cf-bb82-00aa00bdce0b)
|
||||
]
|
||||
coclass CPlugins
|
||||
{
|
||||
[default] interface IHTMLPluginsCollection;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IHTMLOpsProfile interface
|
||||
*/
|
||||
|
@ -12718,6 +12909,15 @@ interface IHTMLOpsProfile : IDispatch
|
|||
HRESULT doWriteRequest([retval, out] VARIANT_BOOL *success);
|
||||
}
|
||||
|
||||
[
|
||||
noncreatable,
|
||||
uuid(3050f402-98b5-11cf-bb82-00aa00bdce0b)
|
||||
]
|
||||
coclass COpsProfile
|
||||
{
|
||||
[default] interface IHTMLOpsProfile;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IOmNavigator interface
|
||||
*/
|
||||
|
@ -12790,6 +12990,15 @@ interface IOmNavigator : IDispatch
|
|||
HRESULT userProfile([retval, out] IHTMLOpsProfile **p);
|
||||
}
|
||||
|
||||
[
|
||||
noncreatable,
|
||||
uuid(FECEAAA6-8405-11cf-8BA1-00AA00476DA6)
|
||||
]
|
||||
coclass HTMLNavigator
|
||||
{
|
||||
[default] interface IOmNavigator;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IHTMLLocation interface
|
||||
*/
|
||||
|
@ -12862,6 +13071,15 @@ interface IHTMLLocation : IDispatch
|
|||
HRESULT toString([retval, out] BSTR *String);
|
||||
}
|
||||
|
||||
[
|
||||
noncreatable,
|
||||
uuid(163BB1E1-6E00-11cf-837A-48DC04C10000)
|
||||
]
|
||||
coclass HTMLLocation
|
||||
{
|
||||
[default] interface IHTMLLocation;
|
||||
}
|
||||
|
||||
[
|
||||
odl,
|
||||
oleautomation,
|
||||
|
|
Loading…
Reference in a new issue