M ObjC.mmod +1 -1
@@ 905,7 905,7 @@ LOG("CreateClassDefinition(%s, %s)\n", n
strcpy ((char*)new_class->name, name);
meta_class->name = new_class->name;
#else
- objc_allocateClassPair(super_class, name, 0);
+ new_class = objc_allocateClassPair(super_class, name, 0);
#endif /* OBJC_V1 */
M dynamic_class.m +24 -23
@@ 191,7 191,7 @@ void f_call_objc_method(INT32 args, int
struct svalue * o_retval;
int num_float_arguments = 0;
int num_pointer_return_arguments = 0;
- void* volatile msgResult;
+ ffi_arg msgResult;
ffi_cif * cif;
SEL sel;
pool = [global_autorelease_pool getAutoreleasePool];
@@ 347,7 347,7 @@ void f_call_objc_method(INT32 args, int
{
Class cls;
wrapper = id_from_object(o);
- argumentList[x] = (wrapper);
+ argumentList[x] = &(wrapper);
}
}
else if(TYPEOF(*sv) == T_ARRAY)
@@ 461,7 461,7 @@ void f_call_objc_method(INT32 args, int
LOG("SENDING MESSAGE %s WITH %d args AND RETURN TYPE %s\n", select, arguments, type);
LOG("OBJ: %p, %p\n", obj, select);
pop_n_elems(args);
-
+ @try {
switch(*type){
case '@':
o_retval = object_dispatch_method(cif, argumentList);
@@ 469,10 469,9 @@ void f_call_objc_method(INT32 args, int
case 'd':
case 'f':
- case 'q':
- case 'Q':
- ffi_call(cif, FFI_FN(objc_msgSend_fpret), msgResult, argumentList);
+ ffi_call(cif, FFI_FN(objc_msgSend), msgResult, argumentList);
break;
+
case '[':
case '{':
@@ 483,68 482,70 @@ void f_call_objc_method(INT32 args, int
THREADS_DISALLOW();
break;
- default:
+ default:
THREADS_ALLOW();
LOG("calling%s\n", "");
- ffi_call(cif, FFI_FN(objc_msgSend), msgResult, argumentList);
+ ffi_call(cif, FFI_FN(objc_msgSend), &msgResult, argumentList);
THREADS_DISALLOW();
LOG("calling2%s\n", "");
break;
}
// free(msgResult);
+printf("whoo\n");
free(cif);
LOG("called!%s\n", "");
- @try
- {
- switch(*type){
+
+ switch(*type){
case 'c':
- push_int(*(INT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
break;
case 'C':
- push_int(*(INT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
break;
case 'i':
- push_int(*(INT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
break;
// TODO: fix the casting... should we support auto objectize for bignums?
case 'l':
- push_int(*(INT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
free(result);
break;
case 'L':
- push_int(*(INT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
break;
case 'I':
- push_int(*(INT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
break;
case 'd':
- push_float(*(FLOAT_TYPE *)msgResult);
+ push_float((FLOAT_TYPE)msgResult);
break;
case 'f':
- push_float(*(FLOAT_TYPE *)msgResult);
+ push_float((FLOAT_TYPE)msgResult);
break;
+/* TODO we need to make sure we're not losing data here if the return size
+ is larger than INT_TYPE */
case 'q':
- push_float(*(FLOAT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
break;
case 'Q':
- push_float(*(FLOAT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
break;
case 's':
- push_int(*(INT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
break;
case 'S':
- push_int(*(INT_TYPE *)msgResult);
+ push_int((INT_TYPE)msgResult);
break;
case 'v':
M examples/exportbook.pike +3 -2
@@ 12,10 12,11 @@ int main()
{
mixed book = Cocoa.ABAddressBook.sharedAddressBook();
mixed e;
-werror("BOOK:%O\n", indices(book));
object p = book->people();
foreach(p;; object person)
{
+werror("!!!!\n");
+//werror("p: %O\n", person);
row = ({});
foreach(fields;; object f)
{
@@ 48,6 49,6 @@ void describe_value(object fv)
werror("error casting %O, %O to string.\n",
fv?fv->__objc_classname:"",
fv?sort(indices(fv)):fv);
-exit(1);}
+}
}
}
M mixins/NSArray.mx +2 -1
@@ 5,6 5,7 @@ MIXIN NSArray
PIKEFUN object _get_iterator()
{
+printf("get_iterator\n");
push_text("Public.ObjectiveC.NSArrayIterator");
SAFE_APPLY_MASTER("resolv", 1);
@@ 55,7 56,7 @@ PIKEFUN mixed `[](int key)
PIKEFUN int _sizeof()
{
int s;
-
+printf("_sizeof()\n");
s = [THIS->obj count];
push_int(s);
M util.m +5 -2
@@ 494,8 494,11 @@ id id_from_object(struct object * o)
c = PiObjC_FindObjCProxy(o);
if(!c)
{
+LOG("object wasn't in the proxy registry, so we will wrap it.%s\n", "");
c = objcify_pike_object(o);
- }
+ } else {
+ LOG("found object in registry %p\n", c);
+}
return c;
}
@@ 1683,7 1686,7 @@ int get_num_pointer_return_arguments(str
for (x = 2; x < argcount; x++)
{
int is_pointer_return = 0;
- method_getArgumentType(nssig, x, type, 100);
+ method_getArgumentType(nssig, x, ltype, 100);
type = ltype;
LOG("type: %s\n", type);
while((*type)&&(*type=='r' || *type =='n' || *type =='N' || *type=='o' || *type=='O' || *type =='V'))