OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [encode-7-next-64bit.m] - Blame information for rev 797

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Additional testing for the NeXT runtime. Encoding in -m64 mode  */
2
 
3
/* { dg-do run { target *-*-darwin* } } */
4
/* { dg-require-effective-target lp64 } */
5
/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
6
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
7
 
8
#include <stdbool.h>
9
#include <string.h>
10
#include <stdlib.h>
11
#include <objc/Object.h>
12
#include "../objc-obj-c++-shared/runtime.h"
13
 
14
#define CHECK_IF(E) if (!(E)) abort ()
15
 
16
@class NSDictionary, NSFont, NSError, _NSATSTypesetterGuts, NSString, NSMenu, NSArray;
17
 
18
typedef unsigned char UInt8;
19
typedef const signed long OSStatus;
20
typedef unsigned long CFIndex;
21
typedef unsigned int UInt32;
22
typedef UInt32 FourCharCode;
23
typedef FourCharCode OSType;
24
 
25
struct FSRef {
26
  UInt8 hidden[80];
27
};
28
typedef struct FSRef FSRef;
29
 
30
typedef struct _NSPoint {
31
    float x;
32
    float y;
33
} NSPoint;
34
 
35
typedef struct _NSSize {
36
    float width;
37
    float height;
38
} NSSize;
39
 
40
typedef struct _NSRect {
41
    NSPoint origin;
42
    NSSize size;
43
} NSRect;
44
 
45
typedef struct _NSRange {
46
    unsigned int location;
47
    unsigned int length;
48
} NSRange;
49
 
50
typedef const char *NXAtom;
51
 
52
typedef struct {
53
  NSDictionary *_attributes;
54
  NSFont *_font;
55
  CFIndex _characterLength;
56
  CFIndex _nominalGlyphLocation;
57
  const CFIndex *p;
58
  float _defaultLineHeight;
59
  float _defaultBaselineOffset;
60
  float _horizExpansion;
61
  float _baselineDelta;
62
  NSRect _attachmentBBox;
63
  long ll, *llp;
64
  unsigned long ull, *ullp;
65
  id a;
66
  const id a1;
67
  const struct objc_object *a2;
68
  SEL b;
69
  const SEL b1;
70
  const struct objc_selector *b2;
71
  const char *str1;
72
  char *str2;
73
  char *const str3;
74
  const char *const str4;
75
  struct {
76
    unsigned int _isAttachmentRun:1;
77
    unsigned int _hasPositionalStake:1;
78
    unsigned int _isDefaultFace:1;
79
    unsigned int _hasCombiningMarks:1;
80
    unsigned int _isScreenFont:1;
81
    unsigned int _reserved:27;
82
  } _rFlags;
83
} NSATSGlyphStorageRun;
84
 
85
typedef struct __CFSet *CFMutableSetRef;
86
typedef const struct __CTLine * CTLineRef;
87
typedef const struct __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID;
88
 
89
struct ComponentInstanceRecord {
90
  long data[1];
91
};
92
typedef struct ComponentInstanceRecord  ComponentInstanceRecord;
93
typedef ComponentInstanceRecord *ComponentInstance;
94
 
95
typedef NSString *(*NSErrorUserInfoFormatterFunc)(id objToBeDisplayed, NSError *err, char modifier);
96
typedef struct {
97
  NSErrorUserInfoFormatterFunc formatterFunc;
98
  NSString *userInfoKey;
99
  unsigned int parameterMask;
100
} NSErrorUserInfoFormatter;
101
 
102
typedef Object MyObj;
103
typedef Object *MyPtr;
104
 
105
@interface Foo: Object {
106
  NSATSGlyphStorageRun r;
107
}
108
- (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2
109
  reading:(BOOL)inReadingNotWriting;
110
- (const NSATSGlyphStorageRun *)_attributeRunForCharacterAtIndex:(const CFIndex)charIndex;
111
- (const _NSATSTypesetterGuts *)_getATSTypesetterGuts:(const struct objc_selector *)sel;
112
- (void)resumeWithSuspensionID:(NSAppleEventManagerSuspensionID)suspensionID and:(const CFIndex *)status;
113
- (const id)anotherMeth:(const SEL)sel and:(const Foo *)foo and:(const struct objc_object *)obj;
114
- (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4;
115
- (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4;
116
- (in const char *)sel1:(const SEL)sel1 id1:(const id)id1;
117
- (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3;
118
+ (ComponentInstance)_defaultScriptingComponent;
119
- (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters
120
  applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters;
121
- (NSErrorUserInfoFormatter *)formatter_func:(id)obj run:(const NSATSGlyphStorageRun **)run;
122
- (BOOL)_forgetWord:(bycopy in NSString *)word inDictionary:(bycopy in NSString *)language;
123
- (void)_registerServicesMenu:(NSMenu *)servicesMenu withSendTypes:(const NXAtom *)sendTypes
124
  andReturnTypes:(const NXAtom *)returnTypes addToList:(BOOL)addToList;
125
+ (CFMutableSetRef *)_proxySharePointer;
126
- (NSRange)_checkGrammarInString:(in NSString *)stringToCheck language:(bycopy in NSString *)language details:(bycopy out NSArray **)details;
127
- (bool)_resolvePositionalStakeGlyphsForLineFragment:(CTLineRef)line lineFragmentRect:(NSRect)lineFragmentRect
128
  minPosition:(float)minPosition maxPosition:(float)maxPosition maxLineFragmentWidth:(float)maxLineFragmentWidth
129
  breakHint:(CFIndex *)charIndex;
130
+ (BOOL)findVoiceByIdentifier:(NSString *)identifier returningCreator:(OSType *)returnedCreator returningID:(OSType *)returnedID;
131
@end
132
 
133
NSRange globalRange;
134
 
135
@implementation Foo
136
- (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2
137
  reading:(BOOL)inReadingNotWriting {
138
  return (NSError *)self;
139
}
140
- (const NSATSGlyphStorageRun *)_attributeRunForCharacterAtIndex:(CFIndex)charIndex {
141
  return (const NSATSGlyphStorageRun *)self;
142
}
143
- (const _NSATSTypesetterGuts *)_getATSTypesetterGuts:(const struct objc_selector *)sel {
144
  return (const _NSATSTypesetterGuts *)self;
145
}
146
- (void)resumeWithSuspensionID:(NSAppleEventManagerSuspensionID)suspensionID and:(const CFIndex *)status {
147
}
148
- (const id)anotherMeth:(const SEL)sel and:(const Foo *)foo and:(const struct objc_object *)obj {
149
  return (const id)self;
150
}
151
- (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4 {
152
  return self;
153
}
154
- (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4 {
155
}
156
- (in const char *)sel1:(const SEL)sel1 id1:(const id)id1 {
157
  return "Hello";
158
}
159
- (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3 {
160
  return self;
161
}
162
+ (ComponentInstance)_defaultScriptingComponent {
163
  return (ComponentInstance)0;
164
}
165
- (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters
166
  applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters {
167
  return (NSString *)self;
168
}
169
- (NSErrorUserInfoFormatter *)formatter_func:(id)obj run:(const NSATSGlyphStorageRun **)run {
170
  return (NSErrorUserInfoFormatter *)0;
171
}
172
- (BOOL)_forgetWord:(bycopy in NSString *)word inDictionary:(bycopy in NSString *)language {
173
  return YES;
174
}
175
- (void)_registerServicesMenu:(NSMenu *)servicesMenu withSendTypes:(const NXAtom *)sendTypes
176
  andReturnTypes:(const NXAtom *)returnTypes addToList:(BOOL)addToList {
177
}
178
+ (CFMutableSetRef *)_proxySharePointer {
179
  return (CFMutableSetRef *)0;
180
}
181
- (NSRange)_checkGrammarInString:(in NSString *)stringToCheck language:(bycopy in NSString *)language details:(bycopy out NSArray **)details {
182
  return globalRange;
183
}
184
- (bool)_resolvePositionalStakeGlyphsForLineFragment:(CTLineRef)line lineFragmentRect:(NSRect)lineFragmentRect
185
  minPosition:(float)minPosition maxPosition:(float)maxPosition maxLineFragmentWidth:(float)maxLineFragmentWidth
186
  breakHint:(CFIndex *)charIndex {
187
  return false;
188
}
189
+ (BOOL)findVoiceByIdentifier:(NSString *)identifier returningCreator:(OSType *)returnedCreator returningID:(OSType *)returnedID {
190
  return NO;
191
}
192
@end
193
 
194
int main(void) {
195
  Class fooClass = objc_getClass ("Foo");
196
  Method meth;
197
  Ivar *ivars;
198
  unsigned int ivar_count;
199
  Ivar ivar;
200
 
201
  meth = class_getInstanceMethod (fooClass, @selector(_errorWithOSStatus:ref1:ref2:reading:));
202
  CHECK_IF (!strcmp (method_getTypeEncoding(meth), "@44@0:8q16r^{FSRef=[80C]}24r^{FSRef=[80C]}32c40"));
203
 
204
  meth = class_getInstanceMethod (fooClass, @selector(_attributeRunForCharacterAtIndex:));
205
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "r^{?=@@QQ^Qffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}q^qQ^Q@@@:::****{?=b1b1b1b1b1b27}}24@0:8Q16"));
206
 
207
  meth = class_getInstanceMethod (fooClass, @selector(_getATSTypesetterGuts:));
208
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "r@24@0:8r:16"));
209
 
210
  meth = class_getInstanceMethod (fooClass, @selector(resumeWithSuspensionID:and:));
211
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "v32@0:8^{__NSAppleEventManagerSuspension=}16r^Q24"));
212
 
213
  meth = class_getInstanceMethod (fooClass, @selector(anotherMeth:and:and:));
214
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "r@40@0:8r:16r@24r@32"));
215
 
216
  meth = class_getInstanceMethod (fooClass, @selector(str1:str2:str3:str4:));
217
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "@48@0:8r*16*24*32r*40"));
218
 
219
  meth = class_getInstanceMethod (fooClass, @selector(foo1:foo2:foo3:foo4:));
220
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "Vv48@0:8@16r@24@32r@40"));
221
 
222
  meth = class_getInstanceMethod (fooClass, @selector(sel1:id1:));
223
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "rn*32@0:8r:16r@24"));
224
 
225
  meth = class_getInstanceMethod (fooClass, @selector(obj1:obj2:obj3:));
226
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "N@40@0:8r@16@24^{Object=#}32"));
227
 
228
  meth = class_getClassMethod (fooClass, @selector(_defaultScriptingComponent));
229
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "^{ComponentInstanceRecord=[1q]}16@0:8"));
230
 
231
  meth = class_getInstanceMethod (fooClass, @selector(_formatCocoaErrorString:parameters:applicableFormatters:count:));
232
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "@44@0:8@16r*24^^{?}32i40"));
233
 
234
  meth = class_getInstanceMethod (fooClass, @selector(formatter_func:run:));
235
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "^{?=^?@I}32@0:8@16r^^{?}24"));
236
 
237
  meth = class_getInstanceMethod (fooClass, @selector(_forgetWord:inDictionary:));
238
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "c32@0:8nO@16nO@24"));
239
 
240
  meth = class_getInstanceMethod (fooClass, @selector(_registerServicesMenu:withSendTypes:andReturnTypes:addToList:));
241
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "v44@0:8@16r^*24r^*32c40"));
242
 
243
  meth = class_getClassMethod (fooClass, @selector(_proxySharePointer));
244
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "^^{__CFSet}16@0:8"));
245
 
246
  meth = class_getInstanceMethod (fooClass, @selector(_checkGrammarInString:language:details:));
247
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "{_NSRange=II}40@0:8n@16nO@24oO^@32"));
248
 
249
  meth = class_getInstanceMethod (fooClass, @selector(_resolvePositionalStakeGlyphsForLineFragment:lineFragmentRect:minPosition:maxPosition:maxLineFragmentWidth:breakHint:));
250
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "B60@0:8^{__CTLine=}16{_NSRect={_NSPoint=ff}{_NSSize=ff}}24f40f44f48^Q52"));
251
 
252
  meth = class_getClassMethod (fooClass, @selector(findVoiceByIdentifier:returningCreator:returningID:));
253
  CHECK_IF (!strcmp (method_getTypeEncoding (meth), "c40@0:8@16^I24^I32"));
254
 
255
  ivars = class_copyIvarList (fooClass, &ivar_count);
256
  CHECK_IF (ivar_count == 1);
257
 
258
  ivar = ivars[0];
259
  CHECK_IF (!strcmp (ivar_getName(ivar), "r"));
260
  CHECK_IF (!strcmp (ivar_getTypeEncoding(ivar),
261
   "{?=\"_attributes\"@\"NSDictionary\"\"_font\"@\"NSFont\"\"_characterLength\""
262
    "Q\"_nominalGlyphLocation\"Q\"p\"^Q\"_defaultLineHeight\"f\"_defaultBaselineOffset\""
263
    "f\"_horizExpansion\"f\"_baselineDelta\"f\"_attachmentBBox\"{_NSRect=\"origin\""
264
    "{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}\"ll\"q\"llp\"^q\"ull\""
265
    "Q\"ullp\"^Q\"a\"@\"a1\"@\"a2\"@\"b\":\"b1\":\"b2\":\"str1\"*\"str2\"*\"str3\"*\"str4\""
266
    "*\"_rFlags\"{?=\"_isAttachmentRun\"b1\"_hasPositionalStake\"b1\"_isDefaultFace\""
267
    "b1\"_hasCombiningMarks\"b1\"_isScreenFont\"b1\"_reserved\"b27}}"));
268
 
269
  return 0;
270
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.