summaryrefslogtreecommitdiff
path: root/MLKForeignProcedure.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-09-29 01:06:05 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-09-29 01:06:05 +0200
commitfd7702e9b009d2984328b2519db946f82ad834e9 (patch)
treef910466e18eddd34e157c98e01dc5414e3154451 /MLKForeignProcedure.m
parentace29d495df89afd2e3251064de91b00da2612da (diff)
parent45e00ec3f4dd6289cd14021ef1ee35568b4928c6 (diff)
Merge /home/mulk/Dropbox/Projekte/Toilet Lisp
Diffstat (limited to 'MLKForeignProcedure.m')
-rw-r--r--MLKForeignProcedure.m17
1 files changed, 10 insertions, 7 deletions
diff --git a/MLKForeignProcedure.m b/MLKForeignProcedure.m
index b8dab83..f268005 100644
--- a/MLKForeignProcedure.m
+++ b/MLKForeignProcedure.m
@@ -23,6 +23,10 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSEnumerator.h>
+#ifdef __OBJC_GC__
+#import <Foundation/NSZone.h>
+#endif
+
#ifdef HAVE_FFI_H
#include <ffi.h>
#elif HAVE_FFI_FFI_H
@@ -47,7 +51,11 @@
_code = code;
_returnType = returnType;
+#ifdef __OBJC_GC__
+ _argumentTypes = NSAllocateCollectable (sizeof (MLKForeignType) * [argTypes count], NSScannedOption);
+#else
_argumentTypes = malloc (sizeof (MLKForeignType) * [argTypes count]);
+#endif
e = [argTypes objectEnumerator];
i = 0;
@@ -67,7 +75,7 @@
ffi_type *return_type;
ffi_status status;
void *argv[argc];
- id return_value;
+ ffi_arg return_value;
int i;
for (i = 0; i < argc; i++)
@@ -95,7 +103,7 @@
if (return_type == &ffi_type_void)
return [NSArray array];
else
- return [NSArray arrayWithObject:nullify (MLKLispValueWithForeignValue (&return_value, _returnType))];
+ return [NSArray arrayWithObject:nullify (MLKLispValueWithForeignValue ((id*)&return_value, _returnType))];
}
-(NSString *) description
@@ -113,9 +121,4 @@
free (_argumentTypes);
[super dealloc];
}
-
--(void) finalize
-{
- free (_argumentTypes);
-}
@end