ftp.nice.ch/Attic/openStep/implementation/gnustep/sources/libFoundation.0.7.tgz#/libFoundation-0.7/FoundationExtensions/extensions/objc-runtime.h

This is objc-runtime.h in view mode; [Download] [Up]

/* 
   Copyright (C) 1996 
	Ovidiu Predescu <ovidiu@bx.logicnet.ro>
	Mircea Oancea <mircea@jupiter.elcom.pub.ro>

   Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>

   This file is part of the FoundationExtensions library.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; see the file COPYING.LIB.
   If not, write to the Free Software Foundation,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef __objc_runtime_h__
#define __objc_runtime_h__

#include <config.h>

#include <objc/objc.h>
#include <objc/objc-api.h>
#include <objc/Protocol.h>
#include <objc/encoding.h>

#if (__GNUC__ == 2) && (__GNUC_MINOR__ <= 6) && !defined(__attribute__)
#  define __attribute__(x)
#endif

extern BOOL sel_types_match(const char*, const char*);

#if GNU_RUNTIME

#define class_addMethods	class_add_methods
#define SEL_EQ(sel1, sel2)	sel_eq(sel1, sel2)

#else /* NeXT_RUNTIME */

#define SEL_EQ(sel1, sel2)	(sel1 == sel2)

extern BOOL sel_isMapped(SEL sel);
extern const char *sel_getName(SEL sel);
extern SEL sel_getUid(const char *str);
extern SEL sel_registerName(const char *str);
extern const char *object_getClassName(id obj);

extern id class_createInstance(Class, unsigned idxIvars);

extern void class_setVersion(Class, int);
extern int class_getVersion(Class);

extern struct objc_method* class_getInstanceMethod(Class, SEL);
extern struct objc_method* class_getClassMethod(Class, SEL);

extern Class class_poseAs(Class imposter, Class original);
extern id objc_lookUpClass(const char *name);

#define class_get_class_method		class_getClassMethod
#define class_get_instance_method	class_getInstanceMethod
#define class_pose_as			class_poseAs
#define objc_get_class			objc_getClass
#define objc_lookup_class		objc_lookUpClass
#define sel_get_name			sel_getName
#define sel_get_uid			sel_getUid
#define sel_get_any_uid			sel_getUid
#define sel_register_name		sel_registerName
#define sel_is_mapped			sel_isMapped
#define class_create_instance(CLASS) \
	class_createInstance(CLASS, 0)
#define class_set_version		class_setVersion
#define class_get_version		class_getVersion
#define object_get_class_name		object_getClassName

#define objc_msg_lookup			objc_msgLookup
#define objc_msg_sendv			next_objc_msg_sendv

extern id objc_msgSend(id self, SEL op, ...);
extern id objc_msgSendSuper(struct objc_super *super, SEL op, ...);

/* forwarding operations */
typedef void* marg_list;

extern id next_objc_msg_sendv(id self, SEL op, void* arg_frame);

static inline IMP
objc_msgLookup(id object, SEL sel)
{
    if(!object || !sel) return NULL;
    else {
	Class class = object->class_pointer;
	struct objc_method* mth =
	    (CLS_ISCLASS(class) ?
		  class_get_instance_method(class, sel)
		: class_get_class_method(class, sel));
	return mth ? mth->method_imp : (IMP)0;
    }
}

#endif /* NeXT_RUNTIME */


extern void class_addMethods(Class, struct objc_method_list*);
void class_add_behavior(Class class, Class behavior);

#endif /* __objc_runtime_h__ */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.