1 /* Basic data types for Objective C.
2 Copyright (C) 1993 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 /* As a special exception, if you link this library with files
21 compiled with GCC to produce an executable, this does not cause
22 the resulting executable to be covered by the GNU General Public License.
23 This exception does not however invalidate any other reasons why
24 the executable file might be covered by the GNU General Public License. */
26 #ifndef __objc_INCLUDE_GNU
27 #define __objc_INCLUDE_GNU
36 ** Definition of the boolean type.
43 ** Definition of a selector. Selectors are really of type unsigned int.
44 ** The runtime does this mapping from SEL's to names internally in the
45 ** sel_... operations. You should never use the fact that it is actually
46 ** an integer, since other Objective-C implementations use other conventions.
51 ** ObjC uses this typedef for untyped instances.
53 typedef struct objc_object
{
54 struct objc_class
* class_pointer
;
58 ** Definition of method type. When retrieving the implementation of a
59 ** method, this is type of the pointer returned
61 typedef id (*IMP
)(id
, SEL
, ...);
64 ** More simple types...
66 #define nil (id)0 /* id of Nil instance */
67 #define Nil (Class*)0 /* id of Nil class */
68 typedef char *STR
; /* String alias */
71 ** The compiler generates one of these structures for each class.
73 ** This structure is the definition for classes.
75 ** This structure is generated by the compiler in the executable and used by
76 ** the run-time during normal messaging operations. Therefore some members
77 ** change type. The compiler generates "char* const" and places a string in
78 ** the following member variables: super_class.
80 typedef struct objc_class MetaClass
;
81 typedef struct objc_class Class
;
83 MetaClass
* class_pointer
; /* Pointer to the class's
85 struct objc_class
* super_class
; /* Pointer to the super
88 const char* name
; /* Name of the class. */
89 long version
; /* Unknown. */
90 unsigned long info
; /* Bit mask. See class masks
92 long instance_size
; /* Size in bytes of the class.
93 The sum of the class definition
96 struct objc_ivar_list
* ivars
; /* Pointer to a structure that
97 describes the instance
98 variables in the class
99 definition. NULL indicates
100 no instance variables. Does
101 not include super class
103 struct objc_method_list
* methods
; /* Linked list of instance
104 methods defined for the
106 struct sarray
* dtable
; /* Pointer to instance
107 method dispatch table. */
108 struct objc_class
* subclass_list
; /* Subclasses */
109 struct objc_class
* sibling_class
;
111 struct objc_protocol_list
*protocols
; /* Protocols conformed to */
115 typedef struct objc_protocol
{
116 struct objc_class
* class_pointer
;
118 struct objc_protocol_list
*protocol_list
;
119 struct objc_method_description_list
*instance_methods
, *class_methods
;
126 typedef void* retval_t
; /* return value */
127 typedef void(*apply_t
)(void); /* function pointer */
130 char arg_regs
[sizeof (char*)];
131 } *arglist_t
; /* argument frame */
134 #if defined(__OBJC__)
135 #include "objc/sarray.h"
138 This is the function called when messages are send to nil. You may
139 set a breakpoint in your debugger at this function to catch messages
142 extern id
nil_method(id rcv
, SEL op
, ...);
145 The messager is inlined, thus it is defined here directly. The
146 inlining is quite time-consuming when optimizing. This will be
147 taken care of later by hand-coding the messager in the compiler.
149 extern __inline__ IMP
150 objc_msg_lookup(id receiver
, SEL op
)
153 return sarray_get(receiver
->class_pointer
->dtable
, (size_t)(op
));
160 IMP
objc_msg_lookup(id receiver
, SEL op
);
168 #endif /* not __objc_INCLUDE_GNU */