From 757b74dbcbb78eee894b0bdb916923ffb2d8e99b Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Wed, 6 Aug 2008 17:21:15 +0200 Subject: Generalise foreign value conversion. --- functions.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'functions.h') diff --git a/functions.h b/functions.h index bb8c6af..102565b 100644 --- a/functions.h +++ b/functions.h @@ -21,6 +21,12 @@ #import #include +#ifdef HAVE_FFI_H +#include +#elif HAVE_FFI_FFI_H +#include +#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); -- cgit v1.2.3