1 /* Additional testing for the NeXT runtime. */
2 /* Author: Ziemowit Laski <zlaski@apple.com> */
4 /* { dg-do run { target *-*-darwin* } } */
5 /* { dg-require-effective-target ilp32 } */
6 /* { dg-options "-Wno-deprecated-declarations" } */
7 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
9 #include "../objc-obj-c++-shared/TestsuiteObject.m"
10 #include "../objc-obj-c++-shared/runtime.h"
14 #define CHECK_IF(E) if (!(E)) abort ()
16 @class NSDictionary, NSFont, NSError, _NSATSTypesetterGuts, NSString, NSMenu, NSArray;
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;
28 typedef struct FSRef FSRef;
30 typedef struct _NSPoint {
35 typedef struct _NSSize {
40 typedef struct _NSRect {
45 typedef struct _NSRange {
46 unsigned int location;
50 typedef const char *NXAtom;
53 NSDictionary *_attributes;
55 CFIndex _characterLength;
56 CFIndex _nominalGlyphLocation;
58 float _defaultLineHeight;
59 float _defaultBaselineOffset;
60 float _horizExpansion;
62 NSRect _attachmentBBox;
64 unsigned long ull, *ullp;
67 const struct objc_object *a2;
70 const struct objc_selector *b2;
74 const char *const str4;
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;
83 } NSATSGlyphStorageRun;
85 typedef struct __CFSet *CFMutableSetRef;
86 typedef const struct __CTLine * CTLineRef;
87 typedef const struct __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID;
89 struct ComponentInstanceRecord {
92 typedef struct ComponentInstanceRecord ComponentInstanceRecord;
93 typedef ComponentInstanceRecord *ComponentInstance;
95 typedef NSString *(*NSErrorUserInfoFormatterFunc)(id objToBeDisplayed, NSError *err, char modifier);
97 NSErrorUserInfoFormatterFunc formatterFunc;
98 NSString *userInfoKey;
99 unsigned int parameterMask;
100 } NSErrorUserInfoFormatter;
102 typedef TestsuiteObject MyObj;
103 typedef TestsuiteObject *MyPtr;
105 @interface Foo: TestsuiteObject {
106 NSATSGlyphStorageRun r;
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:(TestsuiteObject *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;
136 - (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2
137 reading:(BOOL)inReadingNotWriting {
138 return (NSError *)self;
140 - (const NSATSGlyphStorageRun *)_attributeRunForCharacterAtIndex:(CFIndex)charIndex {
141 return (const NSATSGlyphStorageRun *)self;
143 - (const _NSATSTypesetterGuts *)_getATSTypesetterGuts:(const struct objc_selector *)sel {
144 return (const _NSATSTypesetterGuts *)self;
146 - (void)resumeWithSuspensionID:(NSAppleEventManagerSuspensionID)suspensionID and:(const CFIndex *)status {
148 - (const id)anotherMeth:(const SEL)sel and:(const Foo *)foo and:(const struct objc_object *)obj {
149 return (const id)self;
151 - (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4 {
154 - (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4 {
156 - (in const char *)sel1:(const SEL)sel1 id1:(const id)id1 {
159 - (inout id)obj1:(const MyPtr)obj1 obj2:(TestsuiteObject *const)obj2 obj3:(MyObj *const)obj3 {
162 + (ComponentInstance)_defaultScriptingComponent {
163 return (ComponentInstance)0;
165 - (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters
166 applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters {
167 return (NSString *)self;
169 - (NSErrorUserInfoFormatter *)formatter_func:(id)obj run:(const NSATSGlyphStorageRun **)run {
170 return (NSErrorUserInfoFormatter *)0;
172 - (BOOL)_forgetWord:(bycopy in NSString *)word inDictionary:(bycopy in NSString *)language {
175 - (void)_registerServicesMenu:(NSMenu *)servicesMenu withSendTypes:(const NXAtom *)sendTypes
176 andReturnTypes:(const NXAtom *)returnTypes addToList:(BOOL)addToList {
178 + (CFMutableSetRef *)_proxySharePointer {
179 return (CFMutableSetRef *)0;
181 - (NSRange)_checkGrammarInString:(in NSString *)stringToCheck language:(bycopy in NSString *)language details:(bycopy out NSArray **)details {
184 - (bool)_resolvePositionalStakeGlyphsForLineFragment:(CTLineRef)line lineFragmentRect:(NSRect)lineFragmentRect
185 minPosition:(float)minPosition maxPosition:(float)maxPosition maxLineFragmentWidth:(float)maxLineFragmentWidth
186 breakHint:(CFIndex *)charIndex {
189 + (BOOL)findVoiceByIdentifier:(NSString *)identifier returningCreator:(OSType *)returnedCreator returningID:(OSType *)returnedID {
195 Class fooClass = objc_getClass ("Foo");
197 struct objc_ivar_list *ivars;
198 struct objc_ivar *ivar;
200 meth = class_getInstanceMethod (fooClass, @selector(_errorWithOSStatus:ref1:ref2:reading:));
201 CHECK_IF (!strcmp (meth->method_types, "@24@0:4l8r^{FSRef=[80C]}12r^{FSRef=[80C]}16c20"));
203 meth = class_getInstanceMethod (fooClass, @selector(_attributeRunForCharacterAtIndex:));
204 CHECK_IF (!strcmp (meth->method_types, "r^{?=@@II^Iffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}l^lL^L@@@:::****{?=b1b1b1b1b1b27}}12@0:4L8"));
206 meth = class_getInstanceMethod (fooClass, @selector(_getATSTypesetterGuts:));
207 CHECK_IF (!strcmp (meth->method_types, "r@12@0:4r:8"));
209 meth = class_getInstanceMethod (fooClass, @selector(resumeWithSuspensionID:and:));
210 CHECK_IF (!strcmp (meth->method_types, "v16@0:4^{__NSAppleEventManagerSuspension=}8r^I12"));
212 meth = class_getInstanceMethod (fooClass, @selector(anotherMeth:and:and:));
213 CHECK_IF (!strcmp (meth->method_types, "r@20@0:4r:8r@12r@16"));
215 meth = class_getInstanceMethod (fooClass, @selector(str1:str2:str3:str4:));
216 CHECK_IF (!strcmp (meth->method_types, "@24@0:4r*8*12*16r*20"));
218 meth = class_getInstanceMethod (fooClass, @selector(foo1:foo2:foo3:foo4:));
219 CHECK_IF (!strcmp (meth->method_types, "Vv24@0:4@8r@12@16r@20"));
221 meth = class_getInstanceMethod (fooClass, @selector(sel1:id1:));
222 CHECK_IF (!strcmp (meth->method_types, "rn*16@0:4r:8r@12"));
224 meth = class_getInstanceMethod (fooClass, @selector(obj1:obj2:obj3:));
225 CHECK_IF (!strcmp (meth->method_types, "N@20@0:4r@8@12^{TestsuiteObject=#}16"));
227 meth = class_getClassMethod (fooClass, @selector(_defaultScriptingComponent));
228 CHECK_IF (!strcmp (meth->method_types, "^{ComponentInstanceRecord=[1l]}8@0:4"));
230 meth = class_getInstanceMethod (fooClass, @selector(_formatCocoaErrorString:parameters:applicableFormatters:count:));
231 CHECK_IF (!strcmp (meth->method_types, "@24@0:4@8r*12^^{?}16i20"));
233 meth = class_getInstanceMethod (fooClass, @selector(formatter_func:run:));
234 CHECK_IF (!strcmp (meth->method_types, "^{?=^?@I}16@0:4@8r^^{?}12"));
236 meth = class_getInstanceMethod (fooClass, @selector(_forgetWord:inDictionary:));
237 CHECK_IF (!strcmp (meth->method_types, "c16@0:4nO@8nO@12"));
239 meth = class_getInstanceMethod (fooClass, @selector(_registerServicesMenu:withSendTypes:andReturnTypes:addToList:));
240 CHECK_IF (!strcmp (meth->method_types, "v24@0:4@8r^*12r^*16c20"));
242 meth = class_getClassMethod (fooClass, @selector(_proxySharePointer));
243 CHECK_IF (!strcmp (meth->method_types, "^^{__CFSet}8@0:4"));
245 meth = class_getInstanceMethod (fooClass, @selector(_checkGrammarInString:language:details:));
246 CHECK_IF (!strcmp (meth->method_types, "{_NSRange=II}20@0:4n@8nO@12oO^@16"));
248 meth = class_getInstanceMethod (fooClass, @selector(_resolvePositionalStakeGlyphsForLineFragment:lineFragmentRect:minPosition:maxPosition:maxLineFragmentWidth:breakHint:));
249 CHECK_IF (!strcmp (meth->method_types, "B44@0:4^{__CTLine=}8{_NSRect={_NSPoint=ff}{_NSSize=ff}}12f28f32f36^I40"));
251 meth = class_getClassMethod (fooClass, @selector(findVoiceByIdentifier:returningCreator:returningID:));
252 CHECK_IF (!strcmp (meth->method_types, "c20@0:4@8^I12^I16"));
254 ivars = fooClass->ivars;
255 CHECK_IF (ivars->ivar_count == 1);
257 ivar = ivars->ivar_list;
258 CHECK_IF (!strcmp (ivar->ivar_name, "r"));
259 CHECK_IF (!strcmp (ivar->ivar_type,
260 "{?=\"_attributes\"@\"NSDictionary\"\"_font\"@\"NSFont\"\"_characterLength\""
261 "I\"_nominalGlyphLocation\"I\"p\"^I\"_defaultLineHeight\"f\"_defaultBaselineOffset\""
262 "f\"_horizExpansion\"f\"_baselineDelta\"f\"_attachmentBBox\"{_NSRect=\"origin\""
263 "{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}\"ll\"l\"llp\"^l\"ull\""
264 "L\"ullp\"^L\"a\"@\"a1\"@\"a2\"@\"b\":\"b1\":\"b2\":\"str1\"*\"str2\"*\"str3\"*\"str4\""
265 "*\"_rFlags\"{?=\"_isAttachmentRun\"b1\"_hasPositionalStake\"b1\"_isDefaultFace\""
266 "b1\"_hasCombiningMarks\"b1\"_isScreenFont\"b1\"_reserved\"b27}}"));