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