From f6f1391a8af068bda8821310fceb762da8c12d67 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sat, 15 Sep 2012 21:53:10 +0200 Subject: [PATCH 1/1] removed some leftover lines from linker branch --- src/app/Arguments.cpp | 2 +- src/app/Arguments.h | 2 +- src/main.cpp | 35 +++++++---------------------------- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/src/app/Arguments.cpp b/src/app/Arguments.cpp index d01cf2a..80e5aa0 100644 --- a/src/app/Arguments.cpp +++ b/src/app/Arguments.cpp @@ -48,7 +48,7 @@ Arguments::RunLevel Arguments::DetectRunLevel() const { if (dump) { return DUMP; } else if (outfile) { - return COMPILE; + return WRITE; } else { return PLAY; } diff --git a/src/app/Arguments.h b/src/app/Arguments.h index 9bd35a9..1a81649 100644 --- a/src/app/Arguments.h +++ b/src/app/Arguments.h @@ -20,9 +20,9 @@ public: public: enum RunLevel { - COMPILE, DUMP, PLAY, + WRITE, }; public: diff --git a/src/main.cpp b/src/main.cpp index edb0f1c..8f19f43 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,7 +26,6 @@ #include "graphics/Menu.h" #include "graphics/SimpleAnimation.h" #include "graphics/Sprite.h" -#include "loader/Compiler.h" #include "loader/Interpreter.h" #include "loader/ParsedSource.h" #include "loader/Parser.h" @@ -64,7 +63,6 @@ using graphics::Gauge; using graphics::Menu; using graphics::SimpleAnimation; using graphics::Sprite; -using loader::Compiler; using loader::Interpreter; using loader::ParsedSource; using loader::Parser; @@ -114,30 +112,11 @@ int main(int argc, char **argv) { ParsedSource source; for (vector::const_iterator i(args.Infiles().begin()), end(args.Infiles().end()); i != end; ++i) { - string filePath(*i); - switch (filePath[filePath.size() - 1]) { - case 'o': - // TODO: load object file - break; - case 's': - Parser(filePath, source).Parse(); - break; - default: - throw std::runtime_error("don't know what to do with " + filePath); - } + Parser(*i, source).Parse(); } -// Parser("test-data/test.l2s", source).Parse(); -// Parser("test-data/ikaris.l2s", source).Parse(); -// Parser("test-data/items.l2s", source).Parse(); -// Parser("test-data/spells.l2s", source).Parse(); -// Parser("test-data/constants.l2s", source).Parse(); - - Interpreter intp(source); - intp.ReadSource(); - switch (args.DetectRunLevel()) { - case Arguments::COMPILE: + case Arguments::WRITE: { int length(std::strlen(args.OutfilePath())); switch (args.OutfilePath()[length - 1]) { @@ -146,11 +125,8 @@ int main(int argc, char **argv) { source.WriteHeader(outstream); break; } - default: - case 'o': { - std::ofstream outstream(args.OutfilePath()); - Compiler(intp).Write(outstream); - break; + default: { + throw std::runtime_error(string("don't know how to write file ") + args.OutfilePath()); } } return 0; @@ -163,6 +139,9 @@ int main(int argc, char **argv) { break; } + Interpreter intp(source); + intp.ReadSource(); + int battleResId(TypeDescription::GetTypeId("BattleResources")); int heroId(TypeDescription::GetTypeId("Hero")); int itemId(TypeDescription::GetTypeId("Item")); -- 2.39.2