summaryrefslogtreecommitdiffstatshomepage
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
commit073b729fad16967c5cb97cb3aa314b058e3de113 (patch)
tree7226a621aa8e2d22ab5af821cfdf34cc7b017ba9
parent58ec1de730c493d7dac46e9e8c77b5551fcc8df3 (diff)
downloadmandoc-073b729fad16967c5cb97cb3aa314b058e3de113.tar.gz
mandoc-073b729fad16967c5cb97cb3aa314b058e3de113.tar.zst
mandoc-073b729fad16967c5cb97cb3aa314b058e3de113.zip
Added -nested (doesn't do anything).
Added .%C. .Cd is now callable. Added .Rv -std.
-rw-r--r--Makefile2
-rw-r--r--action.c15
-rw-r--r--argv.c24
-rw-r--r--macro.c7
-rw-r--r--mdoc.321
-rw-r--r--mdoc.c10
-rw-r--r--mdoc.h8
-rw-r--r--term.c4
-rw-r--r--validate.c14
9 files changed, 61 insertions, 44 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 9fc1d2d0..c50cc7c1 100644
--- a/action.c
+++ b/action.c
@@ -1,4 +1,4 @@
-/* $Id: action.c,v 1.40 2009/03/11 00:39:58 kristaps Exp $ */
+/* $Id: action.c,v 1.41 2009/03/12 16:30:50 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 dcef1b26..fa9f5cf5 100644
--- a/argv.c
+++ b/argv.c
@@ -1,4 +1,4 @@
-/* $Id: argv.c,v 1.49 2009/03/12 02:57:35 kristaps Exp $ */
+/* $Id: argv.c,v 1.50 2009/03/12 16:30:50 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 5920d2ef..20aac15b 100644
--- a/macro.c
+++ b/macro.c
@@ -1,4 +1,4 @@
-/* $Id: macro.c,v 1.69 2009/03/12 06:38:22 kristaps Exp $ */
+/* $Id: macro.c,v 1.70 2009/03/12 16:30:50 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 d6e6d30d..ec6b2ef1 100644
--- a/mdoc.3
+++ b/mdoc.3
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.3,v 1.14 2009/03/12 15:55:11 kristaps Exp $
+.\" $Id: mdoc.3,v 1.15 2009/03/12 16:30:50 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -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 719434ae..880888de 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.63 2009/03/12 15:55:11 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.64 2009/03/12 16:30:50 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 73d6b284..0803dd0c 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.46 2009/03/11 00:39:58 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.47 2009/03/12 16:30:50 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 3730968b..4ee182e9 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.56 2009/03/12 15:55:11 kristaps Exp $ */
+/* $Id: term.c,v 1.57 2009/03/12 16:30:50 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 a6f37ee1..08032b66 100644
--- a/validate.c
+++ b/validate.c
@@ -1,4 +1,4 @@
-/* $Id: validate.c,v 1.81 2009/03/12 06:32:17 kristaps Exp $ */
+/* $Id: validate.c,v 1.82 2009/03/12 16:30:50 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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)