ReactOS 0.4.15-dev-6662-g1b3eed5
jscript.h File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "dispex.h"
#include "activscp.h"
#include "resource.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "jsval.h"
Include dependency graph for jscript.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  heap_pool_t
 
struct  vdisp_t
 
struct  builtin_prop_t
 
struct  builtin_info_t
 
struct  jsdisp_t
 
struct  named_item_t
 
struct  cc_ctx_t
 
struct  JSCaller
 
struct  _property_desc_t
 
struct  jsexcept_t
 
struct  match_result_t
 
struct  _script_ctx_t
 

Macros

#define COBJMACROS
 
#define SCRIPTLANGUAGEVERSION_HTML   0x400
 
#define SCRIPTLANGUAGEVERSION_ES5   0x102
 
#define PROPF_ARGMASK   0x00ff
 
#define PROPF_METHOD   0x0100
 
#define PROPF_CONSTR   0x0200
 
#define PROPF_ENUMERABLE   0x0400
 
#define PROPF_WRITABLE   0x0800
 
#define PROPF_CONFIGURABLE   0x1000
 
#define PROPF_ALL   (PROPF_ENUMERABLE | PROPF_WRITABLE | PROPF_CONFIGURABLE)
 
#define PROPF_VERSION_MASK   0x01ff0000
 
#define PROPF_VERSION_SHIFT   16
 
#define PROPF_HTML   (SCRIPTLANGUAGEVERSION_HTML << PROPF_VERSION_SHIFT)
 
#define PROPF_ES5   ((SCRIPTLANGUAGEVERSION_HTML|SCRIPTLANGUAGEVERSION_ES5) << PROPF_VERSION_SHIFT)
 
#define DISPATCH_JSCRIPT_CALLEREXECSSOURCE   0x8000
 
#define DISPATCH_JSCRIPT_INTERNAL_MASK   DISPATCH_JSCRIPT_CALLEREXECSSOURCE
 
#define VDISP_DISPEX   0x0001
 
#define VDISP_JSDISP   0x0002
 
#define DEFAULT_FUNCTION_VALUE   {NULL, Function_value,0, Function_get_value}
 
#define REM_CHECK_GLOBAL   0x0001
 
#define REM_RESET_INDEX   0x0002
 
#define REM_NO_CTX_UPDATE   0x0004
 
#define REM_ALLOC_RESULT   0x0008
 
#define REM_NO_PARENS   0x0010
 
#define FACILITY_JSCRIPT   10
 
#define MAKE_JSERROR(code)   MAKE_HRESULT(SEVERITY_ERROR, FACILITY_JSCRIPT, code)
 
#define JS_E_TO_PRIMITIVE   MAKE_JSERROR(IDS_TO_PRIMITIVE)
 
#define JS_E_INVALIDARG   MAKE_JSERROR(IDS_INVALID_CALL_ARG)
 
#define JS_E_SUBSCRIPT_OUT_OF_RANGE   MAKE_JSERROR(IDS_SUBSCRIPT_OUT_OF_RANGE)
 
#define JS_E_OBJECT_REQUIRED   MAKE_JSERROR(IDS_OBJECT_REQUIRED)
 
#define JS_E_CANNOT_CREATE_OBJ   MAKE_JSERROR(IDS_CREATE_OBJ_ERROR)
 
#define JS_E_INVALID_PROPERTY   MAKE_JSERROR(IDS_NO_PROPERTY)
 
#define JS_E_INVALID_ACTION   MAKE_JSERROR(IDS_UNSUPPORTED_ACTION)
 
#define JS_E_MISSING_ARG   MAKE_JSERROR(IDS_ARG_NOT_OPT)
 
#define JS_E_SYNTAX   MAKE_JSERROR(IDS_SYNTAX_ERROR)
 
#define JS_E_MISSING_SEMICOLON   MAKE_JSERROR(IDS_SEMICOLON)
 
#define JS_E_MISSING_LBRACKET   MAKE_JSERROR(IDS_LBRACKET)
 
#define JS_E_MISSING_RBRACKET   MAKE_JSERROR(IDS_RBRACKET)
 
#define JS_E_EXPECTED_IDENTIFIER   MAKE_JSERROR(IDS_EXPECTED_IDENTIFIER)
 
#define JS_E_EXPECTED_ASSIGN   MAKE_JSERROR(IDS_EXPECTED_ASSIGN)
 
#define JS_E_INVALID_CHAR   MAKE_JSERROR(IDS_INVALID_CHAR)
 
#define JS_E_UNTERMINATED_STRING   MAKE_JSERROR(IDS_UNTERMINATED_STR)
 
#define JS_E_MISPLACED_RETURN   MAKE_JSERROR(IDS_MISPLACED_RETURN)
 
#define JS_E_INVALID_BREAK   MAKE_JSERROR(IDS_INVALID_BREAK)
 
#define JS_E_INVALID_CONTINUE   MAKE_JSERROR(IDS_INVALID_CONTINUE)
 
#define JS_E_LABEL_REDEFINED   MAKE_JSERROR(IDS_LABEL_REDEFINED)
 
#define JS_E_LABEL_NOT_FOUND   MAKE_JSERROR(IDS_LABEL_NOT_FOUND)
 
#define JS_E_EXPECTED_CCEND   MAKE_JSERROR(IDS_EXPECTED_CCEND)
 
#define JS_E_DISABLED_CC   MAKE_JSERROR(IDS_DISABLED_CC)
 
#define JS_E_EXPECTED_AT   MAKE_JSERROR(IDS_EXPECTED_AT)
 
#define JS_E_FUNCTION_EXPECTED   MAKE_JSERROR(IDS_NOT_FUNC)
 
#define JS_E_DATE_EXPECTED   MAKE_JSERROR(IDS_NOT_DATE)
 
#define JS_E_NUMBER_EXPECTED   MAKE_JSERROR(IDS_NOT_NUM)
 
#define JS_E_OBJECT_EXPECTED   MAKE_JSERROR(IDS_OBJECT_EXPECTED)
 
#define JS_E_ILLEGAL_ASSIGN   MAKE_JSERROR(IDS_ILLEGAL_ASSIGN)
 
#define JS_E_UNDEFINED_VARIABLE   MAKE_JSERROR(IDS_UNDEFINED)
 
#define JS_E_BOOLEAN_EXPECTED   MAKE_JSERROR(IDS_NOT_BOOL)
 
#define JS_E_VBARRAY_EXPECTED   MAKE_JSERROR(IDS_NOT_VBARRAY)
 
#define JS_E_INVALID_DELETE   MAKE_JSERROR(IDS_INVALID_DELETE)
 
#define JS_E_JSCRIPT_EXPECTED   MAKE_JSERROR(IDS_JSCRIPT_EXPECTED)
 
#define JS_E_ENUMERATOR_EXPECTED   MAKE_JSERROR(IDS_NOT_ENUMERATOR)
 
#define JS_E_REGEXP_SYNTAX   MAKE_JSERROR(IDS_REGEXP_SYNTAX_ERROR)
 
#define JS_E_INVALID_URI_CODING   MAKE_JSERROR(IDS_URI_INVALID_CODING)
 
#define JS_E_INVALID_URI_CHAR   MAKE_JSERROR(IDS_URI_INVALID_CHAR)
 
#define JS_E_FRACTION_DIGITS_OUT_OF_RANGE   MAKE_JSERROR(IDS_FRACTION_DIGITS_OUT_OF_RANGE)
 
#define JS_E_PRECISION_OUT_OF_RANGE   MAKE_JSERROR(IDS_PRECISION_OUT_OF_RANGE)
 
#define JS_E_INVALID_LENGTH   MAKE_JSERROR(IDS_INVALID_LENGTH)
 
#define JS_E_ARRAY_EXPECTED   MAKE_JSERROR(IDS_ARRAY_EXPECTED)
 
#define JS_E_NONCONFIGURABLE_REDEFINED   MAKE_JSERROR(IDS_NONCONFIGURABLE_REDEFINED)
 
#define JS_E_NONWRITABLE_MODIFIED   MAKE_JSERROR(IDS_NONWRITABLE_MODIFIED)
 
#define JS_E_PROP_DESC_MISMATCH   MAKE_JSERROR(IDS_PROP_DESC_MISMATCH)
 
#define JS_E_INVALID_WRITABLE_PROP_DESC   MAKE_JSERROR(IDS_INVALID_WRITABLE_PROP_DESC)
 

Typedefs

typedef struct _jsval_t jsval_t
 
typedef struct _jsstr_t jsstr_t
 
typedef struct _script_ctx_t script_ctx_t
 
typedef struct _dispex_prop_t dispex_prop_t
 
typedef struct _property_desc_t property_desc_t
 
typedef struct jsdisp_t jsdisp_t
 
typedef HRESULT(* builtin_invoke_t) (script_ctx_t *, vdisp_t *, WORD, unsigned, jsval_t *, jsval_t *)
 
typedef HRESULT(* builtin_getter_t) (script_ctx_t *, jsdisp_t *, jsval_t *)
 
typedef HRESULT(* builtin_setter_t) (script_ctx_t *, jsdisp_t *, jsval_t)
 
typedef struct named_item_t named_item_t
 
typedef struct _cc_var_t cc_var_t
 

Enumerations

enum  jsclass_t {
  JSCLASS_NONE , JSCLASS_ARRAY , JSCLASS_BOOLEAN , JSCLASS_DATE ,
  JSCLASS_ENUMERATOR , JSCLASS_ERROR , JSCLASS_FUNCTION , JSCLASS_GLOBAL ,
  JSCLASS_MATH , JSCLASS_NUMBER , JSCLASS_OBJECT , JSCLASS_REGEXP ,
  JSCLASS_STRING , JSCLASS_ARGUMENTS , JSCLASS_VBARRAY , JSCLASS_JSON
}
 
enum  hint_t { NO_HINT , HINT_STRING , HINT_NUMBER }
 

Functions

void heap_pool_init (heap_pool_t *) DECLSPEC_HIDDEN
 
voidheap_pool_alloc (heap_pool_t *, DWORD) __WINE_ALLOC_SIZE(2) DECLSPEC_HIDDEN
 
voidheap_pool_grow (heap_pool_t *, void *, DWORD, DWORD) DECLSPEC_HIDDEN
 
void heap_pool_clear (heap_pool_t *) DECLSPEC_HIDDEN
 
void heap_pool_free (heap_pool_t *) DECLSPEC_HIDDEN
 
heap_pool_theap_pool_mark (heap_pool_t *) DECLSPEC_HIDDEN
 
static LPWSTR heap_strdupW (LPCWSTR str)
 
jsdisp_tiface_to_jsdisp (IDispatch *) DECLSPEC_HIDDEN
 
static void vdisp_release (vdisp_t *vdisp)
 
static BOOL is_jsdisp (vdisp_t *vdisp)
 
static BOOL is_dispex (vdisp_t *vdisp)
 
static void set_jsdisp (vdisp_t *vdisp, jsdisp_t *jsdisp)
 
static void set_disp (vdisp_t *vdisp, IDispatch *disp)
 
static jsdisp_tget_jsdisp (vdisp_t *vdisp)
 
HRESULT builtin_set_const (script_ctx_t *, jsdisp_t *, jsval_t) DECLSPEC_HIDDEN
 
static IDispatchto_disp (jsdisp_t *jsdisp)
 
jsdisp_tas_jsdisp (IDispatch *) DECLSPEC_HIDDEN
 
jsdisp_tto_jsdisp (IDispatch *) DECLSPEC_HIDDEN
 
void jsdisp_free (jsdisp_t *) DECLSPEC_HIDDEN
 
static jsdisp_tjsdisp_addref (jsdisp_t *jsdisp)
 
static void jsdisp_release (jsdisp_t *jsdisp)
 
HRESULT create_dispex (script_ctx_t *, const builtin_info_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT init_dispex (jsdisp_t *, script_ctx_t *, const builtin_info_t *, jsdisp_t *) DECLSPEC_HIDDEN
 
HRESULT init_dispex_from_constr (jsdisp_t *, script_ctx_t *, const builtin_info_t *, jsdisp_t *) DECLSPEC_HIDDEN
 
HRESULT disp_call (script_ctx_t *, IDispatch *, DISPID, WORD, unsigned, jsval_t *, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT disp_call_value (script_ctx_t *, IDispatch *, IDispatch *, WORD, unsigned, jsval_t *, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT jsdisp_call_value (jsdisp_t *, IDispatch *, WORD, unsigned, jsval_t *, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT jsdisp_call (jsdisp_t *, DISPID, WORD, unsigned, jsval_t *, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT jsdisp_call_name (jsdisp_t *, const WCHAR *, WORD, unsigned, jsval_t *, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT disp_propget (script_ctx_t *, IDispatch *, DISPID, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT disp_propput (script_ctx_t *, IDispatch *, DISPID, jsval_t) DECLSPEC_HIDDEN
 
HRESULT jsdisp_propget (jsdisp_t *, DISPID, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT jsdisp_propput (jsdisp_t *, const WCHAR *, DWORD, jsval_t) DECLSPEC_HIDDEN
 
HRESULT jsdisp_propput_name (jsdisp_t *, const WCHAR *, jsval_t) DECLSPEC_HIDDEN
 
HRESULT jsdisp_propput_idx (jsdisp_t *, DWORD, jsval_t) DECLSPEC_HIDDEN
 
HRESULT jsdisp_propget_name (jsdisp_t *, LPCWSTR, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT jsdisp_get_idx (jsdisp_t *, DWORD, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT jsdisp_get_id (jsdisp_t *, const WCHAR *, DWORD, DISPID *) DECLSPEC_HIDDEN
 
HRESULT disp_delete (IDispatch *, DISPID, BOOL *) DECLSPEC_HIDDEN
 
HRESULT disp_delete_name (script_ctx_t *, IDispatch *, jsstr_t *, BOOL *) DECLSPEC_HIDDEN
 
HRESULT jsdisp_delete_idx (jsdisp_t *, DWORD) DECLSPEC_HIDDEN
 
HRESULT jsdisp_get_own_property (jsdisp_t *, const WCHAR *, BOOL, property_desc_t *) DECLSPEC_HIDDEN
 
HRESULT jsdisp_define_property (jsdisp_t *, const WCHAR *, property_desc_t *) DECLSPEC_HIDDEN
 
HRESULT jsdisp_define_data_property (jsdisp_t *, const WCHAR *, unsigned, jsval_t) DECLSPEC_HIDDEN
 
HRESULT jsdisp_next_prop (jsdisp_t *, DISPID, BOOL, DISPID *) DECLSPEC_HIDDEN
 
HRESULT create_builtin_function (script_ctx_t *, builtin_invoke_t, const WCHAR *, const builtin_info_t *, DWORD, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_builtin_constructor (script_ctx_t *, builtin_invoke_t, const WCHAR *, const builtin_info_t *, DWORD, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT Function_invoke (jsdisp_t *, IDispatch *, WORD, unsigned, jsval_t *, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT Function_value (script_ctx_t *, vdisp_t *, WORD, unsigned, jsval_t *, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT Function_get_value (script_ctx_t *, jsdisp_t *, jsval_t *) DECLSPEC_HIDDEN
 
HRESULT throw_eval_error (script_ctx_t *, HRESULT, const WCHAR *) DECLSPEC_HIDDEN
 
HRESULT throw_generic_error (script_ctx_t *, HRESULT, const WCHAR *) DECLSPEC_HIDDEN
 
HRESULT throw_range_error (script_ctx_t *, HRESULT, const WCHAR *) DECLSPEC_HIDDEN
 
HRESULT throw_reference_error (script_ctx_t *, HRESULT, const WCHAR *) DECLSPEC_HIDDEN
 
HRESULT throw_regexp_error (script_ctx_t *, HRESULT, const WCHAR *) DECLSPEC_HIDDEN
 
HRESULT throw_syntax_error (script_ctx_t *, HRESULT, const WCHAR *) DECLSPEC_HIDDEN
 
HRESULT throw_type_error (script_ctx_t *, HRESULT, const WCHAR *) DECLSPEC_HIDDEN
 
HRESULT throw_uri_error (script_ctx_t *, HRESULT, const WCHAR *) DECLSPEC_HIDDEN
 
HRESULT create_object (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_math (script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_array (script_ctx_t *, DWORD, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_regexp (script_ctx_t *, jsstr_t *, DWORD, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_regexp_var (script_ctx_t *, jsval_t, jsval_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_string (script_ctx_t *, jsstr_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_bool (script_ctx_t *, BOOL, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_number (script_ctx_t *, double, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_vbarray (script_ctx_t *, SAFEARRAY *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_json (script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT to_primitive (script_ctx_t *, jsval_t, jsval_t *, hint_t) DECLSPEC_HIDDEN
 
HRESULT to_boolean (jsval_t, BOOL *) DECLSPEC_HIDDEN
 
HRESULT to_number (script_ctx_t *, jsval_t, double *) DECLSPEC_HIDDEN
 
HRESULT to_integer (script_ctx_t *, jsval_t, double *) DECLSPEC_HIDDEN
 
HRESULT to_int32 (script_ctx_t *, jsval_t, INT *) DECLSPEC_HIDDEN
 
HRESULT to_uint32 (script_ctx_t *, jsval_t, UINT32 *) DECLSPEC_HIDDEN
 
HRESULT to_string (script_ctx_t *, jsval_t, jsstr_t **) DECLSPEC_HIDDEN
 
HRESULT to_flat_string (script_ctx_t *, jsval_t, jsstr_t **, const WCHAR **) DECLSPEC_HIDDEN
 
HRESULT to_object (script_ctx_t *, jsval_t, IDispatch **) DECLSPEC_HIDDEN
 
HRESULT jsval_strict_equal (jsval_t, jsval_t, BOOL *) DECLSPEC_HIDDEN
 
HRESULT variant_change_type (script_ctx_t *, VARIANT *, VARIANT *, VARTYPE) DECLSPEC_HIDDEN
 
HRESULT decode_source (WCHAR *) DECLSPEC_HIDDEN
 
HRESULT double_to_string (double, jsstr_t **) DECLSPEC_HIDDEN
 
BOOL is_finite (double) DECLSPEC_HIDDEN
 
void release_cc (cc_ctx_t *) DECLSPEC_HIDDEN
 
void script_release (script_ctx_t *) DECLSPEC_HIDDEN
 
void clear_ei (script_ctx_t *) DECLSPEC_HIDDEN
 
static void script_addref (script_ctx_t *ctx)
 
HRESULT init_global (script_ctx_t *) DECLSPEC_HIDDEN
 
HRESULT init_function_constr (script_ctx_t *, jsdisp_t *) DECLSPEC_HIDDEN
 
HRESULT create_object_prototype (script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_activex_constr (script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_array_constr (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_bool_constr (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_date_constr (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT init_error_constr (script_ctx_t *, jsdisp_t *) DECLSPEC_HIDDEN
 
HRESULT create_enumerator_constr (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_number_constr (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_object_constr (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_regexp_constr (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_string_constr (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
HRESULT create_vbarray_constr (script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
 
IUnknowncreate_ax_site (script_ctx_t *) DECLSPEC_HIDDEN
 
HRESULT create_jscaller (script_ctx_t *) DECLSPEC_HIDDEN
 
HRESULT regexp_match_next (script_ctx_t *, jsdisp_t *, DWORD, jsstr_t *, struct match_state_t **) DECLSPEC_HIDDEN
 
HRESULT parse_regexp_flags (const WCHAR *, DWORD, DWORD *) DECLSPEC_HIDDEN
 
HRESULT regexp_string_match (script_ctx_t *, jsdisp_t *, jsstr_t *, jsval_t *) DECLSPEC_HIDDEN
 
BOOL bool_obj_value (jsdisp_t *) DECLSPEC_HIDDEN
 
unsigned array_get_length (jsdisp_t *) DECLSPEC_HIDDEN
 
HRESULT JSGlobal_eval (script_ctx_t *, vdisp_t *, WORD, unsigned, jsval_t *, jsval_t *) DECLSPEC_HIDDEN
 
static BOOL is_class (jsdisp_t *jsdisp, jsclass_t class)
 
static BOOL is_vclass (vdisp_t *vdisp, jsclass_t class)
 
static BOOL is_int32 (double d)
 
static DWORD make_grfdex (script_ctx_t *ctx, DWORD flags)
 
static BOOL is_jscript_error (HRESULT hres)
 
const chardebugstr_jsval (const jsval_t) DECLSPEC_HIDDEN
 
HRESULT create_jscript_object (BOOL, REFIID, void **) DECLSPEC_HIDDEN
 
static void lock_module (void)
 
static void unlock_module (void)
 

Variables

HINSTANCE jscript_hinstance DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file jscript.h.

◆ DEFAULT_FUNCTION_VALUE

#define DEFAULT_FUNCTION_VALUE   {NULL, Function_value,0, Function_get_value}

Definition at line 315 of file jscript.h.

◆ DISPATCH_JSCRIPT_CALLEREXECSSOURCE

#define DISPATCH_JSCRIPT_CALLEREXECSSOURCE   0x8000

Definition at line 115 of file jscript.h.

◆ DISPATCH_JSCRIPT_INTERNAL_MASK

#define DISPATCH_JSCRIPT_INTERNAL_MASK   DISPATCH_JSCRIPT_CALLEREXECSSOURCE

Definition at line 116 of file jscript.h.

◆ FACILITY_JSCRIPT

#define FACILITY_JSCRIPT   10

Definition at line 524 of file jscript.h.

◆ JS_E_ARRAY_EXPECTED

#define JS_E_ARRAY_EXPECTED   MAKE_JSERROR(IDS_ARRAY_EXPECTED)

Definition at line 569 of file jscript.h.

◆ JS_E_BOOLEAN_EXPECTED

#define JS_E_BOOLEAN_EXPECTED   MAKE_JSERROR(IDS_NOT_BOOL)

Definition at line 558 of file jscript.h.

◆ JS_E_CANNOT_CREATE_OBJ

#define JS_E_CANNOT_CREATE_OBJ   MAKE_JSERROR(IDS_CREATE_OBJ_ERROR)

Definition at line 532 of file jscript.h.

◆ JS_E_DATE_EXPECTED

#define JS_E_DATE_EXPECTED   MAKE_JSERROR(IDS_NOT_DATE)

Definition at line 553 of file jscript.h.

◆ JS_E_DISABLED_CC

#define JS_E_DISABLED_CC   MAKE_JSERROR(IDS_DISABLED_CC)

Definition at line 550 of file jscript.h.

◆ JS_E_ENUMERATOR_EXPECTED

#define JS_E_ENUMERATOR_EXPECTED   MAKE_JSERROR(IDS_NOT_ENUMERATOR)

Definition at line 562 of file jscript.h.

◆ JS_E_EXPECTED_ASSIGN

#define JS_E_EXPECTED_ASSIGN   MAKE_JSERROR(IDS_EXPECTED_ASSIGN)

Definition at line 541 of file jscript.h.

◆ JS_E_EXPECTED_AT

#define JS_E_EXPECTED_AT   MAKE_JSERROR(IDS_EXPECTED_AT)

Definition at line 551 of file jscript.h.

◆ JS_E_EXPECTED_CCEND

#define JS_E_EXPECTED_CCEND   MAKE_JSERROR(IDS_EXPECTED_CCEND)

Definition at line 549 of file jscript.h.

◆ JS_E_EXPECTED_IDENTIFIER

#define JS_E_EXPECTED_IDENTIFIER   MAKE_JSERROR(IDS_EXPECTED_IDENTIFIER)

Definition at line 540 of file jscript.h.

◆ JS_E_FRACTION_DIGITS_OUT_OF_RANGE

#define JS_E_FRACTION_DIGITS_OUT_OF_RANGE   MAKE_JSERROR(IDS_FRACTION_DIGITS_OUT_OF_RANGE)

Definition at line 566 of file jscript.h.

◆ JS_E_FUNCTION_EXPECTED

#define JS_E_FUNCTION_EXPECTED   MAKE_JSERROR(IDS_NOT_FUNC)

Definition at line 552 of file jscript.h.

◆ JS_E_ILLEGAL_ASSIGN

#define JS_E_ILLEGAL_ASSIGN   MAKE_JSERROR(IDS_ILLEGAL_ASSIGN)

Definition at line 556 of file jscript.h.

◆ JS_E_INVALID_ACTION

#define JS_E_INVALID_ACTION   MAKE_JSERROR(IDS_UNSUPPORTED_ACTION)

Definition at line 534 of file jscript.h.

◆ JS_E_INVALID_BREAK

#define JS_E_INVALID_BREAK   MAKE_JSERROR(IDS_INVALID_BREAK)

Definition at line 545 of file jscript.h.

◆ JS_E_INVALID_CHAR

#define JS_E_INVALID_CHAR   MAKE_JSERROR(IDS_INVALID_CHAR)

Definition at line 542 of file jscript.h.

◆ JS_E_INVALID_CONTINUE

#define JS_E_INVALID_CONTINUE   MAKE_JSERROR(IDS_INVALID_CONTINUE)

Definition at line 546 of file jscript.h.

◆ JS_E_INVALID_DELETE

#define JS_E_INVALID_DELETE   MAKE_JSERROR(IDS_INVALID_DELETE)

Definition at line 560 of file jscript.h.

◆ JS_E_INVALID_LENGTH

#define JS_E_INVALID_LENGTH   MAKE_JSERROR(IDS_INVALID_LENGTH)

Definition at line 568 of file jscript.h.

◆ JS_E_INVALID_PROPERTY

#define JS_E_INVALID_PROPERTY   MAKE_JSERROR(IDS_NO_PROPERTY)

Definition at line 533 of file jscript.h.

◆ JS_E_INVALID_URI_CHAR

#define JS_E_INVALID_URI_CHAR   MAKE_JSERROR(IDS_URI_INVALID_CHAR)

Definition at line 565 of file jscript.h.

◆ JS_E_INVALID_URI_CODING

#define JS_E_INVALID_URI_CODING   MAKE_JSERROR(IDS_URI_INVALID_CODING)

Definition at line 564 of file jscript.h.

◆ JS_E_INVALID_WRITABLE_PROP_DESC

#define JS_E_INVALID_WRITABLE_PROP_DESC   MAKE_JSERROR(IDS_INVALID_WRITABLE_PROP_DESC)

Definition at line 573 of file jscript.h.

◆ JS_E_INVALIDARG

#define JS_E_INVALIDARG   MAKE_JSERROR(IDS_INVALID_CALL_ARG)

Definition at line 529 of file jscript.h.

◆ JS_E_JSCRIPT_EXPECTED

#define JS_E_JSCRIPT_EXPECTED   MAKE_JSERROR(IDS_JSCRIPT_EXPECTED)

Definition at line 561 of file jscript.h.

◆ JS_E_LABEL_NOT_FOUND

#define JS_E_LABEL_NOT_FOUND   MAKE_JSERROR(IDS_LABEL_NOT_FOUND)

Definition at line 548 of file jscript.h.

◆ JS_E_LABEL_REDEFINED

#define JS_E_LABEL_REDEFINED   MAKE_JSERROR(IDS_LABEL_REDEFINED)

Definition at line 547 of file jscript.h.

◆ JS_E_MISPLACED_RETURN

#define JS_E_MISPLACED_RETURN   MAKE_JSERROR(IDS_MISPLACED_RETURN)

Definition at line 544 of file jscript.h.

◆ JS_E_MISSING_ARG

#define JS_E_MISSING_ARG   MAKE_JSERROR(IDS_ARG_NOT_OPT)

Definition at line 535 of file jscript.h.

◆ JS_E_MISSING_LBRACKET

#define JS_E_MISSING_LBRACKET   MAKE_JSERROR(IDS_LBRACKET)

Definition at line 538 of file jscript.h.

◆ JS_E_MISSING_RBRACKET

#define JS_E_MISSING_RBRACKET   MAKE_JSERROR(IDS_RBRACKET)

Definition at line 539 of file jscript.h.

◆ JS_E_MISSING_SEMICOLON

#define JS_E_MISSING_SEMICOLON   MAKE_JSERROR(IDS_SEMICOLON)

Definition at line 537 of file jscript.h.

◆ JS_E_NONCONFIGURABLE_REDEFINED

#define JS_E_NONCONFIGURABLE_REDEFINED   MAKE_JSERROR(IDS_NONCONFIGURABLE_REDEFINED)

Definition at line 570 of file jscript.h.

◆ JS_E_NONWRITABLE_MODIFIED

#define JS_E_NONWRITABLE_MODIFIED   MAKE_JSERROR(IDS_NONWRITABLE_MODIFIED)

Definition at line 571 of file jscript.h.

◆ JS_E_NUMBER_EXPECTED

#define JS_E_NUMBER_EXPECTED   MAKE_JSERROR(IDS_NOT_NUM)

Definition at line 554 of file jscript.h.

◆ JS_E_OBJECT_EXPECTED

#define JS_E_OBJECT_EXPECTED   MAKE_JSERROR(IDS_OBJECT_EXPECTED)

Definition at line 555 of file jscript.h.

◆ JS_E_OBJECT_REQUIRED

#define JS_E_OBJECT_REQUIRED   MAKE_JSERROR(IDS_OBJECT_REQUIRED)

Definition at line 531 of file jscript.h.

◆ JS_E_PRECISION_OUT_OF_RANGE

#define JS_E_PRECISION_OUT_OF_RANGE   MAKE_JSERROR(IDS_PRECISION_OUT_OF_RANGE)

Definition at line 567 of file jscript.h.

◆ JS_E_PROP_DESC_MISMATCH

#define JS_E_PROP_DESC_MISMATCH   MAKE_JSERROR(IDS_PROP_DESC_MISMATCH)

Definition at line 572 of file jscript.h.

◆ JS_E_REGEXP_SYNTAX

#define JS_E_REGEXP_SYNTAX   MAKE_JSERROR(IDS_REGEXP_SYNTAX_ERROR)

Definition at line 563 of file jscript.h.

◆ JS_E_SUBSCRIPT_OUT_OF_RANGE

#define JS_E_SUBSCRIPT_OUT_OF_RANGE   MAKE_JSERROR(IDS_SUBSCRIPT_OUT_OF_RANGE)

Definition at line 530 of file jscript.h.

◆ JS_E_SYNTAX

#define JS_E_SYNTAX   MAKE_JSERROR(IDS_SYNTAX_ERROR)

Definition at line 536 of file jscript.h.

◆ JS_E_TO_PRIMITIVE

#define JS_E_TO_PRIMITIVE   MAKE_JSERROR(IDS_TO_PRIMITIVE)

Definition at line 528 of file jscript.h.

◆ JS_E_UNDEFINED_VARIABLE

#define JS_E_UNDEFINED_VARIABLE   MAKE_JSERROR(IDS_UNDEFINED)

Definition at line 557 of file jscript.h.

◆ JS_E_UNTERMINATED_STRING

#define JS_E_UNTERMINATED_STRING   MAKE_JSERROR(IDS_UNTERMINATED_STR)

Definition at line 543 of file jscript.h.

◆ JS_E_VBARRAY_EXPECTED

#define JS_E_VBARRAY_EXPECTED   MAKE_JSERROR(IDS_NOT_VBARRAY)

Definition at line 559 of file jscript.h.

◆ MAKE_JSERROR

Definition at line 526 of file jscript.h.

◆ PROPF_ALL

Definition at line 103 of file jscript.h.

◆ PROPF_ARGMASK

#define PROPF_ARGMASK   0x00ff

Definition at line 96 of file jscript.h.

◆ PROPF_CONFIGURABLE

#define PROPF_CONFIGURABLE   0x1000

Definition at line 102 of file jscript.h.

◆ PROPF_CONSTR

#define PROPF_CONSTR   0x0200

Definition at line 98 of file jscript.h.

◆ PROPF_ENUMERABLE

#define PROPF_ENUMERABLE   0x0400

Definition at line 100 of file jscript.h.

◆ PROPF_ES5

◆ PROPF_HTML

Definition at line 107 of file jscript.h.

◆ PROPF_METHOD

#define PROPF_METHOD   0x0100

Definition at line 97 of file jscript.h.

◆ PROPF_VERSION_MASK

#define PROPF_VERSION_MASK   0x01ff0000

Definition at line 105 of file jscript.h.

◆ PROPF_VERSION_SHIFT

#define PROPF_VERSION_SHIFT   16

Definition at line 106 of file jscript.h.

◆ PROPF_WRITABLE

#define PROPF_WRITABLE   0x0800

Definition at line 101 of file jscript.h.

◆ REM_ALLOC_RESULT

#define REM_ALLOC_RESULT   0x0008

Definition at line 492 of file jscript.h.

◆ REM_CHECK_GLOBAL

#define REM_CHECK_GLOBAL   0x0001

Definition at line 489 of file jscript.h.

◆ REM_NO_CTX_UPDATE

#define REM_NO_CTX_UPDATE   0x0004

Definition at line 491 of file jscript.h.

◆ REM_NO_PARENS

#define REM_NO_PARENS   0x0010

Definition at line 493 of file jscript.h.

◆ REM_RESET_INDEX

#define REM_RESET_INDEX   0x0002

Definition at line 490 of file jscript.h.

◆ SCRIPTLANGUAGEVERSION_ES5

#define SCRIPTLANGUAGEVERSION_ES5   0x102

Definition at line 52 of file jscript.h.

◆ SCRIPTLANGUAGEVERSION_HTML

#define SCRIPTLANGUAGEVERSION_HTML   0x400

Definition at line 47 of file jscript.h.

◆ VDISP_DISPEX

#define VDISP_DISPEX   0x0001

Definition at line 149 of file jscript.h.

◆ VDISP_JSDISP

#define VDISP_JSDISP   0x0002

Definition at line 150 of file jscript.h.

Typedef Documentation

◆ builtin_getter_t

typedef HRESULT(* builtin_getter_t) (script_ctx_t *, jsdisp_t *, jsval_t *)

Definition at line 205 of file jscript.h.

◆ builtin_invoke_t

typedef HRESULT(* builtin_invoke_t) (script_ctx_t *, vdisp_t *, WORD, unsigned, jsval_t *, jsval_t *)

Definition at line 204 of file jscript.h.

◆ builtin_setter_t

typedef HRESULT(* builtin_setter_t) (script_ctx_t *, jsdisp_t *, jsval_t)

Definition at line 206 of file jscript.h.

◆ cc_var_t

Definition at line 370 of file jscript.h.

◆ dispex_prop_t

Definition at line 57 of file jscript.h.

◆ jsdisp_t

Definition at line 92 of file jscript.h.

◆ jsstr_t

Definition at line 55 of file jscript.h.

◆ jsval_t

Definition at line 54 of file jscript.h.

◆ named_item_t

◆ property_desc_t

Definition at line 58 of file jscript.h.

◆ script_ctx_t

Definition at line 56 of file jscript.h.

Enumeration Type Documentation

◆ hint_t

Enumerator
NO_HINT 
HINT_STRING 
HINT_NUMBER 

Definition at line 337 of file jscript.h.

337 {
338 NO_HINT,
341} hint_t;
hint_t
Definition: jscript.h:337
@ NO_HINT
Definition: jscript.h:338
@ HINT_NUMBER
Definition: jscript.h:340
@ HINT_STRING
Definition: jscript.h:339

◆ jsclass_t

Enumerator
JSCLASS_NONE 
JSCLASS_ARRAY 
JSCLASS_BOOLEAN 
JSCLASS_DATE 
JSCLASS_ENUMERATOR 
JSCLASS_ERROR 
JSCLASS_FUNCTION 
JSCLASS_GLOBAL 
JSCLASS_MATH 
JSCLASS_NUMBER 
JSCLASS_OBJECT 
JSCLASS_REGEXP 
JSCLASS_STRING 
JSCLASS_ARGUMENTS 
JSCLASS_VBARRAY 
JSCLASS_JSON 

Definition at line 119 of file jscript.h.

119 {
136} jsclass_t;
jsclass_t
Definition: jscript.h:119
@ JSCLASS_ENUMERATOR
Definition: jscript.h:124
@ JSCLASS_JSON
Definition: jscript.h:135
@ JSCLASS_VBARRAY
Definition: jscript.h:134
@ JSCLASS_ARGUMENTS
Definition: jscript.h:133
@ JSCLASS_FUNCTION
Definition: jscript.h:126
@ JSCLASS_BOOLEAN
Definition: jscript.h:122
@ JSCLASS_STRING
Definition: jscript.h:132
@ JSCLASS_OBJECT
Definition: jscript.h:130
@ JSCLASS_ARRAY
Definition: jscript.h:121
@ JSCLASS_MATH
Definition: jscript.h:128
@ JSCLASS_NONE
Definition: jscript.h:120
@ JSCLASS_DATE
Definition: jscript.h:123
@ JSCLASS_ERROR
Definition: jscript.h:125
@ JSCLASS_GLOBAL
Definition: jscript.h:127
@ JSCLASS_NUMBER
Definition: jscript.h:129
@ JSCLASS_REGEXP
Definition: jscript.h:131

Function Documentation

◆ array_get_length()

unsigned array_get_length ( jsdisp_t array)

Definition at line 73 of file array.c.

74{
77}
static ArrayInstance * array_from_jsdisp(jsdisp_t *jsdisp)
Definition: array.c:58
#define assert(x)
Definition: debug.h:53
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
Definition: jscript.h:504
DWORD length
Definition: array.c:36

Referenced by stringify_array().

◆ as_jsdisp()

jsdisp_t * as_jsdisp ( IDispatch disp)

Definition at line 908 of file dispex.c.

909{
910 assert(disp->lpVtbl == (IDispatchVtbl*)&DispatchExVtbl);
911 return impl_from_IDispatchEx((IDispatchEx*)disp);
912}
static jsdisp_t * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:593
static IDispatchExVtbl DispatchExVtbl
Definition: dispex.c:890

Referenced by interp_obj_prop().

◆ bool_obj_value()

BOOL bool_obj_value ( jsdisp_t obj)

Definition at line 52 of file bool.c.

53{
55 return bool_from_jsdisp(obj)->val;
56}
static BoolInstance * bool_from_jsdisp(jsdisp_t *jsdisp)
Definition: bool.c:37
BOOL val
Definition: bool.c:31

Referenced by maybe_to_primitive().

◆ builtin_set_const()

HRESULT builtin_set_const ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t  value 
)

Definition at line 555 of file dispex.c.

556{
557 TRACE("%p %s\n", jsthis, debugstr_jsval(value));
558 return S_OK;
559}
#define S_OK
Definition: intsafe.h:52
const char * debugstr_jsval(const jsval_t) DECLSPEC_HIDDEN
Definition: jsutils.c:35
#define TRACE(s)
Definition: solgame.cpp:4
Definition: pdh_main.c:94

◆ clear_ei()

void clear_ei ( script_ctx_t ctx)

Definition at line 430 of file engine.c.

431{
432 memset(&ctx->ei.ei, 0, sizeof(ctx->ei.ei));
433 jsval_release(ctx->ei.val);
434 ctx->ei.val = jsval_undefined();
435}
void jsval_release(jsval_t val)
Definition: jsutils.c:191
static jsval_t jsval_undefined(void)
Definition: jsval.h:137
#define memset(x, y, z)
Definition: compat.h:39

Referenced by compile_error(), disp_call(), disp_call_value(), disp_propget(), disp_propput(), DispatchEx_InvokeEx(), Err_Clear(), exec_global_code(), index_from_val(), JScriptParse_ParseScriptText(), release_script(), script_release(), unwind_exception(), and variant_change_type().

◆ create_activex_constr()

HRESULT create_activex_constr ( script_ctx_t ctx,
jsdisp_t **  ret 
)

Definition at line 188 of file activex.c.

189{
190 jsdisp_t *prototype;
192
193 static const WCHAR ActiveXObjectW[] = {'A','c','t','i','v','e','X','O','b','j','e','c','t',0};
194
195 hres = create_object(ctx, NULL, &prototype);
196 if(FAILED(hres))
197 return hres;
198
200 PROPF_CONSTR|1, prototype, ret);
201
202 jsdisp_release(prototype);
203 return hres;
204}
#define NULL
Definition: types.h:112
static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: activex.c:141
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)
Definition: function.c:651
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR ActiveXObjectW[]
Definition: global.c:52
#define PROPF_CONSTR
Definition: jscript.h:98
HRESULT create_object(script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: object.c:731
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
HRESULT hres
Definition: protocol.c:465
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by init_global().

◆ create_array()

HRESULT create_array ( script_ctx_t ctx,
DWORD  length,
jsdisp_t **  ret 
)

Definition at line 1381 of file array.c.

1382{
1384 HRESULT hres;
1385
1387 if(FAILED(hres))
1388 return hres;
1389
1390 array->length = length;
1391
1392 *ret = &array->dispex;
1393 return S_OK;
1394}
static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayInstance **ret)
Definition: array.c:1326
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

Referenced by Array_concat(), Array_map(), Array_slice(), Array_splice(), ArrayConstr_value(), create_match_array(), interp_carray(), parse_json_value(), regexp_string_match(), String_split(), and VBArray_toArray().

◆ create_array_constr()

HRESULT create_array_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 1364 of file array.c.

1365{
1367 HRESULT hres;
1368
1369 static const WCHAR ArrayW[] = {'A','r','r','a','y',0};
1370
1371 hres = alloc_array(ctx, object_prototype, &array);
1372 if(FAILED(hres))
1373 return hres;
1374
1376
1377 jsdisp_release(&array->dispex);
1378 return hres;
1379}
static const builtin_info_t ArrayConstr_info
Definition: array.c:1355
static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: array.c:1275
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)
Definition: function.c:686
static const WCHAR ArrayW[]
Definition: global.c:36

Referenced by init_constructors().

◆ create_ax_site()

IUnknown * create_ax_site ( script_ctx_t ctx)

Definition at line 324 of file jscript.c.

325{
327 AXSite *ret;
329
330 hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IServiceProvider, (void**)&sp);
331 if(FAILED(hres)) {
332 TRACE("Could not get IServiceProvider iface: %08x\n", hres);
333 }
334
335 ret = heap_alloc(sizeof(AXSite));
336 if(!ret) {
337 IServiceProvider_Release(sp);
338 return NULL;
339 }
340
341 ret->IServiceProvider_iface.lpVtbl = &AXSiteVtbl;
342 ret->ref = 1;
343 ret->sp = sp;
344
345 return (IUnknown*)&ret->IServiceProvider_iface;
346}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static IServiceProviderVtbl AXSiteVtbl
Definition: jscript.c:317
static const WCHAR sp[]
Definition: suminfo.c:287

◆ create_bool()

HRESULT create_bool ( script_ctx_t ctx,
BOOL  b,
jsdisp_t **  ret 
)

Definition at line 216 of file bool.c.

217{
220
221 hres = alloc_bool(ctx, NULL, &bool);
222 if(FAILED(hres))
223 return hres;
224
225 bool->val = b;
226
227 *ret = &bool->dispex;
228 return S_OK;
229}
static HRESULT alloc_bool(script_ctx_t *ctx, jsdisp_t *object_prototype, BoolInstance **ret)
Definition: bool.c:175
#define b
Definition: ke_i.h:79
#define bool
Definition: nsiface.idl:72

Referenced by BoolConstr_value(), and to_object().

◆ create_bool_constr()

HRESULT create_bool_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 198 of file bool.c.

199{
202
203 static const WCHAR BooleanW[] = {'B','o','o','l','e','a','n',0};
204
205 hres = alloc_bool(ctx, object_prototype, &bool);
206 if(FAILED(hres))
207 return hres;
208
210 PROPF_CONSTR|1, &bool->dispex, ret);
211
212 jsdisp_release(&bool->dispex);
213 return hres;
214}
static HRESULT BoolConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: bool.c:138
static const WCHAR BooleanW[]
Definition: global.c:37

Referenced by init_constructors().

◆ create_builtin_constructor()

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 
)

Definition at line 686 of file function.c.

688{
689 jsdisp_t *constr;
691
692 hres = create_builtin_function(ctx, value_proc, name, builtin_info, flags, prototype, &constr);
693 if(FAILED(hres))
694 return hres;
695
696 hres = set_constructor_prop(ctx, constr, prototype);
697 if(FAILED(hres)) {
698 jsdisp_release(constr);
699 return hres;
700 }
701
702 *ret = constr;
703 return S_OK;
704}
static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t *prot)
Definition: function.c:678
GLbitfield flags
Definition: glext.h:7161
Definition: name.c:39

Referenced by create_array_constr(), create_bool_constr(), create_date_constr(), create_enumerator_constr(), create_number_constr(), create_object_constr(), create_regexp_constr(), create_string_constr(), create_vbarray_constr(), and init_error_constr().

◆ create_builtin_function()

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 
)

Definition at line 651 of file function.c.

653{
654 NativeFunction *function;
656
657 hres = create_function(ctx, builtin_info, &NativeFunctionVtbl, sizeof(NativeFunction), flags, FALSE, NULL, (void**)&function);
658 if(FAILED(hres))
659 return hres;
660
661 if(builtin_info)
663 jsval_number(function->function.length));
664 if(SUCCEEDED(hres))
666 if(FAILED(hres)) {
667 jsdisp_release(&function->function.dispex);
668 return hres;
669 }
670
671 function->proc = value_proc;
672 function->name = name;
673
674 *ret = &function->function.dispex;
675 return S_OK;
676}
#define FALSE
Definition: types.h:117
static const WCHAR prototypeW[]
Definition: function.c:94
static const WCHAR lengthW[]
Definition: function.c:96
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)
Definition: function.c:566
static const function_vtbl_t NativeFunctionVtbl
Definition: function.c:645
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1801
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
static jsval_t jsval_number(double n)
Definition: jsval.h:144
jsdisp_t dispex
Definition: function.c:31
FunctionInstance function
Definition: function.c:51
const WCHAR * name
Definition: function.c:53
builtin_invoke_t proc
Definition: function.c:52

Referenced by create_activex_constr(), create_builtin_constructor(), and prop_get().

◆ create_date_constr()

HRESULT create_date_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 2534 of file date.c.

2535{
2536 jsdisp_t *date;
2537 HRESULT hres;
2538
2539 static const WCHAR DateW[] = {'D','a','t','e',0};
2540
2541 hres = create_date(ctx, object_prototype, 0.0, &date);
2542 if(FAILED(hres))
2543 return hres;
2544
2546 PROPF_CONSTR|7, date, ret);
2547
2549 return hres;
2550}
static const builtin_info_t DateConstr_info
Definition: date.c:2525
static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: date.c:2436
static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE time, jsdisp_t **ret)
Definition: date.c:2003
static const WCHAR DateW[]
Definition: global.c:38
__u16 date
Definition: mkdosfs.c:8

Referenced by init_constructors().

◆ create_dispex()

HRESULT create_dispex ( script_ctx_t ctx,
const builtin_info_t builtin_info,
jsdisp_t prototype,
jsdisp_t **  dispex 
)

Definition at line 957 of file dispex.c.

958{
959 jsdisp_t *ret;
961
962 ret = heap_alloc_zero(sizeof(jsdisp_t));
963 if(!ret)
964 return E_OUTOFMEMORY;
965
966 hres = init_dispex(ret, ctx, builtin_info ? builtin_info : &dispex_info, prototype);
967 if(FAILED(hres)) {
968 heap_free(ret);
969 return hres;
970 }
971
972 *dispex = ret;
973 return S_OK;
974}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const builtin_info_t dispex_info
Definition: dispex.c:949
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919

Referenced by create_object_prototype(), init_global(), interp_enter_catch(), InterpretedFunction_call(), and Object_create().

◆ create_enumerator_constr()

HRESULT create_enumerator_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 332 of file enumerator.c.

333{
334 EnumeratorInstance *enumerator;
336 static const WCHAR EnumeratorW[] = {'E','n','u','m','e','r','a','t','o','r',0};
337
338 hres = alloc_enumerator(ctx, object_prototype, &enumerator);
339 if(FAILED(hres))
340 return hres;
341
344 PROPF_CONSTR|7, &enumerator->dispex, ret);
345 jsdisp_release(&enumerator->dispex);
346
347 return hres;
348}
static HRESULT EnumeratorConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: enumerator.c:295
static const builtin_info_t EnumeratorConstr_info
Definition: enumerator.c:323
static HRESULT alloc_enumerator(script_ctx_t *ctx, jsdisp_t *object_prototype, EnumeratorInstance **ret)
Definition: enumerator.c:204
static const WCHAR EnumeratorW[]
Definition: global.c:54

Referenced by init_constructors().

◆ create_jscaller()

HRESULT create_jscaller ( script_ctx_t ctx)

Definition at line 1047 of file jsutils.c.

1048{
1049 JSCaller *ret;
1050
1051 ret = heap_alloc(sizeof(*ret));
1052 if(!ret)
1053 return E_OUTOFMEMORY;
1054
1055 ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
1056 ret->ref = 1;
1057 ret->ctx = ctx;
1058
1059 ctx->jscaller = ret;
1060 return S_OK;
1061}
static const IServiceProviderVtbl ServiceProviderVtbl
Definition: jsutils.c:1040

Referenced by JScriptParse_InitNew().

◆ create_jscript_object()

HRESULT create_jscript_object ( BOOL  is_encode,
REFIID  riid,
void **  ppv 
)

Definition at line 1072 of file jscript.c.

1073{
1074 JScript *ret;
1075 HRESULT hres;
1076
1077 ret = heap_alloc_zero(sizeof(*ret));
1078 if(!ret)
1079 return E_OUTOFMEMORY;
1080
1081 lock_module();
1082
1083 ret->IActiveScript_iface.lpVtbl = &JScriptVtbl;
1084 ret->IActiveScriptParse_iface.lpVtbl = &JScriptParseVtbl;
1085 ret->IActiveScriptParseProcedure2_iface.lpVtbl = &JScriptParseProcedureVtbl;
1086 ret->IActiveScriptProperty_iface.lpVtbl = &JScriptPropertyVtbl;
1087 ret->IObjectSafety_iface.lpVtbl = &JScriptSafetyVtbl;
1088 ret->IVariantChangeType_iface.lpVtbl = &VariantChangeTypeVtbl;
1089 ret->ref = 1;
1090 ret->safeopt = INTERFACE_USES_DISPEX;
1091 ret->is_encode = is_encode;
1092
1093 hres = IActiveScript_QueryInterface(&ret->IActiveScript_iface, riid, ppv);
1094 IActiveScript_Release(&ret->IActiveScript_iface);
1095 return hres;
1096}
static const IActiveScriptParseProcedure2Vtbl JScriptParseProcedureVtbl
Definition: jscript.c:877
static const IActiveScriptParseVtbl JScriptParseVtbl
Definition: jscript.c:813
static const IVariantChangeTypeVtbl VariantChangeTypeVtbl
Definition: jscript.c:1065
static const IActiveScriptVtbl JScriptVtbl
Definition: jscript.c:655
static const IObjectSafetyVtbl JScriptSafetyVtbl
Definition: jscript.c:1007
static const IActiveScriptPropertyVtbl JScriptPropertyVtbl
Definition: jscript.c:944
static void lock_module(void)
Definition: ieframe.h:335
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

Referenced by JScriptEncodeFactory_CreateInstance(), and JScriptFactory_CreateInstance().

◆ create_json()

HRESULT create_json ( script_ctx_t ctx,
jsdisp_t **  ret 
)

Definition at line 837 of file json.c.

838{
839 jsdisp_t *json;
841
842 json = heap_alloc_zero(sizeof(*json));
843 if(!json)
844 return E_OUTOFMEMORY;
845
846 hres = init_dispex_from_constr(json, ctx, &JSON_info, ctx->object_constr);
847 if(FAILED(hres)) {
848 heap_free(json);
849 return hres;
850 }
851
852 *ret = json;
853 return S_OK;
854}
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:1030
static const builtin_info_t JSON_info
Definition: json.c:828

Referenced by init_global().

◆ create_math()

HRESULT create_math ( script_ctx_t ctx,
jsdisp_t **  ret 
)

Definition at line 533 of file math.c.

534{
535 jsdisp_t *math;
536 unsigned i;
538
539 struct {
540 const WCHAR *name;
541 DOUBLE val;
542 }constants[] = {
543 {EW, M_E}, /* ECMA-262 3rd Edition 15.8.1.1 */
544 {LN10W, M_LN10}, /* ECMA-262 3rd Edition 15.8.1.2 */
545 {LN2W, M_LN2}, /* ECMA-262 3rd Edition 15.8.1.3 */
546 {LOG2EW, M_LOG2E}, /* ECMA-262 3rd Edition 15.8.1.4 */
547 {LOG10EW, M_LOG10E}, /* ECMA-262 3rd Edition 15.8.1.5 */
548 {PIW, M_PI}, /* ECMA-262 3rd Edition 15.8.1.6 */
549 {SQRT1_2W, M_SQRT1_2}, /* ECMA-262 3rd Edition 15.8.1.7 */
550 {SQRT2W, M_SQRT2}, /* ECMA-262 3rd Edition 15.8.1.8 */
551 };
552
553 math = heap_alloc_zero(sizeof(jsdisp_t));
554 if(!math)
555 return E_OUTOFMEMORY;
556
557 hres = init_dispex_from_constr(math, ctx, &Math_info, ctx->object_constr);
558 if(FAILED(hres)) {
559 heap_free(math);
560 return hres;
561 }
562
563 for(i=0; i < ARRAY_SIZE(constants); i++) {
566 if(FAILED(hres)) {
567 jsdisp_release(math);
568 return hres;
569 }
570 }
571
572 *ret = math;
573 return S_OK;
574}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define M_PI
Definition: dib.cpp:343
static const WCHAR LOG10EW[]
Definition: math.c:37
static const builtin_info_t Math_info
Definition: math.c:524
static const WCHAR SQRT2W[]
Definition: math.c:41
static const WCHAR LOG2EW[]
Definition: math.c:36
static const WCHAR LN2W[]
Definition: math.c:38
static const WCHAR PIW[]
Definition: math.c:40
static const WCHAR LN10W[]
Definition: math.c:39
static const WCHAR SQRT1_2W[]
Definition: math.c:42
static const WCHAR EW[]
Definition: math.c:35
GLuint GLfloat * val
Definition: glext.h:7180
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
Definition: glfuncs.h:248
constants
Definition: resource.c:29
#define M_SQRT2
double DOUBLE
Definition: typedefs.h:70

Referenced by init_global().

◆ create_number()

HRESULT create_number ( script_ctx_t ctx,
double  value,
jsdisp_t **  ret 
)

Definition at line 632 of file number.c.

633{
636
638 if(FAILED(hres))
639 return hres;
640
641 number->value = value;
642
643 *ret = &number->dispex;
644 return S_OK;
645}
static unsigned int number
Definition: dsound.c:1479
static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, NumberInstance **ret)
Definition: number.c:591

Referenced by NumberConstr_value(), and to_object().

◆ create_number_constr()

HRESULT create_number_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 613 of file number.c.

614{
617
618 static const WCHAR NumberW[] = {'N','u','m','b','e','r',0};
619
620 hres = alloc_number(ctx, object_prototype, &number);
621 if(FAILED(hres))
622 return hres;
623
624 number->value = 0;
626 PROPF_CONSTR|1, &number->dispex, ret);
627
628 jsdisp_release(&number->dispex);
629 return hres;
630}
static const WCHAR NumberW[]
Definition: global.c:47
static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: number.c:541

Referenced by init_constructors().

◆ create_object()

HRESULT create_object ( script_ctx_t ctx,
jsdisp_t constr,
jsdisp_t **  ret 
)

Definition at line 731 of file object.c.

732{
735
736 object = heap_alloc_zero(sizeof(jsdisp_t));
737 if(!object)
738 return E_OUTOFMEMORY;
739
740 hres = init_dispex_from_constr(object, ctx, &ObjectInst_info, constr ? constr : ctx->object_constr);
741 if(FAILED(hres)) {
742 heap_free(object);
743 return hres;
744 }
745
746 *ret = object;
747 return S_OK;
748}
static const builtin_info_t ObjectInst_info
Definition: object.c:264

Referenced by create_activex_constr(), create_source_function(), d3drm3_CreateObject(), interp_new_obj(), InterpretedFunction_call(), Object_getOwnPropertyDescriptor(), ObjectConstr_value(), parse_json_value(), and to_object().

◆ create_object_constr()

HRESULT create_object_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 718 of file object.c.

719{
720 static const WCHAR ObjectW[] = {'O','b','j','e','c','t',0};
721
723 object_prototype, ret);
724}
static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:671
static const builtin_info_t ObjectConstr_info
Definition: object.c:662
static const WCHAR ObjectW[]
Definition: global.c:48

Referenced by init_constructors().

◆ create_object_prototype()

HRESULT create_object_prototype ( script_ctx_t ctx,
jsdisp_t **  ret 
)

Definition at line 726 of file object.c.

727{
729}
static const builtin_info_t Object_info
Definition: object.c:255
HRESULT create_dispex(script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype, jsdisp_t **dispex)
Definition: dispex.c:957

Referenced by init_global().

◆ create_regexp()

HRESULT create_regexp ( script_ctx_t ctx,
jsstr_t src,
DWORD  flags,
jsdisp_t **  ret 
)

Definition at line 644 of file jsregexp.c.

645{
646 RegExpInstance *regexp;
647 const WCHAR *str;
649
651 if(!str)
652 return E_OUTOFMEMORY;
653
654 TRACE("%s %x\n", debugstr_wn(str, jsstr_length(src)), flags);
655
656 hres = alloc_regexp(ctx, NULL, &regexp);
657 if(FAILED(hres))
658 return hres;
659
660 regexp->str = jsstr_addref(src);
661 regexp->last_index_val = jsval_number(0);
662
663 regexp->jsregexp = regexp_new(ctx, &ctx->tmp_heap, str, jsstr_length(regexp->str), flags, FALSE);
664 if(!regexp->jsregexp) {
665 WARN("regexp_new failed\n");
666 jsdisp_release(&regexp->dispex);
667 return E_FAIL;
668 }
669
670 *ret = &regexp->dispex;
671 return S_OK;
672}
#define WARN(fmt,...)
Definition: debug.h:112
#define E_FAIL
Definition: ddrawi.h:102
GLenum src
Definition: glext.h:6340
regexp_t * regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str, DWORD str_len, WORD flags, BOOL flat)
Definition: regexp.c:3195
static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegExpInstance **ret)
Definition: jsregexp.c:621
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
#define debugstr_wn
Definition: kernel32.h:33
const WCHAR * str
jsstr_t * str
Definition: jsregexp.c:32
jsdisp_t dispex
Definition: jsregexp.c:29
jsval_t last_index_val
Definition: jsregexp.c:34
regexp_t * jsregexp
Definition: jsregexp.c:31

Referenced by create_regexp_var(), interp_new(), interp_regexp(), and String_match().

◆ create_regexp_constr()

HRESULT create_regexp_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 1004 of file jsregexp.c.

1005{
1006 RegExpInstance *regexp;
1007 HRESULT hres;
1008
1009 static const WCHAR RegExpW[] = {'R','e','g','E','x','p',0};
1010
1011 hres = alloc_regexp(ctx, object_prototype, &regexp);
1012 if(FAILED(hres))
1013 return hres;
1014
1016 PROPF_CONSTR|2, &regexp->dispex, ret);
1017
1018 jsdisp_release(&regexp->dispex);
1019 return hres;
1020}
static const WCHAR RegExpW[]
Definition: global.c:50
static const builtin_info_t RegExpConstr_info
Definition: jsregexp.c:995
static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: jsregexp.c:926

Referenced by init_constructors().

◆ create_regexp_var()

HRESULT create_regexp_var ( script_ctx_t ctx,
jsval_t  src_arg,
jsval_t flags_arg,
jsdisp_t **  ret 
)

Definition at line 674 of file jsregexp.c.

675{
676 unsigned flags, opt_len = 0;
677 const WCHAR *opt = NULL;
678 jsstr_t *src;
680
681 if(is_object_instance(src_arg)) {
682 jsdisp_t *obj;
683
684 obj = iface_to_jsdisp(get_object(src_arg));
685 if(obj) {
688
689 hres = create_regexp(ctx, regexp->str, regexp->jsregexp->flags, ret);
691 return hres;
692 }
693
695 }
696 }
697
698 if(!is_string(src_arg)) {
699 FIXME("src_arg = %s\n", debugstr_jsval(src_arg));
700 return E_NOTIMPL;
701 }
702
703 src = get_string(src_arg);
704
705 if(flags_arg) {
706 jsstr_t *opt_str;
707
708 if(!is_string(*flags_arg)) {
709 FIXME("unimplemented for %s\n", debugstr_jsval(*flags_arg));
710 return E_NOTIMPL;
711 }
712
713 opt_str = get_string(*flags_arg);
714 opt = jsstr_flatten(opt_str);
715 if(!opt)
716 return E_OUTOFMEMORY;
717 opt_len = jsstr_length(opt_str);
718 }
719
720 hres = parse_regexp_flags(opt, opt_len, &flags);
721 if(FAILED(hres))
722 return hres;
723
724 return create_regexp(ctx, src, flags, ret);
725}
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1060
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
HRESULT create_regexp(script_ctx_t *ctx, jsstr_t *src, DWORD flags, jsdisp_t **ret)
Definition: jsregexp.c:644
HRESULT parse_regexp_flags(const WCHAR *str, DWORD str_len, DWORD *ret)
Definition: jsregexp.c:1022
static jsstr_t * get_string(jsval_t v)
Definition: jsval.h:229
static IDispatch * get_object(jsval_t v)
Definition: jsval.h:219
static BOOL is_object_instance(jsval_t v)
Definition: jsval.h:166
static BOOL is_string(parse_buffer *buf)
Definition: parsing.c:600
Definition: jsstr.h:39
WORD flags
Definition: regexp.h:57

Referenced by RegExpConstr_value(), and String_search().

◆ create_string()

HRESULT create_string ( script_ctx_t ctx,
jsstr_t str,
jsdisp_t **  ret 
)

Definition at line 1787 of file string.c.

1788{
1790 HRESULT hres;
1791
1792 hres = string_alloc(ctx, NULL, str, &string);
1793 if(FAILED(hres))
1794 return hres;
1795
1796 *ret = &string->dispex;
1797 return S_OK;
1798
1799}
static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr_t *str, StringInstance **ret)
Definition: string.c:1733
char string[160]
Definition: util.h:11

Referenced by StringConstr_value(), and to_object().

◆ create_string_constr()

HRESULT create_string_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 1769 of file string.c.

1770{
1772 HRESULT hres;
1773
1774 static const WCHAR StringW[] = {'S','t','r','i','n','g',0};
1775
1776 hres = string_alloc(ctx, object_prototype, jsstr_empty(), &string);
1777 if(FAILED(hres))
1778 return hres;
1779
1781 PROPF_CONSTR|1, &string->dispex, ret);
1782
1783 jsdisp_release(&string->dispex);
1784 return hres;
1785}
static const builtin_info_t StringConstr_info
Definition: string.c:1760
static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: string.c:1685
static const WCHAR StringW[]
Definition: global.c:49
jsstr_t * jsstr_empty(void)
Definition: jsstr.c:288

Referenced by init_constructors().

◆ create_vbarray()

HRESULT create_vbarray ( script_ctx_t ctx,
SAFEARRAY sa,
jsdisp_t **  ret 
)

Definition at line 347 of file vbarray.c.

348{
349 VBArrayInstance *vbarray;
351
352 hres = alloc_vbarray(ctx, NULL, &vbarray);
353 if(FAILED(hres))
354 return hres;
355
356 hres = SafeArrayCopy(sa, &vbarray->safearray);
357 if(FAILED(hres)) {
358 jsdisp_release(&vbarray->dispex);
359 return hres;
360 }
361
362 *ret = &vbarray->dispex;
363 return S_OK;
364}
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut)
Definition: safearray.c:1379
jsdisp_t dispex
Definition: vbarray.c:26
SAFEARRAY * safearray
Definition: vbarray.c:28
static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBArrayInstance **ret)
Definition: vbarray.c:267

Referenced by to_object().

◆ create_vbarray_constr()

HRESULT create_vbarray_constr ( script_ctx_t ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

Definition at line 330 of file vbarray.c.

331{
332 VBArrayInstance *vbarray;
334
335 static const WCHAR VBArrayW[] = {'V','B','A','r','r','a','y',0};
336
337 hres = alloc_vbarray(ctx, object_prototype, &vbarray);
338 if(FAILED(hres))
339 return hres;
340
342
343 jsdisp_release(&vbarray->dispex);
344 return hres;
345}
static const WCHAR VBArrayW[]
Definition: global.c:53
static HRESULT VBArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: vbarray.c:290

Referenced by init_constructors().

◆ debugstr_jsval()

const char * debugstr_jsval ( const  jsval_t)

Definition at line 35 of file jsutils.c.

36{
37 switch(jsval_type(v)) {
38 case JSV_UNDEFINED:
39 return "undefined";
40 case JSV_NULL:
41 return "null";
42 case JSV_OBJECT:
43 return wine_dbg_sprintf("obj(%p)", get_object(v));
44 case JSV_STRING:
45 return wine_dbg_sprintf("str(%s)", debugstr_jsstr(get_string(v)));
46 case JSV_NUMBER:
47 return wine_dbg_sprintf("%lf", get_number(v));
48 case JSV_BOOL:
49 return get_bool(v) ? "true" : "false";
50 case JSV_VARIANT:
52 }
53
54 assert(0);
55 return NULL;
56}
static BOOL get_bool(D3DXPARAMETER_TYPE type, const void *data)
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
const GLdouble * v
Definition: gl.h:2040
const char * debugstr_jsstr(jsstr_t *str)
Definition: jsstr.c:37
static VARIANT * get_variant(jsval_t v)
Definition: jsval.h:234
@ JSV_STRING
Definition: jsval.h:48
@ JSV_NUMBER
Definition: jsval.h:49
@ JSV_VARIANT
Definition: jsval.h:51
@ JSV_OBJECT
Definition: jsval.h:47
@ JSV_NULL
Definition: jsval.h:46
@ JSV_UNDEFINED
Definition: jsval.h:45
@ JSV_BOOL
Definition: jsval.h:50
static jsval_type_t jsval_type(jsval_t v)
Definition: jsval.h:210
static double get_number(jsval_t v)
Definition: jsval.h:224
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46

Referenced by Arguments_idx_put(), Array_forEach(), Array_map(), bind_event_target(), builtin_set_const(), create_regexp_var(), exprval_call(), Function_bind(), interp_add(), interp_carray_set(), interp_eq(), interp_eq2(), interp_gt(), interp_gteq(), interp_lt(), interp_lteq(), interp_neq(), invoke_prop_func(), jsdisp_define_property(), JSGlobal_eval(), JSON_stringify(), Object_create(), Object_getPrototypeOf(), print_backtrace(), prop_get(), prop_put(), to_string(), and unwind_exception().

◆ decode_source()

HRESULT decode_source ( WCHAR code)

Definition at line 111 of file decode.c.

112{
113 const WCHAR *src = code;
114 WCHAR *dst = code;
115
116 static const WCHAR decode_beginW[] = {'#','@','~','^'};
117 static const WCHAR decode_endW[] = {'^','#','~','@'};
118
119 while(*src) {
120 if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW))) {
121 DWORD len, i, j=0, csum, s=0;
122
123 src += ARRAY_SIZE(decode_beginW);
124
125 if(!decode_dword(src, &len))
126 return JS_E_INVALID_CHAR;
127
128 src += 8;
129
130 for(i=0; i<len; i++) {
131 if (src[i] == '@') {
132 switch(src[++i]) {
133 case '#':
134 s += dst[j++] = '\r';
135 break;
136 case '&':
137 s += dst[j++] = '\n';
138 break;
139 case '!':
140 s += dst[j++] = '<';
141 break;
142 case '*':
143 s += dst[j++] = '>';
144 break;
145 case '$':
146 s += dst[j++] = '@';
147 break;
148 default:
149 FIXME("unescape %c\n", src[i]);
150 return E_FAIL;
151 }
152 }else if (src[i] < 128) {
153 s += dst[j] = dictionary[src[i]][pick_encoding[j%64]];
154 j++;
155 }else {
156 FIXME("Unsupported char %c\n", src[i]);
157 return E_FAIL;
158 }
159 }
160
161 src += len;
162 dst += j;
163
164 if(!decode_dword(src, &csum) || s != csum)
165 return JS_E_INVALID_CHAR;
166 src += 8;
167
168 if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW)))
169 return JS_E_INVALID_CHAR;
170 src += ARRAY_SIZE(decode_endW);
171 }else {
172 *dst++ = *src++;
173 }
174 }
175
176 *dst = 0;
177
178 TRACE("decoded %s\n", debugstr_w(code));
179 return S_OK;
180}
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble s
Definition: gl.h:2039
GLenum GLenum dst
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
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
Definition: glfuncs.h:250
static BOOL decode_dword(const WCHAR *p, DWORD *ret)
Definition: decode.c:89
static const unsigned char pick_encoding[64]
Definition: decode.c:31
#define JS_E_INVALID_CHAR
Definition: jscript.h:542
#define debugstr_w
Definition: kernel32.h:32
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
Definition: inflate.c:139
Definition: ffs.h:52

Referenced by compile_script().

◆ disp_call()

HRESULT disp_call ( script_ctx_t ctx,
IDispatch disp,
DISPID  id,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t ret 
)

Definition at line 1136 of file dispex.c.

1137{
1138 IDispatchEx *dispex;
1139 jsdisp_t *jsdisp;
1140 VARIANT buf[6], retv;
1141 DISPPARAMS dp;
1142 unsigned i;
1143 HRESULT hres;
1144
1145 jsdisp = iface_to_jsdisp(disp);
1146 if(jsdisp) {
1148 FIXME("disp_call(propput) on builtin object\n");
1149 return E_FAIL;
1150 }
1151
1152 if(ctx != jsdisp->ctx)
1153 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1154 hres = jsdisp_call(jsdisp, id, flags, argc, argv, ret);
1155 jsdisp_release(jsdisp);
1156 return hres;
1157 }
1158
1159 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1160 if(ret && argc)
1162
1163 dp.cArgs = argc;
1164
1166 static DISPID propput_dispid = DISPID_PROPERTYPUT;
1167
1168 dp.cNamedArgs = 1;
1169 dp.rgdispidNamedArgs = &propput_dispid;
1170 }else {
1171 dp.cNamedArgs = 0;
1172 dp.rgdispidNamedArgs = NULL;
1173 }
1174
1175 if(argc > 6) {
1176 dp.rgvarg = heap_alloc(argc*sizeof(VARIANT));
1177 if(!dp.rgvarg)
1178 return E_OUTOFMEMORY;
1179 }else {
1180 dp.rgvarg = buf;
1181 }
1182
1183 for(i=0; i<argc; i++) {
1184 hres = jsval_to_variant(argv[i], dp.rgvarg+argc-i-1);
1185 if(FAILED(hres)) {
1186 while(i--)
1187 VariantClear(dp.rgvarg+argc-i-1);
1188 if(dp.rgvarg != buf)
1189 heap_free(dp.rgvarg);
1190 return hres;
1191 }
1192 }
1193
1194 V_VT(&retv) = VT_EMPTY;
1195 clear_ei(ctx);
1196 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1197 if(SUCCEEDED(hres)) {
1198 hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, &dp, ret ? &retv : NULL, &ctx->ei.ei,
1199 &ctx->jscaller->IServiceProvider_iface);
1200 IDispatchEx_Release(dispex);
1201 }else {
1202 UINT err = 0;
1203
1204 if(flags == DISPATCH_CONSTRUCT) {
1205 WARN("IDispatch cannot be constructor\n");
1206 return DISP_E_MEMBERNOTFOUND;
1207 }
1208
1209 TRACE("using IDispatch\n");
1210 hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, &dp, ret ? &retv : NULL, &ctx->ei.ei, &err);
1211 }
1212
1213 for(i=0; i<argc; i++)
1214 VariantClear(dp.rgvarg+argc-i-1);
1215 if(dp.rgvarg != buf)
1216 heap_free(dp.rgvarg);
1217 if(FAILED(hres))
1218 return hres;
1219
1220 if(ret) {
1221 hres = variant_to_jsval(&retv, ret);
1222 VariantClear(&retv);
1223 }
1224
1225 return hres;
1226}
static int argc
Definition: ServiceArgs.c:12
@ VT_EMPTY
Definition: compat.h:2295
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:430
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static DISPID propput_dispid
Definition: interp.c:27
HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: dispex.c:1113
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
Definition: jsutils.c:258
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
Definition: jsutils.c:347
static VARIANTARG static DISPID
Definition: ordinal.c:52
#define argv
Definition: mplay32.c:18
struct stdole::DISPPARAMS DISPPARAMS
unsigned int UINT
Definition: ndis.h:50
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
#define V_VT(A)
Definition: oleauto.h:211
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
#define IID_NULL
Definition: guiddef.h:98
#define err(...)
script_ctx_t * ctx
Definition: jscript.h:238
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512

Referenced by do_icall(), do_mcall(), exprval_call(), and interp_newenum().

◆ disp_call_value()

HRESULT disp_call_value ( script_ctx_t ctx,
IDispatch disp,
IDispatch jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)

Definition at line 1228 of file dispex.c.

1230{
1231 jsdisp_t *jsdisp;
1232 IDispatchEx *dispex;
1233 VARIANT buf[6], retv;
1234 DISPPARAMS dp;
1235 unsigned i;
1236 HRESULT hres;
1237
1238 assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT|DISPATCH_JSCRIPT_INTERNAL_MASK)));
1239
1240 jsdisp = iface_to_jsdisp(disp);
1241 if(jsdisp) {
1242 if(ctx != jsdisp->ctx)
1243 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1244 hres = jsdisp_call_value(jsdisp, jsthis, flags, argc, argv, r);
1245 jsdisp_release(jsdisp);
1246 return hres;
1247 }
1248
1249 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1250 if(r && argc && flags == DISPATCH_METHOD)
1252
1253 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1254 if(FAILED(hres)) {
1255 TRACE("using IDispatch\n");
1256 dispex = NULL;
1257 jsthis = NULL;
1258 }
1259
1260 if(jsthis) {
1261 static DISPID this_id = DISPID_THIS;
1262
1263 dp.cArgs = argc+1;
1264 dp.cNamedArgs = 1;
1265 dp.rgdispidNamedArgs = &this_id;
1266 }else {
1267 dp.cArgs = argc;
1268 dp.cNamedArgs = 0;
1269 dp.rgdispidNamedArgs = NULL;
1270 }
1271
1272 if(dp.cArgs > ARRAY_SIZE(buf)) {
1273 dp.rgvarg = heap_alloc(dp.cArgs*sizeof(VARIANT));
1274 if(!dp.rgvarg) {
1275 if(dispex)
1276 IDispatchEx_Release(dispex);
1277 return E_OUTOFMEMORY;
1278 }
1279 }else {
1280 dp.rgvarg = buf;
1281 }
1282
1283 for(i=0; i<argc; i++) {
1284 hres = jsval_to_variant(argv[i], dp.rgvarg+dp.cArgs-i-1);
1285 if(FAILED(hres)) {
1286 while(i--)
1287 VariantClear(dp.rgvarg+dp.cArgs-i-1);
1288 if(dp.rgvarg != buf)
1289 heap_free(dp.rgvarg);
1290 if(dispex)
1291 IDispatchEx_Release(dispex);
1292 return hres;
1293 }
1294 }
1295 if(jsthis) {
1296 V_VT(dp.rgvarg) = VT_DISPATCH;
1297 V_DISPATCH(dp.rgvarg) = jsthis;
1298 }
1299
1300 V_VT(&retv) = VT_EMPTY;
1301 clear_ei(ctx);
1302 if(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);
1306 }else {
1307 UINT err = 0;
1308
1309 if(flags == DISPATCH_CONSTRUCT) {
1310 WARN("IDispatch cannot be constructor\n");
1311 return DISP_E_MEMBERNOTFOUND;
1312 }
1313
1314 hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, ctx->lcid, flags, &dp, r ? &retv : NULL, &ctx->ei.ei, &err);
1315 }
1316
1317 for(i=0; i<argc; i++)
1318 VariantClear(dp.rgvarg+dp.cArgs-i-1);
1319 if(dp.rgvarg != buf)
1320 heap_free(dp.rgvarg);
1321 if(FAILED(hres))
1322 return hres;
1323
1324 if(!r)
1325 return S_OK;
1326
1327 hres = variant_to_jsval(&retv, r);
1328 VariantClear(&retv);
1329 return hres;
1330}
@ VT_DISPATCH
Definition: compat.h:2304
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: dispex.c:1089
#define DISPATCH_JSCRIPT_INTERNAL_MASK
Definition: jscript.h:116
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define DISPID_THIS
Definition: olectl.h:395

Referenced by Array_forEach(), Array_map(), exprval_call(), Function_apply(), interp_call(), interp_new(), and invoke_prop_func().

◆ disp_delete()

HRESULT disp_delete ( IDispatch disp,
DISPID  id,
BOOL ret 
)

Definition at line 1511 of file dispex.c.

1512{
1513 IDispatchEx *dispex;
1514 jsdisp_t *jsdisp;
1515 HRESULT hres;
1516
1517 jsdisp = iface_to_jsdisp(disp);
1518 if(jsdisp) {
1519 dispex_prop_t *prop;
1520
1521 prop = get_prop(jsdisp, id);
1522 if(prop)
1523 hres = delete_prop(prop, ret);
1524 else
1526
1527 jsdisp_release(jsdisp);
1528 return hres;
1529 }
1530
1531 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1532 if(FAILED(hres)) {
1533 *ret = FALSE;
1534 return S_OK;
1535 }
1536
1537 hres = IDispatchEx_DeleteMemberByDispID(dispex, id);
1538 IDispatchEx_Release(dispex);
1539 if(FAILED(hres))
1540 return hres;
1541
1542 *ret = hres == S_OK;
1543 return S_OK;
1544}
static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret)
Definition: dispex.c:787
static dispex_prop_t * get_prop(jsdisp_t *This, DISPID id)
Definition: dispex.c:65

Referenced by interp_delete_ident().

◆ disp_delete_name()

HRESULT disp_delete_name ( script_ctx_t ctx,
IDispatch disp,
jsstr_t name,
BOOL ret 
)

Definition at line 1574 of file dispex.c.

1575{
1576 IDispatchEx *dispex;
1577 jsdisp_t *jsdisp;
1578 BSTR bstr;
1579 HRESULT hres;
1580
1581 jsdisp = iface_to_jsdisp(disp);
1582 if(jsdisp) {
1583 dispex_prop_t *prop;
1584 const WCHAR *ptr;
1585
1587 if(!ptr) {
1588 jsdisp_release(jsdisp);
1589 return E_OUTOFMEMORY;
1590 }
1591
1592 hres = find_prop_name(jsdisp, string_hash(ptr), ptr, &prop);
1593 if(prop) {
1594 hres = delete_prop(prop, ret);
1595 }else {
1596 *ret = TRUE;
1597 hres = S_OK;
1598 }
1599
1600 jsdisp_release(jsdisp);
1601 return hres;
1602 }
1603
1605 if(!bstr)
1606 return E_OUTOFMEMORY;
1607 jsstr_flush(name, bstr);
1608
1609 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1610 if(SUCCEEDED(hres)) {
1611 hres = IDispatchEx_DeleteMemberByName(dispex, bstr, make_grfdex(ctx, fdexNameCaseSensitive));
1612 if(SUCCEEDED(hres))
1613 *ret = hres == S_OK;
1614 IDispatchEx_Release(dispex);
1615 }else {
1616 DISPID id;
1617
1618 hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &bstr, 1, 0, &id);
1619 if(SUCCEEDED(hres)) {
1620 /* Property exists and we can't delete it from pure IDispatch interface, so return false. */
1621 *ret = FALSE;
1622 }else if(hres == DISP_E_UNKNOWNNAME) {
1623 /* Property doesn't exist, so nothing to delete */
1624 *ret = TRUE;
1625 hres = S_OK;
1626 }
1627 }
1628
1629 SysFreeString(bstr);
1630 return hres;
1631}
#define TRUE
Definition: types.h:120
OLECHAR * BSTR
Definition: compat.h:2293
GLuint id
Definition: glext.h:5910
static unsigned string_hash(const WCHAR *name)
Definition: dispex.c:120
static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
Definition: dispex.c:197
static DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
Definition: jscript.h:519
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
Definition: jsstr.h:148
static PVOID ptr
Definition: dispmode.c:27
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515

Referenced by interp_delete().

◆ disp_propget()

HRESULT disp_propget ( script_ctx_t ctx,
IDispatch disp,
DISPID  id,
jsval_t val 
)

Definition at line 1458 of file dispex.c.

1459{
1460 DISPPARAMS dp = {NULL,NULL,0,0};
1461 IDispatchEx *dispex;
1462 jsdisp_t *jsdisp;
1463 VARIANT var;
1464 HRESULT hres;
1465
1466 jsdisp = iface_to_jsdisp(disp);
1467 if(jsdisp) {
1468 hres = jsdisp_propget(jsdisp, id, val);
1469 jsdisp_release(jsdisp);
1470 return hres;
1471 }
1472
1473 V_VT(&var) = VT_EMPTY;
1474 clear_ei(ctx);
1475 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1476 if(SUCCEEDED(hres)) {
1477 hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, INVOKE_PROPERTYGET, &dp, &var, &ctx->ei.ei,
1478 &ctx->jscaller->IServiceProvider_iface);
1479 IDispatchEx_Release(dispex);
1480 }else {
1481 ULONG err = 0;
1482
1483 TRACE("using IDispatch\n");
1484 hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, INVOKE_PROPERTYGET, &dp, &var, &ctx->ei.ei, &err);
1485 }
1486 if(FAILED(hres))
1487 return hres;
1488
1490 VariantClear(&var);
1491 return hres;
1492}
HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val)
Definition: dispex.c:1447
const char * var
Definition: shader.c:5666
uint32_t ULONG
Definition: typedefs.h:59

Referenced by exprval_propget(), interp_array(), interp_member(), and to_primitive().

◆ disp_propput()

HRESULT disp_propput ( script_ctx_t ctx,
IDispatch disp,
DISPID  id,
jsval_t  val 
)

Definition at line 1359 of file dispex.c.

1360{
1361 jsdisp_t *jsdisp;
1362 HRESULT hres;
1363
1364 jsdisp = iface_to_jsdisp(disp);
1365 if(jsdisp) {
1366 dispex_prop_t *prop;
1367
1368 prop = get_prop(jsdisp, id);
1369 if(prop)
1370 hres = prop_put(jsdisp, prop, val);
1371 else
1373
1374 jsdisp_release(jsdisp);
1375 }else {
1376 DISPID dispid = DISPID_PROPERTYPUT;
1378 VARIANT var;
1379 DISPPARAMS dp = {&var, &dispid, 1, 1};
1380 IDispatchEx *dispex;
1381
1383 if(FAILED(hres))
1384 return hres;
1385
1386 if(V_VT(&var) == VT_DISPATCH)
1388
1389 clear_ei(ctx);
1390 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1391 if(SUCCEEDED(hres)) {
1392 hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, &dp, NULL, &ctx->ei.ei,
1393 &ctx->jscaller->IServiceProvider_iface);
1394 IDispatchEx_Release(dispex);
1395 }else {
1396 ULONG err = 0;
1397
1398 TRACE("using IDispatch\n");
1399 hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, &dp, NULL, &ctx->ei.ei, &err);
1400 }
1401
1402 VariantClear(&var);
1403 }
1404
1405 return hres;
1406}
static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val)
Definition: dispex.c:490
#define DISPATCH_PROPERTYPUTREF
Definition: oleauto.h:1009

Referenced by assign_ident(), exprval_propput(), interp_assign_member(), and interp_set_member().

◆ double_to_string()

HRESULT double_to_string ( double  n,
jsstr_t **  str 
)

Definition at line 727 of file jsutils.c.

728{
729 static const WCHAR InfinityW[] = {'-','I','n','f','i','n','i','t','y',0};
730
731 if(isnan(n)) {
732 *str = jsstr_nan();
733 }else if(isinf(n)) {
734 *str = jsstr_alloc(n<0 ? InfinityW : InfinityW+1);
735 }else if(is_int32(n)) {
736 *str = int_to_string(n);
737 }else {
738 VARIANT strv, v;
740
741 /* FIXME: Don't use VariantChangeTypeEx */
742 V_VT(&v) = VT_R8;
743 V_R8(&v) = n;
744 V_VT(&strv) = VT_EMPTY;
746 if(FAILED(hres))
747 return hres;
748
749 *str = jsstr_alloc(V_BSTR(&strv));
750 SysFreeString(V_BSTR(&strv));
751 }
752
753 return *str ? S_OK : E_OUTOFMEMORY;
754}
@ VT_BSTR
Definition: compat.h:2303
@ VT_R8
Definition: compat.h:2300
GLdouble n
Definition: glext.h:7729
static const WCHAR InfinityW[]
Definition: global.c:35
static BOOL is_int32(double d)
Definition: jscript.h:514
jsstr_t * jsstr_nan(void)
Definition: jsstr.c:283
static jsstr_t * jsstr_alloc(const WCHAR *str)
Definition: jsstr.h:103
static jsstr_t * int_to_string(int i)
Definition: jsutils.c:697
#define isinf(x)
Definition: mingw_math.h:94
#define isnan(x)
Definition: mingw_math.h:133
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_R8(A)
Definition: oleauto.h:262
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_ENGLISH
Definition: nls.h:52
#define SUBLANG_ENGLISH_US
Definition: nls.h:222
HRESULT WINAPI VariantChangeTypeEx(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, LCID lcid, USHORT wFlags, VARTYPE vt)
Definition: variant.c:988

Referenced by literal_as_string(), stringify(), and to_string().

◆ Function_get_value()

HRESULT Function_get_value ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)

Definition at line 487 of file function.c.

488{
489 FunctionInstance *function = function_from_jsdisp(jsthis);
490 jsstr_t *str;
492
493 TRACE("\n");
494
495 hres = function->vtbl->toString(function, &str);
496 if(FAILED(hres))
497 return hres;
498
499 *r = jsval_string(str);
500 return S_OK;
501}
static FunctionInstance * function_from_jsdisp(jsdisp_t *jsdisp)
Definition: function.c:74
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
const function_vtbl_t * vtbl
Definition: function.c:32
HRESULT(* toString)(FunctionInstance *, jsstr_t **)
Definition: function.c:39

◆ Function_invoke()

HRESULT Function_invoke ( jsdisp_t func_this,
IDispatch jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)

Definition at line 264 of file function.c.

265{
266 FunctionInstance *function;
267
268 TRACE("func %p this %p\n", func_this, jsthis);
269
270 assert(is_class(func_this, JSCLASS_FUNCTION));
271 function = function_from_jsdisp(func_this);
272
273 return function->vtbl->call(function->dispex.ctx, function, jsthis, flags, argc, argv, r);
274}
HRESULT(* call)(script_ctx_t *, FunctionInstance *, IDispatch *, unsigned, unsigned, jsval_t *, jsval_t *)
Definition: function.c:38

Referenced by invoke_prop_func(), and jsdisp_call_value().

◆ Function_value()

HRESULT Function_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)

Definition at line 471 of file function.c.

473{
474 FunctionInstance *function;
475
476 TRACE("\n");
477
478 if(!is_vclass(jsthis, JSCLASS_FUNCTION)) {
479 ERR("dispex is not a function\n");
480 return E_FAIL;
481 }
482
483 function = function_from_jsdisp(jsthis->u.jsdisp);
484 return function->vtbl->call(ctx, function, NULL, flags, argc, argv, r);
485}
#define ERR(fmt,...)
Definition: debug.h:110
static BOOL is_vclass(vdisp_t *vdisp, jsclass_t class)
Definition: jscript.h:509
union vdisp_t::@432 u
jsdisp_t * jsdisp
Definition: jscript.h:144

◆ get_jsdisp()

static jsdisp_t * get_jsdisp ( vdisp_t vdisp)
inlinestatic

Definition at line 199 of file jscript.h.

200{
201 return is_jsdisp(vdisp) ? vdisp->u.jsdisp : NULL;
202}
static BOOL is_jsdisp(vdisp_t *vdisp)
Definition: jscript.h:157

Referenced by Error_toString(), and Object_toString().

◆ heap_pool_alloc()

void * heap_pool_alloc ( heap_pool_t heap,
DWORD  size 
)

Definition at line 77 of file jsutils.c.

78{
79 struct list *list;
80 void *tmp;
81
82 if(!heap->block_cnt) {
83 if(!heap->blocks) {
84 heap->blocks = heap_alloc(sizeof(void*));
85 if(!heap->blocks)
86 return NULL;
87 }
88
89 tmp = heap_alloc(block_size(0));
90 if(!tmp)
91 return NULL;
92
93 heap->blocks[0] = tmp;
94 heap->block_cnt = 1;
95 }
96
97 if(heap->offset + size <= block_size(heap->last_block)) {
98 tmp = ((BYTE*)heap->blocks[heap->last_block])+heap->offset;
99 heap->offset += size;
100 return tmp;
101 }
102
103 if(size <= block_size(heap->last_block+1)) {
104 if(heap->last_block+1 == heap->block_cnt) {
105 tmp = heap_realloc(heap->blocks, (heap->block_cnt+1)*sizeof(void*));
106 if(!tmp)
107 return NULL;
108
109 heap->blocks = tmp;
110 heap->blocks[heap->block_cnt] = heap_alloc(block_size(heap->block_cnt));
111 if(!heap->blocks[heap->block_cnt])
112 return NULL;
113
114 heap->block_cnt++;
115 }
116
117 heap->last_block++;
118 heap->offset = size;
119 return heap->blocks[heap->last_block];
120 }
121
122 list = heap_alloc(size + sizeof(struct list));
123 if(!list)
124 return NULL;
125
126 list_add_head(&heap->custom_blocks, list);
127 return list+1;
128}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
Definition: list.h:37
GLsizeiptr size
Definition: glext.h:5919
static DWORD block_size(DWORD block)
Definition: jsutils.c:66
#define list
Definition: rosglue.h:35
static HANDLE heap
Definition: heap.c:65
unsigned char BYTE
Definition: xxhash.c:193

Referenced by add_dynamic_var(), alloc_local(), alloc_match_state(), compiler_alloc(), compiler_alloc_zero(), heap_pool_grow(), InitMatch(), NewRENode(), parser_alloc(), and parser_alloc_tmp().

◆ heap_pool_clear()

void heap_pool_clear ( heap_pool_t heap)

Definition at line 146 of file jsutils.c.

147{
148 struct list *tmp;
149
150 if(!heap)
151 return;
152
153 while((tmp = list_head(&heap->custom_blocks))) {
154 list_remove(tmp);
155 heap_free(tmp);
156 }
157
158 if(WARN_ON(heap)) {
159 DWORD i;
160
161 for(i=0; i < heap->block_cnt; i++)
163 }
164
165 heap->last_block = heap->offset = 0;
166 heap->mark = FALSE;
167}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define ARENA_FREE_FILLER
Definition: jsutils.c:64
#define WARN_ON(c)
Definition: module.h:257
Definition: list.h:15

Referenced by RegExp2_Test(), RegExp_exec(), regexp_execute(), regexp_match(), regexp_match_next(), regexp_new(), regexp_string_match(), and RegExp_test().

◆ heap_pool_free()

void heap_pool_free ( heap_pool_t heap)

Definition at line 169 of file jsutils.c.

170{
171 DWORD i;
172
174
175 for(i=0; i < heap->block_cnt; i++)
176 heap_free(heap->blocks[i]);
177 heap_free(heap->blocks);
178
180}
void heap_pool_init(heap_pool_t *heap)
Definition: jsutils.c:71
void heap_pool_clear(heap_pool_t *heap)
Definition: jsutils.c:146

Referenced by compile_script(), RegExp2_Release(), release_bytecode(), release_exec(), release_script(), release_vbscode(), and script_release().

◆ heap_pool_grow()

void * heap_pool_grow ( heap_pool_t heap,
void mem,
DWORD  size,
DWORD  inc 
)

Definition at line 130 of file jsutils.c.

131{
132 void *ret;
133
134 if(mem == (BYTE*)heap->blocks[heap->last_block] + heap->offset-size
135 && heap->offset+inc < block_size(heap->last_block)) {
136 heap->offset += inc;
137 return mem;
138 }
139
141 if(ret) /* FIXME: avoid copying for custom blocks */
142 memcpy(ret, mem, size);
143 return ret;
144}
void * heap_pool_alloc(heap_pool_t *heap, DWORD size)
Definition: jsutils.c:77
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: mem.c:156

Referenced by PushBackTrackState(), and ReallocStateStack().

◆ heap_pool_init()

void heap_pool_init ( heap_pool_t heap)

Definition at line 71 of file jsutils.c.

72{
73 memset(heap, 0, sizeof(*heap));
74 list_init(&heap->custom_blocks);
75}
static void list_init(struct list_entry *head)
Definition: list.h:51

Referenced by alloc_vbscode(), compile_script(), create_regexp(), exec_script(), init_code(), JScriptParse_InitNew(), release_script(), and VBScriptFactory_CreateInstance().

◆ heap_pool_mark()

heap_pool_t * heap_pool_mark ( heap_pool_t heap)

Definition at line 182 of file jsutils.c.

183{
184 if(heap->mark)
185 return NULL;
186
187 heap->mark = TRUE;
188 return heap;
189}

Referenced by RegExp2_Test(), RegExp_exec(), regexp_execute(), regexp_match(), regexp_match_next(), regexp_new(), regexp_string_match(), and RegExp_test().

◆ heap_strdupW()

static LPWSTR heap_strdupW ( LPCWSTR  str)
inlinestatic

Definition at line 76 of file jscript.h.

77{
78 LPWSTR ret = NULL;
79
80 if(str) {
81 DWORD size;
82
83 size = (lstrlenW(str)+1)*sizeof(WCHAR);
85 if(ret)
86 memcpy(ret, str, size);
87 }
88
89 return ret;
90}
#define lstrlenW
Definition: compat.h:750
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ iface_to_jsdisp()

◆ init_dispex()

HRESULT init_dispex ( jsdisp_t dispex,
script_ctx_t ctx,
const builtin_info_t builtin_info,
jsdisp_t prototype 
)

Definition at line 919 of file dispex.c.

920{
921 TRACE("%p (%p)\n", dispex, prototype);
922
923 dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
924 dispex->ref = 1;
925 dispex->builtin_info = builtin_info;
926
927 dispex->props = heap_alloc_zero(sizeof(dispex_prop_t)*(dispex->buf_size=4));
928 if(!dispex->props)
929 return E_OUTOFMEMORY;
930
931 dispex->prototype = prototype;
932 if(prototype)
933 jsdisp_addref(prototype);
934
935 dispex->prop_cnt = 1;
936 if(builtin_info->value_prop.invoke || builtin_info->value_prop.getter) {
937 dispex->props[0].type = PROP_BUILTIN;
938 dispex->props[0].u.p = &builtin_info->value_prop;
939 }else {
940 dispex->props[0].type = PROP_DELETED;
941 }
942
944 dispex->ctx = ctx;
945
946 return S_OK;
947}
@ PROP_DELETED
Definition: dispex.c:35
@ PROP_BUILTIN
Definition: dispex.c:32
static void script_addref(script_ctx_t *ctx)
Definition: jscript.h:465
union _dispex_prop_t::@425 u
prop_type_t type
Definition: dispex.c:42
const builtin_prop_t * p
Definition: dispex.c:47
builtin_prop_t value_prop
Definition: jscript.h:220
builtin_getter_t getter
Definition: jscript.h:214
builtin_invoke_t invoke
Definition: jscript.h:212
IDispatchEx IDispatchEx_iface
Definition: jscript.h:231
const builtin_info_t * builtin_info
Definition: jscript.h:242
DWORD buf_size
Definition: jscript.h:235
jsdisp_t * prototype
Definition: jscript.h:240
DWORD prop_cnt
Definition: jscript.h:236
LONG ref
Definition: jscript.h:233
dispex_prop_t * props
Definition: jscript.h:237

Referenced by alloc_array(), alloc_bool(), alloc_doc_node(), alloc_enumerator(), alloc_error(), alloc_number(), alloc_regexp(), alloc_vbarray(), create_child_collection(), create_date(), create_dispex(), create_dom_implementation(), create_event(), create_func_disp(), create_function(), create_history(), create_html_rect(), create_inner_window(), create_mime_types_collection(), create_parseError(), create_plugins_collection(), create_storage(), HTMLCurrentStyle_Create(), HTMLDocument_Create(), HTMLDOMAttribute_Create(), HTMLDOMTextNode_Create(), HTMLElement_get_attr_col(), HTMLElement_Init(), HTMLElementCollection_Create(), HTMLFiltersCollection_Create(), HTMLImageElementFactory_Create(), HTMLLocation_Create(), HTMLOptionElementFactory_Create(), HTMLScreen_Create(), HTMLSelectionObject_Create(), HTMLStyle_Create(), HTMLStyleSheet_Create(), HTMLStyleSheetRulesCollection_Create(), HTMLStyleSheetsCollection_Create(), HTMLTxtRange_Create(), HTMLXMLHttpRequestFactory_Create(), HTMLXMLHttpRequestFactory_create(), init_dispex_from_constr(), MXNamespaceManager_create(), MXWriter_create(), OmNavigator_Create(), SAXAttributes_create(), string_alloc(), XSLProcessor_create(), and XSLTemplate_create().

◆ init_dispex_from_constr()

HRESULT init_dispex_from_constr ( jsdisp_t dispex,
script_ctx_t ctx,
const builtin_info_t builtin_info,
jsdisp_t constr 
)

Definition at line 1030 of file dispex.c.

1031{
1032 jsdisp_t *prot = NULL;
1033 dispex_prop_t *prop;
1034 HRESULT hres;
1035
1036 static const WCHAR prototypeW[] = {'p','r','o','t','o','t','y','p','e',0};
1037
1039 if(SUCCEEDED(hres) && prop && prop->type!=PROP_DELETED) {
1040 jsval_t val;
1041
1042 hres = prop_get(constr, prop, &val);
1043 if(FAILED(hres)) {
1044 ERR("Could not get prototype\n");
1045 return hres;
1046 }
1047
1051 }
1052
1053 hres = init_dispex(dispex, ctx, builtin_info, prot);
1054
1055 if(prot)
1056 jsdisp_release(prot);
1057 return hres;
1058}
static HRESULT find_prop_name_prot(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
Definition: dispex.c:259
static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, jsval_t *r)
Definition: dispex.c:431
Definition: jsval.h:54

Referenced by alloc_array(), alloc_bool(), alloc_enumerator(), alloc_error(), alloc_number(), alloc_regexp(), alloc_vbarray(), create_date(), create_function(), create_json(), create_math(), create_object(), setup_arguments_object(), and string_alloc().

◆ init_error_constr()

HRESULT init_error_constr ( script_ctx_t ctx,
jsdisp_t object_prototype 
)

Definition at line 328 of file error.c.

329{
330 static const WCHAR ErrorW[] = {'E','r','r','o','r',0};
331 static const WCHAR EvalErrorW[] = {'E','v','a','l','E','r','r','o','r',0};
332 static const WCHAR RangeErrorW[] = {'R','a','n','g','e','E','r','r','o','r',0};
333 static const WCHAR ReferenceErrorW[] = {'R','e','f','e','r','e','n','c','e','E','r','r','o','r',0};
334 static const WCHAR RegExpErrorW[] = {'R','e','g','E','x','p','E','r','r','o','r',0};
335 static const WCHAR SyntaxErrorW[] = {'S','y','n','t','a','x','E','r','r','o','r',0};
336 static const WCHAR TypeErrorW[] = {'T','y','p','e','E','r','r','o','r',0};
337 static const WCHAR URIErrorW[] = {'U','R','I','E','r','r','o','r',0};
338 static const WCHAR *names[] = {ErrorW, EvalErrorW, RangeErrorW,
340 jsdisp_t **constr_addr[] = {&ctx->error_constr, &ctx->eval_error_constr,
341 &ctx->range_error_constr, &ctx->reference_error_constr, &ctx->regexp_error_constr,
342 &ctx->syntax_error_constr, &ctx->type_error_constr,
343 &ctx->uri_error_constr};
347
348 jsdisp_t *err;
349 unsigned int i;
350 jsstr_t *str;
352
353 for(i=0; i < ARRAY_SIZE(names); i++) {
354 hres = alloc_error(ctx, i==0 ? object_prototype : NULL, NULL, &err);
355 if(FAILED(hres))
356 return hres;
357
359 if(!str) {
361 return E_OUTOFMEMORY;
362 }
363
367 if(SUCCEEDED(hres))
368 hres = create_builtin_constructor(ctx, constr_val[i], names[i], NULL,
369 PROPF_CONSTR|1, err, constr_addr[i]);
370
372 if(FAILED(hres))
373 return hres;
374 }
375
376 return S_OK;
377}
static const WCHAR nameW[]
Definition: error.c:34
static HRESULT SyntaxErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:307
static HRESULT ReferenceErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:293
static HRESULT URIErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:321
static HRESULT alloc_error(script_ctx_t *ctx, jsdisp_t *prototype, jsdisp_t *constr, jsdisp_t **ret)
Definition: error.c:164
static HRESULT RangeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:286
static HRESULT RegExpErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:300
static HRESULT EvalErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:279
static HRESULT TypeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:314
static HRESULT ErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:272
GLuint GLuint * names
Definition: glext.h:11545
static const WCHAR RangeErrorW[]
Definition: global.c:41
static const WCHAR RegExpErrorW[]
Definition: global.c:51
static const WCHAR SyntaxErrorW[]
Definition: global.c:43
static const WCHAR URIErrorW[]
Definition: global.c:45
static const WCHAR ReferenceErrorW[]
Definition: global.c:42
static const WCHAR EvalErrorW[]
Definition: global.c:40
static const WCHAR ErrorW[]
Definition: global.c:39
static const WCHAR TypeErrorW[]
Definition: global.c:44
HRESULT(* builtin_invoke_t)(script_ctx_t *, vdisp_t *, WORD, unsigned, jsval_t *, jsval_t *)
Definition: jscript.h:204
#define PROPF_WRITABLE
Definition: jscript.h:101
#define PROPF_CONFIGURABLE
Definition: jscript.h:102
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110

Referenced by init_constructors().

◆ init_function_constr()

HRESULT init_function_constr ( script_ctx_t ctx,
jsdisp_t object_prototype 
)

Definition at line 1010 of file function.c.

1011{
1012 NativeFunction *prot, *constr;
1013 HRESULT hres;
1014
1015 static const WCHAR FunctionW[] = {'F','u','n','c','t','i','o','n',0};
1016
1018 TRUE, object_prototype, (void**)&prot);
1019 if(FAILED(hres))
1020 return hres;
1021
1022 prot->proc = FunctionProt_value;
1023 prot->name = prototypeW;
1024
1026 TRUE, &prot->function.dispex, (void**)&constr);
1027 if(SUCCEEDED(hres)) {
1028 constr->proc = FunctionConstr_value;
1029 constr->name = FunctionW;
1031 if(SUCCEEDED(hres))
1033 if(FAILED(hres))
1034 jsdisp_release(&constr->function.dispex);
1035 }
1037 if(FAILED(hres))
1038 return hres;
1039
1040 ctx->function_constr = &constr->function.dispex;
1041 return S_OK;
1042}
static const builtin_info_t FunctionInst_info
Definition: function.c:557
static const builtin_info_t Function_info
Definition: function.c:543
static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:976
static HRESULT FunctionProt_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:1003
static const WCHAR FunctionW[]
Definition: global.c:46

Referenced by init_constructors().

◆ init_global()

HRESULT init_global ( script_ctx_t ctx)

Definition at line 1105 of file global.c.

1106{
1107 unsigned const_flags = ctx->version >= SCRIPTLANGUAGEVERSION_ES5 ? 0 : PROPF_WRITABLE;
1108 jsdisp_t *math, *object_prototype, *constr;
1109 HRESULT hres;
1110
1111 if(ctx->global)
1112 return S_OK;
1113
1114 hres = create_dispex(ctx, &JSGlobal_info, NULL, &ctx->global);
1115 if(FAILED(hres))
1116 return hres;
1117
1118 hres = create_object_prototype(ctx, &object_prototype);
1119 if(FAILED(hres))
1120 return hres;
1121
1122 hres = init_constructors(ctx, object_prototype);
1123 jsdisp_release(object_prototype);
1124 if(FAILED(hres))
1125 return hres;
1126
1127 hres = create_math(ctx, &math);
1128 if(FAILED(hres))
1129 return hres;
1130
1132 jsdisp_release(math);
1133 if(FAILED(hres))
1134 return hres;
1135
1136 if(ctx->version >= 2) {
1137 jsdisp_t *json;
1138
1139 hres = create_json(ctx, &json);
1140 if(FAILED(hres))
1141 return hres;
1142
1144 jsdisp_release(json);
1145 if(FAILED(hres))
1146 return hres;
1147 }
1148
1149 hres = create_activex_constr(ctx, &constr);
1150 if(FAILED(hres))
1151 return hres;
1152
1154 jsval_obj(constr));
1155 jsdisp_release(constr);
1156 if(FAILED(hres))
1157 return hres;
1158
1160 if(FAILED(hres))
1161 return hres;
1162
1163 hres = jsdisp_define_data_property(ctx->global, NaNW, const_flags, jsval_number(NAN));
1164 if(FAILED(hres))
1165 return hres;
1166
1168 return hres;
1169}
HRESULT create_activex_constr(script_ctx_t *ctx, jsdisp_t **ret)
Definition: activex.c:188
static const builtin_info_t JSGlobal_info
Definition: global.c:955
static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
Definition: global.c:964
static const WCHAR NaNW[]
Definition: global.c:34
static const WCHAR MathW[]
Definition: global.c:71
static const WCHAR JSONW[]
Definition: global.c:72
static const WCHAR undefinedW[]
Definition: global.c:78
HRESULT create_object_prototype(script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: object.c:726
#define SCRIPTLANGUAGEVERSION_ES5
Definition: jscript.h:52
HRESULT create_math(script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: math.c:533
HRESULT create_json(script_ctx_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: json.c:837
#define NAN
Definition: mesh.c:39
#define INFINITY
Definition: misc.c:36

◆ is_class()

◆ is_dispex()

static BOOL is_dispex ( vdisp_t vdisp)
inlinestatic

Definition at line 162 of file jscript.h.

163{
164 return (vdisp->flags & VDISP_DISPEX) != 0;
165}
#define VDISP_DISPEX
Definition: jscript.h:149
DWORD flags
Definition: jscript.h:146

Referenced by Object_hasOwnProperty().

◆ is_finite()

BOOL is_finite ( double  n)

Definition at line 58 of file jsutils.c.

59{
60 return !isnan(n) && !isinf(n);
61}

Referenced by JSGlobal_isFinite(), Number_toExponential(), Number_toFixed(), Number_toPrecision(), Number_toString(), stringify(), and to_int32().

◆ is_int32()

static BOOL is_int32 ( double  d)
inlinestatic

Definition at line 514 of file jscript.h.

515{
516 return INT32_MIN <= d && d <= INT32_MAX && (double)(int)d == d;
517}
#define INT32_MAX
Definition: stdint.h:82
#define INT32_MIN
Definition: stdint.h:77
#define d
Definition: ke_i.h:81
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80

Referenced by Array_splice(), ArrayConstr_value(), double_to_string(), index_from_val(), jsval_to_variant(), String_charAt(), String_charCodeAt(), String_indexOf(), String_lastIndexOf(), String_slice(), String_substr(), and String_substring().

◆ is_jscript_error()

static BOOL is_jscript_error ( HRESULT  hres)
inlinestatic

Definition at line 575 of file jscript.h.

576{
578}
#define FACILITY_JSCRIPT
Definition: jscript.h:524
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79

Referenced by throw_error().

◆ is_jsdisp()

static BOOL is_jsdisp ( vdisp_t vdisp)
inlinestatic

Definition at line 157 of file jscript.h.

158{
159 return (vdisp->flags & VDISP_JSDISP) != 0;
160}
#define VDISP_JSDISP
Definition: jscript.h:150

Referenced by get_jsdisp(), get_length(), is_vclass(), Object_hasOwnProperty(), Object_propertyIsEnumerable(), and Object_toLocaleString().

◆ is_vclass()

static BOOL is_vclass ( vdisp_t vdisp,
jsclass_t  class 
)
inlinestatic

◆ jsdisp_addref()

◆ jsdisp_call()

HRESULT jsdisp_call ( jsdisp_t disp,
DISPID  id,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)

Definition at line 1113 of file dispex.c.

1114{
1115 dispex_prop_t *prop;
1116
1117 prop = get_prop(disp, id);
1118 if(!prop)
1119 return DISP_E_MEMBERNOTFOUND;
1120
1121 return invoke_prop_func(disp, to_disp(disp), prop, flags, argc, argv, r, NULL);
1122}
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)
Definition: dispex.c:375
static IDispatch * to_disp(jsdisp_t *jsdisp)
Definition: jscript.h:245

Referenced by disp_call(), and to_primitive().

◆ jsdisp_call_name()

HRESULT jsdisp_call_name ( jsdisp_t disp,
const WCHAR name,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)

Definition at line 1124 of file dispex.c.

1125{
1126 dispex_prop_t *prop;
1127 HRESULT hres;
1128
1129 hres = find_prop_name_prot(disp, string_hash(name), name, &prop);
1130 if(FAILED(hres))
1131 return hres;
1132
1133 return invoke_prop_func(disp, to_disp(disp), prop, flags, argc, argv, r, NULL);
1134}

Referenced by Object_toLocaleString().

◆ jsdisp_call_value()

HRESULT jsdisp_call_value ( jsdisp_t jsfunc,
IDispatch jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)

Definition at line 1089 of file dispex.c.

1090{
1091 HRESULT hres;
1092
1093 assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT|DISPATCH_JSCRIPT_INTERNAL_MASK)));
1094
1095 if(is_class(jsfunc, JSCLASS_FUNCTION)) {
1096 hres = Function_invoke(jsfunc, jsthis, flags, argc, argv, r);
1097 }else {
1098 vdisp_t vdisp;
1099
1100 if(!jsfunc->builtin_info->value_prop.invoke) {
1101 WARN("Not a function\n");
1103 }
1104
1105 set_disp(&vdisp, jsthis);
1106 flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
1107 hres = jsfunc->builtin_info->value_prop.invoke(jsfunc->ctx, &vdisp, flags, argc, argv, r);
1108 vdisp_release(&vdisp);
1109 }
1110 return hres;
1111}
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440
HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:264
static void set_disp(vdisp_t *vdisp, IDispatch *disp)
Definition: jscript.h:174
#define JS_E_FUNCTION_EXPECTED
Definition: jscript.h:552
static void vdisp_release(vdisp_t *vdisp)
Definition: jscript.h:152

Referenced by disp_call_value(), prop_get(), prop_put(), rep_call(), and sort_cmp().

◆ jsdisp_define_data_property()

HRESULT jsdisp_define_data_property ( jsdisp_t obj,
const WCHAR name,
unsigned  flags,
jsval_t  value 
)

Definition at line 1801 of file dispex.c.

1802{
1803 property_desc_t prop_desc = { flags, flags, TRUE };
1804 prop_desc.value = value;
1805 return jsdisp_define_property(obj, name, &prop_desc);
1806}
HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t *desc)
Definition: dispex.c:1677
jsval_t value
Definition: jscript.h:392

Referenced by create_builtin_function(), create_error(), create_math(), create_source_function(), init_constructors(), init_error_constr(), init_function_constr(), init_global(), Object_getOwnPropertyDescriptor(), set_constructor_prop(), and setup_arguments_object().

◆ jsdisp_define_property()

HRESULT jsdisp_define_property ( jsdisp_t obj,
const WCHAR name,
property_desc_t desc 
)

Definition at line 1677 of file dispex.c.

1678{
1679 dispex_prop_t *prop;
1680 HRESULT hres;
1681
1683 if(FAILED(hres))
1684 return hres;
1685
1686 if(!prop && !(prop = alloc_prop(obj, name, PROP_DELETED, 0)))
1687 return E_OUTOFMEMORY;
1688
1689 if(prop->type == PROP_DELETED || prop->type == PROP_PROTREF) {
1690 prop->flags = desc->flags;
1691 if(desc->explicit_getter || desc->explicit_setter) {
1692 prop->type = PROP_ACCESSOR;
1693 prop->u.accessor.getter = desc->getter ? jsdisp_addref(desc->getter) : NULL;
1694 prop->u.accessor.setter = desc->setter ? jsdisp_addref(desc->setter) : NULL;
1695 TRACE("%s = accessor { get: %p set: %p }\n", debugstr_w(name),
1696 prop->u.accessor.getter, prop->u.accessor.setter);
1697 }else {
1698 prop->type = PROP_JSVAL;
1699 if(desc->explicit_value) {
1700 hres = jsval_copy(desc->value, &prop->u.val);
1701 if(FAILED(hres))
1702 return hres;
1703 }else {
1704 prop->u.val = jsval_undefined();
1705 }
1706 TRACE("%s = %s\n", debugstr_w(name), debugstr_jsval(prop->u.val));
1707 }
1708 return S_OK;
1709 }
1710
1711 TRACE("existing prop %s prop flags %x desc flags %x desc mask %x\n", debugstr_w(name),
1712 prop->flags, desc->flags, desc->mask);
1713
1714 if(!(prop->flags & PROPF_CONFIGURABLE)) {
1715 if(((desc->mask & PROPF_CONFIGURABLE) && (desc->flags & PROPF_CONFIGURABLE))
1716 || ((desc->mask & PROPF_ENUMERABLE)
1717 && ((desc->flags & PROPF_ENUMERABLE) != (prop->flags & PROPF_ENUMERABLE))))
1719 }
1720
1721 if(desc->explicit_value || (desc->mask & PROPF_WRITABLE)) {
1722 if(prop->type == PROP_ACCESSOR) {
1723 if(!(prop->flags & PROPF_CONFIGURABLE))
1725 if(prop->u.accessor.getter)
1726 jsdisp_release(prop->u.accessor.getter);
1727 if(prop->u.accessor.setter)
1728 jsdisp_release(prop->u.accessor.setter);
1729
1730 prop->type = PROP_JSVAL;
1731 hres = jsval_copy(desc->value, &prop->u.val);
1732 if(FAILED(hres)) {
1733 prop->u.val = jsval_undefined();
1734 return hres;
1735 }
1736 }else {
1737 if(!(prop->flags & PROPF_CONFIGURABLE) && !(prop->flags & PROPF_WRITABLE)) {
1738 if((desc->mask & PROPF_WRITABLE) && (desc->flags & PROPF_WRITABLE))
1740 if(desc->explicit_value) {
1741 if(prop->type == PROP_JSVAL) {
1742 BOOL eq;
1743 hres = jsval_strict_equal(desc->value, prop->u.val, &eq);
1744 if(FAILED(hres))
1745 return hres;
1746 if(!eq)
1748 }else {
1749 FIXME("redefinition of property type %d\n", prop->type);
1750 }
1751 }
1752 }
1753 if(desc->explicit_value) {
1754 if(prop->type == PROP_JSVAL)
1755 jsval_release(prop->u.val);
1756 else
1757 prop->type = PROP_JSVAL;
1758 hres = jsval_copy(desc->value, &prop->u.val);
1759 if(FAILED(hres)) {
1760 prop->u.val = jsval_undefined();
1761 return hres;
1762 }
1763 }
1764 }
1765 }else if(desc->explicit_getter || desc->explicit_setter) {
1766 if(prop->type != PROP_ACCESSOR) {
1767 if(!(prop->flags & PROPF_CONFIGURABLE))
1769 if(prop->type == PROP_JSVAL)
1770 jsval_release(prop->u.val);
1771 prop->type = PROP_ACCESSOR;
1772 prop->u.accessor.getter = prop->u.accessor.setter = NULL;
1773 }else if(!(prop->flags & PROPF_CONFIGURABLE)) {
1774 if((desc->explicit_getter && desc->getter != prop->u.accessor.getter)
1775 || (desc->explicit_setter && desc->setter != prop->u.accessor.setter))
1777 }
1778
1779 if(desc->explicit_getter) {
1780 if(prop->u.accessor.getter) {
1781 jsdisp_release(prop->u.accessor.getter);
1782 prop->u.accessor.getter = NULL;
1783 }
1784 if(desc->getter)
1785 prop->u.accessor.getter = jsdisp_addref(desc->getter);
1786 }
1787 if(desc->explicit_setter) {
1788 if(prop->u.accessor.setter) {
1789 jsdisp_release(prop->u.accessor.setter);
1790 prop->u.accessor.setter = NULL;
1791 }
1792 if(desc->setter)
1793 prop->u.accessor.setter = jsdisp_addref(desc->setter);
1794 }
1795 }
1796
1797 prop->flags = (prop->flags & ~desc->mask) | (desc->flags & desc->mask);
1798 return S_OK;
1799}
HRESULT jsval_strict_equal(jsval_t lval, jsval_t rval, BOOL *ret)
Definition: engine.c:531
unsigned int BOOL
Definition: ntddk_ex.h:94
static dispex_prop_t * alloc_prop(jsdisp_t *This, const WCHAR *name, prop_type_t type, DWORD flags)
Definition: dispex.c:163
@ PROP_PROTREF
Definition: dispex.c:33
@ PROP_ACCESSOR
Definition: dispex.c:34
@ PROP_JSVAL
Definition: dispex.c:31
#define JS_E_NONWRITABLE_MODIFIED
Definition: jscript.h:571
#define JS_E_NONCONFIGURABLE_REDEFINED
Definition: jscript.h:570
#define PROPF_ENUMERABLE
Definition: jscript.h:100
HRESULT jsval_copy(jsval_t v, jsval_t *r)
Definition: jsutils.c:231
static const WCHAR desc[]
Definition: protectdata.c:36
#define eq(received, expected, label, type)
Definition: locale.c:144
struct _dispex_prop_t::@425::@426 accessor
DWORD flags
Definition: dispex.c:43
jsval_t val
Definition: dispex.c:46

Referenced by interp_obj_prop(), jsdisp_define_data_property(), jsdisp_define_properties(), and Object_defineProperty().

◆ jsdisp_delete_idx()

HRESULT jsdisp_delete_idx ( jsdisp_t obj,
DWORD  idx 
)

Definition at line 1494 of file dispex.c.

1495{
1496 static const WCHAR formatW[] = {'%','d',0};
1497 WCHAR buf[12];
1498 dispex_prop_t *prop;
1499 BOOL b;
1500 HRESULT hres;
1501
1502 swprintf(buf, formatW, idx);
1503
1505 if(FAILED(hres) || !prop)
1506 return hres;
1507
1508 return delete_prop(prop, &b);
1509}
unsigned int idx
Definition: utils.c:41
#define swprintf
Definition: precomp.h:40
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

Referenced by Array_pop(), Array_reverse(), Array_set_length(), Array_shift(), and Array_splice().

◆ jsdisp_free()

void jsdisp_free ( jsdisp_t obj)

Definition at line 976 of file dispex.c.

977{
978 dispex_prop_t *prop;
979
980 TRACE("(%p)\n", obj);
981
982 for(prop = obj->props; prop < obj->props+obj->prop_cnt; prop++) {
983 switch(prop->type) {
984 case PROP_JSVAL:
985 jsval_release(prop->u.val);
986 break;
987 case PROP_ACCESSOR:
988 if(prop->u.accessor.getter)
989 jsdisp_release(prop->u.accessor.getter);
990 if(prop->u.accessor.setter)
991 jsdisp_release(prop->u.accessor.setter);
992 break;
993 default:
994 break;
995 };
996 heap_free(prop->name);
997 }
998 heap_free(obj->props);
999 script_release(obj->ctx);
1000 if(obj->prototype)
1001 jsdisp_release(obj->prototype);
1002
1003 if(obj->builtin_info->destructor)
1004 obj->builtin_info->destructor(obj);
1005 else
1006 heap_free(obj);
1007}
void script_release(script_ctx_t *ctx)
Definition: jscript.c:67
WCHAR * name
Definition: dispex.c:40
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by DispatchEx_Release(), and jsdisp_release().

◆ jsdisp_get_id()

HRESULT jsdisp_get_id ( jsdisp_t jsdisp,
const WCHAR name,
DWORD  flags,
DISPID id 
)

Definition at line 1067 of file dispex.c.

1068{
1069 dispex_prop_t *prop;
1070 HRESULT hres;
1071
1072 if(flags & fdexNameEnsure)
1074 &prop);
1075 else
1076 hres = find_prop_name_prot(jsdisp, string_hash(name), name, &prop);
1077 if(FAILED(hres))
1078 return hres;
1079
1080 if(prop && prop->type!=PROP_DELETED) {
1081 *id = prop_to_id(jsdisp, prop);
1082 return S_OK;
1083 }
1084
1085 TRACE("not found %s\n", debugstr_w(name));
1086 return DISP_E_UNKNOWNNAME;
1087}
static DISPID prop_to_id(jsdisp_t *This, dispex_prop_t *prop)
Definition: dispex.c:60
static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, DWORD create_flags, dispex_prop_t **ret)
Definition: dispex.c:298

Referenced by Array_unshift(), disp_get_id(), DispatchEx_GetDispID(), exec_source(), identifier_eval(), interp_identifier_ref(), stack_topn_exprval(), stringify(), to_primitive(), and to_property_descriptor().

◆ jsdisp_get_idx()

HRESULT jsdisp_get_idx ( jsdisp_t obj,
DWORD  idx,
jsval_t r 
)

Definition at line 1425 of file dispex.c.

1426{
1427 WCHAR name[12];
1428 dispex_prop_t *prop;
1429 HRESULT hres;
1430
1431 static const WCHAR formatW[] = {'%','d',0};
1432
1433 swprintf(name, formatW, idx);
1434
1436 if(FAILED(hres))
1437 return hres;
1438
1439 if(!prop || prop->type==PROP_DELETED) {
1440 *r = jsval_undefined();
1441 return DISP_E_UNKNOWNNAME;
1442 }
1443
1444 return prop_get(obj, prop, r);
1445}

Referenced by Array_forEach(), Array_indexOf(), array_join(), Array_map(), Array_pop(), Array_reverse(), Array_shift(), Array_slice(), Array_sort(), Array_splice(), array_to_args(), concat_array(), and stringify_array().

◆ jsdisp_get_own_property()

HRESULT jsdisp_get_own_property ( jsdisp_t obj,
const WCHAR name,
BOOL  flags_only,
property_desc_t desc 
)

Definition at line 1633 of file dispex.c.

1635{
1636 dispex_prop_t *prop;
1637 HRESULT hres;
1638
1640 if(FAILED(hres))
1641 return hres;
1642
1643 if(!prop)
1644 return DISP_E_UNKNOWNNAME;
1645
1646 memset(desc, 0, sizeof(*desc));
1647
1648 switch(prop->type) {
1649 case PROP_BUILTIN:
1650 case PROP_JSVAL:
1651 desc->mask |= PROPF_WRITABLE;
1652 desc->explicit_value = TRUE;
1653 if(!flags_only) {
1654 hres = prop_get(obj, prop, &desc->value);
1655 if(FAILED(hres))
1656 return hres;
1657 }
1658 break;
1659 case PROP_ACCESSOR:
1660 desc->explicit_getter = desc->explicit_setter = TRUE;
1661 if(!flags_only) {
1662 desc->getter = prop->u.accessor.getter
1663 ? jsdisp_addref(prop->u.accessor.getter) : NULL;
1664 desc->setter = prop->u.accessor.setter
1665 ? jsdisp_addref(prop->u.accessor.setter) : NULL;
1666 }
1667 break;
1668 default:
1669 return DISP_E_UNKNOWNNAME;
1670 }
1671
1674 return S_OK;
1675}

Referenced by Object_getOwnPropertyDescriptor(), Object_hasOwnProperty(), and Object_propertyIsEnumerable().

◆ jsdisp_next_prop()

HRESULT jsdisp_next_prop ( jsdisp_t obj,
DISPID  id,
BOOL  own_only,
DISPID ret 
)

Definition at line 1546 of file dispex.c.

1547{
1548 dispex_prop_t *iter;
1549 HRESULT hres;
1550
1551 if(id == DISPID_STARTENUM && !own_only) {
1553 if(FAILED(hres))
1554 return hres;
1555 }
1556
1557 if(id + 1 < 0 || id+1 >= obj->prop_cnt)
1558 return S_FALSE;
1559
1560 for(iter = &obj->props[id + 1]; iter < obj->props + obj->prop_cnt; iter++) {
1561 if(!iter->name || iter->type == PROP_DELETED)
1562 continue;
1563 if(own_only && iter->type == PROP_PROTREF)
1564 continue;
1565 if(!(get_flags(obj, iter) & PROPF_ENUMERABLE))
1566 continue;
1567 *ret = prop_to_id(obj, iter);
1568 return S_OK;
1569 }
1570
1571 return S_FALSE;
1572}
static HRESULT fill_protrefs(jsdisp_t *This)
Definition: dispex.c:561
DWORD get_flags
Definition: misc.c:1720
#define S_FALSE
Definition: winerror.h:2357

Referenced by DispatchEx_GetNextDispID(), and jsdisp_define_properties().

◆ jsdisp_propget()

HRESULT jsdisp_propget ( jsdisp_t jsdisp,
DISPID  id,
jsval_t val 
)

Definition at line 1447 of file dispex.c.

1448{
1449 dispex_prop_t *prop;
1450
1451 prop = get_prop(jsdisp, id);
1452 if(!prop)
1453 return DISP_E_MEMBERNOTFOUND;
1454
1455 return prop_get(jsdisp, prop, val);
1456}

Referenced by Array_unshift(), disp_propget(), jsdisp_define_properties(), stringify_object(), and to_property_descriptor().

◆ jsdisp_propget_name()

HRESULT jsdisp_propget_name ( jsdisp_t ,
LPCWSTR  ,
jsval_t  
)

◆ jsdisp_propput()

HRESULT jsdisp_propput ( jsdisp_t obj,
const WCHAR name,
DWORD  flags,
jsval_t  val 
)

Definition at line 1332 of file dispex.c.

1333{
1334 dispex_prop_t *prop;
1335 HRESULT hres;
1336
1337 hres = ensure_prop_name(obj, name, flags, &prop);
1338 if(FAILED(hres))
1339 return hres;
1340
1341 return prop_put(obj, prop, val);
1342}

Referenced by jsdisp_propput_name(), and setup_arguments_object().

◆ jsdisp_propput_idx()

HRESULT jsdisp_propput_idx ( jsdisp_t obj,
DWORD  idx,
jsval_t  val 
)

Definition at line 1349 of file dispex.c.

1350{
1351 WCHAR buf[12];
1352
1353 static const WCHAR formatW[] = {'%','d',0};
1354
1355 swprintf(buf, formatW, idx);
1356 return jsdisp_propput_name(obj, buf, val);
1357}
HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val)
Definition: dispex.c:1344

Referenced by Array_concat(), Array_map(), Array_push(), Array_reverse(), Array_shift(), Array_slice(), Array_sort(), Array_splice(), Array_unshift(), ArrayConstr_value(), concat_array(), concat_obj(), create_match_array(), interp_carray_set(), parse_json_value(), regexp_string_match(), String_split(), and VBArray_toArray().

◆ jsdisp_propput_name()

HRESULT jsdisp_propput_name ( jsdisp_t obj,
const WCHAR name,
jsval_t  val 
)

◆ jsdisp_release()

static void jsdisp_release ( jsdisp_t jsdisp)
inlinestatic

Definition at line