From d63c39cc96489a91400a5787ae0058e759b552fd Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 10 Oct 2009 21:00:56 +0000 Subject: [PATCH] Added bridging for nlist_64, activated memory manager, and setup a remap from singleton unions to structs. --- Bridge.def | 4 ++++ Library.mm | 5 ++++- sig/parse.cpp | 5 ++++- todo.txt | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Bridge.def b/Bridge.def index 68251da..e6071ef 100644 --- a/Bridge.def +++ b/Bridge.def @@ -8,6 +8,10 @@ S CGPoint "x"f"y"f S CGRect "origin"{CGPoint}"size"{CGSize} S CGSize "width"f"height"f +l c + +S nlist_64 "_un"(?="n_strx"I)"n_type"C"n_sect"C"n_desc"S"n_value"Q + l objc F class_addIvar B#*LC* diff --git a/Library.mm b/Library.mm index 0083fb5..52cf42e 100644 --- a/Library.mm +++ b/Library.mm @@ -306,6 +306,9 @@ JSObjectRef CYMakeStruct(JSContextRef context, void *data, sig::Type *type, ffi_ } void Structor_(apr_pool_t *pool, const char *name, const char *types, sig::Type *type) { + if (name == NULL) + return; + CYPoolTry { if (NSMutableArray *entry = [[Bridge_ objectAtIndex:2] objectForKey:[NSString stringWithUTF8String:name]]) { switch ([[entry objectAtIndex:0] intValue]) { @@ -1068,7 +1071,7 @@ JSValueRef CYCastJSValue(JSContextRef context, const char *value) { return CYCastJSValue(context, CYJSString(value)); } -JSValueRef CYCastJSValue(JSContextRef context, id value, bool transient = true) { +JSValueRef CYCastJSValue(JSContextRef context, id value, bool transient = false) { return value == nil ? CYJSNull(context) : [value cy$JSValueInContext:context transient:transient]; } diff --git a/sig/parse.cpp b/sig/parse.cpp index 1c0ec23..3452e5a 100644 --- a/sig/parse.cpp +++ b/sig/parse.cpp @@ -118,7 +118,10 @@ struct Type *Parse_(apr_pool_t *pool, const char **name, char eos, bool named, C case '#': type->primitive = typename_P; break; case '(': - type->primitive = union_P; + if (type->data.signature.count < 2) + type->primitive = struct_P; + else + type->primitive = union_P; next = ')'; goto aggregate; diff --git a/todo.txt b/todo.txt index f64e66d..93b7813 100644 --- a/todo.txt +++ b/todo.txt @@ -4,3 +4,4 @@ functors use both ffiData and ffoData... rename "data" variables to "internal" unicode identifier support (native and \u) object literal compilation should use numerify strings +support unions (right now 0-1 fields parsed as struct) -- 2.47.2