commit 7ee87ef3d8b5f5d8ffc8518929eee41691ebf0b1 Author: GRMrGecko Date: Wed Jul 16 23:28:06 2014 -0500 PHPCalc Start diff --git a/Calculator/Calculator.icns b/Calculator/Calculator.icns new file mode 100644 index 0000000..c86d1f9 Binary files /dev/null and b/Calculator/Calculator.icns differ diff --git a/Calculator/Calculator.xcodeproj/project.pbxproj b/Calculator/Calculator.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c9c7750 --- /dev/null +++ b/Calculator/Calculator.xcodeproj/project.pbxproj @@ -0,0 +1,298 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 2A00A06D1642ED4900DB349D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A00A06C1642ED4900DB349D /* Cocoa.framework */; }; + 2A00A0771642ED4900DB349D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2A00A0751642ED4900DB349D /* InfoPlist.strings */; }; + 2A00A0791642ED4900DB349D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A00A0781642ED4900DB349D /* main.m */; }; + 2A00A07D1642ED4900DB349D /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A00A07B1642ED4900DB349D /* Credits.rtf */; }; + 2A00A08A1642EE1500DB349D /* Calculator.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2A00A0891642EE1500DB349D /* Calculator.icns */; }; + 2A00A08C1642F1EC00DB349D /* ScriptingBridge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A00A08B1642F1EC00DB349D /* ScriptingBridge.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 2A00A0681642ED4900DB349D /* Calculator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Calculator.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2A00A06C1642ED4900DB349D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 2A00A06F1642ED4900DB349D /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 2A00A0701642ED4900DB349D /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + 2A00A0711642ED4900DB349D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 2A00A0741642ED4900DB349D /* Calculator-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Calculator-Info.plist"; sourceTree = ""; }; + 2A00A0761642ED4900DB349D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 2A00A0781642ED4900DB349D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 2A00A07A1642ED4900DB349D /* Calculator-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Calculator-Prefix.pch"; sourceTree = ""; }; + 2A00A07C1642ED4900DB349D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; + 2A00A0891642EE1500DB349D /* Calculator.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Calculator.icns; sourceTree = SOURCE_ROOT; }; + 2A00A08B1642F1EC00DB349D /* ScriptingBridge.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScriptingBridge.framework; path = System/Library/Frameworks/ScriptingBridge.framework; sourceTree = SDKROOT; }; + 2A00A08E164311AA00DB349D /* Terminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Terminal.h; sourceTree = ""; }; + 2AAF0683174A4A3B006CB987 /* iTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iTerm.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2A00A0651642ED4900DB349D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2A00A08C1642F1EC00DB349D /* ScriptingBridge.framework in Frameworks */, + 2A00A06D1642ED4900DB349D /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2A00A05D1642ED4900DB349D = { + isa = PBXGroup; + children = ( + 2A00A0721642ED4900DB349D /* Calculator */, + 2A00A06B1642ED4900DB349D /* Frameworks */, + 2A00A0691642ED4900DB349D /* Products */, + ); + sourceTree = ""; + }; + 2A00A0691642ED4900DB349D /* Products */ = { + isa = PBXGroup; + children = ( + 2A00A0681642ED4900DB349D /* Calculator.app */, + ); + name = Products; + sourceTree = ""; + }; + 2A00A06B1642ED4900DB349D /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2A00A08B1642F1EC00DB349D /* ScriptingBridge.framework */, + 2A00A06C1642ED4900DB349D /* Cocoa.framework */, + 2A00A06E1642ED4900DB349D /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 2A00A06E1642ED4900DB349D /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 2A00A06F1642ED4900DB349D /* AppKit.framework */, + 2A00A0701642ED4900DB349D /* CoreData.framework */, + 2A00A0711642ED4900DB349D /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 2A00A0721642ED4900DB349D /* Calculator */ = { + isa = PBXGroup; + children = ( + 2A00A08E164311AA00DB349D /* Terminal.h */, + 2AAF0683174A4A3B006CB987 /* iTerm.h */, + 2A00A0891642EE1500DB349D /* Calculator.icns */, + 2A00A0731642ED4900DB349D /* Supporting Files */, + ); + path = Calculator; + sourceTree = ""; + }; + 2A00A0731642ED4900DB349D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 2A00A0741642ED4900DB349D /* Calculator-Info.plist */, + 2A00A0751642ED4900DB349D /* InfoPlist.strings */, + 2A00A0781642ED4900DB349D /* main.m */, + 2A00A07A1642ED4900DB349D /* Calculator-Prefix.pch */, + 2A00A07B1642ED4900DB349D /* Credits.rtf */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2A00A0671642ED4900DB349D /* Calculator */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2A00A0861642ED4900DB349D /* Build configuration list for PBXNativeTarget "Calculator" */; + buildPhases = ( + 2A00A0641642ED4900DB349D /* Sources */, + 2A00A0651642ED4900DB349D /* Frameworks */, + 2A00A0661642ED4900DB349D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Calculator; + productName = Calculator; + productReference = 2A00A0681642ED4900DB349D /* Calculator.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2A00A05F1642ED4900DB349D /* Project object */ = { + isa = PBXProject; + attributes = { + CLASSPREFIX = MGM; + LastUpgradeCheck = 0450; + ORGANIZATIONNAME = "Mr. Gecko's Media"; + }; + buildConfigurationList = 2A00A0621642ED4900DB349D /* Build configuration list for PBXProject "Calculator" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 2A00A05D1642ED4900DB349D; + productRefGroup = 2A00A0691642ED4900DB349D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2A00A0671642ED4900DB349D /* Calculator */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2A00A0661642ED4900DB349D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2A00A0771642ED4900DB349D /* InfoPlist.strings in Resources */, + 2A00A07D1642ED4900DB349D /* Credits.rtf in Resources */, + 2A00A08A1642EE1500DB349D /* Calculator.icns in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2A00A0641642ED4900DB349D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2A00A0791642ED4900DB349D /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 2A00A0751642ED4900DB349D /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 2A00A0761642ED4900DB349D /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 2A00A07B1642ED4900DB349D /* Credits.rtf */ = { + isa = PBXVariantGroup; + children = ( + 2A00A07C1642ED4900DB349D /* en */, + ); + name = Credits.rtf; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 2A00A0841642ED4900DB349D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 2A00A0851642ED4900DB349D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + SDKROOT = macosx; + }; + name = Release; + }; + 2A00A0871642ED4900DB349D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Calculator/Calculator-Prefix.pch"; + INFOPLIST_FILE = "Calculator/Calculator-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 2A00A0881642ED4900DB349D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Calculator/Calculator-Prefix.pch"; + INFOPLIST_FILE = "Calculator/Calculator-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2A00A0621642ED4900DB349D /* Build configuration list for PBXProject "Calculator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2A00A0841642ED4900DB349D /* Debug */, + 2A00A0851642ED4900DB349D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2A00A0861642ED4900DB349D /* Build configuration list for PBXNativeTarget "Calculator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2A00A0871642ED4900DB349D /* Debug */, + 2A00A0881642ED4900DB349D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2A00A05F1642ED4900DB349D /* Project object */; +} diff --git a/Calculator/Calculator.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Calculator/Calculator.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..294c83a --- /dev/null +++ b/Calculator/Calculator.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Calculator/Calculator.xcodeproj/project.xcworkspace/xcuserdata/grmrgecko.xcuserdatad/UserInterfaceState.xcuserstate b/Calculator/Calculator.xcodeproj/project.xcworkspace/xcuserdata/grmrgecko.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..75a6ff4 Binary files /dev/null and b/Calculator/Calculator.xcodeproj/project.xcworkspace/xcuserdata/grmrgecko.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100644 index 0000000..05301bc --- /dev/null +++ b/Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/Calculator.xcscheme b/Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/Calculator.xcscheme new file mode 100644 index 0000000..1919642 --- /dev/null +++ b/Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/Calculator.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/xcschememanagement.plist b/Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..4baea5f --- /dev/null +++ b/Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + Calculator.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 2A00A0671642ED4900DB349D + + primary + + + + + diff --git a/Calculator/Calculator/Calculator-Info.plist b/Calculator/Calculator/Calculator-Info.plist new file mode 100644 index 0000000..af78f0b --- /dev/null +++ b/Calculator/Calculator/Calculator-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + Calculator + CFBundleIdentifier + com.mrgeckosmedia.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSPrincipalClass + NSApplication + + diff --git a/Calculator/Calculator/Calculator-Prefix.pch b/Calculator/Calculator/Calculator-Prefix.pch new file mode 100644 index 0000000..132c0f6 --- /dev/null +++ b/Calculator/Calculator/Calculator-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'Calculator' target in the 'Calculator' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/Calculator/Calculator/Terminal.h b/Calculator/Calculator/Terminal.h new file mode 100644 index 0000000..a0daf81 --- /dev/null +++ b/Calculator/Calculator/Terminal.h @@ -0,0 +1,162 @@ +/* + * Terminal.h + */ + +#import +#import + + +@class TerminalApplication, TerminalWindow, TerminalSettingsSet, TerminalTab; + +enum TerminalSaveOptions { + TerminalSaveOptionsYes = 'yes ' /* Save the file. */, + TerminalSaveOptionsNo = 'no ' /* Do not save the file. */, + TerminalSaveOptionsAsk = 'ask ' /* Ask the user whether or not to save the file. */ +}; +typedef enum TerminalSaveOptions TerminalSaveOptions; + +enum TerminalPrintingErrorHandling { + TerminalPrintingErrorHandlingStandard = 'lwst' /* Standard PostScript error handling */, + TerminalPrintingErrorHandlingDetailed = 'lwdt' /* print a detailed report of PostScript errors */ +}; +typedef enum TerminalPrintingErrorHandling TerminalPrintingErrorHandling; + + + +/* + * Standard Suite + */ + +// The application‘s top-level scripting object. +@interface TerminalApplication : SBApplication + +- (SBElementArray *) windows; + +@property (copy, readonly) NSString *name; // The name of the application. +@property (readonly) BOOL frontmost; // Is this the frontmost (active) application? +@property (copy, readonly) NSString *version; // The version of the application. + +- (void) open:(NSArray *)x; // Open a document. +- (void) print:(id)x withProperties:(NSDictionary *)withProperties printDialog:(BOOL)printDialog; // Print a document. +- (void) quitSaving:(TerminalSaveOptions)saving; // Quit the application. +- (TerminalTab *) doScript:(NSString *)x in:(id)in_; // Runs a UNIX shell script or command. + +@end + +// A window. +@interface TerminalWindow : SBObject + +- (SBElementArray *) tabs; + +@property (copy, readonly) NSString *name; // The full title of the window. +- (NSInteger) id; // The unique identifier of the window. +@property NSInteger index; // The index of the window, ordered front to back. +@property NSRect bounds; // The bounding rectangle of the window. +@property (readonly) BOOL closeable; // Whether the window has a close box. +@property (readonly) BOOL miniaturizable; // Whether the window can be minimized. +@property BOOL miniaturized; // Whether the window is currently minimized. +@property (readonly) BOOL resizable; // Whether the window can be resized. +@property BOOL visible; // Whether the window is currently visible. +@property (readonly) BOOL zoomable; // Whether the window can be zoomed. +@property BOOL zoomed; // Whether the window is currently zoomed. +@property BOOL frontmost; // Whether the window is currently the frontmost Terminal window. +@property (copy) TerminalTab *selectedTab; +@property NSPoint position; // The position of the window, relative to the upper left corner of the screen. +@property NSPoint origin; // The position of the window, relative to the lower left corner of the screen. +@property NSPoint size; // The width and height of the window +@property NSRect frame; // The bounding rectangle, relative to the lower left corner of the screen. + +- (void) closeSaving:(TerminalSaveOptions)saving savingIn:(NSURL *)savingIn; // Close a document. +- (void) saveIn:(NSURL *)in_; // Save a document. +- (void) printWithProperties:(NSDictionary *)withProperties printDialog:(BOOL)printDialog; // Print a document. +- (void) delete; // Delete an object. +- (void) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location. +- (BOOL) exists; // Verify if an object exists. +- (void) moveTo:(SBObject *)to; // Move object(s) to a new location. + +@end + + + +/* + * Terminal Suite + */ + +@interface TerminalApplication (TerminalSuite) + +- (SBElementArray *) settingsSets; + +@property (copy) TerminalSettingsSet *defaultSettings; // The settings set used for new windows. +@property (copy) TerminalSettingsSet *startupSettings; // The settings set used for the window created on application startup. + +@end + +// A set of settings. +@interface TerminalSettingsSet : SBObject + +- (NSInteger) id; // The unique identifier of the settings set. +@property (copy) NSString *name; // The name of the settings set. +@property NSInteger numberOfRows; // The number of rows displayed in the tab. +@property NSInteger numberOfColumns; // The number of columns displayed in the tab. +@property (copy) NSColor *cursorColor; // The cursor color for the tab. +@property (copy) NSColor *backgroundColor; // The background color for the tab. +@property (copy) NSColor *normalTextColor; // The normal text color for the tab. +@property (copy) NSColor *boldTextColor; // The bold text color for the tab. +@property (copy) NSString *fontName; // The name of the font used to display the tab’s contents. +@property NSInteger fontSize; // The size of the font used to display the tab’s contents. +@property BOOL fontAntialiasing; // Whether the font used to display the tab’s contents is antialiased. +@property (copy) NSArray *cleanCommands; // The processes which will be ignored when checking whether a tab can be closed without showing a prompt. +@property BOOL titleDisplaysDeviceName; // Whether the title contains the device name. +@property BOOL titleDisplaysShellPath; // Whether the title contains the shell path. +@property BOOL titleDisplaysWindowSize; // Whether the title contains the tab’s size, in rows and columns. +@property BOOL titleDisplaysSettingsName; // Whether the title contains the settings name. +@property BOOL titleDisplaysCustomTitle; // Whether the title contains a custom title. +@property (copy) NSString *customTitle; // The tab’s custom title. + +- (void) closeSaving:(TerminalSaveOptions)saving savingIn:(NSURL *)savingIn; // Close a document. +- (void) saveIn:(NSURL *)in_; // Save a document. +- (void) printWithProperties:(NSDictionary *)withProperties printDialog:(BOOL)printDialog; // Print a document. +- (void) delete; // Delete an object. +- (void) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location. +- (BOOL) exists; // Verify if an object exists. +- (void) moveTo:(SBObject *)to; // Move object(s) to a new location. + +@end + +// A tab. +@interface TerminalTab : SBObject + +@property NSInteger numberOfRows; // The number of rows displayed in the tab. +@property NSInteger numberOfColumns; // The number of columns displayed in the tab. +@property (copy, readonly) NSString *contents; // The currently visible contents of the tab. +@property (copy, readonly) NSString *history; // The contents of the entire scrolling buffer of the tab. +@property (readonly) BOOL busy; // Whether the tab is busy running a process. +@property (copy, readonly) NSArray *processes; // The processes currently running in the tab. +@property BOOL selected; // Whether the tab is selected. +@property BOOL titleDisplaysCustomTitle; // Whether the title contains a custom title. +@property (copy) NSString *customTitle; // The tab’s custom title. +@property (copy, readonly) NSString *tty; // The tab’s TTY device. +@property (copy) TerminalSettingsSet *currentSettings; // The set of settings which control the tab’s behavior and appearance. +@property (copy) NSColor *cursorColor; // The cursor color for the tab. +@property (copy) NSColor *backgroundColor; // The background color for the tab. +@property (copy) NSColor *normalTextColor; // The normal text color for the tab. +@property (copy) NSColor *boldTextColor; // The bold text color for the tab. +@property (copy) NSArray *cleanCommands; // The processes which will be ignored when checking whether a tab can be closed without showing a prompt. +@property BOOL titleDisplaysDeviceName; // Whether the title contains the device name. +@property BOOL titleDisplaysShellPath; // Whether the title contains the shell path. +@property BOOL titleDisplaysWindowSize; // Whether the title contains the tab’s size, in rows and columns. +@property BOOL titleDisplaysFileName; // Whether the title contains the file name. +@property (copy) NSString *fontName; // The name of the font used to display the tab’s contents. +@property NSInteger fontSize; // The size of the font used to display the tab’s contents. +@property BOOL fontAntialiasing; // Whether the font used to display the tab’s contents is antialiased. + +- (void) closeSaving:(TerminalSaveOptions)saving savingIn:(NSURL *)savingIn; // Close a document. +- (void) saveIn:(NSURL *)in_; // Save a document. +- (void) printWithProperties:(NSDictionary *)withProperties printDialog:(BOOL)printDialog; // Print a document. +- (void) delete; // Delete an object. +- (void) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location. +- (BOOL) exists; // Verify if an object exists. +- (void) moveTo:(SBObject *)to; // Move object(s) to a new location. + +@end + diff --git a/Calculator/Calculator/en.lproj/Credits.rtf b/Calculator/Calculator/en.lproj/Credits.rtf new file mode 100644 index 0000000..46576ef --- /dev/null +++ b/Calculator/Calculator/en.lproj/Credits.rtf @@ -0,0 +1,29 @@ +{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} +{\colortbl;\red255\green255\blue255;} +\paperw9840\paperh8400 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\b\fs24 \cf0 Engineering: +\b0 \ + Some people\ +\ + +\b Human Interface Design: +\b0 \ + Some other people\ +\ + +\b Testing: +\b0 \ + Hopefully not nobody\ +\ + +\b Documentation: +\b0 \ + Whoever\ +\ + +\b With special thanks to: +\b0 \ + Mom\ +} diff --git a/Calculator/Calculator/en.lproj/InfoPlist.strings b/Calculator/Calculator/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/Calculator/Calculator/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/Calculator/Calculator/iTerm.h b/Calculator/Calculator/iTerm.h new file mode 100644 index 0000000..3c0d128 --- /dev/null +++ b/Calculator/Calculator/iTerm.h @@ -0,0 +1,279 @@ +/* + * iTerm.h + */ + +#import +#import + + +@class iTermItem, iTermITermApplication, iTermColor, iTermDocument, iTermWindow, iTermAttributeRun, iTermCharacter, iTermParagraph, iTermText, iTermAttachment, iTermWord, iTermSession, iTermTerminal, iTermPrintSettings; + +enum iTermSavo { + iTermSavoAsk = 'ask ' /* Ask the user whether or not to save the file. */, + iTermSavoNo = 'no ' /* Do not save the file. */, + iTermSavoYes = 'yes ' /* Save the file. */ +}; +typedef enum iTermSavo iTermSavo; + +enum iTermEnum { + iTermEnumStandard = 'lwst' /* Standard PostScript error handling */, + iTermEnumDetailed = 'lwdt' /* print a detailed report of PostScript errors */ +}; +typedef enum iTermEnum iTermEnum; + + + +/* + * Standard Suite + */ + +// A scriptable object. +@interface iTermItem : SBObject + +@property (copy) NSDictionary *properties; // All of the object's properties. + +- (void) closeSaving:(iTermSavo)saving savingIn:(NSURL *)savingIn; // Close an object. +- (void) delete; // Delete an object. +- (void) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location. +- (BOOL) exists; // Verify if an object exists. +- (void) moveTo:(SBObject *)to; // Move object(s) to a new location. +- (void) saveAs:(NSString *)as in:(NSURL *)in_; // Save an object. +- (void) execCommand:(NSString *)command; // Executes a command in a session (attach a trailing space for commands without carriage return) +- (iTermSession *) launchSession:(NSString *)session; // Launches a default or saved session +- (void) select; // Selects a specified session +- (void) terminate; // Terminates a session +- (void) writeContentsOfFile:(NSString *)contentsOfFile text:(NSString *)text; // Writes text or file contents into a session + +@end + +// An application's top level scripting object. +@interface iTermITermApplication : SBApplication + +- (SBElementArray *) documents; +- (SBElementArray *) windows; + +@property (readonly) BOOL frontmost; // Is this the frontmost (active) application? +@property (copy, readonly) NSString *name; // The name of the application. +@property (copy, readonly) NSString *version; // The version of the application. + +- (iTermDocument *) open:(NSURL *)x; // Open an object. +- (void) print:(NSURL *)x printDialog:(BOOL)printDialog withProperties:(iTermPrintSettings *)withProperties; // Print an object. +- (void) quitSaving:(iTermSavo)saving; // Quit an application. + +@end + +// A color. +@interface iTermColor : iTermItem + + +@end + +// A document. +@interface iTermDocument : iTermItem + +@property (readonly) BOOL modified; // Has the document been modified since the last save? +@property (copy) NSString *name; // The document's name. +@property (copy) NSString *path; // The document's path. + + +@end + +// A window. +@interface iTermWindow : iTermItem + +@property NSRect bounds; // The bounding rectangle of the window. +@property (readonly) BOOL closeable; // Whether the window has a close box. +@property (copy, readonly) iTermDocument *document; // The document whose contents are being displayed in the window. +@property (readonly) BOOL floating; // Whether the window floats. +- (NSInteger) id; // The unique identifier of the window. +@property NSInteger index; // The index of the window, ordered front to back. +@property (readonly) BOOL miniaturizable; // Whether the window can be miniaturized. +@property BOOL miniaturized; // Whether the window is currently miniaturized. +@property (readonly) BOOL modal; // Whether the window is the application's current modal window. +@property (copy) NSString *name; // The full title of the window. +@property (readonly) BOOL resizable; // Whether the window can be resized. +@property (readonly) BOOL titled; // Whether the window has a title bar. +@property BOOL visible; // Whether the window is currently visible. +@property (readonly) BOOL zoomable; // Whether the window can be zoomed. +@property BOOL zoomed; // Whether the window is currently zoomed. + + +@end + + + +/* + * Text Suite + */ + +// This subdivides the text into chunks that all have the same attributes. +@interface iTermAttributeRun : iTermItem + +- (SBElementArray *) attachments; +- (SBElementArray *) attributeRuns; +- (SBElementArray *) characters; +- (SBElementArray *) paragraphs; +- (SBElementArray *) words; + +@property (copy) NSColor *color; // The color of the first character. +@property (copy) NSString *font; // The name of the font of the first character. +@property NSInteger size; // The size in points of the first character. + + +@end + +// This subdivides the text into characters. +@interface iTermCharacter : iTermItem + +- (SBElementArray *) attachments; +- (SBElementArray *) attributeRuns; +- (SBElementArray *) characters; +- (SBElementArray *) paragraphs; +- (SBElementArray *) words; + +@property (copy) NSColor *color; // The color of the first character. +@property (copy) NSString *font; // The name of the font of the first character. +@property NSInteger size; // The size in points of the first character. + + +@end + +// This subdivides the text into paragraphs. +@interface iTermParagraph : iTermItem + +- (SBElementArray *) attachments; +- (SBElementArray *) attributeRuns; +- (SBElementArray *) characters; +- (SBElementArray *) paragraphs; +- (SBElementArray *) words; + +@property (copy) NSColor *color; // The color of the first character. +@property (copy) NSString *font; // The name of the font of the first character. +@property NSInteger size; // The size in points of the first character. + + +@end + +// Rich (styled) text +@interface iTermText : iTermItem + +- (SBElementArray *) attachments; +- (SBElementArray *) attributeRuns; +- (SBElementArray *) characters; +- (SBElementArray *) paragraphs; +- (SBElementArray *) words; + +@property (copy) NSColor *color; // The color of the first character. +@property (copy) NSString *font; // The name of the font of the first character. +@property NSInteger size; // The size in points of the first character. + + +@end + +// Represents an inline text attachment. This class is used mainly for make commands. +@interface iTermAttachment : iTermText + +@property (copy) NSString *fileName; // The path to the file for the attachment + + +@end + +// This subdivides the text into words. +@interface iTermWord : iTermItem + +- (SBElementArray *) attachments; +- (SBElementArray *) attributeRuns; +- (SBElementArray *) characters; +- (SBElementArray *) paragraphs; +- (SBElementArray *) words; + +@property (copy) NSColor *color; // The color of the first character. +@property (copy) NSString *font; // The name of the font of the first character. +@property NSInteger size; // The size in points of the first character. + + +@end + + + +/* + * iTerm Suite + */ + +// Main application class +@interface iTermITermApplication (ITermSuite) + +- (SBElementArray *) terminals; + +@property (copy) iTermTerminal *currentTerminal; // currently active terminal +@property (copy) NSString *uriToken; // URI token + +@end + +// A terminal session +@interface iTermSession : iTermItem + +@property (copy) NSColor *backgroundColor; // Background color +@property (copy) NSString *backgroundImagePath; // Path to background image +@property (copy) NSColor *boldColor; // Bold color +@property (copy, readonly) NSString *contents; // text of the session +@property (copy) NSColor *cursorColor; // Cursor color +@property (copy) NSColor *cursor_textColor; // Cursor text color +@property (copy) NSColor *foregroundColor; // Foreground color +- (NSString *) id; // id of session; set to tty name +@property (copy) NSString *name; // Name of this session +@property NSInteger number; // index of session +@property (copy) NSColor *selectedTextColor; // Selected text color +@property (copy) NSColor *selectionColor; // Selection color +@property double transparency; // Transparency (0-1) +@property (copy, readonly) NSString *tty; // tty device of session + + +@end + +// A pseudo terminal +@interface iTermTerminal : iTermItem + +- (SBElementArray *) sessions; + +@property BOOL antiAlias; // Anti alias for window +@property (copy) iTermSession *currentSession; // current session in the terminal +@property NSInteger numberOfColumns; // Number of columns +@property NSInteger numberOfRows; // Number of rows + + +@end + + + +/* + * Type Definitions + */ + +@interface iTermPrintSettings : SBObject + +@property NSInteger copies; // the number of copies of a document to be printed +@property BOOL collating; // Should printed copies be collated? +@property NSInteger startingPage; // the first page of the document to be printed +@property NSInteger endingPage; // the last page of the document to be printed +@property NSInteger pagesAcross; // number of logical pages laid across a physical page +@property NSInteger pagesDown; // number of logical pages laid out down a physical page +@property (copy) NSDate *requestedPrintTime; // the time at which the desktop printer should print the document +@property iTermEnum errorHandling; // how errors are handled +@property (copy) NSString *faxNumber; // for fax number +@property (copy) NSString *targetPrinter; // for target printer + +- (void) closeSaving:(iTermSavo)saving savingIn:(NSURL *)savingIn; // Close an object. +- (void) delete; // Delete an object. +- (void) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties; // Copy object(s) and put the copies at a new location. +- (BOOL) exists; // Verify if an object exists. +- (void) moveTo:(SBObject *)to; // Move object(s) to a new location. +- (void) saveAs:(NSString *)as in:(NSURL *)in_; // Save an object. +- (void) execCommand:(NSString *)command; // Executes a command in a session (attach a trailing space for commands without carriage return) +- (iTermSession *) launchSession:(NSString *)session; // Launches a default or saved session +- (void) select; // Selects a specified session +- (void) terminate; // Terminates a session +- (void) writeContentsOfFile:(NSString *)contentsOfFile text:(NSString *)text; // Writes text or file contents into a session + +@end + diff --git a/Calculator/Calculator/main.m b/Calculator/Calculator/main.m new file mode 100644 index 0000000..eab8fdf --- /dev/null +++ b/Calculator/Calculator/main.m @@ -0,0 +1,30 @@ +// +// main.m +// Calculator +// +// Created by Mr. Gecko on 10/31/12. +// No Copyright Claimed. Public Domain. +// + +#import +#import +#import "Terminal.h" +#import "iTerm.h" + +int main(int argc, char *argv[]) { + iTermITermApplication *iTerm = [SBApplication applicationWithBundleIdentifier:@"com.googlecode.iterm2"]; + if (iTerm!=nil) { + iTermTerminal *terminal = [[[iTerm classForScriptingClass:@"terminal"] alloc] init]; + [[iTerm terminals] addObject:terminal]; + iTermSession *session = [[[iTerm classForScriptingClass:@"session"] alloc] init]; + [[terminal sessions] addObject:session]; + [session execCommand:@"/usr/ubin/calc"]; + [iTerm activate]; + } else { + TerminalApplication *terminal = [SBApplication applicationWithBundleIdentifier:@"com.apple.Terminal"]; + [terminal doScript:@"calc" in:nil]; + [terminal activate]; + } + + return 0; +} diff --git a/calc b/calc new file mode 100755 index 0000000..2284afc --- /dev/null +++ b/calc @@ -0,0 +1,8 @@ +#!/bin/bash +# +# calc.php +# +# Created by Mr. Gecko on 10/31/12. +# No Copyright Claimed. Public Domain. +# +php /usr/ubin/calc.php \ No newline at end of file diff --git a/calc.php b/calc.php new file mode 100644 index 0000000..12c1fe9 --- /dev/null +++ b/calc.php @@ -0,0 +1,21 @@ + on 10/31/12. +// No Copyright Claimed. Public Domain. +// +while (1) { + $command = readline("> "); + try { + if (preg_match("/^[0-9]+/i", $command) || !preg_match("/;/i", $command)) { + $result = eval("return ".$command.";"); + echo $result."\n"; + } else { + eval($command); + } + } catch (Exception $e) { + echo "Error: ".$e->getMessage()."\n"; + } +} +?> \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..80c374f --- /dev/null +++ b/readme.md @@ -0,0 +1,9 @@ +#Installation +In terminal, copy/paste the following to create a ```ubin``` (user bin) folder if it doesn't exist already and add to paths. +``` +sudo mkdir /usr/ubin +sudo chown $USER /usr/ubin +echo "export PATH=\"/usr/ubin:\$PATH\"" >> ~/.profile +``` + +Then move the ```calc.php``` and ```calc``` file over to ```/usr/ubin/``` and make sure ```calc``` is executable by ```chmod +x /usr/ubin/calc``` \ No newline at end of file