f0dc2055976a97b919e901b12233ff5e708b4f24
[openbsd] /
1 //===-- main.m ------------------------------------------------*- ObjC -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #import <Foundation/Foundation.h>
10
11 #if defined(__APPLE__)
12 #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
13 #define IOS
14 #endif
15 #endif
16
17 #if defined(IOS)
18 #import <Foundation/NSGeometry.h>
19 #else
20 #import <Carbon/Carbon.h>
21 #endif
22
23 @interface MyClass : NSObject
24 {
25     int i;
26     char c;
27     float f; 
28 }
29
30 - (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z;
31 - (int)doIncrementByInt: (int)x;
32
33 @end
34
35 @interface MyOtherClass : MyClass
36 {
37     int i2;
38     MyClass *backup;
39 }
40 - (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q;
41
42 @end
43
44 @implementation MyClass
45
46 - (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z
47 {
48     self = [super init];
49     if (self) {
50         self->i = x;
51         self->f = y;
52         self->c = z;
53     }    
54     return self;
55 }
56
57 - (int)doIncrementByInt: (int)x
58 {
59     self->i += x;
60     return self->i;
61 }
62
63 @end
64
65 @implementation MyOtherClass
66
67 - (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q
68 {
69     self = [super initWithInt:x andFloat:y andChar:z];
70     if (self) {
71         self->i2 = q;
72         self->backup = [[MyClass alloc] initWithInt:x andFloat:y andChar:z];
73     }    
74     return self;
75 }
76
77 @end
78
79 @interface Atom : NSObject {
80     float mass;
81 }
82 -(void)setMass:(float)newMass;
83 -(float)mass;
84 @end
85
86 @interface Molecule : NSObject {
87     NSArray *atoms;
88 }
89 -(void)setAtoms:(NSArray *)newAtoms;
90 -(NSArray *)atoms;
91 @end
92
93 @implementation  Atom
94
95 -(void)setMass:(float)newMass
96 {
97     mass = newMass;
98 }
99 -(float)mass
100 {
101     return mass;
102 }
103
104 @end
105
106 @implementation Molecule
107
108 -(void)setAtoms:(NSArray *)newAtoms
109 {
110     atoms = newAtoms;
111 }
112 -(NSArray *)atoms
113 {
114     return atoms;
115 }
116 @end
117
118 @interface My_KVO_Observer : NSObject
119 -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change 
120         context:(void *)context;
121 - (id) init;
122 - (void) dealloc;
123 @end
124
125 @implementation My_KVO_Observer
126 -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change 
127                       context:(void *)context {
128         // we do not really care about KVO'ing - do nothing
129         return;
130 }
131 - (id) init
132 {
133     self = [super init]; 
134     return self;
135 }
136
137 - (void) dealloc
138 {
139     [super dealloc];
140 }
141 @end
142
143 int main (int argc, const char * argv[])
144 {
145     
146     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
147     
148     MyClass *object = [[MyClass alloc] initWithInt:1 andFloat:3.14 andChar: 'E'];
149     
150     [object doIncrementByInt:3];
151     
152     MyOtherClass *object2 = [[MyOtherClass alloc] initWithInt:2 andFloat:6.28 andChar: 'G' andOtherInt:-1];
153     
154     [object2 doIncrementByInt:3];
155     
156             NSNumber* num1 = [NSNumber numberWithInt:5];
157             NSNumber* num2 = [NSNumber numberWithFloat:3.14];
158             NSNumber* num3 = [NSNumber numberWithDouble:3.14];
159             NSNumber* num4 = [NSNumber numberWithUnsignedLongLong:0xFFFFFFFFFFFFFFFE];
160             NSNumber* num5 = [NSNumber numberWithChar:'A'];
161             NSNumber* num6 = [NSNumber numberWithUnsignedLongLong:0xFF];
162             NSNumber* num7 = [NSNumber numberWithLong:0x1E8480];
163             NSNumber* num8_Y = [NSNumber numberWithBool:YES];
164             NSNumber* num8_N = [NSNumber numberWithBool:NO];
165             NSNumber* num9 = [NSNumber numberWithShort:0x1E8480];
166             NSNumber* num_at1 = @12;
167             NSNumber* num_at2 = @-12;
168             NSNumber* num_at3 = @12.5;
169             NSNumber* num_at4 = @-12.5;
170
171             NSDecimalNumber* decimal_number = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:-10 isNegative:NO];
172             NSDecimalNumber* decimal_number_neg = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:10 isNegative:YES];
173             NSDecimalNumber* decimal_one = [NSDecimalNumber one];
174             NSDecimalNumber* decimal_zero = [NSDecimalNumber zero];
175             NSDecimalNumber* decimal_nan = [NSDecimalNumber notANumber];
176
177             NSString *str0 = [num6 stringValue];
178
179             NSString *str1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding];
180
181             NSString *str2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"];
182
183             NSString *str3 = @"A string made with the at sign is here";
184
185             NSString *str4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4];
186
187             NSRect ns_rect_4str = {{1,1},{5,5}};
188
189             NSString* str5 = NSStringFromRect(ns_rect_4str);
190
191             NSString* str6 = [@"/usr/doc/README.1ST" pathExtension];
192
193             const unichar myCharacters[] = {0x03C3,'x','x'};
194             NSString *str7 = [NSString stringWithCharacters: myCharacters
195                                                      length: sizeof myCharacters / sizeof *myCharacters];
196
197             NSString* str8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension];
198
199             const unichar myOtherCharacters[] = {'a',' ', 'v','e','r','y',' ',
200                 'm','u','c','h',' ','b','o','r','i','n','g',' ','t','a','s','k',
201                 ' ','t','o',' ','w','r','i','t','e', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ',
202                 't','h','i','s',' ','w','a','y','!','!',0x03C3, 0};
203             NSString *str9 = [NSString stringWithCharacters: myOtherCharacters
204                                                      length: sizeof myOtherCharacters / sizeof *myOtherCharacters];
205
206             const unichar myNextCharacters[] = {0x03C3, 0x0000};
207
208             NSString *str10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
209
210             NSString *str11 = NSStringFromClass([str10 class]);
211
212             NSString *label1 = @"Process Name: ";
213             NSString *label2 = @"Process Id: ";
214             NSString *processName = [[NSProcessInfo processInfo] processName];
215             NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]];
216             NSString *str12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
217
218             NSString *strA1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding];
219
220             NSString *strA2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"];
221
222             NSString *strA3 = @"A string made with the at sign is here";
223
224             NSString *strA4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4];
225
226             NSString* strA5 = NSStringFromRect(ns_rect_4str);
227
228             NSString* strA6 = [@"/usr/doc/README.1ST" pathExtension];
229
230             NSString *strA7 = [NSString stringWithCharacters: myCharacters
231                                                      length: sizeof myCharacters / sizeof *myCharacters];
232
233             NSString* strA8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension];
234
235             NSString *strA9 = [NSString stringWithCharacters: myOtherCharacters
236                                                      length: sizeof myOtherCharacters / sizeof *myOtherCharacters];
237
238             NSString *strA10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
239
240             NSString *strA11 = NSStringFromClass([str10 class]);
241
242             NSString *strA12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
243
244             NSString *strB1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding];
245
246             NSString *strB2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"];
247
248             NSString *strB3 = @"A string made with the at sign is here";
249
250             NSString *strB4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4];
251
252             NSString* strB5 = NSStringFromRect(ns_rect_4str);
253
254             NSString* strB6 = [@"/usr/doc/README.1ST" pathExtension];
255
256             NSString *strB7 = [NSString stringWithCharacters: myCharacters
257                                                       length: sizeof myCharacters / sizeof *myCharacters];
258
259             NSString* strB8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension];
260
261             NSString *strB9 = [NSString stringWithCharacters: myOtherCharacters
262                                                       length: sizeof myOtherCharacters / sizeof *myOtherCharacters];
263
264             NSString *strB10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
265
266             NSString *strB11 = NSStringFromClass([str10 class]);
267
268             NSString *strB12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
269
270             NSString *strC11 = NSStringFromClass([str10 class]);
271
272             NSString *strC12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
273
274             NSString *strC1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding];
275
276             NSString *strC2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"];
277
278             NSString *strC3 = @"A string made with the at sign is here";
279
280             NSString *strC4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4];
281
282             NSString* strC5 = NSStringFromRect(ns_rect_4str);
283
284             NSString* strC6 = [@"/usr/doc/README.1ST" pathExtension];
285
286             NSString *strC7 = [NSString stringWithCharacters: myCharacters
287                                                       length: sizeof myCharacters / sizeof *myCharacters];
288
289             NSString* strC8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension];
290
291             NSString *strC9 = [NSString stringWithCharacters: myOtherCharacters
292                                                       length: sizeof myOtherCharacters / sizeof *myOtherCharacters];
293
294             NSString *strC10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
295
296             NSString *strD11 = NSStringFromClass([str10 class]);
297
298             NSString *strD12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
299
300             NSString *eAcute = [NSString stringWithFormat: @"%C", 0x00E9];
301             NSString *randomHaziChar = [NSString stringWithFormat: @"%C", 0x9DC5];
302             NSString *japanese = @"色は匂へど散りぬるを";
303             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.";
304             NSString* french = @"Que veut cette horde d'esclaves, De traîtres, de rois conjurés?";
305             NSString* german = @"Über-Ich und aus den Ansprüchen der sozialen Umwelt";
306
307             void* data_set[3] = {str1,str2,str3};
308         
309                 NSString *hebrew = [NSString stringWithString:@"לילה טוב"];
310
311             NSArray* newArray = [[NSMutableArray alloc] init];
312             [newArray addObject:str1];
313             [newArray addObject:str2];
314             [newArray addObject:str3];
315             [newArray addObject:str4];
316             [newArray addObject:str5];
317             [newArray addObject:str6];
318             [newArray addObject:str7];
319             [newArray addObject:str8];
320             [newArray addObject:str9];
321             [newArray addObject:str10];
322             [newArray addObject:str11];
323             [newArray addObject:str12];
324             [newArray addObject:strA1];
325             [newArray addObject:strA2];
326             [newArray addObject:strA3];
327             [newArray addObject:strA4];
328             [newArray addObject:strA5];
329             [newArray addObject:strA6];
330             [newArray addObject:strA7];
331             [newArray addObject:strA8];
332             [newArray addObject:strA9];
333             [newArray addObject:strA10];
334             [newArray addObject:strA11];
335             [newArray addObject:strA12];
336             [newArray addObject:strB1];
337             [newArray addObject:strB2];
338             [newArray addObject:strB3];
339             [newArray addObject:strB4];
340             [newArray addObject:strB5];
341             [newArray addObject:strB6];
342             [newArray addObject:strB7];
343             [newArray addObject:strB8];
344             [newArray addObject:strB9];
345             [newArray addObject:strB10];
346             [newArray addObject:strB11];
347             [newArray addObject:strB12];
348             [newArray addObject:strC1];
349             [newArray addObject:strC2];
350             [newArray addObject:strC3];
351             [newArray addObject:strC4];
352             [newArray addObject:strC5];
353             [newArray addObject:strC6];
354             [newArray addObject:strC7];
355             [newArray addObject:strC8];
356             [newArray addObject:strC9];
357             [newArray addObject:strC10];
358             [newArray addObject:strC11];
359             [newArray addObject:strC12];
360             [newArray addObject:strD11];
361             [newArray addObject:strD12];
362
363             NSDictionary* newDictionary = [[NSDictionary alloc] initWithObjects:newArray forKeys:newArray];
364             NSDictionary *newMutableDictionary = [[NSMutableDictionary alloc] init];
365             [newMutableDictionary setObject:@"foo" forKey:@"bar0"];
366             [newMutableDictionary setObject:@"foo" forKey:@"bar1"];
367             [newMutableDictionary setObject:@"foo" forKey:@"bar2"];
368             [newMutableDictionary setObject:@"foo" forKey:@"bar3"];
369             [newMutableDictionary setObject:@"foo" forKey:@"bar4"];
370             [newMutableDictionary setObject:@"foo" forKey:@"bar5"];
371             [newMutableDictionary setObject:@"foo" forKey:@"bar6"];
372             [newMutableDictionary setObject:@"foo" forKey:@"bar7"];
373             [newMutableDictionary setObject:@"foo" forKey:@"bar8"];
374             [newMutableDictionary setObject:@"foo" forKey:@"bar9"];
375             [newMutableDictionary setObject:@"foo" forKey:@"bar10"];
376             [newMutableDictionary setObject:@"foo" forKey:@"bar11"];
377             [newMutableDictionary setObject:@"foo" forKey:@"bar12"];
378             [newMutableDictionary setObject:@"foo" forKey:@"bar13"];
379             [newMutableDictionary setObject:@"foo" forKey:@"bar14"];
380             [newMutableDictionary setObject:@"foo" forKey:@"bar15"];
381             [newMutableDictionary setObject:@"foo" forKey:@"bar16"];
382             [newMutableDictionary setObject:@"foo" forKey:@"bar17"];
383             [newMutableDictionary setObject:@"foo" forKey:@"bar18"];
384             [newMutableDictionary setObject:@"foo" forKey:@"bar19"];
385             [newMutableDictionary setObject:@"foo" forKey:@"bar20"];
386
387             id cfKeys[2] = { @"foo", @"bar", @"baz", @"quux" };
388             id cfValues[2] = { @"foo", @"bar", @"baz", @"quux" };
389             NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil));
390             CFDictionaryRef cfDictionaryRef = CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil);
391
392             NSAttributedString* attrString = [[NSAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
393             [attrString isEqual:nil];
394             NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
395             [mutableAttrString isEqual:nil];
396
397             NSString* mutableString = [[NSMutableString alloc] initWithString:@"foo"];
398             [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];
399
400             NSString* mutableGetConst = [NSString stringWithCString:[mutableString cString]];
401
402             [mutableGetConst length];
403
404             NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" length:4];
405             NSData *mutableData = [[NSMutableData alloc] initWithBytes:"NODATA" length:6];
406
407             // No-copy versions of NSData initializers use NSConcreteData if over 2^16 elements are specified.
408             unsigned concreteLength = 100000;
409             void *zeroes1 = calloc(1, concreteLength);
410             // initWithBytesNoCopy takes ownership of the buffer.
411             NSData *concreteData = [[NSData alloc] initWithBytesNoCopy:zeroes1 length:concreteLength];
412             void *zeroes2 = calloc(1, concreteLength);
413             NSMutableData *concreteMutableData = [[NSMutableData alloc] initWithBytesNoCopy:zeroes2 length:concreteLength];
414
415             [mutableData appendBytes:"MOREDATA" length:8];
416
417             [immutableData length];
418             [mutableData length];
419
420             NSSet* nsset = [[NSSet alloc] initWithObjects:str1,str2,str3,nil];
421             NSSet *nsmutableset = [[NSMutableSet alloc] initWithObjects:str1,str2,str3,nil];
422             [nsmutableset addObject:str4];
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 dateWithNaturalLanguageString:@"6pm April 10, 1985"];
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 = &rect;
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