summaryrefslogtreecommitdiff
path: root/community-testing
diff options
context:
space:
mode:
authorroot <root@rshg047.dnsready.net>2011-07-06 23:10:44 +0000
committerroot <root@rshg047.dnsready.net>2011-07-06 23:10:44 +0000
commitb215b5e985b9310dff8d992510f12a87141fe7cb (patch)
treebc81c9c0c02ab9a4d6ee15e553850141b8d46f94 /community-testing
parent9d2caacbc33de06407311a5da87e5d22e0266435 (diff)
Wed Jul 6 23:10:44 UTC 2011
Diffstat (limited to 'community-testing')
-rw-r--r--community-testing/coin/PKGBUILD54
-rw-r--r--community-testing/couchdb/PKGBUILD46
-rw-r--r--community-testing/couchdb/couchdb.install22
-rw-r--r--community-testing/couchdb/rc-script.patch90
-rw-r--r--community-testing/elinks/PKGBUILD37
-rw-r--r--community-testing/fldiff/PKGBUILD31
-rw-r--r--community-testing/fldiff/build-fix.patch31
-rw-r--r--community-testing/fldiff/fldiff.install11
-rw-r--r--community-testing/freewrl/PKGBUILD38
-rw-r--r--community-testing/freewrl/build-fix.patch1201
-rw-r--r--community-testing/gpac/PKGBUILD44
-rw-r--r--community-testing/gpac/libpng14-infopp-null.patch12
-rw-r--r--community-testing/htmldoc/PKGBUILD34
-rw-r--r--community-testing/mediatomb/PKGBUILD49
-rw-r--r--community-testing/mediatomb/gcc46.patch10
-rw-r--r--community-testing/mediatomb/mediatomb.conf23
-rw-r--r--community-testing/mediatomb/mediatomb.install9
-rw-r--r--community-testing/mediatomb/mediatomb.rc54
-rw-r--r--community-testing/mediatomb/tonewjs.patch564
-rw-r--r--community-testing/mongodb/PKGBUILD60
-rw-r--r--community-testing/mongodb/add-js185-support-to-SConstruct.diff12
-rw-r--r--community-testing/mongodb/mongodb-1.8.0-spidermonkey-1.8.5-support.patch1502
-rw-r--r--community-testing/mongodb/mongodb.conf8
-rwxr-xr-xcommunity-testing/mongodb/mongodb.install29
-rwxr-xr-xcommunity-testing/mongodb/mongodb.rc39
-rw-r--r--community-testing/openmovieeditor/PKGBUILD35
-rw-r--r--community-testing/xdiskusage/PKGBUILD47
-rw-r--r--community-testing/xdiskusage/stdin-is-null.patch31
28 files changed, 4123 insertions, 0 deletions
diff --git a/community-testing/coin/PKGBUILD b/community-testing/coin/PKGBUILD
new file mode 100644
index 000000000..70289ef96
--- /dev/null
+++ b/community-testing/coin/PKGBUILD
@@ -0,0 +1,54 @@
+# Maintainer: Thomas Dziedzic < gostrc at gmail >
+# Contributor: mickele
+# Contributor: marcus fritzsch <fritschy@googlemail.com>
+
+pkgname=coin
+pkgver=3.1.3
+pkgrel=5
+pkgdesc='Coin3D is a high-level 3D graphics toolkit on top of OpenGL.'
+url='http://www.coin3d.org/'
+license=('GPL')
+arch=('i686' 'x86_64')
+depends=('mesa' 'expat')
+makedepends=('doxygen')
+optdepends=('openal: sound/dynamic linking support'
+ 'fontconfig: dynamic linking support'
+ 'zlib: dynamic linking support'
+ 'freetype2: dynamic linking support'
+ 'js: dynamic linking support')
+options=('!libtool')
+source=("http://ftp.coin3d.org/coin/src/all/Coin-${pkgver}.tar.gz")
+md5sums=('1538682f8d92cdf03e845c786879fbea')
+
+build() {
+ cd Coin-${pkgver}
+
+ ./configure \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --enable-optimization \
+ --enable-3ds-import \
+ --enable-javascript-api \
+ --enable-threadsafe \
+ --enable-exceptions \
+ --enable-man \
+ --with-mesa \
+ --disable-debug \
+ --enable-shared \
+ --disable-maintainer-mode \
+ --disable-dependency-tracking \
+ --enable-system-expat
+
+ make
+}
+
+package() {
+ cd Coin-${pkgver}
+
+ make DESTDIR=${pkgdir} install
+
+ # final adjustments
+ for _FILE in threads deprecated ; do
+ mv "${pkgdir}/usr/share/man/man3/${_FILE}.3" "${pkgdir}/usr/share/man/man3/coin-${_FILE}.3"
+ done
+}
diff --git a/community-testing/couchdb/PKGBUILD b/community-testing/couchdb/PKGBUILD
new file mode 100644
index 000000000..6d4d6d171
--- /dev/null
+++ b/community-testing/couchdb/PKGBUILD
@@ -0,0 +1,46 @@
+# $Id: PKGBUILD 51045 2011-07-04 15:16:10Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: Vitaliy Berdinskikh ur6lad[at]i.ua
+# Previous Contributor: Michael Fellinger <m.fellinger@gmail.com>
+
+pkgname=couchdb
+pkgver=1.1.0
+pkgrel=1.svn20110704
+pkgdesc="A document-oriented database that can be queried and indexed in a MapReduce fashion using JSON"
+arch=('i686' 'x86_64')
+url="http://couchdb.apache.org"
+license=('APACHE')
+depends=('icu' 'erlang' 'js' 'openssl' 'curl')
+makedepends=('gcc')
+install=couchdb.install
+options=('!libtool')
+backup=('etc/couchdb/local.ini'
+ 'etc/conf.d/couchdb'
+ 'etc/logrotate.d/couchdb')
+#source=("http://www.apache.org/dist/$pkgname/$pkgver/apache-$pkgname-$pkgver.tar.gz"
+source=("http://arch.p5n.pp.ru/~sergej/dl/apache-couchdb-$pkgver.svn20110704.tar.gz"
+ "rc-script.patch")
+md5sums=('a961f9047aa34df56ef19d6f6dce083b'
+ 'e9b5595338efbdc1a5db13284a296612')
+
+build() {
+ cd "$srcdir/apache-$pkgname-$pkgver"
+
+ sed -i 's|-ljs|-lmozjs185|' configure
+ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+ make
+ patch etc/init/couchdb <$srcdir/rc-script.patch
+}
+
+package() {
+ cd "$srcdir/apache-$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+
+ install -Dm755 etc/default/couchdb $pkgdir/etc/conf.d/couchdb
+ sed -i 's|\(CONFIGURATION_FILE=/etc/\)default\(/couchdb\)|\1conf.d\2|' $pkgdir/etc/rc.d/couchdb
+ sed -i 's|\(COUCHDB_OPTIONS=\)|\1"-p /var/run/couchdb/couchdb.pid"|' $pkgdir/etc/conf.d/couchdb
+ sed -i 's|$COUCHDB -s|$COUCHDB $COUCHDB_OPTIONS -s|' $pkgdir/etc/rc.d/couchdb
+ sed -i 's|su $COUCHDB_USER -c|su $COUCHDB_USER -s /bin/bash -c|' $pkgdir/etc/rc.d/couchdb
+
+ rm -rf $pkgdir/etc/default/ $pkgdir/var/run
+}
diff --git a/community-testing/couchdb/couchdb.install b/community-testing/couchdb/couchdb.install
new file mode 100644
index 000000000..5eff459c7
--- /dev/null
+++ b/community-testing/couchdb/couchdb.install
@@ -0,0 +1,22 @@
+post_install() {
+ id couchdb &>/dev/null || \
+ useradd -r -c "CouchDB daemon" -g daemon -d /var/lib/couchdb -s /bin/false couchdb
+ mkdir -p /var/run/couchdb
+ chown -R couchdb.daemon /etc/couchdb
+ chown -R couchdb.daemon /var/{lib,log,run}/couchdb
+}
+
+pre_upgrade() {
+ id couchdb &>/dev/null || \
+ useradd -r -c "CouchDB daemon" -g daemon -d /var/lib/couchdb -s /bin/false couchdb
+}
+
+post_upgrade() {
+ mkdir -p $pkgdir/var/run/couchdb
+ chown -R couchdb.daemon /etc/couchdb
+ chown -R couchdb.daemon /var/{lib,log,run}/couchdb
+}
+
+post_remove() {
+ userdel couchdb &>/dev/null
+}
diff --git a/community-testing/couchdb/rc-script.patch b/community-testing/couchdb/rc-script.patch
new file mode 100644
index 000000000..d38f4dc6c
--- /dev/null
+++ b/community-testing/couchdb/rc-script.patch
@@ -0,0 +1,90 @@
+--- couchdb.org 2011-04-01 19:56:32.000000000 +0000
++++ couchdb 2011-04-01 19:59:17.000000000 +0000
+@@ -1,4 +1,7 @@
+-#!/bin/sh -e
++#!/bin/bash
++#general config
++. /etc/rc.conf
++. /etc/rc.d/functions
+
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ # use this file except in compliance with the License. You may obtain a copy of
+@@ -29,7 +32,7 @@
+ NAME=couchdb
+ SCRIPT_NAME=`basename $0`
+ COUCHDB=/usr/bin/couchdb
+-CONFIGURATION_FILE=/etc/default/couchdb
++CONFIGURATION_FILE=/etc/conf.d/couchdb
+ RUN_DIR=/var/run/couchdb
+ LSB_LIBRARY=/lib/lsb/init-functions
+
+@@ -61,8 +63,9 @@
+ fi
+
+ start_couchdb () {
+- # Start Apache CouchDB as a background process.
++ stat_busy "Starting the CouchDB daemon"
+
++ [ -d /var/run/couchdb ] || mkdir -p /var/run/couchdb
+ command="$COUCHDB -b"
+ if test -n "$COUCHDB_STDOUT_FILE"; then
+ command="$command -o $COUCHDB_STDOUT_FILE"
+@@ -79,38 +82,38 @@
+ mkdir -p "$RUN_DIR"
+ if test -n "$COUCHDB_USER"; then
+ chown $COUCHDB_USER "$RUN_DIR"
+- if su $COUCHDB_USER -c "$command" > /dev/null; then
+- return $SCRIPT_OK
++ if su $COUCHDB_USER -s /bin/bash -c "$command" > /dev/null; then
++ stat_done
+ else
+- return $SCRIPT_ERROR
++ stat_fail
+ fi
+ else
+ if $command > /dev/null; then
+- return $SCRIPT_OK
++ stat_done
+ else
+- return $SCRIPT_ERROR
++ stat_fail
+ fi
+ fi
+ }
+
+ stop_couchdb () {
+- # Stop the running Apache CouchDB process.
++ stat_busy "Stopping the CouchDB daemon"
+
+ command="$COUCHDB -d"
+ if test -n "$COUCHDB_OPTIONS"; then
+ command="$command $COUCHDB_OPTIONS"
+ fi
+ if test -n "$COUCHDB_USER"; then
+- if su $COUCHDB_USER -c "$command" > /dev/null; then
+- return $SCRIPT_OK
++ if su $COUCHDB_USER -s /bin/bash -c "$command" > /dev/null; then
++ stat_done
+ else
+- return $SCRIPT_ERROR
++ stat_fail
+ fi
+ else
+ if $command > /dev/null; then
+- return $SCRIPT_OK
++ stat_done
+ else
+- return $SCRIPT_ERROR
++ stat_fail
+ fi
+ fi
+ }
+@@ -118,7 +121,7 @@
+ display_status () {
+ # Display the status of the running Apache CouchDB process.
+
+- $COUCHDB -s
++ $COUCHDB $COUCHDB_OPTIONS -s
+ }
+
+ parse_script_option_list () {
diff --git a/community-testing/elinks/PKGBUILD b/community-testing/elinks/PKGBUILD
new file mode 100644
index 000000000..037b290e9
--- /dev/null
+++ b/community-testing/elinks/PKGBUILD
@@ -0,0 +1,37 @@
+# $Id: PKGBUILD 51048 2011-07-04 15:29:28Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Maintainer: Andrea Scarpino <andrea@archlinux.org>
+# Contributor: damir <damir@archlinux.org>
+# Contributor: Ben <contrasutra@myrealbox.com>
+
+pkgname=elinks
+pkgver=0.13
+_commit="03c698e926d4421ba43d905b6d9fd7388b97352f"
+pkgrel=6
+pkgdesc="An advanced and well-established feature-rich text mode web browser."
+arch=("i686" "x86_64")
+url="http://elinks.or.cz"
+license=('GPL')
+depends=('bzip2' 'expat>=2.0' 'gpm>=1.20.4' 'openssl' 'lua>=5.1.1' 'libidn' 'js'
+ 'gc' 'tre' 'smbclient')
+source=("http://arch.p5n.pp.ru/~sergej/dl/elinks-$pkgver-${_commit}.tar.gz")
+md5sums=('85916038633d0eb4ed98c3f82ac0b405')
+
+build() {
+ cd "$srcdir/elinks"
+ [ -x configure ] || sh autogen.sh
+ ./configure --prefix=/usr --mandir=/usr/share/man \
+ --sysconfdir=/etc \
+ --enable-smb --without-x --enable-cgi \
+ --enable-leds --enable-256-colors --enable-html-highlight \
+ --with-zlib
+ make
+}
+
+package() {
+ cd "$srcdir/elinks"
+ make DESTDIR="$pkgdir" install
+ rm -f "$pkgdir/usr/share/locale/locale.alias"
+ install -D -m644 "contrib/debian/$pkgname.desktop" \
+ "$pkgdir/usr/share/applications/$pkgname.desktop"
+}
diff --git a/community-testing/fldiff/PKGBUILD b/community-testing/fldiff/PKGBUILD
new file mode 100644
index 000000000..ab25a3240
--- /dev/null
+++ b/community-testing/fldiff/PKGBUILD
@@ -0,0 +1,31 @@
+# $Id: PKGBUILD 51104 2011-07-05 09:00:11Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Maintainer: kevin <kevin@archlinux.org>
+# Contributor: iztok pizorn <pizorn@gmail.com>
+
+pkgname=fldiff
+pkgver=1.1
+pkgrel=6
+pkgdesc="graphical diff program"
+arch=(i686 x86_64)
+url="http://www.easysw.com/~mike/fldiff/"
+license=('GPL')
+install=fldiff.install
+depends=('diffutils' 'fltk' 'xdg-utils')
+source=(http://www.easysw.com/~mike/fldiff/$pkgname-$pkgver-source.tar.gz
+ build-fix.patch)
+md5sums=('12897c92106fb5d665210a2e82f5cf25'
+ 'ea7258e07544b81561c6d76a41c184e7')
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+ patch -p1 <$srcdir/build-fix.patch
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd $srcdir/$pkgname-$pkgver
+ make BUILDROOT=$pkgdir install install-desktop
+ mv `find $pkgdir/ -name Development -type d` $startdir/pkg/usr/share/applications
+}
diff --git a/community-testing/fldiff/build-fix.patch b/community-testing/fldiff/build-fix.patch
new file mode 100644
index 000000000..bb3e0245e
--- /dev/null
+++ b/community-testing/fldiff/build-fix.patch
@@ -0,0 +1,31 @@
+Only in fldiff-1.1.my: config.log
+Only in fldiff-1.1.my: config.status
+Only in fldiff-1.1.my: DiffChooser.o
+Only in fldiff-1.1.my: DiffOpenWindow.o
+Only in fldiff-1.1.my: DiffView.o
+diff -wbBur fldiff-1.1/DiffWindow.cxx fldiff-1.1.my/DiffWindow.cxx
+--- fldiff-1.1/DiffWindow.cxx 2006-11-13 21:54:02.000000000 +0300
++++ fldiff-1.1.my/DiffWindow.cxx 2011-07-05 12:58:38.000000000 +0400
+@@ -1126,11 +1126,11 @@
+ DiffWindow::save_prefs()
+ {
+ // Save the window prefs for the next run...
+- prefs_.set("color", color());
+- prefs_.set("selection_color", selection_color());
++ prefs_.set("color", (int)color());
++ prefs_.set("selection_color", (int)selection_color());
+ prefs_.set("showlinenum", showlinenum());
+ prefs_.set("tabwidth", tabwidth());
+- prefs_.set("textcolor", textcolor());
++ prefs_.set("textcolor", (int)textcolor());
+ prefs_.set("textsize", textsize());
+ prefs_.set("ignoreblanks", ignoreblanks());
+ }
+Only in fldiff-1.1.my: DiffWindow.o
+Only in fldiff-1.1.my: FavoritesMenu.o
+Only in fldiff-1.1.my: FavoritesWindow.o
+Only in fldiff-1.1.my: fldiff
+Only in fldiff-1.1.my: fldiff.list
+Only in fldiff-1.1.my: fldiff.o
+Only in fldiff-1.1.my: Makefile
+Only in fldiff-1.1.my: PtProcess.o
diff --git a/community-testing/fldiff/fldiff.install b/community-testing/fldiff/fldiff.install
new file mode 100644
index 000000000..b95cc069d
--- /dev/null
+++ b/community-testing/fldiff/fldiff.install
@@ -0,0 +1,11 @@
+post_install() {
+ which xdg-icon-resource 1>/dev/null 2>/dev/null && xdg-icon-resource forceupdate || true
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ which xdg-icon-resource 1>/dev/null 2>/dev/null && xdg-icon-resource forceupdate || true
+}
diff --git a/community-testing/freewrl/PKGBUILD b/community-testing/freewrl/PKGBUILD
new file mode 100644
index 000000000..8d00cdc7f
--- /dev/null
+++ b/community-testing/freewrl/PKGBUILD
@@ -0,0 +1,38 @@
+# $Id: PKGBUILD 51056 2011-07-04 16:35:05Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
+
+pkgname=freewrl
+pkgver=1.22.10
+pkgrel=6
+pkgdesc="VRML viewer"
+arch=('i686' 'x86_64')
+url="http://freewrl.sourceforge.net/"
+license=('GPL')
+depends=('java-runtime' 'libxaw' 'glew' 'freeglut' 'curl' 'freetype2' 'imlib2' 'sox'
+ 'unzip' 'imagemagick' 'libxml2' 'ttf-bitstream-vera' 'lesstif' 'js')
+makedepends=('java-environment')
+options=(!libtool)
+source=(http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.bz2
+ build-fix.patch)
+md5sums=('07fd8f193d14799ffb95a59a4887fc88'
+ '52e4b6aacebcaf18cbec8975e0eb7fd8')
+
+build() {
+ . /etc/profile.d/openjdk6.sh
+ cd $srcdir/$pkgname-$pkgver
+ patch -p1 <$srcdir/build-fix.patch
+ export JAVASCRIPT_ENGINE_CFLAGS="-I/usr/include/js -DXP_UNIX -DJS_THREADSAFE $(pkg-config --cflags nspr)"
+ export JAVASCRIPT_ENGINE_LIBS="$(pkg-config --libs nspr) -lmozjs185"
+ ./configure \
+ --prefix=/usr --with-fontsdir=/usr/share/fonts/TTF --enable-libeai \
+ --enable-libcurl --with-expat=/usr --with-target=x11 --disable-plugin \
+ --disable-mozilla-js --disable-xulrunner-js --disable-firefox-js \
+ --disable-seamonkey-js
+ make
+}
+
+package() {
+ cd $srcdir/$pkgname-$pkgver
+ make DESTDIR=$pkgdir install
+}
diff --git a/community-testing/freewrl/build-fix.patch b/community-testing/freewrl/build-fix.patch
new file mode 100644
index 000000000..c0de71d07
--- /dev/null
+++ b/community-testing/freewrl/build-fix.patch
@@ -0,0 +1,1201 @@
+diff -wbBur freewrl-1.22.10/src/lib/non_web3d_formats/ColladaParser.c freewrl-1.22.10.my/src/lib/non_web3d_formats/ColladaParser.c
+--- freewrl-1.22.10/src/lib/non_web3d_formats/ColladaParser.c 2010-08-19 06:20:36.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/non_web3d_formats/ColladaParser.c 2011-07-04 01:19:07.000000000 +0400
+@@ -54,7 +54,7 @@
+ #include "ColladaParser.h"
+
+ #if HAVE_EXPAT_H
+-# include <expat.h>
++# include </usr/include/expat.h>
+ #endif
+
+ #define PROTOINSTANCE_MAX_LEVELS 10
+diff -wbBur freewrl-1.22.10/src/lib/world_script/fieldGet.c freewrl-1.22.10.my/src/lib/world_script/fieldGet.c
+--- freewrl-1.22.10/src/lib/world_script/fieldGet.c 2010-10-13 23:45:26.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/world_script/fieldGet.c 2011-07-04 20:21:21.000000000 +0400
+@@ -412,7 +412,7 @@
+ /* create a new SFFloat object */
+
+ fp = (float *)fp_in;
+- newjsval = DOUBLE_TO_JSVAL(JS_NewDouble(cx,(double)*fp));
++ newjsval = JS_NewJSVal(cx,(double)*fp);
+ fp_in = offsetPointer_deref(float *,fp_in,elementlen);
+
+ /* put this object into the MF class */
+@@ -449,7 +449,7 @@
+ /* create a new SFTime object */
+
+ fp = (float *)fp_in;
+- newjsval = DOUBLE_TO_JSVAL(JS_NewDouble(cx,(double)*fp));
++ newjsval = JS_NewJSVal(cx,(double)*fp);
+ fp_in = offsetPointer_deref(float *,fp_in,elementlen);
+
+ /* put this object into the MF class */
+diff -wbBur freewrl-1.22.10/src/lib/world_script/fieldSet.c freewrl-1.22.10.my/src/lib/world_script/fieldSet.c
+--- freewrl-1.22.10/src/lib/world_script/fieldSet.c 2010-09-22 00:00:25.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/world_script/fieldSet.c 2011-07-04 20:03:53.000000000 +0400
+@@ -748,7 +748,7 @@
+
+ #ifdef SETFIELDVERBOSE
+ strval = JS_ValueToString(scriptContext, JSglobal_return_val);
+- strp = JS_GetStringBytes(strval);
++ strp = JS_EncodeString(scriptContext, strval);
+ printf ("start of setField_javascriptEventOut, to %ld:%d = %p, fieldtype %d string %s\n",(long)tn, tptr, memptr, fieldType, strp);
+ #endif
+
+@@ -813,7 +813,7 @@
+ case FIELDTYPE_SFImage: {
+ /* the string should be saved as an SFImage */
+ strval = JS_ValueToString(scriptContext, JSglobal_return_val);
+- strp = JS_GetStringBytes(strval);
++ strp = JS_EncodeString(scriptContext, strval);
+
+ Parser_scanStringValueToMem(tn, tptr, FIELDTYPE_SFImage, strp, FALSE);
+ break;
+@@ -824,7 +824,7 @@
+ uintptr_t *newptr;
+
+ strval = JS_ValueToString(scriptContext, JSglobal_return_val);
+- strp = JS_GetStringBytes(strval);
++ strp = JS_EncodeString(scriptContext, strval);
+
+ /* copy the string over, delete the old one, if need be */
+ /* printf ("fieldSet SFString, tn %d tptr %d offset from struct %d\n",
+@@ -844,7 +844,7 @@
+ struct X3D_Node *mynode;
+
+ strval = JS_ValueToString(scriptContext, JSglobal_return_val);
+- strp = JS_GetStringBytes(strval);
++ strp = JS_EncodeString(scriptContext, strval);
+
+ /* we will have at least one node here, in an ascii string */
+ while ((*strp > '\0') && (*strp <= ' ')) strp ++;
+@@ -1227,7 +1227,7 @@
+ JSString *_tmpStr;
+
+ _tmpStr = JS_ValueToString(cx, mainElement);
+- strp = JS_GetStringBytes(_tmpStr);
++ strp = JS_EncodeString(scriptContext, _tmpStr);
+ printf ("sub element %d is \"%s\" \n",i,strp);
+
+ if (JSVAL_IS_OBJECT(mainElement)) printf ("sub element %d is an OBJECT\n",i);
+@@ -1329,7 +1329,7 @@
+ JSString *strval;
+
+ strval = JS_ValueToString(cx, mainElement);
+- strp = JS_GetStringBytes(strval);
++ strp = JS_EncodeString(cx, strval);
+
+ #ifdef SETFIELDVERBOSE
+ printf ("getJSMultiNumType, got string %s\n",strp);
+@@ -1441,7 +1441,7 @@
+ return;
+ }
+ strval = JS_ValueToString(cx, _v);
+- valStr = JS_GetStringBytes(strval);
++ valStr = JS_EncodeString(cx, strval);
+
+ /* printf ("new string %d is %s\n",i,valStr); */
+
+diff -wbBur freewrl-1.22.10/src/lib/world_script/jsUtils.c freewrl-1.22.10.my/src/lib/world_script/jsUtils.c
+--- freewrl-1.22.10/src/lib/world_script/jsUtils.c 2010-06-03 23:38:37.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/world_script/jsUtils.c 2011-07-04 20:21:44.000000000 +0400
+@@ -134,7 +134,7 @@
+ nf = OBJECT_TO_JSVAL(me);
+
+ #ifdef JSVRMLCLASSESVERBOSE
+- printf ("parentField is %u \"%s\"\n", pf, JS_GetStringBytes(JSVAL_TO_STRING(pf)));
++ printf ("parentField is %u \"%s\"\n", pf, JS_EncodeString(cx, JSVAL_TO_STRING(pf)));
+ #endif
+
+ if (!setSFNodeField (cx, par, pf, &nf)) {
+@@ -197,7 +197,7 @@
+ char *_id_c;
+
+ _idStr = JS_ValueToString(cx, *newval);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+
+ oldS = (struct Uni_String *) *((uintptr_t *)Data);
+
+@@ -305,12 +305,12 @@
+
+ case FIELDTYPE_SFFloat: {
+ memcpy ((void *) &fl, Data, datalen);
+- *newval = DOUBLE_TO_JSVAL(JS_NewDouble(cx,(double)fl));
++ *newval = JS_NewJSVal(cx,(double)fl);
+ break;
+ }
+ case FIELDTYPE_SFTime: {
+ memcpy ((void *) &dl, Data, datalen);
+- *newval = DOUBLE_TO_JSVAL(JS_NewDouble(cx,dl));
++ *newval = JS_NewJSVal(cx,dl);
+ break;
+ }
+ case FIELDTYPE_SFBool:
+@@ -824,7 +824,7 @@
+ struct X3D_Node *node;
+
+ _idStr = JS_ValueToString(context, id);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(context, _idStr);
+
+ #ifdef JSVRMLCLASSESVERBOSE
+ printf ("\ngetSFNodeField called on name %s object %u\n",_id_c, obj);
+@@ -912,7 +912,7 @@
+
+ /* get the id field... */
+
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id));
+
+ #ifdef JSVRMLCLASSESVERBOSE
+ printf ("\nsetSFNodeField called on name %s object %u, jsval %u\n",_id_c, obj, *vp);
+@@ -1131,10 +1131,10 @@
+ char *_id_c = "(no value in string)";
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id));
+ /* printf ("hmmm...js_SetPropertyCheck called on string \"%s\" object %u, jsval %u\n",_id_c, obj, *vp); */
+ } else if (JSVAL_IS_DOUBLE(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyCheck called on double %s object %u, jsval %u\n",_id_c, obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1192,7 +1192,7 @@
+ /* get the id field... */
+
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id));
+ printf ("\n...js_GetPropertyDebug called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1211,7 +1211,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyDebug called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1229,7 +1229,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyDebug1 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1247,7 +1247,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(cx, JSVAL_TO_STRING(id));
+ printf ("...js_SetPropertyDebug2 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1265,7 +1265,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyDebug3 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1283,7 +1283,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyDebug4 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1301,7 +1301,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyDebug5 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1319,7 +1319,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyDebug6 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1337,7 +1337,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyDebug7 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1355,7 +1355,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyDebug8 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+@@ -1373,7 +1373,7 @@
+
+ /* get the id field... */
+ if (JSVAL_IS_STRING(id)) {
+- _id_c = JS_GetStringBytes(JSVAL_TO_STRING(id));
++ _id_c = JS_EncodeString(context, JSVAL_TO_STRING(id));
+ printf ("\n...js_SetPropertyDebug9 called on string \"%s\" object %u, jsval %lu\n",_id_c, (unsigned int) obj, *vp);
+ } else if (JSVAL_IS_INT(id)) {
+ num = JSVAL_TO_INT(id);
+diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRMLBrowser.c freewrl-1.22.10.my/src/lib/world_script/jsVRMLBrowser.c
+--- freewrl-1.22.10/src/lib/world_script/jsVRMLBrowser.c 2010-08-02 23:55:57.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/world_script/jsVRMLBrowser.c 2011-07-04 20:06:25.000000000 +0400
+@@ -336,7 +336,7 @@
+ return JS_FALSE;
+ }
+ _str = JS_ValueToString(context, argv[0]);
+- _costr = JS_GetStringBytes(_str);
++ _costr = JS_EncodeString(context, _str);
+
+ /* sanitize string, for the EAI_RW call (see EAI_RW code) */
+ tptr = _costr;
+@@ -385,10 +385,10 @@
+ return JS_FALSE;
+ }
+ _str[0] = JS_ValueToString(context, argv[0]);
+- _costr[0] = JS_GetStringBytes(_str[0]);
++ _costr[0] = JS_EncodeString(context, _str[0]);
+
+ _str[1] = JS_ValueToString(context, argv[1]);
+- _costr[1] = JS_GetStringBytes(_str[1]);
++ _costr[1] = JS_EncodeString(context, _str[1]);
+
+ /* we use the EAI code for this - so reformat this for the EAI format */
+ {
+@@ -575,7 +575,7 @@
+ /* third parameter should be a string */
+ if (JSVAL_IS_STRING(argv[2])) {
+ _str[1] = JSVAL_TO_STRING(argv[2]);
+- fieldStr = JS_GetStringBytes(_str[1]);
++ fieldStr = JS_EncodeString(context, _str[1]);
+ #ifdef JSVERBOSE
+ printf ("field string is :%s:\n",fieldStr);
+ #endif
+@@ -590,7 +590,7 @@
+
+ /* get the URL listing as a string */
+ _str[0] = JS_ValueToString(context, argv[0]);
+- _costr0 = JS_GetStringBytes(_str[0]);
++ _costr0 = JS_EncodeString(context, _str[0]);
+
+
+ #ifdef JSVERBOSE
+@@ -690,7 +690,7 @@
+ for (count=0; count < argc; count++) {
+ if (JSVAL_IS_STRING(argv[count])) {
+ _str = JSVAL_TO_STRING(argv[count]);
+- _id_c = JS_GetStringBytes(_str);
++ _id_c = JS_EncodeString(context, _str);
+ #if defined(AQUA) || defined(_MSC_VER)
+ BrowserPrintConsoleMessage(_id_c); /* statusbar hud */
+ consMsgCount = 0; /* reset the "Maximum" count */
+@@ -850,7 +850,7 @@
+
+ /* parameter should be a string */
+ if (JSVAL_IS_STRING(argv[0])) {
+- target = JS_GetStringBytes( JSVAL_TO_STRING(argv[0]));
++ target = JS_EncodeString(context, JSVAL_TO_STRING(argv[0]));
+ #ifdef JSVERBOSE
+ printf ("field string is %s\n",target);
+ #endif
+@@ -930,7 +930,7 @@
+
+ /* parameters should be a string */
+ if (JSVAL_IS_STRING(argv[0])) {
+- targetDevice = JS_GetStringBytes( JSVAL_TO_STRING(argv[0]));
++ targetDevice = JS_EncodeString(cx, JSVAL_TO_STRING(argv[0]));
+ #ifdef JSVERBOSE
+ printf ("field string is %s\n",targetDevice);
+ #endif
+@@ -939,7 +939,7 @@
+ return -1;
+ }
+ if (JSVAL_IS_STRING(argv[1])) {
+- targetController = JS_GetStringBytes( JSVAL_TO_STRING(argv[1]));
++ targetController = JS_EncodeString(cx, JSVAL_TO_STRING(argv[1]));
+ #ifdef JSVERBOSE
+ printf ("field string is %s\n",targetController);
+ #endif
+diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRMLClasses.c freewrl-1.22.10.my/src/lib/world_script/jsVRMLClasses.c
+--- freewrl-1.22.10/src/lib/world_script/jsVRMLClasses.c 2010-09-22 23:40:48.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/world_script/jsVRMLClasses.c 2011-07-04 20:08:03.000000000 +0400
+@@ -935,7 +935,7 @@
+ printf( "JS_NewDouble failed for %f in simplecopyelements.\n",dd);
+ return JS_FALSE;
+ }
+- val = DOUBLE_TO_JSVAL(dp);
++ val = DOUBLE_TO_JSVAL(*dp);
+
+ }
+ }
+@@ -1108,7 +1108,7 @@
+
+ printf ("HAVE STRING HERE!\n");
+ _str = JS_ValueToString(cx, id);
+- asciiStr = JS_GetStringBytes(_str);
++ asciiStr = JS_EncodeString(context, _str);
+ printf ("we have as a parameter :%s:\n",asciiStr);
+ #endif
+
+@@ -1185,7 +1185,7 @@
+ if (_tmpStr==NULL) {
+ _tmp_valStr = "NULL";
+ } else {
+- _tmp_valStr = JS_GetStringBytes(_tmpStr);
++ _tmp_valStr = JS_EncodeString(cx, _tmpStr);
+ }
+ }
+
+@@ -1281,7 +1281,7 @@
+ #endif
+
+ str = JS_ValueToString(cx, id);
+- p = JS_GetStringBytes(str);
++ p = JS_EncodeString(cx, str);
+ #ifdef JSVRMLCLASSESVERBOSE
+ printf("\tid string %s\n ",p);
+ #endif
+@@ -1368,12 +1368,12 @@
+ char * _c;
+ printf ("doMFSetProperty, for object %u, vp %u\n", obj,*vp);
+ _str = JS_ValueToString(cx, id);
+- _c = JS_GetStringBytes(_str);
++ _c = JS_EncodeString(cx, _str);
+ printf ("id is %s\n",_c);
+
+ _sstr = JS_ValueToString(cx, *vp);
+ printf ("looking up value for %d %x object %p\n",*vp,*vp,obj);
+- _cc = JS_GetStringBytes(_sstr);
++ _cc = JS_EncodeString(cx, _sstr);
+ printf("\tdoMFSetProperty:%d: obj = %p, id = %s, vp = %s\n",type,
+ obj, _c, _cc);
+ if (JSVAL_IS_OBJECT(*vp)) { printf ("doMFSet, vp is an OBJECT\n"); }
+@@ -1397,7 +1397,7 @@
+
+ if (!JS_ValueToInt32(cx, *vp, &i)) {
+ _sstr = JS_ValueToString(cx, *vp);
+- _cc = JS_GetStringBytes(_sstr);
++ _cc = JS_EncodeString(cx, _sstr);
+ printf ("can not convert %s to an integer in doMFAddProperty for type %d\n",_cc,type);
+ return JS_FALSE;
+ }
+@@ -1408,7 +1408,7 @@
+ #ifdef JSVRMLCLASSESVERBOSE
+ printf ("doMFSetProperty - ensure that this is a DOUBLE ");
+ _sstr = JS_ValueToString(cx, *vp);
+- _cc = JS_GetStringBytes(_sstr);
++ _cc = JS_EncodeString(cx, _sstr);
+ printf ("value is %s \n",_cc);
+ #endif
+
+@@ -1420,7 +1420,7 @@
+ printf( "JS_NewDouble failed for %f in simplecopyelements.\n",dd);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+
+ }
+ }
+@@ -1511,7 +1511,7 @@
+ nf = OBJECT_TO_JSVAL(me);
+
+ #ifdef JSVRMLCLASSESVERBOSE
+- printf ("parentField is %u \"%s\"\n", pf, JS_GetStringBytes(JSVAL_TO_STRING(pf)));
++ printf ("parentField is %u \"%s\"\n", pf, JS_EncodeString(cx, JSVAL_TO_STRING(pf)));
+ #endif
+
+ if (!setSFNodeField (cx, par, pf, &nf)) {
+@@ -1535,7 +1535,7 @@
+ unsigned int i, j = 0;
+
+ _str = JS_ValueToString(cx, *vp);
+- _buff = JS_GetStringBytes(_str);
++ _buff = JS_EncodeString(cx, _str);
+ _buff_len = strlen(_buff) + 1;
+
+ #ifdef JSVRMLCLASSESVERBOSE
+@@ -1719,14 +1719,14 @@
+ size_t len = 0;
+
+ _idStr = JS_ValueToString(context, id);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(context, _idStr);
+
+ /* "register" this ECMA value for routing changed flag stuff */
+ setInECMATable(context, _id_c);
+
+ if (JSVAL_IS_STRING(*vp)) {
+ _vpStr = JS_ValueToString(context, *vp);
+- _vp_c = JS_GetStringBytes(_vpStr);
++ _vp_c = JS_EncodeString(context, _vpStr);
+
+ len = strlen(_vp_c);
+
+@@ -1752,7 +1752,7 @@
+ } else {
+ #ifdef JSVRMLCLASSESVERBOSE
+ _vpStr = JS_ValueToString(context, *vp);
+- _vp_c = JS_GetStringBytes(_vpStr);
++ _vp_c = JS_EncodeString(cx, _vpStr);
+ printf("setECMANative: obj = %p, id = \"%s\", vp = %s\n",
+ obj, _id_c, _vp_c);
+ #endif
+@@ -1770,9 +1770,9 @@
+ JSString *_idStr, *_vpStr;
+ char *_id_c, *_vp_c;
+ _idStr = JS_ValueToString(cx, id);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+ _vpStr = JS_ValueToString(cx, *vp);
+- _vp_c = JS_GetStringBytes(_vpStr);
++ _vp_c = JS_EncodeString(cx, _vpStr);
+ printf("getAssignProperty: obj = %p, id = \"%s\", vp = %s\n",
+ obj, _id_c, _vp_c);
+ printf ("what is vp? \n");
+@@ -1803,7 +1803,7 @@
+
+ if (JSVAL_IS_STRING(id)) {
+ _str = JSVAL_TO_STRING(id);
+- _id_c = JS_GetStringBytes(_str);
++ _id_c = JS_EncodeString(cx, _str);
+ if (!JS_ConvertValue(cx, *vp, JSTYPE_OBJECT, &newVal)) {
+ printf( "JS_ConvertValue failed in setAssignProperty.\n");
+ return JS_FALSE;
+@@ -1834,9 +1834,9 @@
+ if (JSVAL_IS_DOUBLE(id)) printf ("id is an DOUBLE\n");
+ if (JSVAL_IS_INT(id)) printf ("id is an INT\n");
+
+- printf ("id is %s\n",JS_GetStringBytes(JS_ValueToString(cx,id)));
+- printf ("initVal is %s\n",JS_GetStringBytes(JS_ValueToString(cx,initVal)));
+- printf ("newVal is %s\n",JS_GetStringBytes(JS_ValueToString(cx,newVal)));
++ printf ("id is %s\n",JS_EncodeString(cx, JS_ValueToString(cx,id)));
++ printf ("initVal is %s\n",JS_EncodeString(cx, JS_ValueToString(cx,initVal)));
++ printf ("newVal is %s\n",JS_EncodeString(cx, JS_ValueToString(cx,newVal)));
+
+ #endif
+
+@@ -1859,7 +1859,7 @@
+ } else {
+ #ifdef JSVRMLCLASSESVERBOSE
+ _str = JS_ValueToString(cx, id);
+- _id_c = JS_GetStringBytes(_str);
++ _id_c = JS_EncodeString(cx, _str);
+ printf("setAssignProperty: obj = %p, id = \"%s\"\n",
+ obj, _id_c);
+ #endif
+diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRMLClasses.h freewrl-1.22.10.my/src/lib/world_script/jsVRMLClasses.h
+--- freewrl-1.22.10/src/lib/world_script/jsVRMLClasses.h 2010-10-13 23:45:26.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/world_script/jsVRMLClasses.h 2011-07-04 20:24:53.000000000 +0400
+@@ -30,6 +30,21 @@
+ #ifndef __FREEWRL_JS_VRML_CLASSES_H__
+ #define __FREEWRL_JS_VRML_CLASSES_H__
+
++static inline jsval JS_NewJSVal(JSContext *cx, jsdouble d)
++{
++ jsval ret;
++ JS_NewNumberValue(cx, d, &ret);
++ return ret;
++}
++
++static inline jsdouble * JS_NewDouble(JSContext *cx, jsdouble d)
++{
++ static jsdouble ret;
++ jsval rv;
++ JS_NewNumberValue(cx, d, &rv);
++ ret = JSVAL_TO_DOUBLE(rv);
++ return &ret;
++}
+
+ #ifndef UNUSED
+ #define UNUSED(v) ((void) v)
+@@ -80,14 +95,14 @@
+
+
+ #define SET_JS_TICKTIME_FALSE(possibleRetVal) { jsval zimbo; \
+- zimbo = DOUBLE_TO_JSVAL(JS_NewDouble(cx, TickTime)); \
++ zimbo = JS_NewJSVal(cx, TickTime); \
+ if (!JS_DefineProperty(cx,obj, "__eventInTickTime", zimbo, JS_GET_PROPERTY_STUB, JS_SET_PROPERTY_STUB2, JSPROP_PERMANENT)) { \
+ printf( "JS_DefineProperty failed for \"__eventInTickTime\" at %s:%d.\n",__FILE__,__LINE__); \
+ return possibleRetVal; \
+ }}
+
+ #define SET_JS_TICKTIME() { jsval zimbo; \
+- zimbo = DOUBLE_TO_JSVAL(JS_NewDouble(cx, TickTime)); \
++ zimbo = JS_NewJSVal(cx, TickTime); \
+ if (!JS_DefineProperty(cx,obj, "__eventInTickTime", zimbo, JS_GET_PROPERTY_STUB, JS_SET_PROPERTY_STUB2, JSPROP_PERMANENT)) { \
+ printf( "JS_DefineProperty failed for \"__eventInTickTime\" at %s:%d.\n",__FILE__,__LINE__); \
+ return FALSE; \
+diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRML_MFClasses.c freewrl-1.22.10.my/src/lib/world_script/jsVRML_MFClasses.c
+--- freewrl-1.22.10/src/lib/world_script/jsVRML_MFClasses.c 2010-09-22 23:40:48.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/world_script/jsVRML_MFClasses.c 2011-07-04 20:08:44.000000000 +0400
+@@ -596,7 +596,7 @@
+ return;
+ }
+
+- val = DOUBLE_TO_JSVAL(dp);
++ val = DOUBLE_TO_JSVAL(*dp);
+
+ if (!JS_SetElement(cx, obj, (jsint) i, &val)) {
+ printf( "JS_DefineElement failed for arg %u in VrmlMatrixSetTransform.\n", i);
+@@ -1212,7 +1212,7 @@
+ /*
+ if (JSVAL_IS_STRING(id)==TRUE) {
+ printf(" is a common string :%s:\n",
+- JS_GetStringBytes(JS_ValueToString(cx, id)));
++ JS_EncodeString(cx, JS_ValueToString(cx, id)));
+ }
+ if (JSVAL_IS_OBJECT(id)==TRUE) {
+ printf (" parameter is an object\n");
+@@ -1231,7 +1231,7 @@
+ _index = JSVAL_TO_INT(id);
+
+ if (_index >= _length) {
+- *vp = DOUBLE_TO_JSVAL(&zerojsdouble);
++ *vp = DOUBLE_TO_JSVAL(zerojsdouble);
+ if (!JS_DefineElement(cx, obj, (jsint) _index, *vp, JS_GET_PROPERTY_STUB, JS_SET_PROPERTY_CHECK, JSPROP_ENUMERATE)) {
+ printf( "JS_DefineElement failed in VrmlMatrixGetProperty.\n");
+ return JS_FALSE;
+@@ -1331,7 +1331,7 @@
+ printf("MFStringAddProperty: vp = %p\n", obj);
+ if (JSVAL_IS_STRING(*vp)==TRUE) {
+ printf(" is a common string :%s:\n",
+- JS_GetStringBytes(JS_ValueToString(cx, *vp)));
++ JS_EncodeString(cx, JS_ValueToString(cx, *vp)));
+ }
+ if (JSVAL_IS_OBJECT(*vp)==TRUE) {
+ printf (" parameter is an object\n");
+@@ -1345,7 +1345,7 @@
+ printf("MFStringAddProperty: id = %p\n", obj);
+ if (JSVAL_IS_STRING(id)==TRUE) {
+ printf(" is a common string :%s:\n",
+- JS_GetStringBytes(JS_ValueToString(cx, id)));
++ JS_EncodeString(cx, JS_ValueToString(cx, id)));
+ }
+ if (JSVAL_IS_OBJECT(id)==TRUE) {
+ printf (" parameter is an object\n");
+@@ -1494,7 +1494,7 @@
+ if (JSVAL_IS_STRING(argv[i])==TRUE) {
+ printf (" Common String, is");
+ _str = JS_ValueToString(cx, argv[i]);
+- printf (JS_GetStringBytes(_str));
++ printf (JS_EncodeString(cx, _str));
+ printf ("..");
+
+ }
+diff -wbBur freewrl-1.22.10/src/lib/world_script/jsVRML_SFClasses.c freewrl-1.22.10.my/src/lib/world_script/jsVRML_SFClasses.c
+--- freewrl-1.22.10/src/lib/world_script/jsVRML_SFClasses.c 2010-09-25 00:22:05.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/world_script/jsVRML_SFClasses.c 2011-07-04 20:09:01.000000000 +0400
+@@ -161,7 +161,7 @@
+ printf( "JS_NewDouble failed for %f in SFColorGetHSV.\n", xp[i]);
+ return JS_FALSE;
+ }
+- _v = DOUBLE_TO_JSVAL(dp);
++ _v = DOUBLE_TO_JSVAL(*dp);
+ JS_SetElement(cx, result, (jsint)i, &_v);
+ }
+
+@@ -336,7 +336,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 1:
+ d = (ptr->v).c[1];
+@@ -346,7 +346,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 2:
+ d = (ptr->v).c[2];
+@@ -356,7 +356,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ }
+ }
+@@ -387,13 +387,13 @@
+ if (JSVAL_IS_INT(id)) {
+ switch (JSVAL_TO_INT(id)) {
+ case 0:
+- (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(_val);
++ (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(_val);
+ break;
+ case 1:
+- (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(_val);
++ (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(_val);
+ break;
+ case 2:
+- (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(_val);
++ (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(_val);
+ break;
+
+ }
+@@ -422,18 +422,18 @@
+ *rval = OBJECT_TO_JSVAL(_arrayObj);
+
+ /* construct new double before conversion? */
+- _v = DOUBLE_TO_JSVAL(&hue);
++ _v = DOUBLE_TO_JSVAL(hue);
+ if (!JS_SetElement(cx, _arrayObj, 0, &_v)) {
+ printf( "JS_SetElement failed for hue in SFColorRGBAGetHSV.\n");
+ return JS_FALSE;
+ }
+- _v = DOUBLE_TO_JSVAL(&saturation);
++ _v = DOUBLE_TO_JSVAL(saturation);
+ if (!JS_SetElement(cx, _arrayObj, 1, &_v)) {
+ printf( "JS_SetElement failed for saturation in SFColorRGBAGetHSV.\n");
+ return JS_FALSE;
+ }
+
+- _v = DOUBLE_TO_JSVAL(&value);
++ _v = DOUBLE_TO_JSVAL(value);
+ if (!JS_SetElement(cx, _arrayObj, 2, &_v)) {
+ printf( "JS_SetElement failed for value in SFColorRGBAGetHSV.\n");
+ return JS_FALSE;
+@@ -601,7 +601,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 1:
+ d = (ptr->v).c[1];
+@@ -611,7 +611,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 2:
+ d = (ptr->v).c[2];
+@@ -621,7 +621,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 3:
+ d = (ptr->v).c[3];
+@@ -631,7 +631,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ }
+ }
+@@ -662,16 +662,16 @@
+ if (JSVAL_IS_INT(id)) {
+ switch (JSVAL_TO_INT(id)) {
+ case 0:
+- (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(_val);
++ (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(_val);
+ break;
+ case 1:
+- (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(_val);
++ (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(_val);
+ break;
+ case 2:
+- (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(_val);
++ (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(_val);
+ break;
+ case 3:
+- (ptr->v).c[3] = (float) *JSVAL_TO_DOUBLE(_val);
++ (ptr->v).c[3] = (float) JSVAL_TO_DOUBLE(_val);
+ break;
+
+ }
+@@ -983,7 +983,7 @@
+ } else if (argc == 1) {
+ /* is this a string, or a number indicating a node? */
+ myStr = JS_ValueToString(cx, argv[0]);
+- cString = JS_GetStringBytes(myStr);
++ cString = JS_EncodeString(cx, myStr);
+ #ifdef JSVRMLCLASSESVERBOSE
+ printf ("SFNodeConstr, argc =1l string %s\n",cString);
+ #endif
+@@ -1067,13 +1067,13 @@
+ char *_id_c;
+
+ _idStr = JS_ValueToString(cx, argv[0]);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+ /* printf ("first string :%s:\n",_id_c); */
+
+ cString = STRDUP(_id_c);
+
+ _idStr = JS_ValueToString(cx, argv[1]);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+ /* printf ("second string :%s:\n",_id_c); */
+
+ if (sscanf (_id_c,"%p",&newHandle) != 1) {
+@@ -1190,7 +1190,7 @@
+ jsval rval;
+
+ _idStr = JS_ValueToString(cx, id);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+
+ #ifdef JSVRMLCLASSESVERBOSE
+ printf ("start of SFNodeGetProperty... id is %s\n",_id_c);
+@@ -1264,10 +1264,10 @@
+
+
+ _idStr = JS_ValueToString(cx, id);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+
+ _valStr = JS_ValueToString(cx, *vp);
+- _val_c = JS_GetStringBytes(_valStr);
++ _val_c = JS_EncodeString(cx, _valStr);
+
+ #ifdef JSVRMLCLASSESVERBOSE
+ printf("SFNodeSetProperty: obj = %p, id = %s, vp = %s\n",
+@@ -1904,7 +1904,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 1:
+ d = (ptr->v).c[1];
+@@ -1914,7 +1914,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 2:
+ d = (ptr->v).c[2];
+@@ -1924,7 +1924,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 3:
+ d = (ptr->v).c[3];
+@@ -1934,7 +1934,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ }
+ }
+@@ -1969,16 +1969,16 @@
+ if (JSVAL_IS_INT(id)) {
+ switch (JSVAL_TO_INT(id)) {
+ case 0:
+- (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 1:
+- (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 2:
+- (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 3:
+- (ptr->v).c[3] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[3] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ }
+ }
+@@ -2051,7 +2051,7 @@
+ * it get created in javascript? */
+ if (param_isString) {
+ _str = JS_ValueToString(cx, *argv);
+- charString = JS_GetStringBytes(_str);
++ charString = JS_EncodeString(cx, _str);
+
+ if (sscanf(charString, "%lf %lf",
+ &(pars[0]), &(pars[1])) != 2) {
+@@ -2143,7 +2143,7 @@
+ printf( "JS_NewDouble failed for %f in SFVec2f.\n",d);
+ return JS_FALSE;
+ }
+- *rval = DOUBLE_TO_JSVAL(dp);
++ *rval = DOUBLE_TO_JSVAL(*dp);
+ }
+
+ #ifdef JSVRMLCLASSESVERBOSE
+@@ -2332,7 +2332,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 1:
+ d = (ptr->v).c[1];
+@@ -2342,7 +2342,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ }
+ }
+@@ -2373,13 +2373,13 @@
+ if (JSVAL_IS_INT(id)) {
+ switch (JSVAL_TO_INT(id)) {
+ case 0:
+- (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 1:
+- (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 2:
+- (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ }
+ }
+@@ -2458,7 +2458,7 @@
+ * it get created in javascript? */
+ if (param_isString) {
+ _str = JS_ValueToString(cx, *argv);
+- charString = JS_GetStringBytes(_str);
++ charString = JS_EncodeString(cx, _str);
+
+ if (sscanf(charString, "%lf %lf %lf",
+ &(pars[0]), &(pars[1]), &(pars[2])) != 3) {
+@@ -2580,7 +2580,7 @@
+ printf( "JS_NewDouble failed for %f in SFVec3f.\n",d);
+ return JS_FALSE;
+ }
+- *rval = DOUBLE_TO_JSVAL(dp);
++ *rval = DOUBLE_TO_JSVAL(*dp);
+ }
+ #ifdef JSVRMLCLASSESVERBOSE
+ if (retSFVec3f){
+@@ -2792,9 +2792,9 @@
+ char *_id_c;
+
+ _idStr = JS_ValueToString(cx, id);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+ _idStr = JS_ValueToString(cx, *vp);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+
+ #endif
+
+@@ -2813,7 +2813,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 1:
+ d = (ptr->v).c[1];
+@@ -2823,7 +2823,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 2:
+ d = (ptr->v).c[2];
+@@ -2833,7 +2833,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ }
+ } else {
+@@ -2869,13 +2869,13 @@
+ if (JSVAL_IS_INT(id)) {
+ switch (JSVAL_TO_INT(id)) {
+ case 0:
+- (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 1:
+- (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 2:
+- (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ }
+ }
+@@ -2949,7 +2949,7 @@
+ * it get created in javascript? */
+ if (param_isString) {
+ _str = JS_ValueToString(cx, *argv);
+- charString = JS_GetStringBytes(_str);
++ charString = JS_EncodeString(cx, _str);
+
+ if (sscanf(charString, "%lf %lf %lf",
+ &(pars[0]), &(pars[1]), &(pars[2])) != 3) {
+@@ -3071,7 +3071,7 @@
+ printf( "JS_NewDouble failed for %f in SFVec3d.\n",d);
+ return JS_FALSE;
+ }
+- *rval = DOUBLE_TO_JSVAL(dp);
++ *rval = DOUBLE_TO_JSVAL(*dp);
+ }
+ #ifdef JSVRMLCLASSESVERBOSE
+ if (retSFVec3d){
+@@ -3282,9 +3282,9 @@
+ char *_id_c;
+
+ _idStr = JS_ValueToString(cx, id);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+ _idStr = JS_ValueToString(cx, *vp);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+
+ #endif
+
+@@ -3303,7 +3303,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 1:
+ d = (ptr->v).c[1];
+@@ -3313,7 +3313,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 2:
+ d = (ptr->v).c[2];
+@@ -3323,7 +3323,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ }
+ } else {
+@@ -3359,13 +3359,13 @@
+ if (JSVAL_IS_INT(id)) {
+ switch (JSVAL_TO_INT(id)) {
+ case 0:
+- (ptr->v).c[0] = *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[0] = JSVAL_TO_DOUBLE(myv);
+ break;
+ case 1:
+- (ptr->v).c[1] = *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[1] = JSVAL_TO_DOUBLE(myv);
+ break;
+ case 2:
+- (ptr->v).c[2] = *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[2] = JSVAL_TO_DOUBLE(myv);
+ break;
+ }
+ }
+@@ -3513,9 +3513,9 @@
+ char *_id_c;
+
+ _idStr = JS_ValueToString(cx, id);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+ _idStr = JS_ValueToString(cx, *vp);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+
+ #endif
+
+@@ -3534,7 +3534,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 1:
+ d = (ptr->v).c[1];
+@@ -3544,7 +3544,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 2:
+ d = (ptr->v).c[2];
+@@ -3554,7 +3554,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 3:
+ d = (ptr->v).c[3];
+@@ -3564,7 +3564,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ }
+ } else {
+@@ -3600,16 +3600,16 @@
+ if (JSVAL_IS_INT(id)) {
+ switch (JSVAL_TO_INT(id)) {
+ case 0:
+- (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 1:
+- (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 2:
+- (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 3:
+- (ptr->v).c[3] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[3] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ }
+ }
+@@ -3758,9 +3758,9 @@
+ char *_id_c;
+
+ _idStr = JS_ValueToString(cx, id);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+ _idStr = JS_ValueToString(cx, *vp);
+- _id_c = JS_GetStringBytes(_idStr);
++ _id_c = JS_EncodeString(cx, _idStr);
+
+ #endif
+
+@@ -3779,7 +3779,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 1:
+ d = (ptr->v).c[1];
+@@ -3789,7 +3789,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 2:
+ d = (ptr->v).c[2];
+@@ -3799,7 +3799,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ case 3:
+ d = (ptr->v).c[3];
+@@ -3809,7 +3809,7 @@
+ d);
+ return JS_FALSE;
+ }
+- *vp = DOUBLE_TO_JSVAL(dp);
++ *vp = DOUBLE_TO_JSVAL(*dp);
+ break;
+ }
+ } else {
+@@ -3845,16 +3845,16 @@
+ if (JSVAL_IS_INT(id)) {
+ switch (JSVAL_TO_INT(id)) {
+ case 0:
+- (ptr->v).c[0] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[0] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 1:
+- (ptr->v).c[1] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[1] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 2:
+- (ptr->v).c[2] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[2] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ case 3:
+- (ptr->v).c[3] = (float) *JSVAL_TO_DOUBLE(myv);
++ (ptr->v).c[3] = (float) JSVAL_TO_DOUBLE(myv);
+ break;
+ }
+ }
+diff -wbBur freewrl-1.22.10/src/lib/x3d_parser/X3DParser.c freewrl-1.22.10.my/src/lib/x3d_parser/X3DParser.c
+--- freewrl-1.22.10/src/lib/x3d_parser/X3DParser.c 2010-09-22 20:54:59.000000000 +0400
++++ freewrl-1.22.10.my/src/lib/x3d_parser/X3DParser.c 2011-07-04 01:19:07.000000000 +0400
+@@ -54,7 +54,7 @@
+ #include "X3DProtoScript.h"
+
+ #if HAVE_EXPAT_H
+-# include <expat.h>
++# include </usr/include/expat.h>
+ #endif
+ //#define X3DPARSERVERBOSE 1
+
diff --git a/community-testing/gpac/PKGBUILD b/community-testing/gpac/PKGBUILD
new file mode 100644
index 000000000..69717e2bc
--- /dev/null
+++ b/community-testing/gpac/PKGBUILD
@@ -0,0 +1,44 @@
+# Maintainer: Brad Fanella <bradfanella@archlinux.us
+# Contributor: Allan McRae <allan@archlinux.org>
+# Contributor: niQo
+# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
+
+pkgname=gpac
+pkgver=0.4.5
+pkgrel=7
+pkgdesc="A multimedia framework based on the MPEG-4 Systems standard"
+arch=('i686' 'x86_64')
+url="http://gpac.sourceforge.net"
+depends=('libxml2' 'wxgtk' 'alsa-lib' 'sdl' 'js' 'libmad' \
+ 'faad2' 'xvidcore' 'ffmpeg' 'freeglut')
+license=('LGPL')
+options=('!makeflags') # Multiple build jobs aren't handled correctly
+source=(http://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}-${pkgver}.tar.gz
+ libpng14-infopp-null.patch)
+md5sums=('755e8c438a48ebdb13525dd491f5b0d1'
+ '14d6483c9eb84434aea68596f243e0ca')
+
+build() {
+ cd ${srcdir}/${pkgname}
+ chmod +x configure
+ sed -i 's|--warn-common||' configure
+ sed -i 's#osmozilla##g' applications/Makefile
+ sed -i 's#"$(prefix)#"$(DESTDIR)$(prefix)#' applications/osmo4_wx/Makefile
+ sed -i 's#ldconfig || true##g' Makefile
+
+ #FS#14506
+ sed -i 's#lib64#lib#g' configure
+ patch -Np1 -i ${srcdir}/libpng14-infopp-null.patch
+
+ # Was getting "symbol lookup error: /usr/lib/gpac/gm_x11_out.so: undefined
+ # symbol: XvQueryExtension" with our LDFLAGS :\
+ unset LDFLAGS
+
+ ./configure --prefix=/usr --mandir=/usr/share/man --use-js=no
+ make
+}
+
+package() {
+ cd ${srcdir}/${pkgname}
+ make DESTDIR=${pkgdir} install install-lib
+}
diff --git a/community-testing/gpac/libpng14-infopp-null.patch b/community-testing/gpac/libpng14-infopp-null.patch
new file mode 100644
index 000000000..b02456557
--- /dev/null
+++ b/community-testing/gpac/libpng14-infopp-null.patch
@@ -0,0 +1,12 @@
+diff -upr gpac.orig/src/media_tools/img.c gpac/src/media_tools/img.c
+--- gpac.orig/src/media_tools/img.c 2010-01-24 19:03:28.000000000 +0200
++++ gpac/src/media_tools/img.c 2010-01-24 19:04:07.000000000 +0200
+@@ -551,7 +551,7 @@ GF_Err gf_img_png_enc(char *data, u32 wi
+ /* Allocate/initialize the image information data. REQUIRED */
+ info_ptr = png_create_info_struct(png_ptr);
+ if (info_ptr == NULL) {
+- png_destroy_write_struct(&png_ptr, png_infopp_NULL);
++ png_destroy_write_struct(&png_ptr, NULL);
+ return GF_IO_ERR;
+ }
+
diff --git a/community-testing/htmldoc/PKGBUILD b/community-testing/htmldoc/PKGBUILD
new file mode 100644
index 000000000..92622ac08
--- /dev/null
+++ b/community-testing/htmldoc/PKGBUILD
@@ -0,0 +1,34 @@
+# $Id: PKGBUILD 51081 2011-07-05 07:09:42Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Maintainer: tobias <tobias@archlinux.org>
+# Contributor: Simon Rutishauser <simon.rutishauser@gmx.ch>
+
+pkgname=htmldoc
+pkgver=1.8.27
+pkgrel=6
+pkgdesc="Produce PDF or Postscript from HTML documents including TOCs and Indices"
+arch=(i686 x86_64)
+url="http://www.htmldoc.org"
+license=('GPL')
+depends=('libjpeg' 'libpng' 'openssl' 'fltk' 'gcc' 'libxft' 'libxpm')
+source=(ftp://ftp.easysw.com/pub/${pkgname}/${pkgver}/${pkgname}-$pkgver-source.tar.bz2)
+md5sums=('35589e7b8fe9c54e11be87cd5aec4dcc')
+
+build() {
+ cd ${startdir}/src/${pkgname}-${pkgver}
+ ./configure --prefix=/usr --mandir=${pkgdir}/usr/share/man
+ sed -i 's|^bindir.*$|bindir = ${prefix}/bin|' Makedefs
+ make
+}
+
+package() {
+ cd ${startdir}/src/${pkgname}-${pkgver}
+ make prefix=${startdir}/pkg/usr install
+ # fix freedesktop stuff
+ install -Dm 644 desktop/htmldoc-128.png \
+ ${startdir}/pkg/usr/share/pixmaps/htmldoc.png
+ echo "MimeType=application/vnd.htmldoc-book;" >> desktop/htmldoc.desktop
+ sed -i 's|X-Red-Hat.*$||' desktop/htmldoc.desktop
+ install -Dm 644 desktop/htmldoc.desktop \
+ ${startdir}/pkg/usr/share/applications/htmldoc.desktop
+}
diff --git a/community-testing/mediatomb/PKGBUILD b/community-testing/mediatomb/PKGBUILD
new file mode 100644
index 000000000..c8850e23c
--- /dev/null
+++ b/community-testing/mediatomb/PKGBUILD
@@ -0,0 +1,49 @@
+# $Id: PKGBUILD 51077 2011-07-05 06:51:52Z jconder $
+# Contributor: William Rea <sillywilly@gmail.com>
+# Contributor: Nikhil Bysani <nikron@gmail.com>
+# Contributor: Mika Hynnä <igheax@gmail.com>
+# Maintainer: Jonathan Conder <jonno.conder@gmail.com>
+
+pkgname=mediatomb
+pkgver=0.12.1
+pkgrel=5
+pkgdesc="Free UPnP/DLNA media server"
+arch=('i686' 'x86_64')
+url="http://mediatomb.cc/"
+license=('GPL')
+depends=('curl' 'ffmpegthumbnailer' 'js' 'libexif' 'libmp4v2' 'sqlite3' 'taglib')
+backup=('etc/conf.d/mediatomb')
+install=mediatomb.install
+source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz"
+ 'mediatomb.rc'
+ 'mediatomb.conf'
+ 'gcc46.patch'
+ 'tonewjs.patch')
+md5sums=('e927dd5dc52d3cfcebd8ca1af6f0d3c2'
+ 'aa1191ec508d8bd4b3b9a5fe48efc079'
+ 'bec297e4178332a26b42bbde873b94cd'
+ '0ae34c0d73b76e3d215887834c3c08cf'
+ 'd9e02a9956eecf5ff645bddf6dac0331')
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ patch -Np1 -i $srcdir/gcc46.patch
+ patch -Np1 -i $srcdir/tonewjs.patch
+
+ ./configure --prefix=/usr \
+ --disable-mysql \
+ --enable-libmagic \
+ --enable-libjs \
+ --enable-ffmpeg
+ make
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ make DESTDIR="$pkgdir/" install
+
+ install -D -m0755 "$srcdir/mediatomb.rc" "$pkgdir/etc/rc.d/mediatomb"
+ install -D -m0755 "$srcdir/mediatomb.conf" "$pkgdir/etc/conf.d/mediatomb"
+ install -d "$pkgdir/var/lib/mediatomb"
+}
diff --git a/community-testing/mediatomb/gcc46.patch b/community-testing/mediatomb/gcc46.patch
new file mode 100644
index 000000000..0f4fe490f
--- /dev/null
+++ b/community-testing/mediatomb/gcc46.patch
@@ -0,0 +1,10 @@
+--- a/src/zmm/object.h
++++ b/src/zmm/object.h
+@@ -33,6 +33,7 @@
+ #define __ZMM_OBJECT_H__
+
+ #include <new> // for size_t
++#include <cstddef>
+ #include "atomic.h"
+
+ namespace zmm
diff --git a/community-testing/mediatomb/mediatomb.conf b/community-testing/mediatomb/mediatomb.conf
new file mode 100644
index 000000000..798018d2a
--- /dev/null
+++ b/community-testing/mediatomb/mediatomb.conf
@@ -0,0 +1,23 @@
+#
+# Parameters to be passed to mediatomb
+#
+
+# Port to listen on
+MT_PORT='50500'
+
+# User and group to run as
+MT_USER='nobody'
+MT_GROUP='nobody'
+
+# Location of the PID file
+MT_PIDFILE='/var/run/mediatomb.pid'
+
+# Location of the log file
+MT_LOGFILE='/var/log/mediatomb.log'
+
+# Location of the config file/database
+MT_HOME='/var/lib/mediatomb'
+MT_CFGDIR='.mediatomb'
+
+# User defined command line options
+MT_OPTIONS=''
diff --git a/community-testing/mediatomb/mediatomb.install b/community-testing/mediatomb/mediatomb.install
new file mode 100644
index 000000000..56f6ef92c
--- /dev/null
+++ b/community-testing/mediatomb/mediatomb.install
@@ -0,0 +1,9 @@
+post_install() {
+ echo 'Warning: the MediaTomb web interface exposes your filesystem to the network'
+ echo 'For maximum security, set <ui enabled="no"> in your MediaTomb config file'
+}
+
+post_upgrade() {
+ # TODO: disable next update
+ post_install
+}
diff --git a/community-testing/mediatomb/mediatomb.rc b/community-testing/mediatomb/mediatomb.rc
new file mode 100644
index 000000000..7b93012cd
--- /dev/null
+++ b/community-testing/mediatomb/mediatomb.rc
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/mediatomb
+
+MT_OPTIONS="-p $MT_PORT -u $MT_USER -g $MT_GROUP -P $MT_PIDFILE \
+ -l $MT_LOGFILE -m $MT_HOME -f $MT_CFGDIR $MT_OPTIONS"
+
+case "$1" in
+ start)
+ stat_busy "Starting Mediatomb UPnP Media Server"
+
+ chown "$MT_USER:$MT_GROUP" "$MT_HOME"
+
+ if ! pidof -o %PPID /usr/bin/mediatomb &> /dev/null; then
+ rm -f "$MT_PIDFILE"
+ fi
+
+ PID="$(cat "$MT_PIDFILE" 2> /dev/null)"
+
+ if [ -z "$PID" ] && /usr/bin/mediatomb -d $MT_OPTIONS; then
+ add_daemon mediatomb
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping Mediatomb UPnP Media Server"
+
+ PID="$(cat "$MT_PIDFILE" 2> /dev/null)"
+
+ if [ -n "$PID" ] && kill "$PID" &> /dev/null; then
+ rm -f "$MT_PIDFILE"
+ rm_daemon mediatomb
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+
+ restart)
+ "$0" stop
+ sleep 1
+ "$0" start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/community-testing/mediatomb/tonewjs.patch b/community-testing/mediatomb/tonewjs.patch
new file mode 100644
index 000000000..115968530
--- /dev/null
+++ b/community-testing/mediatomb/tonewjs.patch
@@ -0,0 +1,564 @@
+diff -up mediatomb-0.12.1-back/build/Makefile.in.tonewjs mediatomb-0.12.1-back/build/Makefile.in
+--- mediatomb-0.12.1-back/build/Makefile.in.tonewjs 2010-04-08 00:40:15.000000000 +0200
++++ mediatomb-0.12.1-back/build/Makefile.in 2011-04-19 17:17:01.343509944 +0200
+@@ -257,7 +257,7 @@ CURL_LIBS = @CURL_LIBS@
+ CXX = @CXX@
+ CXXCPP = @CXXCPP@
+ CXXDEPMODE = @CXXDEPMODE@
+-CXXFLAGS = @CXXFLAGS@
++CXXFLAGS = -fpermissive @CXXFLAGS@
+ CYGPATH_W = @CYGPATH_W@
+ DB_AUTOCREATE_OPTION_ENABLED = @DB_AUTOCREATE_OPTION_ENABLED@
+ DB_AUTOCREATE_OPTION_REQUESTED = @DB_AUTOCREATE_OPTION_REQUESTED@
+diff -up mediatomb-0.12.1-back/src/scripting/import_script.cc.tonewjs mediatomb-0.12.1-back/src/scripting/import_script.cc
+--- mediatomb-0.12.1-back/src/scripting/import_script.cc.tonewjs 2011-04-18 13:10:48.000000000 +0200
++++ mediatomb-0.12.1-back/src/scripting/import_script.cc 2011-04-18 13:29:36.000000000 +0200
+@@ -53,8 +53,8 @@ ImportScript::ImportScript(Ref<Runtime>
+ try
+ {
+ load(scriptPath);
+- root = JS_NewScriptObject(cx, script);
+- JS_AddNamedRoot(cx, &root, "ImportScript");
++ root = JS_NewObject(cx, NULL, script, NULL);
++ JS_AddNamedObjectRoot(cx, &root, "ImportScript");
+ }
+ catch (Exception ex)
+ {
+@@ -117,7 +117,7 @@ ImportScript::~ImportScript()
+ #endif
+
+ if (root)
+- JS_RemoveRoot(cx, &root);
++ JS_RemoveObjectRoot(cx, &root);
+
+ #ifdef JS_THREADSAFE
+ JS_EndRequest(cx);
+diff -up mediatomb-0.12.1-back/src/scripting/js_functions.cc.tonewjs mediatomb-0.12.1-back/src/scripting/js_functions.cc
+--- mediatomb-0.12.1-back/src/scripting/js_functions.cc.tonewjs 2011-04-18 13:29:55.000000000 +0200
++++ mediatomb-0.12.1-back/src/scripting/js_functions.cc 2011-04-19 16:48:04.009229611 +0200
+@@ -49,7 +49,7 @@ using namespace zmm;
+ extern "C" {
+
+ JSBool
+-js_print(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
++js_print(JSContext *cx, uintN argc, jsval *argv)
+ {
+ uintN i;
+ JSString *str;
+@@ -60,19 +60,21 @@ js_print(JSContext *cx, JSObject *obj, u
+ if (!str)
+ return JS_TRUE;
+ argv[i] = STRING_TO_JSVAL(str);
+- log_js("%s\n", JS_GetStringBytes(str));
++ char * log_str = JS_EncodeString(cx, str);
++ log_js("%s\n", log_str);
++ JS_free(cx, log_str);
+ }
+ return JS_TRUE;
+ }
+
+ JSBool
+-js_copyObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
++js_copyObject(JSContext *cx, uintN argc, jsval *argv)
+ {
+ jsval arg;
+ JSObject *js_cds_obj;
+ JSObject *js_cds_clone_obj;
+
+- Script *self = (Script *)JS_GetPrivate(cx, obj);
++ Script *self = (Script *)JS_GetPrivate(cx, JS_THIS_OBJECT(cx, argv));
+
+ try
+ {
+@@ -91,7 +93,7 @@ js_copyObject(JSContext *cx, JSObject *o
+
+ self->cdsObject2jsObject(cds_obj, js_cds_clone_obj);
+
+- *rval = OBJECT_TO_JSVAL(js_cds_clone_obj);
++ JS_SET_RVAL(cx, argv, OBJECT_TO_JSVAL(js_cds_clone_obj));
+
+ return JS_TRUE;
+
+@@ -110,7 +112,7 @@ js_copyObject(JSContext *cx, JSObject *o
+ }
+
+ JSBool
+-js_addCdsObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
++js_addCdsObject(JSContext *cx, uintN argc, jsval *argv)
+ {
+ try
+ {
+@@ -126,7 +128,7 @@ js_addCdsObject(JSContext *cx, JSObject
+ Ref<StringConverter> p2i;
+ Ref<StringConverter> i2i;
+
+- Script *self = (Script *)JS_GetPrivate(cx, obj);
++ Script *self = (Script *)JS_GetPrivate(cx, JS_THIS_OBJECT(cx, argv));
+
+ if (self == NULL)
+ {
+@@ -156,20 +158,20 @@ js_addCdsObject(JSContext *cx, JSObject
+ if (!str)
+ path = _("/");
+ else
+- path = JS_GetStringBytes(str);
++ path = JS_EncodeString(cx, str);
+
+ JSString *cont = JS_ValueToString(cx, argv[2]);
+ if (cont)
+ {
+- containerclass = JS_GetStringBytes(cont);
++ containerclass = JS_EncodeString(cx, cont);
+ if (!string_ok(containerclass) || containerclass == "undefined")
+ containerclass = nil;
+ }
+
+ if (self->whoami() == S_PLAYLIST)
+- js_orig_obj = self->getObjectProperty(obj, _("playlist"));
++ js_orig_obj = self->getObjectProperty(JS_THIS_OBJECT(cx, argv), _("playlist"));
+ else if (self->whoami() == S_IMPORT)
+- js_orig_obj = self->getObjectProperty(obj, _("orig"));
++ js_orig_obj = self->getObjectProperty(JS_THIS_OBJECT(cx, argv), _("orig"));
+
+ if (js_orig_obj == NULL)
+ {
+@@ -285,8 +287,7 @@ js_addCdsObject(JSContext *cx, JSObject
+ JSString *str2 = JS_NewStringCopyN(cx, tmp.c_str(), tmp.length());
+ if (!str2)
+ return JS_TRUE;
+- *rval = STRING_TO_JSVAL(str2);
+-
++ JS_SET_RVAL(cx, argv, STRING_TO_JSVAL(str2));
+ return JS_TRUE;
+ }
+ catch (ServerShutdownException se)
+@@ -302,7 +303,7 @@ js_addCdsObject(JSContext *cx, JSObject
+ return JS_TRUE;
+ }
+
+-static JSBool convert_charset_generic(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval, charset_convert_t chr)
++static JSBool convert_charset_generic(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, charset_convert_t chr)
+ {
+ try
+ {
+@@ -321,7 +322,7 @@ static JSBool convert_charset_generic(JS
+ {
+ str = JS_ValueToString(cx, argv[0]);
+ if (str)
+- result = JS_GetStringBytes(str);
++ result = JS_EncodeString(cx, str);
+ }
+
+ if (result != nil)
+@@ -330,7 +331,7 @@ static JSBool convert_charset_generic(JS
+ JSString *str2 = JS_NewStringCopyN(cx, result.c_str(), result.length());
+ if (!str2)
+ return JS_TRUE;
+- *rval = STRING_TO_JSVAL(str2);
++ JS_SET_RVAL(cx, argv, STRING_TO_JSVAL(str2));
+ }
+ }
+ catch (ServerShutdownException se)
+@@ -347,24 +348,23 @@ static JSBool convert_charset_generic(JS
+ }
+
+
+-JSBool js_f2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
++JSBool js_f2i(JSContext *cx, uintN argc, jsval *argv)
+ {
+- return convert_charset_generic(cx, obj, argc, argv, rval, F2I);
++ return convert_charset_generic(cx, JS_THIS_OBJECT(cx, argv), argc, argv, F2I);
+ }
+
+-JSBool js_m2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
++JSBool js_m2i(JSContext *cx, uintN argc, jsval *argv)
+ {
+- return convert_charset_generic(cx, obj, argc, argv, rval, M2I);
+-}
++ return convert_charset_generic(cx, JS_THIS_OBJECT(cx, argv), argc, argv, M2I); }
+
+-JSBool js_p2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
++JSBool js_p2i(JSContext *cx, uintN argc, jsval *argv)
+ {
+- return convert_charset_generic(cx, obj, argc, argv, rval, P2I);
++ return convert_charset_generic(cx, JS_THIS_OBJECT(cx, argv), argc, argv, P2I);
+ }
+
+-JSBool js_j2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
++JSBool js_j2i(JSContext *cx, uintN argc, jsval *argv)
+ {
+- return convert_charset_generic(cx, obj, argc, argv, rval, J2I);
++ return convert_charset_generic(cx, JS_THIS_OBJECT(cx, argv), argc, argv, J2I);
+ }
+
+ } // extern "C"
+diff -up mediatomb-0.12.1-back/src/scripting/js_functions.h.tonewjs mediatomb-0.12.1-back/src/scripting/js_functions.h
+--- mediatomb-0.12.1-back/src/scripting/js_functions.h.tonewjs 2010-03-25 15:58:05.000000000 +0100
++++ mediatomb-0.12.1-back/src/scripting/js_functions.h 2011-04-18 13:59:29.000000000 +0200
+@@ -40,18 +40,18 @@
+ extern "C" {
+
+ /// \brief Log output.
+-JSBool js_print(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
++JSBool js_print(JSContext *cx, uintN argc, jsval *argv);
+
+ /// \brief Adds an object to the database.
+-JSBool js_addCdsObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
++JSBool js_addCdsObject(JSContext *cx, uintN argc, jsval *argv);
+
+ /// \brief Makes a copy of an CDS object.
+-JSBool js_copyObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
++JSBool js_copyObject(JSContext *cx, uintN argc, jsval *argv);
+
+-JSBool js_f2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
+-JSBool js_m2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
+-JSBool js_p2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
+-JSBool js_j2i(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
++JSBool js_f2i(JSContext *cx, uintN argc, jsval *argv);
++JSBool js_m2i(JSContext *cx, uintN argc, jsval *argv);
++JSBool js_p2i(JSContext *cx, uintN argc, jsval *argv);
++JSBool js_j2i(JSContext *cx, uintN argc, jsval *argv);
+
+ } // extern "C"
+
+diff -up mediatomb-0.12.1-back/src/scripting/playlist_parser_script.cc.tonewjs mediatomb-0.12.1-back/src/scripting/playlist_parser_script.cc
+--- mediatomb-0.12.1-back/src/scripting/playlist_parser_script.cc.tonewjs 2011-04-18 13:34:14.000000000 +0200
++++ mediatomb-0.12.1-back/src/scripting/playlist_parser_script.cc 2011-04-18 13:51:59.000000000 +0200
+@@ -46,9 +46,9 @@ using namespace zmm;
+ extern "C" {
+
+ static JSBool
+-js_readln(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
++js_readln(JSContext *cx, uintN argc, jsval *argv)
+ {
+- PlaylistParserScript *self = (PlaylistParserScript *)JS_GetPrivate(cx, obj);
++ PlaylistParserScript *self = (PlaylistParserScript *)JS_GetPrivate(cx, JS_THIS_OBJECT(cx, argv));
+
+ String line;
+
+@@ -69,7 +69,7 @@ js_readln(JSContext *cx, JSObject *obj,
+
+ JSString *jsline = JS_NewStringCopyZ(cx, line.c_str());
+
+- *rval = STRING_TO_JSVAL(jsline);
++ JS_SET_RVAL(cx, argv, STRING_TO_JSVAL(jsline));
+
+ return JS_TRUE;
+ }
+@@ -93,8 +93,8 @@ PlaylistParserScript::PlaylistParserScri
+
+ String scriptPath = ConfigManager::getInstance()->getOption(CFG_IMPORT_SCRIPTING_PLAYLIST_SCRIPT);
+ load(scriptPath);
+- root = JS_NewScriptObject(cx, script);
+- JS_AddNamedRoot(cx, &root, "PlaylistScript");
++ root = JS_NewObject(cx, NULL, script, NULL);
++ JS_AddNamedObjectRoot(cx, &root, "PlaylistScript");
+ }
+ catch (Exception ex)
+ {
+@@ -245,7 +245,7 @@ PlaylistParserScript::~PlaylistParserScr
+ #endif
+
+ if (root)
+- JS_RemoveRoot(cx, &root);
++ JS_RemoveObjectRoot(cx, &root);
+
+ #ifdef JS_THREADSAFE
+ JS_EndRequest(cx);
+diff -up mediatomb-0.12.1-back/src/scripting/script.cc.tonewjs mediatomb-0.12.1-back/src/scripting/script.cc
+--- mediatomb-0.12.1-back/src/scripting/script.cc.tonewjs 2011-04-18 13:53:07.000000000 +0200
++++ mediatomb-0.12.1-back/src/scripting/script.cc 2011-04-19 18:26:34.460338804 +0200
+@@ -87,7 +87,7 @@ String Script::getProperty(JSObject *obj
+ str = JS_ValueToString(cx, val);
+ if (! str)
+ return nil;
+- return JS_GetStringBytes(str);
++ return JS_EncodeString(cx, str);
+ }
+
+ int Script::getBoolProperty(JSObject *obj, String name)
+@@ -427,14 +427,14 @@ static JSFunctionSpec js_global_function
+ try
+ {
+ common_script = _load(common_scr_path);
+- common_root = JS_NewScriptObject(cx, common_script);
+- JS_AddNamedRoot(cx, &common_root, "common-script");
++ common_root = JS_NewObject(cx, NULL, common_script, NULL);
++ JS_AddNamedObjectRoot(cx, &common_root, "common-script");
+ _execute(common_script);
+ }
+ catch (Exception e)
+ {
+ if (common_root)
+- JS_RemoveRoot(cx, &common_root);
++ JS_RemoveObjectRoot(cx, &common_root);
+
+ log_js("Unable to load %s: %s\n", common_scr_path.c_str(),
+ e.getMessage().c_str());
+@@ -460,7 +460,7 @@ Script::~Script()
+ JS_BeginRequest(cx);
+ #endif
+ if (common_root)
+- JS_RemoveRoot(cx, &common_root);
++ JS_RemoveObjectRoot(cx, &common_root);
+
+ /*
+ * scripts are unrooted and will be cleaned up by GC
+@@ -504,11 +504,11 @@ void Script::initGlobalObject()
+ static JSClass global_class =
+ {
+ "global", /* name */
+- JSCLASS_HAS_PRIVATE, /* flags */
++ JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS,/* flags */
+ JS_PropertyStub, /* add property */
+ JS_PropertyStub, /* del property */
+ JS_PropertyStub, /* get property */
+- JS_PropertyStub, /* set property */
++ JS_StrictPropertyStub, /* set property */
+ JS_EnumerateStandardClasses, /* enumerate */
+ JS_ResolveStub, /* resolve */
+ JS_ConvertStub, /* convert */
+@@ -517,7 +517,7 @@ void Script::initGlobalObject()
+ };
+
+ /* create the global object here */
+- glob = JS_NewObject(cx, &global_class, NULL, NULL);
++ glob = JS_NewCompartmentAndGlobalObject(cx, &global_class, NULL);
+ if (! glob)
+ throw _Exception(_("Scripting: could not initialize glboal class"));
+
+@@ -539,12 +539,12 @@ void Script::defineFunctions(JSFunctionS
+ throw _Exception(_("Scripting: JS_DefineFunctions failed"));
+ }
+
+-JSScript *Script::_load(zmm::String scriptPath)
++JSObject *Script::_load(zmm::String scriptPath)
+ {
+ if (glob == NULL)
+ initGlobalObject();
+
+- JSScript *scr;
++ JSObject *scr;
+
+ String scriptText = read_text_file(scriptPath);
+
+@@ -571,14 +571,11 @@ JSScript *Script::_load(zmm::String scri
+
+ void Script::load(zmm::String scriptPath)
+ {
+- if (script)
+- JS_DestroyScript(cx, script);
+-
+ script = _load((scriptPath));
+ }
+
+
+-void Script::_execute(JSScript *scr)
++void Script::_execute(JSObject *scr)
+ {
+ jsval ret_val;
+
+@@ -662,7 +659,7 @@ Ref<CdsObject> Script::jsObject2cdsObjec
+ JSObject *js_meta = getObjectProperty(js, _("meta"));
+ if (js_meta)
+ {
+- JS_AddNamedRoot(cx, &js_meta, "meta");
++ JS_AddNamedObjectRoot(cx, &js_meta, "meta");
+ /// \todo: only metadata enumerated in MT_KEYS is taken
+ for (int i = 0; i < M_MAX; i++)
+ {
+@@ -687,7 +684,7 @@ Ref<CdsObject> Script::jsObject2cdsObjec
+ }
+ }
+ }
+- JS_RemoveRoot(cx, &js_meta);
++ JS_RemoveObjectRoot(cx, &js_meta);
+ }
+
+ // stuff that has not been exported to js
+diff -up mediatomb-0.12.1-back/src/scripting/script.h.tonewjs mediatomb-0.12.1-back/src/scripting/script.h
+--- mediatomb-0.12.1-back/src/scripting/script.h.tonewjs 2011-04-18 12:56:14.000000000 +0200
++++ mediatomb-0.12.1-back/src/scripting/script.h 2011-04-18 12:56:51.000000000 +0200
+@@ -66,8 +66,8 @@ public:
+ JSRuntime *rt;
+ JSContext *cx;
+ JSObject *glob;
+- JSScript *script;
+- JSScript *common_script;
++ JSObject *script;
++ JSObject *common_script;
+
+ public:
+ Script(zmm::Ref<Runtime> runtime);
+@@ -115,8 +115,8 @@ private:
+ JSObject *common_root;
+
+ void initGlobalObject();
+- JSScript *_load(zmm::String scriptPath);
+- void _execute(JSScript *scr);
++ JSObject *_load(zmm::String scriptPath);
++ void _execute(JSObject *scr);
+ zmm::Ref<StringConverter> _p2i;
+ zmm::Ref<StringConverter> _j2i;
+ zmm::Ref<StringConverter> _f2i;
+--- mediatomb-0.12.1/configure.tonewjs 2011-07-04 20:20:00.290227110 +1200
++++ mediatomb-0.12.1/configure 2011-07-04 20:20:28.186894644 +1200
+@@ -23784,14 +23784,14 @@ if test "x$ac_cv_lib_smjs_JS_NewObject"
+
+ else
+
+- LDFLAGS="-L$JS_SEARCH_LIBS $LDFLAGS_SAVE -lmozjs $ADD_PTHREAD_CFLAGS"
+- { $as_echo "$as_me:$LINENO: checking for JS_NewObject in -lmozjs" >&5
+-$as_echo_n "checking for JS_NewObject in -lmozjs... " >&6; }
+-if test "${ac_cv_lib_mozjs_JS_NewObject+set}" = set; then
++ LDFLAGS="-L$JS_SEARCH_LIBS $LDFLAGS_SAVE -lmozjs185 $ADD_PTHREAD_CFLAGS"
++ { $as_echo "$as_me:$LINENO: checking for JS_NewObject in -lmozjs185" >&5
++$as_echo_n "checking for JS_NewObject in -lmozjs185... " >&6; }
++if test "${ac_cv_lib_mozjs185_JS_NewObject+set}" = set; then
+ $as_echo_n "(cached) " >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lmozjs $LIBS"
++LIBS="-lmozjs185 $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+ _ACEOF
+@@ -23835,12 +23835,12 @@ $as_echo "$ac_try_echo") >&5
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+- ac_cv_lib_mozjs_JS_NewObject=yes
++ ac_cv_lib_mozjs185_JS_NewObject=yes
+ else
+ $as_echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+
+- ac_cv_lib_mozjs_JS_NewObject=no
++ ac_cv_lib_mozjs185_JS_NewObject=no
+ fi
+
+ rm -rf conftest.dSYM
+@@ -23848,12 +23848,12 @@ rm -f core conftest.err conftest.$ac_obj
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mozjs_JS_NewObject" >&5
+-$as_echo "$ac_cv_lib_mozjs_JS_NewObject" >&6; }
+-if test "x$ac_cv_lib_mozjs_JS_NewObject" = x""yes; then
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mozjs185_JS_NewObject" >&5
++$as_echo "$ac_cv_lib_mozjs185_JS_NewObject" >&6; }
++if test "x$ac_cv_lib_mozjs185_JS_NewObject" = x""yes; then
+
+- JS_LIBS="-L$JS_SEARCH_LIBS -lmozjs"
+- MOZLIB=mozjs
++ JS_LIBS="-L$JS_SEARCH_LIBS -lmozjs185"
++ MOZLIB=mozjs185
+
+ else
+
+@@ -24020,13 +24020,13 @@ if test "x$ac_cv_lib_smjs_JS_NewObject"
+ else
+
+ unset ac_cv_lib_smjs_JS_NewObject
+- { $as_echo "$as_me:$LINENO: checking for JS_NewObject in -lmozjs" >&5
+-$as_echo_n "checking for JS_NewObject in -lmozjs... " >&6; }
+-if test "${ac_cv_lib_mozjs_JS_NewObject+set}" = set; then
++ { $as_echo "$as_me:$LINENO: checking for JS_NewObject in -lmozjs185" >&5
++$as_echo_n "checking for JS_NewObject in -lmozjs185... " >&6; }
++if test "${ac_cv_lib_mozjs185_JS_NewObject+set}" = set; then
+ $as_echo_n "(cached) " >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lmozjs $LIBS"
++LIBS="-lmozjs185 $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+ _ACEOF
+@@ -24070,12 +24070,12 @@ $as_echo "$ac_try_echo") >&5
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+- ac_cv_lib_mozjs_JS_NewObject=yes
++ ac_cv_lib_mozjs185_JS_NewObject=yes
+ else
+ $as_echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+
+- ac_cv_lib_mozjs_JS_NewObject=no
++ ac_cv_lib_mozjs185_JS_NewObject=no
+ fi
+
+ rm -rf conftest.dSYM
+@@ -24083,12 +24083,12 @@ rm -f core conftest.err conftest.$ac_obj
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mozjs_JS_NewObject" >&5
+-$as_echo "$ac_cv_lib_mozjs_JS_NewObject" >&6; }
+-if test "x$ac_cv_lib_mozjs_JS_NewObject" = x""yes; then
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mozjs185_JS_NewObject" >&5
++$as_echo "$ac_cv_lib_mozjs185_JS_NewObject" >&6; }
++if test "x$ac_cv_lib_mozjs185_JS_NewObject" = x""yes; then
+
+- MOZLIB=mozjs
+- JS_LIBS="-lmozjs"
++ MOZLIB=mozjs185
++ JS_LIBS="-lmozjs185"
+
+ else
+
+@@ -24239,15 +24239,15 @@ if test "x$ac_cv_lib_smjs_JS_NewObject"
+
+ else
+
+- LDFLAGS="-L$SEARCH_DIR_LIBS $LDFLAGS_SAVE -lmozjs"
+- unset ac_cv_lib_mozjs_JS_NewObject
+- { $as_echo "$as_me:$LINENO: checking for JS_NewObject in -lmozjs" >&5
+-$as_echo_n "checking for JS_NewObject in -lmozjs... " >&6; }
+-if test "${ac_cv_lib_mozjs_JS_NewObject+set}" = set; then
++ LDFLAGS="-L$SEARCH_DIR_LIBS $LDFLAGS_SAVE -lmozjs185"
++ unset ac_cv_lib_mozjs185_JS_NewObject
++ { $as_echo "$as_me:$LINENO: checking for JS_NewObject in -lmozjs185" >&5
++$as_echo_n "checking for JS_NewObject in -lmozjs185... " >&6; }
++if test "${ac_cv_lib_mozjs185_JS_NewObject+set}" = set; then
+ $as_echo_n "(cached) " >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lmozjs $LIBS"
++LIBS="-lmozjs185 $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+ _ACEOF
+@@ -24291,12 +24291,12 @@ $as_echo "$ac_try_echo") >&5
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+- ac_cv_lib_mozjs_JS_NewObject=yes
++ ac_cv_lib_mozjs185_JS_NewObject=yes
+ else
+ $as_echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+
+- ac_cv_lib_mozjs_JS_NewObject=no
++ ac_cv_lib_mozjs185_JS_NewObject=no
+ fi
+
+ rm -rf conftest.dSYM
+@@ -24304,12 +24304,12 @@ rm -f core conftest.err conftest.$ac_obj
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mozjs_JS_NewObject" >&5
+-$as_echo "$ac_cv_lib_mozjs_JS_NewObject" >&6; }
+-if test "x$ac_cv_lib_mozjs_JS_NewObject" = x""yes; then
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mozjs185_JS_NewObject" >&5
++$as_echo "$ac_cv_lib_mozjs185_JS_NewObject" >&6; }
++if test "x$ac_cv_lib_mozjs185_JS_NewObject" = x""yes; then
+
+- JS_LIBS="-L$SEARCH_DIR_LIBS -lmozjs"
+- MOZLIB=mozjs
++ JS_LIBS="-L$SEARCH_DIR_LIBS -lmozjs185"
++ MOZLIB=mozjs185
+
+ else
+
diff --git a/community-testing/mongodb/PKGBUILD b/community-testing/mongodb/PKGBUILD
new file mode 100644
index 000000000..04fa547a9
--- /dev/null
+++ b/community-testing/mongodb/PKGBUILD
@@ -0,0 +1,60 @@
+# Maintainer: Thomas Dziedzic < gostrc at gmail >
+# Contributor: Mathias Stearn <mathias@10gen.com>
+# Contributor: Alec Thomas
+
+pkgname=mongodb
+pkgver=1.8.2
+pkgrel=5
+pkgdesc='A high-performance, open source, schema-free document-oriented database.'
+arch=('i686' 'x86_64')
+url='http://www.mongodb.org'
+license=('AGPL3')
+depends=('boost-libs' 'js' 'pcre')
+makedepends=('scons' 'boost')
+optdepends=('libpcap: needed for mongosniff')
+backup=('etc/mongodb.conf')
+install="mongodb.install"
+source=("http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz"
+ 'mongodb.rc'
+ 'mongodb.conf'
+ 'mongodb-1.8.0-spidermonkey-1.8.5-support.patch'
+ 'add-js185-support-to-SConstruct.diff')
+md5sums=('951fb1a75d90fc822cf4528585a970cf'
+ '85eaa28e349fdc6250f883624e624cca'
+ '4839fe1d638187ca3226e8267b947318'
+ '2e6409732fba887c9cfe81257b5260ad'
+ 'ca7e62be31389d951bfd8848b1675c1b')
+
+build() {
+ export SCONSFLAGS="$MAKEFLAGS"
+
+ cd mongodb-src-r${pkgver}
+
+ # js185 support https://jira.mongodb.org/browse/SERVER-2887
+ patch -Np1 -i ${srcdir}/mongodb-1.8.0-spidermonkey-1.8.5-support.patch
+ patch -Np0 -i ${srcdir}/add-js185-support-to-SConstruct.diff
+
+ scons \
+ all \
+ --full
+}
+
+package() {
+ cd mongodb-src-r${pkgver}
+
+ scons \
+ install \
+ --full \
+ --prefix=${pkgdir}/usr
+
+ install -D -m755 ${srcdir}/mongodb.rc \
+ ${pkgdir}/etc/rc.d/mongodb
+ install -D -m644 ${srcdir}/mongodb.conf \
+ ${pkgdir}/etc/mongodb.conf
+ install -d -m700 ${pkgdir}/var/lib/mongodb
+ install -d -m755 ${pkgdir}/var/log/mongodb
+
+ if [ -d ${pkgdir}/usr/lib64 ]; then
+ mv ${pkgdir}/usr/lib64 ${pkgdir}/usr/lib
+ fi
+}
diff --git a/community-testing/mongodb/add-js185-support-to-SConstruct.diff b/community-testing/mongodb/add-js185-support-to-SConstruct.diff
new file mode 100644
index 000000000..c621d00cb
--- /dev/null
+++ b/community-testing/mongodb/add-js185-support-to-SConstruct.diff
@@ -0,0 +1,12 @@
+--- SConstruct.original 2011-07-05 14:23:46.334748007 +0000
++++ SConstruct 2011-07-05 14:26:15.729533840 +0000
+@@ -208,6 +208,9 @@
+ justClientLib = (COMMAND_LINE_TARGETS == ['mongoclient'])
+
+ env = Environment( MSVS_ARCH=msarch , tools = ["default", "gch"], toolpath = '.' )
++
++env.ParseConfig('pkg-config --cflags --libs mozjs185')
++
+ if has_option( "cxx" ):
+ env["CC"] = get_option( "cxx" )
+ env["CXX"] = get_option( "cxx" )
diff --git a/community-testing/mongodb/mongodb-1.8.0-spidermonkey-1.8.5-support.patch b/community-testing/mongodb/mongodb-1.8.0-spidermonkey-1.8.5-support.patch
new file mode 100644
index 000000000..46160450f
--- /dev/null
+++ b/community-testing/mongodb/mongodb-1.8.0-spidermonkey-1.8.5-support.patch
@@ -0,0 +1,1502 @@
+--- mongodb-src-r1.8.0/SConstruct.mozjs185~ 2011-03-16 16:33:30.000000000 +0100
++++ mongodb-src-r1.8.0/SConstruct 2011-04-01 22:16:43.411100876 +0200
+@@ -671,7 +671,6 @@ if nix:
+ env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch" )
+ # env.Append( " -Wconversion" ) TODO: this doesn't really work yet
+ if linux:
+- env.Append( CPPFLAGS=" -Werror " )
+ env.Append( CPPFLAGS=" -fno-builtin-memcmp " ) # glibc's memcmp is faster than gcc's
+ env.Append( CXXFLAGS=" -Wnon-virtual-dtor " )
+ env.Append( LINKFLAGS=" -fPIC -pthread -rdynamic" )
+@@ -893,11 +892,11 @@ def doConfigure( myenv , needPcre=True ,
+ if usesm:
+
+ # see http://www.mongodb.org/pages/viewpageattachments.action?pageId=12157032
+- J = [ "mozjs" , "js", "js_static" ]
++ J = [ "mozjs185" , "js", "js_static" ]
+ if windows:
+ if msarch == "amd64":
+ if release:
+- J = [ "js64r", "js", "mozjs" , "js_static" ]
++ J = [ "js64r", "js", "mozjs185" , "js_static" ]
+ else:
+ J = "js64d"
+ print( "looking for js64d.lib for spidermonkey. (available at mongodb.org prebuilt)" );
+@@ -905,14 +904,12 @@ def doConfigure( myenv , needPcre=True ,
+ if not force32:
+ print( "Assuming a 32 bit build is desired" )
+ if release:
+- J = [ "js32r", "js", "mozjs" , "js_static" ]
++ J = [ "js32r", "js", "mozjs185" , "js_static" ]
+ else:
+- J = [ "js32d", "js", "mozjs" , "js_static" ]
++ J = [ "js32d", "js", "mozjs185" , "js_static" ]
+
+ myCheckLib( J , True )
+ mozHeader = "js"
+- if bigLibString(myenv).find( "mozjs" ) >= 0:
+- mozHeader = "mozjs"
+
+ if not conf.CheckHeader( mozHeader + "/jsapi.h" ):
+ if conf.CheckHeader( "jsapi.h" ):
+@@ -921,6 +918,13 @@ def doConfigure( myenv , needPcre=True ,
+ print( "no spider monkey headers!" )
+ Exit(1)
+
++ if conf.CheckFunc( 'JS_NewCompartmentAndGlobalObject' ):
++ myenv.Append( CPPDEFINES=[ "HAVE_COMPARTMENTS" ] )
++ if conf.CheckFunc( 'JS_GetStringCharsAndLength' ):
++ myenv.Append( CPPDEFINES=[ "HAVE_JS_GET_STRING_CHARS_AND_LENGTH" ] )
++ if conf.CheckFunc( 'JS_NewRegExpObjectNoStatics' ):
++ myenv.Append( CPPDEFINES=[ "JS_NEW_REG_EXP_OBJECT_NO_STATISTICS" ] )
++
+ if usev8:
+ if debugBuild:
+ myCheckLib( [ "v8_g" , "v8" ] , True )
+--- mongodb-src-r1.8.0/scripting/engine_spidermonkey.cpp.mozjs185~ 2011-03-16 16:33:30.000000000 +0100
++++ mongodb-src-r1.8.0/scripting/engine_spidermonkey.cpp 2011-04-01 22:42:19.780233492 +0200
+@@ -192,8 +192,13 @@ namespace mongo {
+ }
+
+ string toString( JSString * so ) {
++#ifdef HAVE_JS_GET_STRING_CHARS_AND_LENGTH
++ size_t srclen;
++ const jschar * s = JS_GetStringCharsAndLength( _context , so , &srclen );
++#else
+ jschar * s = JS_GetStringChars( so );
+ size_t srclen = JS_GetStringLength( so );
++#endif
+ if( srclen == 0 )
+ return "";
+
+@@ -360,7 +365,7 @@ namespace mongo {
+
+ case JSTYPE_OBJECT: {
+ JSObject * o = JSVAL_TO_OBJECT( val );
+- if ( ! o || o == JSVAL_NULL ) {
++ if ( ! o || o == (JSObject *)JSVAL_NULL ){
+ b.appendNull( name );
+ }
+ else if ( ! appendSpecialDBObject( this , b , name , val , o ) ) {
+@@ -419,16 +424,15 @@ namespace mongo {
+ return true;
+ }
+
+- void addRoot( JSFunction * f , const char * name );
++ void addRoot( JSFunction * f );
+
+ JSFunction * compileFunction( const char * code, JSObject * assoc = 0 ) {
+- const char * gcName = "unknown";
+- JSFunction * f = _compileFunction( code , assoc , gcName );
+- //addRoot( f , gcName );
++ JSFunction * f = _compileFunction( code , assoc );
++ //addRoot( f );
+ return f;
+ }
+
+- JSFunction * _compileFunction( const char * raw , JSObject * assoc , const char *& gcName ) {
++ JSFunction * _compileFunction( const char * raw , JSObject * assoc ) {
+ if ( ! assoc )
+ assoc = JS_GetGlobalObject( _context );
+
+@@ -447,7 +451,6 @@ namespace mongo {
+ if ( isSimpleStatement( s ) ) {
+ s = "return " + s;
+ }
+- gcName = "cf anon";
+ fname << "anon";
+ return JS_CompileFunction( _context , assoc , fname.str().c_str() , 0 , 0 , s.c_str() , s.size() , "nofile_a" , 0 );
+ }
+@@ -488,7 +491,6 @@ namespace mongo {
+ log() << "compile failed for: " << raw << endl;
+ return 0;
+ }
+- gcName = "cf normal";
+ return func;
+ }
+
+@@ -630,7 +632,11 @@ namespace mongo {
+ flags++;
+ }
+
++#ifdef JS_NEW_REG_EXP_OBJECT_NO_STATISTICS
++ JSObject * r = JS_NewRegExpObjectNoStatics( _context , (char*)e.regex() , strlen( e.regex() ) , flagNumber);
++#else
+ JSObject * r = JS_NewRegExpObject( _context , (char*)e.regex() , strlen( e.regex() ) , flagNumber );
++#endif
+ assert( r );
+ return OBJECT_TO_JSVAL( r );
+ }
+@@ -791,7 +797,7 @@ namespace mongo {
+
+ BSONFieldIterator * it = (BSONFieldIterator*)JSVAL_TO_PRIVATE( *statep );
+ if ( ! it ) {
+- *statep = 0;
++ *statep = JSVAL_NULL;
+ return JS_TRUE;
+ }
+
+@@ -803,7 +809,7 @@ namespace mongo {
+ }
+ else {
+ delete it;
+- *statep = 0;
++ *statep = JSVAL_NULL;
+ }
+ return JS_TRUE;
+ }
+@@ -818,7 +824,7 @@ namespace mongo {
+ return JS_FALSE;
+ }
+
+- JSBool noaccess( JSContext *cx, JSObject *obj, jsval idval, jsval *vp) {
++ JSBool noaccess( JSContext *cx, JSObject *obj, jsid id, jsval *vp){
+ BSONHolder * holder = GETHOLDER( cx , obj );
+ if ( ! holder ) {
+ // in init code still
+@@ -830,24 +836,37 @@ namespace mongo {
+ return JS_FALSE;
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
++ JSBool strict_noaccess( JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp){
++ return noaccess( cx , obj , id , vp );
++ }
++
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp, JSResolveOp)
+ JSClass bson_ro_class = {
+ "bson_ro_object" , JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE ,
+- noaccess, noaccess, JS_PropertyStub, noaccess,
+- (JSEnumerateOp)bson_enumerate, (JSResolveOp)(&resolveBSONField) , JS_ConvertStub, bson_finalize ,
++ noaccess, noaccess, JS_PropertyStub, strict_noaccess,
++ (JSEnumerateOp)bson_enumerate, (JSResolveOp)resolveBSONField , JS_ConvertStub, bson_finalize ,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool bson_cons( JSContext* cx, uintN argc, jsval* vp ){
++#else
+ JSBool bson_cons( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ cerr << "bson_cons : shouldn't be here!" << endl;
+ JS_ReportError( cx , "can't construct bson object" );
+ return JS_FALSE;
+ }
+
+ JSFunctionSpec bson_functions[] = {
+- { 0 }
++ JS_FS_END
+ };
+
+- JSBool bson_add_prop( JSContext *cx, JSObject *obj, jsval idval, jsval *vp) {
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSPropertyOp)
++ JSBool bson_add_prop( JSContext *cx, JSObject *obj, jsid id, jsval *vp){
++ jsval idval;
++ JS_IdToValue( cx , id , &idval );
+ BSONHolder * holder = GETHOLDER( cx , obj );
+ if ( ! holder ) {
+ // static init
+@@ -864,8 +883,10 @@ namespace mongo {
+ return JS_TRUE;
+ }
+
+-
+- JSBool mark_modified( JSContext *cx, JSObject *obj, jsval idval, jsval *vp) {
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSPropertyOp)
++ JSBool mark_modified( JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp){
++ jsval idval;
++ JS_IdToValue( cx , id , &idval );
+ Convertor c(cx);
+ BSONHolder * holder = GETHOLDER( cx , obj );
+ if ( !holder ) // needed when we're messing with DBRef.prototype
+@@ -877,7 +898,10 @@ namespace mongo {
+ return JS_TRUE;
+ }
+
+- JSBool mark_modified_remove( JSContext *cx, JSObject *obj, jsval idval, jsval *vp) {
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSPropertyOp)
++ JSBool mark_modified_remove( JSContext *cx, JSObject *obj, jsid id, jsval *vp){
++ jsval idval;
++ JS_IdToValue( cx , id , &idval );
+ Convertor c(cx);
+ BSONHolder * holder = GETHOLDER( cx , obj );
+ if ( holder->_inResolve )
+@@ -887,23 +911,26 @@ namespace mongo {
+ return JS_TRUE;
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp, JSResolveOp)
+ JSClass bson_class = {
+ "bson_object" , JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE ,
+ bson_add_prop, mark_modified_remove, JS_PropertyStub, mark_modified,
+- (JSEnumerateOp)bson_enumerate, (JSResolveOp)(&resolveBSONField) , JS_ConvertStub, bson_finalize ,
++ (JSEnumerateOp)bson_enumerate, (JSResolveOp)resolveBSONField , JS_ConvertStub, bson_finalize ,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ static JSClass global_class = {
+ "global", JSCLASS_GLOBAL_FLAGS,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+ // --- global helpers ---
+
+- JSBool native_print( JSContext * cx , JSObject * obj , uintN argc, jsval *argv, jsval *rval ) {
++ JSBool native_print( JSContext * cx , uintN argc , jsval *vp ){
++ jsval *argv = JS_ARGV( cx , vp);
+ stringstream ss;
+ Convertor c( cx );
+ for ( uintN i=0; i<argc; i++ ) {
+@@ -913,10 +940,13 @@ namespace mongo {
+ }
+ ss << "\n";
+ Logstream::logLockless( ss.str() );
++ JS_SET_RVAL( cx , vp , JSVAL_VOID );
+ return JS_TRUE;
+ }
+
+- JSBool native_helper( JSContext *cx , JSObject *obj , uintN argc, jsval *argv , jsval *rval ) {
++ JSBool native_helper( JSContext *cx , uintN argc, jsval *vp){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+
+ NativeFunction func = (NativeFunction)((long long)c.getNumber( obj , "x" ) );
+@@ -942,35 +972,37 @@ namespace mongo {
+ }
+
+ if ( out.isEmpty() ) {
+- *rval = JSVAL_VOID;
++ JS_SET_RVAL( cx , vp , JSVAL_VOID );
+ }
+ else {
+- *rval = c.toval( out.firstElement() );
++ JS_SET_RVAL( cx , vp , c.toval( out.firstElement() ) );
+ }
+
+ return JS_TRUE;
+ }
+
+- JSBool native_load( JSContext *cx , JSObject *obj , uintN argc, jsval *argv , jsval *rval );
++ JSBool native_load( JSContext *cx , uintN argc, jsval *vp );
+
+- JSBool native_gc( JSContext *cx , JSObject *obj , uintN argc, jsval *argv , jsval *rval ) {
++ JSBool native_gc( JSContext *cx , uintN argc, jsval *vp ){
+ JS_GC( cx );
++ JS_SET_RVAL( cx , vp , JSVAL_VOID );
+ return JS_TRUE;
+ }
+
+ JSFunctionSpec globalHelpers[] = {
+- { "print" , &native_print , 0 , 0 , 0 } ,
+- { "nativeHelper" , &native_helper , 1 , 0 , 0 } ,
+- { "load" , &native_load , 1 , 0 , 0 } ,
+- { "gc" , &native_gc , 1 , 0 , 0 } ,
+- { 0 , 0 , 0 , 0 , 0 }
++ JS_FS( "print" , &native_print , 0 , JSFUN_FAST_NATIVE ) ,
++ JS_FS( "nativeHelper" , &native_helper , 1 , JSFUN_FAST_NATIVE ) ,
++ JS_FS( "load" , &native_load , 1 , JSFUN_FAST_NATIVE ) ,
++ JS_FS( "gc" , &native_gc , 1 , JSFUN_FAST_NATIVE ) ,
++ JS_FS_END
+ };
+
+ // ----END global helpers ----
+
+ // Object helpers
+
+- JSBool bson_get_size(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool bson_get_size(JSContext *cx, uintN argc, jsval *vp){
++ jsval *argv = JS_ARGV( cx , vp );
+ if ( argc != 1 || !JSVAL_IS_OBJECT( argv[ 0 ] ) ) {
+ JS_ReportError( cx , "bsonsize requires one valid object" );
+ return JS_FALSE;
+@@ -979,7 +1011,7 @@ namespace mongo {
+ Convertor c(cx);
+
+ if ( argv[0] == JSVAL_VOID || argv[0] == JSVAL_NULL ) {
+- *rval = c.toval( 0.0 );
++ JS_SET_RVAL( cx , vp , c.toval( 0.0 ) );
+ return JS_TRUE;
+ }
+
+@@ -999,18 +1031,21 @@ namespace mongo {
+ size = temp.objsize();
+ }
+
+- *rval = c.toval( size );
++ JS_SET_RVAL( cx , vp , c.toval( size ) );
+ return JS_TRUE;
+ }
+
+ JSFunctionSpec objectHelpers[] = {
+- { "bsonsize" , &bson_get_size , 1 , 0 , 0 } ,
+- { 0 , 0 , 0 , 0 , 0 }
++ JS_FS( "bsonsize" , &bson_get_size , 1 , JSFUN_FAST_NATIVE ) ,
++ JS_FS_END
+ };
+
+ // end Object helpers
+
+- JSBool resolveBSONField( JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp ) {
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSResolveOp)
++ JSBool resolveBSONField( JSContext *cx, JSObject *obj, jsid id, uintN flags, JSObject **objp ){
++ jsval idval;
++ JS_IdToValue( cx , id , &idval );
+ assert( JS_EnterLocalRootScope( cx ) );
+ Convertor c( cx );
+
+@@ -1023,7 +1058,7 @@ namespace mongo {
+ }
+ holder->check();
+
+- string s = c.toString( id );
++ string s = c.toString( idval );
+
+ BSONElement e = holder->_obj[ s.c_str() ];
+
+@@ -1139,9 +1174,15 @@ namespace mongo {
+ //JS_SetVersion( _context , JSVERSION_LATEST); TODO
+ JS_SetErrorReporter( _context , errorReporter );
+
++#ifdef HAVE_COMPARTMENTS
++ _global = JS_NewCompartmentAndGlobalObject( _context , &global_class , NULL);
++ massert( 13442 , "JS_NewCompartmentAndGlobalObject failed for global" , _global );
++ _call = JS_EnterCrossCompartmentCall( _context , _global);
++#else
+ _global = JS_NewObject( _context , &global_class, NULL, NULL);
+ massert( 10432 , "JS_NewObject failed for global" , _global );
+ JS_SetGlobalObject( _context , _global );
++#endif
+ massert( 10433 , "js init failed" , JS_InitStandardClasses( _context , _global ) );
+
+ JS_SetOptions( _context , JS_GetOptions( _context ) | JSOPTION_VAROBJFIX );
+@@ -1159,13 +1200,14 @@ namespace mongo {
+ smlock;
+ uassert( 10223 , "deleted SMScope twice?" , _convertor );
+
+- for ( list<void*>::iterator i=_roots.begin(); i != _roots.end(); i++ ) {
+- JS_RemoveRoot( _context , *i );
++ for ( list<JSObject*>::iterator i=_roots.begin(); i != _roots.end(); i++ ){
++ JSObject * obj = (JSObject *)*i;
++ JS_RemoveObjectRoot( _context , &obj );
+ }
+ _roots.clear();
+
+ if ( _this ) {
+- JS_RemoveRoot( _context , &_this );
++ JS_RemoveObjectRoot( _context , &_this );
+ _this = 0;
+ }
+
+@@ -1174,6 +1216,13 @@ namespace mongo {
+ _convertor = 0;
+ }
+
++#ifdef HAVE_COMPARTMENTS
++ if ( _call ) {
++ JS_LeaveCrossCompartmentCall( _call );
++ _call = 0;
++ }
++#endif
++
+ if ( _context ) {
+ // This is expected to reclaim _global as well.
+ JS_DestroyContext( _context );
+@@ -1187,16 +1236,16 @@ namespace mongo {
+ assert( _convertor );
+ return;
+ if ( _this ) {
+- JS_RemoveRoot( _context , &_this );
++ JS_RemoveObjectRoot( _context , &_this );
+ _this = 0;
+ }
+ currentScope.reset( this );
+ _error = "";
+ }
+
+- void addRoot( void * root , const char * name ) {
+- JS_AddNamedRoot( _context , root , name );
+- _roots.push_back( root );
++ void addRoot( JSObject * obj ){
++ JS_AddObjectRoot( _context , &obj );
++ _roots.push_back( obj );
+ }
+
+ void init( const BSONObj * data ) {
+@@ -1336,13 +1385,13 @@ namespace mongo {
+ void setThis( const BSONObj * obj ) {
+ smlock;
+ if ( _this ) {
+- JS_RemoveRoot( _context , &_this );
++ JS_RemoveObjectRoot( _context , &_this );
+ _this = 0;
+ }
+
+ if ( obj ) {
+ _this = _convertor->toJSObject( obj );
+- JS_AddNamedRoot( _context , &_this , "scope this" );
++ JS_AddObjectRoot( _context , &_this );
+ }
+ }
+
+@@ -1402,7 +1451,7 @@ namespace mongo {
+ spec->start = boost::posix_time::microsec_clock::local_time();
+ spec->count = 0;
+ JS_SetContextPrivate( _context, (void*)spec );
+-#if defined(SM181) && !defined(XULRUNNER190)
++#if JS_VERSION >= 181 && !defined(XULRUNNER190)
+ JS_SetOperationCallback( _context, _interrupt );
+ #else
+ JS_SetBranchCallback( _context, interrupt );
+@@ -1412,7 +1461,7 @@ namespace mongo {
+
+ void uninstallInterrupt( int timeoutMs ) {
+ if ( timeoutMs != 0 || ScriptEngine::haveCheckInterruptCallback() ) {
+-#if defined(SM181) && !defined(XULRUNNER190)
++#if JS_VERSION >= 181 && !defined(XULRUNNER190)
+ JS_SetOperationCallback( _context , 0 );
+ #else
+ JS_SetBranchCallback( _context, 0 );
+@@ -1548,9 +1597,12 @@ namespace mongo {
+
+ JSObject * _global;
+ JSObject * _this;
++#ifdef HAVE_COMPARTMENTS
++ JSCrossCompartmentCall * _call;
++#endif
+
+ string _error;
+- list<void*> _roots;
++ list<JSObject*> _roots;
+
+ bool _externalSetup;
+ bool _localConnect;
+@@ -1579,7 +1631,8 @@ namespace mongo {
+ }
+ }
+
+- JSBool native_load( JSContext *cx , JSObject *obj , uintN argc, jsval *argv , jsval *rval ) {
++ JSBool native_load( JSContext *cx , uintN argc, jsval *vp ){
++ jsval *argv = JS_ARGV( cx , vp );
+ Convertor c(cx);
+
+ Scope * s = currentScope.get();
+@@ -1594,6 +1647,7 @@ namespace mongo {
+ }
+ }
+
++ JS_SET_RVAL( cx , vp , JSVAL_VOID );
+ return JS_TRUE;
+ }
+
+@@ -1633,7 +1687,7 @@ namespace mongo {
+ return new SMScope();
+ }
+
+- void Convertor::addRoot( JSFunction * f , const char * name ) {
++ void Convertor::addRoot( JSFunction * f ){
+ if ( ! f )
+ return;
+
+@@ -1642,7 +1696,7 @@ namespace mongo {
+
+ JSObject * o = JS_GetFunctionObject( f );
+ assert( o );
+- scope->addRoot( &o , name );
++ scope->addRoot( o );
+ }
+
+ }
+--- mongodb-src-r1.8.0/scripting/engine_spidermonkey.h.mozjs185~ 2011-03-16 16:33:30.000000000 +0100
++++ mongodb-src-r1.8.0/scripting/engine_spidermonkey.h 2011-04-01 21:29:15.697678508 +0200
+@@ -21,6 +21,9 @@
+
+ // START inc hacking
+
++#undef malloc
++#undef realloc
++
+ #if defined( MOZJS )
+
+ #define MOZILLA_1_8_BRANCH
+@@ -55,6 +58,9 @@
+
+ #endif
+
++#define malloc MONGO_malloc
++#define realloc MONGO_realloc
++
+ // END inc hacking
+
+ // -- SM 1.6 hacks ---
+@@ -81,6 +87,10 @@ JSBool JS_CStringsAreUTF8() {
+ #define SM181
+ #endif
+
++#ifndef JSFUN_FAST_NATIVE
++#define JSFUN_FAST_NATIVE 0
++#endif
++
+ namespace mongo {
+
+ class SMScope;
+@@ -104,7 +114,7 @@ namespace mongo {
+ extern boost::thread_specific_ptr<SMScope> currentScope;
+
+ // bson
+- JSBool resolveBSONField( JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp );
++ JSBool resolveBSONField( JSContext *cx, JSObject *obj, jsid id, uintN flags, JSObject **objp );
+
+
+ // mongo
+--- mongodb-src-r1.8.0/scripting/sm_db.cpp.mozjs185~ 2011-03-16 16:33:30.000000000 +0100
++++ mongodb-src-r1.8.0/scripting/sm_db.cpp 2011-04-01 22:51:59.701652521 +0200
+@@ -79,13 +79,25 @@ namespace mongo {
+ return holder->get();
+ }
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool internal_cursor_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool internal_cursor_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ uassert( 10236 , "no args to internal_cursor_constructor" , argc == 0 );
+ assert( JS_SetPrivate( cx , obj , 0 ) ); // just for safety
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+
+- void internal_cursor_finalize( JSContext * cx , JSObject * obj ) {
++ void internal_cursor_finalize( JSContext * cx, JSObject * obj ){
+ CursorHolder * holder = (CursorHolder*)JS_GetPrivate( cx , obj );
+ if ( holder ) {
+ delete holder;
+@@ -93,10 +105,11 @@ namespace mongo {
+ }
+ }
+
+- JSBool internal_cursor_hasNext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool internal_cursor_hasNext(JSContext *cx , uintN argc , jsval *vp) {
++ JSObject* obj = JS_THIS_OBJECT( cx , vp );
+ DBClientCursor *cursor = getCursor( cx, obj );
+ try {
+- *rval = cursor->more() ? JSVAL_TRUE : JSVAL_FALSE;
++ JS_SET_RVAL( cx , vp , cursor->more() ? JSVAL_TRUE : JSVAL_FALSE );
+ }
+ catch ( std::exception& e ) {
+ JS_ReportError( cx , e.what() );
+@@ -105,14 +118,16 @@ namespace mongo {
+ return JS_TRUE;
+ }
+
+- JSBool internal_cursor_objsLeftInBatch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool internal_cursor_objsLeftInBatch(JSContext *cx, uintN argc, jsval *vp) {
++ JSObject* obj = JS_THIS_OBJECT( cx , vp );
+ DBClientCursor *cursor = getCursor( cx, obj );
+ Convertor c(cx);
+- *rval = c.toval((double) cursor->objsLeftInBatch() );
++ JS_SET_RVAL( cx , vp , c.toval((double) cursor->objsLeftInBatch()) );
+ return JS_TRUE;
+ }
+
+- JSBool internal_cursor_next(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool internal_cursor_next(JSContext *cx, uintN argc, jsval *vp) {
++ JSObject* obj = JS_THIS_OBJECT( cx , vp );
+ DBClientCursor *cursor = getCursor( cx, obj );
+
+ BSONObj n;
+@@ -131,20 +146,21 @@ namespace mongo {
+ }
+
+ Convertor c(cx);
+- *rval = c.toval( &n );
++ JS_SET_RVAL( cx , vp , c.toval( &n ) );
+ return JS_TRUE;
+ }
+
+ JSFunctionSpec internal_cursor_functions[] = {
+- { "hasNext" , internal_cursor_hasNext , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "objsLeftInBatch" , internal_cursor_objsLeftInBatch , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "next" , internal_cursor_next , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { 0 }
++ JS_FS( "hasNext" , internal_cursor_hasNext , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "objsLeftInBatch" , internal_cursor_objsLeftInBatch , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "next" , internal_cursor_next , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS_END
+ };
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass internal_cursor_class = {
+ "InternalCursor" , JSCLASS_HAS_PRIVATE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, internal_cursor_finalize,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+@@ -157,7 +173,16 @@ namespace mongo {
+ throw -1;
+ }
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool mongo_local_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool mongo_local_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ Convertor c( cx );
+
+ shared_ptr< DBClientWithCommands > client( createDirectClient() );
+@@ -166,10 +191,23 @@ namespace mongo {
+ jsval host = c.toval( "EMBEDDED" );
+ assert( JS_SetProperty( cx , obj , "host" , &host ) );
+
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool mongo_external_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool mongo_external_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ Convertor c( cx );
+
+ smuassert( cx , "0 or 1 args to Mongo" , argc <= 1 );
+@@ -197,6 +235,9 @@ namespace mongo {
+ assert( JS_SetPrivate( cx , obj , (void*)( new shared_ptr< DBClientWithCommands >( conn ) ) ) );
+ jsval host_val = c.toval( host.c_str() );
+ assert( JS_SetProperty( cx , obj , "host" , &host_val ) );
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+
+ }
+@@ -215,14 +256,18 @@ namespace mongo {
+ }
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass mongo_class = {
+ "Mongo" , JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, mongo_finalize,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+- JSBool mongo_find(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool mongo_find(JSContext *cx, uintN argc, jsval *vp) {
++ JSObject* obj = JS_THIS_OBJECT( cx , vp );
++ jsval* argv = JS_ARGV( cx , vp );
++
+ smuassert( cx , "mongo_find needs 7 args" , argc == 7 );
+ shared_ptr< DBClientWithCommands > * connHolder = (shared_ptr< DBClientWithCommands >*)JS_GetPrivate( cx , obj );
+ smuassert( cx , "no connection!" , connHolder && connHolder->get() );
+@@ -252,7 +297,8 @@ namespace mongo {
+ JSObject * mycursor = JS_NewObject( cx , &internal_cursor_class , 0 , 0 );
+ CHECKNEWOBJECT( mycursor, cx, "internal_cursor_class" );
+ assert( JS_SetPrivate( cx , mycursor , new CursorHolder( cursor, *connHolder ) ) );
+- *rval = OBJECT_TO_JSVAL( mycursor );
++
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( mycursor ));
+ return JS_TRUE;
+ }
+ catch ( ... ) {
+@@ -261,7 +307,10 @@ namespace mongo {
+ }
+ }
+
+- JSBool mongo_update(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool mongo_update(JSContext *cx, uintN argc, jsval *vp) {
++ JSObject* obj = JS_THIS_OBJECT( cx , vp );
++ jsval* argv = JS_ARGV( cx , vp );
++
+ smuassert( cx , "mongo_find needs at elast 3 args" , argc >= 3 );
+ smuassert( cx , "2nd param to update has to be an object" , JSVAL_IS_OBJECT( argv[1] ) );
+ smuassert( cx , "3rd param to update has to be an object" , JSVAL_IS_OBJECT( argv[2] ) );
+@@ -282,6 +331,7 @@ namespace mongo {
+
+ try {
+ conn->update( ns , c.toObject( argv[1] ) , c.toObject( argv[2] ) , upsert , multi );
++ JS_SET_RVAL( cx , vp , JSVAL_VOID );
+ return JS_TRUE;
+ }
+ catch ( ... ) {
+@@ -290,7 +340,10 @@ namespace mongo {
+ }
+ }
+
+- JSBool mongo_insert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool mongo_insert(JSContext *cx, uintN argc, jsval *vp) {
++ JSObject* obj = JS_THIS_OBJECT( cx , vp );
++ jsval* argv = JS_ARGV( cx , vp );
++
+ smuassert( cx , "mongo_insert needs 2 args" , argc == 2 );
+ smuassert( cx , "2nd param to insert has to be an object" , JSVAL_IS_OBJECT( argv[1] ) );
+
+@@ -310,6 +363,7 @@ namespace mongo {
+ // TODO: add _id
+
+ conn->insert( ns , o );
++ JS_SET_RVAL( cx, vp, JSVAL_VOID );
+ return JS_TRUE;
+ }
+ catch ( std::exception& e ) {
+@@ -325,7 +379,10 @@ namespace mongo {
+ }
+ }
+
+- JSBool mongo_remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool mongo_remove(JSContext *cx, uintN argc, jsval *vp) {
++ JSObject* obj = JS_THIS_OBJECT( cx , vp );
++ jsval* argv = JS_ARGV( cx , vp );
++
+ smuassert( cx , "mongo_remove needs 2 or 3 arguments" , argc == 2 || argc == 3 );
+ smuassert( cx , "2nd param to insert has to be an object" , JSVAL_IS_OBJECT( argv[1] ) );
+
+@@ -346,6 +403,7 @@ namespace mongo {
+
+ try {
+ conn->remove( ns , o , justOne );
++ JS_SET_RVAL( cx , vp , JSVAL_VOID );
+ return JS_TRUE;
+ }
+ catch ( std::exception& e ) {
+@@ -361,16 +419,26 @@ namespace mongo {
+ }
+
+ JSFunctionSpec mongo_functions[] = {
+- { "find" , mongo_find , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "update" , mongo_update , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "insert" , mongo_insert , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "remove" , mongo_remove , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { 0 }
++ JS_FS( "find" , mongo_find , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "update" , mongo_update , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "insert" , mongo_insert , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "remove" , mongo_remove , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS_END
+ };
+
+ // ------------- db_collection -------------
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool db_collection_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool db_collection_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ smuassert( cx , "db_collection_constructor wrong args" , argc == 4 );
+ assert( JS_SetProperty( cx , obj , "_mongo" , &(argv[0]) ) );
+ assert( JS_SetProperty( cx , obj , "_db" , &(argv[1]) ) );
+@@ -382,16 +450,22 @@ namespace mongo {
+ JS_ReportError( cx , "can't use sharded collection from db.eval" );
+ return JS_FALSE;
+ }
+-
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+
+- JSBool db_collection_resolve( JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp ) {
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSResolveOp)
++ JSBool db_collection_resolve( JSContext *cx, JSObject *obj, jsid id, uintN flags, JSObject **objp ){
++ jsval idval;
++ JS_IdToValue( cx , id , &idval );
++
+ if ( flags & JSRESOLVE_ASSIGNING )
+ return JS_TRUE;
+
+ Convertor c( cx );
+- string collname = c.toString( id );
++ string collname = c.toString( idval );
+
+ if ( isSpecialName( collname ) )
+ return JS_TRUE;
+@@ -419,10 +493,11 @@ namespace mongo {
+ return JS_TRUE;
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp, JSResolveOp)
+ JSClass db_collection_class = {
+ "DBCollection" , JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
+- JS_EnumerateStub, (JSResolveOp)(&db_collection_resolve) , JS_ConvertStub, JS_FinalizeStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
++ JS_EnumerateStub, (JSResolveOp)db_collection_resolve , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+@@ -454,15 +529,32 @@ namespace mongo {
+ // -------------- DB ---------------
+
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool db_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool db_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ smuassert( cx, "wrong number of arguments to DB" , argc == 2 );
+ assert( JS_SetProperty( cx , obj , "_mongo" , &(argv[0]) ) );
+ assert( JS_SetProperty( cx , obj , "_name" , &(argv[1]) ) );
+
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
++
+ return JS_TRUE;
+ }
+
+- JSBool db_resolve( JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp ) {
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSResolveOp)
++ JSBool db_resolve( JSContext *cx, JSObject *obj, jsid id, uintN flags, JSObject **objp ){
++ jsval idval;
++ JS_IdToValue( cx , id , &idval );
+ if ( flags & JSRESOLVE_ASSIGNING )
+ return JS_TRUE;
+
+@@ -471,7 +563,7 @@ namespace mongo {
+ if ( obj == c.getGlobalPrototype( "DB" ) )
+ return JS_TRUE;
+
+- string collname = c.toString( id );
++ string collname = c.toString( idval );
+
+ if ( isSpecialName( collname ) )
+ return JS_TRUE;
+@@ -489,17 +581,28 @@ namespace mongo {
+ return JS_TRUE;
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp, JSResolveOp)
+ JSClass db_class = {
+ "DB" , JSCLASS_HAS_PRIVATE | JSCLASS_NEW_RESOLVE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
+- JS_EnumerateStub, (JSResolveOp)(&db_resolve) , JS_ConvertStub, JS_FinalizeStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
++ JS_EnumerateStub, (JSResolveOp)db_resolve , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+
+ // -------------- object id -------------
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool object_id_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool object_id_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ Convertor c( cx );
+
+ OID oid;
+@@ -524,35 +627,48 @@ namespace mongo {
+ if ( ! JS_InstanceOf( cx , obj , &object_id_class , 0 ) ) {
+ obj = JS_NewObject( cx , &object_id_class , 0 , 0 );
+ CHECKNEWOBJECT( obj, cx, "object_id_constructor" );
+- *rval = OBJECT_TO_JSVAL( obj );
+ }
+
+ jsval v = c.toval( oid.str().c_str() );
+ assert( JS_SetProperty( cx , obj , "str" , &v ) );
+
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
+ return JS_TRUE;
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass object_id_class = {
+ "ObjectId" , JSCLASS_HAS_PRIVATE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+- JSBool object_id_tostring(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool object_id_tostring(JSContext *cx, uintN argc, jsval *vp){
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+- return (JSBool) (*rval = c.getProperty( obj , "str" ));
++ JS_SET_RVAL( cx , vp , c.getProperty( obj , "str" ));
++ return JS_TRUE;
+ }
+
+ JSFunctionSpec object_id_functions[] = {
+- { "toString" , object_id_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { 0 }
++ JS_FS( "toString" , object_id_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS_END
+ };
+
+ // dbpointer
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool dbpointer_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool dbpointer_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ Convertor c( cx );
+
+ if ( argc == 2 ) {
+@@ -564,6 +680,9 @@ namespace mongo {
+
+ assert( JS_SetProperty( cx , obj , "ns" , &(argv[0]) ) );
+ assert( JS_SetProperty( cx , obj , "id" , &(argv[1]) ) );
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+ else {
+@@ -572,19 +691,30 @@ namespace mongo {
+ }
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass dbpointer_class = {
+ "DBPointer" , JSCLASS_HAS_PRIVATE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+ JSFunctionSpec dbpointer_functions[] = {
+- { 0 }
++ JS_FS_END
+ };
+
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool dbref_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool dbref_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ Convertor c( cx );
+
+ if ( argc == 2 ) {
+@@ -594,6 +724,9 @@ namespace mongo {
+ assert( JS_SetProperty( cx, o , "$id" , &argv[ 1 ] ) );
+ BSONObj bo = c.toObject( o );
+ assert( JS_SetPrivate( cx , obj , (void*)(new BSONHolder( bo.getOwned() ) ) ) );
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+ else {
+@@ -607,7 +740,17 @@ namespace mongo {
+
+ // UUID **************************
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool uuid_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool uuid_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ Convertor c( cx );
+
+ if( argc == 0 ) {
+@@ -635,6 +778,9 @@ namespace mongo {
+ c.setProperty( obj, "len", c.toval( (double)16 ) );
+ c.setProperty( obj, "type", c.toval( (double)3 ) );
+
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+ else {
+@@ -643,7 +789,8 @@ namespace mongo {
+ }
+ }
+
+- JSBool uuid_tostring(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool uuid_tostring(JSContext *cx, uintN argc, jsval *vp){
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+ void *holder = JS_GetPrivate( cx, obj );
+ assert( holder );
+@@ -652,7 +799,8 @@ namespace mongo {
+ ss << "UUID(\"" << toHex(data, 16);
+ ss << "\")";
+ string ret = ss.str();
+- return *rval = c.toval( ret.c_str() );
++ JS_SET_RVAL( cx , vp , c.toval( ret.c_str() ) );
++ return JS_TRUE;
+ }
+
+ void uuid_finalize( JSContext * cx , JSObject * obj ) {
+@@ -664,21 +812,32 @@ namespace mongo {
+ }
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass uuid_class = {
+ "UUID" , JSCLASS_HAS_PRIVATE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, uuid_finalize,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+ JSFunctionSpec uuid_functions[] = {
+- { "toString" , uuid_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { 0 }
++ JS_FS( "toString" , uuid_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS_END
+ };
+
+ // BinData **************************
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool bindata_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool bindata_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ Convertor c( cx );
+
+ if ( argc == 2 ) {
+@@ -702,6 +861,9 @@ namespace mongo {
+ c.setProperty( obj, "len", c.toval( (double)decoded.length() ) );
+ c.setProperty( obj, "type", c.toval( (double)type ) );
+
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+ else {
+@@ -710,7 +872,8 @@ namespace mongo {
+ }
+ }
+
+- JSBool bindata_tostring(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool bindata_tostring(JSContext *cx, uintN argc, jsval *vp){
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+ int type = (int)c.getNumber( obj , "type" );
+ int len = (int)c.getNumber( obj, "len" );
+@@ -722,10 +885,12 @@ namespace mongo {
+ base64::encode( ss, (const char *)data, len );
+ ss << "\")";
+ string ret = ss.str();
+- return *rval = c.toval( ret.c_str() );
++ JS_SET_RVAL( cx , vp , c.toval( ret.c_str() ) );
++ return JS_TRUE;
+ }
+
+- JSBool bindataBase64(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool bindataBase64(JSContext *cx, uintN argc, jsval *vp){
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+ int len = (int)c.getNumber( obj, "len" );
+ void *holder = JS_GetPrivate( cx, obj );
+@@ -734,10 +899,12 @@ namespace mongo {
+ stringstream ss;
+ base64::encode( ss, (const char *)data, len );
+ string ret = ss.str();
+- return *rval = c.toval( ret.c_str() );
++ JS_SET_RVAL( cx , vp , c.toval( ret.c_str() ) );
++ return JS_TRUE;
+ }
+
+- JSBool bindataAsHex(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool bindataAsHex(JSContext *cx, uintN argc, jsval *vp){
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+ int len = (int)c.getNumber( obj, "len" );
+ void *holder = JS_GetPrivate( cx, obj );
+@@ -750,19 +917,24 @@ namespace mongo {
+ ss << v;
+ }
+ string ret = ss.str();
+- return *rval = c.toval( ret.c_str() );
++ JS_SET_RVAL( cx , vp , c.toval( ret.c_str() ) );
++ return JS_TRUE;
+ }
+
+- JSBool bindataLength(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool bindataLength(JSContext *cx, uintN argc, jsval *vp){
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+ int len = (int)c.getNumber( obj, "len" );
+- return *rval = c.toval((double) len);
++ JS_SET_RVAL( cx , vp , c.toval((double) len) );
++ return JS_TRUE;
+ }
+
+- JSBool bindataSubtype(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool bindataSubtype(JSContext *cx, uintN argc, jsval *vp){
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+ int t = (int)c.getNumber( obj, "type" );
+- return *rval = c.toval((double) t);
++ JS_SET_RVAL( cx , vp , c.toval((double) t) );
++ return JS_TRUE;
+ }
+
+ void bindata_finalize( JSContext * cx , JSObject * obj ) {
+@@ -774,20 +946,21 @@ namespace mongo {
+ }
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass bindata_class = {
+ "BinData" , JSCLASS_HAS_PRIVATE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, bindata_finalize,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+ JSFunctionSpec bindata_functions[] = {
+- { "toString" , bindata_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "hex", bindataAsHex, 0, JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "base64", bindataBase64, 0, JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "length", bindataLength, 0, JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "subtype", bindataSubtype, 0, JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { 0 }
++ JS_FS( "toString" , bindata_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "hex", bindataAsHex, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "base64", bindataBase64, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "length", bindataLength, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "subtype", bindataSubtype, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS_END
+ };
+
+ // Map
+@@ -796,7 +969,16 @@ namespace mongo {
+ return s == "put" || s == "get" || s == "_get" || s == "values" || s == "_data" || s == "constructor" ;
+ }
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool map_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool map_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ if ( argc > 0 ) {
+ JS_ReportError( cx , "Map takes no arguments" );
+ return JS_FALSE;
+@@ -808,10 +990,16 @@ namespace mongo {
+ jsval a = OBJECT_TO_JSVAL( array );
+ JS_SetProperty( cx , obj , "_data" , &a );
+
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+
+- JSBool map_prop( JSContext *cx, JSObject *obj, jsval idval, jsval *vp ) {
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSPropertyOp)
++ JSBool map_prop( JSContext *cx, JSObject *obj, jsid id, jsval *vp ){
++ jsval idval;
++ JS_IdToValue( cx , id , &idval );
+ Convertor c(cx);
+ if ( specialMapString( c.toString( idval ) ) )
+ return JS_TRUE;
+@@ -821,34 +1009,49 @@ namespace mongo {
+ return JS_FALSE;
+ }
+
++ JSBool strict_map_prop( JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp ){
++ return map_prop( cx , obj , id , vp );
++ }
++
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass map_class = {
+ "Map" , JSCLASS_HAS_PRIVATE ,
+- map_prop, JS_PropertyStub, map_prop, map_prop,
++ map_prop, JS_PropertyStub, map_prop, strict_map_prop,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+ JSFunctionSpec map_functions[] = {
+- { 0 }
++ JS_FS_END
+ };
+
+
+ // -----
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass timestamp_class = {
+ "Timestamp" , JSCLASS_HAS_PRIVATE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool timestamp_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool timestamp_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ smuassert( cx , "Timestamp needs 0 or 2 args" , argc == 0 || argc == 2 );
+
+ if ( ! JS_InstanceOf( cx , obj , &timestamp_class , 0 ) ) {
+ obj = JS_NewObject( cx , &timestamp_class , 0 , 0 );
+ CHECKNEWOBJECT( obj, cx, "timestamp_constructor" );
+- *rval = OBJECT_TO_JSVAL( obj );
+ }
+
+ Convertor c( cx );
+@@ -864,21 +1067,30 @@ namespace mongo {
+ return JS_TRUE;
+ }
+
+-
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass numberlong_class = {
+ "NumberLong" , JSCLASS_HAS_PRIVATE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool numberlong_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool numberlong_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ smuassert( cx , "NumberLong needs 0 or 1 args" , argc == 0 || argc == 1 );
+
+ if ( ! JS_InstanceOf( cx , obj , &numberlong_class , 0 ) ) {
+ obj = JS_NewObject( cx , &numberlong_class , 0 , 0 );
+ CHECKNEWOBJECT( obj, cx, "numberlong_constructor" );
+- *rval = OBJECT_TO_JSVAL( obj );
+ }
+
+ Convertor c( cx );
+@@ -903,19 +1115,25 @@ namespace mongo {
+ c.makeLongObj( n, obj );
+ }
+
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+
+- JSBool numberlong_valueof(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool numberlong_valueof(JSContext *cx, uintN argc, jsval *vp){
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+- return *rval = c.toval( double( c.toNumberLongUnsafe( obj ) ) );
++ JS_SET_RVAL( cx , vp , c.toval( double( c.toNumberLongUnsafe( obj ) ) ) );
++ return JS_TRUE;
+ }
+
+- JSBool numberlong_tonumber(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
+- return numberlong_valueof( cx, obj, argc, argv, rval );
++ JSBool numberlong_tonumber(JSContext *cx, uintN argc, jsval *vp){
++ return numberlong_valueof( cx, argc, vp );
+ }
+
+- JSBool numberlong_tostring(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
++ JSBool numberlong_tostring(JSContext *cx, uintN argc, jsval *vp){
++ JSObject *obj = JS_THIS_OBJECT( cx , vp );
+ Convertor c(cx);
+ stringstream ss;
+ long long val = c.toNumberLongUnsafe( obj );
+@@ -927,33 +1145,45 @@ namespace mongo {
+ ss << "NumberLong(" << val << ")";
+
+ string ret = ss.str();
+- return *rval = c.toval( ret.c_str() );
++ JS_SET_RVAL( cx , vp , c.toval( ret.c_str() ) );
++ return JS_TRUE;
+ }
+
+ JSFunctionSpec numberlong_functions[] = {
+- { "valueOf" , numberlong_valueof , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "toNumber" , numberlong_tonumber , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { "toString" , numberlong_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT, 0 } ,
+- { 0 }
++ JS_FS( "valueOf" , numberlong_valueof , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "toNumber" , numberlong_tonumber , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS( "toString" , numberlong_tostring , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSFUN_FAST_NATIVE ) ,
++ JS_FS_END
+ };
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp)
+ JSClass minkey_class = {
+ "MinKey" , JSCLASS_HAS_PRIVATE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+ JSClass maxkey_class = {
+ "MaxKey" , JSCLASS_HAS_PRIVATE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ JS_EnumerateStub, JS_ResolveStub , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+ // dbquery
+
++#ifdef JSFUN_CONSTRUCTOR
++ JSBool dbquery_constructor( JSContext* cx, uintN argc, jsval* vp ){
++ jsval *argv = JS_ARGV( cx , vp );
++ JSObject *obj = JS_NewObjectForConstructor( cx , vp );
++ if( ! obj ) {
++ JS_ReportError( cx , "Failed to create 'this' object" );
++ return JS_FALSE;
++ }
++#else
+ JSBool dbquery_constructor( JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ) {
++#endif
+ smuassert( cx , "DDQuery needs at least 4 args" , argc >= 4 );
+
+ Convertor c(cx);
+@@ -1001,28 +1231,35 @@ namespace mongo {
+ c.setProperty( obj , "_numReturned" , JSVAL_ZERO );
+ c.setProperty( obj , "_special" , JSVAL_FALSE );
+
++#ifdef JSFUN_CONSTRUCTOR
++ JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) );
++#endif
+ return JS_TRUE;
+ }
+
+- JSBool dbquery_resolve( JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp ) {
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSResolveOp)
++ JSBool dbquery_resolve( JSContext *cx, JSObject *obj, jsid id, uintN flags, JSObject **objp ){
++ jsval idval;
++ JS_IdToValue( cx , id , &idval );
+ if ( flags & JSRESOLVE_ASSIGNING )
+ return JS_TRUE;
+
+- if ( ! JSVAL_IS_NUMBER( id ) )
++ if ( ! JSVAL_IS_NUMBER( idval ) )
+ return JS_TRUE;
+
+ jsval val = JSVAL_VOID;
+- assert( JS_CallFunctionName( cx , obj , "arrayAccess" , 1 , &id , &val ) );
++ assert( JS_CallFunctionName( cx , obj , "arrayAccess" , 1 , &idval , &val ) );
+ Convertor c(cx);
+- c.setProperty( obj , c.toString( id ).c_str() , val );
++ c.setProperty( obj , c.toString( idval ).c_str() , val );
+ *objp = obj;
+ return JS_TRUE;
+ }
+
++ // FIXME: This won't build on spidermonkey < 1.8.5 (JSStrictPropertyOp, JSResolveOp)
+ JSClass dbquery_class = {
+ "DBQuery" , JSCLASS_NEW_RESOLVE ,
+- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
+- JS_EnumerateStub, (JSResolveOp)(&dbquery_resolve) , JS_ConvertStub, JS_FinalizeStub,
++ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
++ JS_EnumerateStub, (JSResolveOp)dbquery_resolve , JS_ConvertStub, JS_FinalizeStub,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+ };
+
+@@ -1102,7 +1339,7 @@ namespace mongo {
+ return true;
+ }
+
+-#if defined( SM16 ) || defined( MOZJS )
++#if defined( SM16 ) || JS_VERSION >= 181
+ #warning dates do not work in your version of spider monkey
+ {
+ jsdouble d = js_DateGetMsecSinceEpoch( c->_context , o );
+@@ -1150,7 +1387,7 @@ namespace mongo {
+ }
+
+ bool isDate( JSContext * cx , JSObject * o ) {
+-#if defined( SM16 ) || defined( MOZJS ) || defined( XULRUNNER )
++#if defined( SM16 ) || JS_VERSION >= 181 || defined( XULRUNNER )
+ return js_DateGetMsecSinceEpoch( cx , o ) != 0;
+ #else
+ return JS_InstanceOf( cx , o, &js_DateClass, 0 );
diff --git a/community-testing/mongodb/mongodb.conf b/community-testing/mongodb/mongodb.conf
new file mode 100644
index 000000000..c5272b7f2
--- /dev/null
+++ b/community-testing/mongodb/mongodb.conf
@@ -0,0 +1,8 @@
+# See http://www.mongodb.org/display/DOCS/File+Based+Configuration for format details
+# Run mongod --help to see a list of options
+
+bind_ip = 127.0.0.1
+quiet = true
+dbpath = /var/lib/mongodb
+logpath = /var/log/mongodb/mongod.log
+logappend = true
diff --git a/community-testing/mongodb/mongodb.install b/community-testing/mongodb/mongodb.install
new file mode 100755
index 000000000..8808eea0d
--- /dev/null
+++ b/community-testing/mongodb/mongodb.install
@@ -0,0 +1,29 @@
+# vim: syntax=sh
+
+post_install() {
+ useradd -r -g daemon -d /var/lib/mongodb -s /bin/bash mongodb
+ chown -R mongodb:daemon /var/lib/mongodb
+ chown -R mongodb:daemon /var/log/mongodb
+
+ if [ "$(arch)" != "x86_64" ]
+ then
+ echo '==> Warning: the 32 bit version of MongoDB is limited to about 2GB of data.'
+ echo '==> See http://blog.mongodb.org/post/137788967/32-bit-limitations'
+ fi
+}
+
+post_upgrade() {
+ chown -R mongodb:daemon /var/lib/mongodb
+ chown -R mongodb:daemon /var/log/mongodb
+
+ # have to fix my fudge up in 1.8.2-2 and 1.8.2-3
+ # added july 5th, 2011
+ usermod -s /bin/bash mongodb >& /dev/null
+ echo 'The dbpath has changed from /var/state/mongodb to /var/lib/mongodb'
+ echo 'Make sure you move your data files to the new dbpath before you start/restart mongodb'
+ echo 'The logpath has changed from /var/log/mongod to /var/log/mongodb/mongod.log'
+}
+
+pre_remove() {
+ userdel mongodb
+}
diff --git a/community-testing/mongodb/mongodb.rc b/community-testing/mongodb/mongodb.rc
new file mode 100755
index 000000000..517258f63
--- /dev/null
+++ b/community-testing/mongodb/mongodb.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+# vim: syntax=sh
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof /usr/bin/mongod`
+case "$1" in
+ start)
+ stat_busy "Starting mongodb"
+ [ -z "$PID" ] && /bin/su mongodb -c "/usr/bin/mongod --config /etc/mongodb.conf --fork" > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon mongodb
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping mongodb"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mongodb
+ while [ ! -z "$(pidof /usr/bin/mongod)" ]; do
+ sleep 1;
+ done
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/community-testing/openmovieeditor/PKGBUILD b/community-testing/openmovieeditor/PKGBUILD
new file mode 100644
index 000000000..f5edd51ad
--- /dev/null
+++ b/community-testing/openmovieeditor/PKGBUILD
@@ -0,0 +1,35 @@
+# $Id: PKGBUILD 51110 2011-07-05 10:08:30Z spupykin $
+# Contributor: Robert Emil Berge <filoktetes@linuxophic.org>
+# Maintainer: Robert Emil Berge
+# Maintainer: Mateusz Herych <heniekk@gmail.com>
+pkgname=openmovieeditor
+pkgver=0.0.20090105
+pkgrel=7
+pkgdesc="A simple video editor"
+arch=('i686' 'x86_64')
+url="http://openmovieeditor.sourceforge.net/HomePage"
+license=('GPL')
+depends=('libquicktime' 'libsamplerate' 'fltk' 'jack' 'portaudio' 'gmerlin-avdecoder')
+source=(http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz)
+md5sums=('ce4f76c0b3e90aabf9c2d5c8dd31e9b1')
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+ unset LDFLAGS
+
+ export CFLAGS="$CFLAGS -fpermissive"
+ export CXXFLAGS="$CXXFLAGS -fpermissive"
+ export CPPFLAGS="$CPPFLAGS -fpermissive"
+ sed -i 's|= sizes();|= (short*)sizes();|g' src/Fl_Split.cpp
+
+ # Fix missing includes
+ sed -e 's|<sstream>|<sstream>\n#include <stdint.h>|' -i src/VideoViewGL.H
+ sed -e 's|<string>|<string>\n#include <stdint.h>|' -i src/WaveForm.H
+ sed -e 's|<stdint.h>|<stdint.h>\n#include <stdio.h>|' -i src/AddCommand.H
+ sed -e 's|<string>|<stdint.h>\n#include <stdio.h>|' -i src/MediaBrowser.H
+ sed -e 's|<iostream>|<iostream>\n#include <stdio.h>|' -i src/fl_font_browser.h
+
+ ./configure --prefix=/usr
+ make
+ make DESTDIR=$pkgdir install
+}
diff --git a/community-testing/xdiskusage/PKGBUILD b/community-testing/xdiskusage/PKGBUILD
new file mode 100644
index 000000000..0ff97363c
--- /dev/null
+++ b/community-testing/xdiskusage/PKGBUILD
@@ -0,0 +1,47 @@
+# $Id: PKGBUILD 51101 2011-07-05 08:55:16Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
+# Contributor: Jason Chu <jason@archlinux.org>
+
+pkgname=xdiskusage
+pkgver=1.48
+pkgrel=6
+pkgdesc="xdiskusage is a user-friendly program to show you what is using up all your disk space"
+arch=('i686' 'x86_64')
+depends=('fltk')
+makedepends=('libxi')
+license=('GPL')
+url="http://xdiskusage.sourceforge.net"
+options=(!emptydirs)
+source=(http://xdiskusage.sourceforge.net/$pkgname-$pkgver.tgz
+ 'stdin-is-null.patch')
+md5sums=('a902aa9d73761ade98256c3cd5c1f533'
+ '0181b66b44e382e44c91602d8de9a7b6')
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ sed -i 's/-lGL -lGLU/-lXft/' makeinclude.in
+
+ patch -Np1 -i "$srcdir/stdin-is-null.patch"
+
+ [ $CARCH == "x86_64" ] && patch xdiskusage.C <<EOF
+991c991
+< switch ((int)v) {
+---
+> switch ((long long)v) {
+1004c1004
+< int n = (int)v;
+---
+> int n = (long long)v;
+EOF
+
+ ./configure --prefix=/usr
+ install -d "$pkgdir/usr/bin" "$pkgdir/usr/share/man/man1"
+ LDFLAGS=-lXi make
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make prefix="$pkgdir/usr" mandir="$pkgdir/usr/share/man" install
+ chmod 0644 $pkgdir/usr/share/man/man1/*
+}
diff --git a/community-testing/xdiskusage/stdin-is-null.patch b/community-testing/xdiskusage/stdin-is-null.patch
new file mode 100644
index 000000000..e70789c13
--- /dev/null
+++ b/community-testing/xdiskusage/stdin-is-null.patch
@@ -0,0 +1,31 @@
+--- xdiskusage-1.48/xdiskusage.C 2004-09-21 07:23:14.000000000 +0200
++++ xdiskusage-1.48.carles/xdiskusage.C 2007-07-30 23:42:05.000000000 +0200
+@@ -223,6 +223,19 @@
+ return 1;
+ }
+
++// returns true if stdin is /dev/null
++// To fix Debian bug #276193
++// Technically could be possible that returns "true" and is not "true",
++// because same device ID is used across file systems. But is the best
++// solutions that I have
++int isstdinnull() {
++ struct stat ststdin,stnull;
++ stat("/dev/null",&stnull);
++ fstat(0,&ststdin);
++
++ return (ststdin.st_rdev==stnull.st_rdev);
++}
++
+ int main(int argc, char**argv) {
+ #if FL_MAJOR_VERSION < 2
+ // Make fltk look more like KDE/Windoze:
+@@ -253,7 +266,7 @@
+ OutputWindow* d = OutputWindow::make(argv[n++]);
+ if (d) d->show(argc,argv);
+ }
+- } else if (!isatty(0)) {
++ } else if (!isatty(0) && !isstdinnull()) {
+ // test for pipe, if so read stdin:
+ OutputWindow* d = OutputWindow::make(0);
+ if (d) d->show(argc,argv);