(all insn and peephole patterns): Rewrite without using arm_output_asm_insn.
[official-gcc.git] / gcc / objc / objc.h
bloba777a9f90b576ce5a01adf3fb0cea5a58fe76f42
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)
9 any later version.
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
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 #include <stddef.h>
36 ** Definition of the boolean type.
38 typedef char BOOL;
39 #define YES (BOOL)1
40 #define NO (BOOL)0
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.
48 typedef void* SEL;
51 ** ObjC uses this typedef for untyped instances.
53 typedef struct objc_object {
54 struct objc_class* class_pointer;
55 } *id;
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.
72 **
73 ** This structure is the definition for classes.
74 **
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;
82 struct objc_class {
83 MetaClass* class_pointer; /* Pointer to the class's
84 meta class. */
85 struct objc_class* super_class; /* Pointer to the super
86 class. NULL for class
87 Object. */
88 const char* name; /* Name of the class. */
89 long version; /* Unknown. */
90 unsigned long info; /* Bit mask. See class masks
91 defined above. */
92 long instance_size; /* Size in bytes of the class.
93 The sum of the class definition
94 and all super class
95 definitions. */
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
102 variables. */
103 struct objc_method_list* methods; /* Linked list of instance
104 methods defined for the
105 class. */
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 */
114 #ifndef __OBJC__
115 typedef struct objc_protocol {
116 struct objc_class* class_pointer;
117 char *protocol_name;
118 struct objc_protocol_list *protocol_list;
119 struct objc_method_description_list *instance_methods, *class_methods;
120 } Protocol;
122 #else /* __OBJC__ */
123 @class Protocol;
124 #endif
126 typedef void* retval_t; /* return value */
127 typedef void(*apply_t)(void); /* function pointer */
128 typedef union {
129 char *arg_ptr;
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
140 too nil.
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)
152 if(receiver)
153 return sarray_get(receiver->class_pointer->dtable, (size_t)(op));
154 else
155 return nil_method;
158 #else
160 IMP objc_msg_lookup(id receiver, SEL op);
162 #endif
164 #ifdef __cplusplus
166 #endif
168 #endif /* not __objc_INCLUDE_GNU */