X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmain.cpp;h=edb0f1c8e47f28ca7361d32970a6e873e0b4f3ca;hb=fd4c31a00e232ac9e494d4cc00462b58af61198c;hp=00fea98dfba5506231f60141c4763b902a024fb6;hpb=d557b3422756e3492b60cf545fd956a2fbf18af1;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index 00fea98..edb0f1c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,6 +36,7 @@ #include "sdl/InitSDL.h" #include +#include #include #include #include @@ -138,12 +139,23 @@ int main(int argc, char **argv) { switch (args.DetectRunLevel()) { case Arguments::COMPILE: { - std::ofstream testOut(args.OutfilePath()); - Compiler(intp).Write(testOut); + int length(std::strlen(args.OutfilePath())); + switch (args.OutfilePath()[length - 1]) { + case 'h': { + std::ofstream outstream(args.OutfilePath()); + source.WriteHeader(outstream); + break; + } + default: + case 'o': { + std::ofstream outstream(args.OutfilePath()); + Compiler(intp).Write(outstream); + break; + } + } return 0; } - case Arguments::DUMP: - { + case Arguments::DUMP: { std::cout << source << std::endl; return 0; }