]> git.saurik.com Git - cycript.git/blobdiff - sig/types.hpp
Do not use corrupt struct to store type reference.
[cycript.git] / sig / types.hpp
index b7547fa206ad6bd13ae8ada5559df7da1fe61c88..2f536ac53a910bd6935763d505c9de1ecf1551b5 100644 (file)
@@ -134,6 +134,7 @@ struct String :
     JSValueRef FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const override;
 };
 
+#ifdef CY_OBJECTIVEC
 struct Meta :
     Type
 {
@@ -159,6 +160,7 @@ struct Selector :
     void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
     JSValueRef FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const override;
 };
+#endif
 
 struct Bits :
     Type
@@ -222,6 +224,7 @@ struct Array :
     JSValueRef FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const override;
 };
 
+#ifdef CY_OBJECTIVEC
 struct Object :
     Type
 {
@@ -241,6 +244,40 @@ struct Object :
     void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
     JSValueRef FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const override;
 };
+#endif
+
+struct Constant {
+    const char *name;
+    double value;
+};
+
+struct Enum :
+    Type
+{
+    Type &type;
+    unsigned count;
+    const char *name;
+
+    Constant *constants;
+
+    Enum(Type &type, unsigned count, const char *name = NULL) :
+        type(type),
+        count(count),
+        name(name),
+        constants(NULL)
+    {
+    }
+
+    Enum *Copy(CYPool &pool, const char *rename = NULL) const override;
+    const char *GetName() const override;
+
+    const char *Encode(CYPool &pool) const override;
+    CYTypedIdentifier *Decode(CYPool &pool) const override;
+
+    ffi_type *GetFFI(CYPool &pool) const override;
+    void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
+    JSValueRef FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const override;
+};
 
 struct Aggregate :
     Type
@@ -295,6 +332,7 @@ struct Function :
     JSValueRef FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const override;
 };
 
+#ifdef CY_OBJECTIVEC
 struct Block :
     Callable
 {
@@ -308,6 +346,7 @@ struct Block :
     void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
     JSValueRef FromFFI(JSContextRef context, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) const override;
 };
+#endif
 
 Type *joc_parse_type(char **name, char eos, bool variable, bool signature);
 void joc_parse_signature(Signature *signature, char **name, char eos, bool variable);