summaryrefslogtreecommitdiff
path: root/cli/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-11-17 13:59:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-11-17 13:59:39 +0200
commit0e56fe29a9afeee00e02e722496678df89d37d50 (patch)
treeada5f6ea6978344f2e75e6194d65a1191cc6e649 /cli/context.cxx
parent577a38358b295379511ea8bb130ef1dcb7157c0f (diff)
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.
Diffstat (limited to 'cli/context.cxx')
-rw-r--r--cli/context.cxx79
1 files changed, 74 insertions, 5 deletions
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 += "</code>";
+ r += "'";
+ break;
+ }
+ case ot_html:
+ {
+ if (b & 4)
+ r += "</b>";
if (b & 2)
r += "</i>";
- if (b & 4)
- r += "</b>";
+ if (b & 1)
+ r += "</code>";
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<cli_unit*> (&n))
+ {
+ return ""; // Map to global namespace.
+ }
+ else
+ {
+ r = fq_name (n.scope ());
+ r += "::";
+ r += cxx_name ? escape (n.name ()) : n.name ();
+ }
+
+ return r;
+}
+
// namespace
//