]> git.saurik.com Git - cycript.git/commitdiff
Change mind (again) and use tightly-coupled C++ API.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 1 Oct 2009 21:56:37 +0000 (21:56 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 1 Oct 2009 21:56:37 +0000 (21:56 +0000)
Application.mm
Library.mm
cycript.h [deleted file]
cycript.hpp [new file with mode: 0644]
makefile

index 56a3cc1010477d4404f6bd51d166992cd97098f3..c5c6936b1f742243185d642e087c00a8924ce8ba 100644 (file)
@@ -1,7 +1,7 @@
 #define _GNU_SOURCE
 
 #include <substrate.h>
-#include "cycript.h"
+#include "cycript.hpp"
 
 #include <cstdio>
 #include <sstream>
index b6b2f71b75538a5ce6dc331fdead9405a0ade0ba..f56e14b1155a48d9bd9616297b84a9438d5028c2 100644 (file)
@@ -40,7 +40,7 @@
 #define _GNU_SOURCE
 
 #include <substrate.h>
-#include "cycript.h"
+#include "cycript.hpp"
 
 #include "sig/parse.hpp"
 #include "sig/ffi_type.hpp"
@@ -261,7 +261,7 @@ JSObjectRef CYMakeObject(JSContextRef context, id object) {
 
 @end
 
-extern "C" JSContextRef CYGetJSContext() {
+JSContextRef CYGetJSContext() {
     return Context_;
 }
 
@@ -394,7 +394,7 @@ JSValueRef CYCastJSValue(JSContextRef context, id value) {
     return value == nil ? JSValueMakeNull(context) : [value cy$JSValueInContext:context];
 }
 
-extern "C" void CYThrowNSError(JSContextRef context, id error, JSValueRef *exception) {
+void CYThrow(JSContextRef context, id error, JSValueRef *exception) {
     *exception = CYCastJSValue(context, error);
 }
 
@@ -469,7 +469,7 @@ extern "C" void CYThrowNSError(JSContextRef context, id error, JSValueRef *excep
 
 @end
 
-extern "C" CFStringRef CYCopyJSONString(JSContextRef context, JSValueRef value) {
+CFStringRef CYCopyJSONString(JSContextRef context, JSValueRef value) {
     id object(CYCastNSObject(context, value));
     return reinterpret_cast<CFStringRef>([(object == nil ? @"null" : [object cy$toJSON]) retain]);
 }
diff --git a/cycript.h b/cycript.h
deleted file mode 100644 (file)
index 482d3f7..0000000
--- a/cycript.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef CYCRIPT_H
-#define CYCRIPT_H
-
-#ifdef __OBJC__
-#include <Foundation/Foundation.h>
-#endif
-
-#include <JavaScriptCore/JSBase.h>
-#include <JavaScriptCore/JSValueRef.h>
-#include <JavaScriptCore/JSObjectRef.h>
-#include <JavaScriptCore/JSContextRef.h>
-#include <JavaScriptCore/JSStringRef.h>
-#include <JavaScriptCore/JSStringRefCF.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-JSContextRef CYGetJSContext();
-CFStringRef CYCopyJSONString(JSContextRef context, JSValueRef value);
-
-#ifdef __OBJC__
-void CYThrowNSError(JSContextRef context, id error, JSValueRef *exception);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef __cplusplus
-inline void CYThrow(JSContextRef context, id error, JSValueRef *exception) {
-    return CYThrowNSError(context, error, exception);
-}
-#endif
-
-#endif/*CYCRIPT_H*/
diff --git a/cycript.hpp b/cycript.hpp
new file mode 100644 (file)
index 0000000..c1e6751
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef CYCRIPT_H
+#define CYCRIPT_H
+
+#ifdef __OBJC__
+#include <Foundation/Foundation.h>
+#endif
+
+#include <JavaScriptCore/JSBase.h>
+#include <JavaScriptCore/JSValueRef.h>
+#include <JavaScriptCore/JSObjectRef.h>
+#include <JavaScriptCore/JSContextRef.h>
+#include <JavaScriptCore/JSStringRef.h>
+#include <JavaScriptCore/JSStringRefCF.h>
+
+JSContextRef CYGetJSContext();
+CFStringRef CYCopyJSONString(JSContextRef context, JSValueRef value);
+
+#ifdef __OBJC__
+void CYThrow(JSContextRef context, id error, JSValueRef *exception);
+#endif
+
+#endif/*CYCRIPT_H*/
index 791a07163d7471da383cdbebd7c057e817ce73b8..d178765a637fb617c542dc382bbc4cb545273d8b 100644 (file)
--- a/makefile
+++ b/makefile
@@ -50,10 +50,10 @@ lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
 Output.o: Output.cpp Parser.hpp Pooling.hpp
        $(target)g++ $(flags) -c -o $@ $<
 
-Library.o: Library.mm Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.h
+Library.o: Library.mm Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp
        $(target)g++ $(flags) -c -o $@ $<
 
-Application.o: Application.mm Cycript.tab.hh Parser.hpp Pooling.hpp cycript.h
+Application.o: Application.mm Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
        $(target)g++ $(flags) -c -o $@ $<
 
 libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o