From 0e56fe29a9afeee00e02e722496678df89d37d50 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 17 Nov 2009 13:59:39 +0200 Subject: Complete the implementation of the option documentation Add the man page generator. Port CLI usage, HTML documentation and the man page to the auto-generated version. Update examples and documentation. --- cli/context.cxx | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 5 deletions(-) (limited to 'cli/context.cxx') diff --git a/cli/context.cxx b/cli/context.cxx index ccd3c8b..05e15cc 100644 --- a/cli/context.cxx +++ b/cli/context.cxx @@ -309,7 +309,19 @@ format (string const& s, output_type ot) { case '\\': { - r += '\\'; + switch (ot) + { + case ot_man: + { + r += "\\e"; + break; + } + default: + { + r += '\\'; + break; + } + } break; } case '"': @@ -461,6 +473,12 @@ format (string const& s, output_type ot) switch (ot) { + case ot_plain: + { + if (b & 1) + r += "'"; + break; + } case ot_html: { if (b & 1) @@ -474,6 +492,17 @@ format (string const& s, output_type ot) break; } + case ot_man: + { + if ((b & 6) == 6) + r += "\\f(BI"; + else if (b & 2) + r += "\\fI"; + else if (b & 4) + r += "\\fB"; + + break; + } default: break; } @@ -490,6 +519,7 @@ format (string const& s, output_type ot) switch (ot) { case ot_plain: + case ot_man: { r += '\n'; break; @@ -506,25 +536,43 @@ format (string const& s, output_type ot) } } } + else if (s[i] == '.') + { + if (ot == ot_man) + r += "\\."; + else + r += '.'; + } else if (!blocks.empty () && s[i] == '}') { unsigned char b (blocks.top ()); switch (ot) { - case ot_html: + case ot_plain: { if (b & 1) - r += ""; + r += "'"; + break; + } + case ot_html: + { + if (b & 4) + r += ""; if (b & 2) r += ""; - if (b & 4) - r += ""; + if (b & 1) + r += ""; break; } + case ot_man: + { + if (b & 6) + r += "\\fP"; + } default: break; } @@ -541,6 +589,27 @@ format (string const& s, output_type ot) return r; } +string context:: +fq_name (semantics::nameable& n, bool cxx_name) +{ + using namespace semantics; + + string r; + + if (dynamic_cast (&n)) + { + return ""; // Map to global namespace. + } + else + { + r = fq_name (n.scope ()); + r += "::"; + r += cxx_name ? escape (n.name ()) : n.name (); + } + + return r; +} + // namespace // -- cgit v1.1