diff options
Diffstat (limited to 'subprojects/packagefiles/janus')
| -rw-r--r-- | subprojects/packagefiles/janus/compiler_warnings.diff | 40 | ||||
| -rw-r--r-- | subprojects/packagefiles/janus/meson.build | 5 | ||||
| -rw-r--r-- | subprojects/packagefiles/janus/wparse.diff | 32 |
3 files changed, 77 insertions, 0 deletions
diff --git a/subprojects/packagefiles/janus/compiler_warnings.diff b/subprojects/packagefiles/janus/compiler_warnings.diff new file mode 100644 index 0000000..a5f07c1 --- /dev/null +++ b/subprojects/packagefiles/janus/compiler_warnings.diff @@ -0,0 +1,40 @@ +diff --git a/src/janus.cpp b/src/janus.cpp +index d1ee260..d3f4cee 100644 +--- a/src/janus.cpp ++++ b/src/janus.cpp +@@ -21,10 +21,10 @@ using namespace janus; + static int tryStringToInt(string const& arg) { + try { + return stoi(arg); +- } catch (invalid_argument) { ++ } catch (std::invalid_argument const&) { + cerr << "Error: cannot parse '" << arg << "' as an integer.\n"; + exit(1); +- } catch (out_of_range) { ++ } catch (std::out_of_range const&) { + cerr << "Error: " << arg << " is out of range.\n"; + exit(1); + } +@@ -34,11 +34,11 @@ static int tryStringToInt(string const& arg) { + static double tryStringToDouble(string const& arg) { + try { + return stod(arg); +- } catch (invalid_argument) { ++ } catch (std::invalid_argument const&) { + cerr << "Error: cannot parse '" << arg << "' "; + cerr << "as a floating-point value.\n"; + exit(1); +- } catch (out_of_range) { ++ } catch (std::out_of_range const&) { + cerr << "Error: " << arg << " is out of range.\n"; + exit(1); + } +@@ -219,6 +219,8 @@ int ArgParser::lenList(string const& name) { + return options[name]->ints.size(); + case OptionType::Double: + return options[name]->doubles.size(); ++ default: ++ return -1; + } + } + diff --git a/subprojects/packagefiles/janus/meson.build b/subprojects/packagefiles/janus/meson.build new file mode 100644 index 0000000..abbea21 --- /dev/null +++ b/subprojects/packagefiles/janus/meson.build @@ -0,0 +1,5 @@ +project('janus', 'cpp', version: '0.7.0') + +janus_inc = include_directories('./src') +janus_lib = static_library('janus', 'src/janus.cpp', include_directories: janus_inc) +janus = declare_dependency(link_with: janus_lib, include_directories: janus_inc) diff --git a/subprojects/packagefiles/janus/wparse.diff b/subprojects/packagefiles/janus/wparse.diff new file mode 100644 index 0000000..f3034df --- /dev/null +++ b/subprojects/packagefiles/janus/wparse.diff @@ -0,0 +1,32 @@ +diff --git a/src/janus.cpp b/src/janus.cpp +index d1ee260..a303b30 100644 +--- a/src/janus.cpp ++++ b/src/janus.cpp +@@ -534,6 +536,15 @@ void ArgParser::parse(int argc, char **argv) { + parse(stream); + } + ++void ArgParser::wparse(int argc, wchar_t **argv) { ++ ArgStream stream; ++ for (int i = 1; i < argc; i++) { ++ wstring ws(argv[i]); ++ stream.append(string(ws.begin(), ws.end())); ++ } ++ parse(stream); ++} ++ + + // ----------------------------------------------------------------------------- + // ArgParser: utilities. +diff --git a/src/janus.h b/src/janus.h +index 37bd956..a049b72 100644 +--- a/src/janus.h ++++ b/src/janus.h +@@ -46,6 +46,7 @@ namespace janus { + + // Parse command line arguments. + void parse(int argc, char **argv); ++ void wparse(int argc, wchar_t **argv); + + // Returns true if the named option was found while parsing. + bool found(std::string const& name); |