[gjs/wip/xulrunner-2-rebase3: 2/6] compat.h: Don't include config.h, instead do inspection of jsapi.h



commit 457758abb48d7ba0edf37eef8b685c4d6053cfc8
Author: Colin Walters <walters verbum org>
Date:   Thu Oct 21 13:35:21 2010 -0400

    compat.h: Don't include config.h, instead do inspection of jsapi.h
    
    This allows us to sanely install this header file, which will allow
    us to make jsapi-util.h depend on it.

 gjs/compat.h |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/gjs/compat.h b/gjs/compat.h
index 3976064..03daf6c 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -1,6 +1,7 @@
 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
 /*
  * Copyright (c) 2009  litl, LLC
+ * Copyright (c) 2010  Red Hat, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -21,20 +22,26 @@
  * IN THE SOFTWARE.
  */
 
+#if !defined (__GJS_GJS_MODULE_H__) && !defined (GJS_COMPILATION)
+#error "Only <gjs/gjs-module.h> can be included directly."
+#endif
+
 #ifndef __GJS_COMPAT_H__
 #define __GJS_COMPAT_H__
 
-G_BEGIN_DECLS
-
-#include "config.h"
+#include <jsapi.h>
 
+G_BEGIN_DECLS
 
-/* See https://bugzilla.gnome.org/show_bug.cgi?id=622896 */
-#ifndef HAVE_MOZJS_2
+/* This file inspects jsapi.h and attempts to provide a compatibility shim.
+ * See https://bugzilla.gnome.org/show_bug.cgi?id=622896 for some initial discussion.
+ */
 
 /* The old JS_AddRoot accepted anything via void *, new
  * api is stricter.
+ * Upstream commit 2fc2a12a4565, Spidermonkey >= Jun 07 2010
  */
+#ifndef JS_TYPED_ROOTING_API
 #define JS_AddValueRoot JS_AddRoot
 #define JS_AddObjectRoot JS_AddRoot
 #define JS_AddStringRoot JS_AddRoot
@@ -43,17 +50,26 @@ G_BEGIN_DECLS
 #define JS_RemoveObjectRoot JS_RemoveRoot
 #define JS_RemoveStringRoot JS_RemoveRoot
 #define JS_RemoveGCThingRoot JS_RemoveRoot
+#endif
 
-/* This one is complex; jsid appears to be explicitly
+/* commit 5ad4532aa996, Spidermonkey > Jun 17 2010
+ * This one is complex; jsid appears to be explicitly
  * different from JSVAL now.  If we're on an old xulrunner,
- * define JSID_IS_VOID in a simple way.
+ * define JSID_IS_VOID in a compatible way.
  */
+#ifndef JSID_VOID
 #define JSID_VOID JSVAL_VOID
 #define JSID_IS_VOID(id) (id == JSVAL_VOID)
 #define INT_TO_JSID(i) ((jsid) INT_TO_JSVAL(i))
+#endif
 
+/* commit 66c8ad02543b, Spidermonkey > Aug 16 2010
+ * "Slow natives" */
+#ifdef JSFUN_CONSTRUCTOR
+/* All functions are "fast", so define this to a no-op */
+#define JSFUN_FAST_NATIVE 0
 #endif
 
 G_END_DECLS
 
-#endif  /* __GJS_MEM_H__ */
+#endif  /* __GJS_COMPAT_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]