ReactOS 0.4.17-dev-281-g9de2895
arraybuf.c File Reference
#include <limits.h>
#include "jscript.h"
#include "wine/debug.h"
Include dependency graph for arraybuf.c:

Go to the source code of this file.

Classes

struct  ArrayBufferInstance
 
struct  DataViewInstance
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (jscript)
 
static ArrayBufferInstancearraybuf_from_jsdisp (jsdisp_t *jsdisp)
 
static DataViewInstancedataview_from_jsdisp (jsdisp_t *jsdisp)
 
static ArrayBufferInstancearraybuf_this (jsval_t vthis)
 
static HRESULT create_arraybuf (script_ctx_t *, DWORD, ArrayBufferInstance **)
 
static HRESULT ArrayBuffer_get_byteLength (script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
 
static HRESULT ArrayBuffer_slice (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT ArrayBufferConstr_isView (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT ArrayBufferConstr_value (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static DataViewInstancedataview_this (jsval_t vthis)
 
static HRESULT DataView_get_buffer (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_get_byteLength (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_get_byteOffset (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static void copy_type_data (void *dst, const void *src, unsigned type_size, BOOL little_endian)
 
static HRESULT get_data (script_ctx_t *ctx, jsval_t vthis, unsigned argc, jsval_t *argv, unsigned type_size, void *ret)
 
static HRESULT set_data (script_ctx_t *ctx, jsval_t vthis, unsigned argc, jsval_t *argv, unsigned type_size, const void *val)
 
static HRESULT DataView_getFloat32 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_getFloat64 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_getInt8 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_getInt16 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_getInt32 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_getUint8 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_getUint16 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_getUint32 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_setFloat32 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_setFloat64 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_setInt8 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_setInt16 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT DataView_setInt32 (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static void DataView_destructor (jsdisp_t *dispex)
 
static HRESULT DataView_gc_traverse (struct gc_ctx *gc_ctx, enum gc_traverse_op op, jsdisp_t *dispex)
 
static HRESULT DataViewConstr_value (script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
HRESULT init_arraybuf_constructors (script_ctx_t *ctx)
 

Variables

static const builtin_prop_t ArrayBuffer_props []
 
static const builtin_info_t ArrayBuffer_info
 
static const builtin_prop_t ArrayBufferInst_props []
 
static const builtin_info_t ArrayBufferInst_info
 
static const builtin_prop_t ArrayBufferConstr_props []
 
static const builtin_info_t ArrayBufferConstr_info
 
static const builtin_prop_t DataView_props []
 
static const builtin_info_t DataView_info
 
static const builtin_info_t DataViewInst_info
 
static const builtin_info_t DataViewConstr_info
 

Function Documentation

◆ arraybuf_from_jsdisp()

static ArrayBufferInstance * arraybuf_from_jsdisp ( jsdisp_t jsdisp)
inlinestatic

Definition at line 47 of file arraybuf.c.

48{
49 return CONTAINING_RECORD(jsdisp, ArrayBufferInstance, dispex);
50}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by arraybuf_this(), and ArrayBuffer_get_byteLength().

◆ arraybuf_this()

static ArrayBufferInstance * arraybuf_this ( jsval_t  vthis)
inlinestatic

Definition at line 57 of file arraybuf.c.

58{
59 jsdisp_t *jsdisp = is_object_instance(vthis) ? to_jsdisp(get_object(vthis)) : NULL;
60 return (jsdisp && is_class(jsdisp, JSCLASS_ARRAYBUFFER)) ? arraybuf_from_jsdisp(jsdisp) : NULL;
61}
static ArrayBufferInstance * arraybuf_from_jsdisp(jsdisp_t *jsdisp)
Definition: arraybuf.c:47
#define NULL
Definition: types.h:112
jsdisp_t * to_jsdisp(IDispatch *disp)
Definition: dispex.c:2447
@ JSCLASS_ARRAYBUFFER
Definition: jscript.h:119
static BOOL is_class(jsdisp_t *jsdisp, jsclass_t class)
Definition: jscript.h:503
static IDispatch * get_object(jsval_t v)
Definition: jsval.h:228
static BOOL is_object_instance(jsval_t v)
Definition: jsval.h:175

Referenced by ArrayBuffer_slice(), and DataViewConstr_value().

◆ ArrayBuffer_get_byteLength()

static HRESULT ArrayBuffer_get_byteLength ( script_ctx_t ctx,
jsdisp_t jsthis,
jsval_t r 
)
static

Definition at line 65 of file arraybuf.c.

66{
67 TRACE("%p\n", jsthis);
68
70 return S_OK;
71}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizeiptr size
Definition: glext.h:5919
#define S_OK
Definition: intsafe.h:52
static jsval_t jsval_number(double n)
Definition: jsval.h:153
#define TRACE(s)
Definition: solgame.cpp:4

◆ ArrayBuffer_slice()

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

Definition at line 73 of file arraybuf.c.

75{
76 ArrayBufferInstance *arraybuf, *ret;
77 DWORD begin = 0, end, size;
79 double n;
80
81 TRACE("\n");
82
83 if(!(arraybuf = arraybuf_this(vthis)))
85 end = arraybuf->size;
86 if(!r)
87 return S_OK;
88
89 if(argc) {
90 hres = to_integer(ctx, argv[0], &n);
91 if(FAILED(hres))
92 return hres;
93 if(n < 0.0)
94 n += arraybuf->size;
95 if(n >= 0.0 && n < arraybuf->size) {
96 begin = n;
97 if(argc > 1 && !is_undefined(argv[1])) {
98 hres = to_integer(ctx, argv[1], &n);
99 if(FAILED(hres))
100 return hres;
101 if(n < 0.0)
102 n += arraybuf->size;
103 if(n >= 0.0) {
104 end = n < arraybuf->size ? n : arraybuf->size;
105 end = end < begin ? begin : end;
106 }else
107 end = begin;
108 }
109 }else
110 end = 0;
111 }
112
113 size = end - begin;
115 if(FAILED(hres))
116 return hres;
117 memcpy(ret->buf, arraybuf->buf + begin, size);
118
119 *r = jsval_obj(&ret->dispex);
120 return S_OK;
121}
static ArrayBufferInstance * arraybuf_this(jsval_t vthis)
Definition: arraybuf.c:57
static HRESULT create_arraybuf(script_ctx_t *, DWORD, ArrayBufferInstance **)
Definition: arraybuf.c:144
MonoAssembly int argc
Definition: metahost.c:107
return ret
Definition: mutex.c:146
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
#define FAILED(hr)
Definition: intsafe.h:51
#define JS_E_ARRAYBUFFER_EXPECTED
Definition: jscript.h:584
HRESULT to_integer(script_ctx_t *, jsval_t, double *)
Definition: jsutils.c:676
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
static BOOL is_undefined(jsval_t v)
Definition: jsval.h:180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HRESULT hres
Definition: protocol.c:465
#define argv
Definition: mplay32.c:18

◆ ArrayBufferConstr_isView()

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

Definition at line 163 of file arraybuf.c.

165{
166 FIXME("not implemented\n");
167
168 return E_NOTIMPL;
169}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ArrayBufferConstr_value()

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

Definition at line 171 of file arraybuf.c.

173{
174 ArrayBufferInstance *arraybuf;
175 DWORD size = 0;
177
178 TRACE("\n");
179
180 switch(flags) {
181 case DISPATCH_METHOD:
182 case DISPATCH_CONSTRUCT: {
183 if(argc) {
184 double n;
185 hres = to_integer(ctx, argv[0], &n);
186 if(FAILED(hres))
187 return hres;
188 if(n < 0.0)
189 return JS_E_INVALID_LENGTH;
191 return E_OUTOFMEMORY;
192 size = n;
193 }
194
195 if(r) {
196 hres = create_arraybuf(ctx, size, &arraybuf);
197 if(FAILED(hres))
198 return hres;
199 *r = jsval_obj(&arraybuf->dispex);
200 }
201 break;
202 }
203 default:
204 FIXME("unimplemented flags: %x\n", flags);
205 return E_NOTIMPL;
206 }
207
208 return S_OK;
209}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define UINT_MAX
Definition: limits.h:27
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
#define JS_E_INVALID_LENGTH
Definition: jscript.h:571
#define DISPATCH_METHOD
Definition: oleauto.h:1006
jsdisp_t dispex
Definition: arraybuf.c:29
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by init_arraybuf_constructors().

◆ copy_type_data()

static void copy_type_data ( void dst,
const void src,
unsigned  type_size,
BOOL  little_endian 
)
inlinestatic

Definition at line 267 of file arraybuf.c.

268{
269 const BYTE *in = src;
270 BYTE *out = dst;
271 unsigned i;
272
273 if(little_endian)
274 memcpy(out, in, type_size);
275 else
276 for(i = 0; i < type_size; i++)
277 out[i] = in[type_size - i - 1];
278}
GLenum src
Definition: glext.h:6340
GLuint in
Definition: glext.h:9616
GLenum GLenum dst
Definition: glext.h:6340
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
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
unsigned char BYTE
Definition: xxhash.c:193

Referenced by get_data(), and set_data().

◆ create_arraybuf()

static HRESULT create_arraybuf ( script_ctx_t ctx,
DWORD  size,
ArrayBufferInstance **  ret 
)
static

Definition at line 144 of file arraybuf.c.

145{
146 ArrayBufferInstance *arraybuf;
148
149 if(!(arraybuf = calloc(1, FIELD_OFFSET(ArrayBufferInstance, buf[size]))))
150 return E_OUTOFMEMORY;
151
152 hres = init_dispex_from_constr(&arraybuf->dispex, ctx, &ArrayBufferInst_info, ctx->arraybuf_constr);
153 if(FAILED(hres)) {
154 free(arraybuf);
155 return hres;
156 }
157 arraybuf->size = size;
158
159 *ret = arraybuf;
160 return S_OK;
161}
static const builtin_info_t ArrayBufferInst_info
Definition: arraybuf.c:138
#define free
Definition: debug_ros.c:5
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:2512
#define calloc
Definition: rosglue.h:14

Referenced by ArrayBuffer_slice(), ArrayBufferConstr_value(), and init_arraybuf_constructors().

◆ DataView_destructor()

static void DataView_destructor ( jsdisp_t dispex)
static

Definition at line 595 of file arraybuf.c.

596{
598 if(view->buffer)
599 jsdisp_release(&view->buffer->dispex);
600}
static DataViewInstance * dataview_from_jsdisp(jsdisp_t *jsdisp)
Definition: arraybuf.c:52
ULONG jsdisp_release(jsdisp_t *obj)
Definition: dispex.c:1911

◆ dataview_from_jsdisp()

static DataViewInstance * dataview_from_jsdisp ( jsdisp_t jsdisp)
inlinestatic

Definition at line 52 of file arraybuf.c.

53{
54 return CONTAINING_RECORD(jsdisp, DataViewInstance, dispex);
55}

Referenced by DataView_destructor(), DataView_gc_traverse(), and dataview_this().

◆ DataView_gc_traverse()

static HRESULT DataView_gc_traverse ( struct gc_ctx gc_ctx,
enum gc_traverse_op  op,
jsdisp_t dispex 
)
static

Definition at line 602 of file arraybuf.c.

603{
605 return gc_process_linked_obj(gc_ctx, op, dispex, &view->buffer->dispex, (void**)&view->buffer);
606}
UINT op
Definition: effect.c:236
HRESULT gc_process_linked_obj(struct gc_ctx *gc_ctx, enum gc_traverse_op op, jsdisp_t *obj, jsdisp_t *link, void **unlink_ref)
Definition: dispex.c:1124
Definition: dispex.c:889

◆ DataView_get_buffer()

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

Definition at line 228 of file arraybuf.c.

230{
232
233 TRACE("\n");
234
235 if(!(view = dataview_this(vthis)))
236 return JS_E_NOT_DATAVIEW;
237 if(r) *r = jsval_obj(jsdisp_addref(&view->buffer->dispex));
238 return S_OK;
239}
static DataViewInstance * dataview_this(jsval_t vthis)
Definition: arraybuf.c:222
jsdisp_t * jsdisp_addref(jsdisp_t *obj)
Definition: dispex.c:1902
#define JS_E_NOT_DATAVIEW
Definition: jscript.h:578

Referenced by init_arraybuf_constructors().

◆ DataView_get_byteLength()

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

Definition at line 241 of file arraybuf.c.

243{
245
246 TRACE("\n");
247
248 if(!(view = dataview_this(vthis)))
249 return JS_E_NOT_DATAVIEW;
250 if(r) *r = jsval_number(view->size);
251 return S_OK;
252}

Referenced by init_arraybuf_constructors().

◆ DataView_get_byteOffset()

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

Definition at line 254 of file arraybuf.c.

256{
258
259 TRACE("\n");
260
261 if(!(view = dataview_this(vthis)))
262 return JS_E_NOT_DATAVIEW;
263 if(r) *r = jsval_number(view->offset);
264 return S_OK;
265}

Referenced by init_arraybuf_constructors().

◆ DataView_getFloat32()

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

Definition at line 358 of file arraybuf.c.

359{
361 float v;
362
363 TRACE("\n");
364
365 hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v);
366 if(FAILED(hres))
367 return hres;
368 if(r) *r = jsval_number(v);
369 return S_OK;
370}
static HRESULT get_data(script_ctx_t *ctx, jsval_t vthis, unsigned argc, jsval_t *argv, unsigned type_size, void *ret)
Definition: arraybuf.c:280
const GLdouble * v
Definition: gl.h:2040

◆ DataView_getFloat64()

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

Definition at line 372 of file arraybuf.c.

373{
375 double v;
376
377 TRACE("\n");
378
379 hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v);
380 if(FAILED(hres))
381 return hres;
382 if(r) *r = jsval_number(v);
383 return S_OK;
384}

◆ DataView_getInt16()

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

Definition at line 400 of file arraybuf.c.

401{
403 INT16 v;
404
405 TRACE("\n");
406
407 hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v);
408 if(FAILED(hres))
409 return hres;
410 if(r) *r = jsval_number(v);
411 return S_OK;
412}
short INT16
Definition: actypes.h:130

◆ DataView_getInt32()

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

Definition at line 414 of file arraybuf.c.

415{
417 INT32 v;
418
419 TRACE("\n");
420
421 hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v);
422 if(FAILED(hres))
423 return hres;
424 if(r) *r = jsval_number(v);
425 return S_OK;
426}
int32_t INT32
Definition: typedefs.h:58

◆ DataView_getInt8()

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

Definition at line 386 of file arraybuf.c.

387{
389 INT8 v;
390
391 TRACE("\n");
392
393 hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v);
394 if(FAILED(hres))
395 return hres;
396 if(r) *r = jsval_number(v);
397 return S_OK;
398}
signed char INT8
Definition: basetsd.h:183

◆ DataView_getUint16()

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

Definition at line 442 of file arraybuf.c.

443{
445 UINT16 v;
446
447 TRACE("\n");
448
449 hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v);
450 if(FAILED(hres))
451 return hres;
452 if(r) *r = jsval_number(v);
453 return S_OK;
454}
unsigned short UINT16
Definition: actypes.h:129

◆ DataView_getUint32()

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

Definition at line 456 of file arraybuf.c.

457{
459 UINT32 v;
460
461 TRACE("\n");
462
463 hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v);
464 if(FAILED(hres))
465 return hres;
466 if(r) *r = jsval_number(v);
467 return S_OK;
468}
uint32_t UINT32
Definition: typedefs.h:59

◆ DataView_getUint8()

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

Definition at line 428 of file arraybuf.c.

429{
431 UINT8 v;
432
433 TRACE("\n");
434
435 hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v);
436 if(FAILED(hres))
437 return hres;
438 if(r) *r = jsval_number(v);
439 return S_OK;
440}
unsigned char UINT8
Definition: actypes.h:128

◆ DataView_setFloat32()

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

Definition at line 470 of file arraybuf.c.

471{
473 double n;
474 float v;
475
476 TRACE("\n");
477
478 if(argc < 2)
480 hres = to_number(ctx, argv[1], &n);
481 if(FAILED(hres))
482 return hres;
483 v = n; /* FIXME: don't assume rounding mode is round-to-nearest ties-to-even */
484
485 hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v);
486 if(FAILED(hres))
487 return hres;
488 if(r) *r = jsval_undefined();
489 return S_OK;
490}
static HRESULT set_data(script_ctx_t *ctx, jsval_t vthis, unsigned argc, jsval_t *argv, unsigned type_size, const void *val)
Definition: arraybuf.c:319
#define JS_E_DATAVIEW_NO_ARGUMENT
Definition: jscript.h:579
HRESULT to_number(script_ctx_t *, jsval_t, double *)
Definition: jsutils.c:630
static jsval_t jsval_undefined(void)
Definition: jsval.h:146

◆ DataView_setFloat64()

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

Definition at line 492 of file arraybuf.c.

493{
495 double v;
496
497 TRACE("\n");
498
499 if(argc < 2)
501 hres = to_number(ctx, argv[1], &v);
502 if(FAILED(hres))
503 return hres;
504
505 hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v);
506 if(FAILED(hres))
507 return hres;
508 if(r) *r = jsval_undefined();
509 return S_OK;
510}

◆ DataView_setInt16()

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

Definition at line 534 of file arraybuf.c.

535{
537 INT32 n;
538 INT16 v;
539
540 TRACE("\n");
541
542 if(argc < 2)
544 hres = to_int32(ctx, argv[1], &n);
545 if(FAILED(hres))
546 return hres;
547 v = n;
548
549 hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v);
550 if(FAILED(hres))
551 return hres;
552 if(r) *r = jsval_undefined();
553 return S_OK;
554}
HRESULT to_int32(script_ctx_t *, jsval_t, INT *)
Definition: jsutils.c:735

◆ DataView_setInt32()

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

Definition at line 556 of file arraybuf.c.

557{
559 INT32 v;
560
561 TRACE("\n");
562
563 if(argc < 2)
565 hres = to_int32(ctx, argv[1], &v);
566 if(FAILED(hres))
567 return hres;
568
569 hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v);
570 if(FAILED(hres))
571 return hres;
572 if(r) *r = jsval_undefined();
573 return S_OK;
574}

◆ DataView_setInt8()

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

Definition at line 512 of file arraybuf.c.

513{
515 INT32 n;
516 INT8 v;
517
518 TRACE("\n");
519
520 if(argc < 2)
522 hres = to_int32(ctx, argv[1], &n);
523 if(FAILED(hres))
524 return hres;
525 v = n;
526
527 hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v);
528 if(FAILED(hres))
529 return hres;
530 if(r) *r = jsval_undefined();
531 return S_OK;
532}

◆ dataview_this()

static DataViewInstance * dataview_this ( jsval_t  vthis)
inlinestatic

Definition at line 222 of file arraybuf.c.

223{
224 jsdisp_t *jsdisp = is_object_instance(vthis) ? to_jsdisp(get_object(vthis)) : NULL;
225 return (jsdisp && is_class(jsdisp, JSCLASS_DATAVIEW)) ? dataview_from_jsdisp(jsdisp) : NULL;
226}
@ JSCLASS_DATAVIEW
Definition: jscript.h:120

Referenced by DataView_get_buffer(), DataView_get_byteLength(), DataView_get_byteOffset(), get_data(), and set_data().

◆ DataViewConstr_value()

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

Definition at line 622 of file arraybuf.c.

624{
625 ArrayBufferInstance *arraybuf;
627 DWORD offset = 0, size;
629
630 TRACE("\n");
631
632 switch(flags) {
633 case DISPATCH_METHOD:
634 case DISPATCH_CONSTRUCT: {
635 if(!argc || !(arraybuf = arraybuf_this(argv[0])))
637 size = arraybuf->size;
638
639 if(argc > 1) {
640 double offs, len, maxsize = size;
641 hres = to_integer(ctx, argv[1], &offs);
642 if(FAILED(hres))
643 return hres;
644 if(offs < 0.0 || offs > maxsize)
646 offset = offs;
647
648 if(argc > 2 && !is_undefined(argv[2])) {
649 hres = to_integer(ctx, argv[2], &len);
650 if(FAILED(hres))
651 return hres;
652 if(len < 0.0 || offs+len > maxsize)
654 size = len;
655 }else
656 size -= offset;
657 }
658
659 if(!r)
660 return S_OK;
661
662 if(!(view = calloc(1, sizeof(DataViewInstance))))
663 return E_OUTOFMEMORY;
664
665 hres = init_dispex_from_constr(&view->dispex, ctx, &DataViewInst_info, ctx->dataview_constr);
666 if(FAILED(hres)) {
667 free(view);
668 return hres;
669 }
670
671 jsdisp_addref(&arraybuf->dispex);
672 view->buffer = arraybuf;
673 view->offset = offset;
674 view->size = size;
675
676 *r = jsval_obj(&view->dispex);
677 break;
678 }
679 default:
680 FIXME("unimplemented flags: %x\n", flags);
681 return E_NOTIMPL;
682 }
683
684 return S_OK;
685}
static const builtin_info_t DataViewInst_info
Definition: arraybuf.c:616
GLintptr offset
Definition: glext.h:5920
GLenum GLsizei len
Definition: glext.h:6722
#define JS_E_DATAVIEW_INVALID_OFFSET
Definition: jscript.h:581
_In_ size_t const maxsize
Definition: strftime.cpp:120

Referenced by init_arraybuf_constructors().

◆ get_data()

static HRESULT get_data ( script_ctx_t ctx,
jsval_t  vthis,
unsigned  argc,
jsval_t argv,
unsigned  type_size,
void ret 
)
static

Definition at line 280 of file arraybuf.c.

281{
282 BOOL little_endian = FALSE;
286 BYTE *data;
287 double n;
288
289 if(!(view = dataview_this(vthis)))
290 return JS_E_NOT_DATAVIEW;
291 if(!argc || is_undefined(argv[0]))
293
294 hres = to_integer(ctx, argv[0], &n);
295 if(FAILED(hres))
296 return hres;
297
298 if(n < 0.0 || n + type_size > view->size)
300
301 offset = n;
302 data = &view->buffer->buf[view->offset + offset];
303
304 if(type_size == 1) {
305 *(BYTE*)ret = data[0];
306 return S_OK;
307 }
308
309 if(argc > 1) {
310 hres = to_boolean(argv[1], &little_endian);
311 if(FAILED(hres))
312 return hres;
313 }
314
315 copy_type_data(ret, data, type_size, little_endian);
316 return S_OK;
317}
static void copy_type_data(void *dst, const void *src, unsigned type_size, BOOL little_endian)
Definition: arraybuf.c:267
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define JS_E_DATAVIEW_INVALID_ACCESS
Definition: jscript.h:580
HRESULT to_boolean(jsval_t, BOOL *)
Definition: jsutils.c:489

Referenced by DataView_getFloat32(), DataView_getFloat64(), DataView_getInt16(), DataView_getInt32(), DataView_getInt8(), DataView_getUint16(), DataView_getUint32(), DataView_getUint8(), and test_put_data().

◆ init_arraybuf_constructors()

HRESULT init_arraybuf_constructors ( script_ctx_t ctx)

Definition at line 692 of file arraybuf.c.

693{
694 static const struct {
695 const WCHAR *name;
697 } DataView_getters[] = {
698 { L"buffer", DataView_get_buffer },
699 { L"byteLength", DataView_get_byteLength },
700 { L"byteOffset", DataView_get_byteOffset },
701 };
702 ArrayBufferInstance *arraybuf;
706 unsigned i;
707
708 if(ctx->version < SCRIPTLANGUAGEVERSION_ES5)
709 return S_OK;
710
711 if(!(arraybuf = calloc(1, FIELD_OFFSET(ArrayBufferInstance, buf[0]))))
712 return E_OUTOFMEMORY;
713
714 hres = init_dispex(&arraybuf->dispex, ctx, &ArrayBuffer_info, ctx->object_prototype);
715 if(FAILED(hres)) {
716 free(arraybuf);
717 return hres;
718 }
719
721 PROPF_CONSTR|1, &arraybuf->dispex, &ctx->arraybuf_constr);
722 jsdisp_release(&arraybuf->dispex);
723 if(FAILED(hres))
724 return hres;
725
727 jsval_obj(ctx->arraybuf_constr));
728 if(FAILED(hres))
729 return hres;
730
731 if(!(view = calloc(1, sizeof(DataViewInstance))))
732 return E_OUTOFMEMORY;
733
734 hres = create_arraybuf(ctx, 0, &view->buffer);
735 if(FAILED(hres)) {
736 free(view);
737 return hres;
738 }
739
740 hres = init_dispex(&view->dispex, ctx, &DataView_info, ctx->object_prototype);
741 if(FAILED(hres)) {
742 jsdisp_release(&view->buffer->dispex);
743 free(view);
744 return hres;
745 }
746
747 desc.flags = PROPF_CONFIGURABLE;
749 desc.explicit_getter = desc.explicit_setter = TRUE;
750 desc.explicit_value = FALSE;
751 desc.setter = NULL;
752
753 /* FIXME: If we find we need builtin accessors in other places, we should consider a more generic solution */
754 for(i = 0; i < ARRAY_SIZE(DataView_getters); i++) {
755 hres = create_builtin_function(ctx, DataView_getters[i].get, NULL, NULL, PROPF_METHOD, NULL, &desc.getter);
756 if(SUCCEEDED(hres)) {
757 hres = jsdisp_define_property(&view->dispex, DataView_getters[i].name, &desc);
758 jsdisp_release(desc.getter);
759 }
760 if(FAILED(hres)) {
761 jsdisp_release(&view->dispex);
762 return hres;
763 }
764 }
765
767 PROPF_CONSTR|1, &view->dispex, &ctx->dataview_constr);
768 jsdisp_release(&view->dispex);
769 if(FAILED(hres))
770 return hres;
771
773 jsval_obj(ctx->dataview_constr));
774
775 return hres;
776}
static HRESULT ArrayBufferConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:171
static const builtin_info_t DataView_info
Definition: arraybuf.c:608
static const builtin_info_t ArrayBufferConstr_info
Definition: arraybuf.c:215
static HRESULT DataView_get_byteLength(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:241
static const builtin_info_t DataViewConstr_info
Definition: arraybuf.c:687
static HRESULT DataViewConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:622
static const builtin_info_t ArrayBuffer_info
Definition: arraybuf.c:128
static HRESULT DataView_get_byteOffset(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:254
static HRESULT DataView_get_buffer(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:228
void get(int argc, const char *argv[])
Definition: cmds.c:480
#define ARRAY_SIZE(A)
Definition: main.h:20
#define TRUE
Definition: types.h:120
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:809
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:773
#define L(x)
Definition: resources.c:13
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:3349
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:2454
HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t *desc)
Definition: dispex.c:3216
#define SCRIPTLANGUAGEVERSION_ES5
Definition: jscript.h:53
HRESULT(* builtin_invoke_t)(script_ctx_t *, jsval_t, WORD, unsigned, jsval_t *, jsval_t *)
Definition: jscript.h:129
const unsigned int PROPF_WRITABLE
Definition: jsdisp.idl:37
const unsigned int PROPF_ENUMERABLE
Definition: jsdisp.idl:36
const unsigned int PROPF_CONFIGURABLE
Definition: jsdisp.idl:38
const unsigned int PROPF_METHOD
Definition: jsdisp.idl:33
const unsigned int PROPF_CONSTR
Definition: jsdisp.idl:34
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1204
short WCHAR
Definition: pedump.c:58
Definition: name.c:39

Referenced by init_global().

◆ set_data()

static HRESULT set_data ( script_ctx_t ctx,
jsval_t  vthis,
unsigned  argc,
jsval_t argv,
unsigned  type_size,
const void val 
)
static

Definition at line 319 of file arraybuf.c.

320{
321 BOOL little_endian = FALSE;
325 BYTE *data;
326 double n;
327
328 if(!(view = dataview_this(vthis)))
329 return JS_E_NOT_DATAVIEW;
330 if(is_undefined(argv[0]) || is_undefined(argv[1]))
332
333 hres = to_integer(ctx, argv[0], &n);
334 if(FAILED(hres))
335 return hres;
336
337 if(n < 0.0 || n + type_size > view->size)
339
340 offset = n;
341 data = &view->buffer->buf[view->offset + offset];
342
343 if(type_size == 1) {
344 data[0] = *(const BYTE*)val;
345 return S_OK;
346 }
347
348 if(argc > 2) {
349 hres = to_boolean(argv[2], &little_endian);
350 if(FAILED(hres))
351 return hres;
352 }
353
354 copy_type_data(data, val, type_size, little_endian);
355 return S_OK;
356}
GLuint GLfloat * val
Definition: glext.h:7180

Referenced by DataView_setFloat32(), DataView_setFloat64(), DataView_setInt16(), DataView_setInt32(), and DataView_setInt8().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( jscript  )

Variable Documentation

◆ ArrayBuffer_info

const builtin_info_t ArrayBuffer_info
static
Initial value:
= {
}
static const builtin_prop_t ArrayBuffer_props[]
Definition: arraybuf.c:123

Definition at line 128 of file arraybuf.c.

Referenced by init_arraybuf_constructors().

◆ ArrayBuffer_props

const builtin_prop_t ArrayBuffer_props[]
static
Initial value:
= {
{L"byteLength", NULL, 0, ArrayBuffer_get_byteLength},
}
static HRESULT ArrayBuffer_get_byteLength(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: arraybuf.c:65
static HRESULT ArrayBuffer_slice(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:73

Definition at line 123 of file arraybuf.c.

◆ ArrayBufferConstr_info

const builtin_info_t ArrayBufferConstr_info
static
Initial value:
= {
.class = JSCLASS_FUNCTION,
.call = Function_value,
}
static const builtin_prop_t ArrayBufferConstr_props[]
Definition: arraybuf.c:211
HRESULT Function_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: function.c:600
@ JSCLASS_FUNCTION
Definition: jscript.h:109

Definition at line 215 of file arraybuf.c.

Referenced by init_arraybuf_constructors().

◆ ArrayBufferConstr_props

const builtin_prop_t ArrayBufferConstr_props[]
static
Initial value:
= {
}
static HRESULT ArrayBufferConstr_isView(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:163

Definition at line 211 of file arraybuf.c.

◆ ArrayBufferInst_info

const builtin_info_t ArrayBufferInst_info
static
Initial value:
= {
}
static const builtin_prop_t ArrayBufferInst_props[]
Definition: arraybuf.c:134

Definition at line 138 of file arraybuf.c.

Referenced by create_arraybuf().

◆ ArrayBufferInst_props

const builtin_prop_t ArrayBufferInst_props[]
static
Initial value:
= {
{L"byteLength", NULL, 0, ArrayBuffer_get_byteLength},
}

Definition at line 134 of file arraybuf.c.

◆ DataView_info

const builtin_info_t DataView_info
static
Initial value:
= {
.class = JSCLASS_DATAVIEW,
.props_cnt = ARRAY_SIZE(DataView_props),
.props = DataView_props,
.destructor = DataView_destructor,
.gc_traverse = DataView_gc_traverse
}
static HRESULT DataView_gc_traverse(struct gc_ctx *gc_ctx, enum gc_traverse_op op, jsdisp_t *dispex)
Definition: arraybuf.c:602
static void DataView_destructor(jsdisp_t *dispex)
Definition: arraybuf.c:595
static const builtin_prop_t DataView_props[]
Definition: arraybuf.c:576

Definition at line 608 of file arraybuf.c.

Referenced by init_arraybuf_constructors().

◆ DataView_props

const builtin_prop_t DataView_props[]
static
Initial value:
= {
{L"getFloat32", DataView_getFloat32, PROPF_METHOD|1},
{L"getFloat64", DataView_getFloat64, PROPF_METHOD|1},
{L"getInt16", DataView_getInt16, PROPF_METHOD|1},
{L"getInt32", DataView_getInt32, PROPF_METHOD|1},
{L"getUint16", DataView_getUint16, PROPF_METHOD|1},
{L"getUint32", DataView_getUint32, PROPF_METHOD|1},
{L"getUint8", DataView_getUint8, PROPF_METHOD|1},
{L"setFloat32", DataView_setFloat32, PROPF_METHOD|1},
{L"setFloat64", DataView_setFloat64, PROPF_METHOD|1},
{L"setInt16", DataView_setInt16, PROPF_METHOD|1},
{L"setInt32", DataView_setInt32, PROPF_METHOD|1},
{L"setUint16", DataView_setInt16, PROPF_METHOD|1},
{L"setUint32", DataView_setInt32, PROPF_METHOD|1},
{L"setUint8", DataView_setInt8, PROPF_METHOD|1},
}
static HRESULT DataView_getUint16(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:442
static HRESULT DataView_setInt8(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:512
static HRESULT DataView_getUint8(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:428
static HRESULT DataView_getInt32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:414
static HRESULT DataView_getFloat32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:358
static HRESULT DataView_setInt32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:556
static HRESULT DataView_getInt16(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:400
static HRESULT DataView_getUint32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:456
static HRESULT DataView_setInt16(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:534
static HRESULT DataView_getFloat64(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:372
static HRESULT DataView_setFloat64(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:492
static HRESULT DataView_getInt8(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:386
static HRESULT DataView_setFloat32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: arraybuf.c:470

Definition at line 576 of file arraybuf.c.

◆ DataViewConstr_info

const builtin_info_t DataViewConstr_info
static
Initial value:
= {
.class = JSCLASS_FUNCTION,
.call = Function_value,
}

Definition at line 687 of file arraybuf.c.

Referenced by init_arraybuf_constructors().

◆ DataViewInst_info

const builtin_info_t DataViewInst_info
static
Initial value:
= {
.class = JSCLASS_DATAVIEW,
.destructor = DataView_destructor,
.gc_traverse = DataView_gc_traverse
}

Definition at line 616 of file arraybuf.c.

Referenced by DataViewConstr_value().