diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-09-29 01:06:05 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-09-29 01:06:05 +0200 |
commit | fd7702e9b009d2984328b2519db946f82ad834e9 (patch) | |
tree | f910466e18eddd34e157c98e01dc5414e3154451 /MLKCompiledClosure.m | |
parent | ace29d495df89afd2e3251064de91b00da2612da (diff) | |
parent | 45e00ec3f4dd6289cd14021ef1ee35568b4928c6 (diff) |
Merge /home/mulk/Dropbox/Projekte/Toilet Lisp
Diffstat (limited to 'MLKCompiledClosure.m')
-rw-r--r-- | MLKCompiledClosure.m | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/MLKCompiledClosure.m b/MLKCompiledClosure.m index 73f308b..fd643e3 100644 --- a/MLKCompiledClosure.m +++ b/MLKCompiledClosure.m @@ -26,6 +26,10 @@ #import <Foundation/NSDictionary.h> #import <Foundation/NSSet.h> +#ifdef __OBJC_GC__ +#import <Foundation/NSZone.h> +#endif + #import <stdlib.h> @@ -36,13 +40,18 @@ { int i; - _data = data; _dataLength = dataLength; _code = code; +#ifdef __OBJC_GC__ + _data = NSAllocateCollectable (dataLength * sizeof(id), NSScannedOption); +#else + _data = malloc (dataLength * sizeof(id)); +#endif + for (i = 0; i < _dataLength; i++) { - LRETAIN (_data[i]); + _data[i] = LRETAIN (data[i]); } return self; @@ -63,7 +72,7 @@ ffi_status status; void *argv[argc]; id argpointers[argc - 1]; - id return_value; + ffi_arg return_value; int i; arg_types[0] = &ffi_type_pointer; @@ -93,9 +102,10 @@ // } ffi_call (&cif, FFI_FN (_code), &return_value, (void**)argv); +// return_value = ((id (*)(void *, ...))_code) (_data, argpointers[0], argpointers[1], MLKEndOfArgumentsMarker); // FIXME: multiple values - return [NSArray arrayWithObject:nullify(return_value)]; + return [NSArray arrayWithObject:nullify((id)return_value)]; } -(NSString *) description |