[lldb/test] Reformat Objective-C data-formatter source file (NFC)

The source file used to test Objective-C data-formatters didn't respected
any formatting (mixed tab and spaces, lines exceed column 80, etc...).

This patch reformats the file using clang-format to make it easier to
work with.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani 2020-05-07 05:50:30 +02:00
parent c7b499d82c
commit f058d397ff
No known key found for this signature in database
GPG Key ID: 9040401522D38F4E
1 changed files with 701 additions and 553 deletions

View File

@ -12,8 +12,7 @@
#import <Carbon/Carbon.h> #import <Carbon/Carbon.h>
#endif #endif
@interface MyClass : NSObject @interface MyClass : NSObject {
{
int i; int i;
char c; char c;
float f; float f;
@ -24,8 +23,7 @@
@end @end
@interface MyOtherClass : MyClass @interface MyOtherClass : MyClass {
{
int i2; int i2;
MyClass *backup; MyClass *backup;
} }
@ -35,8 +33,7 @@
@implementation MyClass @implementation MyClass
- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z - (id)initWithInt:(int)x andFloat:(float)y andChar:(char)z {
{
self = [super init]; self = [super init];
if (self) { if (self) {
self->i = x; self->i = x;
@ -46,8 +43,7 @@
return self; return self;
} }
- (int)doIncrementByInt: (int)x - (int)doIncrementByInt:(int)x {
{
self->i += x; self->i += x;
return self->i; return self->i;
} }
@ -56,8 +52,7 @@
@implementation MyOtherClass @implementation MyOtherClass
- (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q - (id)initWithInt:(int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q {
{
self = [super initWithInt:x andFloat:y andChar:z]; self = [super initWithInt:x andFloat:y andChar:z];
if (self) { if (self) {
self->i2 = q; self->i2 = q;
@ -84,12 +79,10 @@
@implementation Atom @implementation Atom
-(void)setMass:(float)newMass - (void)setMass:(float)newMass {
{
mass = newMass; mass = newMass;
} }
-(float)mass - (float)mass {
{
return mass; return mass;
} }
@ -97,43 +90,42 @@
@implementation Molecule @implementation Molecule
-(void)setAtoms:(NSArray *)newAtoms - (void)setAtoms:(NSArray *)newAtoms {
{
atoms = newAtoms; atoms = newAtoms;
} }
-(NSArray *)atoms - (NSArray *)atoms {
{
return atoms; return atoms;
} }
@end @end
@interface My_KVO_Observer : NSObject @interface My_KVO_Observer : NSObject
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change - (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context; context:(void *)context;
- (id)init; - (id)init;
- (void)dealloc; - (void)dealloc;
@end @end
@implementation My_KVO_Observer @implementation My_KVO_Observer
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change - (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context { context:(void *)context {
// we do not really care about KVO'ing - do nothing // we do not really care about KVO'ing - do nothing
return; return;
} }
- (id) init - (id)init {
{
self = [super init]; self = [super init];
return self; return self;
} }
- (void) dealloc - (void)dealloc {
{
[super dealloc]; [super dealloc];
} }
@end @end
int main (int argc, const char * argv[]) int main(int argc, const char *argv[]) {
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@ -141,7 +133,10 @@ int main (int argc, const char * argv[])
[object doIncrementByInt:3]; [object doIncrementByInt:3];
MyOtherClass *object2 = [[MyOtherClass alloc] initWithInt:2 andFloat:6.28 andChar: 'G' andOtherInt:-1]; MyOtherClass *object2 = [[MyOtherClass alloc] initWithInt:2
andFloat:6.28
andChar:'G'
andOtherInt:-1];
[object2 doIncrementByInt:3]; [object2 doIncrementByInt:3];
@ -160,21 +155,31 @@ int main (int argc, const char * argv[])
NSNumber *num_at3 = @12.5; NSNumber *num_at3 = @12.5;
NSNumber *num_at4 = @-12.5; NSNumber *num_at4 = @-12.5;
NSDecimalNumber* decimal_number = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:-10 isNegative:NO]; NSDecimalNumber *decimal_number =
NSDecimalNumber* decimal_number_neg = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:10 isNegative:YES]; [NSDecimalNumber decimalNumberWithMantissa:123456
exponent:-10
isNegative:NO];
NSDecimalNumber *decimal_number_neg =
[NSDecimalNumber decimalNumberWithMantissa:123456
exponent:10
isNegative:YES];
NSDecimalNumber *decimal_one = [NSDecimalNumber one]; NSDecimalNumber *decimal_one = [NSDecimalNumber one];
NSDecimalNumber *decimal_zero = [NSDecimalNumber zero]; NSDecimalNumber *decimal_zero = [NSDecimalNumber zero];
NSDecimalNumber *decimal_nan = [NSDecimalNumber notANumber]; NSDecimalNumber *decimal_nan = [NSDecimalNumber notANumber];
NSString *str0 = [num6 stringValue]; NSString *str0 = [num6 stringValue];
NSString *str1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; NSString *str1 =
[NSString stringWithCString:"A rather short ASCII NSString object is here"
encoding:NSASCIIStringEncoding];
NSString *str2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; NSString *str2 = [NSString
stringWithUTF8String:"A rather short UTF8 NSString object is here"];
NSString *str3 = @"A string made with the at sign is here"; NSString *str3 = @"A string made with the at sign is here";
NSString *str4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; NSString *str4 = [NSString
stringWithFormat:@"This is string number %ld right here", (long)4];
NSRect ns_rect_4str = {{1, 1}, {5, 5}}; NSRect ns_rect_4str = {{1, 1}, {5, 5}};
@ -183,117 +188,211 @@ int main (int argc, const char * argv[])
NSString *str6 = [@"/usr/doc/README.1ST" pathExtension]; NSString *str6 = [@"/usr/doc/README.1ST" pathExtension];
const unichar myCharacters[] = {0x03C3, 'x', 'x'}; const unichar myCharacters[] = {0x03C3, 'x', 'x'};
NSString *str7 = [NSString stringWithCharacters: myCharacters NSString *str7 = [NSString
stringWithCharacters:myCharacters
length:sizeof myCharacters / sizeof *myCharacters]; length:sizeof myCharacters / sizeof *myCharacters];
NSString* str8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; NSString *str8 =
[@"/usr/doc/"
@"file."
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTime" pathExtension];
const unichar myOtherCharacters[] = {'a',' ', 'v','e','r','y',' ', const unichar myOtherCharacters[] = {
'm','u','c','h',' ','b','o','r','i','n','g',' ','t','a','s','k', 'a', ' ', 'v', 'e', 'r', 'y', ' ', 'm', 'u', 'c', 'h', ' ', 'b', 'o',
' ','t','o',' ','w','r','i','t','e', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'r', 'i', 'n', 'g', ' ', 't', 'a', 's', 'k', ' ', 't', 'o', ' ', 'w',
'r', 'i', 't', 'e', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ',
't', 'h', 'i', 's', ' ', 'w', 'a', 'y', '!', '!', 0x03C3, 0}; 't', 'h', 'i', 's', ' ', 'w', 'a', 'y', '!', '!', 0x03C3, 0};
NSString *str9 = [NSString stringWithCharacters:myOtherCharacters NSString *str9 = [NSString stringWithCharacters:myOtherCharacters
length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; length:sizeof myOtherCharacters /
sizeof *myOtherCharacters];
const unichar myNextCharacters[] = {0x03C3, 0x0000}; const unichar myNextCharacters[] = {0x03C3, 0x0000};
NSString *str10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; NSString *str10 = [NSString
stringWithFormat:@"This is a Unicode string %S number %ld right here",
myNextCharacters, (long)4];
NSString *str11 = NSStringFromClass([str10 class]); NSString *str11 = NSStringFromClass([str10 class]);
NSString *label1 = @"Process Name: "; NSString *label1 = @"Process Name: ";
NSString *label2 = @"Process Id: "; NSString *label2 = @"Process Id: ";
NSString *processName = [[NSProcessInfo processInfo] processName]; NSString *processName = [[NSProcessInfo processInfo] processName];
NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]]; NSString *processID = [NSString
NSString *str12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]];
NSString *str12 = [NSString
stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
NSString *strA1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; NSString *strA1 =
[NSString stringWithCString:"A rather short ASCII NSString object is here"
encoding:NSASCIIStringEncoding];
NSString *strA2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; NSString *strA2 = [NSString
stringWithUTF8String:"A rather short UTF8 NSString object is here"];
NSString *strA3 = @"A string made with the at sign is here"; NSString *strA3 = @"A string made with the at sign is here";
NSString *strA4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; NSString *strA4 = [NSString
stringWithFormat:@"This is string number %ld right here", (long)4];
NSString *strA5 = NSStringFromRect(ns_rect_4str); NSString *strA5 = NSStringFromRect(ns_rect_4str);
NSString *strA6 = [@"/usr/doc/README.1ST" pathExtension]; NSString *strA6 = [@"/usr/doc/README.1ST" pathExtension];
NSString *strA7 = [NSString stringWithCharacters: myCharacters NSString *strA7 = [NSString
stringWithCharacters:myCharacters
length:sizeof myCharacters / sizeof *myCharacters]; length:sizeof myCharacters / sizeof *myCharacters];
NSString* strA8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; NSString *strA8 =
[@"/usr/doc/"
@"file."
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTime" pathExtension];
NSString *strA9 = [NSString stringWithCharacters:myOtherCharacters NSString *strA9 = [NSString stringWithCharacters:myOtherCharacters
length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; length:sizeof myOtherCharacters /
sizeof *myOtherCharacters];
NSString *strA10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; NSString *strA10 = [NSString
stringWithFormat:@"This is a Unicode string %S number %ld right here",
myNextCharacters, (long)4];
NSString *strA11 = NSStringFromClass([str10 class]); NSString *strA11 = NSStringFromClass([str10 class]);
NSString *strA12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; NSString *strA12 = [NSString
stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
NSString *strB1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; NSString *strB1 =
[NSString stringWithCString:"A rather short ASCII NSString object is here"
encoding:NSASCIIStringEncoding];
NSString *strB2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; NSString *strB2 = [NSString
stringWithUTF8String:"A rather short UTF8 NSString object is here"];
NSString *strB3 = @"A string made with the at sign is here"; NSString *strB3 = @"A string made with the at sign is here";
NSString *strB4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; NSString *strB4 = [NSString
stringWithFormat:@"This is string number %ld right here", (long)4];
NSString *strB5 = NSStringFromRect(ns_rect_4str); NSString *strB5 = NSStringFromRect(ns_rect_4str);
NSString *strB6 = [@"/usr/doc/README.1ST" pathExtension]; NSString *strB6 = [@"/usr/doc/README.1ST" pathExtension];
NSString *strB7 = [NSString stringWithCharacters: myCharacters NSString *strB7 = [NSString
stringWithCharacters:myCharacters
length:sizeof myCharacters / sizeof *myCharacters]; length:sizeof myCharacters / sizeof *myCharacters];
NSString* strB8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; NSString *strB8 =
[@"/usr/doc/"
@"file."
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTime" pathExtension];
NSString *strB9 = [NSString stringWithCharacters:myOtherCharacters NSString *strB9 = [NSString stringWithCharacters:myOtherCharacters
length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; length:sizeof myOtherCharacters /
sizeof *myOtherCharacters];
NSString *strB10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; NSString *strB10 = [NSString
stringWithFormat:@"This is a Unicode string %S number %ld right here",
myNextCharacters, (long)4];
NSString *strB11 = NSStringFromClass([str10 class]); NSString *strB11 = NSStringFromClass([str10 class]);
NSString *strB12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; NSString *strB12 = [NSString
stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
NSString *strC11 = NSStringFromClass([str10 class]); NSString *strC11 = NSStringFromClass([str10 class]);
NSString *strC12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; NSString *strC12 = [NSString
stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
NSString *strC1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding]; NSString *strC1 =
[NSString stringWithCString:"A rather short ASCII NSString object is here"
encoding:NSASCIIStringEncoding];
NSString *strC2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"]; NSString *strC2 = [NSString
stringWithUTF8String:"A rather short UTF8 NSString object is here"];
NSString *strC3 = @"A string made with the at sign is here"; NSString *strC3 = @"A string made with the at sign is here";
NSString *strC4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4]; NSString *strC4 = [NSString
stringWithFormat:@"This is string number %ld right here", (long)4];
NSString *strC5 = NSStringFromRect(ns_rect_4str); NSString *strC5 = NSStringFromRect(ns_rect_4str);
NSString *strC6 = [@"/usr/doc/README.1ST" pathExtension]; NSString *strC6 = [@"/usr/doc/README.1ST" pathExtension];
NSString *strC7 = [NSString stringWithCharacters: myCharacters NSString *strC7 = [NSString
stringWithCharacters:myCharacters
length:sizeof myCharacters / sizeof *myCharacters]; length:sizeof myCharacters / sizeof *myCharacters];
NSString* strC8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension]; NSString *strC8 =
[@"/usr/doc/"
@"file."
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime"
@"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExt"
@"ensionThisTime" pathExtension];
NSString *strC9 = [NSString stringWithCharacters:myOtherCharacters NSString *strC9 = [NSString stringWithCharacters:myOtherCharacters
length: sizeof myOtherCharacters / sizeof *myOtherCharacters]; length:sizeof myOtherCharacters /
sizeof *myOtherCharacters];
NSString *strC10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4]; NSString *strC10 = [NSString
stringWithFormat:@"This is a Unicode string %S number %ld right here",
myNextCharacters, (long)4];
NSString *strD11 = NSStringFromClass([str10 class]); NSString *strD11 = NSStringFromClass([str10 class]);
NSString *strD12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID]; NSString *strD12 = [NSString
stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
NSString *eAcute = [NSString stringWithFormat:@"%C", 0x00E9]; NSString *eAcute = [NSString stringWithFormat:@"%C", 0x00E9];
NSString *randomHaziChar = [NSString stringWithFormat:@"%C", 0x9DC5]; NSString *randomHaziChar = [NSString stringWithFormat:@"%C", 0x9DC5];
NSString *japanese = @"色は匂へど散りぬるを"; NSString *japanese = @"色は匂へど散りぬるを";
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."; NSString *italian = @"L'Italia è una Repubblica democratica, fondata sul "
NSString* french = @"Que veut cette horde d'esclaves, De traîtres, de rois conjurés?"; @"lavoro. La sovranità appartiene al popolo, che la "
@"esercita nelle forme e nei limiti della Costituzione.";
NSString *french =
@"Que veut cette horde d'esclaves, De traîtres, de rois conjurés?";
NSString *german = @"Über-Ich und aus den Ansprüchen der sozialen Umwelt"; NSString *german = @"Über-Ich und aus den Ansprüchen der sozialen Umwelt";
void *data_set[3] = {str1, str2, str3}; void *data_set[3] = {str1, str2, str3};
@ -352,7 +451,8 @@ int main (int argc, const char * argv[])
[newArray addObject:strD11]; [newArray addObject:strD11];
[newArray addObject:strD12]; [newArray addObject:strD12];
NSDictionary* newDictionary = [[NSDictionary alloc] initWithObjects:newArray forKeys:newArray]; NSDictionary *newDictionary = [[NSDictionary alloc] initWithObjects:newArray
forKeys:newArray];
NSDictionary *newMutableDictionary = [[NSMutableDictionary alloc] init]; NSDictionary *newMutableDictionary = [[NSMutableDictionary alloc] init];
[newMutableDictionary setObject:@"foo" forKey:@"bar0"]; [newMutableDictionary setObject:@"foo" forKey:@"bar0"];
[newMutableDictionary setObject:@"foo" forKey:@"bar1"]; [newMutableDictionary setObject:@"foo" forKey:@"bar1"];
@ -378,37 +478,58 @@ int main (int argc, const char * argv[])
id cfKeys[4] = {@"foo", @"bar", @"baz", @"quux"}; id cfKeys[4] = {@"foo", @"bar", @"baz", @"quux"};
id cfValues[4] = {@"foo", @"bar", @"baz", @"quux"}; id cfValues[4] = {@"foo", @"bar", @"baz", @"quux"};
NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate( NSDictionary *nsDictionary = CFBridgingRelease(
nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil)); CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil));
NSDictionary *nscfDictionary = CFBridgingRelease(CFDictionaryCreate( NSDictionary *nscfDictionary = CFBridgingRelease(
nil, (void *)cfKeys, (void *)cfValues, 4, nil, nil)); CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 4, nil, nil));
CFDictionaryRef cfDictionaryRef = CFDictionaryCreate( CFDictionaryRef cfDictionaryRef =
nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil); CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil);
NSAttributedString *attrString = [[NSAttributedString alloc] NSAttributedString *attrString =
initWithString:@"hello world from foo" [[NSAttributedString alloc] initWithString:@"hello world from foo"
attributes:newDictionary]; attributes:newDictionary];
[attrString isEqual:nil]; [attrString isEqual:nil];
NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary]; NSAttributedString *mutableAttrString =
[[NSMutableAttributedString alloc] initWithString:@"hello world from foo"
attributes:newDictionary];
[mutableAttrString isEqual:nil]; [mutableAttrString isEqual:nil];
NSString *mutableString = [[NSMutableString alloc] initWithString:@"foo"]; NSString *mutableString = [[NSMutableString alloc] initWithString:@"foo"];
[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]; [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];
NSString* mutableGetConst = [NSString stringWithCString:[mutableString cString]]; NSString *mutableGetConst =
[NSString stringWithCString:[mutableString cString]];
[mutableGetConst length]; [mutableGetConst length];
NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" length:5]; NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" length:5];
NSData *mutableData = [[NSMutableData alloc] initWithBytes:"NODATA" length:6]; NSData *mutableData = [[NSMutableData alloc] initWithBytes:"NODATA" length:6];
// No-copy versions of NSData initializers use NSConcreteData if over 2^16 elements are specified. // No-copy versions of NSData initializers use NSConcreteData if over 2^16
// elements are specified.
unsigned concreteLength = 100000; unsigned concreteLength = 100000;
void *zeroes1 = calloc(1, concreteLength); void *zeroes1 = calloc(1, concreteLength);
// initWithBytesNoCopy takes ownership of the buffer. // initWithBytesNoCopy takes ownership of the buffer.
NSData *concreteData = [[NSData alloc] initWithBytesNoCopy:zeroes1 length:concreteLength]; NSData *concreteData = [[NSData alloc] initWithBytesNoCopy:zeroes1
length:concreteLength];
void *zeroes2 = calloc(1, concreteLength); void *zeroes2 = calloc(1, concreteLength);
NSMutableData *concreteMutableData = [[NSMutableData alloc] initWithBytesNoCopy:zeroes2 length:concreteLength]; NSMutableData *concreteMutableData =
[[NSMutableData alloc] initWithBytesNoCopy:zeroes2 length:concreteLength];
[mutableData appendBytes:"MOREDATA" length:8]; [mutableData appendBytes:"MOREDATA" length:8];
@ -416,14 +537,17 @@ int main (int argc, const char * argv[])
[mutableData length]; [mutableData length];
NSSet *nsset = [[NSSet alloc] initWithObjects:str1, str2, str3, nil]; NSSet *nsset = [[NSSet alloc] initWithObjects:str1, str2, str3, nil];
NSSet *nsmutableset = [[NSMutableSet alloc] initWithObjects:str1,str2,str3,nil]; NSSet *nsmutableset =
[[NSMutableSet alloc] initWithObjects:str1, str2, str3, nil];
[nsmutableset addObject:str4]; [nsmutableset addObject:str4];
NSSet *nscfSet = NSSet *nscfSet =
CFBridgingRelease(CFSetCreate(nil, (void *)cfValues, 2, nil)); CFBridgingRelease(CFSetCreate(nil, (void *)cfValues, 2, nil));
CFDataRef data_ref = CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5); CFDataRef data_ref =
CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5);
CFMutableDataRef mutable_data_ref = CFDataCreateMutable(kCFAllocatorDefault, 8); CFMutableDataRef mutable_data_ref =
CFDataCreateMutable(kCFAllocatorDefault, 8);
CFDataAppendBytes(mutable_data_ref, [mutableData bytes], 5); CFDataAppendBytes(mutable_data_ref, [mutableData bytes], 5);
CFMutableStringRef mutable_string_ref = CFStringCreateMutable(NULL, 100); CFMutableStringRef mutable_string_ref = CFStringCreateMutable(NULL, 100);
@ -447,7 +571,8 @@ int main (int argc, const char * argv[])
CFArraySetValueAtIndex(mutable_array_ref, 9, str11); CFArraySetValueAtIndex(mutable_array_ref, 9, str11);
CFArraySetValueAtIndex(mutable_array_ref, 10, str12); CFArraySetValueAtIndex(mutable_array_ref, 10, str12);
CFBinaryHeapRef binheap_ref = CFBinaryHeapCreate(NULL, 15, &kCFStringBinaryHeapCallBacks, NULL); CFBinaryHeapRef binheap_ref =
CFBinaryHeapCreate(NULL, 15, &kCFStringBinaryHeapCallBacks, NULL);
CFBinaryHeapAddValue(binheap_ref, str1); CFBinaryHeapAddValue(binheap_ref, str1);
CFBinaryHeapAddValue(binheap_ref, str2); CFBinaryHeapAddValue(binheap_ref, str2);
CFBinaryHeapAddValue(binheap_ref, str3); CFBinaryHeapAddValue(binheap_ref, str3);
@ -470,16 +595,25 @@ int main (int argc, const char * argv[])
CFBinaryHeapAddValue(binheap_ref, strC12); CFBinaryHeapAddValue(binheap_ref, strC12);
CFBinaryHeapAddValue(binheap_ref, strA12); CFBinaryHeapAddValue(binheap_ref, strA12);
CFURLRef cfurl_ref = CFURLCreateWithString(NULL, CFSTR("http://www.foo.bar/"), NULL); CFURLRef cfurl_ref =
CFURLRef cfchildurl_ref = CFURLCreateWithString(NULL, CFSTR("page.html"), cfurl_ref); CFURLCreateWithString(NULL, CFSTR("http://www.foo.bar/"), NULL);
CFURLRef cfgchildurl_ref = CFURLCreateWithString(NULL, CFSTR("?whatever"), cfchildurl_ref); CFURLRef cfchildurl_ref =
CFURLCreateWithString(NULL, CFSTR("page.html"), cfurl_ref);
CFURLRef cfgchildurl_ref =
CFURLCreateWithString(NULL, CFSTR("?whatever"), cfchildurl_ref);
NSDictionary *error_userInfo = @{@"a" : @1, @"b" : @2}; NSDictionary *error_userInfo = @{@"a" : @1, @"b" : @2};
NSError *nserror = [[NSError alloc] initWithDomain:@"Foobar" code:12 userInfo:error_userInfo]; NSError *nserror = [[NSError alloc] initWithDomain:@"Foobar"
code:12
userInfo:error_userInfo];
NSError **nserrorptr = &nserror; NSError **nserrorptr = &nserror;
NSBundle* bundle_string = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/Accelerate.framework"]; NSBundle *bundle_string = [[NSBundle alloc]
NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Foundation.framework"]]; initWithPath:@"/System/Library/Frameworks/Accelerate.framework"];
NSBundle *bundle_url = [[NSBundle alloc]
initWithURL:[[NSURL alloc]
initWithString:@"file://localhost/System/Library/"
@"Frameworks/Foundation.framework"]];
NSBundle *main_bundle = [NSBundle mainBundle]; NSBundle *main_bundle = [NSBundle mainBundle];
@ -487,25 +621,39 @@ int main (int argc, const char * argv[])
NSURL *nsurl0; NSURL *nsurl0;
for (NSBundle* bundle in bundles) for (NSBundle *bundle in bundles) {
{
nsurl0 = [bundle bundleURL]; nsurl0 = [bundle bundleURL];
} }
NSException* except0 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName" reason:@"First" userInfo:nil]; NSException *except0 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName"
NSException* except1 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName~1" reason:@"Second" userInfo:nil]; reason:@"First"
NSException* except2 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName`2" reason:@"Third" userInfo:nil]; userInfo:nil];
NSException* except3 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName/3" reason:@"Fourth" userInfo:nil]; NSException *except1 =
[[NSException alloc] initWithName:@"TheGuyWhoHasNoName~1"
reason:@"Second"
userInfo:nil];
NSException *except2 =
[[NSException alloc] initWithName:@"TheGuyWhoHasNoName`2"
reason:@"Third"
userInfo:nil];
NSException *except3 =
[[NSException alloc] initWithName:@"TheGuyWhoHasNoName/3"
reason:@"Fourth"
userInfo:nil];
NSURL *nsurl = [[NSURL alloc] initWithString:@"http://www.foo.bar"]; NSURL *nsurl = [[NSURL alloc] initWithString:@"http://www.foo.bar"];
NSURL *nsurl2 = [NSURL URLWithString:@"page.html" relativeToURL:nsurl]; NSURL *nsurl2 = [NSURL URLWithString:@"page.html" relativeToURL:nsurl];
NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" relativeToURL:nsurl2]; NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" relativeToURL:nsurl2];
NSDate *date1 = [NSDate dateWithTimeIntervalSince1970:133890*60*60]; // 6pm April 10, 1985 GMT NSDate *date1 = [NSDate
NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am January 1, 2011"]; dateWithTimeIntervalSince1970:133890 * 60 * 60]; // 6pm April 10, 1985 GMT
NSDate *date2 =
[NSDate dateWithNaturalLanguageString:@"12am January 1, 2011"];
NSDate *date3 = [NSDate date]; NSDate *date3 = [NSDate date];
NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24 * 60 * 60]; NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24 * 60 * 60];
NSDate *date5 = [NSDate dateWithTimeIntervalSinceReferenceDate: floor([[NSDate date] timeIntervalSinceReferenceDate])]; NSDate *date5 =
[NSDate dateWithTimeIntervalSinceReferenceDate:
floor([[NSDate date] timeIntervalSinceReferenceDate])];
CFAbsoluteTime date1_abs = CFDateGetAbsoluteTime(date1); CFAbsoluteTime date1_abs = CFDateGetAbsoluteTime(date1);
CFAbsoluteTime date2_abs = CFDateGetAbsoluteTime(date2); CFAbsoluteTime date2_abs = CFDateGetAbsoluteTime(date2);
@ -513,8 +661,10 @@ int main (int argc, const char * argv[])
CFAbsoluteTime date4_abs = CFDateGetAbsoluteTime(date4); CFAbsoluteTime date4_abs = CFDateGetAbsoluteTime(date4);
CFAbsoluteTime date5_abs = CFDateGetAbsoluteTime(date5); CFAbsoluteTime date5_abs = CFDateGetAbsoluteTime(date5);
NSIndexSet *iset1 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 4)]; NSIndexSet *iset1 =
NSIndexSet *iset2 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)]; [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 4)];
NSIndexSet *iset2 =
[[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)];
NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init]; NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init];
[imset addIndex:1936]; [imset addIndex:1936];
@ -528,25 +678,18 @@ int main (int argc, const char * argv[])
[imset addIndex:62]; [imset addIndex:62];
[imset addIndex:63]; [imset addIndex:63];
CFTimeZoneRef cupertino = CFTimeZoneCreateWithName ( CFTimeZoneRef cupertino = CFTimeZoneCreateWithName(NULL, CFSTR("PST"), YES);
NULL, CFTimeZoneRef home =
CFSTR("PST"), CFTimeZoneCreateWithName(NULL, CFSTR("Europe/Rome"), YES);
YES); CFTimeZoneRef europe = CFTimeZoneCreateWithName(NULL, CFSTR("CET"), YES);
CFTimeZoneRef home = CFTimeZoneCreateWithName (
NULL,
CFSTR("Europe/Rome"),
YES);
CFTimeZoneRef europe = CFTimeZoneCreateWithName (
NULL,
CFSTR("CET"),
YES);
NSTimeZone *cupertino_ns = [NSTimeZone timeZoneWithAbbreviation:@"PST"]; NSTimeZone *cupertino_ns = [NSTimeZone timeZoneWithAbbreviation:@"PST"];
NSTimeZone *home_ns = [NSTimeZone timeZoneWithName:@"Europe/Rome"]; NSTimeZone *home_ns = [NSTimeZone timeZoneWithName:@"Europe/Rome"];
NSTimeZone *europe_ns = [NSTimeZone timeZoneWithAbbreviation:@"CET"]; NSTimeZone *europe_ns = [NSTimeZone timeZoneWithAbbreviation:@"CET"];
CFGregorianUnits cf_greg_units = {1, 3, 5, 12, 5, 7}; CFGregorianUnits cf_greg_units = {1, 3, 5, 12, 5, 7};
CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(date1), NULL); CFGregorianDate cf_greg_date =
CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(date1), NULL);
CFRange cf_range = {4, 4}; CFRange cf_range = {4, 4};
NSPoint ns_point = {4, 4}; NSPoint ns_point = {4, 4};
NSRange ns_range = {4, 4}; NSRange ns_range = {4, 4};
@ -620,8 +763,14 @@ int main (int argc, const char * argv[])
NSArray *components = @[ @"usr", @"blah", @"stuff" ]; NSArray *components = @[ @"usr", @"blah", @"stuff" ];
NSString *path = [NSString pathWithComponents:components]; NSString *path = [NSString pathWithComponents:components];
[molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL]; // Set break point at this line. [molecule addObserver:[My_KVO_Observer new]
[newMutableDictionary addObserver:[My_KVO_Observer new] forKeyPath:@"weirdKeyToKVO" options:NSKeyValueObservingOptionNew context:NULL]; forKeyPath:@"atoms"
options:0
context:NULL]; // Set break point at this line.
[newMutableDictionary addObserver:[My_KVO_Observer new]
forKeyPath:@"weirdKeyToKVO"
options:NSKeyValueObservingOptionNew
context:NULL];
[molecule setAtoms:nil]; [molecule setAtoms:nil];
[molecule setAtoms:[NSMutableArray new]]; [molecule setAtoms:[NSMutableArray new]];
@ -629,4 +778,3 @@ int main (int argc, const char * argv[])
[pool drain]; [pool drain];
return 0; return 0;
} }