summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2008-12-06 21:10:31 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2008-12-06 21:10:31 +0000
commit390903639a9ead1a07e3f5ccee3a456031ac78d7 (patch)
tree80817df37a08faef7209bca42b0cf706aaf55750
parentba3705541383817037755d7981deb54f3cb5ac43 (diff)
downloadmandoc-390903639a9ead1a07e3f5ccee3a456031ac78d7.tar.gz
.St macros in place.
-rw-r--r--html.c9
-rw-r--r--mdocml.css4
-rw-r--r--mlg.c110
-rw-r--r--private.h3
-rw-r--r--roff.c25
-rw-r--r--roff.h10
-rw-r--r--xml.c1
7 files changed, 145 insertions, 17 deletions
diff --git a/html.c b/html.c
index 884a09e2..c1d335da 100644
--- a/html.c
+++ b/html.c
@@ -122,6 +122,8 @@ html_It_headtagname(struct md_mbuf *mbuf, struct htmlq *q,
break;
assert(n);
+
+ /* LINTED */
for (i = 0; ROFF_ARGMAX != n->argc[i] &&
i < ROFF_MAXLINEARG; i++) {
switch (n->argc[i]) {
@@ -155,6 +157,8 @@ html_It_bodytagname(struct md_mbuf *mbuf, struct htmlq *q,
break;
assert(n);
+
+ /* LINTED */
for (i = 0; ROFF_ARGMAX != n->argc[i] &&
i < ROFF_MAXLINEARG; i++) {
switch (n->argc[i]) {
@@ -249,6 +253,8 @@ html_It_blocktagname(struct md_mbuf *mbuf, struct htmlq *q,
break;
assert(n);
+
+ /* LINTED */
for (i = 0; ROFF_ARGMAX != n->argc[i] &&
i < ROFF_MAXLINEARG; i++) {
switch (n->argc[i]) {
@@ -549,6 +555,7 @@ html_inlinetagargs(struct md_mbuf *mbuf,
return(0);
if ( ! ml_nputs(mbuf, "\"", 1, res))
return(0);
+ break;
default:
break;
}
@@ -605,6 +612,7 @@ html_begintag(struct md_mbuf *mbuf, void *data,
/* TODO: argv. */
assert(argv);
+ /* LINTED */
for (i = 0; ROFF_ARGMAX != argc[i]
&& i < ROFF_MAXLINEARG; i++)
node->argc[i] = argc[i];
@@ -721,6 +729,7 @@ html_free(void *p)
assert(p);
q = (struct htmlq *)p;
+ /* LINTED */
while ((n = q->last)) {
q->last = n->parent;
free(n);
diff --git a/mdocml.css b/mdocml.css
index 8211141a..61e0bf7a 100644
--- a/mdocml.css
+++ b/mdocml.css
@@ -27,11 +27,15 @@
span.body-Fo:after { content: ')'; }
span.body-Oo:before { content: '['; }
span.body-Oo:after { content: ']'; }
+ span.inline-Va { text-decoration: underline; }
+ span.inline-Vt { text-decoration: underline; }
span.inline-Em { font-style: italic; }
span.inline-Op:before { content: '['; }
span.inline-Op:after { content: ']'; }
span.inline-Qq:before { content: '\"'; }
span.inline-Qq:after { content: '\"'; }
+ span.inline-Aq:before { content: '\3c'; }
+ span.inline-Aq:after { content: '\3e'; }
span.inline-Bq:before { content: '['; }
span.inline-Bq:after { content: ']'; }
span.inline-Dq:before { content: '\201c'; }
diff --git a/mlg.c b/mlg.c
index d5257905..068988f4 100644
--- a/mlg.c
+++ b/mlg.c
@@ -62,6 +62,7 @@ struct md_mlg {
static char *mlg_literal(int);
static char *mlg_At_literal(const char *);
+static char *mlg_St_literal(int);
static void mlg_roffmsg(void *arg, enum roffmsg,
const char *, const char *, char *);
static int mlg_roffhead(void *, const struct tm *,
@@ -75,7 +76,8 @@ static int mlg_roffout(void *, int);
static int mlg_roffblkin(void *, int, int *, char **);
static int mlg_roffblkout(void *, int);
static int mlg_roffspecial(void *, int,
- const char *, char **);
+ const char *, const int *,
+ const char **, char **);
static int mlg_roffblkheadin(void *, int,
int *, char **);
static int mlg_roffblkheadout(void *, int);
@@ -108,6 +110,94 @@ extern size_t strlcpy(char *, const char *, size_t);
static char *
+mlg_St_literal(int argc)
+{
+
+ switch (argc) {
+ case(ROFF_p1003_1_88):
+ return("IEEE Std 1003.1-1988 (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_1_90):
+ return("IEEE Std 1003.1-1990 (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_1_96):
+ return("ISO/IEC 9945-1:1996 (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_1_2001):
+ return("IEEE Std 1003.1-2001 (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_1_2004):
+ return("IEEE Std 1003.1-2004 (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_1):
+ return("IEEE Std 1003.1 (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_1b):
+ return("IEEE Std 1003.1b (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_1b_93):
+ return("IEEE Std 1003.1b-1993 (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_1c_95):
+ return("IEEE Std 1003.1c-1995 (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_1g_2000):
+ return("IEEE Std 1003.1g-2000 (&#8220;POSIX&#8221;)");
+ case(ROFF_p1003_2_92):
+ return("IEEE Std 1003.2-1992 (&#8220;POSIX.2&#8221;)");
+ case(ROFF_p1387_2_95):
+ return("IEEE Std 1387.2-1995 (&#8220;POSIX.7.2&#8221;)");
+ case(ROFF_p1003_2):
+ return("IEEE Std 1003.2 (&#8220;POSIX.2&#8221;)");
+ case(ROFF_p1387_2):
+ return("IEEE Std 1387.2 (&#8220;POSIX.7.2&#8221;)");
+ case(ROFF_isoC_90):
+ return("ISO/IEC 9899:1990 (&#8220;ISO C90&#8221;)");
+ case(ROFF_isoC_amd1):
+ return("ISO/IEC 9899/AMD1:1995 (&#8220;ISO C90&#8221;)");
+ case(ROFF_isoC_tcor1):
+ return("ISO/IEC 9899/TCOR1:1994 (&#8220;ISO C90&#8221;)");
+ case(ROFF_isoC_tcor2):
+ return("ISO/IEC 9899/TCOR2:1995 (&#8220;ISO C90&#8221;)");
+ case(ROFF_isoC_99):
+ return("ISO/IEC 9899:1999 (&#8220;ISO C99&#8221;)");
+ case(ROFF_ansiC):
+ return("ANSI X3.159-1989 (&#8220;ANSI C&#8221;)");
+ case(ROFF_ansiC_89):
+ return("ANSI X3.159-1989 (&#8220;ANSI C&#8221;)");
+ case(ROFF_ansiC_99):
+ return("ANSI/ISO/IEC 9899-1999 (&#8220;ANSI C99&#8221;)");
+ case(ROFF_ieee754):
+ return("IEEE Std 754-1985");
+ case(ROFF_iso8802_3):
+ return("ISO 8802-3: 1989");
+ case(ROFF_xpg3):
+ return("X/Open Portability Guide Issue 3 (&#8220;XPG3&#8221;)");
+ case(ROFF_xpg4):
+ return("X/Open Portability Guide Issue 4 (&#8220;XPG4&#8221;)");
+ case(ROFF_xpg4_2):
+ return("X/Open Portability Guide Issue 4.2 (&#8220;XPG4.2&#8221;)");
+ case(ROFF_xpg4_3):
+ return("X/Open Portability Guide Issue 4.3 (&#8220;XPG4.3&#8221;)");
+ case(ROFF_xbd5):
+ return("X/Open System Interface Definitions Issue 5 (&#8220;XBD5&#8221;)");
+ case(ROFF_xcu5):
+ return("X/Open Commands and Utilities Issue 5 (&#8220;XCU5&#8221;)");
+ case(ROFF_xsh5):
+ return("X/Open System Interfaces and Headers Issue 5 (&#8220;XSH5&#8221;)");
+ case(ROFF_xns5):
+ return("X/Open Networking Services Issue 5 (&#8220;XNS5&#8221;)");
+ case(ROFF_xns5_2d2_0):
+ return("X/Open Networking Services Issue 5.2 Draft 2.0 (&#8220;XNS5.2D2.0&#8221;)");
+ case(ROFF_xcurses4_2):
+ return("X/Open Curses Issue 4 Version 2 (&#8220;XCURSES4.2&#8221;)");
+ case(ROFF_susv2):
+ return("Version 2 of the Single UNIX Specification");
+ case(ROFF_susv3):
+ return("Version 3 of the Single UNIX Specification");
+ case(ROFF_svid4):
+ return("System V Interface Definition, Fourth Edition (&#8220;SVID4&#8221;)");
+ default:
+ break;
+ }
+
+ abort();
+ /* NOTREACHED */
+}
+
+
+static char *
mlg_At_literal(const char *p)
{
if (NULL == p)
@@ -468,8 +558,10 @@ mlg_rofftail(void *arg)
}
+/* ARGSUSED */
static int
-mlg_roffspecial(void *arg, int tok, const char *start, char **more)
+mlg_roffspecial(void *arg, int tok, const char *start,
+ const int *argc, const char **argv, char **more)
{
struct md_mlg *p;
@@ -499,6 +591,20 @@ mlg_roffspecial(void *arg, int tok, const char *start, char **more)
return(0);
switch (tok) {
+ case (ROFF_St):
+ assert(NULL == *argv);
+ assert(ROFF_ARGMAX != *argc);
+ if ( ! ml_puts(p->mbuf, mlg_St_literal(*argc),
+ &p->pos))
+ return(0);
+ while (*more) {
+ if ( ! ml_nputs(p->mbuf, " ", 1, &p->pos))
+ return(0);
+ if ( ! ml_putstring(p->mbuf, *more++, &p->pos))
+ return(0);
+ }
+ break;
+
case (ROFF_Xr):
if ( ! *more) {
mlg_err(p, start, start, "missing argument");
diff --git a/private.h b/private.h
index b86cf619..a6778063 100644
--- a/private.h
+++ b/private.h
@@ -261,7 +261,8 @@ struct roffcb {
int (*roffblkheadout)(void *, int);
int (*roffblkbodyin)(void *, int, int *, char **);
int (*roffblkbodyout)(void *, int);
- int (*roffspecial)(void *, int, const char *, char **);
+ int (*roffspecial)(void *, int, const char *,
+ const int *, const char **, char **);
};
struct rofftree;
diff --git a/roff.c b/roff.c
index 16962906..ab0c0170 100644
--- a/roff.c
+++ b/roff.c
@@ -92,7 +92,8 @@ static int roffparse(struct rofftree *, char *);
static int textparse(struct rofftree *, char *);
static int roffdata(struct rofftree *, int, char *);
static int roffspecial(struct rofftree *, int,
- const char *, size_t, char **);
+ const char *, const int *,
+ const char **, size_t, char **);
static int roffsetname(struct rofftree *, char **);
#ifdef __linux__
@@ -618,8 +619,9 @@ roffnode_free(struct rofftree *tree)
static int
-roffspecial(struct rofftree *tree, int tok,
- const char *start, size_t sz, char **ordp)
+roffspecial(struct rofftree *tree, int tok, const char *start,
+ const int *argc, const char **argv,
+ size_t sz, char **ordp)
{
switch (tok) {
@@ -689,8 +691,8 @@ roffspecial(struct rofftree *tree, int tok,
break;
}
- return((*tree->cb.roffspecial)
- (tree->arg, tok, tree->cur, ordp));
+ return((*tree->cb.roffspecial)(tree->arg, tok,
+ tree->cur, argc, argv, ordp));
}
@@ -987,7 +989,7 @@ roff_Ns(ROFFCALL_ARGS)
first = (*argv++ == tree->cur);
morep[0] = NULL;
- if ( ! roffspecial(tree, tok, *argv, 0, morep))
+ if ( ! roffspecial(tree, tok, *argv, NULL, NULL, 0, morep))
return(0);
while (*argv) {
@@ -1199,7 +1201,8 @@ roff_ordered(ROFFCALL_ARGS)
return(0);
if (NULL == *argv)
- return(roffspecial(tree, tok, p, 0, ordp));
+ return(roffspecial(tree, tok, p, argcp,
+ (const char **)argvp, 0, ordp));
i = 0;
while (*argv && i < ROFF_MAXLINEARG) {
@@ -1215,7 +1218,9 @@ roff_ordered(ROFFCALL_ARGS)
if (ROFF_MAX == c)
break;
- if ( ! roffspecial(tree, tok, p, (size_t)i, ordp))
+ if ( ! roffspecial(tree, tok, p, argcp,
+ (const char **)argvp,
+ (size_t)i, ordp))
return(0);
return(roffcall(tree, c, argv));
@@ -1224,7 +1229,9 @@ roff_ordered(ROFFCALL_ARGS)
assert(i != ROFF_MAXLINEARG);
ordp[i] = NULL;
- if ( ! roffspecial(tree, tok, p, (size_t)i, ordp))
+ if ( ! roffspecial(tree, tok, p, argcp,
+ (const char**)argvp,
+ (size_t)i, ordp))
return(0);
/* FIXME: error if there's stuff after the punctuation. */
diff --git a/roff.h b/roff.h
index 8de0cbb0..1e8de0a9 100644
--- a/roff.h
+++ b/roff.h
@@ -133,10 +133,10 @@ static const struct rofftok tokens[ROFF_MAX] = {
{ roff_depr, NULL, NULL, NULL, 0, ROFF_TEXT, 0 }, /* Ot */
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Pa */
{ roff_text, roffarg_Rv, NULL, NULL, 0, ROFF_TEXT, 0 }, /* Rv */
- { roff_text, roffarg_St, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* St */
- { roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Va */
- { roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Vt */ /* XXX needs arg */
- {roff_ordered, NULL, NULL, NULL, 0, ROFF_TEXT, /*XXX*/ -1 }, /* Xr */
+/*Ok*/ {roff_ordered, roffarg_St, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* St */
+/*Ok*/ { roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Va */
+/*Ok*/ { roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Vt */ /* FIXME: section/linebreak. */
+/*Ok*/ {roff_ordered, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Xr */
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED }, /* %A */
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE}, /* %B */
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, 0 }, /* %D */
@@ -150,7 +150,7 @@ static const struct rofftok tokens[ROFF_MAX] = {
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, 0 }, /* %V */
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Ac */
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Ao */
- { roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE | ROFF_LSCOPE }, /* Aq */
+/*Ok*/ { roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE | ROFF_LSCOPE }, /* Aq */
/*Ok*/ {roff_ordered, NULL, NULL, NULL, 0, ROFF_TEXT, 0 }, /* At */
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Bc */
{ roff_layout, NULL, NULL, NULL, 0, ROFF_LAYOUT, 0 }, /* Bf */ /* FIXME */
diff --git a/xml.c b/xml.c
index dd87d239..6e9c3c63 100644
--- a/xml.c
+++ b/xml.c
@@ -58,6 +58,7 @@ xml_printtagargs(struct md_mbuf *mbuf, const int *argc,
return(0);
assert(argc && argv);
+ /* LINTED */
for (res = 0, i = 0; ROFF_ARGMAX != (c = argc[i]); i++) {
if ( ! ml_nputs(mbuf, " ", 1, &res))
return(-1);