From 414d2bf6f6f75db5ec3babb164d8ed7d46d65080 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Tue, 7 Aug 2007 16:38:12 +0200 Subject: Rename the internal function OBJCL-INVOKE-CLASS-METHOD to OBJCL-INVOKE-METHOD. darcs-hash:2a0df2a072f110c491fb0aa97ddade5defd293c5 --- Lisp/libobjcl.lisp | 4 ++-- Lisp/method-invocation.lisp | 4 ++-- Objective-C/libobjcl.h | 14 ++++------- Objective-C/libobjcl.m | 58 ++++----------------------------------------- 4 files changed, 13 insertions(+), 67 deletions(-) diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp index 041ddf3..1cb29a2 100644 --- a/Lisp/libobjcl.lisp +++ b/Lisp/libobjcl.lisp @@ -74,8 +74,8 @@ objects or classes, let alone send messages to them. (argc :int) &rest) -(defcfun ("objcl_invoke_class_method" - %objcl-invoke-class-method) obj-data +(defcfun ("objcl_invoke_method" + %objcl-invoke-method) obj-data (receiver obj-data) (method-name :string) (argc :int) diff --git a/Lisp/method-invocation.lisp b/Lisp/method-invocation.lisp index e7079a7..4de8dc6 100644 --- a/Lisp/method-invocation.lisp +++ b/Lisp/method-invocation.lisp @@ -123,7 +123,7 @@ Returns: *result* --- the return value of the method invocation. "an Objective C instance (ID, OBJC-CLASS or EXCEPTION)") (let* ((arglist (arglist-intersperse-types (mapcar #'lisp->obj-data args))) - (return-value (apply-macro '%objcl-invoke-class-method + (return-value (apply-macro '%objcl-invoke-method (lisp->obj-data receiver) method-name (length args) @@ -136,7 +136,7 @@ Returns: *result* --- the return value of the method invocation. (constructor-name-p method-name)))) (obj-data->lisp return-value)))) (if (typep value 'condition) - (cerror "Return NIL from OBJCL-INVOKE-CLASS-METHOD" value) + (cerror "Return NIL from OBJCL-INVOKE-METHOD" value) value)) (dealloc-obj-data return-value)))) diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h index e8bcfaf..8ccafa7 100644 --- a/Objective-C/libobjcl.h +++ b/Objective-C/libobjcl.h @@ -37,16 +37,10 @@ void objcl_shutdown_runtime (void); OBJCL_OBJ_DATA -objcl_invoke_instance_method (OBJCL_OBJ_DATA receiver, - const char *method_name, - int argc, - ...); - -OBJCL_OBJ_DATA -objcl_invoke_class_method (OBJCL_OBJ_DATA class, - const char *method_name, - int argc, - ...); +objcl_invoke_method (OBJCL_OBJ_DATA receiver, + const char *method_name, + int argc, + ...); OBJCL_OBJ_DATA objcl_find_class (const char *class_name); diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m index 916ffa3..ee74944 100644 --- a/Objective-C/libobjcl.m +++ b/Objective-C/libobjcl.m @@ -165,10 +165,10 @@ _objcl_invoke_method (id self_, OBJCL_OBJ_DATA -objcl_invoke_instance_method (OBJCL_OBJ_DATA receiver, - const char *method_name, - int argc, - ...) +objcl_invoke_method (OBJCL_OBJ_DATA receiver, + const char *method_name, + int argc, + ...) { va_list arglist; id self_ = NULL; @@ -178,7 +178,6 @@ objcl_invoke_instance_method (OBJCL_OBJ_DATA receiver, NS_DURING { - /* fprintf (stderr, "! ---------> %s <--------\n", receiver->type); */ assert (receiver->type[0] == '#' || receiver->type[0] == '@' || receiver->type[0] == 'E'); @@ -186,54 +185,7 @@ objcl_invoke_instance_method (OBJCL_OBJ_DATA receiver, { case '#': self_ = receiver->data.class_val; case '@': self_ = receiver->data.id_val; - case 'E': self_ = receiver->data.exc_val; - } - - selector = NSSelectorFromString ([NSString - stringWithUTF8String: method_name]); - - signature = [self_ instanceMethodSignatureForSelector: selector]; - - va_start (arglist, argc); - _objcl_invoke_method (self_, result, signature, selector, argc, arglist); - va_end (arglist); - } - NS_HANDLER - { - result->type = malloc (strlen (EXCEPTION_TYPESPEC) + 1); - strcpy (result->type, EXCEPTION_TYPESPEC); - result->data.exc_val = localException; - NS_VALUERETURN (result, void *); - } - NS_ENDHANDLER - - return result; -} - - -OBJCL_OBJ_DATA -objcl_invoke_class_method (OBJCL_OBJ_DATA class, - const char *method_name, - int argc, - ...) -{ - va_list arglist; - id self_ = NULL; - SEL selector; - NSMethodSignature *signature; - OBJCL_OBJ_DATA result = malloc (sizeof (struct objcl_object)); - - NS_DURING - { - /* fprintf (stderr, "? ---------> %s <--------\n", class->type); */ - assert (class->type[0] == '#' - || class->type[0] == '@' - || class->type[0] == 'E'); - switch (class->type[0]) - { - case '#': self_ = class->data.class_val; - case '@': self_ = class->data.id_val; - case 'E': self_ = class->data.exc_val; + case 'E': self_ = receiver->data.exc_val; } selector = NSSelectorFromString ([NSString -- cgit v1.2.3