diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-06 17:21:15 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-06 17:21:15 +0200 |
commit | 757b74dbcbb78eee894b0bdb916923ffb2d8e99b (patch) | |
tree | 9080c7141cf71ea63df304184979e45500bb4180 /functions.h | |
parent | fd32094cf12d4894a3eb5a9512f2c74f90b61713 (diff) |
Generalise foreign value conversion.
Diffstat (limited to 'functions.h')
-rw-r--r-- | functions.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/functions.h b/functions.h index bb8c6af..102565b 100644 --- a/functions.h +++ b/functions.h @@ -21,6 +21,12 @@ #import <Foundation/NSString.h> #include <stdint.h> +#ifdef HAVE_FFI_H +#include <ffi.h> +#elif HAVE_FFI_FFI_H +#include <ffi/ffi.h> +#endif + NSString *MLKPrintToString (id object); @@ -36,3 +42,32 @@ id MLKAddFixnums (id x, id y); id MLKSubtractFixnums (id x, id y); id MLKIDivideFixnums (id x, id y); id MLKMultiplyFixnums (id x, id y); + +typedef enum MLKForeignType +{ + MLKT_PTR, + MLKT_SHORT, + MLKT_USHORT, + MLKT_INT, + MLKT_UINT, + MLKT_LONG, + MLKT_ULONG, + MLKT_STRING, + MLKT_VOID, + MLKT_BOOL, + MLKT_ID, + MLKT_CLASS, + MLKT_CHAR, + MLKT_UNICHAR, + MLKT_ERROR, + MLKT_INVALID, +} MLKForeignType; + +MLKForeignType MLKForeignTypeWithObjectiveCType (const char *typestring); +MLKForeignType MLKForeignTypeWithTypeDesignator (id typeDesignator); +MLKForeignType MLKForeignTypeWithLispValue (id value); +ffi_type *MLKFFITypeWithForeignType (MLKForeignType type); +ffi_type *MLKFFITypeWithObjectiveCType (const char *typestring); +ffi_type *MLKFFITypeWithLispValue (id value); +void MLKSetForeignValueWithLispValue (void *destination, id value, MLKForeignType type); +id MLKLispValueWithForeignValue (void *source, MLKForeignType type); |