ReactOS  0.4.14-dev-57-g333b8f1
jscript.h File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "dispex.h"
#include "activscp.h"
#include "resource.h"
#include "wine/unicode.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 INT32_MIN   (-2147483647-1)
 
#define INT32_MAX   (2147483647)
 
#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 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 24 of file jscript.h.

◆ DEFAULT_FUNCTION_VALUE

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

Definition at line 311 of file jscript.h.

◆ DISPATCH_JSCRIPT_CALLEREXECSSOURCE

#define DISPATCH_JSCRIPT_CALLEREXECSSOURCE   0x8000

Definition at line 112 of file jscript.h.

◆ DISPATCH_JSCRIPT_INTERNAL_MASK

#define DISPATCH_JSCRIPT_INTERNAL_MASK   DISPATCH_JSCRIPT_CALLEREXECSSOURCE

Definition at line 113 of file jscript.h.

◆ FACILITY_JSCRIPT

#define FACILITY_JSCRIPT   10

Definition at line 528 of file jscript.h.

◆ INT32_MAX

#define INT32_MAX   (2147483647)

Definition at line 515 of file jscript.h.

◆ INT32_MIN

#define INT32_MIN   (-2147483647-1)

Definition at line 511 of file jscript.h.

◆ JS_E_ARRAY_EXPECTED

#define JS_E_ARRAY_EXPECTED   MAKE_JSERROR(IDS_ARRAY_EXPECTED)

Definition at line 573 of file jscript.h.

◆ JS_E_BOOLEAN_EXPECTED

#define JS_E_BOOLEAN_EXPECTED   MAKE_JSERROR(IDS_NOT_BOOL)

Definition at line 562 of file jscript.h.

◆ JS_E_CANNOT_CREATE_OBJ

#define JS_E_CANNOT_CREATE_OBJ   MAKE_JSERROR(IDS_CREATE_OBJ_ERROR)

Definition at line 536 of file jscript.h.

◆ JS_E_DATE_EXPECTED

#define JS_E_DATE_EXPECTED   MAKE_JSERROR(IDS_NOT_DATE)

Definition at line 557 of file jscript.h.

◆ JS_E_DISABLED_CC

#define JS_E_DISABLED_CC   MAKE_JSERROR(IDS_DISABLED_CC)

Definition at line 554 of file jscript.h.

◆ JS_E_ENUMERATOR_EXPECTED

#define JS_E_ENUMERATOR_EXPECTED   MAKE_JSERROR(IDS_NOT_ENUMERATOR)

Definition at line 566 of file jscript.h.

◆ JS_E_EXPECTED_ASSIGN

#define JS_E_EXPECTED_ASSIGN   MAKE_JSERROR(IDS_EXPECTED_ASSIGN)

Definition at line 545 of file jscript.h.

◆ JS_E_EXPECTED_AT

#define JS_E_EXPECTED_AT   MAKE_JSERROR(IDS_EXPECTED_AT)

Definition at line 555 of file jscript.h.

◆ JS_E_EXPECTED_CCEND

#define JS_E_EXPECTED_CCEND   MAKE_JSERROR(IDS_EXPECTED_CCEND)

Definition at line 553 of file jscript.h.

◆ JS_E_EXPECTED_IDENTIFIER

#define JS_E_EXPECTED_IDENTIFIER   MAKE_JSERROR(IDS_EXPECTED_IDENTIFIER)

Definition at line 544 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 570 of file jscript.h.

◆ JS_E_FUNCTION_EXPECTED

#define JS_E_FUNCTION_EXPECTED   MAKE_JSERROR(IDS_NOT_FUNC)

Definition at line 556 of file jscript.h.

◆ JS_E_ILLEGAL_ASSIGN

#define JS_E_ILLEGAL_ASSIGN   MAKE_JSERROR(IDS_ILLEGAL_ASSIGN)

Definition at line 560 of file jscript.h.

◆ JS_E_INVALID_ACTION

#define JS_E_INVALID_ACTION   MAKE_JSERROR(IDS_UNSUPPORTED_ACTION)

Definition at line 538 of file jscript.h.

◆ JS_E_INVALID_BREAK

#define JS_E_INVALID_BREAK   MAKE_JSERROR(IDS_INVALID_BREAK)

Definition at line 549 of file jscript.h.

◆ JS_E_INVALID_CHAR

#define JS_E_INVALID_CHAR   MAKE_JSERROR(IDS_INVALID_CHAR)

Definition at line 546 of file jscript.h.

◆ JS_E_INVALID_CONTINUE

#define JS_E_INVALID_CONTINUE   MAKE_JSERROR(IDS_INVALID_CONTINUE)

Definition at line 550 of file jscript.h.

◆ JS_E_INVALID_DELETE

#define JS_E_INVALID_DELETE   MAKE_JSERROR(IDS_INVALID_DELETE)

Definition at line 564 of file jscript.h.

◆ JS_E_INVALID_LENGTH

#define JS_E_INVALID_LENGTH   MAKE_JSERROR(IDS_INVALID_LENGTH)

Definition at line 572 of file jscript.h.

◆ JS_E_INVALID_PROPERTY

#define JS_E_INVALID_PROPERTY   MAKE_JSERROR(IDS_NO_PROPERTY)

Definition at line 537 of file jscript.h.

◆ JS_E_INVALID_URI_CHAR

#define JS_E_INVALID_URI_CHAR   MAKE_JSERROR(IDS_URI_INVALID_CHAR)

Definition at line 569 of file jscript.h.

◆ JS_E_INVALID_URI_CODING

#define JS_E_INVALID_URI_CODING   MAKE_JSERROR(IDS_URI_INVALID_CODING)

Definition at line 568 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 577 of file jscript.h.

◆ JS_E_INVALIDARG

#define JS_E_INVALIDARG   MAKE_JSERROR(IDS_INVALID_CALL_ARG)

Definition at line 533 of file jscript.h.

◆ JS_E_JSCRIPT_EXPECTED

#define JS_E_JSCRIPT_EXPECTED   MAKE_JSERROR(IDS_JSCRIPT_EXPECTED)

Definition at line 565 of file jscript.h.

◆ JS_E_LABEL_NOT_FOUND

#define JS_E_LABEL_NOT_FOUND   MAKE_JSERROR(IDS_LABEL_NOT_FOUND)

Definition at line 552 of file jscript.h.

◆ JS_E_LABEL_REDEFINED

#define JS_E_LABEL_REDEFINED   MAKE_JSERROR(IDS_LABEL_REDEFINED)

Definition at line 551 of file jscript.h.

◆ JS_E_MISPLACED_RETURN

#define JS_E_MISPLACED_RETURN   MAKE_JSERROR(IDS_MISPLACED_RETURN)

Definition at line 548 of file jscript.h.

◆ JS_E_MISSING_ARG

#define JS_E_MISSING_ARG   MAKE_JSERROR(IDS_ARG_NOT_OPT)

Definition at line 539 of file jscript.h.

◆ JS_E_MISSING_LBRACKET

#define JS_E_MISSING_LBRACKET   MAKE_JSERROR(IDS_LBRACKET)

Definition at line 542 of file jscript.h.

◆ JS_E_MISSING_RBRACKET

#define JS_E_MISSING_RBRACKET   MAKE_JSERROR(IDS_RBRACKET)

Definition at line 543 of file jscript.h.

◆ JS_E_MISSING_SEMICOLON

#define JS_E_MISSING_SEMICOLON   MAKE_JSERROR(IDS_SEMICOLON)

Definition at line 541 of file jscript.h.

◆ JS_E_NONCONFIGURABLE_REDEFINED

#define JS_E_NONCONFIGURABLE_REDEFINED   MAKE_JSERROR(IDS_NONCONFIGURABLE_REDEFINED)

Definition at line 574 of file jscript.h.

◆ JS_E_NONWRITABLE_MODIFIED

#define JS_E_NONWRITABLE_MODIFIED   MAKE_JSERROR(IDS_NONWRITABLE_MODIFIED)

Definition at line 575 of file jscript.h.

◆ JS_E_NUMBER_EXPECTED

#define JS_E_NUMBER_EXPECTED   MAKE_JSERROR(IDS_NOT_NUM)

Definition at line 558 of file jscript.h.

◆ JS_E_OBJECT_EXPECTED

#define JS_E_OBJECT_EXPECTED   MAKE_JSERROR(IDS_OBJECT_EXPECTED)

Definition at line 559 of file jscript.h.

◆ JS_E_OBJECT_REQUIRED

#define JS_E_OBJECT_REQUIRED   MAKE_JSERROR(IDS_OBJECT_REQUIRED)

Definition at line 535 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 571 of file jscript.h.

◆ JS_E_PROP_DESC_MISMATCH

#define JS_E_PROP_DESC_MISMATCH   MAKE_JSERROR(IDS_PROP_DESC_MISMATCH)

Definition at line 576 of file jscript.h.

◆ JS_E_REGEXP_SYNTAX

#define JS_E_REGEXP_SYNTAX   MAKE_JSERROR(IDS_REGEXP_SYNTAX_ERROR)

Definition at line 567 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 534 of file jscript.h.

◆ JS_E_SYNTAX

#define JS_E_SYNTAX   MAKE_JSERROR(IDS_SYNTAX_ERROR)

Definition at line 540 of file jscript.h.

◆ JS_E_TO_PRIMITIVE

#define JS_E_TO_PRIMITIVE   MAKE_JSERROR(IDS_TO_PRIMITIVE)

Definition at line 532 of file jscript.h.

◆ JS_E_UNDEFINED_VARIABLE

#define JS_E_UNDEFINED_VARIABLE   MAKE_JSERROR(IDS_UNDEFINED)

Definition at line 561 of file jscript.h.

◆ JS_E_UNTERMINATED_STRING

#define JS_E_UNTERMINATED_STRING   MAKE_JSERROR(IDS_UNTERMINATED_STR)

Definition at line 547 of file jscript.h.

◆ JS_E_VBARRAY_EXPECTED

#define JS_E_VBARRAY_EXPECTED   MAKE_JSERROR(IDS_NOT_VBARRAY)

Definition at line 563 of file jscript.h.

◆ MAKE_JSERROR

Definition at line 530 of file jscript.h.

◆ PROPF_ALL

Definition at line 100 of file jscript.h.

◆ PROPF_ARGMASK

#define PROPF_ARGMASK   0x00ff

Definition at line 93 of file jscript.h.

◆ PROPF_CONFIGURABLE

#define PROPF_CONFIGURABLE   0x1000

Definition at line 99 of file jscript.h.

◆ PROPF_CONSTR

#define PROPF_CONSTR   0x0200

Definition at line 95 of file jscript.h.

◆ PROPF_ENUMERABLE

#define PROPF_ENUMERABLE   0x0400

Definition at line 97 of file jscript.h.

◆ PROPF_ES5

◆ PROPF_HTML

Definition at line 104 of file jscript.h.

◆ PROPF_METHOD

#define PROPF_METHOD   0x0100

Definition at line 94 of file jscript.h.

◆ PROPF_VERSION_MASK

#define PROPF_VERSION_MASK   0x01ff0000

Definition at line 102 of file jscript.h.

◆ PROPF_VERSION_SHIFT

#define PROPF_VERSION_SHIFT   16

Definition at line 103 of file jscript.h.

◆ PROPF_WRITABLE

#define PROPF_WRITABLE   0x0800

Definition at line 98 of file jscript.h.

◆ REM_ALLOC_RESULT

#define REM_ALLOC_RESULT   0x0008

Definition at line 488 of file jscript.h.

◆ REM_CHECK_GLOBAL

#define REM_CHECK_GLOBAL   0x0001

Definition at line 485 of file jscript.h.

◆ REM_NO_CTX_UPDATE

#define REM_NO_CTX_UPDATE   0x0004

Definition at line 487 of file jscript.h.

◆ REM_NO_PARENS

#define REM_NO_PARENS   0x0010

Definition at line 489 of file jscript.h.

◆ REM_RESET_INDEX

#define REM_RESET_INDEX   0x0002

Definition at line 486 of file jscript.h.

◆ SCRIPTLANGUAGEVERSION_ES5

#define SCRIPTLANGUAGEVERSION_ES5   0x102

Definition at line 49 of file jscript.h.

◆ SCRIPTLANGUAGEVERSION_HTML

#define SCRIPTLANGUAGEVERSION_HTML   0x400

Definition at line 44 of file jscript.h.

◆ VDISP_DISPEX

#define VDISP_DISPEX   0x0001

Definition at line 146 of file jscript.h.

◆ VDISP_JSDISP

#define VDISP_JSDISP   0x0002

Definition at line 147 of file jscript.h.

Typedef Documentation

◆ builtin_getter_t

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

Definition at line 202 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 201 of file jscript.h.

◆ builtin_setter_t

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

Definition at line 203 of file jscript.h.

◆ cc_var_t

Definition at line 366 of file jscript.h.

◆ dispex_prop_t

Definition at line 54 of file jscript.h.

◆ jsdisp_t

Definition at line 89 of file jscript.h.

◆ jsstr_t

Definition at line 52 of file jscript.h.

◆ jsval_t

Definition at line 51 of file jscript.h.

◆ named_item_t

◆ property_desc_t

Definition at line 55 of file jscript.h.

◆ script_ctx_t

Definition at line 53 of file jscript.h.

Enumeration Type Documentation

◆ hint_t

Enumerator
NO_HINT 
HINT_STRING 
HINT_NUMBER 

Definition at line 333 of file jscript.h.

333  {
334  NO_HINT,
335  HINT_STRING,
337 } hint_t;
hint_t
Definition: jscript.h:333

◆ 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 116 of file jscript.h.

Function Documentation

◆ array_get_length()

unsigned array_get_length ( jsdisp_t )

Definition at line 70 of file array.c.

71 {
74 }
#define assert(x)
Definition: debug.h:53
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
Definition: jscript.h:500
static ArrayInstance * array_from_jsdisp(jsdisp_t *jsdisp)
Definition: array.c:55
DWORD length
Definition: array.c:34

Referenced by stringify_array().

◆ as_jsdisp()

jsdisp_t* as_jsdisp ( IDispatch )

Definition at line 929 of file dispex.c.

930 {
931  assert(disp->lpVtbl == (IDispatchVtbl*)&DispatchExVtbl);
932  return impl_from_IDispatchEx((IDispatchEx*)disp);
933 }
disp
Definition: i386-dis.c:3181
static IDispatchExVtbl DispatchExVtbl
Definition: dispex.c:911
#define assert(x)
Definition: debug.h:53
static jsdisp_t * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:594

Referenced by interp_obj_prop().

◆ bool_obj_value()

BOOL bool_obj_value ( jsdisp_t )

Definition at line 52 of file bool.c.

53 {
55  return bool_from_jsdisp(obj)->val;
56 }
#define assert(x)
Definition: debug.h:53
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
Definition: jscript.h:500
BOOL val
Definition: bool.c:31
static BoolInstance * bool_from_jsdisp(jsdisp_t *jsdisp)
Definition: bool.c:37

Referenced by maybe_to_primitive().

◆ builtin_set_const()

HRESULT builtin_set_const ( script_ctx_t ,
jsdisp_t ,
jsval_t   
)

Definition at line 556 of file dispex.c.

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

◆ clear_ei()

void clear_ei ( script_ctx_t )

Definition at line 428 of file engine.c.

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

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

◆ create_activex_constr()

HRESULT create_activex_constr ( script_ctx_t ,
jsdisp_t **   
)

Definition at line 190 of file activex.c.

191 {
192  jsdisp_t *prototype;
193  HRESULT hres;
194 
195  static const WCHAR ActiveXObjectW[] = {'A','c','t','i','v','e','X','O','b','j','e','c','t',0};
196 
197  hres = create_object(ctx, NULL, &prototype);
198  if(FAILED(hres))
199  return hres;
200 
202  PROPF_CONSTR|1, prototype, ret);
203 
204  jsdisp_release(prototype);
205  return hres;
206 }
static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: activex.c:143
#define PROPF_CONSTR
Definition: jscript.h:95
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
static const WCHAR ActiveXObjectW[]
Definition: global.c:50
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
HRESULT create_object(script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: object.c:597
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:644

Referenced by init_global().

◆ create_array()

HRESULT create_array ( script_ctx_t ,
DWORD  ,
jsdisp_t **   
)

Definition at line 1310 of file array.c.

1311 {
1313  HRESULT hres;
1314 
1315  hres = alloc_array(ctx, NULL, &array);
1316  if(FAILED(hres))
1317  return hres;
1318 
1319  array->length = length;
1320 
1321  *ret = &array->dispex;
1322  return S_OK;
1323 }
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
int ret
static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayInstance **ret)
Definition: array.c:1255
#define S_OK
Definition: intsafe.h:59
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 GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum GLdouble GLenum GLint GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLenum GLfloat GLenum GLfloat GLenum GLushort const GLubyte GLenum GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLvoid GLenum GLenum GLint GLenum GLint GLenum GLint GLuint GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble const GLfloat GLenum const GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLint GLint GLsizei GLsizei GLenum GLuint GLenum array
Definition: glfuncs.h:320

Referenced by Array_concat(), 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 ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 1293 of file array.c.

1294 {
1296  HRESULT hres;
1297 
1298  static const WCHAR ArrayW[] = {'A','r','r','a','y',0};
1299 
1300  hres = alloc_array(ctx, object_prototype, &array);
1301  if(FAILED(hres))
1302  return hres;
1303 
1305 
1306  jsdisp_release(&array->dispex);
1307  return hres;
1308 }
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
static const builtin_info_t ArrayConstr_info
Definition: array.c:1284
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: array.c:1204
static const WCHAR ArrayW[]
Definition: global.c:34
int ret
static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayInstance **ret)
Definition: array.c:1255
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
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 GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum GLdouble GLenum GLint GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLenum GLfloat GLenum GLfloat GLenum GLushort const GLubyte GLenum GLenum GLenum GLint GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLvoid GLenum GLenum GLint GLenum GLint GLenum GLint GLuint GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble const GLfloat GLenum const GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble GLint GLint GLsizei GLsizei GLenum GLuint GLenum array
Definition: glfuncs.h:320

Referenced by init_constructors().

◆ create_ax_site()

IUnknown* create_ax_site ( script_ctx_t )

Definition at line 324 of file jscript.c.

325 {
327  AXSite *ret;
328  HRESULT hres;
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 IServiceProviderVtbl AXSiteVtbl
Definition: jscript.c:317
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
static const WCHAR sp[]
Definition: suminfo.c:288

◆ create_bool()

HRESULT create_bool ( script_ctx_t ,
BOOL  ,
jsdisp_t **   
)

Definition at line 216 of file bool.c.

217 {
219  HRESULT hres;
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
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
typedef bool(CARDLIBPROC *pCanDragProc)(CardRegion &stackobj
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
#define S_OK
Definition: intsafe.h:59

Referenced by BoolConstr_value(), and to_object().

◆ create_bool_constr()

HRESULT create_bool_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 198 of file bool.c.

199 {
201  HRESULT hres;
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 }
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
static const WCHAR BooleanW[]
Definition: global.c:35
static HRESULT alloc_bool(script_ctx_t *ctx, jsdisp_t *object_prototype, BoolInstance **ret)
Definition: bool.c:175
smooth NULL
Definition: ftsmooth.c:416
typedef bool(CARDLIBPROC *pCanDragProc)(CardRegion &stackobj
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
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 void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265

Referenced by init_constructors().

◆ create_builtin_constructor()

HRESULT create_builtin_constructor ( script_ctx_t ,
builtin_invoke_t  ,
const WCHAR ,
const builtin_info_t ,
DWORD  ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 679 of file function.c.

681 {
682  jsdisp_t *constr;
683  HRESULT hres;
684 
685  hres = create_builtin_function(ctx, value_proc, name, builtin_info, flags, prototype, &constr);
686  if(FAILED(hres))
687  return hres;
688 
689  hres = set_constructor_prop(ctx, constr, prototype);
690  if(FAILED(hres)) {
691  jsdisp_release(constr);
692  return hres;
693  }
694 
695  *ret = constr;
696  return S_OK;
697 }
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t *prot)
Definition: function.c:671
int ret
#define S_OK
Definition: intsafe.h:59
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
Definition: name.c:36
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:644

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 ,
builtin_invoke_t  ,
const WCHAR ,
const builtin_info_t ,
DWORD  ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 644 of file function.c.

646 {
647  FunctionInstance *function;
648  HRESULT hres;
649 
650  hres = create_function(ctx, builtin_info, flags, FALSE, NULL, &function);
651  if(FAILED(hres))
652  return hres;
653 
654  if(builtin_info)
655  hres = jsdisp_define_data_property(&function->dispex, lengthW, 0,
656  jsval_number(function->length));
657  if(SUCCEEDED(hres))
658  hres = jsdisp_define_data_property(&function->dispex, prototypeW, 0, jsval_obj(prototype));
659  if(FAILED(hres)) {
660  jsdisp_release(&function->dispex);
661  return hres;
662  }
663 
664  function->value_proc = value_proc;
665  function->name = name;
666 
667  *ret = &function->dispex;
668  return S_OK;
669 }
static const WCHAR lengthW[]
Definition: function.c:69
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1794
static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_info, DWORD flags, BOOL funcprot, jsdisp_t *prototype, FunctionInstance **ret)
Definition: function.c:616
static const WCHAR prototypeW[]
Definition: function.c:67
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
int ret
#define S_OK
Definition: intsafe.h:59
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static jsval_t jsval_number(double n)
Definition: jsval.h:144
GLuint const GLchar * name
Definition: glext.h:6031

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

◆ create_date_constr()

HRESULT create_date_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 2531 of file date.c.

2532 {
2533  jsdisp_t *date;
2534  HRESULT hres;
2535 
2536  static const WCHAR DateW[] = {'D','a','t','e',0};
2537 
2538  hres = create_date(ctx, object_prototype, 0.0, &date);
2539  if(FAILED(hres))
2540  return hres;
2541 
2543  PROPF_CONSTR|7, date, ret);
2544 
2546  return hres;
2547 }
static const WCHAR DateW[]
Definition: global.c:36
static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE time, jsdisp_t **ret)
Definition: date.c:2000
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
static const builtin_info_t DateConstr_info
Definition: date.c:2522
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: date.c:2433
int ret
__u16 date
Definition: mkdosfs.c:366
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265

Referenced by init_constructors().

◆ create_dispex()

HRESULT create_dispex ( script_ctx_t ,
const builtin_info_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 978 of file dispex.c.

979 {
980  jsdisp_t *ret;
981  HRESULT hres;
982 
983  ret = heap_alloc_zero(sizeof(jsdisp_t));
984  if(!ret)
985  return E_OUTOFMEMORY;
986 
987  hres = init_dispex(ret, ctx, builtin_info ? builtin_info : &dispex_info, prototype);
988  if(FAILED(hres)) {
989  heap_free(ret);
990  return hres;
991  }
992 
993  *dispex = ret;
994  return S_OK;
995 }
static const builtin_info_t dispex_info
Definition: dispex.c:970
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
#define S_OK
Definition: intsafe.h:59
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:940
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by create_object_prototype(), init_global(), interp_enter_catch(), and invoke_source().

◆ create_enumerator_constr()

HRESULT create_enumerator_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 332 of file enumerator.c.

333 {
334  EnumeratorInstance *enumerator;
335  HRESULT hres;
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 }
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
static const WCHAR EnumeratorW[]
Definition: global.c:52
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT alloc_enumerator(script_ctx_t *ctx, jsdisp_t *object_prototype, EnumeratorInstance **ret)
Definition: enumerator.c:204
LONG HRESULT
Definition: typedefs.h:77
int ret
static const builtin_info_t EnumeratorConstr_info
Definition: enumerator.c:323
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 void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265

Referenced by init_constructors().

◆ create_jscaller()

HRESULT create_jscaller ( script_ctx_t )

Definition at line 1031 of file jsutils.c.

1032 {
1033  JSCaller *ret;
1034 
1035  ret = heap_alloc(sizeof(*ret));
1036  if(!ret)
1037  return E_OUTOFMEMORY;
1038 
1039  ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
1040  ret->ref = 1;
1041  ret->ctx = ctx;
1042 
1043  ctx->jscaller = ret;
1044  return S_OK;
1045 }
static const IServiceProviderVtbl ServiceProviderVtbl
Definition: jsutils.c:1024
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
int ret
#define S_OK
Definition: intsafe.h:59

Referenced by JScriptParse_InitNew().

◆ create_jscript_object()

HRESULT create_jscript_object ( BOOL  ,
REFIID  ,
void **   
)

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 IObjectSafetyVtbl JScriptSafetyVtbl
Definition: jscript.c:1007
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const IActiveScriptParseProcedure2Vtbl JScriptParseProcedureVtbl
Definition: jscript.c:877
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IVariantChangeTypeVtbl VariantChangeTypeVtbl
Definition: jscript.c:1065
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static const IActiveScriptParseVtbl JScriptParseVtbl
Definition: jscript.c:813
static const IActiveScriptPropertyVtbl JScriptPropertyVtbl
Definition: jscript.c:944
int ret
static void lock_module(void)
Definition: ieframe.h:335
static const IActiveScriptVtbl JScriptVtbl
Definition: jscript.c:655

Referenced by JScriptEncodeFactory_CreateInstance(), and JScriptFactory_CreateInstance().

◆ create_json()

HRESULT create_json ( script_ctx_t ,
jsdisp_t **   
)

Definition at line 845 of file json.c.

846 {
847  jsdisp_t *json;
848  HRESULT hres;
849 
850  json = heap_alloc_zero(sizeof(*json));
851  if(!json)
852  return E_OUTOFMEMORY;
853 
854  hres = init_dispex_from_constr(json, ctx, &JSON_info, ctx->object_constr);
855  if(FAILED(hres)) {
856  heap_free(json);
857  return hres;
858  }
859 
860  *ret = json;
861  return S_OK;
862 }
static const builtin_info_t JSON_info
Definition: json.c:836
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
#define S_OK
Definition: intsafe.h:59
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:1051
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by init_global().

◆ create_math()

HRESULT create_math ( script_ctx_t ,
jsdisp_t **   
)

Definition at line 531 of file math.c.

532 {
533  jsdisp_t *math;
534  unsigned i;
535  HRESULT hres;
536 
537  struct {
538  const WCHAR *name;
539  DOUBLE val;
540  }constants[] = {
541  {EW, M_E}, /* ECMA-262 3rd Edition 15.8.1.1 */
542  {LN10W, M_LN10}, /* ECMA-262 3rd Edition 15.8.1.2 */
543  {LN2W, M_LN2}, /* ECMA-262 3rd Edition 15.8.1.3 */
544  {LOG2EW, M_LOG2E}, /* ECMA-262 3rd Edition 15.8.1.4 */
545  {LOG10EW, M_LOG10E}, /* ECMA-262 3rd Edition 15.8.1.5 */
546  {PIW, M_PI}, /* ECMA-262 3rd Edition 15.8.1.6 */
547  {SQRT1_2W, M_SQRT1_2}, /* ECMA-262 3rd Edition 15.8.1.7 */
548  {SQRT2W, M_SQRT2}, /* ECMA-262 3rd Edition 15.8.1.8 */
549  };
550 
551  math = heap_alloc_zero(sizeof(jsdisp_t));
552  if(!math)
553  return E_OUTOFMEMORY;
554 
555  hres = init_dispex_from_constr(math, ctx, &Math_info, ctx->object_constr);
556  if(FAILED(hres)) {
557  heap_free(math);
558  return hres;
559  }
560 
561  for(i=0; i < ARRAY_SIZE(constants); i++) {
564  if(FAILED(hres)) {
565  jsdisp_release(math);
566  return hres;
567  }
568  }
569 
570  *ret = math;
571  return S_OK;
572 }
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1794
static const WCHAR SQRT1_2W[]
Definition: math.c:40
static const WCHAR PIW[]
Definition: math.c:38
static const WCHAR SQRT2W[]
Definition: math.c:39
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
#define M_SQRT2
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLuint GLfloat * val
Definition: glext.h:7180
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
static const WCHAR LN2W[]
Definition: math.c:36
static const WCHAR LOG10EW[]
Definition: math.c:35
static const WCHAR LOG2EW[]
Definition: math.c:34
#define S_OK
Definition: intsafe.h:59
static const builtin_info_t Math_info
Definition: math.c:522
#define ARRAY_SIZE(a)
Definition: main.h:24
constants
Definition: resource.c:29
static const WCHAR EW[]
Definition: math.c:33
#define M_PI
Definition: macros.h:263
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
static const WCHAR LN10W[]
Definition: math.c:37
Definition: name.c:36
double DOUBLE
Definition: typedefs.h:68
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:1051
static jsval_t jsval_number(double n)
Definition: jsval.h:144
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by init_global().

◆ create_number()

HRESULT create_number ( script_ctx_t ,
double  ,
jsdisp_t **   
)

Definition at line 632 of file number.c.

633 {
635  HRESULT hres;
636 
637  hres = alloc_number(ctx, NULL, &number);
638  if(FAILED(hres))
639  return hres;
640 
641  number->value = value;
642 
643  *ret = &number->dispex;
644  return S_OK;
645 }
static size_t double number
Definition: printf.c:64
smooth NULL
Definition: ftsmooth.c:416
static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, NumberInstance **ret)
Definition: number.c:591
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
GLsizei const GLfloat * value
Definition: glext.h:6069
#define S_OK
Definition: intsafe.h:59

Referenced by NumberConstr_value(), and to_object().

◆ create_number_constr()

HRESULT create_number_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 613 of file number.c.

614 {
616  HRESULT hres;
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:45
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
static size_t double number
Definition: printf.c:64
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
smooth NULL
Definition: ftsmooth.c:416
static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, NumberInstance **ret)
Definition: number.c:591
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265

Referenced by init_constructors().

◆ create_object()

HRESULT create_object ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 597 of file object.c.

598 {
599  jsdisp_t *object;
600  HRESULT hres;
601 
602  object = heap_alloc_zero(sizeof(jsdisp_t));
603  if(!object)
604  return E_OUTOFMEMORY;
605 
606  hres = init_dispex_from_constr(object, ctx, &ObjectInst_info, constr ? constr : ctx->object_constr);
607  if(FAILED(hres)) {
608  heap_free(object);
609  return hres;
610  }
611 
612  *ret = object;
613  return S_OK;
614 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
#define S_OK
Definition: intsafe.h:59
static const builtin_info_t ObjectInst_info
Definition: object.c:261
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:1051
void * object
Definition: jmemsys.h:48
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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

◆ create_object_constr()

HRESULT create_object_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 584 of file object.c.

585 {
586  static const WCHAR ObjectW[] = {'O','b','j','e','c','t',0};
587 
589  object_prototype, ret);
590 }
static const WCHAR ObjectW[]
Definition: global.c:46
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const builtin_info_t ObjectConstr_info
Definition: object.c:528
int ret
static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:537

Referenced by init_constructors().

◆ create_object_prototype()

HRESULT create_object_prototype ( script_ctx_t ,
jsdisp_t **   
)

Definition at line 592 of file object.c.

593 {
594  return create_dispex(ctx, &Object_info, NULL, ret);
595 }
smooth NULL
Definition: ftsmooth.c:416
int ret
HRESULT create_dispex(script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype, jsdisp_t **dispex)
Definition: dispex.c:978
static const builtin_info_t Object_info
Definition: object.c:252

Referenced by init_global().

◆ create_regexp()

HRESULT create_regexp ( script_ctx_t ,
jsstr_t ,
DWORD  ,
jsdisp_t **   
)

Definition at line 644 of file jsregexp.c.

645 {
646  RegExpInstance *regexp;
647  const WCHAR *str;
648  HRESULT hres;
649 
650  TRACE("%s %x\n", debugstr_jsstr(src), flags);
651 
652  str = jsstr_flatten(src);
653  if(!str)
654  return E_OUTOFMEMORY;
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 }
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
jsdisp_t dispex
Definition: jsregexp.c:29
static jsstr_t * jsstr_addref(jsstr_t *str)
Definition: jsstr.h:116
jsval_t last_index_val
Definition: jsregexp.c:34
#define WARN(fmt,...)
Definition: debug.h:111
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
regexp_t * regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str, DWORD str_len, WORD flags, BOOL flat)
Definition: regexp.c:3195
#define TRACE(s)
Definition: solgame.cpp:4
const char * debugstr_jsstr(jsstr_t *str)
Definition: jsstr.c:37
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum src
Definition: glext.h:6340
static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegExpInstance **ret)
Definition: jsregexp.c:621
regexp_t * jsregexp
Definition: jsregexp.c:31
#define S_OK
Definition: intsafe.h:59
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
jsstr_t * str
Definition: jsregexp.c:32
static jsval_t jsval_number(double n)
Definition: jsval.h:144

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

◆ create_regexp_constr()

HRESULT create_regexp_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

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 }
jsdisp_t dispex
Definition: jsregexp.c:29
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
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
static const builtin_info_t RegExpConstr_info
Definition: jsregexp.c:995
static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegExpInstance **ret)
Definition: jsregexp.c:621
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
static const WCHAR RegExpW[]
Definition: global.c:48

Referenced by init_constructors().

◆ create_regexp_var()

HRESULT create_regexp_var ( script_ctx_t ,
jsval_t  ,
jsval_t ,
jsdisp_t **   
)

Definition at line 674 of file jsregexp.c.

675 {
676  unsigned flags, opt_len = 0;
677  const WCHAR *opt = NULL;
678  jsstr_t *src;
679  HRESULT hres;
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) {
686  if(is_class(obj, JSCLASS_REGEXP)) {
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 }
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
Definition: jsstr.h:39
static IDispatch * get_object(jsval_t v)
Definition: jsval.h:219
WORD flags
Definition: regexp.h:57
static BOOL is_string(parse_buffer *buf)
Definition: parsing.c:601
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
HRESULT create_regexp(script_ctx_t *ctx, jsstr_t *src, DWORD flags, jsdisp_t **ret)
Definition: jsregexp.c:644
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
Definition: jscript.h:500
static jsstr_t * get_string(jsval_t v)
Definition: jsval.h:229
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static BOOL is_object_instance(jsval_t v)
Definition: jsval.h:166
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static RegExpInstance * regexp_from_jsdisp(jsdisp_t *jsdisp)
Definition: jsregexp.c:61
GLbitfield flags
Definition: glext.h:7161
int ret
HRESULT parse_regexp_flags(const WCHAR *str, DWORD str_len, DWORD *ret)
Definition: jsregexp.c:1022
GLenum src
Definition: glext.h:6340
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1081
regexp_t * jsregexp
Definition: jsregexp.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
jsstr_t * str
Definition: jsregexp.c:32
const char * debugstr_jsval(const jsval_t) DECLSPEC_HIDDEN
Definition: jsutils.c:33

Referenced by RegExpConstr_value(), and String_search().

◆ create_string()

HRESULT create_string ( script_ctx_t ,
jsstr_t ,
jsdisp_t **   
)

Definition at line 1768 of file string.c.

1769 {
1771  HRESULT hres;
1772 
1773  hres = string_alloc(ctx, NULL, str, &string);
1774  if(FAILED(hres))
1775  return hres;
1776 
1777  *ret = &string->dispex;
1778  return S_OK;
1779 
1780 }
const char * string
Definition: string.c:1522
static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr_t *str, StringInstance **ret)
Definition: string.c:1714
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
#define S_OK
Definition: intsafe.h:59

Referenced by StringConstr_value(), and to_object().

◆ create_string_constr()

HRESULT create_string_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 1750 of file string.c.

1751 {
1753  HRESULT hres;
1754 
1755  static const WCHAR StringW[] = {'S','t','r','i','n','g',0};
1756 
1757  hres = string_alloc(ctx, object_prototype, jsstr_empty(), &string);
1758  if(FAILED(hres))
1759  return hres;
1760 
1762  PROPF_CONSTR|1, &string->dispex, ret);
1763 
1764  jsdisp_release(&string->dispex);
1765  return hres;
1766 }
const char * string
Definition: string.c:1522
static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: string.c:1666
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr_t *str, StringInstance **ret)
Definition: string.c:1714
jsstr_t * jsstr_empty(void)
Definition: jsstr.c:288
static const builtin_info_t StringConstr_info
Definition: string.c:1741
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
static const WCHAR StringW[]
Definition: global.c:47
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265

Referenced by init_constructors().

◆ create_vbarray()

HRESULT create_vbarray ( script_ctx_t ,
SAFEARRAY ,
jsdisp_t **   
)

Definition at line 347 of file vbarray.c.

348 {
349  VBArrayInstance *vbarray;
350  HRESULT hres;
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 }
SAFEARRAY * safearray
Definition: vbarray.c:28
smooth NULL
Definition: ftsmooth.c:416
static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBArrayInstance **ret)
Definition: vbarray.c:267
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut)
Definition: safearray.c:1381
int ret
#define S_OK
Definition: intsafe.h:59
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
jsdisp_t dispex
Definition: vbarray.c:26

Referenced by to_object().

◆ create_vbarray_constr()

HRESULT create_vbarray_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 330 of file vbarray.c.

331 {
332  VBArrayInstance *vbarray;
333  HRESULT hres;
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 }
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
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
smooth NULL
Definition: ftsmooth.c:416
static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBArrayInstance **ret)
Definition: vbarray.c:267
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR VBArrayW[]
Definition: global.c:51
int ret
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
jsdisp_t dispex
Definition: vbarray.c:26

Referenced by init_constructors().

◆ debugstr_jsval()

const char* debugstr_jsval ( const  jsval_t)

Definition at line 33 of file jsutils.c.

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

Referenced by Arguments_idx_put(), bind_event_target(), builtin_set_const(), create_regexp_var(), exprval_call(), 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(), print_backtrace(), prop_get(), prop_put(), to_string(), and unwind_exception().

◆ decode_source()

HRESULT decode_source ( WCHAR )

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(!strncmpW(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(strncmpW(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 }
static BOOL decode_dword(const WCHAR *p, DWORD *ret)
Definition: decode.c:89
#define JS_E_INVALID_CHAR
Definition: jscript.h:546
#define E_FAIL
Definition: ddrawi.h:102
WINE_UNICODE_INLINE int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unicode.h:235
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
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static const unsigned char pick_encoding[64]
Definition: decode.c:31
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
uint32_t * csum
Definition: write.c:2821
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
int code
Definition: i386-dis.c:3591
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
GLenum GLenum dst
Definition: glext.h:6340
Definition: fs.h:216

Referenced by compile_script().

◆ disp_call()

HRESULT disp_call ( script_ctx_t ,
IDispatch ,
DISPID  ,
WORD  ,
unsigned  ,
jsval_t ,
jsval_t  
)

Definition at line 1157 of file dispex.c.

1158 {
1159  IDispatchEx *dispex;
1160  jsdisp_t *jsdisp;
1161  VARIANT buf[6], retv;
1162  DISPPARAMS dp;
1163  unsigned i;
1164  HRESULT hres;
1165 
1166  jsdisp = iface_to_jsdisp(disp);
1167  if(jsdisp) {
1168  if(flags & DISPATCH_PROPERTYPUT) {
1169  FIXME("disp_call(propput) on builtin object\n");
1170  return E_FAIL;
1171  }
1172 
1173  if(ctx != jsdisp->ctx)
1175  hres = jsdisp_call(jsdisp, id, flags, argc, argv, ret);
1176  jsdisp_release(jsdisp);
1177  return hres;
1178  }
1179 
1181  if(ret && argc)
1183 
1184  dp.cArgs = argc;
1185 
1186  if(flags & DISPATCH_PROPERTYPUT) {
1187  static DISPID propput_dispid = DISPID_PROPERTYPUT;
1188 
1189  dp.cNamedArgs = 1;
1190  dp.rgdispidNamedArgs = &propput_dispid;
1191  }else {
1192  dp.cNamedArgs = 0;
1193  dp.rgdispidNamedArgs = NULL;
1194  }
1195 
1196  if(argc > 6) {
1197  dp.rgvarg = heap_alloc(argc*sizeof(VARIANT));
1198  if(!dp.rgvarg)
1199  return E_OUTOFMEMORY;
1200  }else {
1201  dp.rgvarg = buf;
1202  }
1203 
1204  for(i=0; i<argc; i++) {
1205  hres = jsval_to_variant(argv[i], dp.rgvarg+argc-i-1);
1206  if(FAILED(hres)) {
1207  while(i--)
1208  VariantClear(dp.rgvarg+argc-i-1);
1209  if(dp.rgvarg != buf)
1210  heap_free(dp.rgvarg);
1211  return hres;
1212  }
1213  }
1214 
1215  V_VT(&retv) = VT_EMPTY;
1216  clear_ei(ctx);
1217  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1218  if(SUCCEEDED(hres)) {
1219  hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, &dp, ret ? &retv : NULL, &ctx->ei.ei,
1220  &ctx->jscaller->IServiceProvider_iface);
1221  IDispatchEx_Release(dispex);
1222  }else {
1223  UINT err = 0;
1224 
1225  if(flags == DISPATCH_CONSTRUCT) {
1226  WARN("IDispatch cannot be constructor\n");
1227  return DISP_E_MEMBERNOTFOUND;
1228  }
1229 
1230  TRACE("using IDispatch\n");
1231  hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, &dp, ret ? &retv : NULL, &ctx->ei.ei, &err);
1232  }
1233 
1234  for(i=0; i<argc; i++)
1235  VariantClear(dp.rgvarg+argc-i-1);
1236  if(dp.rgvarg != buf)
1237  heap_free(dp.rgvarg);
1238  if(FAILED(hres))
1239  return hres;
1240 
1241  if(ret) {
1242  hres = variant_to_jsval(&retv, ret);
1243  VariantClear(&retv);
1244  }
1245 
1246  return hres;
1247 }
disp
Definition: i386-dis.c:3181
static int argc
Definition: ServiceArgs.c:12
script_ctx_t * ctx
Definition: jscript.h:235
static DISPID propput_dispid
Definition: interp.c:27
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WARN(fmt,...)
Definition: debug.h:111
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
#define argv
Definition: mplay32.c:18
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:428
#define E_FAIL
Definition: ddrawi.h:102
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
HRESULT jsdisp_call(jsdisp_t *disp, DISPID id, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: dispex.c:1134
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
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define DISPATCH_JSCRIPT_INTERNAL_MASK
Definition: jscript.h:113
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
Definition: jsutils.c:339
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
Definition: jsutils.c:256
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
int ret
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define IID_NULL
Definition: guiddef.h:98
#define V_VT(A)
Definition: oleauto.h:211
#define err(...)
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1081
static VARIANTARG static DISPID
Definition: ordinal.c:49
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
unsigned int UINT
Definition: ndis.h:50
struct stdole::DISPPARAMS DISPPARAMS
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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

◆ disp_call_value()

HRESULT disp_call_value ( script_ctx_t ,
IDispatch ,
IDispatch ,
WORD  ,
unsigned  ,
jsval_t ,
jsval_t  
)

Definition at line 1249 of file dispex.c.

1251 {
1252  jsdisp_t *jsdisp;
1253  IDispatchEx *dispex;
1254  VARIANT buf[6], retv;
1255  DISPPARAMS dp;
1256  unsigned i;
1257  HRESULT hres;
1258 
1259  assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT|DISPATCH_JSCRIPT_INTERNAL_MASK)));
1260 
1261  jsdisp = iface_to_jsdisp(disp);
1262  if(jsdisp) {
1263  if(ctx != jsdisp->ctx)
1265  hres = jsdisp_call_value(jsdisp, jsthis, flags, argc, argv, r);
1266  jsdisp_release(jsdisp);
1267  return hres;
1268  }
1269 
1271  if(r && argc && flags == DISPATCH_METHOD)
1273 
1274  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1275  if(FAILED(hres)) {
1276  TRACE("using IDispatch\n");
1277  dispex = NULL;
1278  jsthis = NULL;
1279  }
1280 
1281  if(jsthis) {
1282  static DISPID this_id = DISPID_THIS;
1283 
1284  dp.cArgs = argc+1;
1285  dp.cNamedArgs = 1;
1286  dp.rgdispidNamedArgs = &this_id;
1287  }else {
1288  dp.cArgs = argc;
1289  dp.cNamedArgs = 0;
1290  dp.rgdispidNamedArgs = NULL;
1291  }
1292 
1293  if(dp.cArgs > ARRAY_SIZE(buf)) {
1294  dp.rgvarg = heap_alloc(dp.cArgs*sizeof(VARIANT));
1295  if(!dp.rgvarg) {
1296  if(dispex)
1297  IDispatchEx_Release(dispex);
1298  return E_OUTOFMEMORY;
1299  }
1300  }else {
1301  dp.rgvarg = buf;
1302  }
1303 
1304  for(i=0; i<argc; i++) {
1305  hres = jsval_to_variant(argv[i], dp.rgvarg+dp.cArgs-i-1);
1306  if(FAILED(hres)) {
1307  while(i--)
1308  VariantClear(dp.rgvarg+dp.cArgs-i-1);
1309  if(dp.rgvarg != buf)
1310  heap_free(dp.rgvarg);
1311  if(dispex)
1312  IDispatchEx_Release(dispex);
1313  return hres;
1314  }
1315  }
1316  if(jsthis) {
1317  V_VT(dp.rgvarg) = VT_DISPATCH;
1318  V_DISPATCH(dp.rgvarg) = jsthis;
1319  }
1320 
1321  V_VT(&retv) = VT_EMPTY;
1322  clear_ei(ctx);
1323  if(dispex) {
1324  hres = IDispatchEx_InvokeEx(dispex, DISPID_VALUE, ctx->lcid, flags, &dp, r ? &retv : NULL, &ctx->ei.ei,
1325  &ctx->jscaller->IServiceProvider_iface);
1326  IDispatchEx_Release(dispex);
1327  }else {
1328  UINT err = 0;
1329 
1330  if(flags == DISPATCH_CONSTRUCT) {
1331  WARN("IDispatch cannot be constructor\n");
1332  return DISP_E_MEMBERNOTFOUND;
1333  }
1334 
1335  hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, ctx->lcid, flags, &dp, r ? &retv : NULL, &ctx->ei.ei, &err);
1336  }
1337 
1338  for(i=0; i<argc; i++)
1339  VariantClear(dp.rgvarg+dp.cArgs-i-1);
1340  if(dp.rgvarg != buf)
1341  heap_free(dp.rgvarg);
1342  if(FAILED(hres))
1343  return hres;
1344 
1345  if(!r)
1346  return S_OK;
1347 
1348  hres = variant_to_jsval(&retv, r);
1349  VariantClear(&retv);
1350  return hres;
1351 }
disp
Definition: i386-dis.c:3181
static int argc
Definition: ServiceArgs.c:12
script_ctx_t * ctx
Definition: jscript.h:235
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WARN(fmt,...)
Definition: debug.h:111
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
#define assert(x)
Definition: debug.h:53
#define argv
Definition: mplay32.c:18
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:428
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_DISPATCH(A)
Definition: oleauto.h:239
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
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define DISPATCH_JSCRIPT_INTERNAL_MASK
Definition: jscript.h:113
smooth NULL
Definition: ftsmooth.c:416
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
Definition: jsutils.c:339
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
Definition: jsutils.c:256
HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: dispex.c:1110
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define IID_NULL
Definition: guiddef.h:98
#define V_VT(A)
Definition: oleauto.h:211
#define err(...)
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1081
#define S_OK
Definition: intsafe.h:59
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define DISPID_THIS
Definition: olectl.h:395
#define ARRAY_SIZE(a)
Definition: main.h:24
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
unsigned int UINT
Definition: ndis.h:50
struct stdole::DISPPARAMS DISPPARAMS
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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

◆ disp_delete()

HRESULT disp_delete ( IDispatch ,
DISPID  ,
BOOL  
)

Definition at line 1532 of file dispex.c.

1533 {
1534  IDispatchEx *dispex;
1535  jsdisp_t *jsdisp;
1536  HRESULT hres;
1537 
1538  jsdisp = iface_to_jsdisp(disp);
1539  if(jsdisp) {
1540  dispex_prop_t *prop;
1541 
1542  prop = get_prop(jsdisp, id);
1543  if(prop)
1544  hres = delete_prop(prop, ret);
1545  else
1547 
1548  jsdisp_release(jsdisp);
1549  return hres;
1550  }
1551 
1552  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1553  if(FAILED(hres)) {
1554  *ret = FALSE;
1555  return S_OK;
1556  }
1557 
1558  hres = IDispatchEx_DeleteMemberByDispID(dispex, id);
1559  IDispatchEx_Release(dispex);
1560  if(FAILED(hres))
1561  return hres;
1562 
1563  *ret = hres == S_OK;
1564  return S_OK;
1565 }
disp
Definition: i386-dis.c:3181
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1081
#define S_OK
Definition: intsafe.h:59
static dispex_prop_t * get_prop(jsdisp_t *This, DISPID id)
Definition: dispex.c:66
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret)
Definition: dispex.c:788

Referenced by interp_delete_ident().

◆ disp_delete_name()

HRESULT disp_delete_name ( script_ctx_t ,
IDispatch ,
jsstr_t ,
BOOL  
)

Definition at line 1567 of file dispex.c.

1568 {
1569  IDispatchEx *dispex;
1570  jsdisp_t *jsdisp;
1571  BSTR bstr;
1572  HRESULT hres;
1573 
1574  jsdisp = iface_to_jsdisp(disp);
1575  if(jsdisp) {
1576  dispex_prop_t *prop;
1577  const WCHAR *ptr;
1578 
1579  ptr = jsstr_flatten(name);
1580  if(!ptr) {
1581  jsdisp_release(jsdisp);
1582  return E_OUTOFMEMORY;
1583  }
1584 
1585  hres = find_prop_name(jsdisp, string_hash(ptr), ptr, &prop);
1586  if(prop) {
1587  hres = delete_prop(prop, ret);
1588  }else {
1589  *ret = TRUE;
1590  hres = S_OK;
1591  }
1592 
1593  jsdisp_release(jsdisp);
1594  return hres;
1595  }
1596 
1598  if(!bstr)
1599  return E_OUTOFMEMORY;
1600  jsstr_flush(name, bstr);
1601 
1602  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1603  if(SUCCEEDED(hres)) {
1604  hres = IDispatchEx_DeleteMemberByName(dispex, bstr, make_grfdex(ctx, fdexNameCaseSensitive));
1605  if(SUCCEEDED(hres))
1606  *ret = hres == S_OK;
1607  IDispatchEx_Release(dispex);
1608  }else {
1609  DISPID id;
1610 
1611  hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &bstr, 1, 0, &id);
1612  if(SUCCEEDED(hres)) {
1613  /* Property exists and we can't delete it from pure IDispatch interface, so return false. */
1614  *ret = FALSE;
1615  }else if(hres == DISP_E_UNKNOWNNAME) {
1616  /* Property doesn't exist, so nothing to delete */
1617  *ret = TRUE;
1618  hres = S_OK;
1619  }
1620  }
1621 
1622  SysFreeString(bstr);
1623  return hres;
1624 }
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
disp
Definition: i386-dis.c:3181
#define TRUE
Definition: types.h:120
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
Definition: jsstr.h:148
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
OLECHAR * BSTR
Definition: compat.h:1934
static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
Definition: dispex.c:198
static unsigned string_hash(const WCHAR *name)
Definition: dispex.c:121
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
Definition: jscript.h:523
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
#define IID_NULL
Definition: guiddef.h:98
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1081
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
Definition: name.c:36
static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret)
Definition: dispex.c:788
GLenum GLuint id
Definition: glext.h:5579
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by interp_delete().

◆ disp_propget()

HRESULT disp_propget ( script_ctx_t ,
IDispatch ,
DISPID  ,
jsval_t  
)

Definition at line 1479 of file dispex.c.

1480 {
1481  DISPPARAMS dp = {NULL,NULL,0,0};
1482  IDispatchEx *dispex;
1483  jsdisp_t *jsdisp;
1484  VARIANT var;
1485  HRESULT hres;
1486 
1487  jsdisp = iface_to_jsdisp(disp);
1488  if(jsdisp) {
1489  hres = jsdisp_propget(jsdisp, id, val);
1490  jsdisp_release(jsdisp);
1491  return hres;
1492  }
1493 
1494  V_VT(&var) = VT_EMPTY;
1495  clear_ei(ctx);
1496  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1497  if(SUCCEEDED(hres)) {
1498  hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, INVOKE_PROPERTYGET, &dp, &var, &ctx->ei.ei,
1499  &ctx->jscaller->IServiceProvider_iface);
1500  IDispatchEx_Release(dispex);
1501  }else {
1502  ULONG err = 0;
1503 
1504  TRACE("using IDispatch\n");
1505  hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, INVOKE_PROPERTYGET, &dp, &var, &ctx->ei.ei, &err);
1506  }
1507  if(FAILED(hres))
1508  return hres;
1509 
1510  hres = variant_to_jsval(&var, val);
1511  VariantClear(&var);
1512  return hres;
1513 }
disp
Definition: i386-dis.c:3181
HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val)
Definition: dispex.c:1468
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:428
smooth NULL
Definition: ftsmooth.c:416
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
Definition: jsutils.c:256
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define IID_NULL
Definition: guiddef.h:98
#define V_VT(A)
Definition: oleauto.h:211
#define err(...)
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1081
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
struct stdole::DISPPARAMS DISPPARAMS
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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

◆ disp_propput()

HRESULT disp_propput ( script_ctx_t ,
IDispatch ,
DISPID  ,
jsval_t   
)

Definition at line 1380 of file dispex.c.

1381 {
1382  jsdisp_t *jsdisp;
1383  HRESULT hres;
1384 
1385  jsdisp = iface_to_jsdisp(disp);
1386  if(jsdisp) {
1387  dispex_prop_t *prop;
1388 
1389  prop = get_prop(jsdisp, id);
1390  if(prop)
1391  hres = prop_put(jsdisp, prop, val);
1392  else
1394 
1395  jsdisp_release(jsdisp);
1396  }else {
1397  DISPID dispid = DISPID_PROPERTYPUT;
1399  VARIANT var;
1400  DISPPARAMS dp = {&var, &dispid, 1, 1};
1401  IDispatchEx *dispex;
1402 
1403  hres = jsval_to_variant(val, &var);
1404  if(FAILED(hres))
1405  return hres;
1406 
1407  if(V_VT(&var) == VT_DISPATCH)
1409 
1410  clear_ei(ctx);
1411  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1412  if(SUCCEEDED(hres)) {
1413  hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, &dp, NULL, &ctx->ei.ei,
1414  &ctx->jscaller->IServiceProvider_iface);
1415  IDispatchEx_Release(dispex);
1416  }else {
1417  ULONG err = 0;
1418 
1419  TRACE("using IDispatch\n");
1420  hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, &dp, NULL, &ctx->ei.ei, &err);
1421  }
1422 
1423  VariantClear(&var);
1424  }
1425 
1426  return hres;
1427 }
disp
Definition: i386-dis.c:3181
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:428
smooth NULL
Definition: ftsmooth.c:416
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
Definition: jsutils.c:339
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define IID_NULL
Definition: guiddef.h:98
#define V_VT(A)
Definition: oleauto.h:211
#define err(...)
#define DISPATCH_PROPERTYPUTREF
Definition: oleauto.h:1009
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1081
static VARIANTARG static DISPID
Definition: ordinal.c:49
static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val)
Definition: dispex.c:491
static dispex_prop_t * get_prop(jsdisp_t *This, DISPID id)
Definition: dispex.c:66
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
struct stdole::DISPPARAMS DISPPARAMS
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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

◆ double_to_string()

HRESULT double_to_string ( double  ,
jsstr_t **   
)

Definition at line 719 of file jsutils.c.

720 {
721  static const WCHAR InfinityW[] = {'-','I','n','f','i','n','i','t','y',0};
722 
723  if(isnan(n)) {
724  *str = jsstr_nan();
725  }else if(isinf(n)) {
726  *str = jsstr_alloc(n<0 ? InfinityW : InfinityW+1);
727  }else if(is_int32(n)) {
728  *str = int_to_string(n);
729  }else {
730  VARIANT strv, v;
731  HRESULT hres;
732 
733  /* FIXME: Don't use VariantChangeTypeEx */
734  V_VT(&v) = VT_R8;
735  V_R8(&v) = n;
736  V_VT(&strv) = VT_EMPTY;
738  if(FAILED(hres))
739  return hres;
740 
741  *str = jsstr_alloc(V_BSTR(&strv));
742  SysFreeString(V_BSTR(&strv));
743  }
744 
745  return *str ? S_OK : E_OUTOFMEMORY;
746 }
static jsstr_t * jsstr_alloc(const WCHAR *str)
Definition: jsstr.h:103
jsstr_t * jsstr_nan(void)
Definition: jsstr.c:283
#define MAKELCID(lgid, srtid)
#define V_R8(A)
Definition: oleauto.h:262
GLdouble n
Definition: glext.h:7729
#define SUBLANG_ENGLISH_US
Definition: nls.h:222
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const WCHAR * str
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SORT_DEFAULT
LONG HRESULT
Definition: typedefs.h:77
int isinf(double x)
#define LANG_ENGLISH
Definition: nls.h:52
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
int isnan(double x)
#define S_OK
Definition: intsafe.h:59
const GLdouble * v
Definition: gl.h:2040
static jsstr_t * int_to_string(int i)
Definition: jsutils.c:689
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
static const WCHAR InfinityW[]
Definition: global.c:33
#define MAKELANGID(p, s)
Definition: nls.h:15
static BOOL is_int32(double d)
Definition: jscript.h:518
Definition: compat.h:1941
HRESULT WINAPI VariantChangeTypeEx(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, LCID lcid, USHORT wFlags, VARTYPE vt)
Definition: variant.c:991

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

◆ Function_get_value()

HRESULT Function_get_value ( script_ctx_t ,
jsdisp_t ,
jsval_t  
)

Definition at line 535 of file function.c.

536 {
537  jsstr_t *str;
538  HRESULT hres;
539 
540  TRACE("\n");
541 
543  if(FAILED(hres))
544  return hres;
545 
546  *r = jsval_string(str);
547  return S_OK;
548 }
Definition: jsstr.h:39
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const WCHAR * str
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static FunctionInstance * function_from_jsdisp(jsdisp_t *jsdisp)
Definition: function.c:47
#define S_OK
Definition: intsafe.h:59
static HRESULT function_to_string(FunctionInstance *function, jsstr_t **ret)
Definition: function.c:294

◆ Function_invoke()

HRESULT Function_invoke ( jsdisp_t ,
IDispatch ,
WORD  ,
unsigned  ,
jsval_t ,
jsval_t  
)

Definition at line 324 of file function.c.

325 {
326  const BOOL caller_execs_source = (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0;
327  FunctionInstance *function;
328 
329  TRACE("func %p this %p\n", func_this, jsthis);
330 
331  assert(is_class(func_this, JSCLASS_FUNCTION));
332  function = function_from_jsdisp(func_this);
333 
335  if(function->value_proc)
336  return invoke_value_proc(function->dispex.ctx, function, jsthis, flags, argc, argv, r);
337 
338  if(flags == DISPATCH_CONSTRUCT) {
339  jsdisp_t *this_obj;
340  HRESULT hres;
341 
342  hres = create_object(function->dispex.ctx, &function->dispex, &this_obj);
343  if(FAILED(hres))
344  return hres;
345 
346  hres = invoke_source(function->dispex.ctx, function, to_disp(this_obj), argc, argv, TRUE, caller_execs_source, r);
347  jsdisp_release(this_obj);
348  return hres;
349  }
350 
352  return invoke_source(function->dispex.ctx, function, jsthis, argc, argv, FALSE, caller_execs_source, r);
353 }
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:266
static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, unsigned argc, jsval_t *argv, BOOL is_constructor, BOOL caller_execs_source, jsval_t *r)
Definition: function.c:234
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define assert(x)
Definition: debug.h:53
#define argv
Definition: mplay32.c:18
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define DISPATCH_JSCRIPT_INTERNAL_MASK
Definition: jscript.h:113
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
Definition: jscript.h:500
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
static IDispatch * to_disp(jsdisp_t *jsdisp)
Definition: jscript.h:242
static FunctionInstance * function_from_jsdisp(jsdisp_t *jsdisp)
Definition: function.c:47
#define DISPATCH_JSCRIPT_CALLEREXECSSOURCE
Definition: jscript.h:112
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
HRESULT create_object(script_ctx_t *, jsdisp_t *, jsdisp_t **) DECLSPEC_HIDDEN
Definition: object.c:597

Referenced by invoke_prop_func(), and jsdisp_call_value().

◆ Function_value()

HRESULT Function_value ( script_ctx_t ,
vdisp_t ,
WORD  ,
unsigned  ,
jsval_t ,
jsval_t  
)

Definition at line 517 of file function.c.

519 {
520  FunctionInstance *function;
521 
522  TRACE("\n");
523 
524  if(!is_vclass(jsthis, JSCLASS_FUNCTION)) {
525  ERR("dispex is not a function\n");
526  return E_FAIL;
527  }
528 
529  function = function_from_jsdisp(jsthis->u.jsdisp);
530 
531  assert(function->value_proc != NULL);
532  return invoke_value_proc(ctx, function, NULL, flags, argc, argv, r);
533 }
static int argc
Definition: ServiceArgs.c:12
static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:266
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define assert(x)
Definition: debug.h:53
#define argv
Definition: mplay32.c:18
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL is_vclass(vdisp_t *vdisp, jsclass_t class)
Definition: jscript.h:505
GLbitfield flags
Definition: glext.h:7161
static FunctionInstance * function_from_jsdisp(jsdisp_t *jsdisp)
Definition: function.c:47
#define ERR(fmt,...)
Definition: debug.h:109

◆ get_jsdisp()

static jsdisp_t* get_jsdisp ( vdisp_t vdisp)
inlinestatic

Definition at line 196 of file jscript.h.

197 {
198  return is_jsdisp(vdisp) ? vdisp->u.jsdisp : NULL;
199 }
smooth NULL
Definition: ftsmooth.c:416
jsdisp_t * jsdisp
Definition: jscript.h:141
union vdisp_t::@420 u
static BOOL is_jsdisp(vdisp_t *vdisp)
Definition: jscript.h:154

Referenced by Error_toString(), and Object_toString().

◆ heap_pool_alloc()

void* heap_pool_alloc ( heap_pool_t ,
DWORD   
)

Definition at line 75 of file jsutils.c.

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

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 )

Definition at line 144 of file jsutils.c.

145 {
146  struct list *tmp;
147 
148  if(!heap)
149  return;
150 
151  while((tmp = list_head(&heap->custom_blocks))) {
152  list_remove(tmp);
153  heap_free(tmp);
154  }
155 
156  if(WARN_ON(heap)) {
157  DWORD i;
158 
159  for(i=0; i < heap->block_cnt; i++)
160  memset(heap->blocks[i], ARENA_FREE_FILLER, block_size(i));
161  }
162 
163  heap->last_block = heap->offset = 0;
164  heap->mark = FALSE;
165 }
#define ARENA_FREE_FILLER
Definition: jsutils.c:62
static DWORD block_size(DWORD block)
Definition: jsutils.c:64
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define WARN_ON(c)
Definition: module.h:255
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
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: _list.h:228
#define memset(x, y, z)
Definition: compat.h:39
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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

◆ heap_pool_free()

void heap_pool_free ( heap_pool_t )

Definition at line 167 of file jsutils.c.

168 {
169  DWORD i;
170 
171  heap_pool_clear(heap);
172 
173  for(i=0; i < heap->block_cnt; i++)
174  heap_free(heap->blocks[i]);
175  heap_free(heap->blocks);
176 
177  heap_pool_init(heap);
178 }
void heap_pool_clear(heap_pool_t *heap)
Definition: jsutils.c:144
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
unsigned long DWORD
Definition: ntddk_ex.h:95
void heap_pool_init(heap_pool_t *heap)
Definition: jsutils.c:69
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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

◆ heap_pool_grow()

void* heap_pool_grow ( heap_pool_t ,
void ,
DWORD  ,
DWORD   
)

Definition at line 128 of file jsutils.c.

129 {
130  void *ret;
131 
132  if(mem == (BYTE*)heap->blocks[heap->last_block] + heap->offset-size
133  && heap->offset+inc < block_size(heap->last_block)) {
134  heap->offset += inc;
135  return mem;
136  }
137 
138  ret = heap_pool_alloc(heap, size+inc);
139  if(ret) /* FIXME: avoid copying for custom blocks */
140  memcpy(ret, mem, size);
141  return ret;
142 }
static DWORD block_size(DWORD block)
Definition: jsutils.c:64
void * heap_pool_alloc(heap_pool_t *heap, DWORD size)
Definition: jsutils.c:75
GLsizeiptr size
Definition: glext.h:5919
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
Definition: mem.c:156

Referenced by PushBackTrackState(), and ReallocStateStack().

◆ heap_pool_init()

void heap_pool_init ( heap_pool_t )

Definition at line 69 of file jsutils.c.

70 {
71  memset(heap, 0, sizeof(*heap));
72  list_init(&heap->custom_blocks);
73 }
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define memset(x, y, z)
Definition: compat.h:39

Referenced by alloc_vbscode(), compile_script(), create_regexp(), exec_script(), init_code(), JScriptParse_InitNew(), parse_script(), release_script(), script_parse(), and VBScriptParse_InitNew().

◆ heap_pool_mark()

heap_pool_t* heap_pool_mark ( heap_pool_t )

Definition at line 180 of file jsutils.c.

181 {
182  if(heap->mark)
183  return NULL;
184 
185  heap->mark = TRUE;
186  return heap;
187 }
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416

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

◆ heap_strdupW()

static LPWSTR heap_strdupW ( LPCWSTR  str)
inlinestatic

Definition at line 73 of file jscript.h.

74 {
75  LPWSTR ret = NULL;
76 
77  if(str) {
78  DWORD size;
79 
80  size = (strlenW(str)+1)*sizeof(WCHAR);
81  ret = heap_alloc(size);
82  if(ret)
83  memcpy(ret, str, size);
84  }
85 
86  return ret;
87 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ iface_to_jsdisp()

jsdisp_t* iface_to_jsdisp ( IDispatch )

Definition at line 1081 of file dispex.c.

1082 {
1083  return iface->lpVtbl == (const IDispatchVtbl*)&DispatchExVtbl
1084  ? jsdisp_addref( impl_from_IDispatchEx((IDispatchEx*)iface))
1085  : NULL;
1086 }
static IDispatchExVtbl DispatchExVtbl
Definition: dispex.c:911
smooth NULL
Definition: ftsmooth.c:416
static jsdisp_t * jsdisp_addref(jsdisp_t *jsdisp)
Definition: jscript.h:259
static jsdisp_t * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:594

Referenced by Array_sort(), ArrayConstr_isArray(), concat_obj(), create_regexp_var(), disp_call(), disp_call_value(), disp_delete(), disp_delete_name(), disp_get_id(), disp_propget(), disp_propput(), exec_source(), Function_apply(), init_dispex_from_constr(), interp_carray_set(), interp_instanceof(), interp_obj_prop(), maybe_to_primitive(), RegExpConstr_value(), set_disp(), String_match(), String_replace(), String_search(), String_split(), stringify(), to_primitive(), and typeof_string().

◆ init_dispex()

HRESULT init_dispex ( jsdisp_t ,
script_ctx_t ,
const builtin_info_t ,
jsdisp_t  
)

Definition at line 940 of file dispex.c.

941 {
942  TRACE("%p (%p)\n", dispex, prototype);
943 
944  dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
945  dispex->ref = 1;
946  dispex->builtin_info = builtin_info;
947 
948  dispex->props = heap_alloc_zero(sizeof(dispex_prop_t)*(dispex->buf_size=4));
949  if(!dispex->props)
950  return E_OUTOFMEMORY;
951 
952  dispex->prototype = prototype;
953  if(prototype)
954  jsdisp_addref(prototype);
955 
956  dispex->prop_cnt = 1;
957  if(builtin_info->value_prop.invoke || builtin_info->value_prop.getter) {
958  dispex->props[0].type = PROP_BUILTIN;
959  dispex->props[0].u.p = &builtin_info->value_prop;
960  }else {
961  dispex->props[0].type = PROP_DELETED;
962  }
963 
964  script_addref(ctx);
965  dispex->ctx = ctx;
966 
967  return S_OK;
968 }
static IDispatchExVtbl DispatchExVtbl
Definition: dispex.c:911
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
static jsdisp_t * jsdisp_addref(jsdisp_t *jsdisp)
Definition: jscript.h:259
#define S_OK
Definition: intsafe.h:59
static void script_addref(script_ctx_t *ctx)
Definition: jscript.h:461

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 ,
script_ctx_t ,
const builtin_info_t ,
jsdisp_t  
)

Definition at line 1051 of file dispex.c.

1052 {
1053  jsdisp_t *prot = NULL;
1054  dispex_prop_t *prop;
1055  HRESULT hres;
1056 
1057  static const WCHAR prototypeW[] = {'p','r','o','t','o','t','y','p','e',0};
1058 
1060  if(SUCCEEDED(hres) && prop && prop->type!=PROP_DELETED) {
1061  jsval_t val;
1062 
1063  hres = prop_get(constr, prop, &val);
1064  if(FAILED(hres)) {
1065  ERR("Could not get prototype\n");
1066  return hres;
1067  }
1068 
1069  if(is_object_instance(val))
1070  prot = iface_to_jsdisp(get_object(val));
1071  jsval_release(val);
1072  }
1073 
1074  hres = init_dispex(dispex, ctx, builtin_info, prot);
1075 
1076  if(prot)
1077  jsdisp_release(prot);
1078  return hres;
1079 }
Definition: jsval.h:54
void jsval_release(jsval_t val)
Definition: jsutils.c:189
prop_type_t type
Definition: dispex.c:43
static IDispatch * get_object(jsval_t v)
Definition: jsval.h:219
static const WCHAR prototypeW[]
Definition: function.c:67
static unsigned string_hash(const WCHAR *name)
Definition: dispex.c:121
static HRESULT find_prop_name_prot(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
Definition: dispex.c:260
smooth NULL
Definition: ftsmooth.c:416
static BOOL is_object_instance(jsval_t v)
Definition: jsval.h:166
GLuint GLfloat * val
Definition: glext.h:7180
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109
jsdisp_t * iface_to_jsdisp(IDispatch *iface)
Definition: dispex.c:1081
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:940
static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, jsval_t *r)
Definition: dispex.c:432
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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 ,
jsdisp_t  
)

Definition at line 326 of file error.c.

327 {
328  static const WCHAR ErrorW[] = {'E','r','r','o','r',0};
329  static const WCHAR EvalErrorW[] = {'E','v','a','l','E','r','r','o','r',0};
330  static const WCHAR RangeErrorW[] = {'R','a','n','g','e','E','r','r','o','r',0};
331  static const WCHAR ReferenceErrorW[] = {'R','e','f','e','r','e','n','c','e','E','r','r','o','r',0};
332  static const WCHAR RegExpErrorW[] = {'R','e','g','E','x','p','E','r','r','o','r',0};
333  static const WCHAR SyntaxErrorW[] = {'S','y','n','t','a','x','E','r','r','o','r',0};
334  static const WCHAR TypeErrorW[] = {'T','y','p','e','E','r','r','o','r',0};
335  static const WCHAR URIErrorW[] = {'U','R','I','E','r','r','o','r',0};
336  static const WCHAR *names[] = {ErrorW, EvalErrorW, RangeErrorW,
338  jsdisp_t **constr_addr[] = {&ctx->error_constr, &ctx->eval_error_constr,
339  &ctx->range_error_constr, &ctx->reference_error_constr, &ctx->regexp_error_constr,
340  &ctx->syntax_error_constr, &ctx->type_error_constr,
341  &ctx->uri_error_constr};
345 
346  jsdisp_t *err;
347  unsigned int i;
348  jsstr_t *str;
349  HRESULT hres;
350 
351  for(i=0; i < ARRAY_SIZE(names); i++) {
352  hres = alloc_error(ctx, i==0 ? object_prototype : NULL, NULL, &err);
353  if(FAILED(hres))
354  return hres;
355 
356  str = jsstr_alloc(names[i]);
357  if(!str) {
359  return E_OUTOFMEMORY;
360  }
361 
363  jsval_string(str));
365  if(SUCCEEDED(hres))
366  hres = create_builtin_constructor(ctx, constr_val[i], names[i], NULL,
367  PROPF_CONSTR|1, err, constr_addr[i]);
368 
370  if(FAILED(hres))
371  return hres;
372  }
373 
374  return S_OK;
375 }
#define PROPF_WRITABLE
Definition: jscript.h:98
static const WCHAR nameW[]
Definition: error.c:32
static jsstr_t * jsstr_alloc(const WCHAR *str)
Definition: jsstr.h:103
static const WCHAR RangeErrorW[]
Definition: global.c:39
static HRESULT ReferenceErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:291
static const WCHAR EvalErrorW[]
Definition: global.c:38
static HRESULT RegExpErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:298
static HRESULT EvalErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:277
static HRESULT TypeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:312
static HRESULT SyntaxErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:305
Definition: jsstr.h:39
static HRESULT URIErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:319
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1794
#define PROPF_CONSTR
Definition: jscript.h:95
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:679
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
GLuint GLuint * names
Definition: glext.h:11545
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
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR ErrorW[]
Definition: global.c:37
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
static const WCHAR TypeErrorW[]
Definition: global.c:42
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR SyntaxErrorW[]
Definition: global.c:41
LONG HRESULT
Definition: typedefs.h:77
static HRESULT RangeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:284
static const WCHAR URIErrorW[]
Definition: global.c:43
static const WCHAR ReferenceErrorW[]
Definition: global.c:40
#define err(...)
static HRESULT ErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:270
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
#define PROPF_CONFIGURABLE
Definition: jscript.h:99
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT(* builtin_invoke_t)(script_ctx_t *, vdisp_t *, WORD, unsigned, jsval_t *, jsval_t *)
Definition: jscript.h:201
static const WCHAR RegExpErrorW[]
Definition: global.c:49
static HRESULT alloc_error(script_ctx_t *ctx, jsdisp_t *prototype, jsdisp_t *constr, jsdisp_t **ret)
Definition: error.c:162

Referenced by init_constructors().

◆ init_function_constr()

HRESULT init_function_constr ( script_ctx_t ,
jsdisp_t  
)

Definition at line 853 of file function.c.

854 {
855  FunctionInstance *prot, *constr;
856  HRESULT hres;
857 
858  static const WCHAR FunctionW[] = {'F','u','n','c','t','i','o','n',0};
859 
860  hres = create_function(ctx, &Function_info, PROPF_CONSTR, TRUE, object_prototype, &prot);
861  if(FAILED(hres))
862  return hres;
863 
865  prot->name = prototypeW;
866 
867  hres = create_function(ctx, &FunctionInst_info, PROPF_CONSTR|1, TRUE, &prot->dispex, &constr);
868  if(SUCCEEDED(hres)) {
870  constr->name = FunctionW;
872  if(SUCCEEDED(hres))
873  hres = set_constructor_prop(ctx, &constr->dispex, &prot->dispex);
874  if(FAILED(hres))
875  jsdisp_release(&constr->dispex);
876  }
877  jsdisp_release(&prot->dispex);
878  if(FAILED(hres))
879  return hres;
880 
881  ctx->function_constr = &constr->dispex;
882  return S_OK;
883 }
#define TRUE
Definition: types.h:120
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1794
#define PROPF_CONSTR
Definition: jscript.h:95
const WCHAR * name
Definition: function.c:31
static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_info, DWORD flags, BOOL funcprot, jsdisp_t *prototype, FunctionInstance **ret)
Definition: function.c:616
static const WCHAR prototypeW[]
Definition: function.c:67
builtin_invoke_t value_proc
Definition: function.c:30
static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:819
static const builtin_info_t Function_info
Definition: function.c:593
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
jsdisp_t dispex
Definition: function.c:29
static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t *prot)
Definition: function.c:671
#define S_OK
Definition: intsafe.h:59
static const WCHAR FunctionW[]
Definition: global.c:44
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:265
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static const builtin_info_t FunctionInst_info
Definition: function.c:607
static HRESULT FunctionProt_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:846

Referenced by init_constructors().

◆ init_global()

HRESULT init_global ( script_ctx_t )

Definition at line 1106 o