35 #ifndef __FREEWRL_JS_UTILS_H__
36 #define __FREEWRL_JS_UTILS_H__
39 #include <system_js.h>
45 #define CLEANUP_JAVASCRIPT(cx) \
49 #define LARGESTRING 2048
51 #define SMALLSTRING 128
53 #define FNAME_STUB "file"
60 int findInECMATable(JSContext *context, jsval toFind);
61 int findNameInECMATable(JSContext *context,
char *toFind);
62 void resetNameInECMATable(JSContext *context,
char *toFind);
69 int jsrrunScript(JSContext *_context, JSObject *_globalObj,
char *script, jsval *rval);
70 int JS_DefineSFNodeSpecificProperties (JSContext *context, JSObject *
object,
struct X3D_Node * ptr);
72 #ifdef JAVASCRIPTVERBOSE
73 # define ACTUALRUNSCRIPT(a,b,c) ActualrunScript(a,b,c,__FILE__,__LINE__)
76 # define ACTUALRUNSCRIPT(a,b,c) ActualrunScript(a,b,c)
81 reportWarningsOn(
void);
84 reportWarningsOff(
void);
87 errorReporter(JSContext *cx,
89 JSErrorReport *report);
91 void X3D_ECMA_TO_JS(JSContext *cx,
void *Data,
int datalen,
int dataType, jsval *ret);
93 JSBool setSFNodeField (JSContext *context, JSObject *obj, jsid
id, jsval *vp);
95 JSBool setSFNodeField (JSContext *context, JSObject *obj, jsid
id, JSBool strict, jsval *vp);
98 const char *classToString(JSClass *myClass);
99 #define CHECK_CLASS(cx,obj,argv,fnString,expClass) \
101 if (!JS_InstanceOf(cx, obj, &expClass, argv)) { \
102 printf ("Javascript Instance problem in '%s' - expected a '%s', got a ", fnString, classToString(&expClass)); \
103 printJSNodeType (cx,obj); \