| http://www.sim.no/ http://www.coin3d.org/

spidermonkey.h
1 #ifndef COIN_GLUE_SPIDERMONKEY_H
2 #define COIN_GLUE_SPIDERMONKEY_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/C/basic.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 #if 0 /* to get proper auto-indentation in emacs */
34 }
35 #endif /* emacs indentation */
36
37
38 /*
39 This is used to detect whether the 'jsapi.h' was included by the
40 user or not. The JSVERSION_IS_ECMA is defined in the 'jspubtd.h'
41 file in the SpiderMonkey header directory.
42 */
43 #ifndef JSVERSION_IS_ECMA
44
45
46 /*
47 Structs and defines.
48 */
49 typedef int JSBool;
50 typedef long jsword;
51 typedef jsword jsval;
52 typedef jsword jsid;
53 typedef int intN;
54 typedef unsigned int uintN;
55 typedef uint16_t jschar;
56
57 typedef int32_t jsrefcount;
58 typedef uint8_t jsbytecode;
59 typedef uint32_t JSHashNumber;
60 typedef uint32_t jsatomid;
61
62 typedef enum JSType {
63 JSTYPE_VOID,
64 JSTYPE_OBJECT,
65 JSTYPE_FUNCTION,
66 JSTYPE_STRING,
67 JSTYPE_NUMBER,
68 JSTYPE_BOOLEAN,
69 JSTYPE_LIMIT
70 } JSType;
71
72 typedef enum JSAccessMode {
73 JSACC_PROTO = 0,
74 JSACC_PARENT = 1,
75 JSACC_IMPORT = 2,
76 JSACC_WATCH = 3,
77 JSACC_READ = 4,
78 JSACC_WRITE = 8,
79 JSACC_LIMIT
80 } JSAccessMode;
81
82 typedef enum JSGCStatus {
83 JSGC_BEGIN,
84 JSGC_END,
85 JSGC_MARK_END,
86 JSGC_FINALIZE_END
87 } JSGCStatus;
88
89 struct JSIdArray {
90 int32_t length;
91 jsid vector[1];
92 };
93
94 typedef void JSRuntime;
95 typedef void JSContext;
96 typedef void JSObject;
97 typedef void JSObjectOps;
98 typedef void JSXDRState;
99 typedef void JSString;
100 typedef struct JSClass JSClass;
101 typedef struct JSPropertySpec JSPropertySpec;
102 typedef int JSVersion;
103 typedef void JSFunction;
104 typedef struct JSFunctionSpec JSFunctionSpec;
105 typedef struct JSErrorReport JSErrorReport;
106 typedef void JSScript;
107
108 #define JS_DLL_CALLBACK /* FIXME: set up this define properly. 20050601 mortene. */
109
110 typedef JSBool (* JS_DLL_CALLBACK JSPropertyOp)(JSContext *, JSObject *, jsval, jsval *);
111 typedef JSBool (* JS_DLL_CALLBACK JSEnumerateOp)(JSContext *, JSObject *);
112 typedef JSBool (* JS_DLL_CALLBACK JSResolveOp)(JSContext *, JSObject *, jsval);
113 typedef JSBool (* JS_DLL_CALLBACK JSConvertOp)(JSContext *, JSObject *, JSType, jsval *);
114 typedef void (* JS_DLL_CALLBACK JSFinalizeOp)(JSContext *, JSObject *);
115 typedef JSObjectOps * (* JS_DLL_CALLBACK JSGetObjectOps)(JSContext *, JSClass *);
116 typedef JSBool (* JS_DLL_CALLBACK JSCheckAccessOp)(JSContext *, JSObject *, jsval, JSAccessMode, jsval *);
117 typedef JSBool (* JS_DLL_CALLBACK JSNative)(JSContext *, JSObject *, uintN, jsval *, jsval *);
118 typedef JSBool (* JS_DLL_CALLBACK JSXDRObjectOp)(JSXDRState *, JSObject **);
119 typedef JSBool (* JS_DLL_CALLBACK JSHasInstanceOp)(JSContext *, JSObject *, jsval, JSBool *);
120 typedef uint32_t (* JS_DLL_CALLBACK JSMarkOp)(JSContext *, JSObject *, void *);
121
122 struct JSClass {
123 const char * name;
124 uint32_t flags;
125 JSPropertyOp addProperty;
126 JSPropertyOp delProperty;
127 JSPropertyOp getProperty;
128 JSPropertyOp setProperty;
129 JSEnumerateOp enumerate;
130 JSResolveOp resolve;
131 JSConvertOp convert;
132 JSFinalizeOp finalize;
133 JSGetObjectOps getObjectOps;
134 JSCheckAccessOp checkAccess;
135 JSNative call;
136 JSNative construct;
137 JSXDRObjectOp xdrObject;
138 JSHasInstanceOp hasInstance;
139 JSMarkOp mark;
140 jsword spare;
141 };
142
143 struct JSPropertySpec {
144 const char * name;
145 int8_t tinyid;
146 uint8_t flags;
147 JSPropertyOp getter;
148 JSPropertyOp setter;
149 };
150
151 struct JSFunctionSpec {
152 const char *name;
153 JSNative call;
154 uint8_t nargs;
155 uint8_t flags;
156 uint16_t extra;
157 };
158
159 struct JSErrorReport {
160 const char * filename;
161 uintN lineno;
162 const char * linebuf;
163 const char * tokenptr;
164 const jschar * uclinebuf;
165 const jschar * uctokenptr;
166 uintN flags;
167 uintN errorNumber;
168 const jschar * ucmessage;
169 const jschar ** messageArgs;
170 };
171
172
173 /* Defines and macros. ************************************************** */
174
175 #define JSVAL_OBJECT 0x0
176 #define JSVAL_INT 0x1
177 #define JSVAL_DOUBLE 0x2
178 #define JSVAL_STRING 0x4
179 #define JSVAL_BOOLEAN 0x6
180
181 #define JS_BIT(n) ((uint32_t)1 << (n))
182 #define JS_BITMASK(n) (JS_BIT(n) - 1)
183
184 #define JSVAL_TAGBITS 3
185 #define JSVAL_TAGMASK JS_BITMASK(JSVAL_TAGBITS)
186 #define JSVAL_TAG(v) ((v) & JSVAL_TAGMASK)
187 #define JSVAL_SETTAG(v,t) ((v) | (t))
188 #define JSVAL_CLRTAG(v) ((v) & ~(jsval)JSVAL_TAGMASK)
189
190 #define JSVAL_IS_PRIMITIVE(v) (!JSVAL_IS_OBJECT(v) || JSVAL_IS_NULL(v))
191 #define JSVAL_IS_OBJECT(v) (JSVAL_TAG(v) == JSVAL_OBJECT)
192 #define JSVAL_IS_NUMBER(v) (JSVAL_IS_INT(v) || JSVAL_IS_DOUBLE(v))
193 #define JSVAL_IS_INT(v) (((v) & JSVAL_INT) && (v) != JSVAL_VOID)
194 #define JSVAL_IS_DOUBLE(v) (JSVAL_TAG(v) == JSVAL_DOUBLE)
195 #define JSVAL_IS_STRING(v) (JSVAL_TAG(v) == JSVAL_STRING)
196 #define JSVAL_IS_BOOLEAN(v) (JSVAL_TAG(v) == JSVAL_BOOLEAN)
197 #define JSVAL_IS_NULL(v) ((v) == JSVAL_NULL)
198 #define JSVAL_IS_VOID(v) ((v) == JSVAL_VOID)
199
200 #define BOOLEAN_TO_JSVAL(b) JSVAL_SETTAG((jsval)(b) << JSVAL_TAGBITS, JSVAL_BOOLEAN)
201 #define JSVAL_TO_BOOLEAN(v) ((JSBool)((v) >> JSVAL_TAGBITS))
202
203 #define JSVAL_INT_BITS 31
204 #define JSVAL_INT_POW2(n) ((jsval)1 << (n))
205 #define JSVAL_INT_MIN ((jsval)1 - JSVAL_INT_POW2(30))
206 #define JSVAL_INT_MAX (JSVAL_INT_POW2(30) - 1)
207 #define INT_FITS_IN_JSVAL(i) ((uint32_t)((i)+JSVAL_INT_MAX) <= 2*JSVAL_INT_MAX)
208 #define JSVAL_TO_INT(v) ((int32_t)(v) >> 1)
209 #define INT_TO_JSVAL(i) (((jsval)(i) << 1) | JSVAL_INT)
210
211 #define JSVAL_TO_GCTHING(v) ((void *)JSVAL_CLRTAG(v))
212 #define JSVAL_TO_OBJECT(v) ((JSObject *)JSVAL_TO_GCTHING(v))
213 #define JSVAL_TO_DOUBLE(v) ((double *)JSVAL_TO_GCTHING(v))
214 #define JSVAL_TO_STRING(v) ((JSString *)JSVAL_TO_GCTHING(v))
215 #define OBJECT_TO_JSVAL(obj) ((jsval)(obj))
216 #define DOUBLE_TO_JSVAL(dp) JSVAL_SETTAG((jsval)(dp), JSVAL_DOUBLE)
217 #define STRING_TO_JSVAL(str) JSVAL_SETTAG((jsval)(str), JSVAL_STRING)
218 #define JSVAL_TO_PRIVATE(v) ((void *)((v) & ~JSVAL_INT))
219 #define PRIVATE_TO_JSVAL(p) ((jsval)(p) | JSVAL_INT)
220
221 #define JSPROP_ENUMERATE 0x01
222 #define JSPROP_READONLY 0x02
223 #define JSPROP_PERMANENT 0x04
224 #define JSPROP_EXPORTED 0x08
225 #define JSPROP_GETTER 0x10
226 #define JSPROP_SETTER 0x20
227 #define JSPROP_SHARED 0x40
228 #define JSPROP_INDEX 0x80
229
230 #define JS_FALSE (int)0
231 #define JS_TRUE (int)1
232
233 #define JSVAL_VOID INT_TO_JSVAL(0 - JSVAL_INT_POW2(30))
234 #define JSVAL_NULL OBJECT_TO_JSVAL(0)
235 #define JSVAL_ZERO INT_TO_JSVAL(0)
236 #define JSVAL_ONE INT_TO_JSVAL(1)
237 #define JSVAL_FALSE BOOLEAN_TO_JSVAL(JS_FALSE)
238 #define JSVAL_TRUE BOOLEAN_TO_JSVAL(JS_TRUE)
239
240 #define JSCLASS_HAS_PRIVATE (1<<0)
241 #define JSCLASS_NEW_ENUMERATE (1<<1)
242 #define JSCLASS_NEW_RESOLVE (1<<2)
243 #define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3)
244 #define JSCLASS_SHARE_ALL_PROPERTIES (1<<4)
245 #define JSCLASS_NEW_RESOLVE_GETS_START (1<<5)
246
247 #define JSFUN_BOUND_METHOD 0x40
248
249 #define JSOPTION_STRICT JS_BIT(0)
250 #define JSOPTION_WERROR JS_BIT(1)
251 #define JSOPTION_VAROBJFIX JS_BIT(2)
252 #define JSOPTION_PRIVATE_IS_NSISUPPORTS JS_BIT(3)
253 #define JSOPTION_COMPILE_N_GO JS_BIT(4)
254
255
256 /* Function typedefs. *************************************************** */
257
258 typedef void (* JS_DLL_CALLBACK JSErrorReporter)(JSContext *, const char *, JSErrorReport *);
259 typedef JSBool (* JS_DLL_CALLBACK JSGCCallback)(JSContext *, JSGCStatus);
260
261 #endif /* !JSVERSION_IS_ECMA */
262
263 typedef JSBool (* JS_EvaluateScript_t)(JSContext *, JSObject *, const char *, uintN, const char *, uintN, jsval *);
264 typedef JSString * (* JS_ValueToString_t)(JSContext *, jsval);
265 typedef char * (* JS_GetStringBytes_t)(JSString *);
266 typedef JSBool (* JS_SetProperty_t)(JSContext *, JSObject *, const char *, jsval *);
267 typedef JSBool (* JS_GetProperty_t)(JSContext *, JSObject *, const char *, jsval *);
268 typedef JSBool (* JS_CallFunctionName_t)(JSContext *, JSObject *, const char *, uintN, jsval *, jsval *);
269 typedef JSBool (* JS_CallFunctionValue_t)(JSContext *, JSObject *, jsval, uintN, jsval *, jsval *);
270 typedef JSObject * (* JS_ConstructObjectWithArguments_t)(JSContext *, JSClass *, JSObject *, JSObject *, uintN, jsval *);
271 typedef JSRuntime * (* JS_NewRuntime_t)(uint32_t);
272 typedef void (* JS_DestroyRuntime_t)(JSRuntime *);
273 typedef JSContext * (* JS_NewContext_t)(JSRuntime *, size_t);
274 typedef void (* JS_DestroyContext_t)(JSContext *);
275 typedef void (* JS_ShutDown_t)(void);
276 typedef JSObject * (* JS_NewObject_t)(JSContext *, JSClass *, JSObject *, JSObject *);
277 typedef JSBool (* JS_InitStandardClasses_t)(JSContext *, JSObject *);
278 typedef JSErrorReporter (* JS_SetErrorReporter_t)(JSContext *, JSErrorReporter);
279 typedef JSBool (* JS_PropertyStub_t)(JSContext *, JSObject *, jsval, jsval *);
280 typedef JSBool (* JS_EnumerateStub_t)(JSContext *, JSObject *);
281 typedef JSBool (* JS_ResolveStub_t)(JSContext *, JSObject *, jsval);
282 typedef JSBool (* JS_ConvertStub_t)(JSContext *, JSObject *, JSType, jsval *);
283 typedef void (* JS_FinalizeStub_t)(JSContext *, JSObject *);
284 typedef const char * (* JS_GetImplementationVersion_t)(void);
285 typedef void * (* JS_GetPrivate_t)(JSContext *, JSObject *);
286 typedef JSBool (* JS_SetPrivate_t)(JSContext *, JSObject *, void *);
287 typedef JSFunction * (* JS_NewFunction_t)(JSContext *, JSNative, uintN, uintN flags, JSObject *, const char *);
288 typedef JSObject * (* JS_GetFunctionObject_t)(JSFunction *);
289 typedef JSObject * (* JS_DefineObject_t)(JSContext *, JSObject *, const char *, JSClass *, JSObject *, uintN);
290 typedef JSBool (* JS_DefineProperties_t)(JSContext *, JSObject *, JSPropertySpec *);
291 typedef JSObject * (* JS_GetParent_t)(JSContext *, JSObject *);
292 typedef JSBool (* JS_SetParent_t)(JSContext *, JSObject *, JSObject *);
293 typedef JSBool (* JS_DefineFunctions_t)(JSContext *, JSObject *, JSFunctionSpec *);
294 typedef JSString * (* JS_NewStringCopyZ_t)(JSContext *, const char *);
295 typedef JSType (* JS_TypeOfValue_t)(JSContext *, jsval);
296 typedef const char * (* JS_GetTypeName_t)(JSContext *, JSType);
297 typedef JSBool (* JS_InstanceOf_t)(JSContext *, JSObject *, JSClass *, jsval *);
298 typedef JSObject * (* JS_InitClass_t)(JSContext *, JSObject *, JSObject *, JSClass *,
299 JSNative, uintN, JSPropertySpec *, JSFunctionSpec *,
300 JSPropertySpec *, JSFunctionSpec *);
301 typedef JSBool (* JS_NewDoubleValue_t)(JSContext *, double, jsval *);
302 typedef void * (* JS_GetContextPrivate_t)(JSContext *);
303 typedef void (* JS_SetContextPrivate_t)(JSContext *, void *);
304 typedef JSBool (* JS_ValueToBoolean_t)(JSContext *, jsval, JSBool *);
305 typedef JSBool (* JS_ValueToNumber_t)(JSContext *, jsval, double *);
306 typedef JSObject * (* JS_NewArrayObject_t)(JSContext *, int32_t, jsval *);
307 typedef JSBool (* JS_GetArrayLength_t)(JSContext *, JSObject *, uint32_t *);
308 typedef JSBool (* JS_SetArrayLength_t)(JSContext *, JSObject *, uint32_t);
309 typedef JSBool (* JS_HasArrayLength_t)(JSContext *, JSObject *, uint32_t *);
310 typedef JSBool (* JS_GetElement_t)(JSContext *, JSObject *, int32_t, jsval *);
311 typedef JSBool (* JS_SetElement_t)(JSContext *, JSObject *, int32_t, jsval *);
312 typedef JSBool (* JS_AddRoot_t)(JSContext *, void *);
313 typedef JSBool (* JS_RemoveRoot_t)(JSContext *, void *);
314 typedef size_t (* JS_GetStringLength_t)(JSString *);
315 typedef JSBool (* JS_LookupProperty_t)(JSContext *, JSObject *, const char *, jsval *);
316 typedef JSBool (* JS_DefineProperty_t)(JSContext *, JSObject *, const char *, jsval, JSPropertyOp, JSPropertyOp, uintN);
317 typedef JSScript * (* JS_CompileFile_t)(JSContext *, JSObject *, const char *);
318 typedef JSBool (* JS_ValueToObject_t)(JSContext *, jsval, JSObject **);
319 typedef JSBool (* JS_ExecuteScript_t)(JSContext *, JSObject *, JSScript *, jsval *);
320 typedef JSBool (* JS_IsExceptionPending_t)(JSContext *);
321 typedef JSBool (* JS_GetPendingException_t)(JSContext *, jsval *);
322 typedef void (* JS_SetPendingException_t)(JSContext *, jsval);
323 typedef void (* JS_ClearPendingException_t)(JSContext *);
324 typedef double * (* JS_NewDouble_t)(JSContext *, double);
325 typedef JSBool (* JS_CallFunction_t)(JSContext *, JSObject *, JSFunction *, uintN, jsval *, jsval *);
326 typedef JSFunction * (* JS_ValueToFunction_t)(JSContext *, jsval);
327 typedef void (* JS_ReportError_t)(JSContext *, const char *, ...);
328 typedef JSBool (* JS_IsArrayObject_t)(JSContext *, JSObject *);
329 typedef JSBool (* JS_ObjectIsFunction_t)(JSContext *, JSObject *);
330 typedef JSBool (* JS_ValueToECMAInt32_t)(JSContext *, jsval, int32_t *);
331 typedef JSFunction * (* JS_DefineFunction_t)(JSContext *, JSObject *, const char *, JSNative, uintN, uintN);
332 typedef JSObject * (* JS_GetGlobalObject_t)(JSContext *);
333 typedef JSGCCallback (* JS_SetGCCallback_t)(JSContext *, JSGCCallback);
334 typedef void (* JS_GC_t)(JSContext *);
335 typedef void (* JS_MaybeGC_t)(JSContext *);
336 typedef JSBool (* JS_IsRunning_t)(JSContext *);
337 typedef JSBool (* JS_DeleteProperty_t)(JSContext *, JSObject *, const char *);
338 typedef JSScript * (* JS_CompileScript_t)(JSContext *, JSObject *,
339 const char *, size_t,
340 const char *, uintN);
341 typedef jsval (* JS_GetNaNValue_t)(JSContext *);
342 typedef jsval (* JS_GetNegativeInfinityValue_t)(JSContext *);
343 typedef jsval (* JS_GetPositiveInfinityValue_t)(JSContext *);
344 typedef jsval (* JS_GetEmptyStringValue_t)(JSContext *);
345 typedef JSBool (* JS_SetPropertyAttributes_t)(JSContext *, JSObject *, const char *, uintN, JSBool *);
346 typedef JSBool (* JS_GetPropertyAttributes_t)(JSContext *, JSObject *, const char *, uintN *, JSBool *);
347 typedef JSClass * (* JS_GetClass_t)(JSObject *);
348 typedef JSObject * (* JS_GetPrototype_t)(JSContext *, JSObject *);
349 typedef JSObject * (* JS_SetPrototype_t)(JSContext *, JSObject *, JSObject *);
350 typedef intN (* JS_CompareStrings_t)(JSString *, JSString *);
351 typedef uint32_t (* JS_GetOptions_t)(JSContext *);
352 typedef uint32_t (* JS_SetOptions_t)(JSContext *, uint32_t);
353 typedef uint32_t (* JS_ToggleOptions_t)(JSContext *, uint32_t);
354 typedef struct JSIdArray * (* JS_Enumerate_t)(JSContext *, JSObject *);
355 typedef JSBool (* JS_IdToValue_t)(JSContext *, jsid, jsval *);
356 typedef const char * (* JS_GetFunctionName_t)(JSFunction *);
357 typedef JSObject * (* JS_GetConstructor_t)(JSContext *, JSObject *);
358 typedef void (* JS_DestroyIdArray_t)(JSContext *, struct JSIdArray *);
359
360
361 /* Access interface. **************************************************** */
362
363 typedef struct {
364 int available;
365
366 JS_CallFunctionName_t JS_CallFunctionName;
367 JS_CallFunctionValue_t JS_CallFunctionValue;
368 JS_ConstructObjectWithArguments_t JS_ConstructObjectWithArguments;
369 JS_ConvertStub_t JS_ConvertStub;
370 JS_DestroyContext_t JS_DestroyContext;
371 JS_DestroyRuntime_t JS_DestroyRuntime;
372 JS_EnumerateStub_t JS_EnumerateStub;
373 JS_EvaluateScript_t JS_EvaluateScript;
374 JS_FinalizeStub_t JS_FinalizeStub;
375 JS_GetClass_t JS_GetClass;
376 JS_GetImplementationVersion_t JS_GetImplementationVersion;
377 JS_GetProperty_t JS_GetProperty;
378 JS_GetStringBytes_t JS_GetStringBytes;
379 JS_InitStandardClasses_t JS_InitStandardClasses;
380 JS_NewContext_t JS_NewContext;
381 JS_NewObject_t JS_NewObject;
382 JS_NewRuntime_t JS_NewRuntime;
383 JS_PropertyStub_t JS_PropertyStub;
384 JS_ResolveStub_t JS_ResolveStub;
385 JS_SetErrorReporter_t JS_SetErrorReporter;
386 JS_SetProperty_t JS_SetProperty;
387 JS_ShutDown_t JS_ShutDown;
388 JS_ValueToString_t JS_ValueToString;
389 JS_DefineObject_t JS_DefineObject;
390 JS_DefineProperties_t JS_DefineProperties;
391 JS_GetPrivate_t JS_GetPrivate;
392 JS_SetPrivate_t JS_SetPrivate;
393 JS_NewFunction_t JS_NewFunction;
394 JS_GetFunctionObject_t JS_GetFunctionObject;
395 JS_GetParent_t JS_GetParent;
396 JS_SetParent_t JS_SetParent;
397 JS_DefineFunctions_t JS_DefineFunctions;
398 JS_NewStringCopyZ_t JS_NewStringCopyZ;
399 JS_TypeOfValue_t JS_TypeOfValue;
400 JS_GetTypeName_t JS_GetTypeName;
401 JS_InstanceOf_t JS_InstanceOf;
402 JS_InitClass_t JS_InitClass;
403 JS_NewDoubleValue_t JS_NewDoubleValue;
404 JS_GetContextPrivate_t JS_GetContextPrivate;
405 JS_SetContextPrivate_t JS_SetContextPrivate;
406 JS_ValueToBoolean_t JS_ValueToBoolean;
407 JS_ValueToNumber_t JS_ValueToNumber;
408 JS_NewArrayObject_t JS_NewArrayObject;
409 JS_GetArrayLength_t JS_GetArrayLength;
410 JS_SetArrayLength_t JS_SetArrayLength;
411 JS_HasArrayLength_t JS_HasArrayLength;
412 JS_GetElement_t JS_GetElement;
413 JS_SetElement_t JS_SetElement;
414 JS_AddRoot_t JS_AddRoot;
415 JS_RemoveRoot_t JS_RemoveRoot;
416 JS_GetStringLength_t JS_GetStringLength;
417 JS_LookupProperty_t JS_LookupProperty;
418 JS_DefineProperty_t JS_DefineProperty;
419 JS_CompileFile_t JS_CompileFile;
420 JS_ValueToObject_t JS_ValueToObject;
421 JS_ExecuteScript_t JS_ExecuteScript;
422 JS_IsExceptionPending_t JS_IsExceptionPending;
423 JS_GetPendingException_t JS_GetPendingException;
424 JS_SetPendingException_t JS_SetPendingException;
425 JS_ClearPendingException_t JS_ClearPendingException;
426 JS_NewDouble_t JS_NewDouble;
427 JS_CallFunction_t JS_CallFunction;
428 JS_ValueToFunction_t JS_ValueToFunction;
429 JS_ReportError_t JS_ReportError;
430 JS_IsArrayObject_t JS_IsArrayObject;
431 JS_ObjectIsFunction_t JS_ObjectIsFunction;
432 // Note: We use this function instead of JS_ValueToInt32() since the
433 // latter is buggy in versions of SpiderMonkey older than 2005-09-29,
434 // see Mozilla bug #284032.
435 JS_ValueToECMAInt32_t JS_ValueToECMAInt32;
436 JS_DefineFunction_t JS_DefineFunction;
437 JS_GetGlobalObject_t JS_GetGlobalObject;
438 JS_SetGCCallback_t JS_SetGCCallback;
439 JS_GC_t JS_GC;
440 JS_MaybeGC_t JS_MaybeGC;
441 JS_IsRunning_t JS_IsRunning;
442 JS_DeleteProperty_t JS_DeleteProperty;
443 JS_CompileScript_t JS_CompileScript;
444 JS_GetNaNValue_t JS_GetNaNValue;
445 JS_GetNegativeInfinityValue_t JS_GetNegativeInfinityValue;
446 JS_GetPositiveInfinityValue_t JS_GetPositiveInfinityValue;
447 JS_GetEmptyStringValue_t JS_GetEmptyStringValue;
448 JS_SetPropertyAttributes_t JS_SetPropertyAttributes;
449 JS_GetPropertyAttributes_t JS_GetPropertyAttributes;
450 JS_GetPrototype_t JS_GetPrototype;
451 JS_SetPrototype_t JS_SetPrototype;
452 JS_CompareStrings_t JS_CompareStrings;
453 JS_GetOptions_t JS_GetOptions;
454 JS_SetOptions_t JS_SetOptions;
455 JS_ToggleOptions_t JS_ToggleOptions;
456 JS_Enumerate_t JS_Enumerate;
457 JS_IdToValue_t JS_IdToValue;
458 JS_GetFunctionName_t JS_GetFunctionName;
459 JS_GetConstructor_t JS_GetConstructor;
460 JS_DestroyIdArray_t JS_DestroyIdArray;
461
462 } SpiderMonkey_t;
463
464 COIN_DLL_API const SpiderMonkey_t * spidermonkey(void);
465
466 #ifdef __cplusplus
467 }
468 #endif /* __cplusplus */
469
470 #endif /* !COIN_GLUE_SPIDERMONKEY_H */

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.