|
|
1.1 root 1: /* Basic data types for Objective C.
1.1.1.2 root 2: Copyright (C) 1993 Free Software Foundation, Inc.
1.1 root 3:
4: This file is part of GNU CC.
5:
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.
10:
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.
15:
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. */
19:
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. */
25:
26: #ifndef __objc_INCLUDE_GNU
27: #define __objc_INCLUDE_GNU
28:
29: #ifdef __cplusplus
30: extern "C" {
31: #endif
32:
1.1.1.4 ! root 33: #include <stddef.h>
1.1 root 34:
1.1.1.2 root 35: /*
36: ** Definition of the boolean type.
37: */
1.1.1.4 ! root 38: typedef unsigned char BOOL;
1.1 root 39: #define YES (BOOL)1
40: #define NO (BOOL)0
41:
1.1.1.2 root 42: /*
1.1.1.4 ! root 43: ** Definition of a selector. Selectors themselves are not unique, but
! 44: ** the sel_id is a unique identifier.
1.1.1.2 root 45: */
1.1.1.4 ! root 46: typedef const struct objc_selector
! 47: {
! 48: void *sel_id;
! 49: const char *sel_types;
! 50: } *SEL;
! 51:
! 52: inline static BOOL
! 53: sel_eq (SEL s1, SEL s2)
! 54: {
! 55: if (s1 == 0 || s2 == 0)
! 56: return s1 == s2;
! 57: else
! 58: return s1->sel_id == s2->sel_id;
! 59: }
! 60:
1.1 root 61:
1.1.1.2 root 62: /*
63: ** ObjC uses this typedef for untyped instances.
64: */
1.1 root 65: typedef struct objc_object {
66: struct objc_class* class_pointer;
67: } *id;
68:
69: /*
1.1.1.2 root 70: ** Definition of method type. When retrieving the implementation of a
71: ** method, this is type of the pointer returned
72: */
73: typedef id (*IMP)(id, SEL, ...);
1.1 root 74:
75: /*
1.1.1.2 root 76: ** More simple types...
77: */
78: #define nil (id)0 /* id of Nil instance */
79: #define Nil (Class*)0 /* id of Nil class */
80: typedef char *STR; /* String alias */
1.1 root 81:
82: /*
1.1.1.2 root 83: ** The compiler generates one of these structures for each class.
84: **
85: ** This structure is the definition for classes.
86: **
87: ** This structure is generated by the compiler in the executable and used by
88: ** the run-time during normal messaging operations. Therefore some members
89: ** change type. The compiler generates "char* const" and places a string in
90: ** the following member variables: super_class.
91: */
92: typedef struct objc_class MetaClass;
93: typedef struct objc_class Class;
94: struct objc_class {
95: MetaClass* class_pointer; /* Pointer to the class's
1.1 root 96: meta class. */
97: struct objc_class* super_class; /* Pointer to the super
98: class. NULL for class
99: Object. */
100: const char* name; /* Name of the class. */
101: long version; /* Unknown. */
1.1.1.2 root 102: unsigned long info; /* Bit mask. See class masks
1.1 root 103: defined above. */
104: long instance_size; /* Size in bytes of the class.
105: The sum of the class definition
106: and all super class
107: definitions. */
1.1.1.2 root 108: struct objc_ivar_list* ivars; /* Pointer to a structure that
1.1 root 109: describes the instance
110: variables in the class
111: definition. NULL indicates
112: no instance variables. Does
113: not include super class
114: variables. */
1.1.1.2 root 115: struct objc_method_list* methods; /* Linked list of instance
1.1 root 116: methods defined for the
117: class. */
1.1.1.2 root 118: struct sarray * dtable; /* Pointer to instance
119: method dispatch table. */
120: struct objc_class* subclass_list; /* Subclasses */
121: struct objc_class* sibling_class;
122:
123: struct objc_protocol_list *protocols; /* Protocols conformed to */
124: };
125:
126: #ifndef __OBJC__
127: typedef struct objc_protocol {
128: struct objc_class* class_pointer;
129: char *protocol_name;
130: struct objc_protocol_list *protocol_list;
131: struct objc_method_description_list *instance_methods, *class_methods;
132: } Protocol;
1.1 root 133:
1.1.1.3 root 134: #else /* __OBJC__ */
1.1.1.2 root 135: @class Protocol;
136: #endif
1.1 root 137:
1.1.1.2 root 138: typedef void* retval_t; /* return value */
139: typedef void(*apply_t)(void); /* function pointer */
1.1.1.3 root 140: typedef union {
141: char *arg_ptr;
142: char arg_regs[sizeof (char*)];
143: } *arglist_t; /* argument frame */
1.1 root 144:
1.1.1.2 root 145:
146: IMP objc_msg_lookup(id receiver, SEL op);
147:
148: #ifdef __cplusplus
149: }
150: #endif
1.1 root 151:
152: #endif /* not __objc_INCLUDE_GNU */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.