#include "sdl/InitSDL.h"
#include <cstdlib>
+#include <cstring>
#include <ctime>
#include <exception>
#include <iostream>
Interpreter intp(source);
intp.ReadSource();
- if (args.OutfileSet()) {
- std::ofstream testOut(args.OutfilePath());
- Compiler(intp).Write(testOut);
- return 0;
+ switch (args.DetectRunLevel()) {
+ case Arguments::COMPILE:
+ {
+ 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: {
+ std::cout << source << std::endl;
+ return 0;
+ }
+ case Arguments::PLAY:
+ break;
}
int battleResId(TypeDescription::GetTypeId("BattleResources"));