mirror of https://github.com/jeremysrand/BuGS.git
Initial Commit
This commit is contained in:
commit
dbe7e7ad3f
|
@ -0,0 +1,522 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
9D17168F2491C49300C83148 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D17168E2491C49300C83148 /* main.c */; };
|
||||
9D1716922491C49300C83148 /* main.rez in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716912491C49300C83148 /* main.rez */; };
|
||||
9D1716942491C49300C83148 /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = 9D1716932491C49300C83148 /* Makefile */; };
|
||||
9D1716972491C49300C83148 /* config.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716962491C49300C83148 /* config.txt */; };
|
||||
9D1716992491C49300C83148 /* createDiskImage in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716982491C49300C83148 /* createDiskImage */; };
|
||||
9D17169B2491C49300C83148 /* head.mk in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D17169A2491C49300C83148 /* head.mk */; };
|
||||
9D17169D2491C49300C83148 /* launchEmulator in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D17169C2491C49300C83148 /* launchEmulator */; };
|
||||
9D17169F2491C49300C83148 /* orca-asm in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D17169E2491C49300C83148 /* orca-asm */; };
|
||||
9D1716A12491C49300C83148 /* orca-cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716A02491C49300C83148 /* orca-cc */; };
|
||||
9D1716A32491C49300C83148 /* orca-rez in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716A22491C49300C83148 /* orca-rez */; };
|
||||
9D1716A52491C49300C83148 /* system601.2mg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716A42491C49300C83148 /* system601.2mg */; };
|
||||
9D1716A72491C49300C83148 /* tail.mk in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716A62491C49300C83148 /* tail.mk */; };
|
||||
9D1716AA2491C49300C83148 /* BuGS.xcscheme in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D1716A92491C49300C83148 /* BuGS.xcscheme */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
9D17168A2491C49300C83148 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
9D17169D2491C49300C83148 /* launchEmulator in CopyFiles */,
|
||||
9D1716AA2491C49300C83148 /* BuGS.xcscheme in CopyFiles */,
|
||||
9D1716A12491C49300C83148 /* orca-cc in CopyFiles */,
|
||||
9D1716992491C49300C83148 /* createDiskImage in CopyFiles */,
|
||||
9D1716A32491C49300C83148 /* orca-rez in CopyFiles */,
|
||||
9D1716972491C49300C83148 /* config.txt in CopyFiles */,
|
||||
9D1716A52491C49300C83148 /* system601.2mg in CopyFiles */,
|
||||
9D17169F2491C49300C83148 /* orca-asm in CopyFiles */,
|
||||
9D1716922491C49300C83148 /* main.rez in CopyFiles */,
|
||||
9D17169B2491C49300C83148 /* head.mk in CopyFiles */,
|
||||
9D1716A72491C49300C83148 /* tail.mk in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
9D1716842491C49300C83148 /* BuGS */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BuGS; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9D1716872491C49300C83148 /* BuGS.2mg */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BuGS.2mg; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9D17168C2491C49300C83148 /* doNotBuild */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = doNotBuild; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9D17168E2491C49300C83148 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
|
||||
9D1716902491C49300C83148 /* main.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = main.h; sourceTree = "<group>"; };
|
||||
9D1716912491C49300C83148 /* main.rez */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.rez; path = main.rez; sourceTree = "<group>"; };
|
||||
9D1716932491C49300C83148 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
9D1716962491C49300C83148 /* config.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = config.txt; sourceTree = "<group>"; };
|
||||
9D1716982491C49300C83148 /* createDiskImage */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = createDiskImage; sourceTree = "<group>"; };
|
||||
9D17169A2491C49300C83148 /* head.mk */ = {isa = PBXFileReference; lastKnownFileType = text; path = head.mk; sourceTree = "<group>"; };
|
||||
9D17169C2491C49300C83148 /* launchEmulator */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = launchEmulator; sourceTree = "<group>"; };
|
||||
9D17169E2491C49300C83148 /* orca-asm */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "orca-asm"; sourceTree = "<group>"; };
|
||||
9D1716A02491C49300C83148 /* orca-cc */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "orca-cc"; sourceTree = "<group>"; };
|
||||
9D1716A22491C49300C83148 /* orca-rez */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "orca-rez"; sourceTree = "<group>"; };
|
||||
9D1716A42491C49300C83148 /* system601.2mg */ = {isa = PBXFileReference; lastKnownFileType = file; path = system601.2mg; sourceTree = "<group>"; };
|
||||
9D1716A62491C49300C83148 /* tail.mk */ = {isa = PBXFileReference; lastKnownFileType = text; path = tail.mk; sourceTree = "<group>"; };
|
||||
9D1716A92491C49300C83148 /* BuGS.xcscheme */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = BuGS.xcscheme; path = ../../BuGS.xcodeproj/xcshareddata/xcschemes/BuGS.xcscheme; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
9D1716892491C49300C83148 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
9D17167D2491C49300C83148 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9D17168D2491C49300C83148 /* BuGS */,
|
||||
9D1716852491C49300C83148 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9D1716852491C49300C83148 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9D1716842491C49300C83148 /* BuGS */,
|
||||
9D1716872491C49300C83148 /* BuGS.2mg */,
|
||||
9D17168C2491C49300C83148 /* doNotBuild */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9D17168D2491C49300C83148 /* BuGS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9D17168E2491C49300C83148 /* main.c */,
|
||||
9D1716902491C49300C83148 /* main.h */,
|
||||
9D1716912491C49300C83148 /* main.rez */,
|
||||
9D1716932491C49300C83148 /* Makefile */,
|
||||
9D1716952491C49300C83148 /* make */,
|
||||
9D1716A82491C49300C83148 /* Supporting Files */,
|
||||
);
|
||||
path = BuGS;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9D1716952491C49300C83148 /* make */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9D1716962491C49300C83148 /* config.txt */,
|
||||
9D1716982491C49300C83148 /* createDiskImage */,
|
||||
9D17169A2491C49300C83148 /* head.mk */,
|
||||
9D17169C2491C49300C83148 /* launchEmulator */,
|
||||
9D17169E2491C49300C83148 /* orca-asm */,
|
||||
9D1716A02491C49300C83148 /* orca-cc */,
|
||||
9D1716A22491C49300C83148 /* orca-rez */,
|
||||
9D1716A42491C49300C83148 /* system601.2mg */,
|
||||
9D1716A62491C49300C83148 /* tail.mk */,
|
||||
);
|
||||
path = make;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9D1716A82491C49300C83148 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9D1716A92491C49300C83148 /* BuGS.xcscheme */,
|
||||
);
|
||||
path = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXLegacyTarget section */
|
||||
9D1716822491C49300C83148 /* BuGS */ = {
|
||||
isa = PBXLegacyTarget;
|
||||
buildArgumentsString = "-C BuGS $(ACTION)";
|
||||
buildConfigurationList = 9D1716AD2491C49300C83148 /* Build configuration list for PBXLegacyTarget "BuGS" */;
|
||||
buildPhases = (
|
||||
);
|
||||
buildToolPath = /usr/bin/make;
|
||||
dependencies = (
|
||||
);
|
||||
name = BuGS;
|
||||
passBuildSettingsInEnvironment = 1;
|
||||
productName = BuGS;
|
||||
};
|
||||
/* End PBXLegacyTarget section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
9D1716832491C49300C83148 /* Binary */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9D1716B02491C49300C83148 /* Build configuration list for PBXNativeTarget "Binary" */;
|
||||
buildPhases = (
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Binary;
|
||||
productName = Binary;
|
||||
productReference = 9D1716842491C49300C83148 /* BuGS */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
9D1716862491C49300C83148 /* DiskImage */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9D1716B32491C49300C83148 /* Build configuration list for PBXNativeTarget "DiskImage" */;
|
||||
buildPhases = (
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = DiskImage;
|
||||
productName = DiskImage;
|
||||
productReference = 9D1716872491C49300C83148 /* BuGS.2mg */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
9D17168B2491C49300C83148 /* doNotBuild */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9D1716B62491C49300C83148 /* Build configuration list for PBXNativeTarget "doNotBuild" */;
|
||||
buildPhases = (
|
||||
9D1716882491C49300C83148 /* Sources */,
|
||||
9D1716892491C49300C83148 /* Frameworks */,
|
||||
9D17168A2491C49300C83148 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = doNotBuild;
|
||||
productName = doNotBuild;
|
||||
productReference = 9D17168C2491C49300C83148 /* doNotBuild */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
9D17167E2491C49300C83148 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1130;
|
||||
ORGANIZATIONNAME = "Jeremy Rand";
|
||||
TargetAttributes = {
|
||||
9D1716822491C49300C83148 = {
|
||||
CreatedOnToolsVersion = 11.3.1;
|
||||
};
|
||||
9D1716832491C49300C83148 = {
|
||||
CreatedOnToolsVersion = 11.3.1;
|
||||
};
|
||||
9D1716862491C49300C83148 = {
|
||||
CreatedOnToolsVersion = 11.3.1;
|
||||
};
|
||||
9D17168B2491C49300C83148 = {
|
||||
CreatedOnToolsVersion = 11.3.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 9D1716812491C49300C83148 /* Build configuration list for PBXProject "BuGS" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 9D17167D2491C49300C83148;
|
||||
productRefGroup = 9D1716852491C49300C83148 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
9D1716822491C49300C83148 /* BuGS */,
|
||||
9D1716832491C49300C83148 /* Binary */,
|
||||
9D1716862491C49300C83148 /* DiskImage */,
|
||||
9D17168B2491C49300C83148 /* doNotBuild */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
9D1716882491C49300C83148 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9D1716942491C49300C83148 /* Makefile in Sources */,
|
||||
9D17168F2491C49300C83148 /* main.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
9D1716AB2491C49300C83148 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9D1716AC2491C49300C83148 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9D1716AE2491C49300C83148 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEBUGGING_SYMBOLS = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = VD9FGCW36C;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9D1716AF2491C49300C83148 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = VD9FGCW36C;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9D1716B12491C49300C83148 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = VD9FGCW36C;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
PRODUCT_NAME = BuGS;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9D1716B22491C49300C83148 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = VD9FGCW36C;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
PRODUCT_NAME = BuGS;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9D1716B42491C49300C83148 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = VD9FGCW36C;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
PRODUCT_NAME = BuGS.2mg;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9D1716B52491C49300C83148 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = VD9FGCW36C;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
PRODUCT_NAME = BuGS.2mg;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9D1716B72491C49300C83148 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = VD9FGCW36C;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"inline(X,Y)=\"\"\n",
|
||||
"extended=double\n",
|
||||
"pascal=\"\"",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$TEMP_ROOT/BuGS.build/$CONFIGURATION/BuGS.build/DerivedSources\n",
|
||||
"$GOLDEN_GATE/Libraries/ORCACDefs\n",
|
||||
"~/Library/GoldenGate/Libraries/ORCACDefs\n",
|
||||
"/Library/GoldenGate/Libraries/ORCACDefs\n",
|
||||
"~/GoldenGate/Libraries/ORCACDefs",
|
||||
);
|
||||
PRODUCT_NAME = doNotBuild;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9D1716B82491C49300C83148 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = VD9FGCW36C;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"inline(X,Y)=\"\"\n",
|
||||
"extended=double\n",
|
||||
"pascal=\"\"",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$TEMP_ROOT/BuGS.build/$CONFIGURATION/BuGS.build/DerivedSources\n",
|
||||
"$GOLDEN_GATE/Libraries/ORCACDefs\n",
|
||||
"~/Library/GoldenGate/Libraries/ORCACDefs\n",
|
||||
"/Library/GoldenGate/Libraries/ORCACDefs\n",
|
||||
"~/GoldenGate/Libraries/ORCACDefs",
|
||||
);
|
||||
PRODUCT_NAME = doNotBuild;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
9D1716812491C49300C83148 /* Build configuration list for PBXProject "BuGS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9D1716AB2491C49300C83148 /* Debug */,
|
||||
9D1716AC2491C49300C83148 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9D1716AD2491C49300C83148 /* Build configuration list for PBXLegacyTarget "BuGS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9D1716AE2491C49300C83148 /* Debug */,
|
||||
9D1716AF2491C49300C83148 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9D1716B02491C49300C83148 /* Build configuration list for PBXNativeTarget "Binary" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9D1716B12491C49300C83148 /* Debug */,
|
||||
9D1716B22491C49300C83148 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9D1716B32491C49300C83148 /* Build configuration list for PBXNativeTarget "DiskImage" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9D1716B42491C49300C83148 /* Debug */,
|
||||
9D1716B52491C49300C83148 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9D1716B62491C49300C83148 /* Build configuration list for PBXNativeTarget "doNotBuild" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9D1716B72491C49300C83148 /* Debug */,
|
||||
9D1716B82491C49300C83148 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 9D17167E2491C49300C83148 /* Project object */;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:BuGS.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -0,0 +1,8 @@
|
|||
<?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>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0830"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "9D0B917C1F526C2D004D7E0B"
|
||||
BuildableName = "BuGS"
|
||||
BlueprintName = "BuGS"
|
||||
ReferencedContainer = "container:BuGS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = ""
|
||||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<PathRunnable
|
||||
runnableDebuggingMode = "0"
|
||||
FilePath = "/usr/bin/make">
|
||||
</PathRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "9D0B917C1F526C2D004D7E0B"
|
||||
BuildableName = "BuGS"
|
||||
BlueprintName = "BuGS"
|
||||
ReferencedContainer = "container:BuGS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "-C"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "$PROJECT_DIR/BuGS"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "TARGET_BUILD_DIR=$TARGET_BUILD_DIR"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "DERIVED_SOURCES_DIR=$DERIVED_SOURCES_DIR"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "OBJECT_FILE_DIR=$OBJECT_FILE_DIR"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "execute"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "9D0B917C1F526C2D004D7E0B"
|
||||
BuildableName = "BuGS"
|
||||
BlueprintName = "BuGS"
|
||||
ReferencedContainer = "container:BuGS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -0,0 +1,29 @@
|
|||
<?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>Binary.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>BuGS.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>DiskImage.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<key>doNotBuild.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,124 @@
|
|||
#
|
||||
# Makefile
|
||||
# Apple //GS Build Engine for ORCA and Merlin
|
||||
#
|
||||
|
||||
include make/head.mk
|
||||
|
||||
# Customize this file to control what kind of project you are working on,
|
||||
# where to find files, etc.
|
||||
|
||||
# The name of your system or binary file to build goes here:
|
||||
PGM=BuGS
|
||||
|
||||
# Set the target type you would like to build. The options are:
|
||||
# shell - A shell command for ORCA, GNO or other GS shell
|
||||
# desktop - A full desktop application
|
||||
# cda - A classic desk accessory
|
||||
# cdev - A control panel device
|
||||
# nba - A HyperStudio new button action
|
||||
# nda - A new desk accessory
|
||||
# xcmd - A HyperCard XCMD or XCFN
|
||||
#
|
||||
# TARGETTYPE=shell
|
||||
TARGETTYPE=desktop
|
||||
# TARGETTYPE=cda
|
||||
# TARGETTYPE=cdev
|
||||
# TARGETTYPE=nba
|
||||
# TARGETTYPE=nda
|
||||
# TARGETTYPE=xcmd
|
||||
|
||||
# Add any other directories where you are putting C or assembly source
|
||||
# files to this list:
|
||||
# SRCDIRS+=
|
||||
|
||||
# If you put your main entry point for your project in a file called main.c
|
||||
# Then you don't need to change this value. If you want to call your entry
|
||||
# point something other than main.c, set this variable to point to this file.
|
||||
ROOTCFILE=main.c
|
||||
|
||||
# Add any arguments you want passed to the C compiler to this variable:
|
||||
CFLAGS+=
|
||||
|
||||
# Add any arguments you want passed to the resource compiler to this variable:
|
||||
REZFLAGS+=
|
||||
|
||||
# Uncomment the following line if you have installed rlint as found here:
|
||||
# https://github.com/ksherlock/rlint/releases
|
||||
# Assuming that it is in the path that ORCA searches (the Utilities directory is
|
||||
# probably a good choice), you can just leave the value unchanged. If you have
|
||||
# put the rlint somewhere weird, you can set this to the correct path
|
||||
# RLINT_PATH=rlint
|
||||
|
||||
# Add any arguments you want passed to the macro generator to this variable:
|
||||
MACGENFLAGS+=
|
||||
|
||||
# Add any other macro libraries to include in this variable:
|
||||
MACGENMACROS+=
|
||||
|
||||
# Add any arguments you want passed to the assembler to this variable:
|
||||
ASMFLAGS+=
|
||||
|
||||
# Add any arguments you want passed to the linker to this variable:
|
||||
LDFLAGS+=
|
||||
|
||||
# Uncomment the following line if you want to build against the GNO libraries
|
||||
# export ORCA=$(ORCA_BINDIR)/gno
|
||||
|
||||
# If you want to copy one or more files or directories to the target disk
|
||||
# image, add the root directory to this variable. Any directories under
|
||||
# the source directory which don't exist in the target disk image will be
|
||||
# created. All files will be copied from the source to the target using
|
||||
# the same path from the source.
|
||||
#
|
||||
# For example, if you set COPYDIRS to dir and in your project you have
|
||||
# the following files:
|
||||
# dir/System/mySystemFile
|
||||
# dir/newDir/anotherFile
|
||||
# Then, during the copy phase, mySystemFile will be copied into the System
|
||||
# folder and a folder newDir will be created and anotherFile will be copied
|
||||
# into there.
|
||||
COPYDIRS=
|
||||
|
||||
# By default, the build expects that you have GSplus in the path:
|
||||
# /Applications/GSplus.app/Contents/MacOS/gsplus
|
||||
# If you have it in a different location, specify that here.
|
||||
# GSPLUS=/Applications/GSplus.app/Contents/MacOS/gsplus
|
||||
|
||||
# By default, the build expects that you have GSport in the path:
|
||||
# /Applications/GSport/GSport.app/Contents/MacOS/GSport
|
||||
# If you have it in a different location, specify that here.
|
||||
# GSPORT=/Applications/GSport/GSport.app/Contents/MacOS/GSport
|
||||
|
||||
# For a desktop application, it can operate in 640x200 or 320x200
|
||||
# resolution. This setting is used to define which horizontal
|
||||
# resolution you want to use for a desktop application. Other
|
||||
# target types ignore this value.
|
||||
DESKTOP_RES_MODE=320
|
||||
|
||||
# For a desktop application, it can support opening and printing
|
||||
# files based on paths sent to it by the message center. This
|
||||
# option controls if that is or is not supported in the
|
||||
# application (note: only the C desktop template supports message
|
||||
# center today)
|
||||
MESSAGE_CENTER=false
|
||||
|
||||
# Add any rules you want to execute before any compiles or assembly
|
||||
# commands are called here, if any. You can generate .c, .s or .h
|
||||
# files for example. You can generate data files. Whatever you
|
||||
# might need. You should generate these files in the $(GENDIR)
|
||||
# directory or within a subdirectory under $(GENDIR) which you create
|
||||
# yourself.
|
||||
#
|
||||
# All of your commands associated with a rule _must_ start with a tab
|
||||
# character. Xcode makes it a bit tough to type a tab character by
|
||||
# default. Press option-tab within Xcode to insert a tab character.
|
||||
gen:
|
||||
|
||||
# For any files you generated in the gen target above, you should
|
||||
# add rules in genclean to remove those generated files when you
|
||||
# clean your build.
|
||||
genclean:
|
||||
|
||||
# Do not change anything else below here...
|
||||
include make/tail.mk
|
|
@ -0,0 +1,961 @@
|
|||
/*
|
||||
* main.c
|
||||
* BuGS
|
||||
*
|
||||
* Created by Jeremy Rand on 2020-06-10.
|
||||
* Copyright (c) 2020 Jeremy Rand. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <Memory.h>
|
||||
#include <Locator.h>
|
||||
#include <Event.h>
|
||||
#include <Menu.h>
|
||||
#include <QuickDraw.h>
|
||||
#include <Window.h>
|
||||
#include <Control.h>
|
||||
#include <TextEdit.h>
|
||||
#include <Desk.h>
|
||||
#include <Resources.h>
|
||||
#include <MiscTool.h>
|
||||
#include <STDFile.h>
|
||||
#include <GSOS.h>
|
||||
#include <Print.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
||||
/* Defines and macros */
|
||||
|
||||
#define TOOLFAIL(string) \
|
||||
if (toolerror()) SysFailMgr(toolerror(), "\p" string "\n\r Error Code -> $");
|
||||
|
||||
#define MAX_DOCUMENT_NAME 80
|
||||
|
||||
#define PRINT_RECORD_SIZE 140
|
||||
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef struct tDocument
|
||||
{
|
||||
struct tDocument * nextDocument;
|
||||
struct tDocument * prevDocument;
|
||||
GrafPortPtr wPtr;
|
||||
char documentName[MAX_DOCUMENT_NAME + 1];
|
||||
BOOLEAN isOnDisk;
|
||||
ResultBuf255Hndl pathName;
|
||||
PrRecHndl printRecordHandle;
|
||||
} tDocument;
|
||||
|
||||
|
||||
/* Globals */
|
||||
|
||||
BOOLEAN shouldQuit;
|
||||
EventRecord myEvent;
|
||||
unsigned int userid;
|
||||
tDocument * documentList;
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
void doFileSave(void);
|
||||
|
||||
|
||||
/* Implementation */
|
||||
|
||||
const char * resourceString(int resourceId, const char * defaultValue)
|
||||
{
|
||||
Handle handle;
|
||||
const char *result = defaultValue;
|
||||
|
||||
handle = LoadResource(rCString, resourceId);
|
||||
if (toolerror() == 0) {
|
||||
HLock(handle);
|
||||
result = (const char *) (*handle);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void freeResourceString(int resourceId)
|
||||
{
|
||||
ReleaseResource(-3, rCString, resourceId);
|
||||
}
|
||||
|
||||
|
||||
void showErrorAlert(int resourceId, int toolErrorCode)
|
||||
{
|
||||
char buffer[40] = "";
|
||||
const char *substArray[2];
|
||||
const char *toolErrorFormat;
|
||||
|
||||
if (toolErrorCode != 0) {
|
||||
toolErrorFormat = resourceString(TOOL_ERROR_STRING, "\n\nTool error code = $%04x");
|
||||
sprintf(buffer, toolErrorFormat, toolErrorCode);
|
||||
freeResourceString(TOOL_ERROR_STRING);
|
||||
}
|
||||
|
||||
substArray[0] = resourceString(resourceId, "Unknown error has occurred");
|
||||
substArray[1] = buffer;
|
||||
|
||||
AlertWindow(awCString + awResource, (Pointer) substArray, ERROR_ALERT_STRING);
|
||||
freeResourceString(resourceId);
|
||||
}
|
||||
|
||||
|
||||
tDocument * findDocumentFromWindow(GrafPortPtr wPtr)
|
||||
{
|
||||
tDocument * result = documentList;
|
||||
|
||||
while (result != NULL) {
|
||||
if (result->wPtr == wPtr)
|
||||
break;
|
||||
|
||||
result = result->nextDocument;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#pragma databank 1
|
||||
void drawContents(void)
|
||||
{
|
||||
DrawControls(GetPort());
|
||||
}
|
||||
#pragma databank 0
|
||||
|
||||
|
||||
const char * getUntitledName(void)
|
||||
{
|
||||
static int untitledNum = 1;
|
||||
static char buffer[MAX_DOCUMENT_NAME + 1];
|
||||
const char *untitledFormat = resourceString(UNTITLED_STRING, " Untitled %d ");
|
||||
|
||||
sprintf(buffer + 1, untitledFormat, untitledNum);
|
||||
buffer[0] = strlen(buffer + 1);
|
||||
|
||||
freeResourceString(UNTITLED_STRING);
|
||||
untitledNum++;
|
||||
|
||||
// Returns a Pascal string with a length byte prefix
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
const char * documentNameFromGSOSString(ResultBuf255Ptr gsosString)
|
||||
{
|
||||
static char buffer[MAX_DOCUMENT_NAME + 1];
|
||||
int nameLen = gsosString->bufString.length;
|
||||
|
||||
strcpy(buffer + 1, " ");
|
||||
nameLen = gsosString->bufString.length;
|
||||
if (nameLen > MAX_DOCUMENT_NAME - 5)
|
||||
nameLen = MAX_DOCUMENT_NAME - 5;
|
||||
strncat(buffer + 1, gsosString->bufString.text, nameLen);
|
||||
strcat(buffer + 1, " ");
|
||||
buffer[0] = strlen(buffer + 1);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
const char * documentNameFromPath(wStringPtr pathString)
|
||||
{
|
||||
static char buffer[MAX_DOCUMENT_NAME + 1];
|
||||
int nameLen = pathString->length;
|
||||
char * path = pathString->text;
|
||||
int lastSeparator = 0;
|
||||
int offset;
|
||||
|
||||
for (offset = 0; offset < nameLen; offset++) {
|
||||
if ((path[offset] == ':') ||
|
||||
(path[offset] == '/'))
|
||||
lastSeparator = offset + 1;
|
||||
}
|
||||
|
||||
path = &(path[lastSeparator]);
|
||||
nameLen -= lastSeparator;
|
||||
|
||||
strcpy(buffer + 1, " ");
|
||||
if (nameLen > MAX_DOCUMENT_NAME - 5)
|
||||
nameLen = MAX_DOCUMENT_NAME - 5;
|
||||
strncat(buffer + 1, path, nameLen);
|
||||
strcat(buffer + 1, " ");
|
||||
buffer[0] = strlen(buffer + 1);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
tDocument * newDocument(const char * windowName)
|
||||
{
|
||||
// windowName is a Pascal string with a length byte prefix
|
||||
tDocument * documentPtr;
|
||||
|
||||
documentPtr = malloc(sizeof(tDocument));
|
||||
if (documentPtr == NULL) {
|
||||
showErrorAlert(MALLOC_ERROR_STRING, 0);
|
||||
return(NULL);
|
||||
}
|
||||
documentPtr->printRecordHandle = (PrRecHndl) NewHandle(PRINT_RECORD_SIZE, userid, 0, NULL);
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(MALLOC_ERROR_STRING, toolerror());
|
||||
free(documentPtr);
|
||||
return NULL;
|
||||
}
|
||||
PrDefault(documentPtr->printRecordHandle);
|
||||
|
||||
documentPtr->isOnDisk = FALSE;
|
||||
documentPtr->pathName = NULL;
|
||||
|
||||
documentPtr->documentName[0] = windowName[0];
|
||||
strncpy(documentPtr->documentName + 1, windowName + 1, windowName[0]);
|
||||
|
||||
documentPtr->wPtr = NewWindow2(documentPtr->documentName, 0, drawContents, NULL, refIsResource,
|
||||
WINDOW_RESID, rWindParam1);
|
||||
if (documentPtr->wPtr == NULL) {
|
||||
showErrorAlert(NEW_WINDOW_ERROR_STRING, toolerror());
|
||||
DisposeHandle((Handle)documentPtr->printRecordHandle);
|
||||
free(documentPtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
documentPtr->nextDocument = documentList;
|
||||
documentPtr->prevDocument = NULL;
|
||||
if (documentList != NULL)
|
||||
documentList->prevDocument = documentPtr;
|
||||
|
||||
documentList = documentPtr;
|
||||
|
||||
return documentPtr;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN isDocumentDirty(tDocument * documentPtr)
|
||||
{
|
||||
BOOLEAN isDirty = FALSE;
|
||||
CtlRecHndl controlHdl;
|
||||
CtlRec * controlPtr;
|
||||
|
||||
controlHdl = GetCtlHandleFromID(documentPtr->wPtr, CONTROL_TEXT_EDIT);
|
||||
if (toolerror() == 0) {
|
||||
HLock((Handle) controlHdl);
|
||||
controlPtr = *controlHdl;
|
||||
isDirty = ((controlPtr->ctlFlag & fRecordDirty) != 0);
|
||||
HUnlock((Handle) controlHdl);
|
||||
}
|
||||
return isDirty;
|
||||
}
|
||||
|
||||
|
||||
void clearDocumentDirty(tDocument * documentPtr)
|
||||
{
|
||||
CtlRecHndl controlHdl;
|
||||
CtlRec * controlPtr;
|
||||
|
||||
controlHdl = GetCtlHandleFromID(documentPtr->wPtr, CONTROL_TEXT_EDIT);
|
||||
if (toolerror() == 0) {
|
||||
HLock((Handle) controlHdl);
|
||||
controlPtr = *controlHdl;
|
||||
controlPtr->ctlFlag &= (~fRecordDirty);
|
||||
HUnlock((Handle) controlHdl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void saveDocument(tDocument * documentPtr)
|
||||
{
|
||||
RefNumRecGS closeRecord;
|
||||
CreateRecGS createRecord;
|
||||
NameRecGS destroyRecord;
|
||||
OpenRecGS openRecord;
|
||||
IORecGS writeRecord;
|
||||
|
||||
GrafPortPtr tmpPort;
|
||||
LongWord dataLength;
|
||||
Handle dataHandle;
|
||||
|
||||
tmpPort = GetPort();
|
||||
SetPort(documentPtr->wPtr);
|
||||
dataLength = TEGetText(teTextIsNewHandle | teDataIsCString, (Ref) &dataHandle, 0,
|
||||
0, (Ref) NULL, NULL);
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(SAVE_FILE_ERROR_STRING, toolerror());
|
||||
SetPort(tmpPort);
|
||||
return;
|
||||
}
|
||||
|
||||
HLock((Handle) documentPtr->pathName);
|
||||
|
||||
destroyRecord.pCount = 1;
|
||||
destroyRecord.pathname = &((*(documentPtr->pathName))->bufString);
|
||||
DestroyGS(&destroyRecord);
|
||||
|
||||
createRecord.pCount = 5;
|
||||
createRecord.pathname = &((*(documentPtr->pathName))->bufString);
|
||||
createRecord.access = destroyEnable | renameEnable | readWriteEnable;
|
||||
createRecord.fileType = 0x04;
|
||||
createRecord.auxType = 0x0000;
|
||||
createRecord.storageType = 1;
|
||||
CreateGS(&createRecord);
|
||||
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(SAVE_FILE_ERROR_STRING, toolerror());
|
||||
} else {
|
||||
openRecord.pCount = 3;
|
||||
openRecord.pathname = &((*(documentPtr->pathName))->bufString);
|
||||
openRecord.requestAccess = writeEnable;
|
||||
OpenGS(&openRecord);
|
||||
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(SAVE_FILE_ERROR_STRING, toolerror());
|
||||
} else {
|
||||
HLock(dataHandle);
|
||||
|
||||
writeRecord.pCount = 4;
|
||||
writeRecord.refNum = openRecord.refNum;
|
||||
writeRecord.dataBuffer = *dataHandle;
|
||||
writeRecord.requestCount = dataLength;
|
||||
WriteGS(&writeRecord);
|
||||
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(SAVE_FILE_ERROR_STRING, toolerror());
|
||||
} else {
|
||||
documentPtr->isOnDisk = TRUE;
|
||||
clearDocumentDirty(documentPtr);
|
||||
}
|
||||
|
||||
HUnlock(dataHandle);
|
||||
|
||||
closeRecord.pCount = 1; /* close the file */
|
||||
closeRecord.refNum = openRecord.refNum;
|
||||
CloseGS(&closeRecord);
|
||||
}
|
||||
}
|
||||
|
||||
DisposeHandle(dataHandle);
|
||||
HUnlock((Handle) documentPtr->pathName);
|
||||
SetPort(tmpPort);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN loadDocument(tDocument * documentPtr)
|
||||
{
|
||||
BOOLEAN result = TRUE;
|
||||
|
||||
RefNumRecGS closeRecord;
|
||||
OpenRecGS openRecord;
|
||||
IORecGS readRecord;
|
||||
GrafPortPtr tmpPort;
|
||||
Handle dataHandle;
|
||||
|
||||
openRecord.pCount = 12;
|
||||
HLock((Handle) documentPtr->pathName);
|
||||
openRecord.pathname = &((*(documentPtr->pathName))->bufString);
|
||||
openRecord.requestAccess = readEnable;
|
||||
openRecord.resourceNumber = 0;
|
||||
openRecord.optionList = NULL;
|
||||
OpenGS(&openRecord);
|
||||
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(OPEN_FILE_ERROR_STRING, toolerror());
|
||||
result = FALSE;
|
||||
} else {
|
||||
dataHandle = NewHandle(openRecord.eof, userid, attrLocked, NULL);
|
||||
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(MALLOC_ERROR_STRING, toolerror());
|
||||
result = FALSE;
|
||||
} else {
|
||||
readRecord.pCount = 4;
|
||||
readRecord.refNum = openRecord.refNum;
|
||||
readRecord.dataBuffer = *dataHandle;
|
||||
readRecord.requestCount = openRecord.eof;
|
||||
ReadGS(&readRecord);
|
||||
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(OPEN_FILE_ERROR_STRING, toolerror());
|
||||
result = FALSE;
|
||||
} else {
|
||||
tmpPort = GetPort();
|
||||
SetPort(documentPtr->wPtr);
|
||||
TESetText(teTextIsPtr | teDataIsTextBlock, (Ref)*dataHandle, openRecord.eof,
|
||||
teCtlStyleIsPtr, NULL, NULL);
|
||||
SetPort(tmpPort);
|
||||
}
|
||||
DisposeHandle(dataHandle);
|
||||
}
|
||||
|
||||
closeRecord.pCount = 1;
|
||||
closeRecord.refNum = openRecord.refNum;
|
||||
CloseGS(&closeRecord);
|
||||
}
|
||||
|
||||
HUnlock((Handle) documentPtr->pathName);
|
||||
clearDocumentDirty(documentPtr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void closeDocument(GrafPortPtr wPtr)
|
||||
{
|
||||
tDocument * documentPtr;
|
||||
char documentName[MAX_DOCUMENT_NAME];
|
||||
char * alertStrings[] = { documentName };
|
||||
int documentNameLen;
|
||||
char * tmpPtr;
|
||||
int buttonClicked;
|
||||
|
||||
if (wPtr == NULL)
|
||||
return;
|
||||
|
||||
documentPtr = findDocumentFromWindow(wPtr);
|
||||
if (documentPtr != NULL) {
|
||||
while (isDocumentDirty(documentPtr)) {
|
||||
/* The documentName in the documentPtr is actually a PString so the
|
||||
first byte is the length of the string. */
|
||||
tmpPtr = documentPtr->documentName;
|
||||
documentNameLen = *tmpPtr;
|
||||
tmpPtr++;
|
||||
|
||||
/* The documentName has spaces before and after the real name to format
|
||||
the string for the window title bar. Strip those spaces out and store
|
||||
the name into the documentName local array. */
|
||||
while ((documentNameLen > 0) &&
|
||||
(tmpPtr[documentNameLen - 1] == ' ')) {
|
||||
documentNameLen--;
|
||||
}
|
||||
while (*tmpPtr == ' ') {
|
||||
tmpPtr++;
|
||||
documentNameLen--;
|
||||
}
|
||||
strncpy(documentName, tmpPtr, documentNameLen);
|
||||
documentName[documentNameLen] = '\0';
|
||||
|
||||
buttonClicked = AlertWindow(awCString+awResource, (Pointer) alertStrings, SAVE_BEFORE_CLOSING);
|
||||
switch (buttonClicked) {
|
||||
case 0:
|
||||
doFileSave();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
clearDocumentDirty(documentPtr);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CloseWindow(wPtr);
|
||||
|
||||
if (documentPtr == NULL)
|
||||
return;
|
||||
|
||||
if (documentPtr->pathName != NULL) {
|
||||
DisposeHandle((Handle) documentPtr->pathName);
|
||||
documentPtr->pathName = NULL;
|
||||
}
|
||||
if (documentPtr->printRecordHandle != NULL) {
|
||||
DisposeHandle((Handle)documentPtr->printRecordHandle);
|
||||
documentPtr->printRecordHandle = NULL;
|
||||
}
|
||||
if (documentList == documentPtr) {
|
||||
documentList = documentPtr->nextDocument;
|
||||
} else if (documentPtr->prevDocument != NULL) {
|
||||
documentPtr->prevDocument->nextDocument = documentPtr->nextDocument;
|
||||
}
|
||||
|
||||
if (documentPtr->nextDocument != NULL)
|
||||
documentPtr->nextDocument->prevDocument = documentPtr->prevDocument;
|
||||
|
||||
free(documentPtr);
|
||||
}
|
||||
|
||||
|
||||
void printDocument(tDocument * documentPtr)
|
||||
{
|
||||
GrafPortPtr printerPort;
|
||||
LongWord lineNumber;
|
||||
PrStatusRec printerStatus;
|
||||
Rect pageRect;
|
||||
|
||||
printerPort = PrOpenDoc(documentPtr->printRecordHandle, NULL);
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(PRINT_ERROR_STRING, toolerror());
|
||||
return;
|
||||
}
|
||||
|
||||
HLock((Handle) documentPtr->printRecordHandle);
|
||||
pageRect = (*(documentPtr->printRecordHandle))->prInfo.rPage;
|
||||
HUnlock((Handle) documentPtr->printRecordHandle);
|
||||
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(PRINT_ERROR_STRING, toolerror());
|
||||
} else {
|
||||
lineNumber = 0;
|
||||
while (lineNumber != -1) {
|
||||
PrOpenPage(printerPort, NULL);
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(PRINT_ERROR_STRING, toolerror());
|
||||
break;
|
||||
}
|
||||
else {
|
||||
lineNumber = TEPaintText(printerPort, lineNumber, &pageRect, 0,
|
||||
(Handle) GetCtlHandleFromID(documentPtr->wPtr, CONTROL_TEXT_EDIT));
|
||||
PrClosePage(printerPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
PrCloseDoc(printerPort);
|
||||
|
||||
if (PrError() == 0)
|
||||
PrPicFile(documentPtr->printRecordHandle, NULL, &printerStatus);
|
||||
}
|
||||
|
||||
|
||||
void doAppleAbout(void)
|
||||
{
|
||||
AlertWindow(awCString + awResource, NULL, ABOUT_ALERT_STRING);
|
||||
}
|
||||
|
||||
|
||||
void doFileNew(void)
|
||||
{
|
||||
newDocument(getUntitledName());
|
||||
}
|
||||
|
||||
|
||||
void doFileOpen(void)
|
||||
{
|
||||
tDocument * documentPtr;
|
||||
SFTypeList2 fileTypes;
|
||||
SFReplyRec2 reply;
|
||||
ResultBuf255Hndl nameHandle;
|
||||
|
||||
/* By default, we want to open text files only which is what
|
||||
the following fileTypes request. Customize as necessary. */
|
||||
fileTypes.numEntries = 1;
|
||||
fileTypes.fileTypeEntries[0].flags = 0x0000;
|
||||
fileTypes.fileTypeEntries[0].fileType = 0x04;
|
||||
fileTypes.fileTypeEntries[0].auxType = 0x0000;
|
||||
|
||||
reply.nameRefDesc = refIsNewHandle;
|
||||
reply.pathRefDesc = refIsNewHandle;
|
||||
SFGetFile2(30, 30, refIsResource, OPEN_FILE_STRING, NULL, &fileTypes, &reply);
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(OPEN_FILE_ERROR_STRING, toolerror());
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply.good) {
|
||||
nameHandle = (ResultBuf255Hndl) reply.nameRef;
|
||||
HLock((Handle) nameHandle);
|
||||
documentPtr = newDocument(documentNameFromGSOSString(*nameHandle));
|
||||
DisposeHandle((Handle) nameHandle);
|
||||
|
||||
if (documentPtr == NULL) {
|
||||
DisposeHandle((Handle) reply.pathRef);
|
||||
} else {
|
||||
documentPtr->pathName = (ResultBuf255Hndl) reply.pathRef;
|
||||
documentPtr->isOnDisk = loadDocument(documentPtr);
|
||||
|
||||
if (!documentPtr->isOnDisk)
|
||||
closeDocument(documentPtr->wPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void doFileSaveAs(void)
|
||||
{
|
||||
ResultBuf255Hndl nameHandle;
|
||||
SFReplyRec2 reply;
|
||||
const char * documentName;
|
||||
tDocument * documentPtr = findDocumentFromWindow(FrontWindow());
|
||||
|
||||
if (documentPtr == NULL)
|
||||
return;
|
||||
|
||||
reply.nameRefDesc = refIsNewHandle;
|
||||
reply.pathRefDesc = refIsNewHandle;
|
||||
|
||||
if (documentPtr->pathName == NULL)
|
||||
SFPutFile2(30, 30, refIsResource, SAVE_FILE_STRING, refIsPointer,
|
||||
(Ref) &(documentPtr->pathName), &reply);
|
||||
else
|
||||
SFPutFile2(30, 30, refIsResource, SAVE_FILE_STRING, refIsPointer,
|
||||
(Ref) &((*(documentPtr->pathName))->bufString), &reply);
|
||||
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(SAVE_FILE_ERROR_STRING, toolerror());
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply.good) {
|
||||
nameHandle = (ResultBuf255Hndl) reply.nameRef;
|
||||
HLock((Handle) nameHandle);
|
||||
documentName = documentNameFromGSOSString(*nameHandle);
|
||||
documentPtr->documentName[0] = documentName[0];
|
||||
strncpy(documentPtr->documentName + 1, documentName + 1, documentName[0]);
|
||||
DisposeHandle((Handle) nameHandle);
|
||||
|
||||
SetWTitle(documentPtr->documentName, documentPtr->wPtr);
|
||||
|
||||
documentPtr->pathName = (ResultBuf255Hndl) reply.pathRef;
|
||||
documentPtr->isOnDisk = TRUE;
|
||||
saveDocument(documentPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void doFileSave(void)
|
||||
{
|
||||
tDocument * documentPtr = findDocumentFromWindow(FrontWindow());
|
||||
|
||||
if (documentPtr == NULL)
|
||||
return;
|
||||
|
||||
if (documentPtr->isOnDisk)
|
||||
saveDocument(documentPtr);
|
||||
else
|
||||
doFileSaveAs();
|
||||
}
|
||||
|
||||
|
||||
void doFileClose(void)
|
||||
{
|
||||
closeDocument(FrontWindow());
|
||||
}
|
||||
|
||||
|
||||
void doFilePageSetup(void)
|
||||
{
|
||||
tDocument * documentPtr = findDocumentFromWindow(FrontWindow());
|
||||
|
||||
if (documentPtr == NULL)
|
||||
return;
|
||||
|
||||
PrStlDialog(documentPtr->printRecordHandle);
|
||||
}
|
||||
|
||||
|
||||
void doFilePrint(void)
|
||||
{
|
||||
tDocument * documentPtr = findDocumentFromWindow(FrontWindow());
|
||||
|
||||
if (documentPtr == NULL)
|
||||
return;
|
||||
|
||||
if (PrJobDialog(documentPtr->printRecordHandle))
|
||||
printDocument(documentPtr);
|
||||
}
|
||||
|
||||
|
||||
void doFileQuit(void)
|
||||
{
|
||||
shouldQuit = TRUE;
|
||||
}
|
||||
|
||||
|
||||
void doEditUndo(void)
|
||||
{
|
||||
/* Nothing extra to do here. The text edit control handles this for us. */
|
||||
}
|
||||
|
||||
|
||||
void doEditCut(void)
|
||||
{
|
||||
/* Nothing extra to do here. The text edit control handles this for us. */
|
||||
}
|
||||
|
||||
|
||||
void doEditCopy(void)
|
||||
{
|
||||
/* Nothing extra to do here. The text edit control handles this for us. */
|
||||
}
|
||||
|
||||
|
||||
void doEditPaste(void)
|
||||
{
|
||||
/* Nothing extra to do here. The text edit control handles this for us. */
|
||||
}
|
||||
|
||||
|
||||
void doEditClear(void)
|
||||
{
|
||||
/* Nothing extra to do here. The text edit control handles this for us. */
|
||||
}
|
||||
|
||||
|
||||
void handleMenu(void)
|
||||
{
|
||||
int menuNum;
|
||||
int menuItemNum;
|
||||
|
||||
menuNum = myEvent.wmTaskData >> 16;
|
||||
menuItemNum = myEvent.wmTaskData;
|
||||
|
||||
switch (menuItemNum) {
|
||||
case APPLE_ABOUT:
|
||||
doAppleAbout();
|
||||
break;
|
||||
|
||||
case FILE_NEW:
|
||||
doFileNew();
|
||||
break;
|
||||
|
||||
case FILE_OPEN:
|
||||
doFileOpen();
|
||||
break;
|
||||
|
||||
case FILE_SAVE:
|
||||
doFileSave();
|
||||
break;
|
||||
|
||||
case FILE_SAVE_AS:
|
||||
doFileSaveAs();
|
||||
break;
|
||||
|
||||
case FILE_CLOSE:
|
||||
doFileClose();
|
||||
break;
|
||||
|
||||
case FILE_PAGE_SETUP:
|
||||
doFilePageSetup();
|
||||
break;
|
||||
|
||||
case FILE_PRINT:
|
||||
doFilePrint();
|
||||
break;
|
||||
|
||||
case FILE_QUIT:
|
||||
doFileQuit();
|
||||
break;
|
||||
|
||||
case EDIT_UNDO:
|
||||
doEditUndo();
|
||||
break;
|
||||
|
||||
case EDIT_CUT:
|
||||
doEditCut();
|
||||
break;
|
||||
|
||||
case EDIT_COPY:
|
||||
doEditCopy();
|
||||
break;
|
||||
|
||||
case EDIT_PASTE:
|
||||
doEditPaste();
|
||||
break;
|
||||
|
||||
case EDIT_CLEAR:
|
||||
doEditClear();
|
||||
break;
|
||||
}
|
||||
HiliteMenu(FALSE, menuNum);
|
||||
}
|
||||
|
||||
|
||||
void dimMenus(void)
|
||||
{
|
||||
static BOOLEAN windowWasOpen = TRUE;
|
||||
static BOOLEAN applicationWindowWasInFront = TRUE;
|
||||
BOOLEAN windowIsOpen;
|
||||
BOOLEAN applicationWindowIsInFront;
|
||||
|
||||
GrafPortPtr wPtr = FrontWindow();
|
||||
windowIsOpen = (wPtr != NULL);
|
||||
applicationWindowIsInFront = (findDocumentFromWindow(wPtr) != NULL);
|
||||
|
||||
if ((windowIsOpen == windowWasOpen) &&
|
||||
(applicationWindowIsInFront == applicationWindowWasInFront)) {
|
||||
return;
|
||||
}
|
||||
|
||||
windowWasOpen = windowIsOpen;
|
||||
applicationWindowWasInFront = applicationWindowIsInFront;
|
||||
|
||||
if (windowIsOpen) {
|
||||
EnableMItem(FILE_CLOSE);
|
||||
SetMenuFlag(enableMenu, EDIT_MENU);
|
||||
} else {
|
||||
DisableMItem(FILE_CLOSE);
|
||||
SetMenuFlag(disableMenu, EDIT_MENU);
|
||||
}
|
||||
|
||||
if (applicationWindowIsInFront) {
|
||||
EnableMItem(FILE_SAVE);
|
||||
EnableMItem(FILE_SAVE_AS);
|
||||
EnableMItem(FILE_PAGE_SETUP);
|
||||
EnableMItem(FILE_PRINT);
|
||||
} else {
|
||||
DisableMItem(FILE_SAVE);
|
||||
DisableMItem(FILE_SAVE_AS);
|
||||
DisableMItem(FILE_PAGE_SETUP);
|
||||
DisableMItem(FILE_PRINT);
|
||||
}
|
||||
|
||||
DrawMenuBar();
|
||||
}
|
||||
|
||||
|
||||
void handleMessages(void)
|
||||
{
|
||||
#if MESSAGE_CENTER == 1
|
||||
Handle msgHandle;
|
||||
MessageRecGSPtr msgPtr;
|
||||
wStringPtr pathPtr;
|
||||
tDocument * documentPtr;
|
||||
ResultBuf255Ptr resultBufPtr;
|
||||
|
||||
msgHandle = NewHandle(1, userid, 0, NULL);
|
||||
if (toolerror() != 0) {
|
||||
showErrorAlert(MALLOC_ERROR_STRING, toolerror());
|
||||
return;
|
||||
}
|
||||
|
||||
MessageCenter(getMessage, fileInfoTypeGS, msgHandle);
|
||||
if (toolerror() != 0) {
|
||||
DisposeHandle(msgHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
MessageCenter(deleteMessage, fileInfoTypeGS, msgHandle);
|
||||
HLock(msgHandle);
|
||||
msgPtr = (MessageRecGSPtr)(*msgHandle);
|
||||
|
||||
for (pathPtr = msgPtr->fileNames;
|
||||
pathPtr->length != 0;
|
||||
pathPtr = (wStringPtr)(pathPtr->text + pathPtr->length))
|
||||
{
|
||||
documentPtr = newDocument(documentNameFromPath(pathPtr));
|
||||
if (documentPtr == NULL)
|
||||
continue;
|
||||
|
||||
documentPtr->pathName = (ResultBuf255Hndl)NewHandle(pathPtr->length + 4, userid, 0, NULL);
|
||||
if (toolerror() != 0)
|
||||
{
|
||||
showErrorAlert(MALLOC_ERROR_STRING, toolerror());
|
||||
closeDocument(documentPtr->wPtr);
|
||||
continue;
|
||||
}
|
||||
HLock((Handle) documentPtr->pathName);
|
||||
resultBufPtr = *(documentPtr->pathName);
|
||||
resultBufPtr->bufSize = pathPtr->length + 4;
|
||||
resultBufPtr->bufString.length = pathPtr->length;
|
||||
memcpy(resultBufPtr->bufString.text, pathPtr->text, pathPtr->length);
|
||||
HUnlock((Handle) documentPtr->pathName);
|
||||
|
||||
documentPtr->isOnDisk = loadDocument(documentPtr);
|
||||
|
||||
if (!documentPtr->isOnDisk)
|
||||
{
|
||||
closeDocument(documentPtr->wPtr);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msgPtr->printFlag)
|
||||
{
|
||||
doFilePrint();
|
||||
closeDocument(documentPtr->wPtr);
|
||||
}
|
||||
}
|
||||
|
||||
if (msgPtr->printFlag)
|
||||
doFileQuit();
|
||||
|
||||
DisposeHandle(msgHandle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void initMenus(void)
|
||||
{
|
||||
int height;
|
||||
MenuBarRecHndl menuBarHand;
|
||||
|
||||
menuBarHand = NewMenuBar2(refIsResource, MENU_BAR, NULL);
|
||||
TOOLFAIL("Unable to create menu bar");
|
||||
|
||||
SetSysBar(menuBarHand);
|
||||
TOOLFAIL("Unable to set system menu bar");
|
||||
|
||||
SetMenuBar(NULL);
|
||||
TOOLFAIL("Unable to set menu bar");
|
||||
|
||||
FixAppleMenu(APPLE_MENU);
|
||||
TOOLFAIL("Unable to fix Apple menu");
|
||||
|
||||
height = FixMenuBar();
|
||||
TOOLFAIL("Unable to fix menu bar");
|
||||
|
||||
DrawMenuBar();
|
||||
TOOLFAIL("Unable to draw menu bar");
|
||||
}
|
||||
|
||||
|
||||
void initGlobals(void)
|
||||
{
|
||||
documentList = NULL;
|
||||
shouldQuit = FALSE;
|
||||
myEvent.wmTaskMask = 0x001F7FFF;
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int event;
|
||||
Ref toolStartupRef;
|
||||
|
||||
userid = MMStartUp();
|
||||
TOOLFAIL("Unable to start memory manager");
|
||||
|
||||
TLStartUp();
|
||||
TOOLFAIL("Unable to start tool locator");
|
||||
|
||||
toolStartupRef = StartUpTools(userid, refIsResource, TOOL_STARTUP);
|
||||
TOOLFAIL("Unable to start tools");
|
||||
|
||||
initGlobals();
|
||||
initMenus();
|
||||
InitCursor();
|
||||
|
||||
handleMessages();
|
||||
|
||||
while (!shouldQuit) {
|
||||
HandleDiskInsert(hdiScan | hdiHandle, 0);
|
||||
dimMenus();
|
||||
event = TaskMaster(everyEvent, &myEvent);
|
||||
TOOLFAIL("Unable to handle next event");
|
||||
|
||||
switch (event) {
|
||||
case wInSpecial:
|
||||
case wInMenuBar:
|
||||
handleMenu();
|
||||
break;
|
||||
case wInGoAway:
|
||||
closeDocument((GrafPortPtr)myEvent.wmTaskData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ShutDownTools(refIsHandle, toolStartupRef);
|
||||
TOOLFAIL("Unable to shutdown tools");
|
||||
|
||||
TLShutDown();
|
||||
TOOLFAIL("Unable to shutdown tool locator");
|
||||
|
||||
MMShutDown(userid);
|
||||
TOOLFAIL("Unable to shutdown memory manager");
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* main.h
|
||||
* BuGS
|
||||
*
|
||||
* Created by Jeremy Rand on 2020-06-10.
|
||||
* Copyright (c) 2020 Jeremy Rand. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GUARD_PROJECTBuGS_FILEmain_
|
||||
#define _GUARD_PROJECTBuGS_FILEmain_
|
||||
|
||||
|
||||
/* Menu bars */
|
||||
#define MENU_BAR 1
|
||||
|
||||
|
||||
/* Menus */
|
||||
#define APPLE_MENU 3
|
||||
#define FILE_MENU 4
|
||||
#define EDIT_MENU 5
|
||||
|
||||
|
||||
/* Menu items */
|
||||
#define EDIT_UNDO 250
|
||||
#define EDIT_CUT 251
|
||||
#define EDIT_COPY 252
|
||||
#define EDIT_PASTE 253
|
||||
#define EDIT_CLEAR 254
|
||||
|
||||
#define FILE_NEW 401
|
||||
#define FILE_OPEN 402
|
||||
#define FILE_SAVE 403
|
||||
#define FILE_SAVE_AS 404
|
||||
#define FILE_CLOSE 255
|
||||
#define FILE_PAGE_SETUP 405
|
||||
#define FILE_PRINT 406
|
||||
#define FILE_QUIT 256
|
||||
|
||||
#define APPLE_ABOUT 301
|
||||
|
||||
|
||||
/* Alert strings */
|
||||
#define ABOUT_ALERT_STRING 1
|
||||
#define ERROR_ALERT_STRING 2
|
||||
#define SAVE_BEFORE_CLOSING 3
|
||||
|
||||
|
||||
/* Error strings */
|
||||
#define TOOL_ERROR_STRING 2001
|
||||
#define NEW_WINDOW_ERROR_STRING 2002
|
||||
#define MALLOC_ERROR_STRING 2003
|
||||
#define OPEN_FILE_ERROR_STRING 2004
|
||||
#define SAVE_FILE_ERROR_STRING 2005
|
||||
#define PRINT_ERROR_STRING 2006
|
||||
|
||||
|
||||
/* Other strings */
|
||||
#define UNTITLED_STRING 3001
|
||||
#define OPEN_FILE_STRING 3002
|
||||
#define SAVE_FILE_STRING 3003
|
||||
#define HELLO_WORLD_STRING 3004
|
||||
|
||||
|
||||
/* Windows */
|
||||
#define WINDOW_RESID 1001
|
||||
|
||||
|
||||
/* Controls */
|
||||
#define CONTROL_TEXT_EDIT 1001
|
||||
|
||||
|
||||
/* Tools */
|
||||
#define TOOL_STARTUP 1
|
||||
|
||||
|
||||
#endif /* defined(_GUARD_PROJECTBuGS_FILEmain_) */
|
|
@ -0,0 +1,399 @@
|
|||
/*
|
||||
* main.rez
|
||||
* BuGS
|
||||
*
|
||||
* Created by Jeremy Rand on 2020-06-10.
|
||||
* Copyright © 2020 Jeremy Rand. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "types.rez"
|
||||
#include "main.h"
|
||||
|
||||
|
||||
/* Version resource */
|
||||
resource rVersion (1) {
|
||||
{
|
||||
0, /* Major version number in BCD */
|
||||
1, /* Minor version number in BCD */
|
||||
0, /* Bug version number in BCD */
|
||||
development,/* Development phase */
|
||||
0 /* Release number */
|
||||
},
|
||||
verUS,
|
||||
"BuGS",
|
||||
"Copyright \$A9 2020 Jeremy Rand"
|
||||
};
|
||||
|
||||
#if MESSAGE_CENTER == 1
|
||||
/* Bunde resource */
|
||||
resource rBundle (1, preload, nospecialmemory) {
|
||||
nil, /* rIcon ID for application if you wish a custom icon */
|
||||
1,
|
||||
{
|
||||
{
|
||||
native + LaunchThis,
|
||||
{0}, /* rFinderPath ID for this document */
|
||||
{nil}, /* rIcon ID for large icon for document */
|
||||
{nil}, /* rIcon ID for small icon for document */
|
||||
"", /* String to describe this type of document */
|
||||
},
|
||||
Filetype + AuxType, /* Match field bits */
|
||||
MatchFileType {{$04}}, /* File type to match */
|
||||
MatchAuxType { /* Auxiliary file type to match */
|
||||
{$00000000,$00000000}
|
||||
},
|
||||
empty {},
|
||||
empty {},
|
||||
empty {},
|
||||
empty {},
|
||||
empty {},
|
||||
empty {},
|
||||
empty {},
|
||||
empty {},
|
||||
empty {},
|
||||
empty {}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/* Menu bars */
|
||||
resource rMenuBar (MENU_BAR) {
|
||||
{
|
||||
APPLE_MENU,
|
||||
FILE_MENU,
|
||||
EDIT_MENU
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/* Menus */
|
||||
resource rMenu (APPLE_MENU) {
|
||||
APPLE_MENU,
|
||||
refIsResource * menuTitleRefShift
|
||||
+ refIsResource * itemRefShift
|
||||
+ fAllowCache,
|
||||
APPLE_MENU,
|
||||
{
|
||||
APPLE_ABOUT
|
||||
};
|
||||
};
|
||||
resource rPString (APPLE_MENU, noCrossBank) {"@"};
|
||||
|
||||
resource rMenu (FILE_MENU) {
|
||||
FILE_MENU,
|
||||
refIsResource * menuTitleRefShift
|
||||
+ refIsResource * itemRefShift
|
||||
+ fAllowCache,
|
||||
FILE_MENU,
|
||||
{
|
||||
FILE_NEW,
|
||||
FILE_OPEN,
|
||||
FILE_SAVE,
|
||||
FILE_SAVE_AS,
|
||||
FILE_CLOSE,
|
||||
FILE_PAGE_SETUP,
|
||||
FILE_PRINT,
|
||||
FILE_QUIT
|
||||
};
|
||||
};
|
||||
resource rPString (FILE_MENU, noCrossBank) {" File "};
|
||||
|
||||
resource rMenu (EDIT_MENU) {
|
||||
EDIT_MENU,
|
||||
refIsResource * menuTitleRefShift
|
||||
+ refIsResource * itemRefShift
|
||||
+ fAllowCache,
|
||||
EDIT_MENU,
|
||||
{
|
||||
EDIT_UNDO,
|
||||
EDIT_CUT,
|
||||
EDIT_COPY,
|
||||
EDIT_PASTE,
|
||||
EDIT_CLEAR
|
||||
};
|
||||
};
|
||||
resource rPString (EDIT_MENU, noCrossBank) {" Edit "};
|
||||
|
||||
|
||||
/* Menu items */
|
||||
resource rMenuItem (EDIT_UNDO) {
|
||||
EDIT_UNDO,
|
||||
"Z", "z",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift
|
||||
+ fDivider,
|
||||
EDIT_UNDO
|
||||
};
|
||||
resource rPString (EDIT_UNDO, noCrossBank) {"Undo"};
|
||||
|
||||
resource rMenuItem (EDIT_CUT) {
|
||||
EDIT_CUT,
|
||||
"X", "x",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift,
|
||||
EDIT_CUT
|
||||
};
|
||||
resource rPString (EDIT_CUT, noCrossBank) {"Cut"};
|
||||
|
||||
resource rMenuItem (EDIT_COPY) {
|
||||
EDIT_COPY,
|
||||
"C", "c",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift,
|
||||
EDIT_COPY
|
||||
};
|
||||
resource rPString (EDIT_COPY, noCrossBank) {"Copy"};
|
||||
|
||||
resource rMenuItem (EDIT_PASTE) {
|
||||
EDIT_PASTE,
|
||||
"V", "v",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift,
|
||||
EDIT_PASTE
|
||||
};
|
||||
resource rPString (EDIT_PASTE, noCrossBank) {"Paste"};
|
||||
|
||||
resource rMenuItem (EDIT_CLEAR) {
|
||||
EDIT_CLEAR,
|
||||
"", "",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift,
|
||||
EDIT_CLEAR
|
||||
};
|
||||
resource rPString (EDIT_CLEAR, noCrossBank) {"Clear"};
|
||||
|
||||
resource rMenuItem (FILE_NEW) {
|
||||
FILE_NEW,
|
||||
"N", "n",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift,
|
||||
FILE_NEW
|
||||
};
|
||||
resource rPString (FILE_NEW, noCrossBank) {"New"};
|
||||
|
||||
resource rMenuItem (FILE_OPEN) {
|
||||
FILE_OPEN,
|
||||
"O", "o",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift
|
||||
+ fDivider,
|
||||
FILE_OPEN
|
||||
};
|
||||
resource rPString (FILE_OPEN, noCrossBank) {"Open"};
|
||||
|
||||
resource rMenuItem (FILE_SAVE) {
|
||||
FILE_SAVE,
|
||||
"S", "s",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift,
|
||||
FILE_SAVE
|
||||
};
|
||||
resource rPString (FILE_SAVE, noCrossBank) {"Save"};
|
||||
|
||||
resource rMenuItem (FILE_SAVE_AS) {
|
||||
FILE_SAVE_AS,
|
||||
"", "",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift,
|
||||
FILE_SAVE_AS
|
||||
};
|
||||
resource rPString (FILE_SAVE_AS, noCrossBank) {"Save As..."};
|
||||
|
||||
resource rMenuItem (FILE_CLOSE) {
|
||||
FILE_CLOSE,
|
||||
"W", "w",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift
|
||||
+ fDivider,
|
||||
FILE_CLOSE
|
||||
};
|
||||
resource rPString (FILE_CLOSE, noCrossBank) {"Close"};
|
||||
|
||||
resource rMenuItem (FILE_PAGE_SETUP) {
|
||||
FILE_PAGE_SETUP,
|
||||
"", "",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift,
|
||||
FILE_PAGE_SETUP
|
||||
};
|
||||
resource rPString (FILE_PAGE_SETUP, noCrossBank) {"Page Setup..."};
|
||||
|
||||
resource rMenuItem (FILE_PRINT) {
|
||||
FILE_PRINT,
|
||||
"P", "p",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift
|
||||
+ fDivider,
|
||||
FILE_PRINT
|
||||
};
|
||||
resource rPString (FILE_PRINT, noCrossBank) {"Print..."};
|
||||
|
||||
resource rMenuItem (FILE_QUIT) {
|
||||
FILE_QUIT,
|
||||
"Q", "q",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift,
|
||||
FILE_QUIT
|
||||
};
|
||||
resource rPString (FILE_QUIT, noCrossBank) {"Quit"};
|
||||
|
||||
resource rMenuItem (APPLE_ABOUT) {
|
||||
APPLE_ABOUT,
|
||||
"", "",
|
||||
0,
|
||||
refIsResource * itemTitleRefShift
|
||||
+ fDivider,
|
||||
APPLE_ABOUT
|
||||
};
|
||||
resource rPString (APPLE_ABOUT, noCrossBank) {"About BuGS..."};
|
||||
|
||||
|
||||
/* Error strings */
|
||||
resource rCString (TOOL_ERROR_STRING) {"\n\nTool error code = $%04x"};
|
||||
resource rCString (NEW_WINDOW_ERROR_STRING) {"Error occurred when creating a new window"};
|
||||
resource rCString (MALLOC_ERROR_STRING) {"Out of memory"};
|
||||
resource rCString (OPEN_FILE_ERROR_STRING) {"Error opening file"};
|
||||
resource rCString (SAVE_FILE_ERROR_STRING) {"Error saving file"};
|
||||
resource rCString (PRINT_ERROR_STRING) {"Error printing document"};
|
||||
|
||||
|
||||
/* Other strings */
|
||||
resource rCString (UNTITLED_STRING) {" Untitled %d "};
|
||||
resource rPString (OPEN_FILE_STRING, noCrossBank) {"Choose a file to open..."};
|
||||
resource rPString (SAVE_FILE_STRING, noCrossBank) {"Save file as..."};
|
||||
resource rPString (HELLO_WORLD_STRING, noCrossBank) {"Hello, world!"};
|
||||
|
||||
|
||||
/* Alert strings */
|
||||
resource rAlertString (ABOUT_ALERT_STRING) {
|
||||
"0" /* Custom size */
|
||||
#if DESKTOP_RES_MODE == 320
|
||||
"\$38\$00" /* Upper Y coordinate at 56 */
|
||||
"\$10\$00" /* Left X coordinate at 16 */
|
||||
"\$90\$00" /* Lower Y coorinate at 144 */
|
||||
"\$30\$01" /* Right X coordinate at 304 */
|
||||
#else
|
||||
"\$38\$00" /* Upper Y coordinate at 56 */
|
||||
"\$90\$00" /* Left X coordinate at 144 */
|
||||
"\$90\$00" /* Lower Y coorinate at 144 */
|
||||
"\$F0\$01" /* Right X coordinate at 496 */
|
||||
#endif
|
||||
"3/"
|
||||
"BuGS\n"
|
||||
" by Jeremy Rand\n"
|
||||
"\n"
|
||||
"Copyright \$A9 2020 Jeremy Rand\n"
|
||||
"\n"
|
||||
"Contains libraries from ORCAC,\n"
|
||||
"Copyright \$A9 1991, Byte Works Inc."
|
||||
"/^#0\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (ERROR_ALERT_STRING) {
|
||||
"42/"
|
||||
"*0\n"
|
||||
"*1"
|
||||
"/^#0\$00";
|
||||
};
|
||||
|
||||
resource rAlertString (SAVE_BEFORE_CLOSING) {
|
||||
"34/"
|
||||
"Save changes to *0 before closing?"
|
||||
"/^#2/#3/#1\$00";
|
||||
};
|
||||
|
||||
|
||||
/* Windows */
|
||||
resource rWindParam1 (WINDOW_RESID) {
|
||||
/* wFrameBits */
|
||||
fTitle + fClose + fZoom + fMove + fVis + fAllocated + fHilited,
|
||||
nil, /* wTitle */
|
||||
0, /* wRefCon */
|
||||
{0, 0, 0, 0}, /* ZoomRect */
|
||||
$07FF0001, /* wColor ID */
|
||||
{0, 0}, /* Origin */
|
||||
{0, 0}, /* data size */
|
||||
{0, 0}, /* max height-width */
|
||||
{8, 8}, /* scroll ver hors */
|
||||
{0, 0}, /* page ver horiz */
|
||||
0, /* winfoRefCon */
|
||||
10, /* wInfoHeight */
|
||||
#if DESKTOP_RES_MODE == 320
|
||||
{30, 10, 183, 300}, /* wposition */
|
||||
#else
|
||||
{30, 10, 183, 602}, /* wposition */
|
||||
#endif
|
||||
infront, /* wPlane */
|
||||
CONTROL_TEXT_EDIT, /* wStorage */
|
||||
$0802 /* wInVerb */
|
||||
};
|
||||
|
||||
|
||||
/* Controls */
|
||||
resource rControlTemplate (CONTROL_TEXT_EDIT) {
|
||||
CONTROL_TEXT_EDIT, /* Application defined ID */
|
||||
#if DESKTOP_RES_MODE == 320
|
||||
{0,0,165,300}, /* Bounding rectangle */
|
||||
#else
|
||||
{0,0,165,620}, /* Bounding rectangle */
|
||||
#endif
|
||||
editTextControl {
|
||||
{
|
||||
$0000, /* Flags */
|
||||
/* More flags */
|
||||
FctlCanBeTarget + FctlWantsEvents + FctlProcNotPtr + FctlTellAboutSize + FctlIsMultiPart,
|
||||
0, /* Refcon */
|
||||
/* Text flags */
|
||||
fSingleFormat + fSmartCutPaste + fGrowRuler + fDrawInactiveSelection,
|
||||
{-1,-1,-1,-1}, /* Indent rectangle */
|
||||
$FFFFFFFF, /* Vertical bar */
|
||||
0, /* Vertical amount */
|
||||
nil, /* Horizontal bar */
|
||||
0, /* Horizontal amount */
|
||||
nil, /* Style ref */
|
||||
/* Text descriptor */
|
||||
refIsResource * 8 + dataIsPString,
|
||||
HELLO_WORLD_STRING, /* Text ref */
|
||||
0, /* Text length */
|
||||
nil, /* Maximum chars */
|
||||
nil, /* Maximum lines */
|
||||
nil, /* Maximum chars per line */
|
||||
nil, /* Max height */
|
||||
nil, /* Color ref */
|
||||
4, /* Drawing mode */
|
||||
nil, /* Filter procedure */
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* Tools */
|
||||
resource rToolStartup (TOOL_STARTUP) {
|
||||
#if DESKTOP_RES_MODE == 320
|
||||
mode320,
|
||||
#else
|
||||
mode640,
|
||||
#endif
|
||||
{
|
||||
3, $0100, /* Misc Tool */
|
||||
4, $0100, /* Quickdraw */
|
||||
5, $0100, /* Desk Manager */
|
||||
6, $0100, /* Event Manager */
|
||||
11, $0100, /* Int Math */
|
||||
14, $0300, /* Window Manager */
|
||||
15, $0300, /* Menu Manager */
|
||||
16, $0300, /* Control Manager */
|
||||
18, $0200, /* QD Aux */
|
||||
19, $0100, /* Print Manager */
|
||||
20, $0100, /* LineEdit Tool */
|
||||
21, $0100, /* Dialog Manager */
|
||||
22, $0100, /* Scrap Manager */
|
||||
23, $0100, /* Standard File */
|
||||
27, $0100, /* Font Manager */
|
||||
28, $0100, /* List Manager */
|
||||
30, $0100, /* Resource Manager */
|
||||
34, $0100 /* TextEdit */
|
||||
}
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
# GSport configuration file version 0.31
|
||||
|
||||
s5d1 =
|
||||
s5d2 =
|
||||
|
||||
s6d1 =
|
||||
s6d2 =
|
||||
|
||||
s7d1 = ../BuGS.2mg
|
||||
|
||||
g_joystick_type = 0
|
||||
g_limit_speed = 0
|
||||
|
||||
|
||||
bram1[00] = 00 00 00 01 00 00 0d 06 02 01 01 00 01 00 00 00
|
||||
bram1[10] = 00 00 07 06 02 01 01 00 00 00 0f 06 06 00 05 06
|
||||
bram1[20] = 01 00 00 00 00 00 00 01 00 00 00 00 03 02 02 02
|
||||
bram1[30] = 00 00 00 00 00 00 00 00 08 00 01 02 03 04 05 06
|
||||
bram1[40] = 07 0a 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d
|
||||
bram1[50] = 0e 0f ff ff ff ff ff ff ff 00 ff ff ff ff ff 81
|
||||
bram1[60] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
bram1[70] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
bram1[80] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
bram1[90] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
bram1[a0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
bram1[b0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
bram1[c0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
bram1[d0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
bram1[e0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
|
||||
bram1[f0] = ff ff ff ff ff ff ff ff ff ff ff ff 52 06 f8 ac
|
||||
|
||||
bram3[00] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[10] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[20] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[30] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[40] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[50] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[60] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[70] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[80] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[90] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[a0] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[b0] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[c0] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[d0] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[e0] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
bram3[f0] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
@ -0,0 +1,120 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
MOUNTDIR=/tmp/a2gs_mount.$$
|
||||
TMPDISKIMAGE=/tmp/a2gs_diskimage_$$.2mg
|
||||
TEMPLATEDISKIMAGE=make/system601.2mg
|
||||
|
||||
if [ $# -lt 3 ]
|
||||
then
|
||||
echo USAGE: $0 diskimage file directory
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DISKIMAGE="$1"
|
||||
shift
|
||||
|
||||
FILE="$1"
|
||||
shift
|
||||
|
||||
DISKIMAGEDEST="$1"
|
||||
shift
|
||||
DEST="${MOUNTDIR}/${DISKIMAGEDEST}"
|
||||
|
||||
COPYDIRS=$*
|
||||
|
||||
cleanupAndExit()
|
||||
{
|
||||
umount "$MOUNTDIR" 2> /dev/null
|
||||
rm -f "$TMPDISKIMAGE" 2> /dev/null
|
||||
rm -f "$DISKIMAGE" 2> /dev/null
|
||||
rmdir "$MOUNTDIR" 2> /dev/null
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ ! -f "$TEMPLATEDISKIMAGE" ]
|
||||
then
|
||||
echo Unable to find the template disk image, $TEMPLATEDISKIMAGE
|
||||
cleanupAndExit
|
||||
fi
|
||||
|
||||
cp "$TEMPLATEDISKIMAGE" "$TMPDISKIMAGE"
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo Unable to copy template disk image.
|
||||
cleanupAndExit
|
||||
fi
|
||||
|
||||
mkdir "$MOUNTDIR"
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo Unable to create the mount directory.
|
||||
cleanupAndExit
|
||||
fi
|
||||
|
||||
profuse -orw "$TMPDISKIMAGE" "$MOUNTDIR"
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo Unable to mount the disk image.
|
||||
cleanupAndExit
|
||||
fi
|
||||
|
||||
cp "$FILE" "$DEST"
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo Unable to copy the file to the disk image.
|
||||
cleanupAndExit
|
||||
fi
|
||||
|
||||
OLDDIR=`pwd`
|
||||
for COPYDIR in $COPYDIRS
|
||||
do
|
||||
cd "$COPYDIR"
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo Unable to find $COPYDIR
|
||||
cleanupAndExit
|
||||
fi
|
||||
|
||||
find . -print | while read FILEORDIR
|
||||
do
|
||||
if [ -d "$FILEORDIR" ]
|
||||
then
|
||||
mkdir -p "${MOUNTDIR}/$FILEORDIR"
|
||||
elif [ -f "$FILEORDIR" ]
|
||||
then
|
||||
cp "$FILEORDIR" "${MOUNTDIR}/$FILEORDIR"
|
||||
fi
|
||||
done
|
||||
cd "$OLDDIR"
|
||||
done
|
||||
|
||||
RETRIES=0
|
||||
while [ $RETRIES -lt 5 ]
|
||||
do
|
||||
umount "$MOUNTDIR"
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
RETRIES=`expr $RETRIES + 1`
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [ $RETRIES -ge 5 ]
|
||||
then
|
||||
echo Unable to unmount the disk image.
|
||||
cleanupAndExit
|
||||
fi
|
||||
|
||||
cp "$TMPDISKIMAGE" "$DISKIMAGE"
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo Unable to copy the disk image to the destination.
|
||||
cleanupAndExit
|
||||
fi
|
||||
|
||||
rm -f "$TMPDISKIMAGE"
|
||||
rmdir "$MOUNTDIR"
|
||||
exit 0
|
|
@ -0,0 +1,95 @@
|
|||
#
|
||||
# head.mk
|
||||
#
|
||||
|
||||
ORCA_HOME := $(HOME)/orca
|
||||
|
||||
ORCA_BINDIR = /usr/local/bin
|
||||
|
||||
export ORCA=$(ORCA_BINDIR)/orca
|
||||
|
||||
TARGETTYPE=shell
|
||||
|
||||
ASSEMBLER=orcam
|
||||
|
||||
MERLIN_DIR=/usr/local
|
||||
export MERLIN_BIN=$(MERLIN_DIR)/bin/Merlin32
|
||||
export MERLIN_LIB=$(MERLIN_DIR)/lib/Merlin
|
||||
MERLIN_ASM=make/merlin-asm
|
||||
|
||||
SRCDIRS=.
|
||||
|
||||
# Check for Xcode build variables for the locations of build outputs and fall back
|
||||
# to the current directory if not set.
|
||||
ifeq ($(OBJECT_FILE_DIR),)
|
||||
OBJDIR=.
|
||||
else
|
||||
export OBJECT_FILE_DIR
|
||||
OBJDIR=$(OBJECT_FILE_DIR)
|
||||
endif
|
||||
|
||||
ifeq ($(DERIVED_SOURCES_DIR),)
|
||||
GENDIR=.
|
||||
else
|
||||
export DERIVED_SOURCES_DIR
|
||||
GENDIR=$(DERIVED_SOURCES_DIR)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_BUILD_DIR),)
|
||||
TARGETDIR=.
|
||||
else
|
||||
export TARGET_BUILD_DIR
|
||||
TARGETDIR=$(TARGET_BUILD_DIR)
|
||||
endif
|
||||
|
||||
COMPILE=make/orca-cc
|
||||
CFLAGS= -P -I
|
||||
ROOTCFILE=main.c
|
||||
DEFINES=
|
||||
INCLUDE_PATHS=
|
||||
|
||||
REZ=make/orca-rez
|
||||
REZFLAGS=
|
||||
|
||||
MACGEN=make/orca-macgen
|
||||
MACGENFLAGS=-P
|
||||
MACGENMACROS=13/ORCAInclude/m=
|
||||
|
||||
ASSEMBLE=make/orca-asm
|
||||
ASMFLAGS=-P
|
||||
|
||||
LINK=$(ORCA) link
|
||||
LDFLAGS=-P
|
||||
|
||||
CHTYP=$(ORCA) chtyp
|
||||
|
||||
RM=rm -f
|
||||
CP=cp
|
||||
MV=mv
|
||||
MKDIR=mkdir -p
|
||||
|
||||
DESKTOP_RES_MODE=640
|
||||
MESSAGE_CENTER=0
|
||||
|
||||
GSPLUS=/Applications/GSplus.app/Contents/MacOS/gsplus
|
||||
GSPORT=/Applications/GSport/GSport.app/Contents/MacOS/GSport
|
||||
|
||||
export GSPLUS
|
||||
export GSPORT
|
||||
|
||||
XCODE_PATH=/Applications/Xcode.app
|
||||
XCODE_INFO=$(XCODE_PATH)/Contents/Info.plist
|
||||
|
||||
ORCAM_PLUGIN_PATH=$(HOME)/Library/Developer/Xcode/Plug-ins/OrcaM.ideplugin
|
||||
ORCAM_PLUGIN_INFO=$(ORCAM_PLUGIN_PATH)/Contents/Info.plist
|
||||
|
||||
XCODE_PLUGIN_COMPATIBILITY=DVTPlugInCompatibilityUUID
|
||||
|
||||
|
||||
.PHONY: all gen genclean
|
||||
|
||||
all:
|
||||
$(MKDIR) $(OBJDIR) $(GENDIR) $(TARGETDIR)
|
||||
@make gen
|
||||
@make build
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ ! -z "$GSPLUS" ] && [ -x "$GSPLUS" ]
|
||||
then
|
||||
EMULATORPATH="$GSPLUS"
|
||||
elif [ ! -z "$GSPORT" ] && [ -x "$GSPORT" ]
|
||||
then
|
||||
EMULATORPATH="$GSPORT"
|
||||
fi
|
||||
|
||||
if [ -z "$EMULATORPATH" ]
|
||||
then
|
||||
echo Unable to find GSplus or GSport at these locations.
|
||||
echo " GSPLUS=$GSPLUS"
|
||||
echo " GSPORT=$GSPORT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DISKIMAGE="$1"
|
||||
if echo $DISKIMAGE | grep -v '^/' > /dev/null
|
||||
then
|
||||
DISKIMAGE="$PWD/$DISKIMAGE"
|
||||
fi
|
||||
|
||||
cd make
|
||||
sed -i "" "s:^s7d1 *=.*$:s7d1 = $DISKIMAGE:" config.txt
|
||||
|
||||
# This magic ensure that clicking stop in Xcode results in the emulator terminating.
|
||||
|
||||
$EMULATORPATH &
|
||||
PID=$!
|
||||
|
||||
trap 'kill $PID' SIGTERM SIGINT SIGHUP EXIT
|
||||
wait
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,77 @@
|
|||
#!/bin/bash
|
||||
|
||||
TMPFILE=/tmp/orca-macgen.$$
|
||||
|
||||
FILENAME="$1"
|
||||
shift
|
||||
|
||||
DESTBASENAME="$1"
|
||||
shift
|
||||
|
||||
if echo $FILENAME | grep -v '\.s$' > /dev/null
|
||||
then
|
||||
echo Expected second argument to be a *.s file but got $FILENAME
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRCBASENAME=`echo $FILENAME | sed 's/\.s$//'`
|
||||
SRCMACROSNAME="${SRCBASENAME}.macros"
|
||||
SRCROOTNAME="${SRCBASENAME}.ROOT"
|
||||
SRCOBJNAME="${SRCBASENAME}.a"
|
||||
|
||||
DESTMACROSNAME="${DESTBASENAME}.macros"
|
||||
DESTDEPSNAME="${DESTBASENAME}.macros.d"
|
||||
DESTROOTNAME="${DESTBASENAME}.ROOT"
|
||||
DESTOBJNAME="${DESTBASENAME}.a"
|
||||
|
||||
$ORCA --trace-gsos macgen $MACGENFLAGS "$FILENAME" "$SRCMACROSNAME" $MACGENMACROS < /dev/null 2> $TMPFILE
|
||||
RESULT=$?
|
||||
|
||||
sed '/^[A-Za-z][A-Za-z]*(.*)$/d' $TMPFILE >&2
|
||||
|
||||
if [ "$RESULT" -ne 0 ]
|
||||
then
|
||||
rm -f "$TMPFILE"
|
||||
rm -f "$SRCMACROSNAME"
|
||||
exit $RESULT
|
||||
fi
|
||||
|
||||
DEPS=`awk '
|
||||
/^FastFileLoad/ {
|
||||
sub(/^FastFileLoad\(/, "");
|
||||
sub(/\)$/, "");
|
||||
print}' $TMPFILE | sort -u | while read FILE
|
||||
do
|
||||
if [ -f "$FILE" ]
|
||||
then
|
||||
echo $FILE
|
||||
fi
|
||||
done | tr '\012' ' '`
|
||||
|
||||
rm -f $TMPFILE
|
||||
|
||||
DIRNAME=`dirname $FILENAME`
|
||||
BASENAME=`basename $FILENAME .s`
|
||||
|
||||
pushd "$DIRNAME" > /dev/null
|
||||
$ORCA assemble $* keep="${BASENAME}" "${BASENAME}.s"
|
||||
RESULT=$?
|
||||
popd > /dev/null
|
||||
|
||||
if [ "$RESULT" -ne 0 ]
|
||||
then
|
||||
rm -f "$SRCROOTNAME"
|
||||
rm -f "$SRCMACROSNAME"
|
||||
rm -f "$SRCOBJNAME"
|
||||
fi
|
||||
|
||||
mkdir -p `dirname "$DESTROOTNAME"`
|
||||
mv -f "$SRCROOTNAME" "$DESTROOTNAME" 2> /dev/null
|
||||
mv -f "$SRCMACROSNAME" "$DESTMACROSNAME" 2> /dev/null
|
||||
mv -f "$SRCOBJNAME" "$DESTOBJNAME" 2> /dev/null
|
||||
|
||||
cat > $DESTDEPSNAME << EOF
|
||||
$DESTROOTNAME: $DEPS
|
||||
EOF
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,95 @@
|
|||
#!/bin/bash
|
||||
|
||||
STDOUTPUT=/tmp/orca-cc-std.$$
|
||||
ERROUTPUT=/tmp/orca-cc-errs.$$
|
||||
|
||||
FILENAME="$1"
|
||||
shift
|
||||
|
||||
DESTBASENAME="$1"
|
||||
shift
|
||||
|
||||
if echo $FILENAME | grep -v '\.c$' > /dev/null
|
||||
then
|
||||
echo Expected first argument to be a *.c file but got $FILENAME
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CCARGS=""
|
||||
COMPILEARGS=""
|
||||
for ARG in $*
|
||||
do
|
||||
if echo $ARG | grep '^-[id]' > /dev/null
|
||||
then
|
||||
CCARGS="$CCARGS cc=$ARG"
|
||||
else
|
||||
COMPILEARGS="$COMPILEARGS $ARG"
|
||||
fi
|
||||
done
|
||||
|
||||
SRCBASENAME=`echo "$FILENAME" | sed 's/\.c$//'`
|
||||
SRCOBJNAME="${SRCBASENAME}.a"
|
||||
SRCROOTNAME="${SRCBASENAME}.root"
|
||||
|
||||
DESTDEPSNAME="${DESTBASENAME}.d"
|
||||
DESTOBJNAME="${DESTBASENAME}.a"
|
||||
DESTROOTNAME="${DESTBASENAME}.root"
|
||||
|
||||
$ORCA --trace-gsos compile $COMPILEARGS "$FILENAME" keep="${SRCBASENAME}" $CCARGS > $STDOUTPUT 2> $ERROUTPUT
|
||||
RESULT=$?
|
||||
|
||||
awk '
|
||||
{
|
||||
print $0
|
||||
}
|
||||
|
||||
$1 ~ /^[0-9][0-9]*$/ {
|
||||
LINENO=$1
|
||||
}
|
||||
|
||||
/^ *\^/ {
|
||||
sub(/^ *\^/, "", $0)
|
||||
printf("%s/%s:%d:0: error: %s\n", PWD, FILE, LINENO, $0)
|
||||
}
|
||||
' "PWD=`pwd`" "FILE=$FILENAME" $STDOUTPUT
|
||||
|
||||
|
||||
sed '/^[A-Za-z][A-Za-z]*(.*)$/d' $ERROUTPUT >&2
|
||||
|
||||
if [ "$RESULT" -ne 0 ]
|
||||
then
|
||||
rm -f $ERROUTPUT
|
||||
rm -f $STDOUTPUT
|
||||
rm -f $SRCOBJNAME
|
||||
rm -f $SRCROOTNAME
|
||||
exit $RESULT
|
||||
fi
|
||||
|
||||
mkdir -p `dirname "$DESTOBJNAME"`
|
||||
mv -f "$SRCOBJNAME" "$DESTOBJNAME" 2> /dev/null
|
||||
mv -f "$SRCROOTNAME" "$DESTROOTNAME" 2> /dev/null
|
||||
|
||||
DEPS=`awk '
|
||||
/^FastFileLoad/ {
|
||||
sub(/^FastFileLoad\(/, "");
|
||||
sub(/\)$/, "");
|
||||
print}' $ERROUTPUT | sort -u | while read FILE
|
||||
do
|
||||
if [ -f "$FILE" ]
|
||||
then
|
||||
echo $FILE
|
||||
fi
|
||||
done | tr '\012' ' '`
|
||||
|
||||
rm -f $ERROUTPUT
|
||||
rm -f $STDOUTPUT
|
||||
|
||||
# We add a dependency for both the .o and the .root file. If this is the
|
||||
# main.c file being compiled, we need the dependency on the .root file.
|
||||
cat > $DESTDEPSNAME << EOF
|
||||
$DESTOBJNAME: $DEPS
|
||||
|
||||
$DESTROOTNAME: $DEPS
|
||||
EOF
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
|
||||
ERROUTPUT=/tmp/orca-rez-err.$$
|
||||
|
||||
FILENAME="$1"
|
||||
shift
|
||||
|
||||
DESTBASENAME="$1"
|
||||
shift
|
||||
|
||||
if echo $FILENAME | grep -v '\.rez$' > /dev/null
|
||||
then
|
||||
echo Expected first argument to be a *.rez file but got $FILENAME
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRCBASENAME=`echo $FILENAME | sed 's/\.rez$//'`
|
||||
SRCOBJNAME="${SRCBASENAME}.r"
|
||||
|
||||
DESTDEPSNAME="${DESTBASENAME}.rez.d"
|
||||
DESTOBJNAME="${DESTBASENAME}.r"
|
||||
|
||||
$ORCA --trace-gsos compile "$@" keep="${SRCOBJNAME}" "$FILENAME" 2> $ERROUTPUT
|
||||
RESULT=$?
|
||||
|
||||
awk '
|
||||
/^[A-Za-z][A-Za-z]*\(.*\)$/ {
|
||||
next
|
||||
}
|
||||
|
||||
{
|
||||
print
|
||||
}
|
||||
|
||||
/^File [^ ]*; Line [0-9][0-9]*;/ {
|
||||
sub(/;/,"",$4)
|
||||
LINENO=$4
|
||||
sub(/^File [^ ]*; Line [0-9][0-9]*/, "", $0)
|
||||
printf("%s/%s:%d:0: error: %s\n", PWD, FILE, LINENO, $0)
|
||||
}
|
||||
' "PWD=`pwd`" "FILE=$FILENAME" $ERROUTPUT >&2
|
||||
|
||||
if [ "$RESULT" -ne 0 ]
|
||||
then
|
||||
rm -f $ERROUTPUT
|
||||
rm -f $SRCOBJNAME
|
||||
exit $RESULT
|
||||
fi
|
||||
|
||||
mkdir -p `dirname "$DESTOBJNAME"`
|
||||
mv -f "$SRCOBJNAME" "$DESTOBJNAME" 2> /dev/null
|
||||
|
||||
DEPS=`awk '
|
||||
/^FastFileLoad/ {
|
||||
sub(/^FastFileLoad\(/, "");
|
||||
sub(/\)$/, "");
|
||||
print}' $ERROUTPUT | sort -u | while read FILE
|
||||
do
|
||||
if [ -f "$FILE" ]
|
||||
then
|
||||
echo $FILE
|
||||
fi
|
||||
done`
|
||||
|
||||
echo $DESTOBJNAME: $DEPS > $DESTDEPSNAME
|
||||
rm -f $ERROUTPUT
|
||||
|
||||
exit 0
|
Binary file not shown.
|
@ -0,0 +1,226 @@
|
|||
#
|
||||
# tail.mk
|
||||
#
|
||||
|
||||
export PATH := $(PATH):$(ORCA_BIN)
|
||||
|
||||
CWD=$(shell pwd)
|
||||
|
||||
DISKIMAGE=$(TARGETDIR)/$(PGM).2mg
|
||||
BUILDTARGET=$(DISKIMAGE)
|
||||
EXECTARGET=executeGUI
|
||||
DISKIMAGEDEST=.
|
||||
AUXTYPE=
|
||||
CFLAGS+=-i$(GENDIR)
|
||||
|
||||
vpath $(GENDIR)
|
||||
|
||||
ifeq ($(TARGETTYPE),shell)
|
||||
FILETYPE=exe
|
||||
EXECTARGET=executeShell
|
||||
BUILDTARGET=$(TARGETDIR)/$(PGM)
|
||||
else ifeq ($(TARGETTYPE),desktop)
|
||||
FILETYPE=s16
|
||||
ifeq ($(MESSAGE_CENTER),1)
|
||||
AUXTYPE=-a 0x0000db07
|
||||
else
|
||||
AUXTYPE=-a 0x0000db03
|
||||
endif
|
||||
CFLAGS+=-dMESSAGE_CENTER=$(MESSAGE_CENTER)
|
||||
REZFLAGS+=rez='-d DESKTOP_RES_MODE=$(DESKTOP_RES_MODE)'
|
||||
REZFLAGS+=rez='-d MESSAGE_CENTER=$(MESSAGE_CENTER)'
|
||||
else ifeq ($(TARGETTYPE),cda)
|
||||
FILETYPE=cda
|
||||
DISKIMAGEDEST=System/Desk.Accs
|
||||
else ifeq ($(TARGETTYPE),cdev)
|
||||
BINTARGET=$(TARGETDIR)/$(PGM).bin
|
||||
FILETYPE=199
|
||||
DISKIMAGEDEST=System/CDevs
|
||||
REZFLAGS+=rez='-d BINTARGET="$(BINTARGET)"'
|
||||
else ifeq ($(TARGETTYPE),nba)
|
||||
FILETYPE=exe
|
||||
BUILDTARGET=$(TARGETDIR)/$(PGM)
|
||||
else ifeq ($(TARGETTYPE),nda)
|
||||
FILETYPE=nda
|
||||
DISKIMAGEDEST=System/Desk.Accs
|
||||
else ifeq ($(TARGETTYPE),xcmd)
|
||||
FILETYPE=exe
|
||||
BUILDTARGET=$(TARGETDIR)/$(PGM)
|
||||
endif
|
||||
|
||||
|
||||
ASM_SRCS=$(patsubst $(GENDIR)/%, %, $(patsubst ./%, %, $(wildcard $(addsuffix /*.s, $(SRCDIRS)))))
|
||||
|
||||
ifeq ($(ASSEMBLER),orcam)
|
||||
ASM_MACROS=$(patsubst %.s, $(OBJDIR)/%.macros, $(ASM_SRCS))
|
||||
ASM_DEPS=$(patsubst %.s, $(OBJDIR)/%.macros.d, $(ASM_SRCS))
|
||||
ASM_ROOTS=$(patsubst %.s, $(OBJDIR)/%.ROOT, $(ASM_SRCS))
|
||||
ASM_OBJS=$(patsubst %.s, $(OBJDIR)/%.a, $(ASM_SRCS))
|
||||
|
||||
ifeq ($(wildcard $(ROOTCFILE)),)
|
||||
ROOTCFILE=
|
||||
endif
|
||||
|
||||
C_ROOTS=$(patsubst %.c, $(OBJDIR)/%.root, $(ROOTCFILE))
|
||||
C_SRCS+=$(filter-out $(ROOTCFILE), $(patsubst $(GENDIR)/%, %, $(patsubst ./%, %, $(wildcard $(addsuffix /*.c, $(SRCDIRS))))))
|
||||
C_OBJS=$(patsubst %.c, $(OBJDIR)/%.a, $(C_SRCS))
|
||||
C_DEPS=$(patsubst %.c, $(OBJDIR)/%.d, $(ROOTCFILE)) $(patsubst %.c, $(OBJDIR)/%.d, $(C_SRCS))
|
||||
endif
|
||||
|
||||
REZ_SRCS=$(patsubst $(GENDIR)/%, %, $(patsubst ./%, %, $(wildcard $(addsuffix /*.rez, $(SRCDIRS)))))
|
||||
REZ_DEPS=$(patsubst %.rez, $(OBJDIR)/%.rez.d, $(REZ_SRCS))
|
||||
REZ_OBJS=$(patsubst %.rez, $(OBJDIR)/%.r, $(REZ_SRCS))
|
||||
|
||||
ifneq ($(firstword $(REZ_SRCS)), $(lastword $(REZ_SRCS)))
|
||||
$(error Only a single resource file supported, found $(REZ_SRCS))
|
||||
endif
|
||||
|
||||
BUILD_OBJS=$(C_ROOTS) $(C_OBJS) $(ASM_ROOTS)
|
||||
ifeq ($(BINTARGET),)
|
||||
BUILD_OBJS+=$(REZ_OBJS)
|
||||
endif
|
||||
BUILD_OBJS_NOSUFFIX=$(C_ROOTS:.root=) $(C_OBJS:.a=) $(ASM_ROOTS:.ROOT=)
|
||||
|
||||
ALL_OBJS=$(C_ROOTS:.root=.a) $(C_OBJS) $(ASM_OBJS) $(REZ_OBJS)
|
||||
ALL_ROOTS=$(C_ROOTS) $(C_OBJS:.a=.root) $(ASM_ROOTS)
|
||||
ALL_DEPS=$(C_DEPS) $(ASM_DEPS) $(REZ_DEPS)
|
||||
|
||||
EXECCMD=
|
||||
|
||||
.PHONY: build execute executeShell executeGUI clean xcodefix
|
||||
|
||||
.PRECIOUS: $(ASM_MACROS)
|
||||
|
||||
build: $(BUILDTARGET)
|
||||
|
||||
gen: xcodefix
|
||||
|
||||
xcodefix:
|
||||
defaults write "$(ORCAM_PLUGIN_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)s -array `defaults read "$(XCODE_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)` || true
|
||||
|
||||
clean: genclean
|
||||
$(RM) "$(TARGETDIR)/$(PGM)" $(BINTARGET)
|
||||
$(RM) $(ALL_OBJS)
|
||||
$(RM) $(ALL_ROOTS)
|
||||
$(RM) $(ALL_DEPS)
|
||||
$(RM) $(ASM_MACROS)
|
||||
$(RM) "$(DISKIMAGE)"
|
||||
|
||||
createPackage:
|
||||
pkg/createPackage
|
||||
|
||||
cleanMacCruft:
|
||||
rm -rf pkg
|
||||
|
||||
|
||||
ifeq ($(BINTARGET),)
|
||||
ifeq ($(ASSEMBLER),orcam)
|
||||
|
||||
# This is a standard ORCA build where we generate the resources if any and
|
||||
# then link the binary over that same file creating the resource fork first
|
||||
# and the data fork second.
|
||||
$(TARGETDIR)/$(PGM): $(BUILD_OBJS)
|
||||
$(MKDIR) $(TARGETDIR)
|
||||
ifneq ($(REZ_OBJS),)
|
||||
$(RM) $(TARGETDIR)/$(PGM)
|
||||
$(CP) $(REZ_OBJS) $(TARGETDIR)/$(PGM)
|
||||
endif
|
||||
cd $(OBJDIR); $(LINK) $(LDFLAGS) $(patsubst $(OBJDIR)/%, %, $(BUILD_OBJS_NOSUFFIX)) --keep=$(TARGETDIR)/$(PGM)
|
||||
$(CHTYP) -t $(FILETYPE) $(AUXTYPE) $(TARGETDIR)/$(PGM)
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(ASSEMBLER),merlin)
|
||||
# This is a standard Merlin build where we generate the resources if any and
|
||||
# then link the binary over that same file creating the resource fork first
|
||||
# and the data fork second.
|
||||
|
||||
$(TARGETDIR)/$(PGM): $(BUILD_OBJS) $(ASM_SRCS)
|
||||
$(MKDIR) $(TARGETDIR)
|
||||
$(RM) $(TARGETDIR)/$(PGM)
|
||||
$(MERLIN_ASM) linkscript.s $(PGM) $(TARGETDIR)/$(PGM)
|
||||
ifneq ($(REZ_OBJS),)
|
||||
$(CP) $(REZ_OBJS)/..namedfork/rsrc $(TARGETDIR)/$(PGM)/..namedfork/rsrc
|
||||
endif
|
||||
$(CHTYP) -t $(FILETYPE) $(AUXTYPE) $(TARGETDIR)/$(PGM)
|
||||
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
ifeq ($(ASSEMBLER),orcam)
|
||||
# This is a special build for CDevs under ORCA where we build the binary into
|
||||
# a $(PGM).bin file and then build the resources into the $(PGM) target. The
|
||||
# resource compile will read the $(PGM).bin binary and load it into the
|
||||
# resources also.
|
||||
$(BINTARGET): $(BUILD_OBJS)
|
||||
cd $(OBJDIR); $(LINK) $(LDFLAGS) $(patsubst $(OBJDIR)/%, %, $(BUILD_OBJS_NOSUFFIX)) --keep=$(BINTARGET)
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(ASSEMBLER),merlin)
|
||||
# This is a special build for CDevs under Merlin where we build the binary into
|
||||
# a $(PGM).bin file and then build the resources into the $(PGM) target. The
|
||||
# resource compile will read the $(PGM).bin binary and load it into the
|
||||
# resources # also.
|
||||
$(BINTARGET): $(BUILD_OBJS) $(ASM_SRCS)
|
||||
$(MERLIN_ASM) linkscript.s $(PGM) $(BINTARGET)
|
||||
|
||||
endif
|
||||
|
||||
$(REZ_OBJS): $(BINTARGET)
|
||||
|
||||
$(TARGETDIR)/$(PGM): $(REZ_OBJS)
|
||||
$(MKDIR) $(TARGETDIR)
|
||||
$(RM) $(TARGETDIR)/$(PGM)
|
||||
$(CP) $(REZ_OBJS) $(TARGETDIR)/$(PGM)
|
||||
$(CHTYP) -t $(FILETYPE) $(AUXTYPE) $(TARGETDIR)/$(PGM)
|
||||
|
||||
endif
|
||||
|
||||
$(DISKIMAGE): $(TARGETDIR)/$(PGM)
|
||||
make/createDiskImage "$(DISKIMAGE)" "$(TARGETDIR)/$(PGM)" "$(DISKIMAGEDEST)" $(COPYDIRS)
|
||||
|
||||
execute: $(EXECTARGET)
|
||||
|
||||
executeGUI: all
|
||||
make/launchEmulator $(DISKIMAGE)
|
||||
|
||||
executeShell: all
|
||||
$(ORCA) $(TARGETDIR)/$(PGM)
|
||||
|
||||
$(OBJDIR)/%.a: %.c
|
||||
$(COMPILE) $< $(@:.a=) $(CFLAGS) --noroot
|
||||
|
||||
$(OBJDIR)/%.a: $(GENDIR)/%.c
|
||||
$(COMPILE) $< $(@:.a=) $(CFLAGS) --noroot
|
||||
|
||||
$(OBJDIR)/%.root: %.c
|
||||
$(COMPILE) $< $(@:.root=) $(CFLAGS)
|
||||
|
||||
$(OBJDIR)/%.root: $(GENDIR)/%.c
|
||||
$(COMPILE) $< $(@:.root=) $(CFLAGS)
|
||||
|
||||
$(OBJDIR)/%.ROOT: %.s
|
||||
MACGENFLAGS="$(MACGENFLAGS)" MACGENMACROS="$(MACGENMACROS)" $(ASSEMBLE) $< $(@:.ROOT=) $(ASMFLAGS)
|
||||
|
||||
$(OBJDIR)/%.ROOT: $(GENDIR)/%.s
|
||||
MACGENFLAGS="$(MACGENFLAGS)" MACGENMACROS="$(MACGENMACROS)" $(ASSEMBLE) $< $(@:.ROOT=) $(ASMFLAGS)
|
||||
|
||||
$(OBJDIR)/%.r: %.rez
|
||||
$(REZ) $< $(@:.r=) $(REZFLAGS)
|
||||
ifneq ($(RLINT_PATH),)
|
||||
$(ORCA) $(RLINT_PATH) $@
|
||||
endif
|
||||
|
||||
$(OBJDIR)/%.r: $(GENDIR)/%.rez
|
||||
$(REZ) $< $(@:.r=) $(REZFLAGS)
|
||||
ifneq ($(RLINT_PATH),)
|
||||
$(ORCA) $(RLINT_PATH) $@
|
||||
endif
|
||||
|
||||
$(OBJS): Makefile
|
||||
|
||||
# Include the C and rez dependencies which were generated from the last build
|
||||
# so we recompile correctly on .h file changes.
|
||||
-include $(ALL_DEPS)
|
Loading…
Reference in New Issue