summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-12 16:30:50 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-12 16:30:50 +0000
commit03f7a9976b388e476f2850c33f22cc63572f6a48 (patch)
tree212211aed9deabbdb3b4aabe5c95343e84e0bb28
parentdd35a6706a756677ff1c2734a6eb2fad8a6784fb (diff)
downloadmandoc-03f7a9976b388e476f2850c33f22cc63572f6a48.tar.gz
Added -nested (doesn't do anything).
Added .%C. .Cd is now callable. Added .Rv -std.
-rw-r--r--Makefile2
-rw-r--r--action.c13
-rw-r--r--argv.c22
-rw-r--r--macro.c5
-rw-r--r--mdoc.319
-rw-r--r--mdoc.c8
-rw-r--r--mdoc.h6
-rw-r--r--term.c2
-rw-r--r--validate.c12
9 files changed, 53 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index ef4dd5c5..142bc452 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
.SUFFIXES: .html .sgml
-VERSION = 1.4.11
+VERSION = 1.4.12
VDATE = 13 March 2009
BINDIR = $(PREFIX)/bin
diff --git a/action.c b/action.c
index 6fb82841..882d8852 100644
--- a/action.c
+++ b/action.c
@@ -59,7 +59,7 @@ static int post_dt(struct mdoc *);
static int post_nm(struct mdoc *);
static int post_os(struct mdoc *);
static int post_sh(struct mdoc *);
-static int post_ex(struct mdoc *);
+static int post_std(struct mdoc *);
static int post_prologue(struct mdoc *);
const struct actions mdoc_actions[MDOC_MAX] = {
@@ -85,7 +85,7 @@ const struct actions mdoc_actions[MDOC_MAX] = {
{ NULL }, /* Dv */
{ NULL }, /* Er */
{ NULL }, /* Ev */
- { post_ex }, /* Ex */
+ { post_std }, /* Ex */
{ NULL }, /* Fa */
{ NULL }, /* Fd */
{ NULL }, /* Fl */
@@ -99,7 +99,7 @@ const struct actions mdoc_actions[MDOC_MAX] = {
{ NULL }, /* Op */
{ NULL }, /* Ot */
{ NULL }, /* Pa */
- { NULL }, /* Rv */
+ { post_std }, /* Rv */
{ NULL }, /* St */
{ NULL }, /* Va */
{ NULL }, /* Vt */
@@ -177,6 +177,7 @@ const struct actions mdoc_actions[MDOC_MAX] = {
{ NULL }, /* Brq */
{ NULL }, /* Bro */
{ NULL }, /* Brc */
+ { NULL }, /* %C */
};
@@ -228,12 +229,12 @@ nwarn(struct mdoc *m, const struct mdoc_node *n, enum mwarn type)
static int
-post_ex(struct mdoc *mdoc)
+post_std(struct mdoc *mdoc)
{
/*
- * If `.Ex -std' is invoked without an argument, fill it in with
- * our name (if it's been set).
+ * If '-std' is invoked without an argument, fill it in with our
+ * name (if it's been set).
*/
if (NULL == mdoc->last->args)
diff --git a/argv.c b/argv.c
index 1742e1cb..7228e5f4 100644
--- a/argv.c
+++ b/argv.c
@@ -94,10 +94,11 @@ static int mdoc_argvflags[MDOC_ARG_MAX] = {
ARGV_MULTI, /* MDOC_Column */
ARGV_SINGLE, /* MDOC_Width */
ARGV_NONE, /* MDOC_Compact */
- ARGV_SINGLE, /* MDOC_Std */
+ ARGV_OPT_SINGLE, /* MDOC_Std */
ARGV_NONE, /* MDOC_Filled */
ARGV_NONE, /* MDOC_Words */
ARGV_NONE, /* MDOC_Emphasis */
+ ARGV_NONE, /* MDOC_Symbolic */
ARGV_NONE /* MDOC_Symbolic */
};
@@ -216,6 +217,7 @@ static int mdoc_argflags[MDOC_MAX] = {
ARGS_DELIM, /* Brq */
0, /* Bro */
ARGS_DELIM, /* Brc */
+ ARGS_QUOTED, /* %C */
};
@@ -735,6 +737,8 @@ argv_a2arg(int tok, const char *argv)
return(MDOC_Offset);
else if (xstrcmp(argv, "compact"))
return(MDOC_Compact);
+ else if (xstrcmp(argv, "nested"))
+ return(MDOC_Nested);
break;
case (MDOC_Rv):
@@ -840,25 +844,11 @@ static int
argv(struct mdoc *mdoc, int tok, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
- int fl;
v->sz = 0;
v->value = NULL;
- fl = mdoc_argvflags[v->arg];
- /*
- * Override the default per-argument value.
- */
-
- switch (tok) {
- case (MDOC_Ex):
- fl = ARGV_OPT_SINGLE;
- break;
- default:
- break;
- }
-
- switch (fl) {
+ switch (mdoc_argvflags[v->arg]) {
case (ARGV_SINGLE):
return(argv_single(mdoc, line, v, pos, buf));
case (ARGV_MULTI):
diff --git a/macro.c b/macro.c
index e8f0ee43..9e4a13fb 100644
--- a/macro.c
+++ b/macro.c
@@ -89,7 +89,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Ad */
{ macro_text, MDOC_PARSED }, /* An */
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Ar */
- { macro_constant, 0 }, /* Cd */
+ { macro_constant, MDOC_CALLABLE }, /* Cd */
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Cm */
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Dv */
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Er */
@@ -188,6 +188,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Brq */
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Bro */
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Brc */
+ { macro_constant, 0 }, /* %C */
};
const struct mdoc_macro * const mdoc_macros = __mdoc_macros;
@@ -1393,8 +1394,6 @@ macro_constant(MACRO_PROT_ARGS)
struct mdoc_arg *arg;
char *p;
- assert( ! (MDOC_CALLABLE & mdoc_macros[tok].flags));
-
arg = NULL;
for (;;) {
diff --git a/mdoc.3 b/mdoc.3
index 12a4ce6b..ca8e86cf 100644
--- a/mdoc.3
+++ b/mdoc.3
@@ -375,6 +375,10 @@ systems is in progress.
.Bl -bullet
.\" LIST-ITEM
.It
+.Sq \&Cd
+isn't labelled as callable but is.
+.\" LIST-ITEM
+.It
NetBSD
.Sq \&It \-nested
is assumed for all lists: any list may be nested and
@@ -391,6 +395,21 @@ of proceeded), is not supported.
The
.Sq \&At
macro only accepts a single parameter.
+.\" LIST-ITEM
+.It
+Some manuals use
+.Sq \&Li
+incorrectly by following it with a delimeter (see
+.Xr mdoc.samples 7 )
+and expecting the delimiter to render. This is not supported.
+.\" LIST-ITEM
+.It
+The
+.Sq Bx
+family of macros (
+.Sq Ux ,
+.Sq Nx
+and so on) are not callable as they are in NetBSD.
.El
.\" SECTION
.Sh SEE ALSO
diff --git a/mdoc.c b/mdoc.c
index 72e63a1c..aaee0efa 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -73,7 +73,8 @@ const char *const __mdoc_macronames[MDOC_MAX] = {
"Bk", "Ek", "Bt", "Hf",
"Fr", "Ud", "Lb", "Ap",
"Lp", "Lk", "Mt", "Brq",
- "Bro", "Brc"
+ /* LINTED */
+ "Bro", "Brc", "\%C"
};
const char *const __mdoc_argnames[MDOC_ARG_MAX] = {
@@ -85,7 +86,7 @@ const char *const __mdoc_argnames[MDOC_ARG_MAX] = {
"ohang", "inset", "column",
"width", "compact", "std",
"filled", "words", "emphasis",
- "symbolic"
+ "symbolic", "nested"
};
const char * const *mdoc_macronames = __mdoc_macronames;
@@ -257,7 +258,8 @@ mdoc_macro(struct mdoc *m, int tok,
"disallowed in prologue"));
if (1 != pp && ! (MDOC_CALLABLE & mdoc_macros[tok].flags))
- return(mdoc_perr(m, ln, pp, "not callable"));
+ return(mdoc_perr(m, ln, pp, "%s not callable",
+ mdoc_macronames[tok]));
return((*mdoc_macros[tok].fp)(m, tok, ln, pp, pos, buf));
}
diff --git a/mdoc.h b/mdoc.h
index 42a55e07..9e6a6c13 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -147,7 +147,8 @@
#define MDOC_Brq 111
#define MDOC_Bro 112
#define MDOC_Brc 113
-#define MDOC_MAX 114
+#define MDOC__C 114
+#define MDOC_MAX 115
/* What follows is a list of ALL possible macro arguments. */
@@ -176,7 +177,8 @@
#define MDOC_Words 22
#define MDOC_Emphasis 23
#define MDOC_Symbolic 24
-#define MDOC_ARG_MAX 25
+#define MDOC_Nested 25
+#define MDOC_ARG_MAX 26
/* Warnings are either syntax or groff-compatibility. */
enum mdoc_warn {
diff --git a/term.c b/term.c
index e40dbb8a..b54db3dd 100644
--- a/term.c
+++ b/term.c
@@ -295,6 +295,7 @@ const struct termact __termacts[MDOC_MAX] = {
{ termp_brq_pre, termp_brq_post }, /* Brq */
{ termp_brq_pre, termp_brq_post }, /* Bro */
{ NULL, NULL }, /* Brc */
+ { NULL, NULL }, /* %C */
};
const struct termact *termacts = __termacts;
@@ -838,6 +839,7 @@ termp_rv_pre(DECL_ARGS)
p->flags |= ttypes[TTYPE_FUNC_NAME];
word(p, *node->args->argv[i].value);
p->flags &= ~ttypes[TTYPE_FUNC_NAME];
+ p->flags |= TERMP_NOSPACE;
word(p, "() function returns the value 0 if successful;");
word(p, "otherwise the value -1 is returned and the");
diff --git a/validate.c b/validate.c
index e453352f..dd834db3 100644
--- a/validate.c
+++ b/validate.c
@@ -139,10 +139,10 @@ static int ewarn_ge1(POST_ARGS);
static int ebool(POST_ARGS);
static int post_an(POST_ARGS);
+static int post_args(POST_ARGS);
static int post_at(POST_ARGS);
static int post_bf(POST_ARGS);
static int post_bl(POST_ARGS);
-static int post_ex(POST_ARGS);
static int post_it(POST_ARGS);
static int post_nm(POST_ARGS);
static int post_root(POST_ARGS);
@@ -183,7 +183,8 @@ static v_post posts_lb[] = { eerr_eq1, NULL };
static v_post posts_mt[] = { eerr_ge1, NULL };
static v_post posts_st[] = { eerr_eq1, post_st, NULL };
static v_post posts_pp[] = { ewarn_eq0, NULL };
-static v_post posts_ex[] = { eerr_eq0, post_ex, NULL };
+static v_post posts_ex[] = { eerr_eq0, post_args, NULL };
+static v_post posts_rv[] = { eerr_eq0, post_args, NULL };
static v_post posts_an[] = { post_an, NULL };
static v_post posts_at[] = { post_at, NULL };
static v_post posts_xr[] = { eerr_ge1, eerr_le2, NULL };
@@ -232,7 +233,7 @@ const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, posts_wline }, /* Op */
{ NULL, NULL }, /* Ot */
{ NULL, NULL }, /* Pa */
- { pres_rv, posts_notext }, /* Rv */
+ { pres_rv, posts_rv }, /* Rv */
{ NULL, posts_st }, /* St */
{ NULL, posts_text }, /* Va */
{ NULL, posts_text }, /* Vt */
@@ -310,6 +311,7 @@ const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, posts_wline }, /* Brq */
{ NULL, NULL }, /* Bro */
{ NULL, NULL }, /* Brc */
+ { NULL, posts_text }, /* %C */
};
@@ -669,7 +671,7 @@ check_argv(struct mdoc *m, const struct mdoc_node *n,
if ( ! check_text(m, v->line, v->pos, v->value[i]))
return(0);
- if (MDOC_Std == v->arg && MDOC_Ex == n->tok) {
+ if (MDOC_Std == v->arg) {
/* `Nm' name must be set. */
if (v->sz || m->meta.name)
return(1);
@@ -1084,7 +1086,7 @@ post_an(POST_ARGS)
static int
-post_ex(POST_ARGS)
+post_args(POST_ARGS)
{
if (mdoc->last->args)