1994-11-04 16:29:24 +00:00
|
|
|
/* Definitions to allow compilation of GNU objc code with NeXT runtime
|
1996-05-27 15:10:24 +00:00
|
|
|
Copyright (C) 1993,1994, 1996 Free Software Foundation, Inc.
|
1994-11-04 16:29:24 +00:00
|
|
|
|
1996-04-17 20:17:45 +00:00
|
|
|
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
1994-11-04 16:29:24 +00:00
|
|
|
Date: May 1993
|
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
1994-11-04 16:29:24 +00:00
|
|
|
|
|
|
|
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; if not, write to the Free
|
1999-09-09 02:56:20 +00:00
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
1994-11-04 16:29:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* This file is by no means complete. */
|
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#ifndef __objc_gnu2next_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __objc_gnu2next_h_GNUSTEP_BASE_INCLUDE
|
1994-11-04 16:29:24 +00:00
|
|
|
|
2001-04-10 22:18:36 +00:00
|
|
|
#if NeXT_RUNTIME
|
1994-11-04 16:29:24 +00:00
|
|
|
|
1994-11-14 15:58:43 +00:00
|
|
|
#include <objc/objc-class.h>
|
2001-04-12 17:16:55 +00:00
|
|
|
#include <stddef.h>
|
1994-11-14 15:58:43 +00:00
|
|
|
|
1994-11-04 16:29:24 +00:00
|
|
|
#define arglist_t marg_list
|
|
|
|
#define retval_t void*
|
|
|
|
#define TypedStream NXTypedStream
|
|
|
|
|
|
|
|
#define objc_write_type(STREAM, TYPE, VAR) \
|
|
|
|
NXWriteType(STREAM, TYPE, VAR)
|
|
|
|
#define objc_write_types(STREAM, TYPE, args...) \
|
|
|
|
NXWriteTypes(STREAM, TYPE, args)
|
|
|
|
#define objc_write_object(STREAM, VAR) \
|
|
|
|
NXWriteObject(STREAM, VAR)
|
|
|
|
#define objc_write_object_reference(STREAM, VAR) \
|
|
|
|
NXWriteObjectReference(STREAM, VAR)
|
|
|
|
#define objc_read_type(STREAM, TYPE, VAR) \
|
|
|
|
NXReadType(STREAM, TYPE, VAR)
|
|
|
|
#define objc_read_types(STREAM, TYPE, args...) \
|
|
|
|
NXReadTypes(STREAM, TYPE, args)
|
|
|
|
#define objc_read_object(STREAM, VAR) \
|
|
|
|
do { (*(VAR)) = NXReadObject(STREAM); } while (0)
|
|
|
|
#define objc_write_root_object \
|
|
|
|
NXWriteRootObject
|
|
|
|
#define objc_open_typed_stream_for_file \
|
|
|
|
NXOpenTypedStreamForFile
|
|
|
|
#define objc_close_typed_stream NXCloseTypedStream
|
|
|
|
|
|
|
|
#define class_create_instance(CLASS) class_createInstance(CLASS, 0)
|
|
|
|
#define sel_get_name(ASEL) sel_getName(ASEL)
|
1994-11-14 15:58:43 +00:00
|
|
|
#define sel_get_uid(METHODNAME) sel_getUid(METHODNAME)
|
2001-04-12 17:16:55 +00:00
|
|
|
|
|
|
|
/* FIXME: Any equivalent for this ? */
|
|
|
|
#define sel_get_type(SELECTOR) \
|
|
|
|
(NULL)
|
|
|
|
|
1994-11-04 16:29:24 +00:00
|
|
|
#define class_get_instance_method(CLASSPOINTER, SEL) \
|
|
|
|
class_getInstanceMethod(CLASSPOINTER, SEL)
|
|
|
|
#define class_get_class_method(CLASSPOINTER, SEL) \
|
|
|
|
class_getClassMethod(CLASSPOINTER, SEL)
|
|
|
|
#define class_get_class_name(CLASSPOINTER) \
|
|
|
|
(((struct objc_class*)(CLASSPOINTER))->name)
|
|
|
|
#define method_get_sizeof_arguments(METHOD) \
|
|
|
|
method_getSizeOfArguments(METHOD)
|
|
|
|
#define objc_lookup_class(CLASSNAME) \
|
|
|
|
objc_lookUpClass(CLASSNAME)
|
|
|
|
#define sel_get_any_uid(SELNAME) \
|
|
|
|
sel_getUid(SELNAME)
|
|
|
|
#define object_get_class(OBJECT) \
|
|
|
|
(((struct objc_class*)(OBJECT))->isa)
|
|
|
|
#define class_get_super_class(CLASSPOINTER) \
|
|
|
|
(((struct objc_class*)(CLASSPOINTER))->super_class)
|
|
|
|
#define objc_get_class(CLASSNAME) \
|
|
|
|
objc_lookUpClass(CLASSNAME) /* not exactly right */
|
|
|
|
#define class_get_version(CLASSPOINTER) \
|
|
|
|
(((struct objc_class*)(CLASSPOINTER))->version)
|
|
|
|
#define __objc_responds_to(OBJECT,SEL) \
|
|
|
|
class_getInstanceMethod(object_get_class(OBJECT), SEL)
|
1994-11-14 15:58:43 +00:00
|
|
|
#define CLS_ISCLASS(CLASSPOINTER) \
|
|
|
|
((((struct objc_class*)(CLASSPOINTER))->info) & CLS_CLASS)
|
1994-11-04 16:29:24 +00:00
|
|
|
#define CLS_ISMETA(CLASSPOINTER) \
|
|
|
|
((((struct objc_class*)(CLASSPOINTER))->info) & CLS_META)
|
|
|
|
#define objc_msg_lookup(OBJ,SEL) \
|
|
|
|
(class_getInstanceMethod(object_get_class(OBJ), SEL)->method_imp)
|
|
|
|
|
|
|
|
#define OBJC_READONLY 1
|
|
|
|
#define OBJC_WRITEONLY 2
|
|
|
|
|
2001-04-12 21:09:17 +00:00
|
|
|
/*
|
|
|
|
** Standard functions for memory allocation and disposal.
|
|
|
|
** Users should use these functions in their ObjC programs so
|
|
|
|
** that they work properly with garbage collectors as well as
|
|
|
|
** can take advantage of the exception/error handling available.
|
|
|
|
*/
|
|
|
|
void *
|
|
|
|
objc_malloc(size_t size);
|
|
|
|
|
|
|
|
void *
|
|
|
|
objc_atomic_malloc(size_t size);
|
|
|
|
|
|
|
|
void *
|
|
|
|
objc_valloc(size_t size);
|
|
|
|
|
|
|
|
void *
|
|
|
|
objc_realloc(void *mem, size_t size);
|
|
|
|
|
|
|
|
void *
|
|
|
|
objc_calloc(size_t nelem, size_t size);
|
|
|
|
|
|
|
|
void
|
|
|
|
objc_free(void *mem);
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Hook functions for memory allocation and disposal.
|
|
|
|
** This makes it easy to substitute garbage collection systems
|
|
|
|
** such as Boehm's GC by assigning these function pointers
|
|
|
|
** to the GC's allocation routines. By default these point
|
|
|
|
** to the ANSI standard malloc, realloc, free, etc.
|
|
|
|
**
|
|
|
|
** Users should call the normal objc routines above for
|
|
|
|
** memory allocation and disposal within their programs.
|
|
|
|
*/
|
|
|
|
objc_EXPORT void *(*_objc_malloc)(size_t);
|
|
|
|
objc_EXPORT void *(*_objc_atomic_malloc)(size_t);
|
|
|
|
objc_EXPORT void *(*_objc_valloc)(size_t);
|
|
|
|
objc_EXPORT void *(*_objc_realloc)(void *, size_t);
|
|
|
|
objc_EXPORT void *(*_objc_calloc)(size_t, size_t);
|
|
|
|
objc_EXPORT void (*_objc_free)(void *);
|
|
|
|
|
2001-04-10 22:18:36 +00:00
|
|
|
#endif /* NeXT_RUNTIME */
|
1994-11-04 16:29:24 +00:00
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#endif /* __objc_gnu2next_h_GNUSTEP_BASE_INCLUDE */
|