]> git.saurik.com Git - apple/objc4.git/blob - runtime/objc.h
objc4-235.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
60 #if !defined(STRICT_OPENSTEP)
61
62 typedef char *STR;
63
64 OBJC_EXPORT BOOL sel_isMapped(SEL sel);
65 OBJC_EXPORT const char *sel_getName(SEL sel);
66 OBJC_EXPORT SEL sel_getUid(const char *str);
67 OBJC_EXPORT SEL sel_registerName(const char *str);
68 OBJC_EXPORT const char *object_getClassName(id obj);
69 OBJC_EXPORT void *object_getIndexedIvars(id obj);
70
71 #define ISSELECTOR(sel) sel_isMapped(sel)
72 #define SELNAME(sel) sel_getName(sel)
73 #define SELUID(str) sel_getUid(str)
74 #define NAMEOF(obj) object_getClassName(obj)
75 #define IV(obj) object_getIndexedIvars(obj)
76
77 #if defined(__osf__) && defined(__alpha__)
78 typedef long arith_t;
79 typedef unsigned long uarith_t;
80 # define ARITH_SHIFT 32
81 #else
82 typedef int arith_t;
83 typedef unsigned uarith_t;
84 # define ARITH_SHIFT 16
85 #endif
86
87 #endif /* !STRICT_OPENSTEP */
88
89 #endif /* _OBJC_OBJC_H_ */