summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-10-21 13:35:21 -0400
committerColin Walters <walters@verbum.org>2010-10-29 12:56:43 -0400
commit1a74cfc76b5a8b5ef00a255d8ae813153337e8ab (patch)
tree518901c1e66ac96bceed4398d0e2cf2b930f0411
parent420303448cd8d855dddf1c7be084cac53be42b91 (diff)
downloadgjs-1a74cfc76b5a8b5ef00a255d8ae813153337e8ab.tar.gz
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.
-rw-r--r--gjs/compat.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/gjs/compat.h b/gjs/compat.h
index 3976064b..03daf6c7 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__ */