ReactOS  0.4.15-dev-488-gc7a1924
vbarray.c File Reference
#include "jscript.h"
#include "wine/debug.h"
Include dependency graph for vbarray.c:

Go to the source code of this file.

Classes

struct  VBArrayInstance
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (jscript)
 
static VBArrayInstancevbarray_from_jsdisp (jsdisp_t *jsdisp)
 
static VBArrayInstancevbarray_from_vdisp (vdisp_t *vdisp)
 
static VBArrayInstancevbarray_this (vdisp_t *jsthis)
 
static HRESULT VBArray_dimensions (script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT VBArray_getItem (script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT VBArray_lbound (script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT VBArray_toArray (script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT VBArray_ubound (script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT VBArray_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static void VBArray_destructor (jsdisp_t *dispex)
 
static HRESULT alloc_vbarray (script_ctx_t *ctx, jsdisp_t *object_prototype, VBArrayInstance **ret)
 
static HRESULT VBArrayConstr_value (script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
HRESULT create_vbarray_constr (script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp_t **ret)
 
HRESULT create_vbarray (script_ctx_t *ctx, SAFEARRAY *sa, jsdisp_t **ret)
 

Variables

static const WCHAR dimensionsW [] = {'d','i','m','e','n','s','i','o','n','s',0}
 
static const WCHAR getItemW [] = {'g','e','t','I','t','e','m',0}
 
static const WCHAR lboundW [] = {'l','b','o','u','n','d',0}
 
static const WCHAR toArrayW [] = {'t','o','A','r','r','a','y',0}
 
static const WCHAR uboundW [] = {'u','b','o','u','n','d',0}
 
static const builtin_prop_t VBArray_props []
 
static const builtin_info_t VBArray_info
 

Function Documentation

◆ alloc_vbarray()

static HRESULT alloc_vbarray ( script_ctx_t ctx,
jsdisp_t object_prototype,
VBArrayInstance **  ret 
)
static

Definition at line 267 of file vbarray.c.

268 {
269  VBArrayInstance *vbarray;
270  HRESULT hres;
271 
272  vbarray = heap_alloc_zero(sizeof(VBArrayInstance));
273  if(!vbarray)
274  return E_OUTOFMEMORY;
275 
276  if(object_prototype)
277  hres = init_dispex(&vbarray->dispex, ctx, &VBArray_info, object_prototype);
278  else
280 
281  if(FAILED(hres)) {
282  heap_free(vbarray);
283  return hres;
284  }
285 
286  *ret = vbarray;
287  return S_OK;
288 }
jsdisp_t * vbarray_constr
Definition: jscript.h:459
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
int ret
static const builtin_info_t VBArray_info
Definition: vbarray.c:258
#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
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
jsdisp_t dispex
Definition: vbarray.c:26
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by create_vbarray(), create_vbarray_constr(), and VBArrayConstr_value().

◆ create_vbarray()

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

Definition at line 347 of file vbarray.c.

348 {
349  VBArrayInstance *vbarray;
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:78
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 ctx,
jsdisp_t object_prototype,
jsdisp_t **  ret 
)

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:78
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().

◆ VBArray_destructor()

static void VBArray_destructor ( jsdisp_t dispex)
static

Definition at line 242 of file vbarray.c.

243 {
244  VBArrayInstance *vbarray = vbarray_from_jsdisp(dispex);
245 
246  SafeArrayDestroy(vbarray->safearray);
247  heap_free(vbarray);
248 }
SAFEARRAY * safearray
Definition: vbarray.c:28
static VBArrayInstance * vbarray_from_jsdisp(jsdisp_t *jsdisp)
Definition: vbarray.c:37
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1347
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ VBArray_dimensions()

static HRESULT VBArray_dimensions ( script_ctx_t ctx,
vdisp_t vthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 52 of file vbarray.c.

54 {
55  VBArrayInstance *vbarray;
56 
57  TRACE("\n");
58 
59  vbarray = vbarray_this(vthis);
60  if(!vbarray)
62 
63  if(r)
65  return S_OK;
66 }
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1094
SAFEARRAY * safearray
Definition: vbarray.c:28
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define JS_E_VBARRAY_EXPECTED
Definition: jscript.h:559
#define S_OK
Definition: intsafe.h:59
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440
static VBArrayInstance * vbarray_this(vdisp_t *jsthis)
Definition: vbarray.c:47
static jsval_t jsval_number(double n)
Definition: jsval.h:144

◆ vbarray_from_jsdisp()

static VBArrayInstance* vbarray_from_jsdisp ( jsdisp_t jsdisp)
inlinestatic

Definition at line 37 of file vbarray.c.

38 {
39  return CONTAINING_RECORD(jsdisp, VBArrayInstance, dispex);
40 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by VBArray_destructor(), and vbarray_from_vdisp().

◆ vbarray_from_vdisp()

static VBArrayInstance* vbarray_from_vdisp ( vdisp_t vdisp)
inlinestatic

Definition at line 42 of file vbarray.c.

43 {
44  return vbarray_from_jsdisp(vdisp->u.jsdisp);
45 }
union vdisp_t::@428 u
jsdisp_t * jsdisp
Definition: jscript.h:144
static VBArrayInstance * vbarray_from_jsdisp(jsdisp_t *jsdisp)
Definition: vbarray.c:37

Referenced by vbarray_this().

◆ VBArray_getItem()

static HRESULT VBArray_getItem ( script_ctx_t ctx,
vdisp_t vthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 68 of file vbarray.c.

70 {
71  VBArrayInstance *vbarray;
72  int i, *indexes;
73  VARIANT out;
74  HRESULT hres;
75 
76  TRACE("\n");
77 
78  vbarray = vbarray_this(vthis);
79  if(!vbarray)
81 
82  if(argc < SafeArrayGetDim(vbarray->safearray))
84 
85  indexes = heap_alloc(sizeof(int)*argc);
86  if(!indexes)
87  return E_OUTOFMEMORY;
88 
89  for(i=0; i<argc; i++) {
90  hres = to_int32(ctx, argv[i], indexes+i);
91  if(FAILED(hres)) {
92  heap_free(indexes);
93  return hres;
94  }
95  }
96 
97  hres = SafeArrayGetElement(vbarray->safearray, indexes, (void*)&out);
98  heap_free(indexes);
99  if(hres == DISP_E_BADINDEX)
101  else if(FAILED(hres))
102  return hres;
103 
104  if(r) {
105  hres = variant_to_jsval(&out, r);
106  VariantClear(&out);
107  }
108  return hres;
109 }
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1094
static int argc
Definition: ServiceArgs.c:12
SAFEARRAY * safearray
Definition: vbarray.c:28
HRESULT throw_range_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:420
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HRESULT WINAPI SafeArrayGetElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData)
Definition: safearray.c:947
#define argv
Definition: mplay32.c:18
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
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
smooth NULL
Definition: ftsmooth.c:416
HRESULT to_int32(script_ctx_t *, jsval_t, INT *) DECLSPEC_HIDDEN
Definition: jsutils.c:665
HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
Definition: jsutils.c:258
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
static FILE * out
Definition: regtests2xml.c:44
#define JS_E_VBARRAY_EXPECTED
Definition: jscript.h:559
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
#define JS_E_SUBSCRIPT_OUT_OF_RANGE
Definition: jscript.h:530
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440
#define DISP_E_BADINDEX
Definition: winerror.h:2520
static VBArrayInstance * vbarray_this(vdisp_t *jsthis)
Definition: vbarray.c:47
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ VBArray_lbound()

static HRESULT VBArray_lbound ( script_ctx_t ctx,
vdisp_t vthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 111 of file vbarray.c.

113 {
114  VBArrayInstance *vbarray;
115  int dim;
116  HRESULT hres;
117 
118  TRACE("\n");
119 
120  vbarray = vbarray_this(vthis);
121  if(!vbarray)
123 
124  if(argc) {
125  hres = to_int32(ctx, argv[0], &dim);
126  if(FAILED(hres))
127  return hres;
128  } else
129  dim = 1;
130 
131  hres = SafeArrayGetLBound(vbarray->safearray, dim, &dim);
132  if(hres == DISP_E_BADINDEX)
134  else if(FAILED(hres))
135  return hres;
136 
137  if(r)
138  *r = jsval_number(dim);
139  return S_OK;
140 }
static int argc
Definition: ServiceArgs.c:12
SAFEARRAY * safearray
Definition: vbarray.c:28
HRESULT throw_range_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:420
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define argv
Definition: mplay32.c:18
smooth NULL
Definition: ftsmooth.c:416
HRESULT to_int32(script_ctx_t *, jsval_t, INT *) DECLSPEC_HIDDEN
Definition: jsutils.c:665
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1066
#define JS_E_VBARRAY_EXPECTED
Definition: jscript.h:559
#define S_OK
Definition: intsafe.h:59
#define JS_E_SUBSCRIPT_OUT_OF_RANGE
Definition: jscript.h:530
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440
#define DISP_E_BADINDEX
Definition: winerror.h:2520
static VBArrayInstance * vbarray_this(vdisp_t *jsthis)
Definition: vbarray.c:47
static jsval_t jsval_number(double n)
Definition: jsval.h:144

◆ vbarray_this()

static VBArrayInstance* vbarray_this ( vdisp_t jsthis)
inlinestatic

Definition at line 47 of file vbarray.c.

48 {
49  return is_vclass(jsthis, JSCLASS_VBARRAY) ? vbarray_from_vdisp(jsthis) : NULL;
50 }
smooth NULL
Definition: ftsmooth.c:416
static BOOL is_vclass(vdisp_t *vdisp, jsclass_t class)
Definition: jscript.h:509
static VBArrayInstance * vbarray_from_vdisp(vdisp_t *vdisp)
Definition: vbarray.c:42

Referenced by VBArray_dimensions(), VBArray_getItem(), VBArray_lbound(), VBArray_toArray(), and VBArray_ubound().

◆ VBArray_toArray()

static HRESULT VBArray_toArray ( script_ctx_t ctx,
vdisp_t vthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 142 of file vbarray.c.

144 {
145  VBArrayInstance *vbarray;
146  jsdisp_t *array;
147  jsval_t val;
148  VARIANT *v;
149  int i, size = 1, ubound, lbound;
150  HRESULT hres;
151 
152  TRACE("\n");
153 
154  vbarray = vbarray_this(vthis);
155  if(!vbarray)
157 
158  for(i=1; i<=SafeArrayGetDim(vbarray->safearray); i++) {
159  SafeArrayGetLBound(vbarray->safearray, i, &lbound);
160  SafeArrayGetUBound(vbarray->safearray, i, &ubound);
161  size *= ubound-lbound+1;
162  }
163 
164  hres = SafeArrayAccessData(vbarray->safearray, (void**)&v);
165  if(FAILED(hres))
166  return hres;
167 
168  hres = create_array(ctx, 0, &array);
169  if(FAILED(hres)) {
171  return hres;
172  }
173 
174  for(i=0; i<size; i++) {
175  hres = variant_to_jsval(v, &val);
176  if(SUCCEEDED(hres)) {
179  }
180  if(FAILED(hres)) {
183  return hres;
184  }
185  v++;
186  }
187 
189 
190  if(r)
191  *r = jsval_obj(array);
192  else
194  return S_OK;
195 }
Definition: jsval.h:54
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1094
void jsval_release(jsval_t val)
Definition: jsutils.c:191
SAFEARRAY * safearray
Definition: vbarray.c:28
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
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
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
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
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1066
#define JS_E_VBARRAY_EXPECTED
Definition: jscript.h:559
HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val)
Definition: dispex.c:1349
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
const GLdouble * v
Definition: gl.h:2040
HRESULT create_array(script_ctx_t *ctx, DWORD length, jsdisp_t **ret)
Definition: array.c:1381
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440
static VBArrayInstance * vbarray_this(vdisp_t *jsthis)
Definition: vbarray.c:47
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
#define SUCCEEDED(hr)
Definition: intsafe.h:57
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

◆ VBArray_ubound()

static HRESULT VBArray_ubound ( script_ctx_t ctx,
vdisp_t vthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 197 of file vbarray.c.

199 {
200  VBArrayInstance *vbarray;
201  int dim;
202  HRESULT hres;
203 
204  TRACE("\n");
205 
206  vbarray = vbarray_this(vthis);
207  if(!vbarray)
209 
210  if(argc) {
211  hres = to_int32(ctx, argv[0], &dim);
212  if(FAILED(hres))
213  return hres;
214  } else
215  dim = 1;
216 
217  hres = SafeArrayGetUBound(vbarray->safearray, dim, &dim);
218  if(hres == DISP_E_BADINDEX)
220  else if(FAILED(hres))
221  return hres;
222 
223  if(r)
224  *r = jsval_number(dim);
225  return S_OK;
226 }
static int argc
Definition: ServiceArgs.c:12
SAFEARRAY * safearray
Definition: vbarray.c:28
HRESULT throw_range_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:420
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define argv
Definition: mplay32.c:18
smooth NULL
Definition: ftsmooth.c:416
HRESULT to_int32(script_ctx_t *, jsval_t, INT *) DECLSPEC_HIDDEN
Definition: jsutils.c:665
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define JS_E_VBARRAY_EXPECTED
Definition: jscript.h:559
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
#define JS_E_SUBSCRIPT_OUT_OF_RANGE
Definition: jscript.h:530
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440
#define DISP_E_BADINDEX
Definition: winerror.h:2520
static VBArrayInstance * vbarray_this(vdisp_t *jsthis)
Definition: vbarray.c:47
static jsval_t jsval_number(double n)
Definition: jsval.h:144

◆ VBArray_value()

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

Definition at line 228 of file vbarray.c.

230 {
231  FIXME("\n");
232 
233  switch(flags) {
234  default:
235  FIXME("unimplemented flags %x\n", flags);
236  return E_NOTIMPL;
237  }
238 
239  return S_OK;
240 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ VBArrayConstr_value()

static HRESULT VBArrayConstr_value ( script_ctx_t ctx,
vdisp_t vthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 290 of file vbarray.c.

292 {
293  VBArrayInstance *vbarray;
294  HRESULT hres;
295 
296  TRACE("\n");
297 
298  switch(flags) {
299  case DISPATCH_METHOD:
300  if(argc<1 || !is_variant(argv[0]) || V_VT(get_variant(argv[0])) != (VT_ARRAY|VT_VARIANT))
302 
303  return jsval_copy(argv[0], r);
304 
305  case DISPATCH_CONSTRUCT:
306  if(argc<1 || !is_variant(argv[0]) || V_VT(get_variant(argv[0])) != (VT_ARRAY|VT_VARIANT))
308 
309  hres = alloc_vbarray(ctx, NULL, &vbarray);
310  if(FAILED(hres))
311  return hres;
312 
313  hres = SafeArrayCopy(V_ARRAY(get_variant(argv[0])), &vbarray->safearray);
314  if(FAILED(hres)) {
315  jsdisp_release(&vbarray->dispex);
316  return hres;
317  }
318 
319  *r = jsval_obj(&vbarray->dispex);
320  break;
321 
322  default:
323  FIXME("unimplemented flags: %x\n", flags);
324  return E_NOTIMPL;
325  }
326 
327  return S_OK;
328 }
static int argc
Definition: ServiceArgs.c:12
SAFEARRAY * safearray
Definition: vbarray.c:28
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define V_ARRAY(A)
Definition: oleauto.h:222
#define argv
Definition: mplay32.c:18
#define DISPATCH_METHOD
Definition: oleauto.h:1006
static BOOL is_variant(jsval_t v)
Definition: jsval.h:200
HRESULT jsval_copy(jsval_t v, jsval_t *r)
Definition: jsutils.c:231
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBArrayInstance **ret)
Definition: vbarray.c:267
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut)
Definition: safearray.c:1379
#define JS_E_VBARRAY_EXPECTED
Definition: jscript.h:559
GLbitfield flags
Definition: glext.h:7161
static VARIANT * get_variant(jsval_t v)
Definition: jsval.h:234
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440
jsdisp_t dispex
Definition: vbarray.c:26

Referenced by create_vbarray_constr().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( jscript  )

Variable Documentation

◆ dimensionsW

const WCHAR dimensionsW[] = {'d','i','m','e','n','s','i','o','n','s',0}
static

Definition at line 31 of file vbarray.c.

◆ getItemW

const WCHAR getItemW[] = {'g','e','t','I','t','e','m',0}
static

Definition at line 32 of file vbarray.c.

◆ lboundW

const WCHAR lboundW[] = {'l','b','o','u','n','d',0}
static

Definition at line 33 of file vbarray.c.

◆ toArrayW

const WCHAR toArrayW[] = {'t','o','A','r','r','a','y',0}
static

Definition at line 34 of file vbarray.c.

◆ uboundW

const WCHAR uboundW[] = {'u','b','o','u','n','d',0}
static

Definition at line 35 of file vbarray.c.

◆ VBArray_info

const builtin_info_t VBArray_info
static
Initial value:
= {
}
static const builtin_prop_t VBArray_props[]
Definition: vbarray.c:250
smooth NULL
Definition: ftsmooth.c:416
static void VBArray_destructor(jsdisp_t *dispex)
Definition: vbarray.c:242
static HRESULT VBArray_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: vbarray.c:228
#define ARRAY_SIZE(a)
Definition: main.h:24

Definition at line 258 of file vbarray.c.

Referenced by alloc_vbarray().

◆ VBArray_props

const builtin_prop_t VBArray_props[]
static
Initial value:
= {
}
static HRESULT VBArray_dimensions(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: vbarray.c:52
static const WCHAR lboundW[]
Definition: vbarray.c:33
static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: vbarray.c:68
static const WCHAR getItemW[]
Definition: vbarray.c:32
static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: vbarray.c:111
static const WCHAR dimensionsW[]
Definition: vbarray.c:31
static const WCHAR toArrayW[]
Definition: vbarray.c:34
static const WCHAR uboundW[]
Definition: vbarray.c:35
static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: vbarray.c:197
#define PROPF_METHOD
Definition: jscript.h:97
static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: vbarray.c:142

Definition at line 250 of file vbarray.c.