From 6f6c10491ce0e973fe8328508fe2a232c2189016 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 4 Oct 2009 14:18:38 +0200 Subject: Move runtime inline function to inline file --- cli/runtime-inline.cxx | 107 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 cli/runtime-inline.cxx (limited to 'cli/runtime-inline.cxx') diff --git a/cli/runtime-inline.cxx b/cli/runtime-inline.cxx new file mode 100644 index 0000000..9c33c2e --- /dev/null +++ b/cli/runtime-inline.cxx @@ -0,0 +1,107 @@ +// file : cli/runtime-inline.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include "runtime-inline.hxx" + +using namespace std; + +void +generate_runtime_inline (context& ctx) +{ + ostream& os (ctx.os); + string const& inl (ctx.inl); + + os << "namespace cli" + << "{"; + + os << "// unknown_mode" << endl + << "//" << endl; + + os << inl << "unknown_mode::" << endl + << "unknown_mode (value v)" << endl + << ": v_ (v)" + << "{" + << "}"; + + os << "// exception" << endl + << "//" << endl; + + os << inl << "std::ostream&" << endl + << "operator<< (std::ostream& os, const exception& e)" + << "{" + << "e.print (os);" + << "return os;" + << "}"; + + os << "// unknown_option" << endl + << "//" << endl; + + os << inl << "unknown_option::" << endl + << "unknown_option (const std::string& option)" << endl + << ": option_ (option)" + << "{" + << "}"; + + os << inl << "const std::string& unknown_option::" << endl + << "option () const" + << "{" + << "return option_;" + << "}"; + + os << "// unknown_argument" << endl + << "//" << endl; + + os << inl << "unknown_argument::" << endl + << "unknown_argument (const std::string& argument)" << endl + << ": argument_ (argument)" + << "{" + << "}"; + + os << inl << "const std::string& unknown_argument::" << endl + << "argument () const" + << "{" + << "return argument_;" + << "}"; + + os << "// missing_value" << endl + << "//" << endl; + + os << inl << "missing_value::" << endl + << "missing_value (const std::string& option)" << endl + << ": option_ (option)" + << "{" + << "}"; + + os << inl << "const std::string& missing_value::" << endl + << "option () const" + << "{" + << "return option_;" + << "}"; + + os << "// invalid_value" << endl + << "//" << endl; + + os << inl << "invalid_value::" << endl + << "invalid_value (const std::string& option," << endl + << "const std::string& value)" << endl + << ": option_ (option)," + << " value_ (value)" + << "{" + << "}"; + + os << inl << "const std::string& invalid_value::" << endl + << "option () const" + << "{" + << "return option_;" + << "}"; + + os << inl << "const std::string& invalid_value::" << endl + << "value () const" + << "{" + << "return value_;" + << "}"; + + os << "}"; // namespace cli +} -- cgit v1.1