resource-related tools: misc cleanup

This commit is contained in:
Wolfgang Thaller 2014-11-08 00:52:50 +01:00
parent 30ca7cce42
commit 3a98af6322
3 changed files with 11 additions and 37 deletions

View File

@ -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<int>(
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);

View File

@ -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

View File

@ -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