diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-03-29 00:45:30 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-04-04 13:35:14 +0300 |
commit | dd973d03bf5f3f439dcdacbb22470105e66e698a (patch) | |
tree | 6856ab313c75f3459df80511c98d3f788bf1c22b /tests/buildtab/driver.cxx | |
parent | c72bbd5d04084547c53e9593af4d76d9e5135a53 (diff) |
Implement manifests and build_config
Diffstat (limited to 'tests/buildtab/driver.cxx')
-rw-r--r-- | tests/buildtab/driver.cxx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/buildtab/driver.cxx b/tests/buildtab/driver.cxx new file mode 100644 index 0000000..c3e3a60 --- /dev/null +++ b/tests/buildtab/driver.cxx @@ -0,0 +1,48 @@ +// file : tests/buildtab/driver.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include <ios> // ios::failbit, ios::badbit +#include <cassert> +#include <iostream> + +#include <butl/utility> // operator<<(ostream,exception) + +#include <bbot/build-config> + +using namespace std; +using namespace butl; +using namespace bbot; + +// Usage: argv[0] +// +// Read and parse buildtab from STDIN and serialize the resulted build +// configuration to STDOUT. +// +int +main () +try +{ + cin.exceptions (ios::failbit | ios::badbit); + cout.exceptions (ios::failbit | ios::badbit); + + for (const auto& c: parse_buildtab (cin, "cin")) + { + cout << c.machine_pattern << ' ' << c.name; + + if (c.target) + cout << ' ' << *c.target; + + for (const auto& v: c.vars) + cout << ' ' << v; + + cout << '\n'; + } + + return 0; +} +catch (const tab_parsing& e) +{ + cerr << e << endl; + return 1; +} |