From e1a22a07220fde710a26bc89ce80739fae99764c Mon Sep 17 00:00:00 2001 From: Jaromil Date: Wed, 11 Mar 2009 15:16:22 +0100 Subject: [PATCH] link libmozjs (spidermonkey) from shared library tested on ubuntu with xulrunner-js, still their packaging has bugs and i guess debian too. but let's see and test around --- bindings/Makefile.am | 6 +- bindings/python/Makefile.am | 4 +- configure.in | 60 +++++++++++--- lib/Makefile.am | 2 +- src/Makefile.am | 22 +++--- src/filter_js.cpp | 6 +- src/geo_layer_js.cpp | 154 ++++++++++++++++++------------------ src/layer_js.cpp | 8 +- 8 files changed, 145 insertions(+), 117 deletions(-) diff --git a/bindings/Makefile.am b/bindings/Makefile.am index f9158b29..565db91b 100644 --- a/bindings/Makefile.am +++ b/bindings/Makefile.am @@ -3,12 +3,10 @@ INCLUDES = -I$(top_srcdir)/src/include \ -I$(top_srcdir)/lib/cwiid \ -I$(top_srcdir)/lib/shout \ -I$(top_srcdir)/lib/sdl_ttf \ - -I$(top_srcdir)/lib/sdl_gfx \ - -I$(top_srcdir)/lib/javascript \ - -I$(top_srcdir)/lib/javascript/obj + -I$(top_srcdir)/lib/sdl_gfx -FREEJ_FLAGS = @SDL_CFLAGS@ @FT2_CFLAGS@ @XIPH_CFLAGS@ @UNICAP_CFLAGS@ @FFMPEG_CFLAGS@ +FREEJ_FLAGS = @SDL_CFLAGS@ @FT2_CFLAGS@ @XIPH_CFLAGS@ @UNICAP_CFLAGS@ @FFMPEG_CFLAGS@ @MOZJS_CFLAGS@ # SWIG_SOURCES = freej.i # SWIG_CFLAGS = -modern ${SWIG_ADD_CFLAGS} diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am index d1f1bb59..313c9215 100644 --- a/bindings/python/Makefile.am +++ b/bindings/python/Makefile.am @@ -5,12 +5,10 @@ INCLUDES = -I$(top_srcdir)/src/include \ -I$(top_srcdir)/lib/shout \ -I$(top_srcdir)/lib/sdl_ttf \ -I$(top_srcdir)/lib/sdl_gfx \ - -I$(top_srcdir)/lib/javascript \ - -I$(top_srcdir)/lib/javascript/obj \ -I/usr/include/slang -FREEJ_FLAGS = @SDL_CFLAGS@ @FT2_CFLAGS@ @XIPH_CFLAGS@ @UNICAP_CFLAGS@ @FFMPEG_CFLAGS@ +FREEJ_FLAGS = @SDL_CFLAGS@ @FT2_CFLAGS@ @XIPH_CFLAGS@ @UNICAP_CFLAGS@ @FFMPEG_CFLAGS@ @MOZJS_CFLAGS@ BUILT_SOURCES = freej_py.cpp diff --git a/configure.in b/configure.in index 5248b522..4f60ce12 100644 --- a/configure.in +++ b/configure.in @@ -351,7 +351,7 @@ AC_ARG_ENABLE(flash, else have_flash=yes; fi ],[ have_flash=yes ]) -AC_MSG_CHECKING(compiling flash (v3 animation only) layer) +AC_MSG_CHECKING(compiling flash - v3 animation only - layer) if test x$have_flash = xyes; then AC_DEFINE(WITH_FLASH,1,[define if compiling flash layer]) FLASH_LIBS="\$(top_srcdir)/lib/flash/libflash.la" @@ -605,21 +605,50 @@ AC_SUBST(GOOM_PPC_FILES) dnl ============================================================== dnl compile including the javascript interpreter dnl ============================================================== -AC_DEFINE(WITH_JAVASCRIPT,1,[Define is using the javascript interpreter]) -if test x$have_linux = xyes ; then - AC_DEFINE(XP_UNIX,1,[Define use of UNIX types in javascript]) -fi -if test x$have_darwin = xyes ; then - AC_DEFINE(XP_MAC,1,[Define use of MAC types in javascript]) -fi -if test x$debug = xyes ; then - JS_CFLAGS="$JS_CFLAGS -DJS_GCMETER" + +MOZJS_LIBS="" +MOZJS_CFLAGS="" +JS_DIR="" +# ubuntu check for libmozjs-dev +# i guess debian calls it something else +# these distros are so good at making developers life more difficult GRRR +PKG_CHECK_MODULES(MOZJS, xulrunner-js, have_mozjs=yes, have_mozjs=no) +if test x$have_mozjs = xyes; then + MOZJS_CFLAGS="$MOZJS_CFLAGS -DJS_GCMETER" + +dnl see https://bugs.launchpad.net/ubuntu/+source/xulrunner-1.9/+bug/273956 +dnl pps will fail to link libmozjs since the library is compiled without -DJS_THREADSAFE +dnl and to the contrary the .pc file xulrunner-js adopts -DJS_THREADSAFE in the CFLAGS +dnl this will generate such an error: +dnl undefined reference to `js_GetSlotThreadSafe(JSContext*, JSObject*, unsigned int)' + MOZJS_CFLAGS="`echo $MOZJS_CFLAGS | sed 's/-DJS_THREADSAFE//'`" +dnl i really cannot figure out how comes the packaging of xulrunner is such a crap +dnl in debian, ubuntu and so on. we are stuck at static linking since years :/ + +else + MOZJS_CFLAGS=" -I\$(top_srcdir)/lib/javascript -I\$(top_srcdir)/lib/javascript/obj " + MOZJS_LIBS="\$(top_srcdir)/lib/javascript/obj/libjs.a" + JS_DIR="javascript" + if test x$have_linux = xyes ; then + AC_DEFINE(XP_UNIX,1,[Define use of UNIX types in javascript]) + fi + if test x$have_darwin = xyes ; then + AC_DEFINE(XP_MAC,1,[Define use of MAC types in javascript]) + fi + if test x$debug = xyes ; then + MOZJS_CFLAGS="$MOZJS_CFLAGS -DJS_GCMETER" + fi fi +AC_DEFINE(WITH_JAVASCRIPT,1,[Define if using libmozjs for spidermonkey javascript]) +AC_SUBST(MOZJS_LIBS) +AC_SUBST(MOZJS_CFLAGS) +AC_SUBST(JS_DIR) - -AC_SUBST(BUILDLIBS) -AC_SUBST(STATIC_LIBS) +dnl OLD STATIC: +dnl AC_DEFINE(WITH_JAVASCRIPT,1,[Define is using the javascript interpreter]) +dnl AC_SUBST(BUILDLIBS) +dnl AC_SUBST(STATIC_LIBS) dnl ============================================================== @@ -823,6 +852,11 @@ else echo " in case you are packing a binary package please take care" echo " because of this many users will miss important functionality" fi + +echo "= javascript interpreter" +echo " LIBS : $MOZJS_LIBS" +echo " CFLAGS: $MOZJS_CFLAGS" + if test x$have_unicap = xyes; then echo "= unicap library" echo " LIBS : $UNICAP_LIBS" diff --git a/lib/Makefile.am b/lib/Makefile.am index 5363c813..68ffd95c 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -4,8 +4,8 @@ SUBDIRS = ccvt \ sdl_ttf \ lo \ shout \ - javascript \ frei0r \ + @JS_DIR@ \ @GOOM_DIR@ \ @CWIID_DIR@ \ @FLASH_DIR@ diff --git a/src/Makefile.am b/src/Makefile.am index fd89dfb0..a02bc83b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,15 +6,13 @@ INCLUDES = -I$(top_srcdir)/src/include \ -I$(top_srcdir)/lib/sdl_image \ -I$(top_srcdir)/lib/sdl_gfx \ -I$(top_srcdir)/lib/sdl_ttf \ - -I$(top_srcdir)/lib/javascript \ - -I$(top_srcdir)/lib/javascript/obj \ -I$(top_srcdir)/lib/flash \ -I$(top_srcdir)/lib/goom \ -I$(top_srcdir)/lib/cwiid \ -I/usr/include/slang #-freg-struct-return is to compile an host compatible with freeframe dso -AM_CXXFLAGS = @SDL_CFLAGS@ @FT2_CFLAGS@ @FC_CFLAGS@ @XIPH_CFLAGS@ @UNICAP_CFLAGS@ @FFMPEG_CFLAGS@ \ +AM_CXXFLAGS = @SDL_CFLAGS@ @FT2_CFLAGS@ @FC_CFLAGS@ @XIPH_CFLAGS@ @UNICAP_CFLAGS@ @FFMPEG_CFLAGS@ @MOZJS_CFLAGS@ \ -freg-struct-return \ -DPREFIX="\"$(prefix)\"" -DDATADIR="\"$(datadir)\"" @@ -102,18 +100,18 @@ JS_SOURCES = context_js.cpp \ audio_collector_js.cpp -static_libs = $(top_builddir)/lib/ccvt/libccvt.la \ - $(top_builddir)/lib/sdl_image/libsdl_image.la \ - $(top_builddir)/lib/sdl_gfx/libsdl_gfx.la \ - $(top_builddir)/lib/sdl_ttf/libsdl_ttf.la \ - $(top_builddir)/lib/shout/libshout.la \ - $(top_builddir)/lib/lo/liblo.la \ - $(top_builddir)/lib/javascript/obj/libjs.a +static_libs = $(top_srcdir)/lib/ccvt/libccvt.la \ + $(top_srcdir)/lib/sdl_image/libsdl_image.la \ + $(top_srcdir)/lib/sdl_gfx/libsdl_gfx.la \ + $(top_srcdir)/lib/sdl_ttf/libsdl_ttf.la \ + $(top_srcdir)/lib/shout/libshout.la \ + $(top_srcdir)/lib/lo/liblo.la +# $(top_srcdir)/lib/javascript/obj/libjs.a shared_libs = -ldl -lpthread -lm -lslang -lpng -ljpeg -lrt \ @X11_LIBS@ \ @XIPH_LIBS@ \ - @STATIC_LIBS@ \ + @MOZJS_LIBS@ \ @OPENGL_LIB@ \ @SDL_LIBS@ \ @FLASH_LIBS@ \ @@ -139,6 +137,6 @@ libfreej_la_LDFLAGS = -version-info @FREEJ_VERSION_INFO@ bin_PROGRAMS = freej freej_SOURCES = freej.cpp -freej_LDADD = -L$(top_builddir)/src/.libs -lfreej +freej_LDADD = -L$(top_srcdir)/src/.libs -lfreej diff --git a/src/filter_js.cpp b/src/filter_js.cpp index 92209900..97ae39e8 100644 --- a/src/filter_js.cpp +++ b/src/filter_js.cpp @@ -121,7 +121,7 @@ JS(filter_set_parameter) { case Parameter::BOOL: case Parameter::NUMBER: { - if(!js_ValueToNumber(cx, argv[1], &val[0])) { + if(!JS_ValueToNumber(cx, argv[1], &val[0])) { error("set parameter called with an invalid value for filter %s", duo->proto->name); return JS_TRUE; @@ -135,12 +135,12 @@ JS(filter_set_parameter) { break; } case Parameter::POSITION: - if(!js_ValueToNumber(cx, argv[1], &val[0])) { + if(!JS_ValueToNumber(cx, argv[1], &val[0])) { error("set parameter called with an invalid value for filter %s", duo->proto->name); return JS_TRUE; } - if(!js_ValueToNumber(cx, argv[2], &val[1])) { + if(!JS_ValueToNumber(cx, argv[2], &val[1])) { error("set parameter called with an invalid value for filter %s", duo->proto->name); return JS_TRUE; diff --git a/src/geo_layer_js.cpp b/src/geo_layer_js.cpp index b54a91e2..3b801509 100644 --- a/src/geo_layer_js.cpp +++ b/src/geo_layer_js.cpp @@ -101,11 +101,11 @@ JS(geometry_layer_color) { lay->set_color((uint32_t)hex); } else { - js_ValueToUint16(cx, argv[0], &r); - js_ValueToUint16(cx, argv[1], &g); - js_ValueToUint16(cx, argv[2], &b); + JS_ValueToUint16(cx, argv[0], &r); + JS_ValueToUint16(cx, argv[1], &g); + JS_ValueToUint16(cx, argv[2], &b); if (argc == 4) - js_ValueToUint16(cx, argv[3], &a); + JS_ValueToUint16(cx, argv[3], &a); else a = 0xff; } @@ -123,8 +123,8 @@ JS(geometry_layer_pixel) { GET_LAYER(GeoLayer); uint16_t x,y; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y); OPTIONAL_COLOR_ARG(2); @@ -140,9 +140,9 @@ JS(geometry_layer_hline) { GET_LAYER(GeoLayer); uint16_t x1,x2,y; - js_ValueToUint16(cx, argv[0], &x1); - js_ValueToUint16(cx, argv[1], &x2); - js_ValueToUint16(cx, argv[2], &y); + JS_ValueToUint16(cx, argv[0], &x1); + JS_ValueToUint16(cx, argv[1], &x2); + JS_ValueToUint16(cx, argv[2], &y); OPTIONAL_COLOR_ARG(3); @@ -158,9 +158,9 @@ JS(geometry_layer_vline) { GET_LAYER(GeoLayer); uint16_t x,y1,y2; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y1); - js_ValueToUint16(cx, argv[2], &y2); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y1); + JS_ValueToUint16(cx, argv[2], &y2); OPTIONAL_COLOR_ARG(3); @@ -177,11 +177,11 @@ JS(geometry_layer_rectangle) { GET_LAYER(GeoLayer); uint16_t x1,x2,y1,y2; - js_ValueToUint16(cx, argv[0], &x1); - js_ValueToUint16(cx, argv[1], &y1); + JS_ValueToUint16(cx, argv[0], &x1); + JS_ValueToUint16(cx, argv[1], &y1); - js_ValueToUint16(cx, argv[2], &x2); - js_ValueToUint16(cx, argv[3], &y2); + JS_ValueToUint16(cx, argv[2], &x2); + JS_ValueToUint16(cx, argv[3], &y2); //uint32_t col; OPTIONAL_COLOR_ARG(4); @@ -198,11 +198,11 @@ JS(geometry_layer_rectangle_fill) { GET_LAYER(GeoLayer); uint16_t x1,x2,y1,y2; - js_ValueToUint16(cx, argv[0], &x1); - js_ValueToUint16(cx, argv[1], &y1); + JS_ValueToUint16(cx, argv[0], &x1); + JS_ValueToUint16(cx, argv[1], &y1); - js_ValueToUint16(cx, argv[2], &x2); - js_ValueToUint16(cx, argv[3], &y2); + JS_ValueToUint16(cx, argv[2], &x2); + JS_ValueToUint16(cx, argv[3], &y2); //uint32_t col; OPTIONAL_COLOR_ARG(4); @@ -219,11 +219,11 @@ JS(geometry_layer_line) { GET_LAYER(GeoLayer); uint16_t x1,x2,y1,y2; - js_ValueToUint16(cx, argv[0], &x1); - js_ValueToUint16(cx, argv[1], &y1); + JS_ValueToUint16(cx, argv[0], &x1); + JS_ValueToUint16(cx, argv[1], &y1); - js_ValueToUint16(cx, argv[2], &x2); - js_ValueToUint16(cx, argv[3], &y2); + JS_ValueToUint16(cx, argv[2], &x2); + JS_ValueToUint16(cx, argv[3], &y2); OPTIONAL_COLOR_ARG(4); @@ -239,11 +239,11 @@ JS(geometry_layer_aaline) { GET_LAYER(GeoLayer); uint16_t x1,x2,y1,y2; - js_ValueToUint16(cx, argv[0], &x1); - js_ValueToUint16(cx, argv[1], &y1); + JS_ValueToUint16(cx, argv[0], &x1); + JS_ValueToUint16(cx, argv[1], &y1); - js_ValueToUint16(cx, argv[2], &x2); - js_ValueToUint16(cx, argv[3], &y2); + JS_ValueToUint16(cx, argv[2], &x2); + JS_ValueToUint16(cx, argv[3], &y2); OPTIONAL_COLOR_ARG(4); @@ -259,9 +259,9 @@ JS(geometry_layer_circle) { GET_LAYER(GeoLayer); uint16_t x,y,r; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y); - js_ValueToUint16(cx, argv[2], &r); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y); + JS_ValueToUint16(cx, argv[2], &r); OPTIONAL_COLOR_ARG(3); @@ -277,9 +277,9 @@ JS(geometry_layer_aacircle) { GET_LAYER(GeoLayer); uint16_t x,y,r; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y); - js_ValueToUint16(cx, argv[2], &r); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y); + JS_ValueToUint16(cx, argv[2], &r); OPTIONAL_COLOR_ARG(3); @@ -295,9 +295,9 @@ JS(geometry_layer_circle_fill) { GET_LAYER(GeoLayer); uint16_t x,y,r; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y); - js_ValueToUint16(cx, argv[2], &r); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y); + JS_ValueToUint16(cx, argv[2], &r); OPTIONAL_COLOR_ARG(3); @@ -313,10 +313,10 @@ JS(geometry_layer_ellipse) { GET_LAYER(GeoLayer); uint16_t x,y,rx,ry; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y); - js_ValueToUint16(cx, argv[2], &rx); - js_ValueToUint16(cx, argv[3], &ry); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y); + JS_ValueToUint16(cx, argv[2], &rx); + JS_ValueToUint16(cx, argv[3], &ry); OPTIONAL_COLOR_ARG(4); @@ -332,10 +332,10 @@ JS(geometry_layer_aaellipse) { GET_LAYER(GeoLayer); uint16_t x,y,rx,ry; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y); - js_ValueToUint16(cx, argv[2], &rx); - js_ValueToUint16(cx, argv[3], &ry); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y); + JS_ValueToUint16(cx, argv[2], &rx); + JS_ValueToUint16(cx, argv[3], &ry); OPTIONAL_COLOR_ARG(4); @@ -351,10 +351,10 @@ JS(geometry_layer_ellipse_fill) { GET_LAYER(GeoLayer); uint16_t x,y,rx,ry; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y); - js_ValueToUint16(cx, argv[2], &rx); - js_ValueToUint16(cx, argv[3], &ry); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y); + JS_ValueToUint16(cx, argv[2], &rx); + JS_ValueToUint16(cx, argv[3], &ry); OPTIONAL_COLOR_ARG(4); @@ -370,11 +370,11 @@ JS(geometry_layer_pie) { GET_LAYER(GeoLayer); uint16_t x,y,rad,start,end; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y); - js_ValueToUint16(cx, argv[2], &rad); - js_ValueToUint16(cx, argv[3], &start); - js_ValueToUint16(cx, argv[4], &end); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y); + JS_ValueToUint16(cx, argv[2], &rad); + JS_ValueToUint16(cx, argv[3], &start); + JS_ValueToUint16(cx, argv[4], &end); OPTIONAL_COLOR_ARG(5); @@ -390,11 +390,11 @@ JS(geometry_layer_pie_fill) { GET_LAYER(GeoLayer); uint16_t x,y,rad,start,end; - js_ValueToUint16(cx, argv[0], &x); - js_ValueToUint16(cx, argv[1], &y); - js_ValueToUint16(cx, argv[2], &rad); - js_ValueToUint16(cx, argv[3], &start); - js_ValueToUint16(cx, argv[4], &end); + JS_ValueToUint16(cx, argv[0], &x); + JS_ValueToUint16(cx, argv[1], &y); + JS_ValueToUint16(cx, argv[2], &rad); + JS_ValueToUint16(cx, argv[3], &start); + JS_ValueToUint16(cx, argv[4], &end); OPTIONAL_COLOR_ARG(5); @@ -410,12 +410,12 @@ JS(geometry_layer_trigon) { GET_LAYER(GeoLayer); uint16_t x1,y1,x2,y2,x3,y3; - js_ValueToUint16(cx, argv[0], &x1); - js_ValueToUint16(cx, argv[1], &y1); - js_ValueToUint16(cx, argv[2], &x2); - js_ValueToUint16(cx, argv[3], &y2); - js_ValueToUint16(cx, argv[4], &x3); - js_ValueToUint16(cx, argv[5], &y3); + JS_ValueToUint16(cx, argv[0], &x1); + JS_ValueToUint16(cx, argv[1], &y1); + JS_ValueToUint16(cx, argv[2], &x2); + JS_ValueToUint16(cx, argv[3], &y2); + JS_ValueToUint16(cx, argv[4], &x3); + JS_ValueToUint16(cx, argv[5], &y3); OPTIONAL_COLOR_ARG(6); @@ -431,12 +431,12 @@ JS(geometry_layer_aatrigon) { GET_LAYER(GeoLayer); uint16_t x1,y1,x2,y2,x3,y3; - js_ValueToUint16(cx, argv[0], &x1); - js_ValueToUint16(cx, argv[1], &y1); - js_ValueToUint16(cx, argv[2], &x2); - js_ValueToUint16(cx, argv[3], &y2); - js_ValueToUint16(cx, argv[4], &x3); - js_ValueToUint16(cx, argv[5], &y3); + JS_ValueToUint16(cx, argv[0], &x1); + JS_ValueToUint16(cx, argv[1], &y1); + JS_ValueToUint16(cx, argv[2], &x2); + JS_ValueToUint16(cx, argv[3], &y2); + JS_ValueToUint16(cx, argv[4], &x3); + JS_ValueToUint16(cx, argv[5], &y3); OPTIONAL_COLOR_ARG(6); @@ -452,12 +452,12 @@ JS(geometry_layer_trigon_fill) { GET_LAYER(GeoLayer); uint16_t x1,y1,x2,y2,x3,y3; - js_ValueToUint16(cx, argv[0], &x1); - js_ValueToUint16(cx, argv[1], &y1); - js_ValueToUint16(cx, argv[2], &x2); - js_ValueToUint16(cx, argv[3], &y2); - js_ValueToUint16(cx, argv[4], &x3); - js_ValueToUint16(cx, argv[5], &y3); + JS_ValueToUint16(cx, argv[0], &x1); + JS_ValueToUint16(cx, argv[1], &y1); + JS_ValueToUint16(cx, argv[2], &x2); + JS_ValueToUint16(cx, argv[3], &y2); + JS_ValueToUint16(cx, argv[4], &x3); + JS_ValueToUint16(cx, argv[5], &y3); OPTIONAL_COLOR_ARG(6); diff --git a/src/layer_js.cpp b/src/layer_js.cpp index ccfaee9f..1e5a41fe 100644 --- a/src/layer_js.cpp +++ b/src/layer_js.cpp @@ -89,8 +89,8 @@ void *Layer::js_constructor(Context *env, JSContext *cx, JSObject *obj, return NULL; } } else if(argc==2) { - js_ValueToUint16(cx, argv[0], &width); - js_ValueToUint16(cx, argv[1], &height); + JS_ValueToUint16(cx, argv[0], &width); + JS_ValueToUint16(cx, argv[1], &height); if(!init(env, width, height)) { snprintf(err_msg, MAX_ERR_MSG, "Layer constructor failed initialization w[%u] h[%u]", width, height); @@ -98,8 +98,8 @@ void *Layer::js_constructor(Context *env, JSContext *cx, JSObject *obj, } } else if(argc==3) { - js_ValueToUint16(cx, argv[0], &width); - js_ValueToUint16(cx, argv[1], &height); + JS_ValueToUint16(cx, argv[0], &width); + JS_ValueToUint16(cx, argv[1], &height); JS_ARG_STRING(filename,2); if(!init(env, width, height)) { snprintf(err_msg, MAX_ERR_MSG,