]> git.saurik.com Git - apple/objc4.git/blob - runtime/objc.h
objc4-437.1.tar.gz
[apple/objc4.git] / runtime / objc.h
1 /*
2 * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * objc.h
25 * Copyright 1988-1996, NeXT Software, Inc.
26 */
27
28 #ifndef _OBJC_OBJC_H_
29 #define _OBJC_OBJC_H_
30
31 #include <sys/types.h> // for __DARWIN_NULL
32 #include <objc/objc-api.h>
33
34
35 typedef struct objc_class *Class;
36 typedef struct objc_object {
37 Class isa;
38 } *id;
39
40
41 typedef struct objc_selector *SEL;
42 typedef id (*IMP)(id, SEL, ...);
43 typedef signed char BOOL;
44 // BOOL is explicitly signed so @encode(BOOL) == "c" rather than "C"
45 // even if -funsigned-char is used.
46 #define OBJC_BOOL_DEFINED
47
48
49 #define YES (BOOL)1
50 #define NO (BOOL)0
51
52 #ifndef Nil
53 #define Nil __DARWIN_NULL /* id of Nil class */
54 #endif
55
56 #ifndef nil
57 #define nil __DARWIN_NULL /* id of Nil instance */
58 #endif
59
60 #ifndef __OBJC_GC__
61 #define __strong /* empty */
62 #endif
63
64 OBJC_EXPORT const char *sel_getName(SEL sel);
65 OBJC_EXPORT SEL sel_registerName(const char *str);
66 OBJC_EXPORT const char *object_getClassName(id obj);
67 OBJC_EXPORT void *object_getIndexedIvars(id obj);
68
69
70 #if !__OBJC2__
71
72 // The following declarations are provided here for source compatibility.
73
74 #if defined(__LP64__)
75 typedef long arith_t;
76 typedef unsigned long uarith_t;
77 # define ARITH_SHIFT 32
78 #else
79 typedef int arith_t;
80 typedef unsigned uarith_t;
81 # define ARITH_SHIFT 16
82 #endif
83
84 OBJC_EXPORT BOOL sel_isMapped(SEL sel);
85 OBJC_EXPORT SEL sel_getUid(const char *str);
86
87 typedef char *STR;
88
89 #define ISSELECTOR(sel) sel_isMapped(sel)
90 #define SELNAME(sel) sel_getName(sel)
91 #define SELUID(str) sel_getUid(str)
92 #define NAMEOF(obj) object_getClassName(obj)
93 #define IV(obj) object_getIndexedIvars(obj)
94
95 #endif
96
97 #endif /* _OBJC_OBJC_H_ */