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[4] = {@"foo", @"bar", @"baz", @"quux"}; 380 id cfValues[4] = {@"foo", @"bar", @"baz", @"quux"}; 381 NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate( 382 nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil)); 383 NSDictionary *nscfDictionary = CFBridgingRelease(CFDictionaryCreate( 384 nil, (void *)cfKeys, (void *)cfValues, 4, nil, nil)); 385 CFDictionaryRef cfDictionaryRef = CFDictionaryCreate( 386 nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil); 387 388 NSAttributedString *attrString = [[NSAttributedString alloc] 389 initWithString:@"hello world from foo" 390 attributes:newDictionary]; 391 [attrString isEqual:nil]; 392 NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary]; 393 [mutableAttrString isEqual:nil]; 394 395 NSString* mutableString = [[NSMutableString alloc] initWithString:@"foo"]; 396 [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]; 397 398 NSString* mutableGetConst = [NSString stringWithCString:[mutableString cString]]; 399 400 [mutableGetConst length]; 401 402 NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" length:5]; 403 NSData *mutableData = [[NSMutableData alloc] initWithBytes:"NODATA" length:6]; 404 405 // No-copy versions of NSData initializers use NSConcreteData if over 2^16 elements are specified. 406 unsigned concreteLength = 100000; 407 void *zeroes1 = calloc(1, concreteLength); 408 // initWithBytesNoCopy takes ownership of the buffer. 409 NSData *concreteData = [[NSData alloc] initWithBytesNoCopy:zeroes1 length:concreteLength]; 410 void *zeroes2 = calloc(1, concreteLength); 411 NSMutableData *concreteMutableData = [[NSMutableData alloc] initWithBytesNoCopy:zeroes2 length:concreteLength]; 412 413 [mutableData appendBytes:"MOREDATA" length:8]; 414 415 [immutableData length]; 416 [mutableData length]; 417 418 NSSet* nsset = [[NSSet alloc] initWithObjects:str1,str2,str3,nil]; 419 NSSet *nsmutableset = [[NSMutableSet alloc] initWithObjects:str1,str2,str3,nil]; 420 [nsmutableset addObject:str4]; 421 NSSet *nscfSet = 422 CFBridgingRelease(CFSetCreate(nil, (void *)cfValues, 2, nil)); 423 424 CFDataRef data_ref = CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5); 425 426 CFMutableDataRef mutable_data_ref = CFDataCreateMutable(kCFAllocatorDefault, 8); 427 CFDataAppendBytes(mutable_data_ref, [mutableData bytes], 5); 428 429 CFMutableStringRef mutable_string_ref = CFStringCreateMutable(NULL,100); 430 CFStringAppend(mutable_string_ref, CFSTR("Wish ya knew")); 431 432 CFStringRef cfstring_ref = CFSTR("HELLO WORLD"); 433 434 CFArrayRef cfarray_ref = CFArrayCreate(NULL, data_set, 3, NULL); 435 CFMutableArrayRef mutable_array_ref = CFArrayCreateMutable(NULL, 16, NULL); 436 437 CFArraySetValueAtIndex(mutable_array_ref, 0, str1); 438 CFArraySetValueAtIndex(mutable_array_ref, 1, str2); 439 CFArraySetValueAtIndex(mutable_array_ref, 2, str3); 440 CFArraySetValueAtIndex(mutable_array_ref, 3, str4); 441 CFArraySetValueAtIndex(mutable_array_ref, 0, str5); // replacing value at 0!! 442 CFArraySetValueAtIndex(mutable_array_ref, 4, str6); 443 CFArraySetValueAtIndex(mutable_array_ref, 5, str7); 444 CFArraySetValueAtIndex(mutable_array_ref, 6, str8); 445 CFArraySetValueAtIndex(mutable_array_ref, 7, str9); 446 CFArraySetValueAtIndex(mutable_array_ref, 8, str10); 447 CFArraySetValueAtIndex(mutable_array_ref, 9, str11); 448 CFArraySetValueAtIndex(mutable_array_ref, 10, str12); 449 450 CFBinaryHeapRef binheap_ref = CFBinaryHeapCreate(NULL, 15, &kCFStringBinaryHeapCallBacks, NULL); 451 CFBinaryHeapAddValue(binheap_ref, str1); 452 CFBinaryHeapAddValue(binheap_ref, str2); 453 CFBinaryHeapAddValue(binheap_ref, str3); 454 CFBinaryHeapAddValue(binheap_ref, str4); 455 CFBinaryHeapAddValue(binheap_ref, str5); 456 CFBinaryHeapAddValue(binheap_ref, str6); 457 CFBinaryHeapAddValue(binheap_ref, str7); 458 CFBinaryHeapAddValue(binheap_ref, str8); 459 CFBinaryHeapAddValue(binheap_ref, str9); 460 CFBinaryHeapAddValue(binheap_ref, str10); 461 CFBinaryHeapAddValue(binheap_ref, str11); 462 CFBinaryHeapAddValue(binheap_ref, str12); 463 CFBinaryHeapAddValue(binheap_ref, strA1); 464 CFBinaryHeapAddValue(binheap_ref, strB1); 465 CFBinaryHeapAddValue(binheap_ref, strC1); 466 CFBinaryHeapAddValue(binheap_ref, strA11); 467 CFBinaryHeapAddValue(binheap_ref, strB11); 468 CFBinaryHeapAddValue(binheap_ref, strC11); 469 CFBinaryHeapAddValue(binheap_ref, strB12); 470 CFBinaryHeapAddValue(binheap_ref, strC12); 471 CFBinaryHeapAddValue(binheap_ref, strA12); 472 473 CFURLRef cfurl_ref = CFURLCreateWithString(NULL, CFSTR("http://www.foo.bar/"), NULL); 474 CFURLRef cfchildurl_ref = CFURLCreateWithString(NULL, CFSTR("page.html"), cfurl_ref); 475 CFURLRef cfgchildurl_ref = CFURLCreateWithString(NULL, CFSTR("?whatever"), cfchildurl_ref); 476 477 NSDictionary *error_userInfo = @{@"a": @1, @"b" : @2}; 478 NSError *nserror = [[NSError alloc] initWithDomain:@"Foobar" code:12 userInfo:error_userInfo]; 479 NSError **nserrorptr = &nserror; 480 481 NSBundle* bundle_string = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/Accelerate.framework"]; 482 NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Foundation.framework"]]; 483 484 NSBundle* main_bundle = [NSBundle mainBundle]; 485 486 NSArray* bundles = [NSBundle allBundles]; 487 488 NSURL *nsurl0; 489 490 for (NSBundle* bundle in bundles) 491 { 492 nsurl0 = [bundle bundleURL]; 493 } 494 495 NSException* except0 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName" reason:@"First" userInfo:nil]; 496 NSException* except1 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName~1" reason:@"Second" userInfo:nil]; 497 NSException* except2 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName`2" reason:@"Third" userInfo:nil]; 498 NSException* except3 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName/3" reason:@"Fourth" userInfo:nil]; 499 500 NSURL *nsurl = [[NSURL alloc] initWithString:@"http://www.foo.bar"]; 501 NSURL *nsurl2 = [NSURL URLWithString:@"page.html" relativeToURL:nsurl]; 502 NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" relativeToURL:nsurl2]; 503 504 NSDate *date1 = [NSDate dateWithTimeIntervalSince1970:133890*60*60]; // 6pm April 10, 1985 GMT 505 NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am January 1, 2011"]; 506 NSDate *date3 = [NSDate date]; 507 NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24*60*60]; 508 NSDate *date5 = [NSDate dateWithTimeIntervalSinceReferenceDate: floor([[NSDate date] timeIntervalSinceReferenceDate])]; 509 510 CFAbsoluteTime date1_abs = CFDateGetAbsoluteTime(date1); 511 CFAbsoluteTime date2_abs = CFDateGetAbsoluteTime(date2); 512 CFAbsoluteTime date3_abs = CFDateGetAbsoluteTime(date3); 513 CFAbsoluteTime date4_abs = CFDateGetAbsoluteTime(date4); 514 CFAbsoluteTime date5_abs = CFDateGetAbsoluteTime(date5); 515 516 NSIndexSet *iset1 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 4)]; 517 NSIndexSet *iset2 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)]; 518 519 NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init]; 520 [imset addIndex:1936]; 521 [imset addIndex:7]; 522 [imset addIndex:9]; 523 [imset addIndex:11]; 524 [imset addIndex:24]; 525 [imset addIndex:41]; 526 [imset addIndex:58]; 527 [imset addIndex:61]; 528 [imset addIndex:62]; 529 [imset addIndex:63]; 530 531 CFTimeZoneRef cupertino = CFTimeZoneCreateWithName ( 532 NULL, 533 CFSTR("PST"), 534 YES); 535 CFTimeZoneRef home = CFTimeZoneCreateWithName ( 536 NULL, 537 CFSTR("Europe/Rome"), 538 YES); 539 CFTimeZoneRef europe = CFTimeZoneCreateWithName ( 540 NULL, 541 CFSTR("CET"), 542 YES); 543 544 NSTimeZone *cupertino_ns = [NSTimeZone timeZoneWithAbbreviation:@"PST"]; 545 NSTimeZone *home_ns = [NSTimeZone timeZoneWithName:@"Europe/Rome"]; 546 NSTimeZone *europe_ns = [NSTimeZone timeZoneWithAbbreviation:@"CET"]; 547 548 CFGregorianUnits cf_greg_units = {1,3,5,12,5,7}; 549 CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(date1), NULL); 550 CFRange cf_range = {4,4}; 551 NSPoint ns_point = {4,4}; 552 NSRange ns_range = {4,4}; 553 554 NSRect ns_rect = {{1,1},{5,5}}; 555 NSRect* ns_rect_ptr = &ns_rect; 556 NSRectArray ns_rect_arr = &ns_rect; 557 NSSize ns_size = {5,7}; 558 NSSize* ns_size_ptr = &ns_size; 559 560 CGSize cg_size = {1,6}; 561 CGPoint cg_point = {2,7}; 562 CGRect cg_rect = {{1,2}, {7,7}}; 563 564#ifndef IOS 565 RGBColor rgb_color = {3,56,35}; 566 RGBColor* rgb_color_ptr = &rgb_color; 567#endif 568 569 Rect rect = {4,8,4,7}; 570 Rect* rect_ptr = ▭ 571 572 Point point = {7,12}; 573 Point* point_ptr = &point; 574 575#ifndef IOS 576 HIPoint hi_point = {7,12}; 577 HIRect hi_rect = {{3,5},{4,6}}; 578#endif 579 580 SEL foo_selector = @selector(foo_selector_impl); 581 582 CFMutableBitVectorRef mut_bv = CFBitVectorCreateMutable(NULL, 64); 583 CFBitVectorSetCount(mut_bv, 50); 584 CFBitVectorSetBitAtIndex(mut_bv, 0, 1); 585 CFBitVectorSetBitAtIndex(mut_bv, 1, 1); 586 CFBitVectorSetBitAtIndex(mut_bv, 2, 1); 587 CFBitVectorSetBitAtIndex(mut_bv, 5, 1); 588 CFBitVectorSetBitAtIndex(mut_bv, 6, 1); 589 CFBitVectorSetBitAtIndex(mut_bv, 8, 1); 590 CFBitVectorSetBitAtIndex(mut_bv, 10, 1); 591 CFBitVectorSetBitAtIndex(mut_bv, 11, 1); 592 CFBitVectorSetBitAtIndex(mut_bv, 16, 1); 593 CFBitVectorSetBitAtIndex(mut_bv, 17, 1); 594 CFBitVectorSetBitAtIndex(mut_bv, 19, 1); 595 CFBitVectorSetBitAtIndex(mut_bv, 20, 1); 596 CFBitVectorSetBitAtIndex(mut_bv, 22, 1); 597 CFBitVectorSetBitAtIndex(mut_bv, 24, 1); 598 CFBitVectorSetBitAtIndex(mut_bv, 28, 1); 599 CFBitVectorSetBitAtIndex(mut_bv, 29, 1); 600 CFBitVectorSetBitAtIndex(mut_bv, 30, 1); 601 CFBitVectorSetBitAtIndex(mut_bv, 30, 1); 602 CFBitVectorSetBitAtIndex(mut_bv, 31, 1); 603 CFBitVectorSetBitAtIndex(mut_bv, 34, 1); 604 CFBitVectorSetBitAtIndex(mut_bv, 35, 1); 605 CFBitVectorSetBitAtIndex(mut_bv, 37, 1); 606 CFBitVectorSetBitAtIndex(mut_bv, 39, 1); 607 CFBitVectorSetBitAtIndex(mut_bv, 40, 1); 608 CFBitVectorSetBitAtIndex(mut_bv, 41, 1); 609 CFBitVectorSetBitAtIndex(mut_bv, 43, 1); 610 CFBitVectorSetBitAtIndex(mut_bv, 47, 1); 611 612 Molecule *molecule = [Molecule new]; 613 614 Class myclass = NSClassFromString(@"NSValue"); 615 Class myclass2 = [str0 class]; 616 Class myclass3 = [molecule class]; 617 Class myclass4 = NSClassFromString(@"NSMutableArray"); 618 Class myclass5 = [nil class]; 619 620 NSArray *components = @[@"usr", @"blah", @"stuff"]; 621 NSString *path = [NSString pathWithComponents: components]; 622 623 [molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL]; // Set break point at this line. 624 [newMutableDictionary addObserver:[My_KVO_Observer new] forKeyPath:@"weirdKeyToKVO" options:NSKeyValueObservingOptionNew context:NULL]; 625 626 [molecule setAtoms:nil]; 627 [molecule setAtoms:[NSMutableArray new]]; 628 629 [pool drain]; 630 return 0; 631} 632 633