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