114 TRACE(
"(%p)\n", arguments);
118 for(
i = 0;
i < arguments->
argc;
i++)
130 return arguments->
argc;
136 return arguments->
buf +
idx;
197 static const WCHAR caleeW[] = {
'c',
'a',
'l',
'l',
'e',
'e',0};
199 args = heap_alloc_zero(
sizeof(*
args));
247 for(
i = 0;
i < arguments->
argc ;
i++) {
256 ERR(
"out of memory\n");
268 TRACE(
"func %p this %p\n", func_this, jsthis);
278 TRACE(
"%p\n", jsthis);
380 FIXME(
"throw TypeError\n");
401 IDispatch_Release(this_obj);
434 IDispatch_Release(this_obj);
451 FIXME(
"no this argument\n");
479 ERR(
"dispex is not a function\n");
511 for(frame =
ctx->call_ctx; frame; frame = frame->
prev_frame) {
572 function = heap_alloc_zero(
size);
578 else if(builtin_info)
587 function->
vtbl = vtbl;
604 else if(
ctx->host_global)
622 static const WCHAR native_prefixW[] = {
'\n',
'f',
'u',
'n',
'c',
't',
'i',
'o',
'n',
' '};
623 static const WCHAR native_suffixW[] =
624 {
'(',
')',
' ',
'{',
'\n',
' ',
' ',
' ',
' ',
'[',
'n',
'a',
't',
'i',
'v',
'e',
' ',
'c',
'o',
'd',
'e',
']',
'\n',
'}',
'\n'};
631 memcpy(
ptr, native_prefixW,
sizeof(native_prefixW));
635 memcpy(
ptr, native_suffixW,
sizeof(native_suffixW));
671 function->
proc = value_proc;
680 static const WCHAR constructorW[] = {
'c',
'o',
'n',
's',
't',
'r',
'u',
'c',
't',
'o',
'r',0};
711 DWORD exec_flags = 0;
714 TRACE(
"%p\n", function);
717 WARN(
"Script engine state does not allow running code.\n");
721 if(
flags & DISPATCH_CONSTRUCT) {
730 if(
flags & DISPATCH_CONSTRUCT)
814 TRACE(
"%p\n", function);
823 memcpy(call_args, function->
args, function->
argc *
sizeof(*call_args));
836 static const WCHAR native_functionW[] =
837 {
'\n',
'f',
'u',
'n',
'c',
't',
'i',
'o',
'n',
'(',
')',
' ',
'{',
'\n',
838 ' ',
' ',
' ',
' ',
'[',
'n',
'a',
't',
'i',
'v',
'e',
' ',
'c',
'o',
'd',
'e',
']',
'\n',
850 TRACE(
"%p\n", function);
852 for(
i = 0;
i < function->
argc;
i++)
855 IDispatch_Release(function->
this);
878 IDispatch_AddRef(function->
this = bound_this);
897 unsigned len = 0,
i = 0;
904 static const WCHAR function_anonymousW[] = {
'f',
'u',
'n',
'c',
't',
'i',
'o',
'n',
' ',
'a',
'n',
'o',
'n',
'y',
'm',
'o',
'u',
's',
'('};
905 static const WCHAR function_beginW[] = {
')',
' ',
'{',
'\n'};
906 static const WCHAR function_endW[] = {
'\n',
'}',0};
927 memcpy(
str, function_anonymousW,
sizeof(function_anonymousW));
938 memcpy(
ptr, function_beginW,
sizeof(function_beginW));
942 memcpy(
ptr, function_endW,
sizeof(function_endW));
961 if(
code->global_code.func_cnt != 1 ||
code->global_code.var_cnt != 1) {
962 ERR(
"Invalid parser result!\n");
985 case DISPATCH_CONSTRUCT: {
1015 static const WCHAR FunctionW[] = {
'F',
'u',
'n',
'c',
't',
'i',
'o',
'n',0};
1018 TRUE, object_prototype, (
void**)&prot);
@ SCRIPTSTATE_UNINITIALIZED
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
static const builtin_info_t FunctionInst_info
static FunctionInstance * function_from_jsdisp(jsdisp_t *jsdisp)
static FunctionInstance * function_from_vdisp(vdisp_t *vdisp)
static const builtin_info_t Function_info
static const WCHAR prototypeW[]
static void BindFunction_destructor(FunctionInstance *func)
static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t *prot)
static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_obj, unsigned flags, unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame)
static const WCHAR callW[]
static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *argc, jsval_t **ret)
static HRESULT Function_get_arguments(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
static const builtin_prop_t Function_props[]
static const WCHAR lengthW[]
static void NativeFunction_destructor(FunctionInstance *function)
static const WCHAR applyW[]
static const builtin_info_t Arguments_info
static const function_vtbl_t InterpretedFunctionVtbl
static HRESULT create_bind_function(script_ctx_t *, FunctionInstance *, IDispatch *, unsigned, jsval_t *, jsdisp_t **r)
HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_code_t *func_code, scope_chain_t *scope_chain, jsdisp_t **ret)
static HRESULT NativeFunction_toString(FunctionInstance *func, jsstr_t **ret)
static const function_vtbl_t BindFunctionVtbl
static ArgumentsInstance * arguments_from_jsdisp(jsdisp_t *jsdisp)
static const builtin_prop_t FunctionInst_props[]
static HRESULT InterpretedFunction_toString(FunctionInstance *func, jsstr_t **ret)
static HRESULT Arguments_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static void Function_destructor(jsdisp_t *dispex)
static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_obj, unsigned flags, unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static void InterpretedFunction_destructor(FunctionInstance *func)
HRESULT Function_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_info, const function_vtbl_t *vtbl, size_t size, DWORD flags, BOOL funcprot, jsdisp_t *prototype, void **ret)
static const function_vtbl_t NativeFunctionVtbl
static void Arguments_destructor(jsdisp_t *jsdisp)
static const WCHAR toStringW[]
static HRESULT Arguments_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r)
static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
static HRESULT BindFunction_toString(FunctionInstance *function, jsstr_t **ret)
static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *argv, IDispatch **ret)
HRESULT create_builtin_constructor(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)
static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static unsigned Arguments_idx_length(jsdisp_t *jsdisp)
void detach_arguments_object(jsdisp_t *args_disp)
static HRESULT Function_bind(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT Function_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
static HRESULT FunctionProt_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
static const WCHAR argumentsW[]
static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_disp, unsigned flags, unsigned argc, jsval_t *argv, jsval_t *r)
static HRESULT Arguments_idx_put(jsdisp_t *jsdisp, unsigned idx, jsval_t val)
static jsval_t * get_argument_ref(ArgumentsInstance *arguments, unsigned idx)
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)
static FunctionInstance * function_this(vdisp_t *jsthis)
static const WCHAR bindW[]
void scope_release(scope_chain_t *scope)
HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, function_code_t *function, scope_chain_t *scope, IDispatch *this_obj, jsdisp_t *function_instance, jsdisp_t *variable_obj, unsigned argc, jsval_t *argv, jsval_t *r)
static scope_chain_t * scope_addref(scope_chain_t *scope)
#define EXEC_RETURN_TO_INTERP
static bytecode_t * bytecode_addref(bytecode_t *code)
GLdouble GLdouble GLdouble r
GLenum const GLfloat * params
GLuint GLsizei GLsizei * length
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
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 GLint GLint j
static HRESULT to_string(VARIANT *src, BSTR *dst)
void release_bytecode(bytecode_t *code)
HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, const WCHAR *args, const WCHAR *delimiter, BOOL from_eval, BOOL use_decode, bytecode_t **ret)
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val)
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
HRESULT jsdisp_propput(jsdisp_t *obj, const WCHAR *name, DWORD flags, jsval_t val)
HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r)
HRESULT create_dispex(script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype, jsdisp_t **dispex)
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val)
static const WCHAR FunctionW[]
static BOOL is_vclass(vdisp_t *vdisp, jsclass_t class)
#define DISPATCH_JSCRIPT_CALLEREXECSSOURCE
HRESULT(* builtin_invoke_t)(script_ctx_t *, vdisp_t *, WORD, unsigned, jsval_t *, jsval_t *)
HRESULT create_object(script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
#define DEFAULT_FUNCTION_VALUE
static void set_disp(vdisp_t *vdisp, IDispatch *disp)
HRESULT to_object(script_ctx_t *, jsval_t, IDispatch **) DECLSPEC_HIDDEN
static void jsdisp_release(jsdisp_t *jsdisp)
#define PROPF_CONFIGURABLE
static void set_jsdisp(vdisp_t *vdisp, jsdisp_t *jsdisp)
#define JS_E_FUNCTION_EXPECTED
static void vdisp_release(vdisp_t *vdisp)
HRESULT to_uint32(script_ctx_t *, jsval_t, UINT32 *) DECLSPEC_HIDDEN
static IDispatch * to_disp(jsdisp_t *jsdisp)
const char * debugstr_jsval(const jsval_t) DECLSPEC_HIDDEN
static jsdisp_t * jsdisp_addref(jsdisp_t *jsdisp)
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
#define DISPATCH_JSCRIPT_INTERNAL_MASK
jsstr_t * jsstr_alloc_len(const WCHAR *buf, unsigned len)
jsstr_t * jsstr_alloc_buf(unsigned len, WCHAR **buf)
static void jsstr_release(jsstr_t *str)
static unsigned jsstr_length(jsstr_t *str)
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
static jsstr_t * jsstr_alloc(const WCHAR *str)
HRESULT jsval_copy(jsval_t v, jsval_t *r)
void jsval_release(jsval_t val)
static jsval_t jsval_null(void)
static jsval_t jsval_string(jsstr_t *str)
static jsval_t jsval_undefined(void)
static jsval_t jsval_obj(jsdisp_t *obj)
static BOOL is_undefined(jsval_t v)
static jsval_t jsval_disp(IDispatch *obj)
static IDispatch * get_object(jsval_t v)
static BOOL is_object_instance(jsval_t v)
static BOOL is_null(jsval_t v)
static jsval_t jsval_number(double n)
#define memcpy(s1, s2, n)
static unsigned(__cdecl *hash_bstr)(bstr_t s)
InterpretedFunction * function
FunctionInstance * target
FunctionInstance function
const function_vtbl_t * vtbl
FunctionInstance function
function_code_t * func_code
scope_chain_t * scope_chain
FunctionInstance function
struct _call_frame_t * prev_frame
scope_chain_t * base_scope
function_code_t * function
jsdisp_t * function_instance
HRESULT(* call)(script_ctx_t *, FunctionInstance *, IDispatch *, unsigned, unsigned, jsval_t *, jsval_t *)
HRESULT(* toString)(FunctionInstance *, jsstr_t **)
void(* destructor)(FunctionInstance *)
struct _call_frame_t * frame
#define FIELD_OFFSET(t, f)
#define CONTAINING_RECORD(address, type, field)
#define DISP_E_UNKNOWNNAME