]> gcc.gnu.org Git - gcc.git/blame - libobjc/objc/objc.h
re PR objc/6107 (sparc-sun-solaris2.7 gcc-3.1 extra objc testsuite failures w/-m64)
[gcc.git] / libobjc / objc / objc.h
CommitLineData
88e17b57
BE
1/* Basic data types for Objective C.
2 Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
21/* As a special exception, if you link this library with files
22 compiled with GCC to produce an executable, this does not cause
23 the resulting executable to be covered by the GNU General Public License.
24 This exception does not however invalidate any other reasons why
25 the executable file might be covered by the GNU General Public License. */
26
27#ifndef __objc_INCLUDE_GNU
28#define __objc_INCLUDE_GNU
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include <stddef.h>
35
36/*
37** Definition of the boolean type.
38*/
39#ifdef __vxworks
40typedef int BOOL;
41#else
42typedef unsigned char BOOL;
43#endif
44#define YES (BOOL)1
45#define NO (BOOL)0
46
47/*
48** Definition of a selector. Selectors themselves are not unique, but
49** the sel_id is a unique identifier.
50*/
51typedef const struct objc_selector
52{
53 void *sel_id;
54 const char *sel_types;
55} *SEL;
56
57inline static BOOL
58sel_eq (SEL s1, SEL s2)
59{
60 if (s1 == 0 || s2 == 0)
61 return s1 == s2;
62 else
63 return s1->sel_id == s2->sel_id;
64}
65
66
67/*
68** ObjC uses this typedef for untyped instances.
69*/
70typedef struct objc_object {
71 struct objc_class* class_pointer;
72} *id;
73
74/*
75** Definition of method type. When retrieving the implementation of a
76** method, this is type of the pointer returned
77*/
78typedef id (*IMP)(id, SEL, ...);
79
80/*
81** More simple types...
82*/
83#define nil (id)0 /* id of Nil instance */
84#define Nil (Class)0 /* id of Nil class */
85typedef char *STR; /* String alias */
86
87/*
88** The compiler generates one of these structures for each class.
89**
90** This structure is the definition for classes.
91**
92** This structure is generated by the compiler in the executable and used by
93** the run-time during normal messaging operations. Therefore some members
94** change type. The compiler generates "char* const" and places a string in
95** the following member variables: super_class.
96*/
97typedef struct objc_class *MetaClass;
98typedef struct objc_class *Class;
99struct objc_class {
100 MetaClass class_pointer; /* Pointer to the class's
101 meta class. */
102 struct objc_class* super_class; /* Pointer to the super
103 class. NULL for class
104 Object. */
105 const char* name; /* Name of the class. */
106 long version; /* Unknown. */
107 unsigned long info; /* Bit mask. See class masks
108 defined above. */
109 long instance_size; /* Size in bytes of the class.
110 The sum of the class
111 definition and all super
112 class definitions. */
113 struct objc_ivar_list* ivars; /* Pointer to a structure that
114 describes the instance
115 variables in the class
116 definition. NULL indicates
117 no instance variables. Does
118 not include super class
119 variables. */
120 struct objc_method_list* methods; /* Linked list of instance
121 methods defined for the
122 class. */
123 struct sarray * dtable; /* Pointer to instance
124 method dispatch table. */
125 struct objc_class* subclass_list; /* Subclasses */
126 struct objc_class* sibling_class;
127
128 struct objc_protocol_list *protocols; /* Protocols conformed to */
129 void* gc_object_type;
130};
131
132#ifndef __OBJC__
133typedef struct objc_protocol {
134 struct objc_class* class_pointer;
135 char *protocol_name;
136 struct objc_protocol_list *protocol_list;
137 struct objc_method_description_list *instance_methods, *class_methods;
138} Protocol;
139
140#else /* __OBJC__ */
141@class Protocol;
142#endif
143
144typedef void* retval_t; /* return value */
145typedef void(*apply_t)(void); /* function pointer */
146typedef union {
147 char *arg_ptr;
148 char arg_regs[sizeof (char*)];
149} *arglist_t; /* argument frame */
150
151
152IMP objc_msg_lookup(id receiver, SEL op);
153
154#ifdef __cplusplus
155}
156#endif
157
158#endif /* not __objc_INCLUDE_GNU */
This page took 0.253859 seconds and 5 git commands to generate.