summaryrefslogtreecommitdiffstats
path: root/Doc/ref/ref.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/ref/ref.tex')
0 files changed, 0 insertions, 0 deletions
Object; }, + { + ACTIONS = {showPreferences = id; }; + CLASS = MyAppDelegate; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/Mac/PythonLauncher/English.lproj/MainMenu.nib/info.nib b/Mac/PythonLauncher/English.lproj/MainMenu.nib/info.nib new file mode 100644 index 0000000..b96759a --- /dev/null +++ b/Mac/PythonLauncher/English.lproj/MainMenu.nib/info.nib @@ -0,0 +1,21 @@ + + + + + IBDocumentLocation + 99 33 356 240 0 0 800 578 + IBEditorPositions + + 29 + 82 396 318 44 0 0 800 578 + + IBFramework Version + 263.2 + IBOpenObjects + + 29 + + IBSystem Version + 5S66 + + diff --git a/Mac/PythonLauncher/English.lproj/MainMenu.nib/objects.nib b/Mac/PythonLauncher/English.lproj/MainMenu.nib/objects.nib new file mode 100644 index 0000000..532a5c8 Binary files /dev/null and b/Mac/PythonLauncher/English.lproj/MainMenu.nib/objects.nib differ diff --git a/Mac/PythonLauncher/English.lproj/MyDocument.nib/classes.nib b/Mac/PythonLauncher/English.lproj/MyDocument.nib/classes.nib new file mode 100644 index 0000000..bcdc0cd --- /dev/null +++ b/Mac/PythonLauncher/English.lproj/MyDocument.nib/classes.nib @@ -0,0 +1,26 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {"do_apply" = id; "do_cancel" = id; "do_reset" = id; "do_run" = id; }; + CLASS = MyDocument; + LANGUAGE = ObjC; + OUTLETS = { + commandline = NSTextField; + debug = NSButton; + honourhashbang = NSButton; + inspect = NSButton; + interpreter = NSTextField; + nosite = NSButton; + optimize = NSButton; + others = NSTextField; + scriptargs = NSTextField; + tabs = NSButton; + verbose = NSButton; + "with_terminal" = NSButton; + }; + SUPERCLASS = NSDocument; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/Mac/PythonLauncher/English.lproj/MyDocument.nib/info.nib b/Mac/PythonLauncher/English.lproj/MyDocument.nib/info.nib new file mode 100644 index 0000000..e258c72 --- /dev/null +++ b/Mac/PythonLauncher/English.lproj/MyDocument.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 398 60 356 240 0 0 1024 746 + IBFramework Version + 291.0 + IBOpenObjects + + 5 + + IBSystem Version + 6L60 + + diff --git a/Mac/PythonLauncher/English.lproj/MyDocument.nib/objects.nib b/Mac/PythonLauncher/English.lproj/MyDocument.nib/objects.nib new file mode 100644 index 0000000..0473a31 Binary files /dev/null and b/Mac/PythonLauncher/English.lproj/MyDocument.nib/objects.nib differ diff --git a/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/classes.nib b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/classes.nib new file mode 100644 index 0000000..467aa8b --- /dev/null +++ b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/classes.nib @@ -0,0 +1,26 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {"do_apply" = id; "do_filetype" = id; "do_reset" = id; }; + CLASS = PreferencesWindowController; + LANGUAGE = ObjC; + OUTLETS = { + commandline = NSTextField; + debug = NSButton; + filetype = NSPopUpButton; + honourhashbang = NSButton; + inspect = NSButton; + interpreter = NSTextField; + nosite = NSButton; + optimize = NSButton; + others = NSTextField; + tabs = NSButton; + verbose = NSButton; + "with_terminal" = NSButton; + }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/info.nib b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/info.nib new file mode 100644 index 0000000..bc558f7 --- /dev/null +++ b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 565 235 519 534 0 0 1280 1002 + IBFramework Version + 364.0 + IBOpenObjects + + 5 + + IBSystem Version + 7H63 + + diff --git a/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/objects.nib b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/objects.nib new file mode 100644 index 0000000..3dfed33 Binary files /dev/null and b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/objects.nib differ diff --git a/Mac/PythonLauncher/FileSettings.h b/Mac/PythonLauncher/FileSettings.h new file mode 100755 index 0000000..d807bae --- /dev/null +++ b/Mac/PythonLauncher/FileSettings.h @@ -0,0 +1,64 @@ +// +// FileSettings.h +// PythonLauncher +// +// Created by Jack Jansen on Sun Jul 21 2002. +// Copyright (c) 2002 __MyCompanyName__. All rights reserved. +// + +#import + +@protocol FileSettingsSource +- (NSString *) interpreter; +- (BOOL) honourhashbang; +- (BOOL) debug; +- (BOOL) verbose; +- (BOOL) inspect; +- (BOOL) optimize; +- (BOOL) nosite; +- (BOOL) tabs; +- (NSString *) others; +- (BOOL) with_terminal; +- (NSString *) scriptargs; +@end + +@interface FileSettings : NSObject +{ + NSString *interpreter; // The pathname of the interpreter to use + NSArray *interpreters; // List of known interpreters + BOOL honourhashbang; // #! line overrides interpreter + BOOL debug; // -d option: debug parser + BOOL verbose; // -v option: verbose import + BOOL inspect; // -i option: interactive mode after script + BOOL optimize; // -O option: optimize bytecode + BOOL nosite; // -S option: don't import site.py + BOOL tabs; // -t option: warn about inconsistent tabs + NSString *others; // other options + NSString *scriptargs; // script arguments (not for preferences) + BOOL with_terminal; // Run in terminal window + + FileSettings *origsource; + NSString *prefskey; +} + ++ (id)getDefaultsForFileType: (NSString *)filetype; ++ (id)getFactorySettingsForFileType: (NSString *)filetype; ++ (id)newSettingsForFileType: (NSString *)filetype; + +//- (id)init; +- (id)initForFileType: (NSString *)filetype; +- (id)initForFSDefaultFileType: (NSString *)filetype; +- (id)initForDefaultFileType: (NSString *)filetype; +//- (id)initWithFileSettings: (FileSettings *)source; + +- (void)updateFromSource: (id )source; +- (NSString *)commandLineForScript: (NSString *)script; + +//- (void)applyFactorySettingsForFileType: (NSString *)filetype; +//- (void)saveDefaults; +//- (void)applyUserDefaults: (NSString *)filetype; +- (void)applyValuesFromDict: (NSDictionary *)dict; +- (void)reset; +- (NSArray *) interpreters; + +@end diff --git a/Mac/PythonLauncher/FileSettings.m b/Mac/PythonLauncher/FileSettings.m new file mode 100755 index 0000000..fc3937b --- /dev/null +++ b/Mac/PythonLauncher/FileSettings.m @@ -0,0 +1,298 @@ +// +// FileSettings.m +// PythonLauncher +// +// Created by Jack Jansen on Sun Jul 21 2002. +// Copyright (c) 2002 __MyCompanyName__. All rights reserved. +// + +#import "FileSettings.h" + +@implementation FileSettings + ++ (id)getFactorySettingsForFileType: (NSString *)filetype +{ + static FileSettings *fsdefault_py, *fsdefault_pyw, *fsdefault_pyc; + FileSettings **curdefault; + + if ([filetype isEqualToString: @"Python Script"]) { + curdefault = &fsdefault_py; + } else if ([filetype isEqualToString: @"Python GUI Script"]) { + curdefault = &fsdefault_pyw; + } else if ([filetype isEqualToString: @"Python Bytecode Document"]) { + curdefault = &fsdefault_pyc; + } else { + NSLog(@"Funny File Type: %@\n", filetype); + curdefault = &fsdefault_py; + filetype = @"Python Script"; + } + if (!*curdefault) { + *curdefault = [[FileSettings new] initForFSDefaultFileType: filetype]; + } + return *curdefault; +} + ++ (id)getDefaultsForFileType: (NSString *)filetype +{ + static FileSettings *default_py, *default_pyw, *default_pyc; + FileSettings **curdefault; + + if ([filetype isEqualToString: @"Python Script"]) { + curdefault = &default_py; + } else if ([filetype isEqualToString: @"Python GUI Script"]) { + curdefault = &default_pyw; + } else if ([filetype isEqualToString: @"Python Bytecode Document"]) { + curdefault = &default_pyc; + } else { + NSLog(@"Funny File Type: %@\n", filetype); + curdefault = &default_py; + filetype = @"Python Script"; + } + if (!*curdefault) { + *curdefault = [[FileSettings new] initForDefaultFileType: filetype]; + } + return *curdefault; +} + ++ (id)newSettingsForFileType: (NSString *)filetype +{ + FileSettings *cur; + + cur = [FileSettings new]; + [cur initForFileType: filetype]; + return [cur retain]; +} + +- (id)initWithFileSettings: (FileSettings *)source +{ + self = [super init]; + if (!self) return self; + + interpreter = [source->interpreter retain]; + honourhashbang = source->honourhashbang; + debug = source->debug; + verbose = source->verbose; + inspect = source->inspect; + optimize = source->optimize; + nosite = source->nosite; + tabs = source->tabs; + others = [source->others retain]; + scriptargs = [source->scriptargs retain]; + with_terminal = source->with_terminal; + prefskey = source->prefskey; + if (prefskey) [prefskey retain]; + + return self; +} + +- (id)initForFileType: (NSString *)filetype +{ + FileSettings *defaults; + + defaults = [FileSettings getDefaultsForFileType: filetype]; + self = [self initWithFileSettings: defaults]; + origsource = [defaults retain]; + return self; +} + +//- (id)init +//{ +// self = [self initForFileType: @"Python Script"]; +// return self; +//} + +- (id)initForFSDefaultFileType: (NSString *)filetype +{ + int i; + NSString *filename; + NSDictionary *dict; + static NSDictionary *factorySettings; + + self = [super init]; + if (!self) return self; + + if (factorySettings == NULL) { + NSBundle *bdl = [NSBundle mainBundle]; + NSString *path = [ bdl pathForResource: @"factorySettings" + ofType: @"plist"]; + factorySettings = [[NSDictionary dictionaryWithContentsOfFile: + path] retain]; + if (factorySettings == NULL) { + NSLog(@"Missing %@", path); + return NULL; + } + } + dict = [factorySettings objectForKey: filetype]; + if (dict == NULL) { + NSLog(@"factorySettings.plist misses file type \"%@\"", filetype); + interpreter = [@"no default found" retain]; + return NULL; + } + [self applyValuesFromDict: dict]; + interpreters = [dict objectForKey: @"interpreter_list"]; + interpreter = NULL; + for (i=0; i < [interpreters count]; i++) { + filename = [interpreters objectAtIndex: i]; + filename = [filename stringByExpandingTildeInPath]; + if ([[NSFileManager defaultManager] fileExistsAtPath: filename]) { + interpreter = [filename retain]; + break; + } + } + if (interpreter == NULL) + interpreter = [@"no default found" retain]; + origsource = NULL; + return self; +} + +- (void)applyUserDefaults: (NSString *)filetype +{ + NSUserDefaults *defaults; + NSDictionary *dict; + + defaults = [NSUserDefaults standardUserDefaults]; + dict = [defaults dictionaryForKey: filetype]; + if (!dict) + return; + [self applyValuesFromDict: dict]; +} + +- (id)initForDefaultFileType: (NSString *)filetype +{ + FileSettings *fsdefaults; + + fsdefaults = [FileSettings getFactorySettingsForFileType: filetype]; + self = [self initWithFileSettings: fsdefaults]; + if (!self) return self; + interpreters = [fsdefaults->interpreters retain]; + scriptargs = [@"" retain]; + [self applyUserDefaults: filetype]; + prefskey = [filetype retain]; + return self; +} + +- (void)reset +{ + if (origsource) { + [self updateFromSource: origsource]; + } else { + FileSettings *fsdefaults; + fsdefaults = [FileSettings getFactorySettingsForFileType: prefskey]; + [self updateFromSource: fsdefaults]; + } +} + +- (void)updateFromSource: (id )source +{ + interpreter = [[source interpreter] retain]; + honourhashbang = [source honourhashbang]; + debug = [source debug]; + verbose = [source verbose]; + inspect = [source inspect]; + optimize = [source optimize]; + nosite = [source nosite]; + tabs = [source tabs]; + others = [[source others] retain]; + scriptargs = [[source scriptargs] retain]; + with_terminal = [source with_terminal]; + // And if this is a user defaults object we also save the + // values + if (!origsource) { + NSUserDefaults *defaults; + NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: + interpreter, @"interpreter", + [NSNumber numberWithBool: honourhashbang], @"honourhashbang", + [NSNumber numberWithBool: debug], @"debug", + [NSNumber numberWithBool: verbose], @"verbose", + [NSNumber numberWithBool: inspect], @"inspect", + [NSNumber numberWithBool: optimize], @"optimize", + [NSNumber numberWithBool: nosite], @"nosite", + [NSNumber numberWithBool: nosite], @"nosite", + others, @"others", + scriptargs, @"scriptargs", + [NSNumber numberWithBool: with_terminal], @"with_terminal", + nil]; + defaults = [NSUserDefaults standardUserDefaults]; + [defaults setObject: dict forKey: prefskey]; + } +} + +- (void)applyValuesFromDict: (NSDictionary *)dict +{ + id value; + + value = [dict objectForKey: @"interpreter"]; + if (value) interpreter = [value retain]; + value = [dict objectForKey: @"honourhashbang"]; + if (value) honourhashbang = [value boolValue]; + value = [dict objectForKey: @"debug"]; + if (value) debug = [value boolValue]; + value = [dict objectForKey: @"verbose"]; + if (value) verbose = [value boolValue]; + value = [dict objectForKey: @"inspect"]; + if (value) inspect = [value boolValue]; + value = [dict objectForKey: @"optimize"]; + if (value) optimize = [value boolValue]; + value = [dict objectForKey: @"nosite"]; + if (value) nosite = [value boolValue]; + value = [dict objectForKey: @"nosite"]; + if (value) tabs = [value boolValue]; + value = [dict objectForKey: @"others"]; + if (value) others = [value retain]; + value = [dict objectForKey: @"scriptargs"]; + if (value) scriptargs = [value retain]; + value = [dict objectForKey: @"with_terminal"]; + if (value) with_terminal = [value boolValue]; +} + +- (NSString *)commandLineForScript: (NSString *)script +{ + NSString *cur_interp = NULL; + char hashbangbuf[1024]; + FILE *fp; + char *p; + + if (honourhashbang && + (fp=fopen([script cString], "r")) && + fgets(hashbangbuf, sizeof(hashbangbuf), fp) && + strncmp(hashbangbuf, "#!", 2) == 0 && + (p=strchr(hashbangbuf, '\n'))) { + *p = '\0'; + p = hashbangbuf + 2; + while (*p == ' ') p++; + cur_interp = [NSString stringWithCString: p]; + } + if (!cur_interp) + cur_interp = interpreter; + + return [NSString stringWithFormat: + @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %@ %s", + cur_interp, + debug?" -d":"", + verbose?" -v":"", + inspect?" -i":"", + optimize?" -O":"", + nosite?" -S":"", + tabs?" -t":"", + others, + script, + scriptargs, + with_terminal? "&& echo Exit status: $? && exit 1" : " &"]; +} + +- (NSArray *) interpreters { return interpreters;}; + +// FileSettingsSource protocol +- (NSString *) interpreter { return interpreter;}; +- (BOOL) honourhashbang { return honourhashbang; }; +- (BOOL) debug { return debug;}; +- (BOOL) verbose { return verbose;}; +- (BOOL) inspect { return inspect;}; +- (BOOL) optimize { return optimize;}; +- (BOOL) nosite { return nosite;}; +- (BOOL) tabs { return tabs;}; +- (NSString *) others { return others;}; +- (NSString *) scriptargs { return scriptargs;}; +- (BOOL) with_terminal { return with_terminal;}; + +@end diff --git a/Mac/PythonLauncher/Info.plist b/Mac/PythonLauncher/Info.plist new file mode 100644 index 0000000..1dd795f --- /dev/null +++ b/Mac/PythonLauncher/Info.plist @@ -0,0 +1,65 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + py + pyw + + CFBundleTypeIconFile + PythonSource.icns + CFBundleTypeName + Python Script + CFBundleTypeRole + Viewer + NSDocumentClass + MyDocument + + + CFBundleTypeExtensions + + pyc + pyo + + CFBundleTypeIconFile + PythonCompiled.icns + CFBundleTypeName + Python Bytecode Document + CFBundleTypeRole + Viewer + NSDocumentClass + MyDocument + + + CFBundleExecutable + PythonLauncher + CFBundleGetInfoString + 2.5, © 001-2006 Python Software Foundation + CFBundleIconFile + PythonLauncher.icns + CFBundleIdentifier + org.python.PythonLauncher + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Python Launcher + CFBundlePackageType + APPL + CFBundleShortVersionString + 2.5 + CFBundleSignature + PytL + CFBundleVersion + 2.5 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/Mac/PythonLauncher/Makefile.in b/Mac/PythonLauncher/Makefile.in new file mode 100644 index 0000000..19763a6 --- /dev/null +++ b/Mac/PythonLauncher/Makefile.in @@ -0,