Browse files

Added Self Control app source, with ability to open empty VM for buil…

…ding.
  • Loading branch information...
1 parent f778131 commit 1fafc9edfc66d60ce7ca6740def031adc751d15e @russellallen committed Mar 30, 2012
View
1 .gitignore
@@ -3,7 +3,6 @@
*~
*.snap
*.old
-Self
bin/linux/AddTrailingNewline
bin/linux/UpdateFiles
bin/linux/cmprev
View
BIN ...oj/project.xcworkspace/xcuserdata/russellallen.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
View
BIN controller/osx/Self.app/Contents/MacOS/Self
Binary file not shown.
View
32 controller/osx/Self/RunningSelfVMManagerModel.h
@@ -0,0 +1,32 @@
+//
+// RunningSelfVMManagerModel.h
+// Self
+//
+// Created by Russell Allen on 13/01/12.
+// Copyright 2012 AUTHORS. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@class SelfWorld;
+
+@interface RunningSelfVMManagerModel : NSObject <NSTableViewDelegate, NSTableViewDataSource> {
+ NSMutableArray *running;
+ IBOutlet NSTableView* myTable;
+ IBOutlet NSButton* openTerminalButton;
+ IBOutlet NSButton* forceQuitButton;
+}
+
+-(void)registerRunningVM:(SelfWorld *)vm;
+-(void)killAll;
+-(NSString*)nameOfSelectedWorld;
+-(BOOL)warnBeforeClose;
+-(void)notifyTaskEnded:(SelfWorld *)vm;
+-(void)forceQuit:(NSNotification *)aNotification;
+-(void)openTerminal:(NSNotification *)aNotification;
+
+@property (nonatomic, retain) IBOutlet NSTableView* myTable;
+@property (nonatomic, retain) IBOutlet NSButton* openTerminalButton;
+@property (nonatomic, retain) IBOutlet NSButton* forceQuitButton;
+
+@end
View
129 controller/osx/Self/RunningSelfVMManagerModel.m
@@ -0,0 +1,129 @@
+//
+// RunningSelfVMManagerModel.m
+// Self
+//
+// Created by Russell Allen on 13/01/12.
+// Copyright 2012 AUTHORS. All rights reserved.
+//
+
+#import "RunningSelfVMManagerModel.h"
+#import "SelfAppDelegate.h"
+#import "SelfWorld.h"
+
+@implementation RunningSelfVMManagerModel
+
+@synthesize myTable;
+@synthesize openTerminalButton;
+@synthesize forceQuitButton;
+
+-(void)awakeFromNib
+{
+ // Register myself for use by application
+ SelfAppDelegate *app = [NSApp delegate];
+ [app setModel: self];
+ [openTerminalButton setEnabled:NO];
+ [forceQuitButton setEnabled:NO];
+}
+
+- (id)init
+{
+ self = [super init];
+ if (self) {
+ // Initialization code here.
+ running = [[NSMutableArray alloc] init];
+ }
+ return self;
+}
+
+- (void) dealloc
+{
+ [running release];
+ [super dealloc];
+}
+
+-(void)registerRunningVM:(SelfWorld *)vm
+{
+ [running addObject: vm];
+ [vm notifyMe:self];
+ [myTable reloadData];
+}
+
+-(BOOL)warnBeforeClose
+{
+ return [running count] > 0;
+}
+
+-(void)killAll
+{
+ NSTask *t;
+ NSEnumerator* myIterator = [running objectEnumerator];
+
+ while( t = [myIterator nextObject])
+ {
+ [t terminate];
+ }
+}
+
+-(void)notifyTaskEnded:(SelfWorld *)vm
+{
+ [running removeObject:vm];
+ [myTable reloadData];
+}
+
+// TableViewDataSource
+
+- (id)tableView:(NSTableView *)tableView
+ objectValueForTableColumn:(NSTableColumn *)tableColumn
+ row:(NSInteger)row {
+
+ return [[running objectAtIndex:row] getName];
+
+}
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
+ return [running count];
+}
+
+// TableViewDelagate
+
+- (IBAction)tableViewSelected:(NSTableView *)tableView
+{
+ if ([tableView selectedRow] == -1) {
+ [openTerminalButton setEnabled:NO];
+ [forceQuitButton setEnabled:NO];
+ } else {
+ [openTerminalButton setEnabled:YES];
+ [forceQuitButton setEnabled:YES];
+ }
+}
+
+- (NSString*)nameOfSelectedWorld
+{
+ return [(SelfWorld*)[running objectAtIndex:[myTable selectedRow]] getNameForScreen];
+}
+
+// MANAGING
+
+- (void)openTerminal:(NSNotification *)aNotification
+{
+ NSString *s = [NSString stringWithFormat:
+ @"tell application \"Terminal\" to do script \"screen -t Self -D -r %@\"", [self nameOfSelectedWorld]];
+ NSAppleScript *as = [[NSAppleScript alloc] initWithSource: s];
+ [as executeAndReturnError:nil];
+
+ s = @"tell application \"Terminal\" to activate";
+ as = [[NSAppleScript alloc] initWithSource: s];
+ [as executeAndReturnError:nil];
+
+
+}
+
+- (void)forceQuit:(NSNotification *)aNotification
+{
+ [(SelfWorld*)[running objectAtIndex:[myTable selectedRow]] terminate];
+}
+
+// END MANAGING
+
+
+@end
View
57 controller/osx/Self/Self Control-Info.plist
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>snap</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>Self Snapshot</string>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string>Self ControlIcon</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.selflanguage.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>4.5</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleURLTypes</key>
+ <array/>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSApplicationCategoryType</key>
+ <string>public.app-category.utilities</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>${MACOSX_DEPLOYMENT_TARGET}</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2012 AUTHORS. See LICENCE.</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+ <key>NSServices</key>
+ <array/>
+ <key>UTExportedTypeDeclarations</key>
+ <array/>
+ <key>UTImportedTypeDeclarations</key>
+ <array/>
+</dict>
+</plist>
View
7 controller/osx/Self/Self Control-Prefix.pch
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'Self' target in the 'Self' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
View
5 controller/osx/Self/Self.entitlements
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict/>
+</plist>
View
23 controller/osx/Self/SelfAppDelegate.h
@@ -0,0 +1,23 @@
+//
+// SelfAppDelegate.h
+// Self
+//
+// Created by Russell Allen on 7/01/12.
+// Copyright 2012 AUTHORS. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@class RunningSelfVMManagerModel;
+
+@interface SelfAppDelegate : NSObject <NSApplicationDelegate> {
+ NSWindow *window;
+ RunningSelfVMManagerModel *vmManagerModel;
+}
+
+@property (assign) IBOutlet NSWindow *window;
+
+-(void)setModel:(RunningSelfVMManagerModel *)model;
+-(int)installVM;
+
+@end
View
285 controller/osx/Self/SelfAppDelegate.m
@@ -0,0 +1,285 @@
+//
+// SelfAppDelegate.m
+// Self
+//
+// Created by Russell Allen on 7/01/12.
+// Copyright 2012 AUTHORS. All rights reserved.
+//
+
+#import "SelfAppDelegate.h"
+#import "RunningSelfVMManagerModel.h"
+#import "SelfWorld.h"
+
+#include <Security/Authorization.h>
+#include <Security/AuthorizationTags.h>
+
+
+@implementation SelfAppDelegate
+
+@synthesize window;
+
+//- (id)init
+//{
+// self = [super init];
+// if (self) {
+// // Initialization code here.
+// // Initialise model to keep track of running VMs
+// vmManagerModel = [[RunningSelfVMManagerModel alloc] init];
+// }
+// return self;
+//}
+
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
+{
+ // Insert code here to initialize your application
+
+}
+
+// INSTALLING VM
+
+-(int)installVM
+{
+ // Create shell script
+
+ NSBundle* myBundle = [NSBundle mainBundle];
+ NSString* myVM = [myBundle pathForResource:@"Self"ofType:@"app"];
+ myVM = [myVM stringByAppendingString:@"/Contents/MacOS/Self"];
+
+ NSString* str = @"#!/bin/sh\n";
+ str = [str stringByAppendingString:myVM];
+ str = [str stringByAppendingString:@" $@"];
+
+ NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];
+ [attributes setObject:[NSNumber numberWithInt:493] forKey:NSFilePosixPermissions];
+ /*493 is Decimal for the 755 octal*/
+
+ NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding];
+ [[NSFileManager defaultManager] createFileAtPath: @"/tmp/Self"
+ contents: data
+ attributes: attributes];
+
+ // Create installation script
+
+ str = @"#!/bin/sh\ncp /tmp/Self /usr/bin/Self\nchmod 755 /usr/bin/Self";
+ attributes = [[NSMutableDictionary alloc] init];
+ [attributes setObject:[NSNumber numberWithInt:493] forKey:NSFilePosixPermissions];
+ /*493 is Decimal for the 755 octal*/
+
+ data = [str dataUsingEncoding:NSUTF8StringEncoding];
+ [[NSFileManager defaultManager] createFileAtPath: @"/tmp/Self-install"
+ contents: data
+ attributes: attributes];
+
+
+ // Run installation script with authorisation privileges
+
+ OSStatus myStatus;
+ AuthorizationFlags myFlags = kAuthorizationFlagDefaults; // 1
+ AuthorizationRef myAuthorizationRef; // 2
+
+ myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, // 3
+ myFlags, &myAuthorizationRef);
+
+ if (myStatus != errAuthorizationSuccess)
+ return myStatus;
+
+ {
+ AuthorizationItem myItems = {kAuthorizationRightExecute, 0, // 4
+ NULL, 0};
+
+ AuthorizationRights myRights = {1, &myItems}; // 5
+
+ myFlags = kAuthorizationFlagDefaults | // 6
+ kAuthorizationFlagInteractionAllowed |
+ kAuthorizationFlagPreAuthorize |
+ kAuthorizationFlagExtendRights;
+
+ myStatus = AuthorizationCopyRights (myAuthorizationRef, // 7
+ &myRights, NULL, myFlags, NULL );
+ }
+
+ if (myStatus != errAuthorizationSuccess) goto DoneWorking;
+
+ {
+ char myToolPath[] = "/tmp/Self-install";
+ char *myArguments[] = { NULL };
+ FILE *myCommunicationsPipe = NULL;
+ char myReadBuffer[128];
+
+ myFlags = kAuthorizationFlagDefaults; // 8
+ myStatus = AuthorizationExecuteWithPrivileges // 9
+ (myAuthorizationRef, myToolPath, myFlags, myArguments,
+ &myCommunicationsPipe);
+
+ if (myStatus == errAuthorizationSuccess)
+ for(;;)
+ {
+ int bytesRead = read (fileno (myCommunicationsPipe),
+ myReadBuffer, sizeof (myReadBuffer));
+
+ if (bytesRead < 1) goto DoneWorking;
+ write (fileno (stdout), myReadBuffer, bytesRead);
+ }
+ }
+
+ DoneWorking:
+
+ AuthorizationFree (myAuthorizationRef, kAuthorizationFlagDefaults); // 10
+
+ if (myStatus) printf("Status: %d\n", myStatus);
+
+ return myStatus;
+
+}
+// SETUP
+
+-(void)setModel:(RunningSelfVMManagerModel *)model
+{
+ vmManagerModel = model;
+}
+
+// QUITTING
+
+- (void)quitDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
+ if (returnCode == NSAlertFirstButtonReturn) {
+ [vmManagerModel killAll];
+ [NSApp replyToApplicationShouldTerminate: YES];
+ } else {
+ [NSApp replyToApplicationShouldTerminate: NO];
+ }
+}
+
+- (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication*) sender
+{
+ if (![vmManagerModel warnBeforeClose]) {
+ // We can quit straight away because there are no Self VMs running
+ return NSTerminateNow;
+ }
+ NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+ [alert addButtonWithTitle:@"Quit"];
+ [alert addButtonWithTitle:@"Cancel"];
+ [alert setMessageText:@"Quit Self?"];
+ [alert setInformativeText:@"Quitting Self will terminate all running Self instances without snapshotting."];
+ [alert setAlertStyle:NSWarningAlertStyle];
+ [alert beginSheetModalForWindow:window
+ modalDelegate:self
+ didEndSelector:@selector(quitDidEnd:returnCode:contextInfo:)
+ contextInfo:nil];
+ return NSTerminateLater;
+}
+
+- (void)quit:(NSNotification *)aNotification
+{
+ [NSApp terminate:self];
+}
+
+// END QUITTING
+
+// EMPTY VM
+
+- (void)emptyVM:(NSNotification *)aNotification
+{
+ [self showIntroAlert];
+}
+
+-(void)showIntroAlert
+{
+ NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+ [alert addButtonWithTitle:@"Continue..."];
+ [alert setMessageText:@"Choose a CWD"];
+ [alert setInformativeText:@"You will need to choose a current working directory to start the VM from."];
+ [alert setAlertStyle:NSInformationalAlertStyle];
+ [alert beginSheetModalForWindow:window modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil];
+}
+
+- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode
+ contextInfo:(void *)contextInfo;
+{
+ // No idea why this works, but without it we get very strange window stuff.
+ [NSTimer scheduledTimerWithTimeInterval:0.0
+ target:self
+ selector:@selector(cwdDialog)
+ userInfo:nil
+ repeats:NO];
+}
+
+- (void)cwdDialog
+{
+ NSOpenPanel* panel = [[NSOpenPanel openPanel] retain];
+ [panel setCanChooseFiles:NO];
+ [panel setCanChooseDirectories:YES];
+ [panel setAllowsMultipleSelection:NO];
+ [panel beginSheetModalForWindow:window completionHandler:^(NSInteger result){
+ if (result == NSFileHandlingPanelOKButton) {
+ for (NSURL *fileURL in [panel URLs]) {
+ [self openEmptyVM:fileURL];
+ }
+ }
+ [panel release];
+ }];
+
+}
+
+- (void)openEmptyVM:(NSURL*)aUrl
+{
+ SelfWorld *w = [[SelfWorld alloc] init];
+ [w runEmptyOn:aUrl];
+ [vmManagerModel registerRunningVM: w];
+}
+
+
+// END EMPTY VM
+
+// OPENING
+
+- (void)openSnapshot:(NSURL*)aUrl
+{
+ SelfWorld *w = [[SelfWorld alloc] init];
+ [w runSnapshot: aUrl];
+ [vmManagerModel registerRunningVM: w];
+}
+
+- (void)fileDialog
+{
+ NSOpenPanel* panel = [[NSOpenPanel openPanel] retain];
+ [panel setCanChooseFiles:YES];
+ [panel setCanChooseDirectories:NO];
+ [panel setAllowsMultipleSelection:YES];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:@"snap"]];
+
+ [panel beginSheetModalForWindow:window completionHandler:^(NSInteger result){
+ if (result == NSFileHandlingPanelOKButton) {
+ for (NSURL *fileURL in [panel URLs]) {
+ [self openSnapshot:fileURL];
+ }
+ }
+ [panel release];
+ }];
+
+}
+
+- (void)chooseSnapshot:(NSNotification *)aNotification
+{
+ [self fileDialog];
+}
+
+- (void)openDocument:(id)sender
+{
+ [self fileDialog];
+}
+
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
+{
+ [self openSnapshot:[NSURL URLWithString:filename]];
+ return TRUE;
+}
+
+- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
+{
+ return NO;
+}
+
+// END OPENING
+
+@end
View
35 controller/osx/Self/SelfWorld.h
@@ -0,0 +1,35 @@
+//
+// SelfWorld.h
+// Self
+//
+// Created by Russell Allen on 7/01/12.
+// Copyright 2012 AUTHORS. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import <Foundation/NSAppleScript.h>
+
+@class RunningSelfVMManagerModel;
+
+@interface SelfWorld : NSObject {
+ NSTask *task;
+ NSString *name;
+ RunningSelfVMManagerModel *manager;
+
+ NSFileHandle *taskOutput;
+ NSPipe *outputPipe;
+ NSFileHandle *taskInput;
+ NSPipe *inputPipe;
+
+}
+
+-(SelfWorld *)runSnapshot:(NSURL *)aUrl;
+-(SelfWorld *)runEmptyOn:(NSURL *)aUrl;
+-(NSString *)getName;
+-(NSString *)getNameForScreen;
+-(void)terminate;
+-(BOOL)isRunning;
+-(void)notifyMe:(RunningSelfVMManagerModel *)m;
+
+@end
+
View
155 controller/osx/Self/SelfWorld.m
@@ -0,0 +1,155 @@
+//
+// SelfWorld.m
+// Self
+//
+// Created by Russell Allen on 22/02/12.
+// Copyright (c) 2012 AUTHORS. All rights reserved.
+//
+
+#import "SelfWorld.h"
+#import "RunningSelfVMManagerModel.h"
+
+#include <unistd.h>
+
+@implementation SelfWorld
+
+-(void)dealloc {
+ [name release];
+ [task release];
+ [super dealloc];
+}
+
+-(SelfWorld *)runWithCwd:(NSString*)cwd Snapshot:(NSString*)snap
+{
+ NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
+
+ NSBundle* myBundle = [NSBundle mainBundle];
+ NSString* myVM = [myBundle pathForResource:@"Self"ofType:@"app"];
+ myVM = [myVM stringByAppendingString:@"/Contents/MacOS/Self"];
+
+ NSString* command = @"#!/bin/sh\ncd \"";
+ command = [command stringByAppendingString:cwd];
+ command = [command stringByAppendingString:@"\"\n\""];
+ command = [command stringByAppendingString:myVM];
+ command = [command stringByAppendingString:@"\" "];
+
+ // If we are loading a snapshot
+ NSLog(@"%@", snap);
+ if(![snap isEqualToString:@""])
+ {
+ command = [command stringByAppendingString:@" -s \""];
+ command = [command stringByAppendingString:snap];
+ command = [command stringByAppendingString:@"\""];
+ }
+
+ NSLog(@"%@", command);
+
+ NSString *tmp = [NSString stringWithUTF8String: tmpnam(nil)];
+ [command writeToFile: tmp atomically: YES encoding:NSASCIIStringEncoding error:NULL];
+
+ NSDictionary *defaultEnvironment = [[NSProcessInfo processInfo] environment];
+ NSMutableDictionary *environment = [[NSMutableDictionary alloc] initWithDictionary:defaultEnvironment];
+ [environment setObject:@"YES" forKey:@"NSUnbufferedIO"];
+
+ outputPipe = [NSPipe pipe];
+ taskOutput = [outputPipe fileHandleForReading];
+
+ inputPipe = [NSPipe pipe];
+ taskInput = [inputPipe fileHandleForWriting];
+
+ task = [[[NSTask alloc]init]retain];
+ //[task setLaunchPath:@"/bin/sh"];
+ [task setLaunchPath:@"/usr/bin/screen"];
+ [task setArguments: [NSArray arrayWithObjects: @"-S", [[cwd stringByAppendingString:snap]stringByReplacingOccurrencesOfString:@"/"withString:@""], @"-D", @"-m", @"sh", tmp, nil]];
+ [task setEnvironment:environment];
+ [task setStandardInput:inputPipe];
+ [task setStandardOutput:outputPipe];
+ [task setStandardError:outputPipe];
+
+ [defaultCenter addObserver:self selector:@selector(taskCompleted:) name:NSTaskDidTerminateNotification object:task];
+ [defaultCenter addObserver:self selector:@selector(taskDataAvailable:) name:NSFileHandleReadCompletionNotification object:taskOutput];
+
+ [task launch];
+ [taskOutput readInBackgroundAndNotify];
+
+ return self;
+}
+
+-(SelfWorld *)runEmptyOn:(NSURL *)aUrl
+{
+ name = [[aUrl path]copy];
+ [self runWithCwd:name Snapshot:@""];
+ return self;
+}
+
+-(SelfWorld *)runSnapshot:(NSURL *)aUrl
+{
+ NSString* cwd = [[aUrl path] substringToIndex: ([[aUrl path] length] - [[aUrl lastPathComponent] length])];
+ [self runWithCwd:cwd Snapshot:[aUrl lastPathComponent]];
+ name = [[aUrl path]copy];
+ return self;
+}
+
+-(NSString *)getName
+{
+ return name;
+}
+
+-(NSString *)getNameForScreen
+{
+ return [name stringByReplacingOccurrencesOfString:@"/"withString:@""];
+}
+
+-(BOOL)isRunning
+{
+ return [task isRunning];
+}
+
+-(void)terminate
+{
+ if ([task isRunning]) {[task terminate];}
+}
+
+-(void)notifyMe:(RunningSelfVMManagerModel *)m
+{
+ manager = m;
+ [NSThread detachNewThreadSelector: @selector(checkRunning:)
+ toTarget: self withObject: nil];
+}
+
+- (void)taskCompleted:(NSNotification *)notif
+{
+ int exitCode = [[notif object] terminationStatus];
+
+ if (exitCode != 0)
+ NSLog(@"Error: Task exited with code %d", exitCode);
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ // Do whatever else you need to do when the task finished
+}
+
+- (void)taskDataAvailable:(NSNotification *)notif
+{
+ NSData *incomingData = [[notif userInfo] objectForKey:NSFileHandleNotificationDataItem];
+ if (incomingData && [incomingData length])
+ {
+ NSString *incomingText = [[NSString alloc] initWithData:incomingData encoding:NSASCIIStringEncoding];
+ // Do whatever with incomingText, the string that has some text in it
+ NSLog(@"%@", incomingText);
+ [taskOutput readInBackgroundAndNotify];
+ [incomingText release];
+ return;
+ }
+}
+
+- (void)sendData:(NSString *)dataString
+{
+ [taskInput writeData:[dataString dataUsingEncoding:[NSString defaultCStringEncoding]]];
+}
+
+-(void)checkRunning:(id)v
+{
+ [task waitUntilExit];
+ [manager notifyTaskEnded: self];
+}
+
+@end
View
36 controller/osx/Self/en.lproj/Credits.rtf
@@ -0,0 +1,36 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\vieww9600\viewh8400\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
+
+\f0\b\fs24 \cf0 (In alphabetical order by surname)\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
+
+\b0 \cf0 \
+Russell Allen\
+Jan-Paul Bultmann\
+Chris Double\
+Randall B. Smith\
+Adam Spitz\
+Stanford University\
+Sun Microsystems, Inc. \
+David Ungar\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
+\cf0 \
+
+\b With special thanks to:
+\b0 \
+\
+This software is a continuation of the Self system as developed at Xerox Parc, Stanford University and Sun Microsystems.\
+\
+The first version of the Self language was designed in 1986 by David Ungar and Randall B. Smith at Xerox PARC. \
+\
+A series of Self implementations and a graphical programming environment were built at Stanford University by Craig Chambers, Urs H\'f6lzle, Ole Agesen, Elgin Lee, Bay-Wei Chang, and David Ungar. \
+\
+The project continued at Sun Microsystems Laboratories, where it benefited from the efforts of Randall B. Smith, Mario Wolczko, John Maloney, and Lars Bak under the joint leadership of Smith and Ungar. \
+\
+The Self Group would like to thank Elgin Lee, James "kjx" Noble, Christine Ahrens, Jeff Dean, Erik Ernst, Ivan Moore, and Michael Abd-El-Malek for their contributions.\
+\
+Finally, thanks go to Sun Microsystems Laboratories, Stanford University, and all other organizations that supported Self (in alphabetical order): Aarhus University, Apple, Cray, the Danish Research Academy, DEC, IBM, the National Science Foundation, NCR, the Swiss Nationalfonds, Tandem, Texas Instruments, and Xerox.\
+}
View
2 controller/osx/Self/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
View
4,248 controller/osx/Self/en.lproj/MainMenu.xib
4,248 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
14 controller/osx/Self/main.m
@@ -0,0 +1,14 @@
+//
+// main.m
+// Self
+//
+// Created by Russell Allen on 7/01/12.
+// Copyright 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, char *argv[])
+{
+ return NSApplicationMain(argc, (const char **)argv);
+}

0 comments on commit 1fafc9e

Please sign in to comment.