Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 93b769605c52722429ea1c7b1169dc43 > files > 3

erlang-js-1.2.2-1.fc18.src.rpm

From a8449ee6c3b76f9b78961be6b25ca936f5654706 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Thu, 28 Oct 2010 12:29:26 +0400
Subject: [PATCH 2/3] Build with js-1.7.0

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
 c_src/spidermonkey.c | 16 ++++++++++++----
 c_src/spidermonkey.h |  3 ++-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/c_src/spidermonkey.c b/c_src/spidermonkey.c
index 623c109..baf7ec2 100644
--- a/c_src/spidermonkey.c
+++ b/c_src/spidermonkey.c
@@ -23,6 +23,16 @@
 #include "spidermonkey.h"
 #include "erl_compatibility.h"
 
+#define JS_SET_RVAL(cx,vp,v)    (*(vp) = (v))
+
+#ifndef JSVERSION_LATEST
+#define JSVERSION_LATEST JSVERSION_1_7
+#endif
+
+#ifndef JSFUN_FAST_NATIVE
+#define JSFUN_FAST_NATIVE JSFUN_INTERPRETED
+#endif
+
 void free_error(spidermonkey_state *state);
 
 /* The class of the global object. */
@@ -108,12 +118,11 @@ void write_timestamp(FILE *fd) {
           tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
 }
 
-JSBool js_log(JSContext *cx, uintN argc, jsval *vp) {
+JSBool js_log(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *vp) {
   if (argc != 2) {
     JS_SET_RVAL(cx, vp, JSVAL_FALSE);
   }
   else {
-    jsval *argv = JS_ARGV(cx, vp);
     jsval jsfilename = argv[0];
     jsval jsoutput = argv[1];
     char *filename = JS_GetStringBytes(JS_ValueToString(cx, jsfilename));
@@ -134,7 +143,7 @@ JSBool js_log(JSContext *cx, uintN argc, jsval *vp) {
 }
 
 void sm_configure_locale(void) {
-  JS_SetCStringsAreUTF8();
+	return;
 }
 
 spidermonkey_vm *sm_initialize(long thread_stack, long heap_size) {
@@ -148,7 +157,6 @@ spidermonkey_vm *sm_initialize(long thread_stack, long heap_size) {
   JS_SetGCParameter(vm->runtime, JSGC_MAX_BYTES, heap_size);
   JS_SetGCParameter(vm->runtime, JSGC_MAX_MALLOC_BYTES, gc_size);
   vm->context = JS_NewContext(vm->runtime, 8192);
-  JS_SetScriptStackQuota(vm->context, thread_stack);
 
   begin_request(vm);
   JS_SetOptions(vm->context, JSOPTION_VAROBJFIX);
diff --git a/c_src/spidermonkey.h b/c_src/spidermonkey.h
index e68aecf..ce1bfeb 100644
--- a/c_src/spidermonkey.h
+++ b/c_src/spidermonkey.h
@@ -16,7 +16,8 @@
 #ifndef __SPIDERMONKEY_INTERFACE_
 #define __SPIDERMONKEY_INTERFACE_
 
-#include "jsapi.h"
+#include <jsapi.h>
+#include <jsfun.h>
 
 typedef struct _spidermonkey_error_t {
   unsigned int lineno;
-- 
1.8.1.4