From 037ad0360056ec38eda1b3b8a74cd3ae4371630f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 21 Jul 2018 14:47:30 +0200 Subject: Add binding support executable stub for manifest parsing --- libbutl/manifest.cxx | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 libbutl/manifest.cxx (limited to 'libbutl/manifest.cxx') 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 +#include + +#include +#include +#include + +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; +} -- cgit v1.1