From patchwork Sat Oct 9 20:12:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 67330 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 20525B6EEB for ; Sun, 10 Oct 2010 07:12:56 +1100 (EST) Received: (qmail 12545 invoked by alias); 9 Oct 2010 20:12:53 -0000 Received: (qmail 12532 invoked by uid 22791); 9 Oct 2010 20:12:52 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL, BAYES_20, TW_BJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Oct 2010 20:12:47 +0000 Received: from eggs.gnu.org ([140.186.70.92]:54538) by fencepost.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1P4fmf-0002Ue-8b for gcc-patches@gnu.org; Sat, 09 Oct 2010 16:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P4fmd-0002m7-Al for gcc-patches@gnu.org; Sat, 09 Oct 2010 16:12:45 -0400 Received: from smtp151.iad.emailsrvr.com ([207.97.245.151]:34488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P4fmd-0002ls-8A for gcc-patches@gnu.org; Sat, 09 Oct 2010 16:12:43 -0400 Received: from relay25.relay.iad.mlsrvr.com (localhost [127.0.0.1]) by relay25.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id AF14C1B4E9E for ; Sat, 9 Oct 2010 16:12:42 -0400 (EDT) Received: from dynamic11.wm-web.iad.mlsrvr.com (dynamic11.wm-web.iad.mlsrvr.com [192.168.2.218]) by relay25.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id AA8C61B4E98 for ; Sat, 9 Oct 2010 16:12:42 -0400 (EDT) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic11.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id 9A475E008A for ; Sat, 9 Oct 2010 16:12:42 -0400 (EDT) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Sat, 9 Oct 2010 22:12:42 +0200 (CEST) Date: Sat, 9 Oct 2010 22:12:42 +0200 (CEST) Subject: libobjc - another small header update From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1286655162.61319927@192.168.2.227> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch moved the declaration of messaging functions and types into objc/message.h (all mechanical with the exception of updates to comments). Committed to trunk. Thanks Index: ChangeLog =================================================================== --- ChangeLog (revision 165234) +++ ChangeLog (working copy) @@ -1,3 +1,11 @@ +2010-10-09 Nicola Pero + + * objc/objc-api.h (struct objc_super, Super, Super_t, + objc_msg_lookup_super, objc_msg_sendv, objc_msg_forward, + objc_msg_forward2): Declarations moved to objc/message.h. Include + message.h here. + * objc/message.h: Added such declarations; updated comments. + 2010-10-06 Nicola Pero Implemented fast enumeration for Objective-C. Index: objc/objc-api.h =================================================================== --- objc/objc-api.h (revision 165234) +++ objc/objc-api.h (working copy) @@ -289,27 +289,13 @@ typedef struct objc_category { conformed to */ } Category, *Category_t; -/* -** Structure used when a message is send to a class's super class. The -** compiler generates one of these structures and passes it to -** objc_msg_super. -*/ -typedef struct objc_super { - id self; /* Id of the object sending - the message. */ -#ifdef __cplusplus - Class super_class; -#else - Class class; /* Object's super class. */ -#endif -} Super, *Super_t; +/* We include message.h for compatibility with the old objc-api.h + which included the declarations currently in message.h. The + Apple/NeXT runtime does not do this and only include message.h in + objc-runtime.h. It does not matter that much since most of the + definitions in message.h are runtime-specific. */ +#include "message.h" -objc_EXPORT IMP objc_msg_lookup_super(Super_t super, SEL sel); - -objc_EXPORT retval_t objc_msg_sendv(id, SEL, arglist_t); - - - /* ** This is a hook which is called by objc_lookup_class and ** objc_get_class if the runtime is not able to find the class. @@ -359,16 +345,6 @@ objc_free(void *mem); #include "deprecated/objc_valloc.h" #include "deprecated/objc_malloc.h" -/* -** Hooks for method forwarding. This makes it easy to substitute a -** library, such as ffcall, that implements closures, thereby avoiding -** gcc's __builtin_apply problems. __objc_msg_forward2's result will -** be preferred over that of __objc_msg_forward if both are set and -** return non-NULL. -*/ -objc_EXPORT IMP (*__objc_msg_forward)(SEL); -objc_EXPORT IMP (*__objc_msg_forward2)(id, SEL); - #include "deprecated/objc_unexpected_exception.h" objc_EXPORT Method_t class_get_class_method(MetaClass _class, SEL aSel); Index: objc/message.h =================================================================== --- objc/message.h (revision 165234) +++ objc/message.h (working copy) @@ -33,8 +33,17 @@ extern "C" { #include "objc.h" #include "objc-decls.h" -/* This file includes declarations of the messaging functions and types. */ +/* This file includes declarations of the messaging functions and + types. +*/ +/* Compatibility note: the messaging function is one area where the + GNU runtime and the Apple/NeXT runtime differ significantly. If + you can, it is recommended that you use higher-level facilities + (provided by a Foundation library such as GNUstep Base) to perform + forwarding or other advanced messaging tricks. +*/ + typedef void* retval_t; /* return value */ typedef void(*apply_t)(void); /* function pointer */ typedef union arglist { @@ -44,8 +53,38 @@ typedef union arglist { objc_EXPORT IMP objc_msg_lookup(id receiver, SEL op); -/* TODO: Add the remaining messaging declarations from objc-api.h. */ +/* + * Structure used when a message is send to a class's super class. + * The compiler generates one of these structures and passes it to + * objc_msg_lookup_super. + */ +typedef struct objc_super { + id self; /* Id of the object sending the message. */ +#ifdef __cplusplus + /* The new version of the API will always use 'super_class'. */ + Class super_class; +#else + Class class; /* Object's super class. */ +#endif +} Super, *Super_t; +objc_EXPORT IMP objc_msg_lookup_super(Super_t super, SEL sel); + +objc_EXPORT retval_t objc_msg_sendv(id, SEL, arglist_t); + +/* + * Hooks for method forwarding. This makes it easy to substitute a + * library, such as ffcall, that implements closures, thereby avoiding + * gcc's __builtin_apply problems. __objc_msg_forward2's result will + * be preferred over that of __objc_msg_forward if both are set and + * return non-NULL. + * + * TODO: The API should define objc_set_msg_forward_handler () or + * similar instead of these hooks. + */ +objc_EXPORT IMP (*__objc_msg_forward)(SEL); +objc_EXPORT IMP (*__objc_msg_forward2)(id, SEL); + #ifdef __cplusplus } #endif