H3D API  2.4.1
SpiderMonkeyTypes.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
48 //
50 #ifndef __SPIDERMONKEYTYPES_H__
51 #define __SPIDERMONKEYTYPES_H__
52 
53 #include<iostream>
54 
55 #include <H3D/SFMatrix3f.h>
56 #include <H3D/SFMatrix4f.h>
57 #include <H3D/SFFloat.h>
58 #include <H3D/SFDouble.h>
59 #include <H3D/SFTime.h>
60 #include <H3D/SFInt32.h>
61 #include <H3D/SFString.h>
62 #include <H3D/SFVec3f.h>
63 #include <H3D/SFVec3d.h>
64 #include <H3D/SFVec4f.h>
65 #include <H3D/SFVec4d.h>
66 #include <H3D/SFVec2f.h>
67 #include <H3D/SFVec2d.h>
68 #include <H3D/SFColor.h>
69 #include <H3D/SFRotation.h>
70 #include <H3D/SFNode.h>
71 #include <H3D/SFBool.h>
72 #include <H3D/X3DTexture2DNode.h>
73 
74 #include <H3D/MFFloat.h>
75 #include <H3D/MFDouble.h>
76 #include <H3D/MFTime.h>
77 #include <H3D/MFInt32.h>
78 #include <H3D/MFString.h>
79 #include <H3D/MFVec3f.h>
80 #include <H3D/MFVec3d.h>
81 #include <H3D/MFVec2f.h>
82 #include <H3D/MFVec2d.h>
83 #include <H3D/MFVec4f.h>
84 #include <H3D/MFVec4d.h>
85 #include <H3D/MFColor.h>
86 #include <H3D/MFRotation.h>
87 #include <H3D/MFNode.h>
88 #include <H3D/MFBool.h>
89 #include <H3D/SAIFunctions.h>
90 
91 #ifdef HAVE_SPIDERMONKEY
92 
93 // defines needed for include of jsapi.h
94 #ifdef H3D_WINDOWS
95 #define XP_WIN
96 #else // H3D_WINDOWS
97 #define XP_UNIX
98 #endif // H3D_WINDOWS else
99 
100 #include <jsapi.h>
101 
102 namespace H3D {
103  namespace SpiderMonkey {
104 
106  void setJSException( JSContext *cx, const SAI::SAIError &e );
107 
110  bool insertH3DTypes( JSContext *cx, JSObject *obj );
111 
120  jsval jsvalFromField( JSContext* cx, Field *f, bool make_copy,
121  int array_index = -1, X3DTypes::X3DType x3dt = X3DTypes::UNKNOWN_X3D_TYPE );
122 
125  JSBool setFieldValueFromjsval( JSContext* cx, Field *f, jsval v );
126 
128  JSBool haveFunction( JSContext* cx, JSObject *obj, const char * name );
129 
131  template< class PointerType >
133  public:
140  PointerPrivateData( PointerType *_ptr,
141  bool _internal_pointer,
142  int _array_index = -1
143  ):
144  ptr( _ptr ),
145  internal_pointer( _internal_pointer ),
146  array_index( _array_index ),
147  disposed( false ) {
148 
149  }
150 
153  if( ptr && internal_pointer ) {
154  delete ptr;
155  }
156  }
157 
159  inline PointerType *getPointer() {
160  return ptr;
161  }
162 
164  inline bool isDisposed() {
165  return disposed;
166  }
167 
170  inline int getArrayIndex() {
171  return array_index;
172  }
173 
175  inline void dispose() {
176  disposed = true;
177  }
178 
179  protected:
180  PointerType *ptr;
181  bool internal_pointer;
182  bool disposed;
183  int array_index;
184  };
185 
186  typedef PointerPrivateData< Field > FieldObjectPrivate;
187  typedef PointerPrivateData< SAI::ExecutionContext > ExecutionContextPrivate;
188  typedef PointerPrivateData< SAI::Browser > BrowserPrivate;
189 
192  template< class PointerType >
193  void PrivatePointer_finalize(JSContext *cx, JSObject *obj) {
194  PointerType *private_data =
195  static_cast<PointerType *>(JS_GetPrivate(cx,obj));
196  if( private_data ) {
197  delete private_data;
198  }
199  }
200 
204  JSBool FieldObject_toString(JSContext *cx, JSObject *obj,
205  uintN argc, jsval *argv,
206  jsval *rval);
207 
208 
209  template<class FieldType>
210  JSBool FieldObject_toString2(JSContext *cx, JSObject *obj,
211  uintN argc, jsval *argv, jsval *rval);
212 
213 
217 
219  SFVEC2F_X, SFVEC2F_Y, SFVEC2F_Z
220  };
221 
222  JSBool SFVec2f_toString(JSContext *cx, JSObject *obj,
223  uintN argc, jsval *argv,
224  jsval *rval);
225 
226 
234  JSObject *SFVec2f_newInstance( JSContext *cx, Field *field, bool internal_field, int array_index = -1 );
235 
238  JSBool SFVec2f_setProperty(JSContext *cx,
239  JSObject *obj,
240  jsval id,
241  jsval *vp);
242 
245  JSBool SFVec2f_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
246 
249  JSBool SFVec2f_construct(JSContext *cx, JSObject *obj,
250  uintN argc, jsval *argv,
251  jsval *rval);
252 
253  // member functions
254  JSBool SFVec2f_add(JSContext *cx, JSObject *obj,
255  uintN argc, jsval *argv,
256  jsval *rval);
257  JSBool SFVec2f_divide(JSContext *cx, JSObject *obj,
258  uintN argc, jsval *argv,
259  jsval *rval);
260  JSBool SFVec2f_dot(JSContext *cx, JSObject *obj,
261  uintN argc, jsval *argv,
262  jsval *rval);
263  JSBool SFVec2f_length(JSContext *cx, JSObject *obj,
264  uintN argc, jsval *argv,
265  jsval *rval);
266  JSBool SFVec2f_multiple(JSContext *cx, JSObject *obj,
267  uintN argc, jsval *argv,
268  jsval *rval);
269  JSBool SFVec2f_negate(JSContext *cx, JSObject *obj,
270  uintN argc, jsval *argv,
271  jsval *rval);
272  JSBool SFVec2f_normalize(JSContext *cx, JSObject *obj,
273  uintN argc, jsval *argv,
274  jsval *rval);
275  JSBool SFVec2f_subtract(JSContext *cx, JSObject *obj,
276  uintN argc, jsval *argv,
277  jsval *rval);
278 
279  // properties
280  static JSPropertySpec SFVec2f_properties[] = {
281  {"x", SFVEC2F_X, JSPROP_PERMANENT},
282  {"y", SFVEC2F_Y, JSPROP_PERMANENT},
283  {0}
284  };
285 
286  static JSFunctionSpec SFVec2f_functions[] = {
287  {"add", SFVec2f_add, 1, 0, 0 },
288  {"divide", SFVec2f_divide, 1, 0, 0 },
289  {"dot", SFVec2f_dot, 1, 0, 0 },
290  {"length", SFVec2f_length, 0, 0, 0 },
291  {"multiple", SFVec2f_multiple, 1, 0, 0 },
292  {"negate", SFVec2f_negate, 0, 0, 0 },
293  {"normalize", SFVec2f_normalize, 0, 0, 0 },
294  {"subtract", SFVec2f_subtract, 1, 0, 0 },
295  {"toString", SFVec2f_toString, 0, 0, 0 },
296  {0}
297  };
298 
299 
300  static JSClass SFVec2fClass = {
301  "SFVec2f",
302  JSCLASS_HAS_PRIVATE,
303 
304  /* All of these can be replaced with the corresponding JS_*Stub
305  function pointers. */
306  JS_PropertyStub, // add property
307  JS_PropertyStub, // del property
308  SpiderMonkey::SFVec2f_getProperty, // get property
309  SpiderMonkey::SFVec2f_setProperty, // set property
310  JS_EnumerateStub, // enumerate
311  JS_ResolveStub, // resolve
312  JS_ConvertStub, // convert
313  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
314  NULL, // getObjectOps
315  NULL, // checkAccess
316  NULL, // call
317  SFVec2f_construct, // construct
318  NULL, // xdrObject
319  NULL, // hasInstance
320  NULL, // mark
321  NULL //reserveSlots
322  };
323 
327 
329  SFVEC2D_X, SFVEC2D_Y, SFVEC2D_Z
330  };
331 
332  JSBool SFVec2d_toString(JSContext *cx, JSObject *obj,
333  uintN argc, jsval *argv,
334  jsval *rval);
335 
336 
344  JSObject *SFVec2d_newInstance( JSContext *cx, Field *field, bool internal_field, int array_index = -1 );
345 
348  JSBool SFVec2d_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
349 
352  JSBool SFVec2d_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
353 
356  JSBool SFVec2d_construct(JSContext *cx, JSObject *obj,
357  uintN argc, jsval *argv,
358  jsval *rval);
359 
360  // member functions
361  JSBool SFVec2d_add(JSContext *cx, JSObject *obj,
362  uintN argc, jsval *argv,
363  jsval *rval);
364  JSBool SFVec2d_divide(JSContext *cx, JSObject *obj,
365  uintN argc, jsval *argv,
366  jsval *rval);
367  JSBool SFVec2d_dot(JSContext *cx, JSObject *obj,
368  uintN argc, jsval *argv,
369  jsval *rval);
370  JSBool SFVec2d_length(JSContext *cx, JSObject *obj,
371  uintN argc, jsval *argv,
372  jsval *rval);
373  JSBool SFVec2d_multiple(JSContext *cx, JSObject *obj,
374  uintN argc, jsval *argv,
375  jsval *rval);
376  JSBool SFVec2d_negate(JSContext *cx, JSObject *obj,
377  uintN argc, jsval *argv,
378  jsval *rval);
379  JSBool SFVec2d_normalize(JSContext *cx, JSObject *obj,
380  uintN argc, jsval *argv,
381  jsval *rval);
382  JSBool SFVec2d_subtract(JSContext *cx, JSObject *obj,
383  uintN argc, jsval *argv,
384  jsval *rval);
385 
386  // properties
387  static JSPropertySpec SFVec2d_properties[] = {
388  {"x", SFVEC2D_X, JSPROP_PERMANENT},
389  {"y", SFVEC2D_Y, JSPROP_PERMANENT},
390  {0}
391  };
392 
393  static JSFunctionSpec SFVec2d_functions[] = {
394  {"add", SFVec2d_add, 1, 0, 0 },
395  {"divide", SFVec2d_divide, 1, 0, 0 },
396  {"dot", SFVec2d_dot, 1, 0, 0 },
397  {"length", SFVec2d_length, 0, 0, 0 },
398  {"multiple", SFVec2d_multiple, 1, 0, 0 },
399  {"negate", SFVec2d_negate, 0, 0, 0 },
400  {"normalize", SFVec2d_normalize, 0, 0, 0 },
401  {"subtract", SFVec2d_subtract, 1, 0, 0 },
402  {"toString", SFVec2d_toString, 0, 0, 0 },
403  {0}
404  };
405 
406 
407  static JSClass SFVec2dClass = {
408  "SFVec2d",
409  JSCLASS_HAS_PRIVATE,
410 
411  /* All of these can be replaced with the corresponding JS_*Stub
412  function pointers. */
413  JS_PropertyStub, // add property
414  JS_PropertyStub, // del property
415  SpiderMonkey::SFVec2d_getProperty, // get property
416  SpiderMonkey::SFVec2d_setProperty, // set property
417  JS_EnumerateStub, // enumerate
418  JS_ResolveStub, // resolve
419  JS_ConvertStub, // convert
420  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
421  NULL, // getObjectOps
422  NULL, // checkAccess
423  NULL, // call
424  SFVec2d_construct, // construct
425  NULL, // xdrObject
426  NULL, // hasInstance
427  NULL, // mark
428  NULL //reserveSlots
429  };
430 
431 
432 
433 
437 
439 
440  enum SFImagePropertyId {
441  SFImage_WIDTH, SFImage_HEIGHT, SFImage_COMP, SFImage_ARRAY,
442  };
443 
444  JSBool SFImage_toString(JSContext *cx, JSObject *obj,
445  uintN argc, jsval *argv, jsval *rval);
446 
447 
455  JSObject *SFImage_newInstance( JSContext *cx, /*SFImage*/ Field *field, bool internal_field, int array_index = -1 );
456 
459  JSBool SFImage_setProperty(JSContext *cx, JSObject *obj,
460  jsval id, jsval *vp);
461 
464  JSBool SFImage_getProperty(JSContext *cx, JSObject *obj,
465  jsval id, jsval *vp);
466 
469  JSBool SFImage_construct(JSContext *cx, JSObject *obj,
470  uintN argc, jsval *argv,
471  jsval *rval);
472 
473  JSBool SFImage_toString(JSContext *cx, JSObject *obj,
474  uintN argc, jsval *argv,
475  jsval *rval);
476 
477 
478  // properties
479  static JSPropertySpec SFImage_properties[] = {
480  {"width", SFImage_WIDTH, JSPROP_PERMANENT},
481  {"height", SFImage_HEIGHT, JSPROP_PERMANENT},
482  {"comp", SFImage_COMP, JSPROP_PERMANENT},
483  {"array", SFImage_ARRAY, JSPROP_PERMANENT},
484  {0}
485  };
486 
487  static JSFunctionSpec SFImage_functions[] = {
488  {"toString", SFImage_toString, 0, 0, 0 },
489  {0}
490  };
491 
492 
493  static JSClass SFImageClass = {
494  "SFImage",
495  JSCLASS_HAS_PRIVATE,
496 
497  /* All of these can be replaced with the corresponding JS_*Stub
498  function pointers. */
499  JS_PropertyStub, // add property
500  JS_PropertyStub, // del property
501  SpiderMonkey::SFImage_getProperty, // get property
502  SpiderMonkey::SFImage_setProperty, // set property
503  JS_EnumerateStub, // enumerate
504  JS_ResolveStub, // resolve
505  JS_ConvertStub, // convert
506  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
507  NULL, // getObjectOps
508  NULL, // checkAccess
509  NULL, // call
510  SFImage_construct, // construct
511  NULL, // xdrObject
512  NULL, // hasInstance
513  NULL, // mark
514  NULL //reserveSlots
515  };
516 
517 
521 
523  SFVEC3F_X, SFVEC3F_Y, SFVEC3F_Z
524  };
525 
526  JSBool SFVec3f_toString(JSContext *cx, JSObject *obj,
527  uintN argc, jsval *argv,
528  jsval *rval);
529 
530 
538  JSObject *SFVec3f_newInstance( JSContext *cx, Field *field, bool internal_field, int array_index = -1 );
539 
542  JSBool SFVec3f_setProperty(JSContext *cx,
543  JSObject *obj,
544  jsval id,
545  jsval *vp);
546 
549  JSBool SFVec3f_getProperty(JSContext *cx,
550  JSObject *obj,
551  jsval id,
552  jsval *vp);
553 
556  JSBool SFVec3f_construct(JSContext *cx, JSObject *obj,
557  uintN argc, jsval *argv,
558  jsval *rval);
559 
560  // member functions
561  JSBool SFVec3f_add(JSContext *cx, JSObject *obj,
562  uintN argc, jsval *argv,
563  jsval *rval);
564  JSBool SFVec3f_cross(JSContext *cx, JSObject *obj,
565  uintN argc, jsval *argv,
566  jsval *rval);
567  JSBool SFVec3f_divide(JSContext *cx, JSObject *obj,
568  uintN argc, jsval *argv,
569  jsval *rval);
570  JSBool SFVec3f_dot(JSContext *cx, JSObject *obj,
571  uintN argc, jsval *argv,
572  jsval *rval);
573  JSBool SFVec3f_length(JSContext *cx, JSObject *obj,
574  uintN argc, jsval *argv,
575  jsval *rval);
576  JSBool SFVec3f_multiple(JSContext *cx, JSObject *obj,
577  uintN argc, jsval *argv,
578  jsval *rval);
579  JSBool SFVec3f_negate(JSContext *cx, JSObject *obj,
580  uintN argc, jsval *argv,
581  jsval *rval);
582  JSBool SFVec3f_normalize(JSContext *cx, JSObject *obj,
583  uintN argc, jsval *argv,
584  jsval *rval);
585  JSBool SFVec3f_subtract(JSContext *cx, JSObject *obj,
586  uintN argc, jsval *argv,
587  jsval *rval);
588 
589  // properties
590  static JSPropertySpec SFVec3f_properties[] = {
591  {"x", SFVEC3F_X, JSPROP_PERMANENT},
592  {"y", SFVEC3F_Y, JSPROP_PERMANENT},
593  {"z", SFVEC3F_Z, JSPROP_PERMANENT},
594  {0}
595  };
596 
597  static JSFunctionSpec SFVec3f_functions[] = {
598  {"add", SFVec3f_add, 1, 0, 0 },
599  {"cross", SFVec3f_cross, 1, 0, 0 },
600  {"divide", SFVec3f_divide, 1, 0, 0 },
601  {"dot", SFVec3f_dot, 1, 0, 0 },
602  {"length", SFVec3f_length, 0, 0, 0 },
603  {"multiple", SFVec3f_multiple, 1, 0, 0 },
604  {"negate", SFVec3f_negate, 0, 0, 0 },
605  {"normalize", SFVec3f_normalize, 0, 0, 0 },
606  {"subtract", SFVec3f_subtract, 1, 0, 0 },
607  {"toString", SFVec3f_toString, 0, 0, 0 },
608  {0}
609  };
610 
611 
612  static JSClass SFVec3fClass = {
613  "SFVec3f",
614  JSCLASS_HAS_PRIVATE,
615 
616  /* All of these can be replaced with the corresponding JS_*Stub
617  function pointers. */
618  JS_PropertyStub, // add property
619  JS_PropertyStub, // del property
620  SpiderMonkey::SFVec3f_getProperty, // get property
621  SpiderMonkey::SFVec3f_setProperty, // set property
622  JS_EnumerateStub, // enumerate
623  JS_ResolveStub, // resolve
624  JS_ConvertStub, // convert
625  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
626  NULL, // getObjectOps
627  NULL, // checkAccess
628  NULL, // call
629  SFVec3f_construct, // construct
630  NULL, // xdrObject
631  NULL, // hasInstance
632  NULL, // mark
633  NULL //reserveSlots
634  };
635 
636 
637 
641 
642  class SFMatrix3fRow : public Field {
643  public:
644  SFMatrix3fRow() : sfmatrix( NULL ), row( 0 ) { }
645  SFMatrix3fRow(SFMatrix3f* _sfmatrix, int _row) : row(_row), sfmatrix(_sfmatrix) { }
646  SFMatrix3f* sfmatrix;
647  int row;
648  };
649 
650  JSBool SFMatrix3fRow_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
651  JSBool SFMatrix3fRow_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
652  JSBool SFMatrix3fRow_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
653  JSBool SFMatrix3fRow_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
654  JSObject *SFMatrix3fRow_newInstance( JSContext *cx, Field *field, bool internal_field );
655 
656  enum SFMatrix3fRowPropertyId {
657  };
658 
659  static JSPropertySpec SFMatrix3fRow_properties[] = {
660  {0}
661  };
662 
663  static JSFunctionSpec SFMatrix3fRow_functions[] = {
664  {"toString", SFMatrix3fRow_toString , 0, 0, 0 },
665  {0}
666  };
667  static JSClass SFMatrix3fRowClass = {
668  "SFMatrix3fRow",
669  JSCLASS_HAS_PRIVATE,
670 
671  /* All of these can be replaced with the corresponding JS_*Stub
672  function pointers. */
673  JS_PropertyStub, // add property
674  JS_PropertyStub, // del property
675  SpiderMonkey::SFMatrix3fRow_getProperty, // get property
676  SpiderMonkey::SFMatrix3fRow_setProperty, // set property
677  JS_EnumerateStub, // enumerate
678  JS_ResolveStub, // resolve
679  JS_ConvertStub, // convert
680  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
681  NULL, // getObjectOps
682  NULL, // checkAccess
683  NULL, // call
684  NULL, // construct
685  NULL, // xdrObject
686  NULL, // hasInstance
687  NULL, // mark
688  NULL //reserveSlots
689  };
690 
691  JSBool X3DMatrix3_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
692  JSBool X3DMatrix3_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
693  JSBool X3DMatrix3_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
694  JSBool X3DMatrix3_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
695  JSBool X3DMatrix3_setTransform(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
696  JSBool X3DMatrix3_getTransform(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
697  JSBool X3DMatrix3_inverse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
698  JSBool X3DMatrix3_transpose(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
699  JSBool X3DMatrix3_multLeft(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
700  JSBool X3DMatrix3_multRight(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
701  JSBool X3DMatrix3_multVecMatrix(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
702  JSBool X3DMatrix3_multMatrixVec(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
703  JSObject *X3DMatrix3_newInstance( JSContext *cx, Field *field, bool internal_field );
704 
705  enum X3DMatrix3PropertyId {
706  };
707 
708  static JSPropertySpec X3DMatrix3_properties[] = {
709  {0}
710  };
711 
712  static JSFunctionSpec X3DMatrix3_functions[] = {
713  {"inverse", X3DMatrix3_inverse, 0, 0, 0 },
714  {"transpose", X3DMatrix3_transpose, 0, 0, 0 },
715  {"setTransform", X3DMatrix3_setTransform, 5, 0, 0 },
716  {"getTransform", X3DMatrix3_getTransform, 3, 0, 0 },
717  {"multLeft", X3DMatrix3_multLeft, 1, 0, 0 },
718  {"multRight", X3DMatrix3_multRight, 1, 0, 0 },
719  {"multVecMatrix", X3DMatrix3_multVecMatrix, 1, 0, 0 },
720  {"multMatrixVec", X3DMatrix3_multMatrixVec, 1, 0, 0 },
721  {"toString", X3DMatrix3_toString , 0, 0, 0 },
722  {0}
723  };
724 
725  static JSClass X3DMatrix3Class = {
726  "X3DMatrix3",
727  JSCLASS_HAS_PRIVATE,
728 
729  /* All of these can be replaced with the corresponding JS_*Stub
730  function pointers. */
731  JS_PropertyStub, // add property
732  JS_PropertyStub, // del property
733  SpiderMonkey::X3DMatrix3_getProperty, // get property
734  SpiderMonkey::X3DMatrix3_setProperty, // set property
735  JS_EnumerateStub, // enumerate
736  JS_ResolveStub, // resolve
737  JS_ConvertStub, // convert
738  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
739  NULL, // getObjectOps
740  NULL, // checkAccess
741  NULL, // call
742  X3DMatrix3_construct, // construct
743  NULL, // xdrObject
744  NULL, // hasInstance
745  NULL, // mark
746  NULL //reserveSlots
747  };
748 
749 
753 
754  class SFMatrix4fRow : public Field {
755  public:
756  SFMatrix4fRow() : sfmatrix( NULL ), row( 0 ) { }
757  SFMatrix4fRow(SFMatrix4f* _sfmatrix, int _row) : row(_row), sfmatrix(_sfmatrix) { }
758  SFMatrix4f* sfmatrix;
759  int row;
760  };
761 
762  JSBool SFMatrix4fRow_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
763  JSBool SFMatrix4fRow_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
764  JSBool SFMatrix4fRow_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
765  JSBool SFMatrix4fRow_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
766  JSObject *SFMatrix4fRow_newInstance( JSContext *cx, Field *field, bool internal_field );
767 
768  enum SFMatrix4fRowPropertyId {
769  };
770 
771  static JSPropertySpec SFMatrix4fRow_properties[] = {
772  {0}
773  };
774 
775  static JSFunctionSpec SFMatrix4fRow_functions[] = {
776  {"toString", SFMatrix4fRow_toString , 0, 0, 0 },
777  {0}
778  };
779  static JSClass SFMatrix4fRowClass = {
780  "SFMatrix4fRow",
781  JSCLASS_HAS_PRIVATE,
782 
783  /* All of these can be replaced with the corresponding JS_*Stub
784  function pointers. */
785  JS_PropertyStub, // add property
786  JS_PropertyStub, // del property
787  SpiderMonkey::SFMatrix4fRow_getProperty, // get property
788  SpiderMonkey::SFMatrix4fRow_setProperty, // set property
789  JS_EnumerateStub, // enumerate
790  JS_ResolveStub, // resolve
791  JS_ConvertStub, // convert
792  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
793  NULL, // getObjectOps
794  NULL, // checkAccess
795  NULL, // call
796  NULL, // construct
797  NULL, // xdrObject
798  NULL, // hasInstance
799  NULL, // mark
800  NULL //reserveSlots
801  };
802 
803  JSBool X3DMatrix4_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
804  JSBool X3DMatrix4_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
805  JSBool X3DMatrix4_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
806  JSBool X3DMatrix4_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
807  JSBool X3DMatrix4_setTransform(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
808  JSBool X3DMatrix4_getTransform(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
809  JSBool X3DMatrix4_inverse(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
810  JSBool X3DMatrix4_transpose(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
811  JSBool X3DMatrix4_multLeft(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
812  JSBool X3DMatrix4_multRight(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
813  JSBool X3DMatrix4_multVecMatrix(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
814  JSBool X3DMatrix4_multMatrixVec(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
815  JSObject *X3DMatrix4_newInstance( JSContext *cx, Field *field, bool internal_field );
816 
817  enum X3DMatrix4PropertyId {
818  };
819 
820  static JSPropertySpec X3DMatrix4_properties[] = {
821  {0}
822  };
823 
824  static JSFunctionSpec X3DMatrix4_functions[] = {
825  {"inverse", X3DMatrix4_inverse, 0, 0, 0 },
826  {"transpose", X3DMatrix4_transpose, 0, 0, 0 },
827  {"setTransform", X3DMatrix4_setTransform, 5, 0, 0 },
828  {"getTransform", X3DMatrix4_getTransform, 3, 0, 0 },
829  {"multLeft", X3DMatrix4_multLeft, 1, 0, 0 },
830  {"multRight", X3DMatrix4_multRight, 1, 0, 0 },
831  {"multVecMatrix", X3DMatrix4_multVecMatrix, 1, 0, 0 },
832  {"multMatrixVec", X3DMatrix4_multMatrixVec, 1, 0, 0 },
833  {"toString", X3DMatrix4_toString , 0, 0, 0 },
834  {0}
835  };
836 
837  static JSClass X3DMatrix4Class = {
838  "X3DMatrix4",
839  JSCLASS_HAS_PRIVATE,
840 
841  /* All of these can be replaced with the corresponding JS_*Stub
842  function pointers. */
843  JS_PropertyStub, // add property
844  JS_PropertyStub, // del property
845  SpiderMonkey::X3DMatrix4_getProperty, // get property
846  SpiderMonkey::X3DMatrix4_setProperty, // set property
847  JS_EnumerateStub, // enumerate
848  JS_ResolveStub, // resolve
849  JS_ConvertStub, // convert
850  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
851  NULL, // getObjectOps
852  NULL, // checkAccess
853  NULL, // call
854  X3DMatrix4_construct, // construct
855  NULL, // xdrObject
856  NULL, // hasInstance
857  NULL, // mark
858  NULL //reserveSlots
859  };
860 
861 
865 
867  SFVEC3D_X, SFVEC3D_Y, SFVEC3D_Z
868  };
869 
870  JSBool SFVec3d_toString(JSContext *cx, JSObject *obj,
871  uintN argc, jsval *argv,
872  jsval *rval);
873 
874 
882  JSObject *SFVec3d_newInstance( JSContext *cx, Field *field, bool internal_field, int array_index = -1 );
883 
886  JSBool SFVec3d_setProperty(JSContext *cx,
887  JSObject *obj,
888  jsval id,
889  jsval *vp);
890 
893  JSBool SFVec3d_getProperty(JSContext *cx,
894  JSObject *obj,
895  jsval id,
896  jsval *vp);
897 
900  JSBool SFVec3d_construct(JSContext *cx, JSObject *obj,
901  uintN argc, jsval *argv,
902  jsval *rval);
903 
904  // member functions
905  JSBool SFVec3d_add(JSContext *cx, JSObject *obj,
906  uintN argc, jsval *argv,
907  jsval *rval);
908  JSBool SFVec3d_cross(JSContext *cx, JSObject *obj,
909  uintN argc, jsval *argv,
910  jsval *rval);
911  JSBool SFVec3d_divide(JSContext *cx, JSObject *obj,
912  uintN argc, jsval *argv,
913  jsval *rval);
914  JSBool SFVec3d_dot(JSContext *cx, JSObject *obj,
915  uintN argc, jsval *argv,
916  jsval *rval);
917  JSBool SFVec3d_length(JSContext *cx, JSObject *obj,
918  uintN argc, jsval *argv,
919  jsval *rval);
920  JSBool SFVec3d_multiple(JSContext *cx, JSObject *obj,
921  uintN argc, jsval *argv,
922  jsval *rval);
923  JSBool SFVec3d_negate(JSContext *cx, JSObject *obj,
924  uintN argc, jsval *argv,
925  jsval *rval);
926  JSBool SFVec3d_normalize(JSContext *cx, JSObject *obj,
927  uintN argc, jsval *argv,
928  jsval *rval);
929  JSBool SFVec3d_subtract(JSContext *cx, JSObject *obj,
930  uintN argc, jsval *argv,
931  jsval *rval);
932 
933  // properties
934  static JSPropertySpec SFVec3d_properties[] = {
935  {"x", SFVEC3D_X, JSPROP_PERMANENT},
936  {"y", SFVEC3D_Y, JSPROP_PERMANENT},
937  {"z", SFVEC3D_Z, JSPROP_PERMANENT},
938  {0}
939  };
940 
941  static JSFunctionSpec SFVec3d_functions[] = {
942  {"add", SFVec3d_add, 1, 0, 0 },
943  {"cross", SFVec3d_cross, 1, 0, 0 },
944  {"divide", SFVec3d_divide, 1, 0, 0 },
945  {"dot", SFVec3d_dot, 1, 0, 0 },
946  {"length", SFVec3d_length, 0, 0, 0 },
947  {"multiple", SFVec3d_multiple, 1, 0, 0 },
948  {"negate", SFVec3d_negate, 0, 0, 0 },
949  {"normalize", SFVec3d_normalize, 0, 0, 0 },
950  {"subtract", SFVec3d_subtract, 1, 0, 0 },
951  {"toString", SFVec3d_toString, 0, 0, 0 },
952  {0}
953  };
954 
955 
956  static JSClass SFVec3dClass = {
957  "SFVec3d",
958  JSCLASS_HAS_PRIVATE,
959 
960  /* All of these can be replaced with the corresponding JS_*Stub
961  function pointers. */
962  JS_PropertyStub, // add property
963  JS_PropertyStub, // del property
964  SpiderMonkey::SFVec3d_getProperty, // get property
965  SpiderMonkey::SFVec3d_setProperty, // set property
966  JS_EnumerateStub, // enumerate
967  JS_ResolveStub, // resolve
968  JS_ConvertStub, // convert
969  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
970  NULL, // getObjectOps
971  NULL, // checkAccess
972  NULL, // call
973  SFVec3d_construct, // construct
974  NULL, // xdrObject
975  NULL, // hasInstance
976  NULL, // mark
977  NULL //reserveSlots
978  };
979 
980 
984 
986  SFVEC4F_X, SFVEC4F_Y, SFVEC4F_Z, SFVEC4F_W,
987  };
988 
989 
990  JSBool SFVec4f_toString(JSContext *cx, JSObject *obj,
991  uintN argc, jsval *argv,
992  jsval *rval);
993 
994 
1002  JSObject *SFVec4f_newInstance( JSContext *cx, Field *field, bool internal_field, int array_index = -1 );
1003 
1006  JSBool SFVec4f_setProperty(JSContext *cx,
1007  JSObject *obj,
1008  jsval id,
1009  jsval *vp);
1010 
1013  JSBool SFVec4f_getProperty(JSContext *cx,
1014  JSObject *obj,
1015  jsval id,
1016  jsval *vp);
1017 
1020  JSBool SFVec4f_construct(JSContext *cx, JSObject *obj,
1021  uintN argc, jsval *argv,
1022  jsval *rval);
1023 
1024  // member functions
1025  JSBool SFVec4f_add(JSContext *cx, JSObject *obj,
1026  uintN argc, jsval *argv,
1027  jsval *rval);
1028  JSBool SFVec4f_divide(JSContext *cx, JSObject *obj,
1029  uintN argc, jsval *argv,
1030  jsval *rval);
1031  JSBool SFVec4f_dot(JSContext *cx, JSObject *obj,
1032  uintN argc, jsval *argv,
1033  jsval *rval);
1034  JSBool SFVec4f_multiple(JSContext *cx, JSObject *obj,
1035  uintN argc, jsval *argv,
1036  jsval *rval);
1037  JSBool SFVec4f_negate(JSContext *cx, JSObject *obj,
1038  uintN argc, jsval *argv,
1039  jsval *rval);
1040  JSBool SFVec4f_subtract(JSContext *cx, JSObject *obj,
1041  uintN argc, jsval *argv,
1042  jsval *rval);
1043 
1044  // properties
1045  static JSPropertySpec SFVec4f_properties[] = {
1046  {"x", SFVEC4F_X, JSPROP_PERMANENT},
1047  {"y", SFVEC4F_Y, JSPROP_PERMANENT},
1048  {"z", SFVEC4F_Z, JSPROP_PERMANENT},
1049  {"w", SFVEC4F_W, JSPROP_PERMANENT},
1050  {0}
1051  };
1052 
1053  static JSFunctionSpec SFVec4f_functions[] = {
1054  {"add", SFVec4f_add, 1, 0, 0 },
1055  {"divide", SFVec4f_divide, 1, 0, 0 },
1056  {"dot", SFVec4f_dot, 1, 0, 0 },
1057  {"multiple", SFVec4f_multiple, 1, 0, 0 },
1058  {"negate", SFVec4f_negate, 0, 0, 0 },
1059  {"subtract", SFVec4f_subtract, 1, 0, 0 },
1060  {"toString", SFVec4f_toString, 0, 0, 0 },
1061  {0}
1062  };
1063 
1064 
1065  static JSClass SFVec4fClass = {
1066  "SFVec4f",
1067  JSCLASS_HAS_PRIVATE,
1068 
1069  /* All of these can be replaced with the corresponding JS_*Stub
1070  function pointers. */
1071  JS_PropertyStub, // add property
1072  JS_PropertyStub, // del property
1073  SpiderMonkey::SFVec4f_getProperty, // get property
1074  SpiderMonkey::SFVec4f_setProperty, // set property
1075  JS_EnumerateStub, // enumerate
1076  JS_ResolveStub, // resolve
1077  JS_ConvertStub, // convert
1078  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
1079  NULL, // getObjectOps
1080  NULL, // checkAccess
1081  NULL, // call
1082  SFVec4f_construct, // construct
1083  NULL, // xdrObject
1084  NULL, // hasInstance
1085  NULL, // mark
1086  NULL //reserveSlots
1087  };
1088 
1092 
1094  SFVEC4D_X, SFVEC4D_Y, SFVEC4D_Z, SFVEC4D_W,
1095  };
1096 
1097  JSBool SFVec4d_toString(JSContext *cx, JSObject *obj,
1098  uintN argc, jsval *argv,
1099  jsval *rval);
1100 
1108  JSObject *SFVec4d_newInstance( JSContext *cx, Field *field, bool internal_field, int array_index = -1 );
1109 
1112  JSBool SFVec4d_setProperty(JSContext *cx,
1113  JSObject *obj,
1114  jsval id,
1115  jsval *vp);
1116 
1119  JSBool SFVec4d_getProperty(JSContext *cx,
1120  JSObject *obj,
1121  jsval id,
1122  jsval *vp);
1123 
1126  JSBool SFVec4d_construct(JSContext *cx, JSObject *obj,
1127  uintN argc, jsval *argv,
1128  jsval *rval);
1129 
1130  // member functions
1131  JSBool SFVec4d_add(JSContext *cx, JSObject *obj,
1132  uintN argc, jsval *argv,
1133  jsval *rval);
1134  JSBool SFVec4d_divide(JSContext *cx, JSObject *obj,
1135  uintN argc, jsval *argv,
1136  jsval *rval);
1137  JSBool SFVec4d_dot(JSContext *cx, JSObject *obj,
1138  uintN argc, jsval *argv,
1139  jsval *rval);
1140  JSBool SFVec4d_multiple(JSContext *cx, JSObject *obj,
1141  uintN argc, jsval *argv,
1142  jsval *rval);
1143  JSBool SFVec4d_negate(JSContext *cx, JSObject *obj,
1144  uintN argc, jsval *argv,
1145  jsval *rval);
1146  JSBool SFVec4d_subtract(JSContext *cx, JSObject *obj,
1147  uintN argc, jsval *argv,
1148  jsval *rval);
1149 
1150  // properties
1151  static JSPropertySpec SFVec4d_properties[] = {
1152  {"x", SFVEC4D_X, JSPROP_PERMANENT},
1153  {"y", SFVEC4D_Y, JSPROP_PERMANENT},
1154  {"z", SFVEC4D_Z, JSPROP_PERMANENT},
1155  {"w", SFVEC4D_W, JSPROP_PERMANENT},
1156  {0}
1157  };
1158 
1159  static JSFunctionSpec SFVec4d_functions[] = {
1160  {"add", SFVec4d_add, 1, 0, 0 },
1161  {"divide", SFVec4d_divide, 1, 0, 0 },
1162  {"dot", SFVec4d_dot, 1, 0, 0 },
1163  {"multiple", SFVec4d_multiple, 1, 0, 0 },
1164  {"negate", SFVec4d_negate, 0, 0, 0 },
1165  {"subtract", SFVec4d_subtract, 1, 0, 0 },
1166  {"toString", SFVec4d_toString, 0, 0, 0 },
1167  {0}
1168  };
1169 
1170 
1171  static JSClass SFVec4dClass = {
1172  "SFVec4d",
1173  JSCLASS_HAS_PRIVATE,
1174 
1175  /* All of these can be replaced with the corresponding JS_*Stub
1176  function pointers. */
1177  JS_PropertyStub, // add property
1178  JS_PropertyStub, // del property
1179  SpiderMonkey::SFVec4d_getProperty, // get property
1180  SpiderMonkey::SFVec4d_setProperty, // set property
1181  JS_EnumerateStub, // enumerate
1182  JS_ResolveStub, // resolve
1183  JS_ConvertStub, // convert
1184  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
1185  NULL, // getObjectOps
1186  NULL, // checkAccess
1187  NULL, // call
1188  SFVec4d_construct, // construct
1189  NULL, // xdrObject
1190  NULL, // hasInstance
1191  NULL, // mark
1192  NULL //reserveSlots
1193  };
1194 
1195 
1199 
1201  SFRotation_X, SFRotation_Y, SFRotation_Z, SFRotation_ANGLE,
1202  };
1203 
1204  JSBool SFRotation_toString(JSContext *cx, JSObject *obj,
1205  uintN argc, jsval *argv,
1206  jsval *rval);
1207 
1215  JSObject *SFRotation_newInstance( JSContext *cx, Field *field, bool internal_field, int array_index = -1 );
1216 
1219  JSBool SFRotation_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
1220 
1223  JSBool SFRotation_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
1224 
1227  JSBool SFRotation_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,jsval *rval);
1228 
1229  // member functions
1230  JSBool SFRotation_getAxis( JSContext *cx, JSObject *obj, uintN argc, jsval *argv,jsval *rval );
1231  JSBool SFRotation_inverse( JSContext *cx, JSObject *obj, uintN argc, jsval *argv,jsval *rval );
1232  JSBool SFRotation_multiply( JSContext *cx, JSObject *obj, uintN argc, jsval *argv,jsval *rval );
1233  JSBool SFRotation_multiVec( JSContext *cx, JSObject *obj, uintN argc, jsval *argv,jsval *rval );
1234  JSBool SFRotation_setAxis( JSContext *cx, JSObject *obj, uintN argc, jsval *argv,jsval *rval );
1235  JSBool SFRotation_slerp( JSContext *cx, JSObject *obj, uintN argc, jsval *argv,jsval *rval );
1236 
1237  // properties
1238  static JSPropertySpec SFRotation_properties[] = {
1239  {"x", SFRotation_X, JSPROP_PERMANENT},
1240  {"y", SFRotation_Y, JSPROP_PERMANENT},
1241  {"z", SFRotation_Z, JSPROP_PERMANENT},
1242  {"angle", SFRotation_ANGLE, JSPROP_PERMANENT},
1243  {0}
1244  };
1245 
1246  static JSFunctionSpec SFRotation_functions[] = {
1247  {"getAxis", SFRotation_getAxis, 0, 0, 0 },
1248  {"inverse", SFRotation_inverse, 0, 0, 0 },
1249  {"multiply", SFRotation_multiply, 1, 0, 0 },
1250  {"multiVec", SFRotation_multiVec, 1, 0, 0 },
1251  {"setAxis", SFRotation_setAxis, 1, 0, 0 },
1252  {"slerp", SFRotation_slerp, 2, 0, 0 },
1253  {"toString", SFRotation_toString, 0, 0, 0 },
1254  {0}
1255  };
1256 
1257  static JSClass SFRotationClass = {
1258  "SFRotation",
1259  JSCLASS_HAS_PRIVATE,
1260 
1261  /* All of these can be replaced with the corresponding JS_*Stub
1262  function pointers. */
1263  JS_PropertyStub, // add property
1264  JS_PropertyStub, // del property
1265  SpiderMonkey::SFRotation_getProperty, // get property
1266  SpiderMonkey::SFRotation_setProperty, // set property
1267  JS_EnumerateStub, // enumerate
1268  JS_ResolveStub, // resolve
1269  JS_ConvertStub, // convert
1270  PrivatePointer_finalize<FieldObjectPrivate>, // finalize
1271  NULL, // getObjectOps
1272  NULL, // checkAccess
1273  NULL, // call
1274  SFRotation_construct, // construct
1275  NULL, // xdrObject
1276  NULL, // hasInstance
1277  NULL, // mark
1278  NULL //reserveSlots
1279  };
1280 
1281 
1285 
1286 
1294  JSObject *SFNode_newInstance( JSContext *cx,
1295  Field *field,
1296  bool internal_field, int array_index = -1 );
1297 
1300  JSBool SFNode_setProperty(JSContext *cx,
1301  JSObject *obj,
1302  jsval id,
1303  jsval *vp);
1304 
1307  JSBool SFNode_getProperty(JSContext *cx,
1308  JSObject *obj,
1309  jsval id,
1310  jsval *vp);
1311 
1314  JSBool SFNode_construct(JSContext *cx, JSObject *obj,
1315  uintN argc, jsval *argv,
1316  jsval *rval);
1317 
1318  // member functions
1319  JSBool SFNode_getNodeName(JSContext *cx, JSObject *obj,
1320  uintN argc, jsval *argv,
1321  jsval *rval);
1322  JSBool SFNode_getNodeType(JSContext *cx, JSObject *obj,
1323  uintN argc, jsval *argv,
1324  jsval *rval);
1325  JSBool SFNode_getFieldDefinitions(JSContext *cx, JSObject *obj,
1326  uintN argc, jsval *argv,
1327  jsval *rval);
1328  JSBool SFNode_toVRMLString(JSContext *cx, JSObject *obj,
1329  uintN argc, jsval *argv,
1330  jsval *rval);
1331  JSBool SFNode_toX3DString(JSContext *cx, JSObject *obj,
1332  uintN argc, jsval *argv,
1333  jsval *rval);
1334 
1335 
1336  static JSFunctionSpec SFNode_functions[] = {
1337  {"getNodeName", SFNode_getNodeName, 0, 0, 0 },
1338  {"getNodeType", SFNode_getNodeType, 0, 0, 0 },
1339  {"getFieldDefinitions", SFNode_getFieldDefinitions, 0, 0, 0 },
1340  {"toString", SFNode_toX3DString, 0, 0, 0 },
1341  {"toX3DString", SFNode_toX3DString, 0, 0, 0 },
1342  {"toVRMLString", SFNode_toVRMLString, 0, 0, 0 },
1343  {0}
1344  };
1345 
1346  static JSClass SFNodeClass = {
1347  "SFNode",
1348  JSCLASS_HAS_PRIVATE,
1349 
1350  /* All of these can be replaced with the corresponding JS_*Stub
1351  function pointers. */
1352  JS_PropertyStub, // add property
1353  JS_PropertyStub, // del property
1354  SpiderMonkey::SFNode_getProperty, // get property
1355  SpiderMonkey::SFNode_setProperty, // set property
1356  JS_EnumerateStub, // enumerate
1357  JS_ResolveStub, // resolve
1358  JS_ConvertStub, // convert
1359  PrivatePointer_finalize< FieldObjectPrivate >, // finalize
1360  NULL, // getObjectOps
1361  NULL, // checkAccess
1362  NULL, // call
1363  SFNode_construct, // construct
1364  NULL, // xdrObject
1365  NULL, // hasInstance
1366  NULL, // mark
1367  NULL //reserveSlots
1368  };
1369 
1373 
1375  SFCOLOR_R, SFCOLOR_G, SFCOLOR_B
1376  };
1377 
1385  JSObject *SFColor_newInstance( JSContext *cx,
1386  Field *field,
1387  bool internal_field, int array_index = -1 );
1388 
1391  JSBool SFColor_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
1392 
1395  JSBool SFColor_getProperty(JSContext *cx,
1396  JSObject *obj,
1397  jsval id,
1398  jsval *vp);
1399 
1402  JSBool SFColor_construct(JSContext *cx, JSObject *obj,
1403  uintN argc, jsval *argv,
1404  jsval *rval);
1405 
1406  // member functions
1407  JSBool SFColor_getHSV(JSContext *cx, JSObject *obj,
1408  uintN argc, jsval *argv,
1409  jsval *rval);
1410  JSBool SFColor_setHSV(JSContext *cx, JSObject *obj,
1411  uintN argc, jsval *argv,
1412  jsval *rval);
1413 
1414  JSBool SFColor_toString(JSContext *cx, JSObject *obj,
1415  uintN argc, jsval *argv,
1416  jsval *rval);
1417 
1418  // properties
1419  static JSPropertySpec SFColor_properties[] = {
1420  {"r", SFCOLOR_R, JSPROP_PERMANENT},
1421  {"g", SFCOLOR_G, JSPROP_PERMANENT},
1422  {"b", SFCOLOR_B, JSPROP_PERMANENT},
1423  {0}
1424  };
1425 
1426  static JSFunctionSpec SFColor_functions[] = {
1427  {"getHSV", SFColor_getHSV, 1, 0, 0 },
1428  {"setHSV", SFColor_setHSV, 1, 0, 0 },
1429  {"toString", SFColor_toString, 0, 0, 0 },
1430  {0}
1431  };
1432 
1433  static JSClass SFColorClass = {
1434  "SFColor",
1435  JSCLASS_HAS_PRIVATE,
1436 
1437  /* All of these can be replaced with the corresponding JS_*Stub
1438  function pointers. */
1439  JS_PropertyStub, // add property
1440  JS_PropertyStub, // del property
1441  SpiderMonkey::SFColor_getProperty, // get property
1442  SpiderMonkey::SFColor_setProperty, // set property
1443  JS_EnumerateStub, // enumerate
1444  JS_ResolveStub, // resolve
1445  JS_ConvertStub, // convert
1446  PrivatePointer_finalize< FieldObjectPrivate >, // finalize
1447  NULL, // getObjectOps
1448  NULL, // checkAccess
1449  NULL, // call
1450  SFColor_construct, // construct
1451  NULL, // xdrObject
1452  NULL, // hasInstance
1453  NULL, // mark
1454  NULL //reserveSlots
1455  };
1456 
1460 
1462  X3DEXECUTIONCONTEXT_ROOTNODES
1463  };
1464 
1472  JSObject *X3DExecutionContext_newInstance( JSContext *cx,
1473  SAI::ExecutionContext *field,
1474  bool internal_field );
1475 
1478  JSBool X3DExecutionContext_setProperty(JSContext *cx,
1479  JSObject *obj,
1480  jsval id,
1481  jsval *vp);
1482 
1485  JSBool X3DExecutionContext_getProperty(JSContext *cx,
1486  JSObject *obj,
1487  jsval id,
1488  jsval *vp);
1489 
1492  JSBool X3DExecutionContext_construct(JSContext *cx, JSObject *obj,
1493  uintN argc, jsval *argv,
1494  jsval *rval);
1495 
1496 
1497  // member functions
1498  JSBool X3DExecutionContext_createNode(JSContext *cx, JSObject *obj,
1499  uintN argc, jsval *argv,
1500  jsval *rval);
1501 
1502  // properties
1503  static JSPropertySpec X3DExecutionContext_properties[] = {
1504  {"rootNodes", X3DEXECUTIONCONTEXT_ROOTNODES, JSPROP_PERMANENT},
1505  {0}
1506  };
1507 
1508  static JSFunctionSpec X3DExecutionContext_functions[] = {
1509  {"createNode", X3DExecutionContext_createNode, 1, 0, 0 },
1510  {0}
1511  };
1512 
1513  static JSClass X3DExecutionContextClass = {
1514  "X3DExecutionContext",
1515  JSCLASS_HAS_PRIVATE,
1516 
1517  /* All of these can be replaced with the corresponding JS_*Stub
1518  function pointers. */
1519  JS_PropertyStub, // add property
1520  JS_PropertyStub, // del property
1521  SpiderMonkey::X3DExecutionContext_getProperty, // get property
1522  SpiderMonkey::X3DExecutionContext_setProperty, // set property
1523  JS_EnumerateStub, // enumerate
1524  JS_ResolveStub, // resolve
1525  JS_ConvertStub, // convert
1526  PrivatePointer_finalize< ExecutionContextPrivate >, // finalize
1527  NULL, // getObjectOps
1528  NULL, // checkAccess
1529  NULL, // call
1530  NULL, // construct
1531  NULL, // xdrObject
1532  NULL, // hasInstance
1533  NULL, // mark
1534  NULL //reserveSlots
1535  };
1536 
1537 
1541 
1543  X3DSCENE_ROOTNODES
1544  };
1545 
1553  JSObject *X3DScene_newInstance( JSContext *cx,
1554  SAI::SAIScene *field,
1555  bool internal_field );
1556 
1559  JSBool X3DScene_setProperty(JSContext *cx,
1560  JSObject *obj,
1561  jsval id,
1562  jsval *vp);
1563 
1566  JSBool X3DScene_getProperty(JSContext *cx,
1567  JSObject *obj,
1568  jsval id,
1569  jsval *vp);
1570 
1573  JSBool X3DScene_construct(JSContext *cx, JSObject *obj,
1574  uintN argc, jsval *argv,
1575  jsval *rval);
1576 
1577 
1578  // member functions
1579 
1580  // properties
1581  static JSPropertySpec X3DScene_properties[] = {
1582  {"rootNodes", X3DSCENE_ROOTNODES, JSPROP_PERMANENT},
1583  {0}
1584  };
1585 
1586  static JSFunctionSpec X3DScene_functions[] = {
1587  {"createNode", X3DExecutionContext_createNode, 1, 0, 0 },
1588  {0}
1589  };
1590 
1591  static JSClass X3DSceneClass = {
1592  "X3DScene",
1593  JSCLASS_HAS_PRIVATE,
1594 
1595  /* All of these can be replaced with the corresponding JS_*Stub
1596  function pointers. */
1597  JS_PropertyStub, // add property
1598  JS_PropertyStub, // del property
1599  SpiderMonkey::X3DScene_getProperty, // get property
1600  SpiderMonkey::X3DScene_setProperty, // set property
1601  JS_EnumerateStub, // enumerate
1602  JS_ResolveStub, // resolve
1603  JS_ConvertStub, // convert
1604  PrivatePointer_finalize< ExecutionContextPrivate >, // finalize
1605  NULL, // getObjectOps
1606  NULL, // checkAccess
1607  NULL, // call
1608  NULL, // construct
1609  NULL, // xdrObject
1610  NULL, // hasInstance
1611  NULL, // mark
1612  NULL //reserveSlots
1613  };
1614 
1618 
1619  JSBool Browser_getProperty(JSContext *cx,
1620  JSObject *obj,
1621  jsval id,
1622  jsval *vp);
1623 
1624  JSBool Browser_setProperty(JSContext *cx,
1625  JSObject *obj,
1626  jsval id,
1627  jsval *vp);
1628 
1629  JSObject *Browser_newInstance( JSContext *cx,
1630  SAI::Browser *browser,
1631  bool internal_field );
1632 
1633  // Functions
1634  JSBool Browser_print(JSContext *cx,
1635  JSObject *obj, uintN argc,
1636  jsval *argv, jsval *rval);
1637 
1638  JSBool Browser_println(JSContext *cx,
1639  JSObject *obj, uintN argc,
1640  jsval *argv, jsval *rval);
1641 
1642  JSBool Browser_createX3DFromString(JSContext *cx,
1643  JSObject *obj, uintN argc,
1644  jsval *argv, jsval *rval);
1645 
1646  JSBool Browser_createX3DFromURL(JSContext *cx,
1647  JSObject *obj, uintN argc,
1648  jsval *argv, jsval *rval);
1649 
1650  enum BrowserPropertyId {
1651  BROWSER_NAME, BROWSER_VERSION, BROWSER_CURRENT_SCENE
1652  };
1653 
1654  static JSPropertySpec browser_properties[] = {
1655  {"version", BROWSER_VERSION, JSPROP_READONLY},
1656  {"name", BROWSER_NAME, JSPROP_READONLY},
1657  {"currentScene", BROWSER_CURRENT_SCENE, JSPROP_READONLY},
1658  {0}
1659  };
1660 
1661  static JSFunctionSpec browser_functions[] = {
1662  {"println", Browser_println, 0, 0, 0 },
1663  {"print", Browser_print, 0, 0, 0 },
1664  {"createX3DFromString", Browser_createX3DFromString, 0, 0, 0 },
1665  {"createX3DFromURL", Browser_createX3DFromURL, 0, 0, 0 },
1666  {0}
1667  };
1668 
1669  static JSClass BrowserClass = {
1670  "Browser",
1671  JSCLASS_HAS_PRIVATE,
1672 
1673  /* All of these can be replaced with the corresponding JS_*Stub
1674  function pointers. */
1675  JS_PropertyStub, // add property
1676  JS_PropertyStub, // del property
1677  Browser_getProperty, // get property
1678  Browser_setProperty, // set property
1679  JS_EnumerateStub, // enumerate
1680  JS_ResolveStub, // resolve
1681  JS_ConvertStub, // convert
1682  PrivatePointer_finalize<BrowserPrivate>, // finalize
1683  JSCLASS_NO_OPTIONAL_MEMBERS
1684  };
1685 
1689  template< class MFieldType, class ElementType >
1690  struct JS_MField {
1691 
1699  static JSObject *newInstance( JSContext *cx,
1700  Field *field,
1701  bool internal_field, int array_index = -1 );
1702 
1705  static JSBool setProperty(JSContext *cx,
1706  JSObject *obj,
1707  jsval id,
1708  jsval *vp);
1709 
1712  static JSBool getProperty(JSContext *cx,
1713  JSObject *obj,
1714  jsval id,
1715  jsval *vp);
1716 
1719  static JSBool construct(JSContext *cx, JSObject *obj,
1720  uintN argc, jsval *argv,
1721  jsval *rval);
1722 
1724  static JSFunctionSpec functions[2];
1725  static JSClass js_class;
1726  static JSPropertySpec properties[1];
1727 
1728  static JSBool initClass( JSContext *cx, JSObject *obj, const char *name ) {
1729 
1730  JSPropertySpec p[] = {
1731  {0}
1732  };
1733 
1734  properties[0] = p[0];
1735 
1736 
1737  JSFunctionSpec f[2] = {
1738  {"toString", FieldObject_toString, 0, 0, 0 },
1739  {0}
1740  };
1741  functions[0] = f[0];
1742  functions[1] = f[1];
1743 
1744  JSClass c = {
1745  name,
1746  JSCLASS_HAS_PRIVATE,
1747 
1748  /* All of these can be replaced with the corresponding JS_*Stub
1749  function pointers. */
1750  JS_PropertyStub, // add property
1751  JS_PropertyStub, // del property
1752  getProperty, // get property
1753  setProperty, // set property
1754  JS_EnumerateStub, // enumerate
1755  JS_ResolveStub, // resolve
1756  JS_ConvertStub, // convert
1757  PrivatePointer_finalize< FieldObjectPrivate >, // finalize
1758  NULL, // getObjectOps
1759  NULL, // checkAccess
1760  NULL, // call
1761  construct, // construct
1762  NULL, // xdrObject
1763  NULL, // hasInstance
1764  NULL, // mark
1765  NULL //reserveSlots
1766  };
1767 
1768  js_class = c;
1769 
1770  JSObject *proto = JS_InitClass( cx, obj, NULL,
1771  &js_class, construct, 0,
1772  properties, functions, NULL, NULL );
1773  return JS_TRUE;
1774 
1775  }
1776  };
1777 
1778  template< class MFieldType, class ElementType >
1780 
1781  template< class MFieldType, class ElementType >
1782  JSClass JS_MField< MFieldType, ElementType >::js_class;
1783 
1784  template< class MFieldType, class ElementType >
1785  JSPropertySpec JS_MField< MFieldType, ElementType >::properties[1];
1786 
1787  template< class MFieldType, class ElementType >
1789 
1790  Field *field,
1791  bool internal_field,
1792  int array_index
1793  ) {
1794 
1795  JSObject *js_field;
1796 
1797  js_field = JS_NewObject( cx, &js_class, NULL, NULL );
1798 
1799  JS_DefineProperties(cx, js_field,
1801  JS_DefineFunctions(cx, js_field,
1803  JS_SetPrivate(cx, js_field, (void *) new FieldObjectPrivate( field,
1804  internal_field ) );
1805  return js_field;
1806  }
1807 
1808 
1811 
1814 
1817 
1820 
1823 
1826 
1829 
1832 
1835 
1838 
1841 
1844 
1847 
1850 
1853 
1855  //typedef JS_MField< MFImage, SFImage > JS_MFImage;
1856 
1857  typedef enum { O_ADD, O_SUBTRACT, O_CROSS, O_DOT, O_DIVIDE, O_MULTIPLE, } BinaryOperator;
1858 
1859  // get the private pointer from a JSObject
1860  template<class T>
1861  T* helper_extractPrivateObject( JSContext* cx, JSObject* jsobj);
1862 
1863  // templates for binary-operator functions
1864 
1865  template <class T>
1866  bool helper_calculate2_TTT(JSContext *cx, JSObject *this_obj, jsval *arg, T* const rval, BinaryOperator op);
1867  template <class T, class N>
1868  bool helper_calculate2_TNT(JSContext *cx, JSObject *this_obj, jsval *arg, T* const rval, BinaryOperator op);
1869  template <class T, class N>
1870  bool helper_calculate2_TTN(JSContext *cx, JSObject *this_obj, jsval *arg, jsval* const rjsval, BinaryOperator op);
1871 
1873  static JSClass SFNumberClass = {
1874  "SFNumber",
1875  JSCLASS_HAS_PRIVATE,
1876  JS_PropertyStub, JS_PropertyStub,
1877  JS_PropertyStub, JS_PropertyStub,
1878  JS_EnumerateStub, JS_ResolveStub,
1879  JS_ConvertStub, JS_FinalizeStub,
1880  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
1881  };
1882 
1883  // sanity check the parameters against a particular set
1884  bool helper_sanityCheck(JSContext *cx, JSObject *obj, uintN argc,
1885  jsval *argv, uintN e_argc, JSClass** e_argtypes);
1886  }
1887 }
1888 
1889 #endif // HAVE_SPIDERMONKEY
1890 
1891 #endif
Contains the MFBool field class.
Contains the MFColor field class.
Contains the MFDouble field class.
Contains the MFFloat field class.
Contains the MFInt32 field class.
Contains the MFNode class.
Contains the MFRotation field class.
Contains the MFString field class.
Contains the MFTime field class.
Contains the MFVec2d field class.
Contains the MFVec2f field class.
Contains the MFVec3d field class.
Contains the MFVec3f field class.
Contains the MFVec4d field class.
Contains the MFVec4f field class.
Header file for common SAI interface classes and functions for use by script engine implementations s...
Contains the SFBool field class.
Contains the SFColor field class.
Contains the SFDouble field class.
Contains the SFFloat field class.
Contains the SFInt32 field class.
Contains the SFMatrix3f field class.
Contains the SFMatrix4f field class.
Contains the SFNode class.
Contains the SFRotation field class.
Contains the SFString field class.
Contains the SFTime field class.
Contains the SFVec2d field class.
Contains the SFVec2f field class.
Contains the SFVec3d field class.
Contains the SFVec3f field class.
Contains the SFVec4d field class.
Contains the SFVec4f field class.
JSBool SFVec4d_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFVec4d.
Definition: SpiderMonkeyTypes.cpp:1744
JSBool SFVec2d_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFVec2d.
Definition: SpiderMonkeyTypes.cpp:665
JSBool X3DMatrix4_getTransform(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
X3DMatrix4.
Definition: SpiderMonkeyTypes.cpp:4225
JSBool SFNode_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
Callback setter function for properties of a SFNode object.
Definition: SpiderMonkeyTypes.cpp:2327
JSBool haveFunction(JSContext *cx, JSObject *obj, const char *name)
Returns JS_TRUE if the name is a function in the given object.
Definition: SpiderMonkeyTypes.cpp:3772
SFRotationPropertyId
SFRotation.
Definition: SpiderMonkeyTypes.h:1200
JSBool SFVec3f_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFVec3f.
Definition: SpiderMonkeyTypes.cpp:919
JSBool SFNode_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFNode.
Definition: SpiderMonkeyTypes.cpp:2277
JSBool Browser_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
Browser.
Definition: SpiderMonkeyTypes.cpp:3209
JSBool SFColor_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFColor.
Definition: SpiderMonkeyTypes.cpp:2459
SFVec3dPropertyId
SFVec3d.
Definition: SpiderMonkeyTypes.h:866
SFVec4dPropertyId
SFVec4d.
Definition: SpiderMonkeyTypes.h:1093
X3DScenePropertyId
X3DScene.
Definition: SpiderMonkeyTypes.h:1542
JSBool setFieldValueFromjsval(JSContext *cx, Field *f, jsval v)
Sets the field value to the value of the jsval v.
Definition: SpiderMonkeyTypes.cpp:3607
X3DExecutionContextPropertyId
X3DExecutionContext.
Definition: SpiderMonkeyTypes.h:1461
JSBool SFVec4f_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFVec4f.
Definition: SpiderMonkeyTypes.cpp:1493
void setJSException(JSContext *cx, const SAI::SAIError &e)
Set a JS API exception based on the c++ SAIError exception.
Definition: SpiderMonkeyTypes.cpp:3786
bool insertH3DTypes(JSContext *cx, JSObject *obj)
Insert the H3D data types, such as SFFloat, MFInt32 etc into the context and object given.
Definition: SpiderMonkeyTypes.cpp:3262
void PrivatePointer_finalize(JSContext *cx, JSObject *obj)
Destruct callback for JSObject with a private datamember.
Definition: SpiderMonkeyTypes.h:193
SFVec2dPropertyId
SFVec2d.
Definition: SpiderMonkeyTypes.h:328
JSBool SFRotation_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFRotation.
Definition: SpiderMonkeyTypes.cpp:1998
JSBool FieldObject_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Callback function for converting a JSObject with a FieldObjectPrivate private data member to a JSStri...
Definition: SpiderMonkeyTypes.cpp:158
JSBool SFVec2f_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFVec2f.
Definition: SpiderMonkeyTypes.cpp:412
SFVec2fPropertyId
SFVec2f.
Definition: SpiderMonkeyTypes.h:218
jsval jsvalFromField(JSContext *cx, Field *f, bool make_copy, int array_index=-1, X3DTypes::X3DType x3dt=X3DTypes::UNKNOWN_X3D_TYPE)
Create a jsval object containing the value of the field(and possibly encapsulating the field).
Definition: SpiderMonkeyTypes.cpp:3362
SFColorPropertyId
SFColor.
Definition: SpiderMonkeyTypes.h:1374
JSBool X3DScene_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of X3DScene.
SFVec3fPropertyId
SFVec3f.
Definition: SpiderMonkeyTypes.h:522
JSBool X3DExecutionContext_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of X3DExecutionContext.
JSBool X3DMatrix3_getTransform(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
X3DMATRIX3.
Definition: SpiderMonkeyTypes.cpp:3976
JSBool SFImage_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFImage.
Definition: SpiderMonkeyTypes.cpp:2653
JSBool SFVec3d_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of SFVec3d.
Definition: SpiderMonkeyTypes.cpp:1205
SFVec4fPropertyId
SFVec4f.
Definition: SpiderMonkeyTypes.h:985
JSBool SFNode_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
Callback getter function for properties of a SFNode object.
Definition: SpiderMonkeyTypes.cpp:2294
JSBool X3DMatrix4_setTransform(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Definition: SpiderMonkeyTypes.cpp:4270
JSObject * SFNode_newInstance(JSContext *cx, Field *field, bool internal_field, int array_index=-1)
SFNode.
Definition: SpiderMonkeyTypes.cpp:2352
Header file for X3DTexture2DNode, X3D scene-graph node.
The Field class.
Definition: Field.h:46
The SFMatrix3f field contains a Matrix3f.
Definition: SFMatrix3f.h:41
The SFMatrix4f field contains a Matrix4f.
Definition: SFMatrix4f.h:41
Class used as the private data in field JSObject classes.
Definition: SpiderMonkeyTypes.h:132
PointerType * getPointer()
Get the pointer the JSObject encapsulates.
Definition: SpiderMonkeyTypes.h:159
void dispose()
Dispose the object. Sets the dispose flag to true.
Definition: SpiderMonkeyTypes.h:175
bool isDisposed()
Returns true if this data object has been disposed.
Definition: SpiderMonkeyTypes.h:164
int getArrayIndex()
Return the array index (in case we using (MF, index) to represent an SF object Return -1 if it IS an ...
Definition: SpiderMonkeyTypes.h:170
PointerPrivateData(PointerType *_ptr, bool _internal_pointer, int _array_index=-1)
Constructor.
Definition: SpiderMonkeyTypes.h:140
~PointerPrivateData()
Destructor.
Definition: SpiderMonkeyTypes.h:152
X3DMatrix3.
Definition: SpiderMonkeyTypes.h:642
X3DMatrix4.
Definition: SpiderMonkeyTypes.h:754
A SFNode encapsulating an Image class.
Definition: X3DTexture2DNode.h:49
H3D API namespace.
Definition: Anchor.h:38
MField template.
Definition: SpiderMonkeyTypes.h:1690
static JSObject * newInstance(JSContext *cx, Field *field, bool internal_field, int array_index=-1)
Returns a new JSObject object encapsulating a field.
Definition: SpiderMonkeyTypes.h:1788
static JSBool construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
Construct callback function for creating a new instance of JS_MField.
Definition: SpiderMonkeyTypes.cpp:275
static JSFunctionSpec functions[2]
Member functions.
Definition: SpiderMonkeyTypes.h:1724
static JSBool setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
Callback setter function for properties of a JS_MField object.
Definition: SpiderMonkeyTypes.cpp:306
static JSBool getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
Callback getter function for properties of a JS_MField object.
Definition: SpiderMonkeyTypes.cpp:206