1#import <Foundation/Foundation.h> 2 3#if defined(__APPLE__) 4#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) 5#define IOS 6#endif 7#endif 8 9#if defined(IOS) 10#import <Foundation/NSGeometry.h> 11#else 12#import <Carbon/Carbon.h> 13#endif 14 15@interface MyClass : NSObject 16{ 17 int i; 18 char c; 19 float f; 20} 21 22- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z; 23- (int)doIncrementByInt: (int)x; 24 25@end 26 27@interface MyOtherClass : MyClass 28{ 29 int i2; 30 MyClass *backup; 31} 32- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q; 33 34@end 35 36@implementation MyClass 37 38- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z 39{ 40 self = [super init]; 41 if (self) { 42 self->i = x; 43 self->f = y; 44 self->c = z; 45 } 46 return self; 47} 48 49- (int)doIncrementByInt: (int)x 50{ 51 self->i += x; 52 return self->i; 53} 54 55@end 56 57@implementation MyOtherClass 58 59- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q 60{ 61 self = [super initWithInt:x andFloat:y andChar:z]; 62 if (self) { 63 self->i2 = q; 64 self->backup = [[MyClass alloc] initWithInt:x andFloat:y andChar:z]; 65 } 66 return self; 67} 68 69@end 70 71@interface Atom : NSObject { 72 float mass; 73} 74-(void)setMass:(float)newMass; 75-(float)mass; 76@end 77 78@interface Molecule : NSObject { 79 NSArray *atoms; 80} 81-(void)setAtoms:(NSArray *)newAtoms; 82-(NSArray *)atoms; 83@end 84 85@implementation Atom 86 87-(void)setMass:(float)newMass 88{ 89 mass = newMass; 90} 91-(float)mass 92{ 93 return mass; 94} 95 96@end 97 98@implementation Molecule 99 100-(void)setAtoms:(NSArray *)newAtoms 101{ 102 atoms = newAtoms; 103} 104-(NSArray *)atoms 105{ 106 return atoms; 107} 108@end 109 110@interface My_KVO_Observer : NSObject 111-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change 112 context:(void *)context; 113- (id) init; 114- (void) dealloc; 115@end 116 117@implementation My_KVO_Observer 118-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change 119 context:(void *)context { 120 // we do not really care about KVO'ing - do nothing 121 return; 122} 123- (id) init 124{ 125 self = [super init]; 126 return self; 127} 128 129- (void) dealloc 130{ 131 [super dealloc]; 132} 133@end 134 135int main (int argc, const char * argv[]) 136{ 137 138 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 139 140 MyClass *object = [[MyClass alloc] initWithInt:1 andFloat:3.14 andChar: 'E']; 141 142 [object doIncrementByInt:3]; 143 144 MyOtherClass *object2 = [[MyOtherClass alloc] initWithInt:2 andFloat:6.28 andChar: 'G' andOtherInt:-1]; 145 146 [object2 doIncrementByInt:3]; 147 148 NSNumber* num1 = [NSNumber numberWithInt:5]; 149 NSNumber* num2 = [NSNumber numberWithFloat:3.14]; 150 NSNumber* num3 = [NSNumber numberWithDouble:3.14]; 151 NSNumber* num4 = [NSNumber numberWithUnsignedLongLong:0xFFFFFFFFFFFFFFFE]; 152 NSNumber* num5 = [NSNumber numberWithChar:'A']; 153 NSNumber* num6 = [NSNumber numberWithUnsignedLongLong:0xFF]; 154 NSNumber* num7 = [NSNumber numberWithLong:0x1E8480]; 155 NSNumber* num8_Y = [NSNumber numberWithBool:YES]; 156 NSNumber* num8_N = [NSNumber numberWithBool:NO]; 157 NSNumber* num9 = [NSNumber numberWithShort:0x1E8480]; 158 NSNumber* num_at1 = @12; 159 NSNumber* num_at2 = @-12; 160 NSNumber* num_at3 = @12.5; 161 NSNumber* num_at4 = @-12.5; 162 163 NSDecimalNumber* decimal_number = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:-10 isNegative:NO]; 164 NSDecimalNumber* decimal_number_neg = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:10 isNegative:YES]; 165 NSDecimalNumber* decimal_one = [NSDecimalNumber one]; 166 NSDecimalNumber* decimal_zero = [NSDecimalNumber zero]; 167 NSDecimalNumber* decimal_nan = [NSDecimalNumber notANumber]; 168 169 NSString *str0 = [num6 stringValue]; 170 171 NSString *str1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; 172 173 NSString *str2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; 174 175 NSString *str3 = @"A string made with the at sign is here"; 176 177 NSString *str4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; 178 179 NSRect ns_rect_4str = {{1,1},{5,5}}; 180 181 NSString* str5 = NSStringFromRect(ns_rect_4str); 182 183 NSString* str6 = [@"/usr/doc/README.1ST" pathExtension]; 184 185 const unichar myCharacters[] = {0x03C3,'x','x'}; 186 NSString *str7 = [NSString stringWithCharacters: myCharacters 187 length: sizeof myCharacters / sizeof *myCharacters]; 188 189 NSString* str8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; 190 191 const unichar myOtherCharacters[] = {'a',' ', 'v','e','r','y',' ', 192 'm','u','c','h',' ','b','o','r','i','n','g',' ','t','a','s','k', 193 ' ','t','o',' ','w','r','i','t','e', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 194 't','h','i','s',' ','w','a','y','!','!',0x03C3, 0}; 195 NSString *str9 = [NSString stringWithCharacters: myOtherCharacters 196 length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; 197 198 const unichar myNextCharacters[] = {0x03C3, 0x0000}; 199 200 NSString *str10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; 201 202 NSString *str11 = NSStringFromClass([str10 class]); 203 204 NSString *label1 = @"Process Name: "; 205 NSString *label2 = @"Process Id: "; 206 NSString *processName = [[NSProcessInfo processInfo] processName]; 207 NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]]; 208 NSString *str12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; 209 210 NSString *strA1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; 211 212 NSString *strA2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; 213 214 NSString *strA3 = @"A string made with the at sign is here"; 215 216 NSString *strA4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; 217 218 NSString* strA5 = NSStringFromRect(ns_rect_4str); 219 220 NSString* strA6 = [@"/usr/doc/README.1ST" pathExtension]; 221 222 NSString *strA7 = [NSString stringWithCharacters: myCharacters 223 length: sizeof myCharacters / sizeof *myCharacters]; 224 225 NSString* strA8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; 226 227 NSString *strA9 = [NSString stringWithCharacters: myOtherCharacters 228 length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; 229 230 NSString *strA10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; 231 232 NSString *strA11 = NSStringFromClass([str10 class]); 233 234 NSString *strA12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; 235 236 NSString *strB1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; 237 238 NSString *strB2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; 239 240 NSString *strB3 = @"A string made with the at sign is here"; 241 242 NSString *strB4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; 243 244 NSString* strB5 = NSStringFromRect(ns_rect_4str); 245 246 NSString* strB6 = [@"/usr/doc/README.1ST" pathExtension]; 247 248 NSString *strB7 = [NSString stringWithCharacters: myCharacters 249 length: sizeof myCharacters / sizeof *myCharacters]; 250 251 NSString* strB8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; 252 253 NSString *strB9 = [NSString stringWithCharacters: myOtherCharacters 254 length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; 255 256 NSString *strB10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; 257 258 NSString *strB11 = NSStringFromClass([str10 class]); 259 260 NSString *strB12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; 261 262 NSString *strC11 = NSStringFromClass([str10 class]); 263 264 NSString *strC12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; 265 266 NSString *strC1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; 267 268 NSString *strC2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; 269 270 NSString *strC3 = @"A string made with the at sign is here"; 271 272 NSString *strC4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; 273 274 NSString* strC5 = NSStringFromRect(ns_rect_4str); 275 276 NSString* strC6 = [@"/usr/doc/README.1ST" pathExtension]; 277 278 NSString *strC7 = [NSString stringWithCharacters: myCharacters 279 length: sizeof myCharacters / sizeof *myCharacters]; 280 281 NSString* strC8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; 282 283 NSString *strC9 = [NSString stringWithCharacters: myOtherCharacters 284 length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; 285 286 NSString *strC10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; 287 288 NSString *strD11 = NSStringFromClass([str10 class]); 289 290 NSString *strD12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; 291 292 NSString *eAcute = [NSString stringWithFormat: @"%C", 0x00E9]; 293 NSString *randomHaziChar = [NSString stringWithFormat: @"%C", 0x9DC5]; 294 NSString *japanese = @"色は匂へど散りぬるを"; 295 NSString *italian = @"L'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione."; 296 NSString* french = @"Que veut cette horde d'esclaves, De traîtres, de rois conjurés?"; 297 NSString* german = @"Über-Ich und aus den Ansprüchen der sozialen Umwelt"; 298 299 void* data_set[3] = {str1,str2,str3}; 300 301 NSString *hebrew = [NSString stringWithString:@"לילה טוב"]; 302 303 NSArray* newArray = [[NSMutableArray alloc] init]; 304 [newArray addObject:str1]; 305 [newArray addObject:str2]; 306 [newArray addObject:str3]; 307 [newArray addObject:str4]; 308 [newArray addObject:str5]; 309 [newArray addObject:str6]; 310 [newArray addObject:str7]; 311 [newArray addObject:str8]; 312 [newArray addObject:str9]; 313 [newArray addObject:str10]; 314 [newArray addObject:str11]; 315 [newArray addObject:str12]; 316 [newArray addObject:strA1]; 317 [newArray addObject:strA2]; 318 [newArray addObject:strA3]; 319 [newArray addObject:strA4]; 320 [newArray addObject:strA5]; 321 [newArray addObject:strA6]; 322 [newArray addObject:strA7]; 323 [newArray addObject:strA8]; 324 [newArray addObject:strA9]; 325 [newArray addObject:strA10]; 326 [newArray addObject:strA11]; 327 [newArray addObject:strA12]; 328 [newArray addObject:strB1]; 329 [newArray addObject:strB2]; 330 [newArray addObject:strB3]; 331 [newArray addObject:strB4]; 332 [newArray addObject:strB5]; 333 [newArray addObject:strB6]; 334 [newArray addObject:strB7]; 335 [newArray addObject:strB8]; 336 [newArray addObject:strB9]; 337 [newArray addObject:strB10]; 338 [newArray addObject:strB11]; 339 [newArray addObject:strB12]; 340 [newArray addObject:strC1]; 341 [newArray addObject:strC2]; 342 [newArray addObject:strC3]; 343 [newArray addObject:strC4]; 344 [newArray addObject:strC5]; 345 [newArray addObject:strC6]; 346 [newArray addObject:strC7]; 347 [newArray addObject:strC8]; 348 [newArray addObject:strC9]; 349 [newArray addObject:strC10]; 350 [newArray addObject:strC11]; 351 [newArray addObject:strC12]; 352 [newArray addObject:strD11]; 353 [newArray addObject:strD12]; 354 355 NSDictionary* newDictionary = [[NSDictionary alloc] initWithObjects:newArray forKeys:newArray]; 356 NSDictionary *newMutableDictionary = [[NSMutableDictionary alloc] init]; 357 [newMutableDictionary setObject:@"foo" forKey:@"bar0"]; 358 [newMutableDictionary setObject:@"foo" forKey:@"bar1"]; 359 [newMutableDictionary setObject:@"foo" forKey:@"bar2"]; 360 [newMutableDictionary setObject:@"foo" forKey:@"bar3"]; 361 [newMutableDictionary setObject:@"foo" forKey:@"bar4"]; 362 [newMutableDictionary setObject:@"foo" forKey:@"bar5"]; 363 [newMutableDictionary setObject:@"foo" forKey:@"bar6"]; 364 [newMutableDictionary setObject:@"foo" forKey:@"bar7"]; 365 [newMutableDictionary setObject:@"foo" forKey:@"bar8"]; 366 [newMutableDictionary setObject:@"foo" forKey:@"bar9"]; 367 [newMutableDictionary setObject:@"foo" forKey:@"bar10"]; 368 [newMutableDictionary setObject:@"foo" forKey:@"bar11"]; 369 [newMutableDictionary setObject:@"foo" forKey:@"bar12"]; 370 [newMutableDictionary setObject:@"foo" forKey:@"bar13"]; 371 [newMutableDictionary setObject:@"foo" forKey:@"bar14"]; 372 [newMutableDictionary setObject:@"foo" forKey:@"bar15"]; 373 [newMutableDictionary setObject:@"foo" forKey:@"bar16"]; 374 [newMutableDictionary setObject:@"foo" forKey:@"bar17"]; 375 [newMutableDictionary setObject:@"foo" forKey:@"bar18"]; 376 [newMutableDictionary setObject:@"foo" forKey:@"bar19"]; 377 [newMutableDictionary setObject:@"foo" forKey:@"bar20"]; 378 379 id cfKeys[2] = { @"foo", @"bar", @"baz", @"quux" }; 380 id cfValues[2] = { @"foo", @"bar", @"baz", @"quux" }; 381 NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil)); 382 CFDictionaryRef cfDictionaryRef = CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil); 383 384 NSAttributedString* attrString = [[NSAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary]; 385 [attrString isEqual:nil]; 386 NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary]; 387 [mutableAttrString isEqual:nil]; 388 389 NSString* mutableString = [[NSMutableString alloc] initWithString:@"foo"]; 390 [mutableString insertString:@"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear " atIndex:0]; 391 392 NSString* mutableGetConst = [NSString stringWithCString:[mutableString cString]]; 393 394 [mutableGetConst length]; 395 396 NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" length:5]; 397 NSData *mutableData = [[NSMutableData alloc] initWithBytes:"NODATA" length:6]; 398 399 // No-copy versions of NSData initializers use NSConcreteData if over 2^16 elements are specified. 400 unsigned concreteLength = 100000; 401 void *zeroes1 = calloc(1, concreteLength); 402 // initWithBytesNoCopy takes ownership of the buffer. 403 NSData *concreteData = [[NSData alloc] initWithBytesNoCopy:zeroes1 length:concreteLength]; 404 void *zeroes2 = calloc(1, concreteLength); 405 NSMutableData *concreteMutableData = [[NSMutableData alloc] initWithBytesNoCopy:zeroes2 length:concreteLength]; 406 407 [mutableData appendBytes:"MOREDATA" length:8]; 408 409 [immutableData length]; 410 [mutableData length]; 411 412 NSSet* nsset = [[NSSet alloc] initWithObjects:str1,str2,str3,nil]; 413 NSSet *nsmutableset = [[NSMutableSet alloc] initWithObjects:str1,str2,str3,nil]; 414 [nsmutableset addObject:str4]; 415 416 CFDataRef data_ref = CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5); 417 418 CFMutableDataRef mutable_data_ref = CFDataCreateMutable(kCFAllocatorDefault, 8); 419 CFDataAppendBytes(mutable_data_ref, [mutableData bytes], 5); 420 421 CFMutableStringRef mutable_string_ref = CFStringCreateMutable(NULL,100); 422 CFStringAppend(mutable_string_ref, CFSTR("Wish ya knew")); 423 424 CFStringRef cfstring_ref = CFSTR("HELLO WORLD"); 425 426 CFArrayRef cfarray_ref = CFArrayCreate(NULL, data_set, 3, NULL); 427 CFMutableArrayRef mutable_array_ref = CFArrayCreateMutable(NULL, 16, NULL); 428 429 CFArraySetValueAtIndex(mutable_array_ref, 0, str1); 430 CFArraySetValueAtIndex(mutable_array_ref, 1, str2); 431 CFArraySetValueAtIndex(mutable_array_ref, 2, str3); 432 CFArraySetValueAtIndex(mutable_array_ref, 3, str4); 433 CFArraySetValueAtIndex(mutable_array_ref, 0, str5); // replacing value at 0!! 434 CFArraySetValueAtIndex(mutable_array_ref, 4, str6); 435 CFArraySetValueAtIndex(mutable_array_ref, 5, str7); 436 CFArraySetValueAtIndex(mutable_array_ref, 6, str8); 437 CFArraySetValueAtIndex(mutable_array_ref, 7, str9); 438 CFArraySetValueAtIndex(mutable_array_ref, 8, str10); 439 CFArraySetValueAtIndex(mutable_array_ref, 9, str11); 440 CFArraySetValueAtIndex(mutable_array_ref, 10, str12); 441 442 CFBinaryHeapRef binheap_ref = CFBinaryHeapCreate(NULL, 15, &kCFStringBinaryHeapCallBacks, NULL); 443 CFBinaryHeapAddValue(binheap_ref, str1); 444 CFBinaryHeapAddValue(binheap_ref, str2); 445 CFBinaryHeapAddValue(binheap_ref, str3); 446 CFBinaryHeapAddValue(binheap_ref, str4); 447 CFBinaryHeapAddValue(binheap_ref, str5); 448 CFBinaryHeapAddValue(binheap_ref, str6); 449 CFBinaryHeapAddValue(binheap_ref, str7); 450 CFBinaryHeapAddValue(binheap_ref, str8); 451 CFBinaryHeapAddValue(binheap_ref, str9); 452 CFBinaryHeapAddValue(binheap_ref, str10); 453 CFBinaryHeapAddValue(binheap_ref, str11); 454 CFBinaryHeapAddValue(binheap_ref, str12); 455 CFBinaryHeapAddValue(binheap_ref, strA1); 456 CFBinaryHeapAddValue(binheap_ref, strB1); 457 CFBinaryHeapAddValue(binheap_ref, strC1); 458 CFBinaryHeapAddValue(binheap_ref, strA11); 459 CFBinaryHeapAddValue(binheap_ref, strB11); 460 CFBinaryHeapAddValue(binheap_ref, strC11); 461 CFBinaryHeapAddValue(binheap_ref, strB12); 462 CFBinaryHeapAddValue(binheap_ref, strC12); 463 CFBinaryHeapAddValue(binheap_ref, strA12); 464 465 CFURLRef cfurl_ref = CFURLCreateWithString(NULL, CFSTR("http://www.foo.bar/"), NULL); 466 CFURLRef cfchildurl_ref = CFURLCreateWithString(NULL, CFSTR("page.html"), cfurl_ref); 467 CFURLRef cfgchildurl_ref = CFURLCreateWithString(NULL, CFSTR("?whatever"), cfchildurl_ref); 468 469 NSDictionary *error_userInfo = @{@"a": @1, @"b" : @2}; 470 NSError *nserror = [[NSError alloc] initWithDomain:@"Foobar" code:12 userInfo:error_userInfo]; 471 NSError **nserrorptr = &nserror; 472 473 NSBundle* bundle_string = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/Accelerate.framework"]; 474 NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Foundation.framework"]]; 475 476 NSBundle* main_bundle = [NSBundle mainBundle]; 477 478 NSArray* bundles = [NSBundle allBundles]; 479 480 NSURL *nsurl0; 481 482 for (NSBundle* bundle in bundles) 483 { 484 nsurl0 = [bundle bundleURL]; 485 } 486 487 NSException* except0 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName" reason:@"First" userInfo:nil]; 488 NSException* except1 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName~1" reason:@"Second" userInfo:nil]; 489 NSException* except2 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName`2" reason:@"Third" userInfo:nil]; 490 NSException* except3 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName/3" reason:@"Fourth" userInfo:nil]; 491 492 NSURL *nsurl = [[NSURL alloc] initWithString:@"http://www.foo.bar"]; 493 NSURL *nsurl2 = [NSURL URLWithString:@"page.html" relativeToURL:nsurl]; 494 NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" relativeToURL:nsurl2]; 495 496 NSDate *date1 = [NSDate dateWithTimeIntervalSince1970:133890*60*60]; // 6pm April 10, 1985 GMT 497 NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am January 1, 2011"]; 498 NSDate *date3 = [NSDate date]; 499 NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24*60*60]; 500 NSDate *date5 = [NSDate dateWithTimeIntervalSinceReferenceDate: floor([[NSDate date] timeIntervalSinceReferenceDate])]; 501 502 CFAbsoluteTime date1_abs = CFDateGetAbsoluteTime(date1); 503 CFAbsoluteTime date2_abs = CFDateGetAbsoluteTime(date2); 504 CFAbsoluteTime date3_abs = CFDateGetAbsoluteTime(date3); 505 CFAbsoluteTime date4_abs = CFDateGetAbsoluteTime(date4); 506 CFAbsoluteTime date5_abs = CFDateGetAbsoluteTime(date5); 507 508 NSIndexSet *iset1 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 4)]; 509 NSIndexSet *iset2 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)]; 510 511 NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init]; 512 [imset addIndex:1936]; 513 [imset addIndex:7]; 514 [imset addIndex:9]; 515 [imset addIndex:11]; 516 [imset addIndex:24]; 517 [imset addIndex:41]; 518 [imset addIndex:58]; 519 [imset addIndex:61]; 520 [imset addIndex:62]; 521 [imset addIndex:63]; 522 523 CFTimeZoneRef cupertino = CFTimeZoneCreateWithName ( 524 NULL, 525 CFSTR("PST"), 526 YES); 527 CFTimeZoneRef home = CFTimeZoneCreateWithName ( 528 NULL, 529 CFSTR("Europe/Rome"), 530 YES); 531 CFTimeZoneRef europe = CFTimeZoneCreateWithName ( 532 NULL, 533 CFSTR("CET"), 534 YES); 535 536 NSTimeZone *cupertino_ns = [NSTimeZone timeZoneWithAbbreviation:@"PST"]; 537 NSTimeZone *home_ns = [NSTimeZone timeZoneWithName:@"Europe/Rome"]; 538 NSTimeZone *europe_ns = [NSTimeZone timeZoneWithAbbreviation:@"CET"]; 539 540 CFGregorianUnits cf_greg_units = {1,3,5,12,5,7}; 541 CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(date1), NULL); 542 CFRange cf_range = {4,4}; 543 NSPoint ns_point = {4,4}; 544 NSRange ns_range = {4,4}; 545 546 NSRect ns_rect = {{1,1},{5,5}}; 547 NSRect* ns_rect_ptr = &ns_rect; 548 NSRectArray ns_rect_arr = &ns_rect; 549 NSSize ns_size = {5,7}; 550 NSSize* ns_size_ptr = &ns_size; 551 552 CGSize cg_size = {1,6}; 553 CGPoint cg_point = {2,7}; 554 CGRect cg_rect = {{1,2}, {7,7}}; 555 556#ifndef IOS 557 RGBColor rgb_color = {3,56,35}; 558 RGBColor* rgb_color_ptr = &rgb_color; 559#endif 560 561 Rect rect = {4,8,4,7}; 562 Rect* rect_ptr = ▭ 563 564 Point point = {7,12}; 565 Point* point_ptr = &point; 566 567#ifndef IOS 568 HIPoint hi_point = {7,12}; 569 HIRect hi_rect = {{3,5},{4,6}}; 570#endif 571 572 SEL foo_selector = @selector(foo_selector_impl); 573 574 CFMutableBitVectorRef mut_bv = CFBitVectorCreateMutable(NULL, 64); 575 CFBitVectorSetCount(mut_bv, 50); 576 CFBitVectorSetBitAtIndex(mut_bv, 0, 1); 577 CFBitVectorSetBitAtIndex(mut_bv, 1, 1); 578 CFBitVectorSetBitAtIndex(mut_bv, 2, 1); 579 CFBitVectorSetBitAtIndex(mut_bv, 5, 1); 580 CFBitVectorSetBitAtIndex(mut_bv, 6, 1); 581 CFBitVectorSetBitAtIndex(mut_bv, 8, 1); 582 CFBitVectorSetBitAtIndex(mut_bv, 10, 1); 583 CFBitVectorSetBitAtIndex(mut_bv, 11, 1); 584 CFBitVectorSetBitAtIndex(mut_bv, 16, 1); 585 CFBitVectorSetBitAtIndex(mut_bv, 17, 1); 586 CFBitVectorSetBitAtIndex(mut_bv, 19, 1); 587 CFBitVectorSetBitAtIndex(mut_bv, 20, 1); 588 CFBitVectorSetBitAtIndex(mut_bv, 22, 1); 589 CFBitVectorSetBitAtIndex(mut_bv, 24, 1); 590 CFBitVectorSetBitAtIndex(mut_bv, 28, 1); 591 CFBitVectorSetBitAtIndex(mut_bv, 29, 1); 592 CFBitVectorSetBitAtIndex(mut_bv, 30, 1); 593 CFBitVectorSetBitAtIndex(mut_bv, 30, 1); 594 CFBitVectorSetBitAtIndex(mut_bv, 31, 1); 595 CFBitVectorSetBitAtIndex(mut_bv, 34, 1); 596 CFBitVectorSetBitAtIndex(mut_bv, 35, 1); 597 CFBitVectorSetBitAtIndex(mut_bv, 37, 1); 598 CFBitVectorSetBitAtIndex(mut_bv, 39, 1); 599 CFBitVectorSetBitAtIndex(mut_bv, 40, 1); 600 CFBitVectorSetBitAtIndex(mut_bv, 41, 1); 601 CFBitVectorSetBitAtIndex(mut_bv, 43, 1); 602 CFBitVectorSetBitAtIndex(mut_bv, 47, 1); 603 604 Molecule *molecule = [Molecule new]; 605 606 Class myclass = NSClassFromString(@"NSValue"); 607 Class myclass2 = [str0 class]; 608 Class myclass3 = [molecule class]; 609 Class myclass4 = NSClassFromString(@"NSMutableArray"); 610 Class myclass5 = [nil class]; 611 612 NSArray *components = @[@"usr", @"blah", @"stuff"]; 613 NSString *path = [NSString pathWithComponents: components]; 614 615 [molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL]; // Set break point at this line. 616 [newMutableDictionary addObserver:[My_KVO_Observer new] forKeyPath:@"weirdKeyToKVO" options:NSKeyValueObservingOptionNew context:NULL]; 617 618 [molecule setAtoms:nil]; 619 [molecule setAtoms:[NSMutableArray new]]; 620 621 [pool drain]; 622 return 0; 623} 624 625