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

Go to the source code of this file.

Classes

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

Macros

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

Typedefs

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

Enumerations

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

Functions

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

Variables

HINSTANCE jscript_hinstance DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file jscript.h.

◆ DEFAULT_FUNCTION_VALUE

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

Definition at line 315 of file jscript.h.

◆ DISPATCH_JSCRIPT_CALLEREXECSSOURCE

#define DISPATCH_JSCRIPT_CALLEREXECSSOURCE   0x8000

Definition at line 115 of file jscript.h.

◆ DISPATCH_JSCRIPT_INTERNAL_MASK

#define DISPATCH_JSCRIPT_INTERNAL_MASK   DISPATCH_JSCRIPT_CALLEREXECSSOURCE

Definition at line 116 of file jscript.h.

◆ FACILITY_JSCRIPT

#define FACILITY_JSCRIPT   10

Definition at line 524 of file jscript.h.

◆ JS_E_ARRAY_EXPECTED

#define JS_E_ARRAY_EXPECTED   MAKE_JSERROR(IDS_ARRAY_EXPECTED)

Definition at line 569 of file jscript.h.

◆ JS_E_BOOLEAN_EXPECTED

#define JS_E_BOOLEAN_EXPECTED   MAKE_JSERROR(IDS_NOT_BOOL)

Definition at line 558 of file jscript.h.

◆ JS_E_CANNOT_CREATE_OBJ

#define JS_E_CANNOT_CREATE_OBJ   MAKE_JSERROR(IDS_CREATE_OBJ_ERROR)

Definition at line 532 of file jscript.h.

◆ JS_E_DATE_EXPECTED

#define JS_E_DATE_EXPECTED   MAKE_JSERROR(IDS_NOT_DATE)

Definition at line 553 of file jscript.h.

◆ JS_E_DISABLED_CC

#define JS_E_DISABLED_CC   MAKE_JSERROR(IDS_DISABLED_CC)

Definition at line 550 of file jscript.h.

◆ JS_E_ENUMERATOR_EXPECTED

#define JS_E_ENUMERATOR_EXPECTED   MAKE_JSERROR(IDS_NOT_ENUMERATOR)

Definition at line 562 of file jscript.h.

◆ JS_E_EXPECTED_ASSIGN

#define JS_E_EXPECTED_ASSIGN   MAKE_JSERROR(IDS_EXPECTED_ASSIGN)

Definition at line 541 of file jscript.h.

◆ JS_E_EXPECTED_AT

#define JS_E_EXPECTED_AT   MAKE_JSERROR(IDS_EXPECTED_AT)

Definition at line 551 of file jscript.h.

◆ JS_E_EXPECTED_CCEND

#define JS_E_EXPECTED_CCEND   MAKE_JSERROR(IDS_EXPECTED_CCEND)

Definition at line 549 of file jscript.h.

◆ JS_E_EXPECTED_IDENTIFIER

#define JS_E_EXPECTED_IDENTIFIER   MAKE_JSERROR(IDS_EXPECTED_IDENTIFIER)

Definition at line 540 of file jscript.h.

◆ JS_E_FRACTION_DIGITS_OUT_OF_RANGE

#define JS_E_FRACTION_DIGITS_OUT_OF_RANGE   MAKE_JSERROR(IDS_FRACTION_DIGITS_OUT_OF_RANGE)

Definition at line 566 of file jscript.h.

◆ JS_E_FUNCTION_EXPECTED

#define JS_E_FUNCTION_EXPECTED   MAKE_JSERROR(IDS_NOT_FUNC)

Definition at line 552 of file jscript.h.

◆ JS_E_ILLEGAL_ASSIGN

#define JS_E_ILLEGAL_ASSIGN   MAKE_JSERROR(IDS_ILLEGAL_ASSIGN)

Definition at line 556 of file jscript.h.

◆ JS_E_INVALID_ACTION

#define JS_E_INVALID_ACTION   MAKE_JSERROR(IDS_UNSUPPORTED_ACTION)

Definition at line 534 of file jscript.h.

◆ JS_E_INVALID_BREAK

#define JS_E_INVALID_BREAK   MAKE_JSERROR(IDS_INVALID_BREAK)

Definition at line 545 of file jscript.h.

◆ JS_E_INVALID_CHAR

#define JS_E_INVALID_CHAR   MAKE_JSERROR(IDS_INVALID_CHAR)

Definition at line 542 of file jscript.h.

◆ JS_E_INVALID_CONTINUE

#define JS_E_INVALID_CONTINUE   MAKE_JSERROR(IDS_INVALID_CONTINUE)

Definition at line 546 of file jscript.h.

◆ JS_E_INVALID_DELETE

#define JS_E_INVALID_DELETE   MAKE_JSERROR(IDS_INVALID_DELETE)

Definition at line 560 of file jscript.h.

◆ JS_E_INVALID_LENGTH

#define JS_E_INVALID_LENGTH   MAKE_JSERROR(IDS_INVALID_LENGTH)

Definition at line 568 of file jscript.h.

◆ JS_E_INVALID_PROPERTY

#define JS_E_INVALID_PROPERTY   MAKE_JSERROR(IDS_NO_PROPERTY)

Definition at line 533 of file jscript.h.

◆ JS_E_INVALID_URI_CHAR

#define JS_E_INVALID_URI_CHAR   MAKE_JSERROR(IDS_URI_INVALID_CHAR)

Definition at line 565 of file jscript.h.

◆ JS_E_INVALID_URI_CODING

#define JS_E_INVALID_URI_CODING   MAKE_JSERROR(IDS_URI_INVALID_CODING)

Definition at line 564 of file jscript.h.

◆ JS_E_INVALID_WRITABLE_PROP_DESC

#define JS_E_INVALID_WRITABLE_PROP_DESC   MAKE_JSERROR(IDS_INVALID_WRITABLE_PROP_DESC)

Definition at line 573 of file jscript.h.

◆ JS_E_INVALIDARG

#define JS_E_INVALIDARG   MAKE_JSERROR(IDS_INVALID_CALL_ARG)

Definition at line 529 of file jscript.h.

◆ JS_E_JSCRIPT_EXPECTED

#define JS_E_JSCRIPT_EXPECTED   MAKE_JSERROR(IDS_JSCRIPT_EXPECTED)

Definition at line 561 of file jscript.h.

◆ JS_E_LABEL_NOT_FOUND

#define JS_E_LABEL_NOT_FOUND   MAKE_JSERROR(IDS_LABEL_NOT_FOUND)

Definition at line 548 of file jscript.h.

◆ JS_E_LABEL_REDEFINED

#define JS_E_LABEL_REDEFINED   MAKE_JSERROR(IDS_LABEL_REDEFINED)

Definition at line 547 of file jscript.h.

◆ JS_E_MISPLACED_RETURN

#define JS_E_MISPLACED_RETURN   MAKE_JSERROR(IDS_MISPLACED_RETURN)

Definition at line 544 of file jscript.h.

◆ JS_E_MISSING_ARG

#define JS_E_MISSING_ARG   MAKE_JSERROR(IDS_ARG_NOT_OPT)

Definition at line 535 of file jscript.h.

◆ JS_E_MISSING_LBRACKET

#define JS_E_MISSING_LBRACKET   MAKE_JSERROR(IDS_LBRACKET)

Definition at line 538 of file jscript.h.

◆ JS_E_MISSING_RBRACKET

#define JS_E_MISSING_RBRACKET   MAKE_JSERROR(IDS_RBRACKET)

Definition at line 539 of file jscript.h.

◆ JS_E_MISSING_SEMICOLON

#define JS_E_MISSING_SEMICOLON   MAKE_JSERROR(IDS_SEMICOLON)

Definition at line 537 of file jscript.h.

◆ JS_E_NONCONFIGURABLE_REDEFINED

#define JS_E_NONCONFIGURABLE_REDEFINED   MAKE_JSERROR(IDS_NONCONFIGURABLE_REDEFINED)

Definition at line 570 of file jscript.h.

◆ JS_E_NONWRITABLE_MODIFIED

#define JS_E_NONWRITABLE_MODIFIED   MAKE_JSERROR(IDS_NONWRITABLE_MODIFIED)

Definition at line 571 of file jscript.h.

◆ JS_E_NUMBER_EXPECTED

#define JS_E_NUMBER_EXPECTED   MAKE_JSERROR(IDS_NOT_NUM)

Definition at line 554 of file jscript.h.

◆ JS_E_OBJECT_EXPECTED

#define JS_E_OBJECT_EXPECTED   MAKE_JSERROR(IDS_OBJECT_EXPECTED)

Definition at line 555 of file jscript.h.

◆ JS_E_OBJECT_REQUIRED

#define JS_E_OBJECT_REQUIRED   MAKE_JSERROR(IDS_OBJECT_REQUIRED)

Definition at line 531 of file jscript.h.

◆ JS_E_PRECISION_OUT_OF_RANGE

#define JS_E_PRECISION_OUT_OF_RANGE   MAKE_JSERROR(IDS_PRECISION_OUT_OF_RANGE)

Definition at line 567 of file jscript.h.

◆ JS_E_PROP_DESC_MISMATCH

#define JS_E_PROP_DESC_MISMATCH   MAKE_JSERROR(IDS_PROP_DESC_MISMATCH)

Definition at line 572 of file jscript.h.

◆ JS_E_REGEXP_SYNTAX

#define JS_E_REGEXP_SYNTAX   MAKE_JSERROR(IDS_REGEXP_SYNTAX_ERROR)

Definition at line 563 of file jscript.h.

◆ JS_E_SUBSCRIPT_OUT_OF_RANGE

#define JS_E_SUBSCRIPT_OUT_OF_RANGE   MAKE_JSERROR(IDS_SUBSCRIPT_OUT_OF_RANGE)

Definition at line 530 of file jscript.h.

◆ JS_E_SYNTAX

#define JS_E_SYNTAX   MAKE_JSERROR(IDS_SYNTAX_ERROR)

Definition at line 536 of file jscript.h.

◆ JS_E_TO_PRIMITIVE

#define JS_E_TO_PRIMITIVE   MAKE_JSERROR(IDS_TO_PRIMITIVE)

Definition at line 528 of file jscript.h.

◆ JS_E_UNDEFINED_VARIABLE

#define JS_E_UNDEFINED_VARIABLE   MAKE_JSERROR(IDS_UNDEFINED)

Definition at line 557 of file jscript.h.

◆ JS_E_UNTERMINATED_STRING

#define JS_E_UNTERMINATED_STRING   MAKE_JSERROR(IDS_UNTERMINATED_STR)

Definition at line 543 of file jscript.h.

◆ JS_E_VBARRAY_EXPECTED

#define JS_E_VBARRAY_EXPECTED   MAKE_JSERROR(IDS_NOT_VBARRAY)

Definition at line 559 of file jscript.h.

◆ MAKE_JSERROR

Definition at line 526 of file jscript.h.

◆ PROPF_ALL

Definition at line 103 of file jscript.h.

◆ PROPF_ARGMASK

#define PROPF_ARGMASK   0x00ff

Definition at line 96 of file jscript.h.

◆ PROPF_CONFIGURABLE

#define PROPF_CONFIGURABLE   0x1000

Definition at line 102 of file jscript.h.

◆ PROPF_CONSTR

#define PROPF_CONSTR   0x0200

Definition at line 98 of file jscript.h.

◆ PROPF_ENUMERABLE

#define PROPF_ENUMERABLE   0x0400

Definition at line 100 of file jscript.h.

◆ PROPF_ES5

◆ PROPF_HTML

Definition at line 107 of file jscript.h.

◆ PROPF_METHOD

#define PROPF_METHOD   0x0100

Definition at line 97 of file jscript.h.

◆ PROPF_VERSION_MASK

#define PROPF_VERSION_MASK   0x01ff0000

Definition at line 105 of file jscript.h.

◆ PROPF_VERSION_SHIFT

#define PROPF_VERSION_SHIFT   16

Definition at line 106 of file jscript.h.

◆ PROPF_WRITABLE

#define PROPF_WRITABLE   0x0800

Definition at line 101 of file jscript.h.

◆ REM_ALLOC_RESULT

#define REM_ALLOC_RESULT   0x0008

Definition at line 492 of file jscript.h.

◆ REM_CHECK_GLOBAL

#define REM_CHECK_GLOBAL   0x0001

Definition at line 489 of file jscript.h.

◆ REM_NO_CTX_UPDATE

#define REM_NO_CTX_UPDATE   0x0004

Definition at line 491 of file jscript.h.

◆ REM_NO_PARENS

#define REM_NO_PARENS   0x0010

Definition at line 493 of file jscript.h.

◆ REM_RESET_INDEX

#define REM_RESET_INDEX   0x0002

Definition at line 490 of file jscript.h.

◆ SCRIPTLANGUAGEVERSION_ES5

#define SCRIPTLANGUAGEVERSION_ES5   0x102

Definition at line 52 of file jscript.h.

◆ SCRIPTLANGUAGEVERSION_HTML

#define SCRIPTLANGUAGEVERSION_HTML   0x400

Definition at line 47 of file jscript.h.

◆ VDISP_DISPEX

#define VDISP_DISPEX   0x0001

Definition at line 149 of file jscript.h.

◆ VDISP_JSDISP

#define VDISP_JSDISP   0x0002

Definition at line 150 of file jscript.h.

Typedef Documentation

◆ builtin_getter_t

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

Definition at line 205 of file jscript.h.

◆ builtin_invoke_t

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

Definition at line 204 of file jscript.h.

◆ builtin_setter_t

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

Definition at line 206 of file jscript.h.

◆ cc_var_t

Definition at line 370 of file jscript.h.

◆ dispex_prop_t

Definition at line 57 of file jscript.h.

◆ jsdisp_t

Definition at line 92 of file jscript.h.

◆ jsstr_t

Definition at line 55 of file jscript.h.

◆ jsval_t

Definition at line 54 of file jscript.h.

◆ named_item_t

◆ property_desc_t

Definition at line 58 of file jscript.h.

◆ script_ctx_t

Definition at line 56 of file jscript.h.

Enumeration Type Documentation

◆ hint_t

Enumerator
NO_HINT 
HINT_STRING 
HINT_NUMBER 

Definition at line 337 of file jscript.h.

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

◆ jsclass_t

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

Definition at line 119 of file jscript.h.

Function Documentation

◆ array_get_length()

unsigned array_get_length ( jsdisp_t )

Definition at line 73 of file array.c.

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

Referenced by stringify_array().

◆ as_jsdisp()

jsdisp_t* as_jsdisp ( IDispatch )

Definition at line 908 of file dispex.c.

909 {
910  assert(disp->lpVtbl == (IDispatchVtbl*)&DispatchExVtbl);
911  return impl_from_IDispatchEx((IDispatchEx*)disp);
912 }
disp
Definition: i386-dis.c:3181
static IDispatchExVtbl DispatchExVtbl
Definition: dispex.c:890
#define assert(x)
Definition: debug.h:53
static jsdisp_t * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:593

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:504
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 555 of file dispex.c.

556 {
557  TRACE("%p %s\n", jsthis, debugstr_jsval(value));
558  return S_OK;
559 }
#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:35

◆ clear_ei()

void clear_ei ( script_ctx_t )

Definition at line 430 of file engine.c.

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

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

◆ create_activex_constr()

HRESULT create_activex_constr ( script_ctx_t ,
jsdisp_t **   
)

Definition at line 188 of file activex.c.

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

Referenced by init_global().

◆ create_array()

HRESULT create_array ( script_ctx_t ,
DWORD  ,
jsdisp_t **   
)

Definition at line 1381 of file array.c.

1382 {
1384  HRESULT hres;
1385 
1386  hres = alloc_array(ctx, NULL, &array);
1387  if(FAILED(hres))
1388  return hres;
1389 
1390  array->length = length;
1391 
1392  *ret = &array->dispex;
1393  return S_OK;
1394 }
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:1326
#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_map(), Array_slice(), Array_splice(), ArrayConstr_value(), create_match_array(), interp_carray(), parse_json_value(), regexp_string_match(), String_split(), and VBArray_toArray().

◆ create_array_constr()

HRESULT create_array_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 1364 of file array.c.

1365 {
1367  HRESULT hres;
1368 
1369  static const WCHAR ArrayW[] = {'A','r','r','a','y',0};
1370 
1371  hres = alloc_array(ctx, object_prototype, &array);
1372  if(FAILED(hres))
1373  return hres;
1374 
1376 
1377  jsdisp_release(&array->dispex);
1378  return hres;
1379 }
#define PROPF_CONSTR
Definition: jscript.h:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
static const builtin_info_t ArrayConstr_info
Definition: array.c:1355
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:1275
static const WCHAR ArrayW[]
Definition: global.c:36
int ret
static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayInstance **ret)
Definition: array.c:1326
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
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:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
static const WCHAR BooleanW[]
Definition: global.c:37
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:268

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 686 of file function.c.

688 {
689  jsdisp_t *constr;
690  HRESULT hres;
691 
692  hres = create_builtin_function(ctx, value_proc, name, builtin_info, flags, prototype, &constr);
693  if(FAILED(hres))
694  return hres;
695 
696  hres = set_constructor_prop(ctx, constr, prototype);
697  if(FAILED(hres)) {
698  jsdisp_release(constr);
699  return hres;
700  }
701 
702  *ret = constr;
703  return S_OK;
704 }
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:678
int ret
#define S_OK
Definition: intsafe.h:59
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
Definition: name.c:38
HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:651

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 651 of file function.c.

653 {
654  NativeFunction *function;
655  HRESULT hres;
656 
657  hres = create_function(ctx, builtin_info, &NativeFunctionVtbl, sizeof(NativeFunction), flags, FALSE, NULL, (void**)&function);
658  if(FAILED(hres))
659  return hres;
660 
661  if(builtin_info)
662  hres = jsdisp_define_data_property(&function->function.dispex, lengthW, 0,
663  jsval_number(function->function.length));
664  if(SUCCEEDED(hres))
665  hres = jsdisp_define_data_property(&function->function.dispex, prototypeW, 0, jsval_obj(prototype));
666  if(FAILED(hres)) {
667  jsdisp_release(&function->function.dispex);
668  return hres;
669  }
670 
671  function->proc = value_proc;
672  function->name = name;
673 
674  *ret = &function->function.dispex;
675  return S_OK;
676 }
static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_info, const function_vtbl_t *vtbl, size_t size, DWORD flags, BOOL funcprot, jsdisp_t *prototype, void **ret)
Definition: function.c:566
static const WCHAR lengthW[]
Definition: function.c:96
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1801
static const WCHAR prototypeW[]
Definition: function.c:94
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static const function_vtbl_t NativeFunctionVtbl
Definition: function.c:645
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:268
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 2534 of file date.c.

2535 {
2536  jsdisp_t *date;
2537  HRESULT hres;
2538 
2539  static const WCHAR DateW[] = {'D','a','t','e',0};
2540 
2541  hres = create_date(ctx, object_prototype, 0.0, &date);
2542  if(FAILED(hres))
2543  return hres;
2544 
2546  PROPF_CONSTR|7, date, ret);
2547 
2549  return hres;
2550 }
static const WCHAR DateW[]
Definition: global.c:38
static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE time, jsdisp_t **ret)
Definition: date.c:2003
#define PROPF_CONSTR
Definition: jscript.h:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
static const builtin_info_t DateConstr_info
Definition: date.c:2525
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:2436
int ret
__u16 date
Definition: mkdosfs.c:366
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268

Referenced by init_constructors().

◆ create_dispex()

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

Definition at line 957 of file dispex.c.

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

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

◆ create_enumerator_constr()

HRESULT create_enumerator_constr ( script_ctx_t ,
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:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
static const WCHAR EnumeratorW[]
Definition: global.c:54
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:268

Referenced by init_constructors().

◆ create_jscaller()

HRESULT create_jscaller ( script_ctx_t )

Definition at line 1047 of file jsutils.c.

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

838 {
839  jsdisp_t *json;
840  HRESULT hres;
841 
842  json = heap_alloc_zero(sizeof(*json));
843  if(!json)
844  return E_OUTOFMEMORY;
845 
846  hres = init_dispex_from_constr(json, ctx, &JSON_info, ctx->object_constr);
847  if(FAILED(hres)) {
848  heap_free(json);
849  return hres;
850  }
851 
852  *ret = json;
853  return S_OK;
854 }
static const builtin_info_t JSON_info
Definition: json.c:828
#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:1030
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 533 of file math.c.

534 {
535  jsdisp_t *math;
536  unsigned i;
537  HRESULT hres;
538 
539  struct {
540  const WCHAR *name;
541  DOUBLE val;
542  }constants[] = {
543  {EW, M_E}, /* ECMA-262 3rd Edition 15.8.1.1 */
544  {LN10W, M_LN10}, /* ECMA-262 3rd Edition 15.8.1.2 */
545  {LN2W, M_LN2}, /* ECMA-262 3rd Edition 15.8.1.3 */
546  {LOG2EW, M_LOG2E}, /* ECMA-262 3rd Edition 15.8.1.4 */
547  {LOG10EW, M_LOG10E}, /* ECMA-262 3rd Edition 15.8.1.5 */
548  {PIW, M_PI}, /* ECMA-262 3rd Edition 15.8.1.6 */
549  {SQRT1_2W, M_SQRT1_2}, /* ECMA-262 3rd Edition 15.8.1.7 */
550  {SQRT2W, M_SQRT2}, /* ECMA-262 3rd Edition 15.8.1.8 */
551  };
552 
553  math = heap_alloc_zero(sizeof(jsdisp_t));
554  if(!math)
555  return E_OUTOFMEMORY;
556 
557  hres = init_dispex_from_constr(math, ctx, &Math_info, ctx->object_constr);
558  if(FAILED(hres)) {
559  heap_free(math);
560  return hres;
561  }
562 
563  for(i=0; i < ARRAY_SIZE(constants); i++) {
566  if(FAILED(hres)) {
567  jsdisp_release(math);
568  return hres;
569  }
570  }
571 
572  *ret = math;
573  return S_OK;
574 }
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1801
static const WCHAR SQRT1_2W[]
Definition: math.c:42
static const WCHAR PIW[]
Definition: math.c:40
static const WCHAR SQRT2W[]
Definition: math.c:41
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:38
static const WCHAR LOG10EW[]
Definition: math.c:37
static const WCHAR LOG2EW[]
Definition: math.c:36
#define S_OK
Definition: intsafe.h:59
static const builtin_info_t Math_info
Definition: math.c:524
#define ARRAY_SIZE(a)
Definition: main.h:24
constants
Definition: resource.c:29
static const WCHAR EW[]
Definition: math.c:35
#define M_PI
Definition: macros.h:263
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
static const WCHAR LN10W[]
Definition: math.c:39
Definition: name.c:38
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:1030
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:69
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:47
#define PROPF_CONSTR
Definition: jscript.h:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
static size_t double number
Definition: printf.c:69
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:268

Referenced by init_constructors().

◆ create_object()

HRESULT create_object ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 731 of file object.c.

732 {
733  jsdisp_t *object;
734  HRESULT hres;
735 
736  object = heap_alloc_zero(sizeof(jsdisp_t));
737  if(!object)
738  return E_OUTOFMEMORY;
739 
740  hres = init_dispex_from_constr(object, ctx, &ObjectInst_info, constr ? constr : ctx->object_constr);
741  if(FAILED(hres)) {
742  heap_free(object);
743  return hres;
744  }
745 
746  *ret = object;
747  return S_OK;
748 }
#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:264
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:1030
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(), interp_new_obj(), InterpretedFunction_call(), Object_getOwnPropertyDescriptor(), ObjectConstr_value(), parse_json_value(), and to_object().

◆ create_object_constr()

HRESULT create_object_constr ( script_ctx_t ,
jsdisp_t ,
jsdisp_t **   
)

Definition at line 718 of file object.c.

719 {
720  static const WCHAR ObjectW[] = {'O','b','j','e','c','t',0};
721 
723  object_prototype, ret);
724 }
static const WCHAR ObjectW[]
Definition: global.c:48
#define PROPF_CONSTR
Definition: jscript.h:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const builtin_info_t ObjectConstr_info
Definition: object.c:662
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:671

Referenced by init_constructors().

◆ create_object_prototype()

HRESULT create_object_prototype ( script_ctx_t ,
jsdisp_t **   
)

Definition at line 726 of file object.c.

727 {
728  return create_dispex(ctx, &Object_info, NULL, ret);
729 }
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:957
static const builtin_info_t Object_info
Definition: object.c:255

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  str = jsstr_flatten(src);
651  if(!str)
652  return E_OUTOFMEMORY;
653 
654  TRACE("%s %x\n", debugstr_wn(str, jsstr_length(src)), flags);
655 
656  hres = alloc_regexp(ctx, NULL, &regexp);
657  if(FAILED(hres))
658  return hres;
659 
660  regexp->str = jsstr_addref(src);
661  regexp->last_index_val = jsval_number(0);
662 
663  regexp->jsregexp = regexp_new(ctx, &ctx->tmp_heap, str, jsstr_length(regexp->str), flags, FALSE);
664  if(!regexp->jsregexp) {
665  WARN("regexp_new failed\n");
666  jsdisp_release(&regexp->dispex);
667  return E_FAIL;
668  }
669 
670  *ret = &regexp->dispex;
671  return S_OK;
672 }
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
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
#define debugstr_wn
Definition: kernel32.h:33
regexp_t * jsregexp
Definition: jsregexp.c:31
#define S_OK
Definition: intsafe.h:59
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
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:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
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:268
static const WCHAR RegExpW[]
Definition: global.c:50

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:600
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
static char * get_string(void)
Definition: ppl.yy.c:4402
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:504
#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:1060
regexp_t * jsregexp
Definition: jsregexp.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
jsstr_t * str
Definition: jsregexp.c:32
const char * debugstr_jsval(const jsval_t) DECLSPEC_HIDDEN
Definition: jsutils.c:35

Referenced by RegExpConstr_value(), and String_search().

◆ create_string()

HRESULT create_string ( script_ctx_t ,
jsstr_t ,
jsdisp_t **   
)

Definition at line 1787 of file string.c.

1788 {
1790  HRESULT hres;
1791 
1792  hres = string_alloc(ctx, NULL, str, &string);
1793  if(FAILED(hres))
1794  return hres;
1795 
1796  *ret = &string->dispex;
1797  return S_OK;
1798 
1799 }
const char * string
Definition: string.c:1565
static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr_t *str, StringInstance **ret)
Definition: string.c:1733
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 1769 of file string.c.

1770 {
1772  HRESULT hres;
1773 
1774  static const WCHAR StringW[] = {'S','t','r','i','n','g',0};
1775 
1776  hres = string_alloc(ctx, object_prototype, jsstr_empty(), &string);
1777  if(FAILED(hres))
1778  return hres;
1779 
1781  PROPF_CONSTR|1, &string->dispex, ret);
1782 
1783  jsdisp_release(&string->dispex);
1784  return hres;
1785 }
const char * string
Definition: string.c:1565
static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: string.c:1685
#define PROPF_CONSTR
Definition: jscript.h:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr_t *str, StringInstance **ret)
Definition: string.c:1733
jsstr_t * jsstr_empty(void)
Definition: jsstr.c:288
static const builtin_info_t StringConstr_info
Definition: string.c:1760
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:49
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268

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:1379
int ret
#define S_OK
Definition: intsafe.h:59
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
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:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
static 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:53
int ret
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
jsdisp_t dispex
Definition: vbarray.c:26

Referenced by init_constructors().

◆ debugstr_jsval()

const char* debugstr_jsval ( const  jsval_t)

Definition at line 35 of file jsutils.c.

36 {
37  switch(jsval_type(v)) {
38  case JSV_UNDEFINED:
39  return "undefined";
40  case JSV_NULL:
41  return "null";
42  case JSV_OBJECT:
43  return wine_dbg_sprintf("obj(%p)", get_object(v));
44  case JSV_STRING:
45  return wine_dbg_sprintf("str(%s)", debugstr_jsstr(get_string(v)));
46  case JSV_NUMBER:
47  return wine_dbg_sprintf("%lf", get_number(v));
48  case JSV_BOOL:
49  return get_bool(v) ? "true" : "false";
50  case JSV_VARIANT:
52  }
53 
54  assert(0);
55  return NULL;
56 }
static IDispatch * get_object(jsval_t v)
Definition: jsval.h:219
#define assert(x)
Definition: debug.h:53
static char * get_string(void)
Definition: ppl.yy.c:4402
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
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(), Array_forEach(), Array_map(), bind_event_target(), builtin_set_const(), create_regexp_var(), exprval_call(), Function_bind(), interp_add(), interp_carray_set(), interp_eq(), interp_eq2(), interp_gt(), interp_gteq(), interp_lt(), interp_lteq(), interp_neq(), invoke_prop_func(), jsdisp_define_property(), JSGlobal_eval(), JSON_stringify(), Object_create(), Object_getPrototypeOf(), print_backtrace(), prop_get(), prop_put(), to_string(), and unwind_exception().

◆ decode_source()

HRESULT decode_source ( WCHAR )

Definition at line 111 of file decode.c.

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

1137 {
1138  IDispatchEx *dispex;
1139  jsdisp_t *jsdisp;
1140  VARIANT buf[6], retv;
1141  DISPPARAMS dp;
1142  unsigned i;
1143  HRESULT hres;
1144 
1145  jsdisp = iface_to_jsdisp(disp);
1146  if(jsdisp) {
1147  if(flags & DISPATCH_PROPERTYPUT) {
1148  FIXME("disp_call(propput) on builtin object\n");
1149  return E_FAIL;
1150  }
1151 
1152  if(ctx != jsdisp->ctx)
1154  hres = jsdisp_call(jsdisp, id, flags, argc, argv, ret);
1155  jsdisp_release(jsdisp);
1156  return hres;
1157  }
1158 
1160  if(ret && argc)
1162 
1163  dp.cArgs = argc;
1164 
1165  if(flags & DISPATCH_PROPERTYPUT) {
1166  static DISPID propput_dispid = DISPID_PROPERTYPUT;
1167 
1168  dp.cNamedArgs = 1;
1169  dp.rgdispidNamedArgs = &propput_dispid;
1170  }else {
1171  dp.cNamedArgs = 0;
1172  dp.rgdispidNamedArgs = NULL;
1173  }
1174 
1175  if(argc > 6) {
1176  dp.rgvarg = heap_alloc(argc*sizeof(VARIANT));
1177  if(!dp.rgvarg)
1178  return E_OUTOFMEMORY;
1179  }else {
1180  dp.rgvarg = buf;
1181  }
1182 
1183  for(i=0; i<argc; i++) {
1184  hres = jsval_to_variant(argv[i], dp.rgvarg+argc-i-1);
1185  if(FAILED(hres)) {
1186  while(i--)
1187  VariantClear(dp.rgvarg+argc-i-1);
1188  if(dp.rgvarg != buf)
1189  heap_free(dp.rgvarg);
1190  return hres;
1191  }
1192  }
1193 
1194  V_VT(&retv) = VT_EMPTY;
1195  clear_ei(ctx);
1196  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1197  if(SUCCEEDED(hres)) {
1198  hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, &dp, ret ? &retv : NULL, &ctx->ei.ei,
1199  &ctx->jscaller->IServiceProvider_iface);
1200  IDispatchEx_Release(dispex);
1201  }else {
1202  UINT err = 0;
1203 
1204  if(flags == DISPATCH_CONSTRUCT) {
1205  WARN("IDispatch cannot be constructor\n");
1206  return DISP_E_MEMBERNOTFOUND;
1207  }
1208 
1209  TRACE("using IDispatch\n");
1210  hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, &dp, ret ? &retv : NULL, &ctx->ei.ei, &err);
1211  }
1212 
1213  for(i=0; i<argc; i++)
1214  VariantClear(dp.rgvarg+argc-i-1);
1215  if(dp.rgvarg != buf)
1216  heap_free(dp.rgvarg);
1217  if(FAILED(hres))
1218  return hres;
1219 
1220  if(ret) {
1221  hres = variant_to_jsval(&retv, ret);
1222  VariantClear(&retv);
1223  }
1224 
1225  return hres;
1226 }
disp
Definition: i386-dis.c:3181
static int argc
Definition: ServiceArgs.c:12
script_ctx_t * ctx
Definition: jscript.h:238
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:430
#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:1113
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:116
#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:347
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
Definition: jsutils.c:258
#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:648
#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:1060
static VARIANTARG static DISPID
Definition: ordinal.c:49
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
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 1228 of file dispex.c.

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

◆ disp_delete()

HRESULT disp_delete ( IDispatch ,
DISPID  ,
BOOL  
)

Definition at line 1511 of file dispex.c.

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

Referenced by interp_delete_ident().

◆ disp_delete_name()

HRESULT disp_delete_name ( script_ctx_t ,
IDispatch ,
jsstr_t ,
BOOL  
)

Definition at line 1574 of file dispex.c.

1575 {
1576  IDispatchEx *dispex;
1577  jsdisp_t *jsdisp;
1578  BSTR bstr;
1579  HRESULT hres;
1580 
1581  jsdisp = iface_to_jsdisp(disp);
1582  if(jsdisp) {
1583  dispex_prop_t *prop;
1584  const WCHAR *ptr;
1585 
1586  ptr = jsstr_flatten(name);
1587  if(!ptr) {
1588  jsdisp_release(jsdisp);
1589  return E_OUTOFMEMORY;
1590  }
1591 
1592  hres = find_prop_name(jsdisp, string_hash(ptr), ptr, &prop);
1593  if(prop) {
1594  hres = delete_prop(prop, ret);
1595  }else {
1596  *ret = TRUE;
1597  hres = S_OK;
1598  }
1599 
1600  jsdisp_release(jsdisp);
1601  return hres;
1602  }
1603 
1605  if(!bstr)
1606  return E_OUTOFMEMORY;
1607  jsstr_flush(name, bstr);
1608 
1609  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1610  if(SUCCEEDED(hres)) {
1611  hres = IDispatchEx_DeleteMemberByName(dispex, bstr, make_grfdex(ctx, fdexNameCaseSensitive));
1612  if(SUCCEEDED(hres))
1613  *ret = hres == S_OK;
1614  IDispatchEx_Release(dispex);
1615  }else {
1616  DISPID id;
1617 
1618  hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &bstr, 1, 0, &id);
1619  if(SUCCEEDED(hres)) {
1620  /* Property exists and we can't delete it from pure IDispatch interface, so return false. */
1621  *ret = FALSE;
1622  }else if(hres == DISP_E_UNKNOWNNAME) {
1623  /* Property doesn't exist, so nothing to delete */
1624  *ret = TRUE;
1625  hres = S_OK;
1626  }
1627  }
1628 
1629  SysFreeString(bstr);
1630  return hres;
1631 }
#define 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:339
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:1942
static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
Definition: dispex.c:197
static unsigned string_hash(const WCHAR *name)
Definition: dispex.c:120
#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:519
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:1060
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:271
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
Definition: name.c:38
static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret)
Definition: dispex.c:787
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 1458 of file dispex.c.

1459 {
1460  DISPPARAMS dp = {NULL,NULL,0,0};
1461  IDispatchEx *dispex;
1462  jsdisp_t *jsdisp;
1463  VARIANT var;
1464  HRESULT hres;
1465 
1466  jsdisp = iface_to_jsdisp(disp);
1467  if(jsdisp) {
1468  hres = jsdisp_propget(jsdisp, id, val);
1469  jsdisp_release(jsdisp);
1470  return hres;
1471  }
1472 
1473  V_VT(&var) = VT_EMPTY;
1474  clear_ei(ctx);
1475  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1476  if(SUCCEEDED(hres)) {
1477  hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, INVOKE_PROPERTYGET, &dp, &var, &ctx->ei.ei,
1478  &ctx->jscaller->IServiceProvider_iface);
1479  IDispatchEx_Release(dispex);
1480  }else {
1481  ULONG err = 0;
1482 
1483  TRACE("using IDispatch\n");
1484  hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, INVOKE_PROPERTYGET, &dp, &var, &ctx->ei.ei, &err);
1485  }
1486  if(FAILED(hres))
1487  return hres;
1488 
1489  hres = variant_to_jsval(&var, val);
1490  VariantClear(&var);
1491  return hres;
1492 }
disp
Definition: i386-dis.c:3181
HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val)
Definition: dispex.c:1447
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:430
smooth NULL
Definition: ftsmooth.c:416
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
Definition: jsutils.c:258
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:648
#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:1060
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
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 1359 of file dispex.c.

1360 {
1361  jsdisp_t *jsdisp;
1362  HRESULT hres;
1363 
1364  jsdisp = iface_to_jsdisp(disp);
1365  if(jsdisp) {
1366  dispex_prop_t *prop;
1367 
1368  prop = get_prop(jsdisp, id);
1369  if(prop)
1370  hres = prop_put(jsdisp, prop, val);
1371  else
1373 
1374  jsdisp_release(jsdisp);
1375  }else {
1376  DISPID dispid = DISPID_PROPERTYPUT;
1378  VARIANT var;
1379  DISPPARAMS dp = {&var, &dispid, 1, 1};
1380  IDispatchEx *dispex;
1381 
1382  hres = jsval_to_variant(val, &var);
1383  if(FAILED(hres))
1384  return hres;
1385 
1386  if(V_VT(&var) == VT_DISPATCH)
1388 
1389  clear_ei(ctx);
1390  hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
1391  if(SUCCEEDED(hres)) {
1392  hres = IDispatchEx_InvokeEx(dispex, id, ctx->lcid, flags, &dp, NULL, &ctx->ei.ei,
1393  &ctx->jscaller->IServiceProvider_iface);
1394  IDispatchEx_Release(dispex);
1395  }else {
1396  ULONG err = 0;
1397 
1398  TRACE("using IDispatch\n");
1399  hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, &dp, NULL, &ctx->ei.ei, &err);
1400  }
1401 
1402  VariantClear(&var);
1403  }
1404 
1405  return hres;
1406 }
disp
Definition: i386-dis.c:3181
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
void clear_ei(script_ctx_t *ctx)
Definition: engine.c:430
smooth NULL
Definition: ftsmooth.c:416
HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
Definition: jsutils.c:347
#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:648
#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:1060
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:490
static dispex_prop_t * get_prop(jsdisp_t *This, DISPID id)
Definition: dispex.c:65
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
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 727 of file jsutils.c.

728 {
729  static const WCHAR InfinityW[] = {'-','I','n','f','i','n','i','t','y',0};
730 
731  if(isnan(n)) {
732  *str = jsstr_nan();
733  }else if(isinf(n)) {
734  *str = jsstr_alloc(n<0 ? InfinityW : InfinityW+1);
735  }else if(is_int32(n)) {
736  *str = int_to_string(n);
737  }else {
738  VARIANT strv, v;
739  HRESULT hres;
740 
741  /* FIXME: Don't use VariantChangeTypeEx */
742  V_VT(&v) = VT_R8;
743  V_R8(&v) = n;
744  V_VT(&strv) = VT_EMPTY;
746  if(FAILED(hres))
747  return hres;
748 
749  *str = jsstr_alloc(V_BSTR(&strv));
750  SysFreeString(V_BSTR(&strv));
751  }
752 
753  return *str ? S_OK : E_OUTOFMEMORY;
754 }
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:697
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
static const WCHAR InfinityW[]
Definition: global.c:35
#define MAKELANGID(p, s)
Definition: nls.h:15
static BOOL is_int32(double d)
Definition: jscript.h:514
Definition: compat.h:1949
HRESULT WINAPI VariantChangeTypeEx(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, LCID lcid, USHORT wFlags, VARTYPE vt)
Definition: variant.c:988

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

◆ Function_get_value()

HRESULT Function_get_value ( script_ctx_t ,
jsdisp_t ,
jsval_t  
)

Definition at line 487 of file function.c.

488 {
489  FunctionInstance *function = function_from_jsdisp(jsthis);
490  jsstr_t *str;
491  HRESULT hres;
492 
493  TRACE("\n");
494 
495  hres = function->vtbl->toString(function, &str);
496  if(FAILED(hres))
497  return hres;
498 
499  *r = jsval_string(str);
500  return S_OK;
501 }
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:74
#define S_OK
Definition: intsafe.h:59

◆ Function_invoke()

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

Definition at line 264 of file function.c.

265 {
266  FunctionInstance *function;
267 
268  TRACE("func %p this %p\n", func_this, jsthis);
269 
270  assert(is_class(func_this, JSCLASS_FUNCTION));
271  function = function_from_jsdisp(func_this);
272 
273  return function->vtbl->call(function->dispex.ctx, function, jsthis, flags, argc, argv, r);
274 }
static int argc
Definition: ServiceArgs.c:12
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define assert(x)
Definition: debug.h:53
#define argv
Definition: mplay32.c:18
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
Definition: jscript.h:504
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
static FunctionInstance * function_from_jsdisp(jsdisp_t *jsdisp)
Definition: function.c:74

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 471 of file function.c.

473 {
474  FunctionInstance *function;
475 
476  TRACE("\n");
477 
478  if(!is_vclass(jsthis, JSCLASS_FUNCTION)) {
479  ERR("dispex is not a function\n");
480  return E_FAIL;
481  }
482 
483  function = function_from_jsdisp(jsthis->u.jsdisp);
484  return function->vtbl->call(ctx, function, NULL, flags, argc, argv, r);
485 }
static int argc
Definition: ServiceArgs.c:12
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#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:509
GLbitfield flags
Definition: glext.h:7161
static FunctionInstance * function_from_jsdisp(jsdisp_t *jsdisp)
Definition: function.c:74
#define ERR(fmt,...)
Definition: debug.h:109

◆ get_jsdisp()

static jsdisp_t* get_jsdisp ( vdisp_t vdisp)
inlinestatic

Definition at line 199 of file jscript.h.

200 {
201  return is_jsdisp(vdisp) ? vdisp->u.jsdisp : NULL;
202 }
smooth NULL
Definition: ftsmooth.c:416
jsdisp_t * jsdisp
Definition: jscript.h:144
union vdisp_t::@425 u
static BOOL is_jsdisp(vdisp_t *vdisp)
Definition: jscript.h:157

Referenced by Error_toString(), and Object_toString().

◆ heap_pool_alloc()

void* heap_pool_alloc ( heap_pool_t ,
DWORD   
)

Definition at line 77 of file jsutils.c.

78 {
79  struct list *list;
80  void *tmp;
81 
82  if(!heap->block_cnt) {
83  if(!heap->blocks) {
84  heap->blocks = heap_alloc(sizeof(void*));
85  if(!heap->blocks)
86  return NULL;
87  }
88 
89  tmp = heap_alloc(block_size(0));
90  if(!tmp)
91  return NULL;
92 
93  heap->blocks[0] = tmp;
94  heap->block_cnt = 1;
95  }
96 
97  if(heap->offset + size <= block_size(heap->last_block)) {
98  tmp = ((BYTE*)heap->blocks[heap->last_block])+heap->offset;
99  heap->offset += size;
100  return tmp;
101  }
102 
103  if(size <= block_size(heap->last_block+1)) {
104  if(heap->last_block+1 == heap->block_cnt) {
105  tmp = heap_realloc(heap->blocks, (heap->block_cnt+1)*sizeof(void*));
106  if(!tmp)
107  return NULL;
108 
109  heap->blocks = tmp;
110  heap->blocks[heap->block_cnt] = heap_alloc(block_size(heap->block_cnt));
111  if(!heap->blocks[heap->block_cnt])
112  return NULL;
113 
114  heap->block_cnt++;
115  }
116 
117  heap->last_block++;
118  heap->offset = size;
119  return heap->blocks[heap->last_block];
120  }
121 
122  list = heap_alloc(size + sizeof(struct list));
123  if(!list)
124  return NULL;
125 
126  list_add_head(&heap->custom_blocks, list);
127  return list+1;
128 }
__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:66
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 146 of file jsutils.c.

147 {
148  struct list *tmp;
149 
150  if(!heap)
151  return;
152 
153  while((tmp = list_head(&heap->custom_blocks))) {
154  list_remove(tmp);
155  heap_free(tmp);
156  }
157 
158  if(WARN_ON(heap)) {
159  DWORD i;
160 
161  for(i=0; i < heap->block_cnt; i++)
162  memset(heap->blocks[i], ARENA_FREE_FILLER, block_size(i));
163  }
164 
165  heap->last_block = heap->offset = 0;
166  heap->mark = FALSE;
167 }
#define ARENA_FREE_FILLER
Definition: jsutils.c:64
static DWORD block_size(DWORD block)
Definition: jsutils.c:66
__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 169 of file jsutils.c.

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

131 {
132  void *ret;
133 
134  if(mem == (BYTE*)heap->blocks[heap->last_block] + heap->offset-size
135  && heap->offset+inc < block_size(heap->last_block)) {
136  heap->offset += inc;
137  return mem;
138  }
139 
140  ret = heap_pool_alloc(heap, size+inc);
141  if(ret) /* FIXME: avoid copying for custom blocks */
142  memcpy(ret, mem, size);
143  return ret;
144 }
static DWORD block_size(DWORD block)
Definition: jsutils.c:66
void * heap_pool_alloc(heap_pool_t *heap, DWORD size)
Definition: jsutils.c:77
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 71 of file jsutils.c.

72 {
73  memset(heap, 0, sizeof(*heap));
74  list_init(&heap->custom_blocks);
75 }
__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 VBScriptFactory_CreateInstance().

◆ heap_pool_mark()

heap_pool_t* heap_pool_mark ( heap_pool_t )

Definition at line 182 of file jsutils.c.

183 {
184  if(heap->mark)
185  return NULL;
186 
187  heap->mark = TRUE;
188  return heap;
189 }
#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 76 of file jscript.h.

77 {
78  LPWSTR ret = NULL;
79 
80  if(str) {
81  DWORD size;
82 
83  size = (lstrlenW(str)+1)*sizeof(WCHAR);
84  ret = heap_alloc(size);
85  if(ret)
86  memcpy(ret, str, size);
87  }
88 
89  return ret;
90 }
#define lstrlenW
Definition: compat.h:415
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 1060 of file dispex.c.

1061 {
1062  return iface->lpVtbl == (const IDispatchVtbl*)&DispatchExVtbl
1063  ? jsdisp_addref( impl_from_IDispatchEx((IDispatchEx*)iface))
1064  : NULL;
1065 }
static IDispatchExVtbl DispatchExVtbl
Definition: dispex.c:890
smooth NULL
Definition: ftsmooth.c:416
static jsdisp_t * jsdisp_addref(jsdisp_t *jsdisp)
Definition: jscript.h:262
static jsdisp_t * impl_from_IDispatchEx(IDispatchEx *iface)
Definition: dispex.c:593

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 919 of file dispex.c.

920 {
921  TRACE("%p (%p)\n", dispex, prototype);
922 
923  dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
924  dispex->ref = 1;
925  dispex->builtin_info = builtin_info;
926 
927  dispex->props = heap_alloc_zero(sizeof(dispex_prop_t)*(dispex->buf_size=4));
928  if(!dispex->props)
929  return E_OUTOFMEMORY;
930 
931  dispex->prototype = prototype;
932  if(prototype)
933  jsdisp_addref(prototype);
934 
935  dispex->prop_cnt = 1;
936  if(builtin_info->value_prop.invoke || builtin_info->value_prop.getter) {
937  dispex->props[0].type = PROP_BUILTIN;
938  dispex->props[0].u.p = &builtin_info->value_prop;
939  }else {
940  dispex->props[0].type = PROP_DELETED;
941  }
942 
943  script_addref(ctx);
944  dispex->ctx = ctx;
945 
946  return S_OK;
947 }
static IDispatchExVtbl DispatchExVtbl
Definition: dispex.c:890
#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:262
#define S_OK
Definition: intsafe.h:59
static void script_addref(script_ctx_t *ctx)
Definition: jscript.h:465

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 1030 of file dispex.c.

1031 {
1032  jsdisp_t *prot = NULL;
1033  dispex_prop_t *prop;
1034  HRESULT hres;
1035 
1036  static const WCHAR prototypeW[] = {'p','r','o','t','o','t','y','p','e',0};
1037 
1039  if(SUCCEEDED(hres) && prop && prop->type!=PROP_DELETED) {
1040  jsval_t val;
1041 
1042  hres = prop_get(constr, prop, &val);
1043  if(FAILED(hres)) {
1044  ERR("Could not get prototype\n");
1045  return hres;
1046  }
1047 
1048  if(is_object_instance(val))
1049  prot = iface_to_jsdisp(get_object(val));
1050  jsval_release(val);
1051  }
1052 
1053  hres = init_dispex(dispex, ctx, builtin_info, prot);
1054 
1055  if(prot)
1056  jsdisp_release(prot);
1057  return hres;
1058 }
Definition: jsval.h:54
void jsval_release(jsval_t val)
Definition: jsutils.c:191
prop_type_t type
Definition: dispex.c:42
static IDispatch * get_object(jsval_t v)
Definition: jsval.h:219
static const WCHAR prototypeW[]
Definition: function.c:94
static unsigned string_hash(const WCHAR *name)
Definition: dispex.c:120
static HRESULT find_prop_name_prot(jsdisp_t *This, unsigned hash, const WCHAR *name, dispex_prop_t **ret)
Definition: dispex.c:259
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:1060
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, jsval_t *r)
Definition: dispex.c:431
#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 328 of file error.c.

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

Referenced by init_constructors().

◆ init_function_constr()

HRESULT init_function_constr ( script_ctx_t ,
jsdisp_t  
)

Definition at line 1010 of file function.c.

1011 {
1012  NativeFunction *prot, *constr;
1013  HRESULT hres;
1014 
1015  static const WCHAR FunctionW[] = {'F','u','n','c','t','i','o','n',0};
1016 
1018  TRUE, object_prototype, (void**)&prot);
1019  if(FAILED(hres))
1020  return hres;
1021 
1022  prot->proc = FunctionProt_value;
1023  prot->name = prototypeW;
1024 
1026  TRUE, &prot->function.dispex, (void**)&constr);
1027  if(SUCCEEDED(hres)) {
1028  constr->proc = FunctionConstr_value;
1029  constr->name = FunctionW;
1031  if(SUCCEEDED(hres))
1032  hres = set_constructor_prop(ctx, &constr->function.dispex, &prot->function.dispex);
1033  if(FAILED(hres))
1034  jsdisp_release(&constr->function.dispex);
1035  }
1036  jsdisp_release(&prot->function.dispex);
1037  if(FAILED(hres))
1038  return hres;
1039 
1040  ctx->function_constr = &constr->function.dispex;
1041  return S_OK;
1042 }
#define TRUE
Definition: types.h:120
static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_info, const function_vtbl_t *vtbl, size_t size, DWORD flags, BOOL funcprot, jsdisp_t *prototype, void **ret)
Definition: function.c:566
FunctionInstance function
Definition: function.c:51
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1801
#define PROPF_CONSTR
Definition: jscript.h:98
builtin_invoke_t proc
Definition: function.c:52
static const WCHAR prototypeW[]
Definition: function.c:94
static HRESULT FunctionConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:976
static const builtin_info_t Function_info
Definition: function.c:543
HRESULT hres
Definition: protocol.c:465
const WCHAR * name
Definition: function.c:53
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const function_vtbl_t NativeFunctionVtbl
Definition: function.c:645
jsdisp_t dispex
Definition: function.c:31
static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t *prot)
Definition: function.c:678
#define S_OK
Definition: intsafe.h:59
static const WCHAR FunctionW[]
Definition: global.c:46
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
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:557
static HRESULT FunctionProt_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:1003

Referenced by init_constructors().

◆ init_global()

HRESULT init_global ( script_ctx_t )

Definition at line 1105 of file global.c.

1106 {
1107  unsigned const_flags = ctx->version >= SCRIPTLANGUAGEVERSION_ES5 ? 0 : PROPF_WRITABLE;
1108  jsdisp_t *math, *object_prototype, *constr;
1109  HRESULT hres;
1110 
1111  if(ctx->global)
1112  return S_OK;
1113 
1114  hres = create_dispex(ctx, &JSGlobal_info, NULL, &ctx->global);
1115  if(FAILED(hres))
1116  return hres;
1117 
1118  hres = create_object_prototype(ctx, &object_prototype);
1119  if(FAILED(hres))
1120  return hres;
1121 
1122  hres = init_constructors(ctx, object_prototype);
1123  jsdisp_release(object_prototype);
1124  if(FAILED(hres))
1125  return hres;
1126 
1127  hres = create_math(ctx, &math);
1128  if(FAILED(hres))
1129  return hres;
1130 
1132  jsdisp_release(math);
1133  if(FAILED(