27#define FDEX_VERSION_MASK 0xf0000000
28#define GOLDEN_RATIO 0x9E3779B9U
62 return prop -
This->props;
92 max =
This->builtin_info->props_cnt-1;
108 return This->builtin_info->props +
i;
138 if(
This->buf_size !=
This->prop_cnt)
147 for(
i=0;
i<
This->buf_size;
i++) {
148 This->props[
i].bucket_head = 0;
149 This->props[
i].bucket_next = 0;
152 for(
i=1;
i<
This->prop_cnt;
i++) {
156 props->bucket_next =
This->props[bucket].bucket_head;
157 This->props[bucket].bucket_head =
i;
171 prop = &
This->props[
This->prop_cnt];
181 This->props[bucket].bucket_head =
This->prop_cnt++;
200 unsigned bucket,
pos, prev = 0;
204 pos =
This->props[bucket].bucket_head;
208 This->props[prev].bucket_next =
This->props[
pos].bucket_next;
209 This->props[
pos].bucket_next =
This->props[bucket].bucket_head;
210 This->props[bucket].bucket_head =
pos;
238 if(
This->builtin_info->idx_length) {
244 if(!*
ptr && idx < This->builtin_info->idx_length(
This)) {
274 if(
This->prototype) {
281 del->u.ref = prop -
This->prototype->props;
328 for(
i=0;
i < dp->cNamedArgs;
i++) {
333 WARN(
"This is not VT_DISPATCH\n");
338 TRACE(
"no this passed\n");
349 cnt = dp->cArgs - dp->cNamedArgs;
359 for(
i = 0;
i < cnt;
i++) {
391 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
421 FIXME(
"Invoking PROP_IDX not yet supported\n");
499 prototype_iter = prototype_iter->
prototype;
500 prop_iter = prototype_iter->
props + prop_iter->
u.
ref;
510 TRACE(
"getter with no setter\n");
528 TRACE(
"no setter\n");
533 if(!
This->builtin_info->idx_put) {
534 TRACE(
"no put_idx\n");
549 if(
This->builtin_info->on_put)
571 for(iter =
This->prototype->props; iter < This->prototype->props+
This->prototype->prop_cnt; iter++) {
581 prop->
u.
ref = iter -
This->prototype->props;
604 *
ppv = &
This->IDispatchEx_iface;
607 *
ppv = &
This->IDispatchEx_iface;
610 *
ppv = &
This->IDispatchEx_iface;
652 FIXME(
"(%p)->(%u %u %p)\n",
This, iTInfo, lcid, ppTInfo);
667 for(
i=0;
i < cNames;
i++) {
668 hres = IDispatchEx_GetDispID(&
This->IDispatchEx_iface, rgszNames[
i], 0, rgDispId+
i);
678 VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
UINT *puArgErr)
683 lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
685 return IDispatchEx_InvokeEx(&
This->IDispatchEx_iface, dispIdMember, lcid,
wFlags,
686 pDispParams, pVarResult, pExcepInfo,
NULL);
695 if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit|
FDEX_VERSION_MASK)) {
696 FIXME(
"Unsupported grfdex %x\n", grfdex);
710 TRACE(
"(%p)->(%x %x %x %p %p %p %p)\n",
This,
id, lcid,
wFlags, pdp, pvarRes, pei, pspCaller);
717 TRACE(
"invalid id\n");
728 case DISPATCH_CONSTRUCT: {
759 for(
i=0;
i < pdp->cNamedArgs;
i++) {
760 if(pdp->rgdispidNamedArgs[
i] == DISPID_PROPERTYPUT)
764 if(
i == pdp->cNamedArgs) {
765 TRACE(
"no value to set\n");
783 *pei =
This->ctx->ei.ei;
801 FIXME(
"not supported on accessor property\n");
814 if(grfdex & ~(fdexNameCaseSensitive|fdexNameEnsure|fdexNameImplicit|
FDEX_VERSION_MASK))
815 FIXME(
"Unsupported grfdex %x\n", grfdex);
821 TRACE(
"not found\n");
838 WARN(
"invalid id\n");
848 FIXME(
"(%p)->(%x %x %p)\n",
This,
id, grfdexFetch, pgrfdex);
857 TRACE(
"(%p)->(%x %p)\n",
This,
id, pbstrName);
879 *
pid = DISPID_STARTENUM;
921 TRACE(
"%p (%p)\n", dispex, prototype);
982 for(prop =
obj->props; prop < obj->
props+
obj->prop_cnt; prop++) {
1003 if(
obj->builtin_info->destructor)
1004 obj->builtin_info->destructor(
obj);
1014 TRACE(
"(%p) ref=%d\n", jsdisp,
ref);
1022 TRACE(
"(%p) ref=%d\n", jsdisp,
ref);
1036 static const WCHAR prototypeW[] = {
'p',
'r',
'o',
't',
'o',
't',
'y',
'p',
'e',0};
1044 ERR(
"Could not get prototype\n");
1072 if(
flags & fdexNameEnsure)
1101 WARN(
"Not a function\n");
1106 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1148 FIXME(
"disp_call(propput) on builtin object\n");
1153 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1159 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1172 dp.rgdispidNamedArgs =
NULL;
1188 if(dp.rgvarg !=
buf)
1196 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1199 &
ctx->jscaller->IServiceProvider_iface);
1200 IDispatchEx_Release(dispex);
1204 if(
flags == DISPATCH_CONSTRUCT) {
1205 WARN(
"IDispatch cannot be constructor\n");
1209 TRACE(
"using IDispatch\n");
1215 if(dp.rgvarg !=
buf)
1243 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1249 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1253 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1255 TRACE(
"using IDispatch\n");
1265 dp.rgdispidNamedArgs = &this_id;
1269 dp.rgdispidNamedArgs =
NULL;
1276 IDispatchEx_Release(dispex);
1288 if(dp.rgvarg !=
buf)
1291 IDispatchEx_Release(dispex);
1303 hres = IDispatchEx_InvokeEx(dispex, DISPID_VALUE,
ctx->lcid,
flags, &dp,
r ? &retv :
NULL, &
ctx->ei.ei,
1304 &
ctx->jscaller->IServiceProvider_iface);
1305 IDispatchEx_Release(dispex);
1309 if(
flags == DISPATCH_CONSTRUCT) {
1310 WARN(
"IDispatch cannot be constructor\n");
1319 if(dp.rgvarg !=
buf)
1353 static const WCHAR formatW[] = {
'%',
'd',0};
1376 DISPID dispid = DISPID_PROPERTYPUT;
1379 DISPPARAMS dp = {&
var, &dispid, 1, 1};
1390 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1393 &
ctx->jscaller->IServiceProvider_iface);
1394 IDispatchEx_Release(dispex);
1398 TRACE(
"using IDispatch\n");
1431 static const WCHAR formatW[] = {
'%',
'd',0};
1475 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1477 hres = IDispatchEx_InvokeEx(dispex,
id,
ctx->lcid, INVOKE_PROPERTYGET, &dp, &
var, &
ctx->ei.ei,
1478 &
ctx->jscaller->IServiceProvider_iface);
1479 IDispatchEx_Release(dispex);
1483 TRACE(
"using IDispatch\n");
1496 static const WCHAR formatW[] = {
'%',
'd',0};
1531 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1537 hres = IDispatchEx_DeleteMemberByDispID(dispex,
id);
1538 IDispatchEx_Release(dispex);
1551 if(
id == DISPID_STARTENUM && !own_only) {
1557 if(
id + 1 < 0 ||
id+1 >=
obj->prop_cnt)
1560 for(iter = &
obj->props[
id + 1]; iter < obj->
props +
obj->prop_cnt; iter++) {
1609 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
1611 hres = IDispatchEx_DeleteMemberByName(dispex, bstr,
make_grfdex(
ctx, fdexNameCaseSensitive));
1614 IDispatchEx_Release(dispex);
1618 hres = IDispatch_GetIDsOfNames(disp, &
IID_NULL, &bstr, 1, 0, &
id);
1648 switch(prop->
type) {
1691 if(
desc->explicit_getter ||
desc->explicit_setter) {
1699 if(
desc->explicit_value) {
1740 if(
desc->explicit_value) {
1749 FIXME(
"redefinition of property type %d\n", prop->
type);
1753 if(
desc->explicit_value) {
1765 }
else if(
desc->explicit_getter ||
desc->explicit_setter) {
1779 if(
desc->explicit_getter) {
1787 if(
desc->explicit_setter) {
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
static void * heap_realloc(void *mem, size_t len)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static VOID del(LPHIST_ENTRY item)
static WCHAR * heap_strdupW(const WCHAR *str)
static const WCHAR version[]
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
static const WCHAR prototypeW[]
HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
void script_release(script_ctx_t *ctx)
void clear_ei(script_ctx_t *ctx)
HRESULT jsval_strict_equal(jsval_t lval, jsval_t rval, BOOL *ret)
GLuint GLuint GLsizei GLenum type
GLdouble GLdouble GLdouble r
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static DISPID propput_dispid
void jsdisp_free(jsdisp_t *obj)
HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_only, property_desc_t *desc)
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
#define FDEX_VERSION_MASK
static dispex_prop_t * alloc_protref(jsdisp_t *This, const WCHAR *name, DWORD ref)
static dispex_prop_t * alloc_prop(jsdisp_t *This, const WCHAR *name, prop_type_t type, DWORD flags)
HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val)
HRESULT disp_propget(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t *val)
static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret)
static unsigned string_hash(const WCHAR *name)
static IDispatch * get_this(DISPPARAMS *dp)
HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *id)
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
static HRESULT find_prop_name_prot(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
HRESULT disp_delete(IDispatch *disp, DISPID id, BOOL *ret)
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
HRESULT jsdisp_propput(jsdisp_t *obj, const WCHAR *name, DWORD flags, jsval_t val)
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
static HRESULT convert_params(const DISPPARAMS *dp, jsval_t *buf, unsigned *argc, jsval_t **ret)
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, unsigned argc, jsval_t *argv, jsval_t *ret)
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL *ret)
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static DISPID prop_to_id(jsdisp_t *This, dispex_prop_t *prop)
static jsdisp_t * impl_from_IDispatchEx(IDispatchEx *iface)
HRESULT jsdisp_delete_idx(jsdisp_t *obj, DWORD idx)
jsdisp_t * as_jsdisp(IDispatch *disp)
HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r)
static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val)
static unsigned get_props_idx(jsdisp_t *This, unsigned hash)
static const builtin_prop_t * find_builtin_prop(jsdisp_t *This, const WCHAR *name)
static const builtin_info_t dispex_info
static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
HRESULT create_dispex(script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype, jsdisp_t **dispex)
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val)
static dispex_prop_t * get_prop(jsdisp_t *This, DISPID id)
HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val)
static HRESULT resize_props(jsdisp_t *This)
HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT builtin_set_const(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
static HRESULT fill_protrefs(jsdisp_t *This)
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
jsdisp_t * to_jsdisp(IDispatch *disp)
HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val)
HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t *desc)
HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, BOOL own_only, DISPID *ret)
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val)
static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller)
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, DWORD create_flags, dispex_prop_t **ret)
static IDispatchExVtbl DispatchExVtbl
static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, jsval_t *r)
HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static void set_disp(vdisp_t *vdisp, IDispatch *disp)
static void jsdisp_release(jsdisp_t *jsdisp)
#define PROPF_VERSION_MASK
#define PROPF_CONFIGURABLE
static void set_jsdisp(vdisp_t *vdisp, jsdisp_t *jsdisp)
static void script_addref(script_ctx_t *ctx)
#define JS_E_FUNCTION_EXPECTED
static void vdisp_release(vdisp_t *vdisp)
#define JS_E_NONWRITABLE_MODIFIED
static IDispatch * to_disp(jsdisp_t *jsdisp)
static DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
#define JS_E_NONCONFIGURABLE_REDEFINED
const char * debugstr_jsval(const jsval_t) DECLSPEC_HIDDEN
static jsdisp_t * jsdisp_addref(jsdisp_t *jsdisp)
#define PROPF_VERSION_SHIFT
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
#define DISPATCH_JSCRIPT_INTERNAL_MASK
static const WCHAR * jsstr_flatten(jsstr_t *str)
static unsigned jsstr_length(jsstr_t *str)
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
HRESULT jsval_copy(jsval_t v, jsval_t *r)
void jsval_release(jsval_t val)
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
static jsval_t jsval_undefined(void)
static jsval_t jsval_obj(jsdisp_t *obj)
static IDispatch * get_object(jsval_t v)
static BOOL is_object_instance(jsval_t v)
static const WCHAR desc[]
#define eq(received, expected, label, type)
static VARIANTARG static DISPID
BSTR WINAPI SysAllocString(LPCOLESTR str)
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
#define DISPATCH_PROPERTYPUT
#define DISPATCH_PROPERTYGET
#define DISPATCH_PROPERTYPUTREF
#define IsEqualGUID(rguid1, rguid2)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
struct _dispex_prop_t::@435::@436 accessor
union _dispex_prop_t::@435 u
builtin_prop_t value_prop
HRESULT(* idx_get)(jsdisp_t *, unsigned, jsval_t *)
IDispatchEx IDispatchEx_iface
const builtin_info_t * builtin_info
#define CONTAINING_RECORD(address, type, field)
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
static const WCHAR props[]
_In_ DWORD _Out_ _In_ WORD wFlags
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
#define DISP_E_MEMBERNOTFOUND
#define DISP_E_PARAMNOTOPTIONAL
#define DISP_E_UNKNOWNNAME