#include "Standard.hpp"
class CYPool;
-struct CYTypedIdentifier;
+struct CYType;
struct CYTypedParameter;
namespace sig {
virtual const char *GetName() const;
virtual const char *Encode(CYPool &pool) const = 0;
- virtual CYTypedIdentifier *Decode(CYPool &pool) const = 0;
+ virtual CYType *Decode(CYPool &pool) const = 0;
virtual ffi_type *GetFFI(CYPool &pool) const = 0;
virtual void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const = 0;
}
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
Void *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
Unknown *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
String *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
};
+#ifdef CY_OBJECTIVEC
struct Meta :
Type
{
Meta *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
Selector *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
};
+#endif
struct Bits :
Type
Bits *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
Pointer *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
Array *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
};
+#ifdef CY_OBJECTIVEC
struct Object :
Type
{
Object *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
+};
+#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;
+ CYType *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;
const char *GetName() const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *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;
{
Signature signature;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
- virtual CYTypedIdentifier *Modify(CYPool &pool, CYTypedIdentifier *result, CYTypedParameter *parameters) const = 0;
+ CYType *Decode(CYPool &pool) const override;
+ virtual CYType *Modify(CYPool &pool, CYType *result, CYTypedParameter *parameters) const = 0;
};
struct Function :
Function *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Modify(CYPool &pool, CYTypedIdentifier *result, CYTypedParameter *parameters) const override;
+ CYType *Modify(CYPool &pool, CYType *result, CYTypedParameter *parameters) 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;
};
+#ifdef CY_OBJECTIVEC
struct Block :
Callable
{
Block *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
- CYTypedIdentifier *Modify(CYPool &pool, CYTypedIdentifier *result, CYTypedParameter *parameters) const override;
+ CYType *Decode(CYPool &pool) const override;
+ CYType *Modify(CYPool &pool, CYType *result, CYTypedParameter *parameters) 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;
};
+#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);