Browse Source

PHPCalc Start

master
GRMrGecko 10 years ago
commit
7ee87ef3d8
  1. BIN
      Calculator/Calculator.icns
  2. 298
      Calculator/Calculator.xcodeproj/project.pbxproj
  3. 7
      Calculator/Calculator.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  4. BIN
      Calculator/Calculator.xcodeproj/project.xcworkspace/xcuserdata/grmrgecko.xcuserdatad/UserInterfaceState.xcuserstate
  5. 5
      Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  6. 86
      Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/Calculator.xcscheme
  7. 22
      Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/xcschememanagement.plist
  8. 30
      Calculator/Calculator/Calculator-Info.plist
  9. 7
      Calculator/Calculator/Calculator-Prefix.pch
  10. 162
      Calculator/Calculator/Terminal.h
  11. 29
      Calculator/Calculator/en.lproj/Credits.rtf
  12. 2
      Calculator/Calculator/en.lproj/InfoPlist.strings
  13. 279
      Calculator/Calculator/iTerm.h
  14. 30
      Calculator/Calculator/main.m
  15. 8
      calc
  16. 21
      calc.php
  17. 9
      readme.md

BIN
Calculator/Calculator.icns

298
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 = "<group>"; };
2A00A0761642ED4900DB349D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
2A00A0781642ED4900DB349D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2A00A07A1642ED4900DB349D /* Calculator-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Calculator-Prefix.pch"; sourceTree = "<group>"; };
2A00A07C1642ED4900DB349D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
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 = "<group>"; };
2AAF0683174A4A3B006CB987 /* iTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iTerm.h; sourceTree = "<group>"; };
/* 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 = "<group>";
};
2A00A0691642ED4900DB349D /* Products */ = {
isa = PBXGroup;
children = (
2A00A0681642ED4900DB349D /* Calculator.app */,
);
name = Products;
sourceTree = "<group>";
};
2A00A06B1642ED4900DB349D /* Frameworks */ = {
isa = PBXGroup;
children = (
2A00A08B1642F1EC00DB349D /* ScriptingBridge.framework */,
2A00A06C1642ED4900DB349D /* Cocoa.framework */,
2A00A06E1642ED4900DB349D /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
2A00A06E1642ED4900DB349D /* Other Frameworks */ = {
isa = PBXGroup;
children = (
2A00A06F1642ED4900DB349D /* AppKit.framework */,
2A00A0701642ED4900DB349D /* CoreData.framework */,
2A00A0711642ED4900DB349D /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
2A00A0721642ED4900DB349D /* Calculator */ = {
isa = PBXGroup;
children = (
2A00A08E164311AA00DB349D /* Terminal.h */,
2AAF0683174A4A3B006CB987 /* iTerm.h */,
2A00A0891642EE1500DB349D /* Calculator.icns */,
2A00A0731642ED4900DB349D /* Supporting Files */,
);
path = Calculator;
sourceTree = "<group>";
};
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 = "<group>";
};
/* 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 = "<group>";
};
2A00A07B1642ED4900DB349D /* Credits.rtf */ = {
isa = PBXVariantGroup;
children = (
2A00A07C1642ED4900DB349D /* en */,
);
name = Credits.rtf;
sourceTree = "<group>";
};
/* 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 */;
}

7
Calculator/Calculator.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Calculator.xcodeproj">
</FileRef>
</Workspace>

BIN
Calculator/Calculator.xcodeproj/project.xcworkspace/xcuserdata/grmrgecko.xcuserdatad/UserInterfaceState.xcuserstate

5
Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "1.0">
</Bucket>

86
Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/Calculator.xcscheme

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2A00A0671642ED4900DB349D"
BuildableName = "Calculator.app"
BlueprintName = "Calculator"
ReferencedContainer = "container:Calculator.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2A00A0671642ED4900DB349D"
BuildableName = "Calculator.app"
BlueprintName = "Calculator"
ReferencedContainer = "container:Calculator.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2A00A0671642ED4900DB349D"
BuildableName = "Calculator.app"
BlueprintName = "Calculator"
ReferencedContainer = "container:Calculator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2A00A0671642ED4900DB349D"
BuildableName = "Calculator.app"
BlueprintName = "Calculator"
ReferencedContainer = "container:Calculator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

22
Calculator/Calculator.xcodeproj/xcuserdata/grmrgecko.xcuserdatad/xcschemes/xcschememanagement.plist

@ -0,0 +1,22 @@
<?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>SchemeUserState</key>
<dict>
<key>Calculator.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>2A00A0671642ED4900DB349D</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

30
Calculator/Calculator/Calculator-Info.plist

@ -0,0 +1,30 @@
<?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>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Calculator</string>
<key>CFBundleIdentifier</key>
<string>com.mrgeckosmedia.${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>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

7
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 <Cocoa/Cocoa.h>
#endif

162
Calculator/Calculator/Terminal.h

@ -0,0 +1,162 @@
/*
* Terminal.h
*/
#import <AppKit/AppKit.h>
#import <ScriptingBridge/ScriptingBridge.h>
@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 applications 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 tabs contents.
@property NSInteger fontSize; // The size of the font used to display the tabs contents.
@property BOOL fontAntialiasing; // Whether the font used to display the tabs 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 tabs 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 tabs 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 tabs custom title.
@property (copy, readonly) NSString *tty; // The tabs TTY device.
@property (copy) TerminalSettingsSet *currentSettings; // The set of settings which control the tabs 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 tabs 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 tabs contents.
@property NSInteger fontSize; // The size of the font used to display the tabs contents.
@property BOOL fontAntialiasing; // Whether the font used to display the tabs 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

29
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\
}

2
Calculator/Calculator/en.lproj/InfoPlist.strings

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

279
Calculator/Calculator/iTerm.h

@ -0,0 +1,279 @@
/*
* iTerm.h
*/
#import <AppKit/AppKit.h>
#import <ScriptingBridge/ScriptingBridge.h>
@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

30
Calculator/Calculator/main.m

@ -0,0 +1,30 @@
//
// main.m
// Calculator
//
// Created by Mr. Gecko <GRMrGecko@gmail.com> on 10/31/12.
// No Copyright Claimed. Public Domain.
//
#import <Cocoa/Cocoa.h>
#import <ScriptingBridge/ScriptingBridge.h>
#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;
}

8
calc

@ -0,0 +1,8 @@
#!/bin/bash
#
# calc.php
#
# Created by Mr. Gecko <GRMrGecko@gmail.com> on 10/31/12.
# No Copyright Claimed. Public Domain.
#
php /usr/ubin/calc.php

21
calc.php

@ -0,0 +1,21 @@
<?
//
// calc.php
//
// Created by Mr. Gecko <GRMrGecko@gmail.com> 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";
}
}
?>

9
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```
Loading…
Cancel
Save