From 26a97259f5a7b066cff2927e88c867fac2aaad87 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 26 May 2009 23:10:13 +0200 Subject: template FTW!!!!!11 --- ue4/mycpu/mycpu.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'ue4/mycpu/mycpu.cpp') diff --git a/ue4/mycpu/mycpu.cpp b/ue4/mycpu/mycpu.cpp index b25e721..6c9f71a 100644 --- a/ue4/mycpu/mycpu.cpp +++ b/ue4/mycpu/mycpu.cpp @@ -6,7 +6,7 @@ * be executed in linear order (except jumps) afterwards. In order to * initialize the memory of the cpu before execution an optional * memoryfile can be passed as commandline option. - * @date 13.05.2009 + * @date 26.05.2009 * @par Exercise * 4 */ @@ -16,9 +16,10 @@ #include #include #include -#include "ccpu.h" +#include "cdat.h" #include "cmem.h" #include "cprogram.h" +#include "ccpu.h" using namespace std; namespace po = boost::program_options; @@ -47,6 +48,7 @@ int main(int argc, char* argv[]) po::options_description desc("Allowed options"); desc.add_options() ("help,h", "this help message") + ("format,f", po::value(), "format") ("compile,c", po::value(), "input programfile") ("memory,m", po::value(), "input memoryfile"); @@ -65,13 +67,13 @@ int main(int argc, char* argv[]) /* print usage upon request or missing params */ if (vm.count("help") || !vm.count("compile")) { - cout << "Usage: " << me << " -c [-m ]" << endl; + cout << "Usage: " << me << " [-f ] -c [-m ]" << endl; cout << desc << endl; return 0; } /* create memory and optionally initialize memory from file */ - CMem memory; + CMem > memory; if (vm.count("memory")) { string memoryfile(vm["memory"].as()); @@ -101,7 +103,7 @@ int main(int argc, char* argv[]) } /* create program instance */ - CProgram program; + CProgram > program; string programfile(vm["compile"].as()); ifstream file(programfile.c_str(), ios::in); if (!file.is_open()) @@ -131,7 +133,7 @@ int main(int argc, char* argv[]) /* create cpu and execute the program */ try { - CCPU cpu(256); + CCPU > cpu(256); cpu.setMemory(&memory); cpu.setProgram(&program); cpu.run(); -- cgit v1.2.3