summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/usr.bin/mandoc/roff/Makefile4
-rw-r--r--regress/usr.bin/mandoc/roff/de/Dd.in11
-rw-r--r--regress/usr.bin/mandoc/roff/de/Dd.out_ascii9
-rw-r--r--regress/usr.bin/mandoc/roff/de/Dd.out_ascii_opt9
-rw-r--r--regress/usr.bin/mandoc/roff/de/Makefile41
-rw-r--r--regress/usr.bin/mandoc/roff/de/TH.in8
-rw-r--r--regress/usr.bin/mandoc/roff/de/TH.out_ascii13
-rw-r--r--regress/usr.bin/mandoc/roff/de/TH.out_ascii_opt13
-rw-r--r--usr.bin/mandoc/libmandoc.h4
-rw-r--r--usr.bin/mandoc/read.c4
-rw-r--r--usr.bin/mandoc/roff.c69
11 files changed, 177 insertions, 8 deletions
diff --git a/regress/usr.bin/mandoc/roff/Makefile b/regress/usr.bin/mandoc/roff/Makefile
index 9bd19806a52..0bdfeb1d61e 100644
--- a/regress/usr.bin/mandoc/roff/Makefile
+++ b/regress/usr.bin/mandoc/roff/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.9 2012/05/28 13:00:51 schwarze Exp $
+# $OpenBSD: Makefile,v 1.10 2012/06/02 23:18:31 schwarze Exp $
-SUBDIR+= args esc cond string br na ps rm sp
+SUBDIR+= args esc cond string br de na ps rm sp
ascii groff groff-clean obj-clean tman: _SUBDIRUSE
diff --git a/regress/usr.bin/mandoc/roff/de/Dd.in b/regress/usr.bin/mandoc/roff/de/Dd.in
new file mode 100644
index 00000000000..4dcbdd2bfcf
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/de/Dd.in
@@ -0,0 +1,11 @@
+.de At
+BSD
+..
+.Dd June 3, 2012
+.Dt DE-DD 1
+.Os OpenBSD
+.Sh NAME
+.Nm de-Dd
+.Nd interaction of the Dd macro with de requests
+.Sh DESCRIPTION
+.At
diff --git a/regress/usr.bin/mandoc/roff/de/Dd.out_ascii b/regress/usr.bin/mandoc/roff/de/Dd.out_ascii
new file mode 100644
index 00000000000..b0dedeaf09d
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/de/Dd.out_ascii
@@ -0,0 +1,9 @@
+DE-DD(1) OpenBSD Reference Manual DE-DD(1)
+
+NNAAMMEE
+ ddee--DDdd - interaction of the Dd macro with de requests
+
+DDEESSCCRRIIPPTTIIOONN
+ AT&T UNIX
+
+OpenBSD June 3, 2012 OpenBSD
diff --git a/regress/usr.bin/mandoc/roff/de/Dd.out_ascii_opt b/regress/usr.bin/mandoc/roff/de/Dd.out_ascii_opt
new file mode 100644
index 00000000000..7d388cca414
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/de/Dd.out_ascii_opt
@@ -0,0 +1,9 @@
+DE-DD(1) OpenBSD Reference Manual DE-DD(1)
+
+NNAAMMEE
+ ddee--DDdd - interaction of the Dd macro with de requests
+
+DDEESSCCRRIIPPTTIIOONN
+ BSD
+
+OpenBSD June 3, 2012 OpenBSD
diff --git a/regress/usr.bin/mandoc/roff/de/Makefile b/regress/usr.bin/mandoc/roff/de/Makefile
new file mode 100644
index 00000000000..2f3262bce36
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/de/Makefile
@@ -0,0 +1,41 @@
+# $OpenBSD: Makefile,v 1.1 2012/06/02 23:18:31 schwarze Exp $
+
+REGRESS_TARGETS=TH Dd
+
+.include <bsd.regress.mk>
+
+
+# --- additions to public targets ---
+
+all ascii: ascii-diff-opt
+
+ascii-clean: ascii-clean-opt
+
+groff: TH.out_ascii_opt Dd.out_ascii_opt
+
+groff-clean: groff-clean-opt
+
+
+# --- local rules ---
+
+ascii-diff-opt: TH.mandoc_ascii_opt Dd.mandoc_ascii_opt
+ ${DIFF} ${.CURDIR}/TH.out_ascii_opt TH.mandoc_ascii_opt
+ ${DIFF} ${.CURDIR}/Dd.out_ascii_opt Dd.mandoc_ascii_opt
+
+TH.mandoc_ascii_opt: TH.in
+ ${MANDOC} -man ${.ALLSRC} > ${.TARGET}
+
+Dd.mandoc_ascii_opt: Dd.in
+ ${MANDOC} -mdoc ${.ALLSRC} > ${.TARGET}
+
+ascii-clean-opt:
+ rm -f TH.mandoc_ascii_opt Dd.mandoc_ascii_opt
+
+TH.out_ascii_opt: TH.in
+ /usr/local/bin/nroff -c -man -Tascii ${.ALLSRC} > ${.TARGET}
+
+Dd.out_ascii_opt: Dd.in
+ /usr/local/bin/nroff -c -mdoc -Tascii ${.ALLSRC} > ${.TARGET}
+
+groff-clean-opt:
+ rm -f TH.out_ascii_opt Dd.out_ascii_opt
diff --git a/regress/usr.bin/mandoc/roff/de/TH.in b/regress/usr.bin/mandoc/roff/de/TH.in
new file mode 100644
index 00000000000..50b6401f922
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/de/TH.in
@@ -0,0 +1,8 @@
+.de BI
+.IB \\$1 \\$2 \\$3
+..
+.TH DE-TH 1 "June 3, 2012" OpenBSD
+.SH NAME
+de-TH - interaction of the TH macro with de requests
+.SH DESCRIPTION
+.BI bold italic bold
diff --git a/regress/usr.bin/mandoc/roff/de/TH.out_ascii b/regress/usr.bin/mandoc/roff/de/TH.out_ascii
new file mode 100644
index 00000000000..1623c53b741
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/de/TH.out_ascii
@@ -0,0 +1,13 @@
+DE-TH(1) OpenBSD Reference Manual DE-TH(1)
+
+
+
+NNAAMMEE
+ de-TH - interaction of the TH macro with de requests
+
+DDEESSCCRRIIPPTTIIOONN
+ bboolldd_i_t_a_l_i_cbboolldd
+
+
+
+OpenBSD June 3, 2012 DE-TH(1)
diff --git a/regress/usr.bin/mandoc/roff/de/TH.out_ascii_opt b/regress/usr.bin/mandoc/roff/de/TH.out_ascii_opt
new file mode 100644
index 00000000000..1623c53b741
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/de/TH.out_ascii_opt
@@ -0,0 +1,13 @@
+DE-TH(1) OpenBSD Reference Manual DE-TH(1)
+
+
+
+NNAAMMEE
+ de-TH - interaction of the TH macro with de requests
+
+DDEESSCCRRIIPPTTIIOONN
+ bboolldd_i_t_a_l_i_cbboolldd
+
+
+
+OpenBSD June 3, 2012 DE-TH(1)
diff --git a/usr.bin/mandoc/libmandoc.h b/usr.bin/mandoc/libmandoc.h
index a23533f0239..e438e1fe75d 100644
--- a/usr.bin/mandoc/libmandoc.h
+++ b/usr.bin/mandoc/libmandoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmandoc.h,v 1.17 2012/05/24 23:33:23 schwarze Exp $ */
+/* $Id: libmandoc.h,v 1.18 2012/06/02 23:18:30 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -68,7 +68,7 @@ int man_addspan(struct man *, const struct tbl_span *);
int man_addeqn(struct man *, const struct eqn *);
void roff_free(struct roff *);
-struct roff *roff_alloc(struct mparse *);
+struct roff *roff_alloc(enum mparset, struct mparse *);
void roff_reset(struct roff *);
enum rofferr roff_parseln(struct roff *, int,
char **, size_t *, int, int *);
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index ef726042c35..e70ff17655d 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.7 2012/05/24 23:33:23 schwarze Exp $ */
+/* $Id: read.c,v 1.8 2012/06/02 23:18:30 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -712,7 +712,7 @@ mparse_alloc(enum mparset inttype, enum mandoclevel wlevel,
curp->inttype = inttype;
curp->defos = defos;
- curp->roff = roff_alloc(curp);
+ curp->roff = roff_alloc(inttype, curp);
return(curp);
}
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 5dee1a8f32b..cc763da3bbd 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.46 2012/05/31 01:36:56 schwarze Exp $ */
+/* $Id: roff.c,v 1.47 2012/06/02 23:18:30 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -54,6 +54,8 @@ enum rofft {
ROFF_so,
ROFF_ta,
ROFF_tr,
+ ROFF_Dd,
+ ROFF_TH,
ROFF_TS,
ROFF_TE,
ROFF_T_,
@@ -98,6 +100,7 @@ struct roffkv {
};
struct roff {
+ enum mparset parsetype; /* requested parse type */
struct mparse *parse; /* parse point */
struct roffnode *last; /* leaf of stack */
enum roffrule rstack[RSTACK_MAX]; /* stack of !`ie' rules */
@@ -191,6 +194,8 @@ static void roff_setstrn(struct roffkv **, const char *,
size_t, const char *, size_t, int);
static enum rofferr roff_so(ROFF_ARGS);
static enum rofferr roff_tr(ROFF_ARGS);
+static enum rofferr roff_Dd(ROFF_ARGS);
+static enum rofferr roff_TH(ROFF_ARGS);
static enum rofferr roff_TE(ROFF_ARGS);
static enum rofferr roff_TS(ROFF_ARGS);
static enum rofferr roff_EQ(ROFF_ARGS);
@@ -230,6 +235,8 @@ static struct roffmac roffs[ROFF_MAX] = {
{ "so", roff_so, NULL, NULL, 0, NULL },
{ "ta", roff_line_ignore, NULL, NULL, 0, NULL },
{ "tr", roff_tr, NULL, NULL, 0, NULL },
+ { "Dd", roff_Dd, NULL, NULL, 0, NULL },
+ { "TH", roff_TH, NULL, NULL, 0, NULL },
{ "TS", roff_TS, NULL, NULL, 0, NULL },
{ "TE", roff_TE, NULL, NULL, 0, NULL },
{ "T&", roff_T_, NULL, NULL, 0, NULL },
@@ -240,6 +247,37 @@ static struct roffmac roffs[ROFF_MAX] = {
{ NULL, roff_userdef, NULL, NULL, 0, NULL },
};
+const char *const __mdoc_reserved[] = {
+ "Ac", "Ad", "An", "Ao", "Ap", "Aq", "Ar", "At",
+ "Bc", "Bd", "Bf", "Bk", "Bl", "Bo", "Bq",
+ "Brc", "Bro", "Brq", "Bsx", "Bt", "Bx",
+ "Cd", "Cm", "Db", "Dc", "Dd", "Dl", "Do", "Dq",
+ "Ds", "Dt", "Dv", "Dx", "D1",
+ "Ec", "Ed", "Ef", "Ek", "El", "Em", "em",
+ "En", "Eo", "Eq", "Er", "Es", "Ev", "Ex",
+ "Fa", "Fc", "Fd", "Fl", "Fn", "Fo", "Fr", "Ft", "Fx",
+ "Hf", "Ic", "In", "It", "Lb", "Li", "Lk", "Lp", "LP",
+ "Me", "Ms", "Mt", "Nd", "Nm", "No", "Ns", "Nx",
+ "Oc", "Oo", "Op", "Os", "Ot", "Ox",
+ "Pa", "Pc", "Pf", "Po", "Pp", "PP", "pp", "Pq",
+ "Qc", "Ql", "Qo", "Qq", "Or", "Rd", "Re", "Rs", "Rv",
+ "Sc", "Sf", "Sh", "SH", "Sm", "So", "Sq",
+ "Ss", "St", "Sx", "Sy",
+ "Ta", "Tn", "Ud", "Ux", "Va", "Vt", "Xc", "Xo", "Xr",
+ "%A", "%B", "%D", "%I", "%J", "%N", "%O",
+ "%P", "%Q", "%R", "%T", "%U", "%V",
+ NULL
+};
+
+const char *const __man_reserved[] = {
+ "AT", "B", "BI", "BR", "BT", "DE", "DS", "DT",
+ "EE", "EN", "EQ", "EX", "HF", "HP", "I", "IB", "IP", "IR",
+ "LP", "ME", "MT", "OP", "P", "PD", "PP", "PT",
+ "R", "RB", "RE", "RI", "RS", "SB", "SH", "SM", "SS", "SY",
+ "TE", "TH", "TP", "TQ", "TS", "T&", "UC", "UE", "UR", "YS",
+ NULL
+};
+
/* Array of injected predefined strings. */
#define PREDEFS_MAX 38
static const struct predef predefs[PREDEFS_MAX] = {
@@ -405,12 +443,13 @@ roff_free(struct roff *r)
struct roff *
-roff_alloc(struct mparse *parse)
+roff_alloc(enum mparset type, struct mparse *parse)
{
struct roff *r;
int i;
r = mandoc_calloc(1, sizeof(struct roff));
+ r->parsetype = type;
r->parse = parse;
r->rstackpos = -1;
@@ -1261,6 +1300,32 @@ roff_rm(ROFF_ARGS)
/* ARGSUSED */
static enum rofferr
+roff_Dd(ROFF_ARGS)
+{
+ const char *const *cp;
+
+ if (MPARSE_MDOC != r->parsetype)
+ for (cp = __mdoc_reserved; *cp; cp++)
+ roff_setstr(r, *cp, NULL, 0);
+
+ return(ROFF_CONT);
+}
+
+/* ARGSUSED */
+static enum rofferr
+roff_TH(ROFF_ARGS)
+{
+ const char *const *cp;
+
+ if (MPARSE_MDOC != r->parsetype)
+ for (cp = __man_reserved; *cp; cp++)
+ roff_setstr(r, *cp, NULL, 0);
+
+ return(ROFF_CONT);
+}
+
+/* ARGSUSED */
+static enum rofferr
roff_TE(ROFF_ARGS)
{