diff options
author | John Hodge (bugs) <tpg@mutabah.net> | 2017-02-25 22:24:40 +0800 |
---|---|---|
committer | John Hodge (bugs) <tpg@mutabah.net> | 2017-02-25 22:24:40 +0800 |
commit | 03addc877bab648ccde022edec29f5b051ce7cb9 (patch) | |
tree | 51089cf2abbda1d48a7105da1cb18ec84f2f4590 /src/main.cpp | |
parent | 12c012c69235fd90c855881f2c07c91dbb052635 (diff) | |
download | mrust-03addc877bab648ccde022edec29f5b051ce7cb9.tar.gz |
Add visual studio project files, little tweaks to codebase to allow compiling on visual studio (not complete)
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/main.cpp b/src/main.cpp index 3eb385f7..4c8d3104 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -239,19 +239,18 @@ int main(int argc, char *argv[]) crate_name = ::std::string(params.infile.begin() + s, params.infile.begin() + e); for(auto& b : crate_name) { - switch(b) - { - case '0' ... '9': - case 'A' ... 'Z': - case 'a' ... 'z': - case '_': - break; - case '-': - b = '_'; - break; - default: - break; - } + if ('0' <= b && b <= '9') { + } + else if ('A' <= b && b <= 'Z') { + } + else if (b == '_') { + } + else if (b == '-') { + b = '_'; + } + else { + // TODO: Error? + } } } crate.m_crate_name = crate_name; @@ -525,12 +524,14 @@ ProgramParams::ProgramParams(int argc, char *argv[]) if( arg[0] != '-' ) { - if( this->infile != "" ) - ; - this->infile = arg; - - if( this->infile == "" ) - ; + if (this->infile == "") + { + this->infile = arg; + } + else + { + // TODO: Error + } } else if( arg[1] != '-' ) { @@ -593,14 +594,15 @@ ProgramParams::ProgramParams(int argc, char *argv[]) } this->crate_path = argv[++i]; } - else if( strcmp(arg, "--out-dir") == 0 ) { - if( i == argc - 1 ) { - ::std::cerr << "Flag " << arg << " requires an argument" << ::std::endl; - exit(1); - } - this->output_dir = argv[++i]; - if( this->output_dir == "" ) - ; + else if (strcmp(arg, "--out-dir") == 0) { + if (i == argc - 1) { + ::std::cerr << "Flag " << arg << " requires an argument" << ::std::endl; + exit(1); + } + this->output_dir = argv[++i]; + if (this->output_dir == "") { + // TODO: Error? + } if( this->output_dir.back() != '/' ) this->output_dir += '/'; } |