]> git.saurik.com Git - cycript.git/commitdiff
Allow the type to be recovered from a Functor.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 11 Sep 2013 04:15:11 +0000 (21:15 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 11 Sep 2013 04:15:11 +0000 (21:15 -0700)
.gitignore
Cycript.h [new file with mode: 0644]
Execute.cpp
xcode.mk

index e1cc9b27757c204f7929f1275cd791b00acb5678..cc51ea04119c5a693aac2bb7423e762d5257b3c5 100644 (file)
@@ -34,3 +34,4 @@ readline-6.2
 readline-6.2.tar.gz
 libffi.*
 build.*
+Cycript.framework
diff --git a/Cycript.h b/Cycript.h
new file mode 100644 (file)
index 0000000..cdff446
--- /dev/null
+++ b/Cycript.h
@@ -0,0 +1,35 @@
+/* Cycript - Optimizing JavaScript Compiler/Runtime
+ * Copyright (C) 2009-2013  Jay Freeman (saurik)
+*/
+
+/* GNU General Public License, Version 3 {{{ */
+/*
+ * Cycript is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Cycript is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cycript.  If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#ifndef CYCRIPT_CYCRIPT_H
+#define CYCRIPT_CYCRIPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void CYListenServer(short port);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif/*CYCRIPT_CYCRIPT_H*/
index 4c9e19891feef5db21d2de887626613d776338dc..5fe0439e63d18ebed1e86e1bd636bc627ad838a3 100644 (file)
@@ -1188,6 +1188,12 @@ static JSValueRef Pointer_callAsFunction_toCYON(JSContextRef context, JSObjectRe
     }
 } CYCatch(NULL) }
 
+static JSValueRef Functor_getProperty_type(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) {
+    cy::Functor *internal(reinterpret_cast<cy::Functor *>(JSObjectGetPrivate(object)));
+    CYPool pool;
+    return CYCastJSValue(context, Unparse(pool, &internal->signature_));
+}
+
 static JSValueRef Type_getProperty_alignment(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) {
     Type_privateData *internal(reinterpret_cast<Type_privateData *>(JSObjectGetPrivate(object)));
     return CYCastJSValue(context, internal->GetFFI()->alignment);
@@ -1247,6 +1253,11 @@ namespace cy {
     JSStaticFunction const * const Functor::StaticFunctions = Functor_staticFunctions;
 }
 
+static JSStaticValue Functor_staticValues[2] = {
+    {"type", &Functor_getProperty_type, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete},
+    {NULL, NULL, NULL, 0}
+};
+
 static JSStaticValue Type_staticValues[4] = {
     {"alignment", &Type_getProperty_alignment, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete},
     {"name", &Type_getProperty_name, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete},
@@ -1361,6 +1372,7 @@ void CYInitializeDynamic() {
     definition = kJSClassDefinitionEmpty;
     definition.className = "Functor";
     definition.staticFunctions = cy::Functor::StaticFunctions;
+    definition.staticValues = Functor_staticValues;
     definition.callAsFunction = &Functor_callAsFunction;
     definition.finalize = &CYFinalize;
     Functor_ = JSClassCreate(&definition);
index 0766d6f790850b93f6d532ad0dee77bb5e1c2f18..d87951fb9a0e51b123405aadaf8d469c0bfedafd 100644 (file)
--- a/xcode.mk
+++ b/xcode.mk
@@ -30,7 +30,17 @@ libs += .libs/libcycript-sys.dylib
 libs += .libs/libcycript-sim.dylib
 libs += .libs/libcycript.o
 
-all: cycript $(libs)
+framework := 
+framework += Cycript.framework/Cycript
+framework += Cycript.framework/Headers/Cycript.h
+
+all: cycript $(libs) $(framework)
+
+cycript.zip: all
+       rm -f $@
+       zip -r9y $@ .libs/cycript .libs/*.dylib Cycript.framework
+
+package: cycript.zip
 
 clean:
        rm -rf cycript .libs
@@ -104,8 +114,16 @@ $(foreach arch,armv6,$(eval $(call build_arm,$(arch))))
 .libs/libcycript.o: .libs/libcycript-ios-armv6.o .libs/libcycript-ios-armv7.o .libs/libcycript-ios-armv7s.o .libs/libcycript-sim-i386.o
        $(lipo) -create -output $@ $^
 
+Cycript.framework/Cycript: .libs/libcycript.o
+       @mkdir -p $(dir $@)
+       cp -a $< $@
+
+Cycript.framework/Headers/Cycript.h: Cycript.h
+       @mkdir -p $(dir $@)
+       cp -a $< $@
+
 cycript: cycript.in
        cp -af $< $@
        chmod 755 $@
 
-.PHONY: all clean
+.PHONY: all clean package