Skip to content

Instantly share code, notes, and snippets.

@jorbsd
Created March 9, 2010 01:20
Show Gist options
  • Save jorbsd/326039 to your computer and use it in GitHub Desktop.
Save jorbsd/326039 to your computer and use it in GitHub Desktop.
// clang -ggdb -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test test.m -framework JBBAdditions -framework Cocoa
// clang -arch i386 -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test test.m -framework JBBAdditions -framework Cocoa
#import <stdlib.h>
#import <stdio.h>
#import <Cocoa/Cocoa.h>
#import <JBBAdditions/JBBAdditions.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
[[NSString jbb_continuationProxyWithContinuation:^(id anObject) {
[anObject jbb_puts];
}] stringWithCString:"this is a test" encoding:NSUTF8StringEncoding];
__block NSString *testString = nil;
[[NSString jbb_continuationProxyWithContinuation:^(id anObject) {
testString = [anObject retain];
}] stringWithCString:"this is another test" encoding:NSUTF8StringEncoding];
[testString jbb_puts];
[testString release];
[[NSString jbb_continuationProxyWithContinuation:^(id anObject) {
[@"this is a third test" jbb_puts];
}
errorHandler:^(NSError *anError) {
[[NSString stringWithFormat:@"this is an error: %@", anError] jbb_puts];
}] stringWithContentsOfFile:@"/tmp/fake_file" encoding:NSUTF8StringEncoding error:nil];
NSString *testString2 = [[NSString jbb_continuationProxy] stringWithCString:"this is another test" encoding:NSUTF8StringEncoding];
NSUInteger testInt = [[@"hello, world" jbb_continuationProxy] length];
[[NSString stringWithFormat:@"\n\nlast two tests: %@, %u", testString2, testInt] jbb_puts];
[localPool drain];
return 0;
}
// clang -ggdb -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test2 test2.m -framework JBBAdditions -framework Cocoa
// clang -arch i386 -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test2 test2.m -framework JBBAdditions -framework Cocoa
#import <stdlib.h>
#import <stdio.h>
#import <Cocoa/Cocoa.h>
#import <JBBAdditions/JBBAdditions.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
[WRAP_MSG_SEND(NSString, stringWithCString:"this is a test" encoding:NSUTF8StringEncoding)
jbb_invokeWithContinuation:^(id anObject) {
[anObject jbb_puts];
}];
__block NSString *testString = nil;
[WRAP_MSG_SEND(NSString, stringWithCString:"this is another test" encoding:NSUTF8StringEncoding)
jbb_invokeWithContinuation:^(id anObject) {
testString = [anObject retain];
}];
[testString jbb_puts];
[testString release];
[WRAP_MSG_SEND(NSString, stringWithContentsOfFile:@"/tmp/fake_file" encoding:NSUTF8StringEncoding error:nil)
jbb_invokeWithContinuation:^(id anObject) {
[@"this is a third test" jbb_puts];
}
errorHandler:^(NSError *anError) {
[[NSString stringWithFormat:@"this is an error: %@", anError] jbb_puts];
}];
[localPool drain];
return 0;
}
// clang -ggdb -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test3 test3.m -framework JBBAdditions -framework Cocoa
// clang -arch i386 -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test3 test3.m -framework JBBAdditions -framework Cocoa
#import <stdlib.h>
#import <stdio.h>
#import <Cocoa/Cocoa.h>
#import <JBBAdditions/JBBAdditions.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
[[[NSString jbb_invocationProxy] stringWithCString:"this is a test" encoding:NSUTF8StringEncoding], [JBBInvocationProxy getInvocation]
jbb_invokeWithContinuation:^(id anObject) {
[anObject jbb_puts];
}];
__block NSString *testString = nil;
[[[NSString jbb_invocationProxy] stringWithCString:"this is another test" encoding:NSUTF8StringEncoding], [JBBInvocationProxy getInvocation]
jbb_invokeWithContinuation:^(id anObject) {
testString = [anObject retain];
}];
[testString jbb_puts];
[testString release];
[[[NSString jbb_invocationProxy] stringWithContentsOfFile:@"/tmp/fake_file" encoding:NSUTF8StringEncoding error:nil], [JBBInvocationProxy getInvocation]
jbb_invokeWithContinuation:^(id anObject) {
[@"this is a third test" jbb_puts];
}
errorHandler:^(NSError *anError) {
[[NSString stringWithFormat:@"this is an error: %@", anError] jbb_puts];
}];
[localPool drain];
return 0;
}
// clang -ggdb -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test4 test4.m -framework JBBAdditions -framework Cocoa
// clang -arch i386 -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test4 test4.m -framework JBBAdditions -framework Cocoa
#import <stdlib.h>
#import <stdio.h>
#import <Cocoa/Cocoa.h>
#import <JBBAdditions/JBBAdditions.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
[[NSString jbb_invocationProxy] stringWithCString:"this is a test" encoding:NSUTF8StringEncoding];
[JBBInvocationProxy invokeWithContinuation:^(id anObject) {
[anObject jbb_puts];
}];
__block NSString *testString = nil;
[[NSString jbb_invocationProxy] stringWithCString:"this is another test" encoding:NSUTF8StringEncoding];
[JBBInvocationProxy invokeWithContinuation:^(id anObject) {
testString = [anObject retain];
}];
[testString jbb_puts];
[testString release];
[[NSString jbb_invocationProxy] stringWithContentsOfFile:@"/tmp/fake_file" encoding:NSUTF8StringEncoding error:nil];
[JBBInvocationProxy invokeWithContinuation:^(id anObject) {
[@"this is a third test" jbb_puts];
}
errorHandler:^(NSError *anError) {
[[NSString stringWithFormat:@"this is an error: %@", anError] jbb_puts];
}];
[localPool drain];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment