From 3a98af6322c912f24c172604067c5e79b5b8400c Mon Sep 17 00:00:00 2001 From: Wolfgang Thaller Date: Sat, 8 Nov 2014 00:52:50 +0100 Subject: [PATCH] resource-related tools: misc cleanup --- MakeAPPL/main.cc | 29 +++-------------------------- ResourceFiles/ResourceFork.cc | 3 +-- Rez/CMakeLists.txt | 16 +++++++--------- 3 files changed, 11 insertions(+), 37 deletions(-) diff --git a/MakeAPPL/main.cc b/MakeAPPL/main.cc index 4ca8d593a6..3b4db468b3 100644 --- a/MakeAPPL/main.cc +++ b/MakeAPPL/main.cc @@ -32,23 +32,6 @@ #include "BinaryIO.h" #include "ResourceFile.h" -std::string commandPath; - -void wrapMacBinary(std::string macBinaryFile, std::string diskImagePath) -{ - int size = static_cast( - std::ifstream(macBinaryFile.c_str()).seekg(0,std::ios::end).tellg() - ); - - size += 20 * 1024; - size += 800*1024 - size % (800*1024); - - std::ofstream(diskImagePath.c_str(), std::ios::binary | std::ios::trunc).seekp(size-1).put(0); - - std::system((commandPath + "hformat " + diskImagePath + " > /dev/null").c_str()); - std::system((commandPath + "hcopy -m " + macBinaryFile + " :").c_str()); -} - std::string fromhex(std::string hex) { std::string bin; @@ -104,11 +87,6 @@ int main(int argc, char *argv[]) unsigned long minimumSize = 384 * 1024; unsigned long preferredSize = 384 * 1024; - if(char *lastSlash = std::strrchr(argv[0], '/')) - { - commandPath = std::string(argv[0], lastSlash + 1); - } - for(int i = 1; i < argc;) { std::string arg(argv[i++]); @@ -207,9 +185,9 @@ int main(int argc, char *argv[]) { assert(i < argc); std::string fn = argv[i++]; - std::ifstream in(fn.c_str(), std::ios::in|std::ios::binary); - Resources rsrc2(in); - rsrc.addResources(rsrc2); + ResourceFile copyRsrc(fn); + copyRsrc.read(); + rsrc.addResources(copyRsrc.resources); } else { @@ -235,7 +213,6 @@ int main(int argc, char *argv[]) file.assign(dskFileName, ResourceFile::Format::diskimage); file.write(); - //wrapMacBinary(binFileName, dskFileName); #ifdef __APPLE__ file.assign(outFileName + ".APPL", ResourceFile::Format::real); diff --git a/ResourceFiles/ResourceFork.cc b/ResourceFiles/ResourceFork.cc index a24a945bad..1e38573dda 100644 --- a/ResourceFiles/ResourceFork.cc +++ b/ResourceFiles/ResourceFork.cc @@ -8,8 +8,7 @@ void Resources::addResources(const Resources& res) { for(auto& rr : res.resources) - resources.insert(rr); -// resources.insert(resources.end(),res.resources.begin(), res.resources.end()); + addResource(rr.second); } void Resources::writeFork(std::ostream& out) const diff --git a/Rez/CMakeLists.txt b/Rez/CMakeLists.txt index 0bb65a0885..e256d59161 100644 --- a/Rez/CMakeLists.txt +++ b/Rez/CMakeLists.txt @@ -27,16 +27,14 @@ find_package(BISON REQUIRED) include_directories(. ${CMAKE_CURRENT_BINARY_DIR}) -add_custom_command( - DEPENDS RezParser.yy - COMMAND ${BISON_EXECUTABLE} - ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/RezParser.generated.cc - ${CMAKE_CURRENT_SOURCE_DIR}/RezParser.yy --graph - COMMENT "Generating parser.cpp" - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/RezParser.generated.cc ${CMAKE_CURRENT_BINARY_DIR}/RezParser.generated.hh -) +bison_target(RezParser RezParser.yy + ${CMAKE_CURRENT_BINARY_DIR}/RezParser.generated.cc ${CMAKE_CURRENT_BINARY_DIR}/RezParser.generated.hh + ${CMAKE_CURRENT_BINARY_DIR}/location.hh ${CMAKE_CURRENT_BINARY_DIR}/position.hh + ${CMAKE_CURRENT_BINARY_DIR}/stack.hh) + add_library(RezLib - RezParser.yy RezParser.generated.hh RezParser.generated.cc + RezParser.yy + ${BISON_RezParser_OUTPUTS} RezLexer.h RezLexer.cc