| 1 | /* Basic data types for Objective C.
|
|---|
| 2 | Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
|
|---|
| 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, 59 Temple Place - Suite 330,
|
|---|
| 19 | Boston, 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
|
|---|
| 31 | extern "C" {
|
|---|
| 32 | #endif
|
|---|
| 33 |
|
|---|
| 34 | #include <stddef.h>
|
|---|
| 35 |
|
|---|
| 36 | /*
|
|---|
| 37 | ** Definition of the boolean type.
|
|---|
| 38 | */
|
|---|
| 39 | #ifdef __vxworks
|
|---|
| 40 | typedef int BOOL;
|
|---|
| 41 | #else
|
|---|
| 42 | typedef 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 | */
|
|---|
| 51 | typedef const struct objc_selector
|
|---|
| 52 | {
|
|---|
| 53 | void *sel_id;
|
|---|
| 54 | const char *sel_types;
|
|---|
| 55 | } *SEL;
|
|---|
| 56 |
|
|---|
| 57 | inline static BOOL
|
|---|
| 58 | sel_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 | */
|
|---|
| 70 | typedef 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 | */
|
|---|
| 78 | typedef 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 */
|
|---|
| 85 | typedef char *STR; /* String alias */
|
|---|
| 86 |
|
|---|
|
|---|