diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-07-21 14:47:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-07-21 14:47:30 +0200 |
commit | 037ad0360056ec38eda1b3b8a74cd3ae4371630f (patch) | |
tree | 6d21bad6f694d8744107e2420d72660a135eda7a /libbutl/manifest.cxx | |
parent | 03ff256dc44228c9465cd2040593a72b2d084d1e (diff) |
Add binding support executable stub for manifest parsing
Diffstat (limited to 'libbutl/manifest.cxx')
-rw-r--r-- | libbutl/manifest.cxx | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/libbutl/manifest.cxx b/libbutl/manifest.cxx new file mode 100644 index 0000000..9319b71 --- /dev/null +++ b/libbutl/manifest.cxx @@ -0,0 +1,59 @@ +// file : libbutl/manifest.cxx +// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include <string> +#include <iostream> + +#include <libbutl/utility.mxx> +#include <libbutl/manifest-parser.mxx> +#include <libbutl/manifest-serializer.mxx> + +using namespace std; +using namespace butl; + +static int +cmd_parse () +{ + //@@ TODO + + const char m[] = + ":1\0" + "name:foo\0" + "version:1.2.3\0" + "description:foo\nexecutable\0" + "depends:libfoo\0" + "depends:libbar"; // Last \0 will be added. + + cout.write (m, sizeof (m)); + + return 0; +} + +static int +cmd_serialize () +{ + //@@ TODO + + return 0; +} + +int +main (int argc, char* argv[]) +{ + // We should switch to CLI if we need anything more elaborate. + // + if (argc < 2) + { + cerr << "error: missing command" << endl; + return 1; + } + + string c (argv[1]); + + if (c == "parse") return cmd_parse (); + if (c == "serialize") return cmd_serialize (); + + cerr << "error: unknown command '" << c << "'" << endl; + return 1; +} |