From 36ce0f2243fd0723a746b3c2f5f0651577312400 Mon Sep 17 00:00:00 2001 From: Tayler Hetherington Date: Fri, 30 Nov 2012 21:29:42 -0800 Subject: Merging Power model into Fermi //depot/gpgpu_sim_research/fermi_power/distribution/... to //depot/gpgpu_sim_research/fermi/distribution/... [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 14723] --- src/option_parser.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/option_parser.cc') diff --git a/src/option_parser.cc b/src/option_parser.cc index 4133d15..4fa2343 100644 --- a/src/option_parser.cc +++ b/src/option_parser.cc @@ -37,6 +37,8 @@ #include #include #include +#include "option_parser.h" + using namespace std; @@ -203,7 +205,7 @@ public: p_option->assignDefault(optionDefault); } - void ParseCommandLine(int argc, const char * const argv[]) + void ParseCommandLine(int argc, const char * const argv[]) { for (int i = 1; i < argc; i++) { OptionMap::iterator i_option; @@ -230,11 +232,11 @@ public: fprintf(stderr, "\n\nGPGPU-Sim ** ERROR: Missing filename for option '-config'.\n"); exit(1); } + ParseFile(argv[i + 1]); i += 1; optionFound = true; } - if (optionFound == false) { fprintf(stderr, "\n\nGPGPU-Sim ** ERROR: Unknown Option: '%s' \n", argv[i]); exit(1); @@ -242,6 +244,7 @@ public: } } + void ParseFile(const char *filename) { ifstream inputFile; stringstream args; @@ -384,12 +387,14 @@ void option_parser_register(option_parser_t opp, } void option_parser_cmdline(option_parser_t opp, - int argc, const char *argv[]) + int argc, const char *argv[]) { OptionParser *p_opr = reinterpret_cast(opp); - p_opr->ParseCommandLine(argc,argv); + return p_opr->ParseCommandLine(argc,argv); + } + void option_parser_cfgfile(option_parser_t opp, const char *filename) { -- cgit v1.3