summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc-obj-c++-shared/Object1.h
blob: 293d0468ff7abd4e397c80da230808c551d884d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/* Compatibility code between APIs and ABIs for the objc test suite.
   Copyright (C) 2010, 2011 Free Software Foundation, Inc.
   Contributed by Iain Sandoe 

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.

GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */

/* 
 * Compatibility header.
 *
 * Four cases:
 *   GNU 
 *      Uses the 'old' Object with API and ABI = 0.
 *      Compatibility methods are added.
 *   NeXT pre-Darwin9
 *      Uses the 'old' Object with API and ABI = 0.
 *   NeXT Darwin >= 9 with no implementation of ABI 2
 *      Uses API 2 and ABI 0 for m32, uses the 'old' Object'
 *      Uses API 2 for m64 but only compile tests can be expected to work.
 *   NeXT Darwin >= 9 with __OBJC2__
 *      Uses API 2 and ABI 0 for m32, uses the 'old' Object'
 *      Uses API 2 and ABI 2 - the libobjc implementation of Object is very
 *      basic, and we add a category to expand this for test-suite use.
 */
#ifndef _OBJC_OBJECT1_H_
#define _OBJC_OBJECT1_H_

#ifndef __NEXT_RUNTIME__ 
/* Case 1 = GNU. */
#  include <objc/Object.h>
/* NeXT requires a +initialize (or forward:) method, and it makes testcases more
   readable if the conditional code can be reduced, so we add one to the GNU tests 
   too.  This saves us from having to introduce it every time.  */
@interface Object (TEST_SUITE_ADDITIONS)
+ initialize;
@end

#else /* NeXT */

#  include "next-abi.h"
#  if !defined(NEXT_OBJC_ABI_VERSION) || (NEXT_OBJC_ABI_VERSION < 2)
/* Cases 2, Case 3/m32 and 4/m32 are handled as default.  */
#    include <objc/Object.h>
#  else
#    include <objc/objc.h>

/* This is a cut-down Object with only the methods currently required
   by the testsuite declared.  The implementation is provided in 
   Object1-implementation.h
*/

/* The m64 libobjc implementation of Object provides only the 'class' and
   isEqual: methods.  
   
   We add the others required as a test-suite category. 
   
   Please leave the unimplemented methods as comments - so that they can
   be inserted as required by future tests.  */

@interface Object
{
  Class isa;
}
+ (Class) class;
- (BOOL)isEqual: (id)anObject;
@end

/* Dummy definition.  */
typedef void * marg_list;

@interface Object (TEST_SUITE_ADDITIONS)

+ initialize;
- init;

+ new;
+ free;
- free;
+ alloc;
//- copy;
//+ allocFromZone:(void *)zone;
//- copyFromZone:(void *)zone;
//- (void *)zone;

- (Class) class;
+ (Class) superclass;
//+ (const char *) name;
//- superclass;
- (const char *) name;

//- self;
//- (unsigned int) hash;

/* Testing inheritance relationships */

//- (BOOL) isKindOf: aClassObject;
//- (BOOL) isMemberOf: aClassObject;
//- (BOOL) isKindOfClassNamed: (const char *)aClassName;
//- (BOOL) isMemberOfClassNamed: (const char *)aClassName;

/* Testing class functionality */

//+ (BOOL) instancesRespondTo:(SEL)aSelector;
//- (BOOL) respondsTo:(SEL)aSelector;

/* Testing protocol conformance */

- (BOOL) conformsTo: (Protocol *)aProtocolObject;
//+ (BOOL) conformsTo: (Protocol *)aProtocolObject;

/* Obtaining method descriptors from protocols */

//- (struct objc_method_description *) descriptionForMethod:(SEL)aSel;
//+ (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;

/* Obtaining method handles */

//- (IMP) methodFor:(SEL)aSelector;
//+ (IMP) instanceMethodFor:(SEL)aSelector;

/* Sending messages determined at run time */

//- perform:(SEL)aSelector;
//- perform:(SEL)aSelector with:anObject;
//- perform:(SEL)aSelector with:object1 with:object2;

/* Posing */

//+ poseAs: aClassObject;

/* Enforcing intentions */
 
//- subclassResponsibility:(SEL)aSelector;
//- notImplemented:(SEL)aSelector;

/* Error handling */

//- doesNotRecognize:(SEL)aSelector;
//- error:(const char *)aString, ...;

/* Debugging */

//- (void) printForDebugger:(void *)stream;

/* Archiving */

//- awake;
//- write:(void *)stream;
//- read:(void *)stream;
//+ (int) version;
//+ setVersion: (int) aVersion;

/* Forwarding */

- forward: (SEL)sel : (marg_list)args;
//- performv: (SEL)sel : (marg_list)args;

@end

#    endif /* NeXT case 3 & 4 m64 */
#  endif /* NEXT */
#endif /* _OBJC_OBJECT1_H_ */