summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mandoc/att.c3
-rw-r--r--usr.bin/mandoc/main.c7
-rw-r--r--usr.bin/mandoc/man.c63
-rw-r--r--usr.bin/mandoc/man.h15
-rw-r--r--usr.bin/mandoc/man_hash.c3
-rw-r--r--usr.bin/mandoc/man_html.c55
-rw-r--r--usr.bin/mandoc/man_macro.c59
-rw-r--r--usr.bin/mandoc/man_term.c95
-rw-r--r--usr.bin/mandoc/man_validate.c43
-rw-r--r--usr.bin/mandoc/mandocdb.c47
-rw-r--r--usr.bin/mandoc/mdoc.c75
-rw-r--r--usr.bin/mandoc/mdoc.h20
-rw-r--r--usr.bin/mandoc/mdoc_argv.c13
-rw-r--r--usr.bin/mandoc/mdoc_hash.c3
-rw-r--r--usr.bin/mandoc/mdoc_html.c109
-rw-r--r--usr.bin/mandoc/mdoc_macro.c41
-rw-r--r--usr.bin/mandoc/mdoc_man.c69
-rw-r--r--usr.bin/mandoc/mdoc_term.c163
-rw-r--r--usr.bin/mandoc/mdoc_validate.c99
-rw-r--r--usr.bin/mandoc/read.c11
-rw-r--r--usr.bin/mandoc/roff.h29
-rw-r--r--usr.bin/mandoc/st.c3
-rw-r--r--usr.bin/mandoc/tree.c79
23 files changed, 566 insertions, 538 deletions
diff --git a/usr.bin/mandoc/att.c b/usr.bin/mandoc/att.c
index 9921fcd7ee6..a1cd433ae42 100644
--- a/usr.bin/mandoc/att.c
+++ b/usr.bin/mandoc/att.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: att.c,v 1.9 2014/11/28 18:57:04 schwarze Exp $ */
+/* $OpenBSD: att.c,v 1.10 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -17,6 +17,7 @@
#include <sys/types.h>
#include <string.h>
+#include "roff.h"
#include "mdoc.h"
#include "libmdoc.h"
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index b0ae7164081..05290a6adc8 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.135 2015/03/27 21:17:16 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.136 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -33,11 +33,12 @@
#include <string.h>
#include <unistd.h>
-#include "mandoc.h"
#include "mandoc_aux.h"
-#include "main.h"
+#include "mandoc.h"
+#include "roff.h"
#include "mdoc.h"
#include "man.h"
+#include "main.h"
#include "manconf.h"
#include "mansearch.h"
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index 385004f09c7..bb1b8068991 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man.c,v 1.97 2015/01/30 21:28:21 schwarze Exp $ */
+/* $OpenBSD: man.c,v 1.98 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -8,9 +8,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -25,11 +25,12 @@
#include <stdio.h>
#include <string.h>
-#include "man.h"
-#include "mandoc.h"
#include "mandoc_aux.h"
-#include "libman.h"
+#include "mandoc.h"
+#include "roff.h"
+#include "man.h"
#include "libmandoc.h"
+#include "libman.h"
const char *const __man_macronames[MAN_MAX] = {
"br", "TH", "SH", "SS",
@@ -51,7 +52,7 @@ static void man_breakscope(struct man *, enum mant);
static void man_descope(struct man *, int, int);
static void man_free1(struct man *);
static struct man_node *man_node_alloc(struct man *, int, int,
- enum man_type, enum mant);
+ enum roff_type, enum mant);
static void man_node_append(struct man *, struct man_node *);
static void man_node_free(struct man_node *);
static void man_node_unlink(struct man *,
@@ -119,7 +120,7 @@ int
man_parseln(struct man *man, int ln, char *buf, int offs)
{
- if (man->last->type != MAN_EQN || ln > man->last->line)
+ if (man->last->type != ROFFT_EQN || ln > man->last->line)
man->flags |= MAN_NEWLINE;
return (roff_getcontrol(man->roff, buf, &offs) ?
@@ -148,7 +149,7 @@ man_alloc1(struct man *man)
man->flags = 0;
man->last = mandoc_calloc(1, sizeof(struct man_node));
man->first = man->last;
- man->last->type = MAN_ROOT;
+ man->last->type = ROFFT_ROOT;
man->last->tok = MAN_MAX;
man->next = MAN_NEXT_CHILD;
}
@@ -160,7 +161,7 @@ man_node_append(struct man *man, struct man_node *p)
assert(man->last);
assert(man->first);
- assert(p->type != MAN_ROOT);
+ assert(p->type != ROFFT_ROOT);
switch (man->next) {
case MAN_NEXT_SIBLING:
@@ -181,16 +182,16 @@ man_node_append(struct man *man, struct man_node *p)
p->parent->nchild++;
switch (p->type) {
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
if (p->tok == MAN_SH || p->tok == MAN_SS)
man->flags &= ~MAN_LITERAL;
break;
- case MAN_HEAD:
- assert(p->parent->type == MAN_BLOCK);
+ case ROFFT_HEAD:
+ assert(p->parent->type == ROFFT_BLOCK);
p->parent->head = p;
break;
- case MAN_BODY:
- assert(p->parent->type == MAN_BLOCK);
+ case ROFFT_BODY:
+ assert(p->parent->type == ROFFT_BLOCK);
p->parent->body = p;
break;
default:
@@ -200,9 +201,9 @@ man_node_append(struct man *man, struct man_node *p)
man->last = p;
switch (p->type) {
- case MAN_TBL:
+ case ROFFT_TBL:
/* FALLTHROUGH */
- case MAN_TEXT:
+ case ROFFT_TEXT:
man_valid_post(man);
break;
default:
@@ -212,7 +213,7 @@ man_node_append(struct man *man, struct man_node *p)
static struct man_node *
man_node_alloc(struct man *man, int line, int pos,
- enum man_type type, enum mant tok)
+ enum roff_type type, enum mant tok)
{
struct man_node *p;
@@ -233,7 +234,7 @@ man_elem_alloc(struct man *man, int line, int pos, enum mant tok)
{
struct man_node *p;
- p = man_node_alloc(man, line, pos, MAN_ELEM, tok);
+ p = man_node_alloc(man, line, pos, ROFFT_ELEM, tok);
man_node_append(man, p);
man->next = MAN_NEXT_CHILD;
}
@@ -243,7 +244,7 @@ man_head_alloc(struct man *man, int line, int pos, enum mant tok)
{
struct man_node *p;
- p = man_node_alloc(man, line, pos, MAN_HEAD, tok);
+ p = man_node_alloc(man, line, pos, ROFFT_HEAD, tok);
man_node_append(man, p);
man->next = MAN_NEXT_CHILD;
}
@@ -253,7 +254,7 @@ man_body_alloc(struct man *man, int line, int pos, enum mant tok)
{
struct man_node *p;
- p = man_node_alloc(man, line, pos, MAN_BODY, tok);
+ p = man_node_alloc(man, line, pos, ROFFT_BODY, tok);
man_node_append(man, p);
man->next = MAN_NEXT_CHILD;
}
@@ -263,7 +264,7 @@ man_block_alloc(struct man *man, int line, int pos, enum mant tok)
{
struct man_node *p;
- p = man_node_alloc(man, line, pos, MAN_BLOCK, tok);
+ p = man_node_alloc(man, line, pos, ROFFT_BLOCK, tok);
man_node_append(man, p);
man->next = MAN_NEXT_CHILD;
}
@@ -273,7 +274,7 @@ man_word_alloc(struct man *man, int line, int pos, const char *word)
{
struct man_node *n;
- n = man_node_alloc(man, line, pos, MAN_TEXT, MAN_MAX);
+ n = man_node_alloc(man, line, pos, ROFFT_TEXT, MAN_MAX);
n->string = roff_strdup(man->roff, word);
man_node_append(man, n);
man->next = MAN_NEXT_SIBLING;
@@ -322,7 +323,7 @@ man_addeqn(struct man *man, const struct eqn *ep)
{
struct man_node *n;
- n = man_node_alloc(man, ep->ln, ep->pos, MAN_EQN, MAN_MAX);
+ n = man_node_alloc(man, ep->ln, ep->pos, ROFFT_EQN, MAN_MAX);
n->eqn = ep;
if (ep->ln > man->last->line)
n->flags |= MAN_LINE;
@@ -337,7 +338,7 @@ man_addspan(struct man *man, const struct tbl_span *sp)
struct man_node *n;
man_breakscope(man, MAN_MAX);
- n = man_node_alloc(man, sp->line, 0, MAN_TBL, MAN_MAX);
+ n = man_node_alloc(man, sp->line, 0, ROFFT_TBL, MAN_MAX);
n->span = sp;
man_node_append(man, n);
man->next = MAN_NEXT_SIBLING;
@@ -509,7 +510,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
if (man->quick && tok == MAN_SH) {
n = man->last;
- if (n->type == MAN_BODY &&
+ if (n->type == ROFFT_BODY &&
strcmp(n->prev->child->string, "NAME"))
return(2);
}
@@ -546,7 +547,7 @@ man_breakscope(struct man *man, enum mant tok)
if (man->flags & MAN_ELINE && (tok == MAN_MAX ||
! (man_macros[tok].flags & MAN_NSCOPED))) {
n = man->last;
- assert(n->type != MAN_TEXT);
+ assert(n->type != ROFFT_TEXT);
if (man_macros[n->tok].flags & MAN_NSCOPED)
n = n->parent;
@@ -568,14 +569,14 @@ man_breakscope(struct man *man, enum mant tok)
if (man->flags & MAN_BLINE && (tok == MAN_MAX ||
man_macros[tok].flags & MAN_BSCOPE)) {
n = man->last;
- if (n->type == MAN_TEXT)
+ if (n->type == ROFFT_TEXT)
n = n->parent;
if ( ! (man_macros[n->tok].flags & MAN_BSCOPE))
n = n->parent;
- assert(n->type == MAN_HEAD);
+ assert(n->type == ROFFT_HEAD);
n = n->parent;
- assert(n->type == MAN_BLOCK);
+ assert(n->type == ROFFT_BLOCK);
assert(man_macros[n->tok].flags & MAN_SCOPED);
mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
@@ -643,7 +644,7 @@ man_deroff(char **dest, const struct man_node *n)
char *cp;
size_t sz;
- if (n->type != MAN_TEXT) {
+ if (n->type != ROFFT_TEXT) {
for (n = n->child; n; n = n->next)
man_deroff(dest, n);
return;
diff --git a/usr.bin/mandoc/man.h b/usr.bin/mandoc/man.h
index cd9b5998101..1b897ca1b5d 100644
--- a/usr.bin/mandoc/man.h
+++ b/usr.bin/mandoc/man.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: man.h,v 1.49 2015/01/24 02:41:32 schwarze Exp $ */
+/* $OpenBSD: man.h,v 1.50 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -58,17 +58,6 @@ enum mant {
MAN_MAX
};
-enum man_type {
- MAN_TEXT,
- MAN_ELEM,
- MAN_ROOT,
- MAN_BLOCK,
- MAN_HEAD,
- MAN_BODY,
- MAN_TBL,
- MAN_EQN
-};
-
struct man_meta {
char *msec; /* `TH' section (1, 3p, etc.) */
char *date; /* `TH' normalised date */
@@ -91,7 +80,7 @@ struct man_node {
#define MAN_VALID (1 << 0) /* has been validated */
#define MAN_EOS (1 << 2) /* at sentence boundary */
#define MAN_LINE (1 << 3) /* first macro/text on line */
- enum man_type type; /* AST node type */
+ enum roff_type type; /* AST node type */
char *string; /* TEXT node argument */
struct man_node *head; /* BLOCK node HEAD ptr */
struct man_node *tail; /* BLOCK node TAIL ptr */
diff --git a/usr.bin/mandoc/man_hash.c b/usr.bin/mandoc/man_hash.c
index 46f9cdfce92..4618424b0d0 100644
--- a/usr.bin/mandoc/man_hash.c
+++ b/usr.bin/mandoc/man_hash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_hash.c,v 1.19 2014/12/01 08:05:02 schwarze Exp $ */
+/* $OpenBSD: man_hash.c,v 1.20 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -21,6 +21,7 @@
#include <limits.h>
#include <string.h>
+#include "roff.h"
#include "man.h"
#include "libman.h"
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index 45031122cd0..712ad37340d 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_html.c,v 1.65 2015/03/03 21:09:25 schwarze Exp $ */
+/* $OpenBSD: man_html.c,v 1.66 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -24,6 +24,7 @@
#include <string.h>
#include "mandoc_aux.h"
+#include "roff.h"
#include "man.h"
#include "out.h"
#include "html.h"
@@ -131,10 +132,10 @@ print_bvspace(struct html *h, const struct man_node *n)
{
if (n->body && n->body->child)
- if (MAN_TBL == n->body->child->type)
+ if (n->body->child->type == ROFFT_TBL)
return;
- if (MAN_ROOT == n->parent->type || MAN_RS != n->parent->tok)
+ if (n->parent->type == ROFFT_ROOT || n->parent->tok != MAN_RS)
if (NULL == n->prev)
return;
@@ -206,10 +207,10 @@ print_man_node(MAN_ARGS)
t = h->tags.head;
switch (n->type) {
- case MAN_ROOT:
+ case ROFFT_ROOT:
man_root_pre(man, n, mh, h);
break;
- case MAN_TEXT:
+ case ROFFT_TEXT:
if ('\0' == *n->string) {
print_paragraph(h);
return;
@@ -220,12 +221,12 @@ print_man_node(MAN_ARGS)
print_otag(h, TAG_BR, 0, NULL);
print_text(h, n->string);
return;
- case MAN_EQN:
+ case ROFFT_EQN:
if (n->flags & MAN_LINE)
putchar('\n');
print_eqn(h, n->eqn);
break;
- case MAN_TBL:
+ case ROFFT_TBL:
/*
* This will take care of initialising all of the table
* state data for the first table, then tearing it down
@@ -264,10 +265,10 @@ print_man_node(MAN_ARGS)
print_stagq(h, t);
switch (n->type) {
- case MAN_ROOT:
+ case ROFFT_ROOT:
man_root_post(man, n, mh, h);
break;
- case MAN_EQN:
+ case ROFFT_EQN:
break;
default:
if (mans[n->tok].post)
@@ -280,7 +281,7 @@ static int
a2width(const struct man_node *n, struct roffsu *su)
{
- if (MAN_TEXT != n->type)
+ if (n->type != ROFFT_TEXT)
return(0);
if (a2roffsu(n->string, su, SCALE_EN))
return(1);
@@ -382,12 +383,12 @@ man_SH_pre(MAN_ARGS)
{
struct htmlpair tag;
- if (MAN_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
mh->fl &= ~MANH_LITERAL;
PAIR_CLASS_INIT(&tag, "section");
print_otag(h, TAG_DIV, 1, &tag);
return(1);
- } else if (MAN_BODY == n->type)
+ } else if (n->type == ROFFT_BODY)
return(1);
print_otag(h, TAG_H1, 0, NULL);
@@ -466,12 +467,12 @@ man_SS_pre(MAN_ARGS)
{
struct htmlpair tag;
- if (MAN_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
mh->fl &= ~MANH_LITERAL;
PAIR_CLASS_INIT(&tag, "subsection");
print_otag(h, TAG_DIV, 1, &tag);
return(1);
- } else if (MAN_BODY == n->type)
+ } else if (n->type == ROFFT_BODY)
return(1);
print_otag(h, TAG_H2, 0, NULL);
@@ -482,9 +483,9 @@ static int
man_PP_pre(MAN_ARGS)
{
- if (MAN_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
return(0);
- else if (MAN_BLOCK == n->type)
+ else if (n->type == ROFFT_BLOCK)
print_bvspace(h, n);
return(1);
@@ -495,10 +496,10 @@ man_IP_pre(MAN_ARGS)
{
const struct man_node *nn;
- if (MAN_BODY == n->type) {
+ if (n->type == ROFFT_BODY) {
print_otag(h, TAG_DD, 0, NULL);
return(1);
- } else if (MAN_HEAD != n->type) {
+ } else if (n->type != ROFFT_HEAD) {
print_otag(h, TAG_DL, 0, NULL);
return(1);
}
@@ -534,9 +535,9 @@ man_HP_pre(MAN_ARGS)
struct roffsu su;
const struct man_node *np;
- if (MAN_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
return(0);
- else if (MAN_BLOCK != n->type)
+ else if (n->type != ROFFT_BLOCK)
return(1);
np = n->head->child;
@@ -635,9 +636,9 @@ man_RS_pre(MAN_ARGS)
struct htmlpair tag;
struct roffsu su;
- if (MAN_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
return(0);
- else if (MAN_BODY == n->type)
+ else if (n->type == ROFFT_BODY)
return(1);
SCALE_HS_INIT(&su, INDENT);
@@ -657,15 +658,15 @@ man_UR_pre(MAN_ARGS)
struct htmlpair tag[2];
n = n->child;
- assert(MAN_HEAD == n->type);
+ assert(n->type == ROFFT_HEAD);
if (n->nchild) {
- assert(MAN_TEXT == n->child->type);
+ assert(n->child->type == ROFFT_TEXT);
PAIR_CLASS_INIT(&tag[0], "link-ext");
PAIR_HREF_INIT(&tag[1], n->child->string);
print_otag(h, TAG_A, 2, tag);
}
- assert(MAN_BODY == n->next->type);
+ assert(n->next->type == ROFFT_BODY);
if (n->next->nchild)
n = n->next;
diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c
index 071959a602b..1f3ee5aed95 100644
--- a/usr.bin/mandoc/man_macro.c
+++ b/usr.bin/mandoc/man_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_macro.c,v 1.62 2015/03/20 14:47:20 schwarze Exp $ */
+/* $OpenBSD: man_macro.c,v 1.63 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -8,9 +8,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -23,8 +23,9 @@
#include <stdlib.h>
#include <string.h>
-#include "man.h"
#include "mandoc.h"
+#include "roff.h"
+#include "man.h"
#include "libmandoc.h"
#include "libman.h"
@@ -41,11 +42,11 @@ static void in_line_eoln(MACRO_PROT_ARGS);
static int man_args(struct man *, int,
int *, char *, char **);
-static void rew_scope(enum man_type,
+static void rew_scope(enum roff_type,
struct man *, enum mant);
-static enum rew rew_dohalt(enum mant, enum man_type,
+static enum rew rew_dohalt(enum mant, enum roff_type,
const struct man_node *);
-static enum rew rew_block(enum mant, enum man_type,
+static enum rew rew_block(enum mant, enum roff_type,
const struct man_node *);
const struct man_macro __man_macros[MAN_MAX] = {
@@ -113,7 +114,7 @@ man_unscope(struct man *man, const struct man_node *to)
if (man->flags & MAN_ELINE)
man->flags &= ~MAN_ELINE;
else {
- assert(n->type == MAN_HEAD);
+ assert(n->type == ROFFT_HEAD);
n = n->parent;
man->flags &= ~MAN_BLINE;
}
@@ -122,7 +123,7 @@ man_unscope(struct man *man, const struct man_node *to)
man_node_delete(man, man->last);
continue;
}
- if (n->type == MAN_BLOCK &&
+ if (n->type == ROFFT_BLOCK &&
man_macros[n->tok].fp == blk_exp)
mandoc_msg(MANDOCERR_BLK_NOEND,
man->parse, n->line, n->pos,
@@ -153,11 +154,11 @@ man_unscope(struct man *man, const struct man_node *to)
}
static enum rew
-rew_block(enum mant ntok, enum man_type type, const struct man_node *n)
+rew_block(enum mant ntok, enum roff_type type, const struct man_node *n)
{
- if (type == MAN_BLOCK && ntok == n->parent->tok &&
- n->parent->type == MAN_BODY)
+ if (type == ROFFT_BLOCK && n->parent->tok == ntok &&
+ n->parent->type == ROFFT_BODY)
return(REW_REWIND);
return(ntok == n->tok ? REW_HALT : REW_NOHALT);
}
@@ -168,18 +169,18 @@ rew_block(enum mant ntok, enum man_type type, const struct man_node *n)
* sections and subsections).
*/
static enum rew
-rew_dohalt(enum mant tok, enum man_type type, const struct man_node *n)
+rew_dohalt(enum mant tok, enum roff_type type, const struct man_node *n)
{
enum rew c;
/* We cannot progress beyond the root ever. */
- if (MAN_ROOT == n->type)
+ if (n->type == ROFFT_ROOT)
return(REW_HALT);
assert(n->parent);
/* Normal nodes shouldn't go to the level of the root. */
- if (MAN_ROOT == n->parent->type)
+ if (n->parent->type == ROFFT_ROOT)
return(REW_REWIND);
/* Already-validated nodes should be closed out. */
@@ -241,7 +242,7 @@ rew_dohalt(enum mant tok, enum man_type type, const struct man_node *n)
* scopes. When a scope is closed, it must be validated and actioned.
*/
static void
-rew_scope(enum man_type type, struct man *man, enum mant tok)
+rew_scope(enum roff_type type, struct man *man, enum mant tok)
{
struct man_node *n;
enum rew c;
@@ -286,7 +287,7 @@ blk_close(MACRO_PROT_ARGS)
if ( ! man_args(man, line, pos, buf, &p))
break;
for (nn = man->last->parent; nn; nn = nn->parent)
- if (nn->tok == ntok && nn->type == MAN_BLOCK)
+ if (nn->tok == ntok && nn->type == ROFFT_BLOCK)
nrew++;
target = strtol(p, &p, 10);
if (*p != '\0')
@@ -310,13 +311,13 @@ blk_close(MACRO_PROT_ARGS)
}
for (nn = man->last->parent; nn; nn = nn->parent)
- if (nn->tok == ntok && nn->type == MAN_BLOCK && ! --nrew)
+ if (nn->tok == ntok && nn->type == ROFFT_BLOCK && ! --nrew)
break;
if (nn == NULL) {
mandoc_msg(MANDOCERR_BLK_NOTOPEN, man->parse,
line, ppos, man_macronames[tok]);
- rew_scope(MAN_BLOCK, man, MAN_PP);
+ rew_scope(ROFFT_BLOCK, man, MAN_PP);
} else {
line = man->last->line;
ppos = man->last->pos;
@@ -339,7 +340,7 @@ blk_exp(MACRO_PROT_ARGS)
char *p;
int la;
- rew_scope(MAN_BLOCK, man, tok);
+ rew_scope(ROFFT_BLOCK, man, tok);
man_block_alloc(man, line, ppos, tok);
man_head_alloc(man, line, ppos, tok);
head = man->last;
@@ -358,8 +359,8 @@ blk_exp(MACRO_PROT_ARGS)
}
/*
- * Parse an implicit-block macro. These contain a MAN_HEAD and a
- * MAN_BODY contained within a MAN_BLOCK. Rules for closing out other
+ * Parse an implicit-block macro. These contain a ROFFT_HEAD and a
+ * ROFFT_BODY contained within a ROFFT_BLOCK. Rules for closing out other
* scopes, such as `SH' closing out an `SS', are defined in the rew
* routines.
*/
@@ -370,8 +371,8 @@ blk_imp(MACRO_PROT_ARGS)
char *p;
struct man_node *n;
- rew_scope(MAN_BODY, man, tok);
- rew_scope(MAN_BLOCK, man, tok);
+ rew_scope(ROFFT_BODY, man, tok);
+ rew_scope(ROFFT_BLOCK, man, tok);
man_block_alloc(man, line, ppos, tok);
man_head_alloc(man, line, ppos, tok);
n = man->last;
@@ -399,7 +400,7 @@ blk_imp(MACRO_PROT_ARGS)
/* Close out the head and open the body. */
- rew_scope(MAN_HEAD, man, tok);
+ rew_scope(ROFFT_HEAD, man, tok);
man_body_alloc(man, line, ppos, tok);
}
@@ -432,7 +433,7 @@ in_line_eoln(MACRO_PROT_ARGS)
if ( ! man_args(man, line, pos, buf, &p))
break;
if (man_macros[tok].flags & MAN_JOIN &&
- man->last->type == MAN_TEXT)
+ man->last->type == ROFFT_TEXT)
man_word_append(man, p);
else
man_word_alloc(man, line, la, p);
@@ -459,7 +460,7 @@ in_line_eoln(MACRO_PROT_ARGS)
return;
}
- assert(man->last->type != MAN_ROOT);
+ assert(man->last->type != ROFFT_ROOT);
man->next = MAN_NEXT_SIBLING;
/*
@@ -471,7 +472,7 @@ in_line_eoln(MACRO_PROT_ARGS)
for ( ; man->last; man->last = man->last->parent) {
if (man->last == n)
break;
- if (man->last->type == MAN_ROOT)
+ if (man->last->type == ROFFT_ROOT)
break;
man_valid_post(man);
}
@@ -482,7 +483,7 @@ in_line_eoln(MACRO_PROT_ARGS)
* Same here regarding whether we're back at the root.
*/
- if (man->last->type != MAN_ROOT)
+ if (man->last->type != ROFFT_ROOT)
man_valid_post(man);
}
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index de80db0f6e0..deb6ba80b77 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_term.c,v 1.123 2015/03/15 16:51:34 schwarze Exp $ */
+/* $OpenBSD: man_term.c,v 1.124 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -24,10 +24,11 @@
#include <stdlib.h>
#include <string.h>
-#include "mandoc.h"
#include "mandoc_aux.h"
-#include "out.h"
+#include "mandoc.h"
+#include "roff.h"
#include "man.h"
+#include "out.h"
#include "term.h"
#include "main.h"
@@ -158,7 +159,7 @@ terminal_man(void *arg, const struct man *man)
if (p->synopsisonly) {
while (n != NULL) {
if (n->tok == MAN_SH &&
- n->child->child->type == MAN_TEXT &&
+ n->child->child->type == ROFFT_TEXT &&
!strcmp(n->child->child->string, "SYNOPSIS")) {
if (n->child->next->child != NULL)
print_man_nodelist(p, &mt,
@@ -195,10 +196,10 @@ print_bvspace(struct termp *p, const struct man_node *n, int pardist)
term_newln(p);
if (n->body && n->body->child)
- if (MAN_TBL == n->body->child->type)
+ if (n->body->child->type == ROFFT_TBL)
return;
- if (MAN_ROOT == n->parent->type || MAN_RS != n->parent->tok)
+ if (n->parent->type == ROFFT_ROOT || n->parent->tok != MAN_RS)
if (NULL == n->prev)
return;
@@ -267,7 +268,7 @@ pre_PD(DECL_ARGS)
mt->pardist = 1;
return(0);
}
- assert(MAN_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
if (a2roffsu(n->string, &su, SCALE_VS))
mt->pardist = term_vspan(p, &su);
return(0);
@@ -489,10 +490,10 @@ pre_HP(DECL_ARGS)
int len;
switch (n->type) {
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
print_bvspace(p, n, mt->pardist);
return(1);
- case MAN_BODY:
+ case ROFFT_BODY:
break;
default:
return(0);
@@ -526,7 +527,7 @@ post_HP(DECL_ARGS)
{
switch (n->type) {
- case MAN_BODY:
+ case ROFFT_BODY:
term_newln(p);
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
p->trailspace = 0;
@@ -543,7 +544,7 @@ pre_PP(DECL_ARGS)
{
switch (n->type) {
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
print_bvspace(p, n, mt->pardist);
break;
@@ -552,7 +553,7 @@ pre_PP(DECL_ARGS)
break;
}
- return(MAN_HEAD != n->type);
+ return(n->type != ROFFT_HEAD);
}
static int
@@ -563,14 +564,14 @@ pre_IP(DECL_ARGS)
int len, savelit;
switch (n->type) {
- case MAN_BODY:
+ case ROFFT_BODY:
p->flags |= TERMP_NOSPACE;
break;
- case MAN_HEAD:
+ case ROFFT_HEAD:
p->flags |= TERMP_NOBREAK;
p->trailspace = 1;
break;
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
print_bvspace(p, n, mt->pardist);
/* FALLTHROUGH */
default:
@@ -591,7 +592,7 @@ pre_IP(DECL_ARGS)
len = mt->lmargin[mt->lmargincur];
switch (n->type) {
- case MAN_HEAD:
+ case ROFFT_HEAD:
p->offset = mt->offset;
p->rmargin = mt->offset + len;
@@ -605,7 +606,7 @@ pre_IP(DECL_ARGS)
mt->fl |= MANT_LITERAL;
return(0);
- case MAN_BODY:
+ case ROFFT_BODY:
p->offset = mt->offset + len;
p->rmargin = p->maxrmargin;
break;
@@ -621,13 +622,13 @@ post_IP(DECL_ARGS)
{
switch (n->type) {
- case MAN_HEAD:
+ case ROFFT_HEAD:
term_flushln(p);
p->flags &= ~TERMP_NOBREAK;
p->trailspace = 0;
p->rmargin = p->maxrmargin;
break;
- case MAN_BODY:
+ case ROFFT_BODY:
term_newln(p);
p->offset = mt->offset;
break;
@@ -644,14 +645,14 @@ pre_TP(DECL_ARGS)
int len, savelit;
switch (n->type) {
- case MAN_HEAD:
+ case ROFFT_HEAD:
p->flags |= TERMP_NOBREAK;
p->trailspace = 1;
break;
- case MAN_BODY:
+ case ROFFT_BODY:
p->flags |= TERMP_NOSPACE;
break;
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
print_bvspace(p, n, mt->pardist);
/* FALLTHROUGH */
default:
@@ -673,7 +674,7 @@ pre_TP(DECL_ARGS)
len = mt->lmargin[mt->lmargincur];
switch (n->type) {
- case MAN_HEAD:
+ case ROFFT_HEAD:
p->offset = mt->offset;
p->rmargin = mt->offset + len;
@@ -693,7 +694,7 @@ pre_TP(DECL_ARGS)
if (savelit)
mt->fl |= MANT_LITERAL;
return(0);
- case MAN_BODY:
+ case ROFFT_BODY:
p->offset = mt->offset + len;
p->rmargin = p->maxrmargin;
p->trailspace = 0;
@@ -711,10 +712,10 @@ post_TP(DECL_ARGS)
{
switch (n->type) {
- case MAN_HEAD:
+ case ROFFT_HEAD:
term_flushln(p);
break;
- case MAN_BODY:
+ case ROFFT_BODY:
term_newln(p);
p->offset = mt->offset;
break;
@@ -729,7 +730,7 @@ pre_SS(DECL_ARGS)
int i;
switch (n->type) {
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
mt->fl &= ~MANT_LITERAL;
mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
mt->offset = term_len(p, p->defindent);
@@ -749,11 +750,11 @@ pre_SS(DECL_ARGS)
for (i = 0; i < mt->pardist; i++)
term_vspace(p);
break;
- case MAN_HEAD:
+ case ROFFT_HEAD:
term_fontrepl(p, TERMFONT_BOLD);
p->offset = term_len(p, 3);
break;
- case MAN_BODY:
+ case ROFFT_BODY:
p->offset = mt->offset;
break;
default:
@@ -768,10 +769,10 @@ post_SS(DECL_ARGS)
{
switch (n->type) {
- case MAN_HEAD:
+ case ROFFT_HEAD:
term_newln(p);
break;
- case MAN_BODY:
+ case ROFFT_BODY:
term_newln(p);
break;
default:
@@ -785,7 +786,7 @@ pre_SH(DECL_ARGS)
int i;
switch (n->type) {
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
mt->fl &= ~MANT_LITERAL;
mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
mt->offset = term_len(p, p->defindent);
@@ -804,11 +805,11 @@ pre_SH(DECL_ARGS)
for (i = 0; i < mt->pardist; i++)
term_vspace(p);
break;
- case MAN_HEAD:
+ case ROFFT_HEAD:
term_fontrepl(p, TERMFONT_BOLD);
p->offset = 0;
break;
- case MAN_BODY:
+ case ROFFT_BODY:
p->offset = mt->offset;
break;
default:
@@ -823,10 +824,10 @@ post_SH(DECL_ARGS)
{
switch (n->type) {
- case MAN_HEAD:
+ case ROFFT_HEAD:
term_newln(p);
break;
- case MAN_BODY:
+ case ROFFT_BODY:
term_newln(p);
break;
default:
@@ -840,10 +841,10 @@ pre_RS(DECL_ARGS)
struct roffsu su;
switch (n->type) {
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
term_newln(p);
return(1);
- case MAN_HEAD:
+ case ROFFT_HEAD:
return(0);
default:
break;
@@ -874,9 +875,9 @@ post_RS(DECL_ARGS)
{
switch (n->type) {
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
return;
- case MAN_HEAD:
+ case ROFFT_HEAD:
return;
default:
term_newln(p);
@@ -894,14 +895,14 @@ static int
pre_UR(DECL_ARGS)
{
- return (MAN_HEAD != n->type);
+ return (n->type != ROFFT_HEAD);
}
static void
post_UR(DECL_ARGS)
{
- if (MAN_BLOCK != n->type)
+ if (n->type != ROFFT_BLOCK)
return;
term_word(p, "<");
@@ -921,7 +922,7 @@ print_man_node(DECL_ARGS)
int c;
switch (n->type) {
- case MAN_TEXT:
+ case ROFFT_TEXT:
/*
* If we have a blank line, output a vertical space.
* If we have a space as the first character, break
@@ -936,14 +937,14 @@ print_man_node(DECL_ARGS)
term_word(p, n->string);
goto out;
- case MAN_EQN:
+ case ROFFT_EQN:
if ( ! (n->flags & MAN_LINE))
p->flags |= TERMP_NOSPACE;
term_eqn(p, n->eqn);
if (n->next != NULL && ! (n->next->flags & MAN_LINE))
p->flags |= TERMP_NOSPACE;
return;
- case MAN_TBL:
+ case ROFFT_TBL:
if (p->tbl.cols == NULL)
term_vspace(p);
term_tbl(p, n->span);
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index d1c99fb98c2..a0e408cac5c 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_validate.c,v 1.84 2015/02/06 11:54:03 schwarze Exp $ */
+/* $OpenBSD: man_validate.c,v 1.85 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -26,11 +26,12 @@
#include <string.h>
#include <time.h>
-#include "man.h"
-#include "mandoc.h"
#include "mandoc_aux.h"
-#include "libman.h"
+#include "mandoc.h"
+#include "roff.h"
+#include "man.h"
#include "libmandoc.h"
+#include "libman.h"
#define CHKARGS struct man *man, struct man_node *n
@@ -106,15 +107,15 @@ man_valid_post(struct man *man)
n->flags |= MAN_VALID;
switch (n->type) {
- case MAN_TEXT:
+ case ROFFT_TEXT:
check_text(man, n);
break;
- case MAN_ROOT:
+ case ROFFT_ROOT:
check_root(man, n);
break;
- case MAN_EQN:
+ case ROFFT_EQN:
/* FALLTHROUGH */
- case MAN_TBL:
+ case ROFFT_TBL:
break;
default:
cp = man_valids + n->tok;
@@ -184,7 +185,7 @@ static void
post_UR(CHKARGS)
{
- if (n->type == MAN_HEAD && n->child == NULL)
+ if (n->type == ROFFT_HEAD && n->child == NULL)
mandoc_vmsg(MANDOCERR_UR_NOHEAD, man->parse,
n->line, n->pos, "UR");
check_part(man, n);
@@ -241,7 +242,7 @@ static void
check_part(CHKARGS)
{
- if (n->type == MAN_BODY && n->child == NULL)
+ if (n->type == ROFFT_BODY && n->child == NULL)
mandoc_msg(MANDOCERR_BLK_EMPTY, man->parse,
n->line, n->pos, man_macronames[n->tok]);
}
@@ -251,17 +252,17 @@ check_par(CHKARGS)
{
switch (n->type) {
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
if (0 == n->body->nchild)
man_node_delete(man, n);
break;
- case MAN_BODY:
+ case ROFFT_BODY:
if (0 == n->nchild)
mandoc_vmsg(MANDOCERR_PAR_SKIP,
man->parse, n->line, n->pos,
"%s empty", man_macronames[n->tok]);
break;
- case MAN_HEAD:
+ case ROFFT_HEAD:
if (n->nchild)
mandoc_vmsg(MANDOCERR_ARG_SKIP,
man->parse, n->line, n->pos,
@@ -279,11 +280,11 @@ post_IP(CHKARGS)
{
switch (n->type) {
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
if (0 == n->head->nchild && 0 == n->body->nchild)
man_node_delete(man, n);
break;
- case MAN_BODY:
+ case ROFFT_BODY:
if (0 == n->parent->head->nchild && 0 == n->nchild)
mandoc_vmsg(MANDOCERR_PAR_SKIP,
man->parse, n->line, n->pos,
@@ -425,7 +426,7 @@ post_UC(CHKARGS)
n = n->child;
- if (NULL == n || MAN_TEXT != n->type)
+ if (n == NULL || n->type != ROFFT_TEXT)
p = bsd_versions[0];
else {
s = n->string;
@@ -462,7 +463,7 @@ post_AT(CHKARGS)
n = n->child;
- if (NULL == n || MAN_TEXT != n->type)
+ if (n == NULL || n->type != ROFFT_TEXT)
p = unix_versions[0];
else {
s = n->string;
@@ -472,7 +473,9 @@ post_AT(CHKARGS)
p = unix_versions[1];
else if (0 == strcmp(s, "5")) {
nn = n->next;
- if (nn && MAN_TEXT == nn->type && nn->string[0])
+ if (nn != NULL &&
+ nn->type == ROFFT_TEXT &&
+ nn->string[0] != '\0')
p = unix_versions[3];
else
p = unix_versions[2];
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index bd0cc2e4fca..98eaf6240b8 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandocdb.c,v 1.140 2015/03/27 17:36:56 schwarze Exp $ */
+/* $OpenBSD: mandocdb.c,v 1.141 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -36,10 +36,11 @@
#include <ohash.h>
#include <sqlite3.h>
+#include "mandoc_aux.h"
+#include "mandoc.h"
+#include "roff.h"
#include "mdoc.h"
#include "man.h"
-#include "mandoc.h"
-#include "mandoc_aux.h"
#include "manconf.h"
#include "mansearch.h"
@@ -1418,7 +1419,7 @@ putmdockey(const struct mpage *mpage,
for ( ; NULL != n; n = n->next) {
if (NULL != n->child)
putmdockey(mpage, n->child, m);
- if (MDOC_TEXT == n->type)
+ if (n->type == ROFFT_TEXT)
putkey(mpage, n->string, m);
}
}
@@ -1442,13 +1443,13 @@ parse_man(struct mpage *mpage, const struct man_meta *meta,
* the correct section or not.
*/
- if (MAN_BODY == n->type && MAN_SH == n->tok) {
+ if (n->type == ROFFT_BODY && n->tok == MAN_SH) {
body = n;
assert(body->parent);
if (NULL != (head = body->parent->head) &&
1 == head->nchild &&
NULL != (head = (head->child)) &&
- MAN_TEXT == head->type &&
+ head->type == ROFFT_TEXT &&
0 == strcmp(head->string, "NAME") &&
NULL != body->child) {
@@ -1557,15 +1558,15 @@ parse_mdoc(struct mpage *mpage, const struct mdoc_meta *meta,
assert(NULL != n);
for (n = n->child; NULL != n; n = n->next) {
switch (n->type) {
- case MDOC_ELEM:
+ case ROFFT_ELEM:
/* FALLTHROUGH */
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
/* FALLTHROUGH */
- case MDOC_HEAD:
+ case ROFFT_HEAD:
/* FALLTHROUGH */
- case MDOC_BODY:
+ case ROFFT_BODY:
/* FALLTHROUGH */
- case MDOC_TAIL:
+ case ROFFT_TAIL:
if (NULL != mdocs[n->tok].fp)
if (0 == (*mdocs[n->tok].fp)(mpage, meta, n))
break;
@@ -1574,7 +1575,7 @@ parse_mdoc(struct mpage *mpage, const struct mdoc_meta *meta,
mdocs[n->tok].mask);
break;
default:
- assert(MDOC_ROOT != n->type);
+ assert(n->type != ROFFT_ROOT);
continue;
}
if (NULL != n->child)
@@ -1591,7 +1592,7 @@ parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_meta *meta,
if (SEC_SYNOPSIS != n->sec ||
NULL == (n = n->child) ||
- MDOC_TEXT != n->type)
+ n->type != ROFFT_TEXT)
return(0);
/*
@@ -1602,7 +1603,7 @@ parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_meta *meta,
if (strcmp("#include", n->string))
return(0);
- if (NULL == (n = n->next) || MDOC_TEXT != n->type)
+ if ((n = n->next) == NULL || n->type != ROFFT_TEXT)
return(0);
/*
@@ -1632,7 +1633,7 @@ parse_mdoc_fname(struct mpage *mpage, const struct mdoc_node *n)
char *cp;
size_t sz;
- if (n->type != MDOC_TEXT)
+ if (n->type != ROFFT_TEXT)
return;
/* Skip function pointer punctuation. */
@@ -1658,7 +1659,7 @@ parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_meta *meta,
parse_mdoc_fname(mpage, n->child);
for (n = n->child->next; n != NULL; n = n->next)
- if (n->type == MDOC_TEXT)
+ if (n->type == ROFFT_TEXT)
putkey(mpage, n->string, TYPE_Fa);
return(0);
@@ -1669,7 +1670,7 @@ parse_mdoc_Fo(struct mpage *mpage, const struct mdoc_meta *meta,
const struct mdoc_node *n)
{
- if (n->type != MDOC_HEAD)
+ if (n->type != ROFFT_HEAD)
return(1);
if (n->child != NULL)
@@ -1703,7 +1704,7 @@ parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_meta *meta,
const struct mdoc_node *n)
{
- if (MDOC_BODY == n->type)
+ if (n->type == ROFFT_BODY)
mdoc_deroff(&mpage->desc, n);
return(0);
}
@@ -1715,7 +1716,7 @@ parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_meta *meta,
if (SEC_NAME == n->sec)
putmdockey(mpage, n->child, NAME_TITLE);
- else if (SEC_SYNOPSIS == n->sec && MDOC_HEAD == n->type) {
+ else if (n->sec == SEC_SYNOPSIS && n->type == ROFFT_HEAD) {
if (n->child == NULL)
putkey(mpage, meta->name, NAME_SYN);
else
@@ -1724,7 +1725,7 @@ parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_meta *meta,
if ( ! (mpage->name_head_done ||
n->child == NULL || n->child->string == NULL ||
strcasecmp(n->child->string, meta->title))) {
- putkey(mpage, n->child->string, NAME_HEAD);
+ putkey(mpage, n->child->string, ROFFT_HEAD);
mpage->name_head_done = 1;
}
return(0);
@@ -1735,7 +1736,7 @@ parse_mdoc_Sh(struct mpage *mpage, const struct mdoc_meta *meta,
const struct mdoc_node *n)
{
- return(SEC_CUSTOM == n->sec && MDOC_HEAD == n->type);
+ return(n->sec == SEC_CUSTOM && n->type == ROFFT_HEAD);
}
static int
@@ -1743,7 +1744,7 @@ parse_mdoc_head(struct mpage *mpage, const struct mdoc_meta *meta,
const struct mdoc_node *n)
{
- return(MDOC_HEAD == n->type);
+ return(n->type == ROFFT_HEAD);
}
static int
@@ -1751,7 +1752,7 @@ parse_mdoc_body(struct mpage *mpage, const struct mdoc_meta *meta,
const struct mdoc_node *n)
{
- return(MDOC_BODY == n->type);
+ return(n->type == ROFFT_BODY);
}
/*
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 24b625ef264..ea26de2c7d3 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc.c,v 1.127 2015/02/12 13:00:27 schwarze Exp $ */
+/* $OpenBSD: mdoc.c,v 1.128 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -25,11 +25,12 @@
#include <string.h>
#include <time.h>
-#include "mdoc.h"
-#include "mandoc.h"
#include "mandoc_aux.h"
-#include "libmdoc.h"
+#include "mandoc.h"
+#include "roff.h"
+#include "mdoc.h"
#include "libmandoc.h"
+#include "libmdoc.h"
const char *const __mdoc_macronames[MDOC_MAX + 1] = {
"Ap", "Dd", "Dt", "Os",
@@ -86,7 +87,7 @@ static void mdoc_node_unlink(struct mdoc *,
static void mdoc_free1(struct mdoc *);
static void mdoc_alloc1(struct mdoc *);
static struct mdoc_node *node_alloc(struct mdoc *, int, int,
- enum mdoct, enum mdoc_type);
+ enum mdoct, enum roff_type);
static void node_append(struct mdoc *, struct mdoc_node *);
static int mdoc_ptext(struct mdoc *, int, char *, int);
static int mdoc_pmacro(struct mdoc *, int, char *, int);
@@ -136,7 +137,7 @@ mdoc_alloc1(struct mdoc *mdoc)
mdoc->lastnamed = mdoc->lastsec = SEC_NONE;
mdoc->last = mandoc_calloc(1, sizeof(struct mdoc_node));
mdoc->first = mdoc->last;
- mdoc->last->type = MDOC_ROOT;
+ mdoc->last->type = ROFFT_ROOT;
mdoc->last->tok = MDOC_MAX;
mdoc->next = MDOC_NEXT_CHILD;
}
@@ -200,7 +201,7 @@ mdoc_addeqn(struct mdoc *mdoc, const struct eqn *ep)
{
struct mdoc_node *n;
- n = node_alloc(mdoc, ep->ln, ep->pos, MDOC_MAX, MDOC_EQN);
+ n = node_alloc(mdoc, ep->ln, ep->pos, MDOC_MAX, ROFFT_EQN);
n->eqn = ep;
if (ep->ln > mdoc->last->line)
n->flags |= MDOC_LINE;
@@ -213,7 +214,7 @@ mdoc_addspan(struct mdoc *mdoc, const struct tbl_span *sp)
{
struct mdoc_node *n;
- n = node_alloc(mdoc, sp->line, 0, MDOC_MAX, MDOC_TBL);
+ n = node_alloc(mdoc, sp->line, 0, MDOC_MAX, ROFFT_TBL);
n->span = sp;
node_append(mdoc, n);
mdoc->next = MDOC_NEXT_SIBLING;
@@ -227,7 +228,7 @@ int
mdoc_parseln(struct mdoc *mdoc, int ln, char *buf, int offs)
{
- if (mdoc->last->type != MDOC_EQN || ln > mdoc->last->line)
+ if (mdoc->last->type != ROFFT_EQN || ln > mdoc->last->line)
mdoc->flags |= MDOC_NEWLINE;
/*
@@ -279,7 +280,7 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
assert(mdoc->last);
assert(mdoc->first);
- assert(MDOC_ROOT != p->type);
+ assert(p->type != ROFFT_ROOT);
switch (mdoc->next) {
case MDOC_NEXT_SIBLING:
@@ -304,13 +305,13 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
*/
switch (p->type) {
- case MDOC_BODY:
+ case ROFFT_BODY:
if (ENDBODY_NOT != p->end)
break;
/* FALLTHROUGH */
- case MDOC_TAIL:
+ case ROFFT_TAIL:
/* FALLTHROUGH */
- case MDOC_HEAD:
+ case ROFFT_HEAD:
p->norm = p->parent->norm;
break;
default:
@@ -320,18 +321,18 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
mdoc_valid_pre(mdoc, p);
switch (p->type) {
- case MDOC_HEAD:
- assert(MDOC_BLOCK == p->parent->type);
+ case ROFFT_HEAD:
+ assert(p->parent->type == ROFFT_BLOCK);
p->parent->head = p;
break;
- case MDOC_TAIL:
- assert(MDOC_BLOCK == p->parent->type);
+ case ROFFT_TAIL:
+ assert(p->parent->type == ROFFT_BLOCK);
p->parent->tail = p;
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
if (p->end)
break;
- assert(MDOC_BLOCK == p->parent->type);
+ assert(p->parent->type == ROFFT_BLOCK);
p->parent->body = p;
break;
default:
@@ -341,9 +342,9 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
mdoc->last = p;
switch (p->type) {
- case MDOC_TBL:
+ case ROFFT_TBL:
/* FALLTHROUGH */
- case MDOC_TEXT:
+ case ROFFT_TEXT:
mdoc_valid_post(mdoc);
break;
default:
@@ -353,7 +354,7 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
static struct mdoc_node *
node_alloc(struct mdoc *mdoc, int line, int pos,
- enum mdoct tok, enum mdoc_type type)
+ enum mdoct tok, enum roff_type type)
{
struct mdoc_node *p;
@@ -382,7 +383,7 @@ mdoc_tail_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok)
{
struct mdoc_node *p;
- p = node_alloc(mdoc, line, pos, tok, MDOC_TAIL);
+ p = node_alloc(mdoc, line, pos, tok, ROFFT_TAIL);
node_append(mdoc, p);
mdoc->next = MDOC_NEXT_CHILD;
}
@@ -394,7 +395,7 @@ mdoc_head_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok)
assert(mdoc->first);
assert(mdoc->last);
- p = node_alloc(mdoc, line, pos, tok, MDOC_HEAD);
+ p = node_alloc(mdoc, line, pos, tok, ROFFT_HEAD);
node_append(mdoc, p);
mdoc->next = MDOC_NEXT_CHILD;
return(p);
@@ -405,7 +406,7 @@ mdoc_body_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok)
{
struct mdoc_node *p;
- p = node_alloc(mdoc, line, pos, tok, MDOC_BODY);
+ p = node_alloc(mdoc, line, pos, tok, ROFFT_BODY);
node_append(mdoc, p);
mdoc->next = MDOC_NEXT_CHILD;
return(p);
@@ -419,7 +420,7 @@ mdoc_endbody_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok,
body->flags |= MDOC_ENDED;
body->parent->flags |= MDOC_ENDED;
- p = node_alloc(mdoc, line, pos, tok, MDOC_BODY);
+ p = node_alloc(mdoc, line, pos, tok, ROFFT_BODY);
p->body = body;
p->norm = body->norm;
p->end = end;
@@ -434,7 +435,7 @@ mdoc_block_alloc(struct mdoc *mdoc, int line, int pos,
{
struct mdoc_node *p;
- p = node_alloc(mdoc, line, pos, tok, MDOC_BLOCK);
+ p = node_alloc(mdoc, line, pos, tok, ROFFT_BLOCK);
p->args = args;
if (p->args)
(args->refcnt)++;
@@ -465,7 +466,7 @@ mdoc_elem_alloc(struct mdoc *mdoc, int line, int pos,
{
struct mdoc_node *p;
- p = node_alloc(mdoc, line, pos, tok, MDOC_ELEM);
+ p = node_alloc(mdoc, line, pos, tok, ROFFT_ELEM);
p->args = args;
if (p->args)
(args->refcnt)++;
@@ -486,7 +487,7 @@ mdoc_word_alloc(struct mdoc *mdoc, int line, int pos, const char *p)
{
struct mdoc_node *n;
- n = node_alloc(mdoc, line, pos, MDOC_MAX, MDOC_TEXT);
+ n = node_alloc(mdoc, line, pos, MDOC_MAX, ROFFT_TEXT);
n->string = roff_strdup(mdoc->roff, p);
node_append(mdoc, n);
mdoc->next = MDOC_NEXT_SIBLING;
@@ -511,7 +512,7 @@ static void
mdoc_node_free(struct mdoc_node *p)
{
- if (MDOC_BLOCK == p->type || MDOC_ELEM == p->type)
+ if (p->type == ROFFT_BLOCK || p->type == ROFFT_ELEM)
free(p->norm);
if (p->string)
free(p->string);
@@ -594,12 +595,12 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs)
/*
* Divert directly to list processing if we're encountering a
- * columnar MDOC_BLOCK with or without a prior MDOC_BLOCK entry
- * (a MDOC_BODY means it's already open, in which case we should
+ * columnar ROFFT_BLOCK with or without a prior ROFFT_BLOCK entry
+ * (a ROFFT_BODY means it's already open, in which case we should
* process within its context in the normal way).
*/
- if (n->tok == MDOC_Bl && n->type == MDOC_BODY &&
+ if (n->tok == MDOC_Bl && n->type == ROFFT_BODY &&
n->end == ENDBODY_NOT && n->norm->Bl.type == LIST_column) {
/* `Bl' is open without any children. */
mdoc->flags |= MDOC_FREECOL;
@@ -607,7 +608,7 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs)
return(1);
}
- if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
+ if (n->tok == MDOC_It && n->type == ROFFT_BLOCK &&
NULL != n->parent &&
MDOC_Bl == n->parent->tok &&
LIST_column == n->parent->norm->Bl.type) {
@@ -776,7 +777,7 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
* context around the parsed macro.
*/
- if (n->tok == MDOC_Bl && n->type == MDOC_BODY &&
+ if (n->tok == MDOC_Bl && n->type == ROFFT_BODY &&
n->end == ENDBODY_NOT && n->norm->Bl.type == LIST_column) {
mdoc->flags |= MDOC_FREECOL;
mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf);
@@ -789,7 +790,7 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
* then open an `It' block context around the parsed macro.
*/
- if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
+ if (n->tok == MDOC_It && n->type == ROFFT_BLOCK &&
NULL != n->parent &&
MDOC_Bl == n->parent->tok &&
LIST_column == n->parent->norm->Bl.type) {
@@ -863,7 +864,7 @@ mdoc_deroff(char **dest, const struct mdoc_node *n)
char *cp;
size_t sz;
- if (MDOC_TEXT != n->type) {
+ if (n->type != ROFFT_TEXT) {
for (n = n->child; n; n = n->next)
mdoc_deroff(dest, n);
return;
diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h
index a65b46344fd..6e68a9d9052 100644
--- a/usr.bin/mandoc/mdoc.h
+++ b/usr.bin/mandoc/mdoc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc.h,v 1.61 2015/02/12 12:20:47 schwarze Exp $ */
+/* $OpenBSD: mdoc.h,v 1.62 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -174,18 +174,6 @@ enum mdocargt {
MDOC_ARG_MAX
};
-enum mdoc_type {
- MDOC_TEXT,
- MDOC_ELEM,
- MDOC_HEAD,
- MDOC_TAIL,
- MDOC_BODY,
- MDOC_BLOCK,
- MDOC_TBL,
- MDOC_EQN,
- MDOC_ROOT
-};
-
/*
* Section (named/unnamed) of `Sh'. Note that these appear in the
* conventional order imposed by mdoc.7. In the case of SEC_NONE, no
@@ -363,7 +351,7 @@ struct mdoc_node {
#define MDOC_BROKEN (1 << 5) /* must validate parent when ending */
#define MDOC_DELIMO (1 << 6)
#define MDOC_DELIMC (1 << 7)
- enum mdoc_type type; /* AST node type */
+ enum roff_type type; /* AST node type */
enum mdoc_sec sec; /* current named section */
union mdoc_data *norm; /* normalised args */
int prev_font; /* before entering this node */
diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c
index 3c66034205a..1742787c8a6 100644
--- a/usr.bin/mandoc/mdoc_argv.c
+++ b/usr.bin/mandoc/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_argv.c,v 1.56 2015/02/04 18:58:09 schwarze Exp $ */
+/* $OpenBSD: mdoc_argv.c,v 1.57 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -22,11 +22,12 @@
#include <stdio.h>
#include <string.h>
-#include "mdoc.h"
-#include "mandoc.h"
#include "mandoc_aux.h"
-#include "libmdoc.h"
+#include "mandoc.h"
+#include "roff.h"
+#include "mdoc.h"
#include "libmandoc.h"
+#include "libmdoc.h"
#define MULTI_STEP 5 /* pre-allocate argument values */
#define DELIMSZ 6 /* max possible size of a delimiter */
diff --git a/usr.bin/mandoc/mdoc_hash.c b/usr.bin/mandoc/mdoc_hash.c
index 2aedb5b9517..169244bb7d4 100644
--- a/usr.bin/mandoc/mdoc_hash.c
+++ b/usr.bin/mandoc/mdoc_hash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_hash.c,v 1.16 2014/11/28 19:25:03 schwarze Exp $ */
+/* $OpenBSD: mdoc_hash.c,v 1.17 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <string.h>
+#include "roff.h"
#include "mdoc.h"
#include "libmdoc.h"
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 02e94dd23ac..4cbc340d17f 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_html.c,v 1.101 2015/03/03 21:09:25 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.102 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -25,6 +25,7 @@
#include <unistd.h>
#include "mandoc_aux.h"
+#include "roff.h"
#include "mdoc.h"
#include "out.h"
#include "html.h"
@@ -388,10 +389,10 @@ print_mdoc_node(MDOC_ARGS)
n->flags &= ~MDOC_ENDED;
switch (n->type) {
- case MDOC_ROOT:
+ case ROFFT_ROOT:
child = mdoc_root_pre(meta, n, h);
break;
- case MDOC_TEXT:
+ case ROFFT_TEXT:
/* No tables in this mode... */
assert(NULL == h->tblt);
@@ -408,12 +409,12 @@ print_mdoc_node(MDOC_ARGS)
if (MDOC_DELIMO & n->flags)
h->flags |= HTML_NOSPACE;
return;
- case MDOC_EQN:
+ case ROFFT_EQN:
if (n->flags & MDOC_LINE)
putchar('\n');
print_eqn(h, n->eqn);
break;
- case MDOC_TBL:
+ case ROFFT_TBL:
/*
* This will take care of initialising all of the table
* state data for the first table, then tearing it down
@@ -448,10 +449,10 @@ print_mdoc_node(MDOC_ARGS)
print_stagq(h, t);
switch (n->type) {
- case MDOC_ROOT:
+ case ROFFT_ROOT:
mdoc_root_post(meta, n, h);
break;
- case MDOC_EQN:
+ case ROFFT_EQN:
break;
default:
if ( ! mdocs[n->tok].post || n->flags & MDOC_ENDED)
@@ -541,11 +542,11 @@ mdoc_sh_pre(MDOC_ARGS)
struct htmlpair tag;
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
PAIR_CLASS_INIT(&tag, "section");
print_otag(h, TAG_DIV, 1, &tag);
return(1);
- case MDOC_BODY:
+ case ROFFT_BODY:
if (n->sec == SEC_AUTHORS)
h->flags &= ~(HTML_SPLIT|HTML_NOSPLIT);
return(1);
@@ -556,7 +557,7 @@ mdoc_sh_pre(MDOC_ARGS)
bufinit(h);
bufcat(h, "x");
- for (n = n->child; n && MDOC_TEXT == n->type; ) {
+ for (n = n->child; n != NULL && n->type == ROFFT_TEXT; ) {
bufcat_id(h, n->string);
if (NULL != (n = n->next))
bufcat_id(h, " ");
@@ -576,17 +577,17 @@ mdoc_ss_pre(MDOC_ARGS)
{
struct htmlpair tag;
- if (MDOC_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
PAIR_CLASS_INIT(&tag, "subsection");
print_otag(h, TAG_DIV, 1, &tag);
return(1);
- } else if (MDOC_BODY == n->type)
+ } else if (n->type == ROFFT_BODY)
return(1);
bufinit(h);
bufcat(h, "x");
- for (n = n->child; n && MDOC_TEXT == n->type; ) {
+ for (n = n->child; n != NULL && n->type == ROFFT_TEXT; ) {
bufcat_id(h, n->string);
if (NULL != (n = n->next))
bufcat_id(h, " ");
@@ -618,7 +619,7 @@ mdoc_fl_pre(MDOC_ARGS)
if ( ! (n->nchild == 0 &&
(n->next == NULL ||
- n->next->type == MDOC_TEXT ||
+ n->next->type == ROFFT_TEXT ||
n->next->flags & MDOC_LINE)))
h->flags |= HTML_NOSPACE;
@@ -630,7 +631,7 @@ mdoc_nd_pre(MDOC_ARGS)
{
struct htmlpair tag;
- if (MDOC_BODY != n->type)
+ if (n->type != ROFFT_BODY)
return(1);
/* XXX: this tag in theory can contain block elements. */
@@ -649,19 +650,19 @@ mdoc_nm_pre(MDOC_ARGS)
int len;
switch (n->type) {
- case MDOC_ELEM:
+ case ROFFT_ELEM:
synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "name");
print_otag(h, TAG_B, 1, &tag);
if (NULL == n->child && meta->name)
print_text(h, meta->name);
return(1);
- case MDOC_HEAD:
+ case ROFFT_HEAD:
print_otag(h, TAG_TD, 0, NULL);
if (NULL == n->child && meta->name)
print_text(h, meta->name);
return(1);
- case MDOC_BODY:
+ case ROFFT_BODY:
print_otag(h, TAG_TD, 0, NULL);
return(1);
default:
@@ -673,7 +674,7 @@ mdoc_nm_pre(MDOC_ARGS)
print_otag(h, TAG_TABLE, 1, &tag);
for (len = 0, n = n->child; n; n = n->next)
- if (MDOC_TEXT == n->type)
+ if (n->type == ROFFT_TEXT)
len += html_strlen(n->string);
if (0 == len && meta->name)
@@ -834,7 +835,7 @@ mdoc_it_pre(MDOC_ARGS)
bufinit(h);
- if (MDOC_HEAD == n->type) {
+ if (n->type == ROFFT_HEAD) {
switch (type) {
case LIST_bullet:
/* FALLTHROUGH */
@@ -869,7 +870,7 @@ mdoc_it_pre(MDOC_ARGS)
default:
break;
}
- } else if (MDOC_BODY == n->type) {
+ } else if (n->type == ROFFT_BODY) {
switch (type) {
case LIST_bullet:
/* FALLTHROUGH */
@@ -933,13 +934,13 @@ mdoc_bl_pre(MDOC_ARGS)
struct roffsu su;
char buf[BUFSIZ];
- if (MDOC_BODY == n->type) {
+ if (n->type == ROFFT_BODY) {
if (LIST_column == n->norm->Bl.type)
print_otag(h, TAG_TBODY, 0, NULL);
return(1);
}
- if (MDOC_HEAD == n->type) {
+ if (n->type == ROFFT_HEAD) {
if (LIST_column != n->norm->Bl.type)
return(0);
@@ -1033,7 +1034,7 @@ mdoc_ex_pre(MDOC_ARGS)
nchild = n->nchild;
for (n = n->child; n; n = n->next) {
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
t = print_otag(h, TAG_B, 1, &tag);
print_text(h, n->string);
@@ -1073,7 +1074,7 @@ mdoc_d1_pre(MDOC_ARGS)
struct htmlpair tag[2];
struct roffsu su;
- if (MDOC_BLOCK != n->type)
+ if (n->type != ROFFT_BLOCK)
return(1);
SCALE_VS_INIT(&su, 0);
@@ -1126,13 +1127,13 @@ mdoc_bd_pre(MDOC_ARGS)
struct mdoc_node *nn;
struct roffsu su;
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
return(0);
- if (MDOC_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
comp = n->norm->Bd.comp;
for (nn = n; nn && ! comp; nn = nn->parent) {
- if (MDOC_BLOCK != nn->type)
+ if (nn->type != ROFFT_BLOCK)
continue;
if (MDOC_Ss == nn->tok || MDOC_Sh == nn->tok)
comp = 1;
@@ -1351,7 +1352,7 @@ mdoc_fd_pre(MDOC_ARGS)
if (NULL == (n = n->child))
return(0);
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
if (strcmp(n->string, "#include")) {
PAIR_CLASS_INIT(&tag[0], "macro");
@@ -1364,7 +1365,7 @@ mdoc_fd_pre(MDOC_ARGS)
print_text(h, n->string);
if (NULL != (n = n->next)) {
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
/*
* XXX This is broken and not easy to fix.
@@ -1398,7 +1399,7 @@ mdoc_fd_pre(MDOC_ARGS)
}
for ( ; n; n = n->next) {
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
print_text(h, n->string);
}
@@ -1410,12 +1411,12 @@ mdoc_vt_pre(MDOC_ARGS)
{
struct htmlpair tag;
- if (MDOC_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
synopsis_pre(h, n);
return(1);
- } else if (MDOC_ELEM == n->type) {
+ } else if (n->type == ROFFT_ELEM) {
synopsis_pre(h, n);
- } else if (MDOC_HEAD == n->type)
+ } else if (n->type == ROFFT_HEAD)
return(0);
PAIR_CLASS_INIT(&tag, "type");
@@ -1594,7 +1595,7 @@ mdoc_lk_pre(MDOC_ARGS)
if (NULL == (n = n->child))
return(0);
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
PAIR_CLASS_INIT(&tag[0], "link-ext");
PAIR_HREF_INIT(&tag[1], n->string);
@@ -1619,7 +1620,7 @@ mdoc_mt_pre(MDOC_ARGS)
PAIR_CLASS_INIT(&tag[0], "link-mail");
for (n = n->child; n; n = n->next) {
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
bufinit(h);
bufcat(h, "mailto:");
@@ -1640,12 +1641,12 @@ mdoc_fo_pre(MDOC_ARGS)
struct htmlpair tag;
struct tag *t;
- if (MDOC_BODY == n->type) {
+ if (n->type == ROFFT_BODY) {
h->flags |= HTML_NOSPACE;
print_text(h, "(");
h->flags |= HTML_NOSPACE;
return(1);
- } else if (MDOC_BLOCK == n->type) {
+ } else if (n->type == ROFFT_BLOCK) {
synopsis_pre(h, n);
return(1);
}
@@ -1666,7 +1667,7 @@ static void
mdoc_fo_post(MDOC_ARGS)
{
- if (MDOC_BODY != n->type)
+ if (n->type != ROFFT_BODY)
return;
h->flags |= HTML_NOSPACE;
print_text(h, ")");
@@ -1700,7 +1701,7 @@ mdoc_in_pre(MDOC_ARGS)
h->flags |= HTML_NOSPACE;
if (NULL != (n = n->child)) {
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
PAIR_CLASS_INIT(&tag[0], "link-includes");
@@ -1722,7 +1723,7 @@ mdoc_in_pre(MDOC_ARGS)
print_text(h, ">");
for ( ; n; n = n->next) {
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
print_text(h, n->string);
}
@@ -1821,9 +1822,9 @@ mdoc_bf_pre(MDOC_ARGS)
struct htmlpair tag[2];
struct roffsu su;
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
return(0);
- else if (MDOC_BODY != n->type)
+ else if (n->type != ROFFT_BODY)
return(1);
if (FONT_Em == n->norm->Bf.font)
@@ -1880,7 +1881,7 @@ mdoc_rs_pre(MDOC_ARGS)
{
struct htmlpair tag;
- if (MDOC_BLOCK != n->type)
+ if (n->type != ROFFT_BLOCK)
return(1);
if (n->prev && SEC_SEE_ALSO == n->sec)
@@ -2046,11 +2047,11 @@ mdoc_bk_pre(MDOC_ARGS)
{
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
break;
- case MDOC_HEAD:
+ case ROFFT_HEAD:
return(0);
- case MDOC_BODY:
+ case ROFFT_BODY:
if (n->parent->args || 0 == n->prev->nchild)
h->flags |= HTML_PREKEEP;
break;
@@ -2066,7 +2067,7 @@ static void
mdoc_bk_post(MDOC_ARGS)
{
- if (MDOC_BODY == n->type)
+ if (n->type == ROFFT_BODY)
h->flags &= ~(HTML_KEEP | HTML_PREKEEP);
}
@@ -2075,7 +2076,7 @@ mdoc_quote_pre(MDOC_ARGS)
{
struct htmlpair tag;
- if (MDOC_BODY != n->type)
+ if (n->type != ROFFT_BODY)
return(1);
switch (n->tok) {
@@ -2147,7 +2148,7 @@ static void
mdoc_quote_post(MDOC_ARGS)
{
- if (n->type != MDOC_BODY && n->type != MDOC_ELEM)
+ if (n->type != ROFFT_BODY && n->type != ROFFT_ELEM)
return;
h->flags |= HTML_NOSPACE;
@@ -2212,7 +2213,7 @@ static int
mdoc_eo_pre(MDOC_ARGS)
{
- if (n->type != MDOC_BODY)
+ if (n->type != ROFFT_BODY)
return(1);
if (n->end == ENDBODY_NOT &&
@@ -2232,7 +2233,7 @@ mdoc_eo_post(MDOC_ARGS)
{
int body, tail;
- if (n->type != MDOC_BODY)
+ if (n->type != ROFFT_BODY)
return;
if (n->end != ENDBODY_NOT) {
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index f0d1c893029..74f65409cfa 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_macro.c,v 1.139 2015/02/12 12:20:47 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.140 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -24,10 +24,11 @@
#include <string.h>
#include <time.h>
-#include "mdoc.h"
#include "mandoc.h"
-#include "libmdoc.h"
+#include "roff.h"
+#include "mdoc.h"
#include "libmandoc.h"
+#include "libmdoc.h"
static void blk_full(MACRO_PROT_ARGS);
static void blk_exp_close(MACRO_PROT_ARGS);
@@ -215,7 +216,7 @@ mdoc_macroend(struct mdoc *mdoc)
mdoc->last->parent : mdoc->last;
for ( ; n; n = n->parent)
- if (n->type == MDOC_BLOCK &&
+ if (n->type == ROFFT_BLOCK &&
mdoc_macros[n->tok].flags & MDOC_EXPLICIT)
mandoc_msg(MANDOCERR_BLK_NOEND, mdoc->parse,
n->line, n->pos, mdoc_macronames[n->tok]);
@@ -285,10 +286,10 @@ rew_pending(struct mdoc *mdoc, const struct mdoc_node *n)
rew_last(mdoc, n);
switch (n->type) {
- case MDOC_HEAD:
+ case ROFFT_HEAD:
mdoc_body_alloc(mdoc, n->line, n->pos, n->tok);
return;
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
break;
default:
return;
@@ -301,8 +302,8 @@ rew_pending(struct mdoc *mdoc, const struct mdoc_node *n)
if ((n = n->parent) == NULL)
return;
- if (n->type == MDOC_BLOCK ||
- n->type == MDOC_HEAD) {
+ if (n->type == ROFFT_BLOCK ||
+ n->type == ROFFT_HEAD) {
if (n->flags & MDOC_ENDED)
break;
else
@@ -364,9 +365,9 @@ rew_elem(struct mdoc *mdoc, enum mdoct tok)
struct mdoc_node *n;
n = mdoc->last;
- if (MDOC_ELEM != n->type)
+ if (n->type != ROFFT_ELEM)
n = n->parent;
- assert(MDOC_ELEM == n->type);
+ assert(n->type == ROFFT_ELEM);
assert(tok == n->tok);
rew_last(mdoc, n);
}
@@ -385,7 +386,7 @@ dword(struct mdoc *mdoc, int line, int col, const char *p,
if (may_append &&
! (mdoc->flags & (MDOC_SYNOPSIS | MDOC_KEEP | MDOC_SMOFF)) &&
- d == DELIM_NONE && mdoc->last->type == MDOC_TEXT &&
+ d == DELIM_NONE && mdoc->last->type == ROFFT_TEXT &&
mdoc_isdelim(mdoc->last->string) == DELIM_NONE) {
mdoc_word_append(mdoc, p);
return;
@@ -520,13 +521,13 @@ blk_exp_close(MACRO_PROT_ARGS)
/* Remember the start of our own body. */
- if (n->type == MDOC_BODY && atok == n->tok) {
+ if (n->type == ROFFT_BODY && atok == n->tok) {
if (n->end == ENDBODY_NOT)
body = n;
continue;
}
- if (n->type != MDOC_BLOCK || n->tok == MDOC_Nm)
+ if (n->type != ROFFT_BLOCK || n->tok == MDOC_Nm)
continue;
if (n->tok == MDOC_It) {
@@ -871,7 +872,7 @@ blk_full(MACRO_PROT_ARGS)
n->flags |= MDOC_BROKEN;
continue;
}
- if (n->type != MDOC_BLOCK)
+ if (n->type != ROFFT_BLOCK)
continue;
if (tok == MDOC_It && n->tok == MDOC_Bl) {
@@ -1014,7 +1015,7 @@ blk_full(MACRO_PROT_ARGS)
/*
* Emit leading punctuation (i.e., punctuation before
- * the MDOC_HEAD) for non-phrase types.
+ * the ROFFT_HEAD) for non-phrase types.
*/
if (head == NULL &&
@@ -1084,7 +1085,7 @@ blk_full(MACRO_PROT_ARGS)
n->flags |= MDOC_BROKEN;
continue;
}
- if (n->type == MDOC_BLOCK &&
+ if (n->type == ROFFT_BLOCK &&
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) {
n->flags = MDOC_BROKEN;
head->flags = MDOC_ENDED;
@@ -1169,7 +1170,7 @@ blk_part_imp(MACRO_PROT_ARGS)
n->flags |= MDOC_BROKEN;
continue;
}
- if (n->type == MDOC_BLOCK &&
+ if (n->type == ROFFT_BLOCK &&
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) {
n->flags |= MDOC_BROKEN;
if ( ! (body->flags & MDOC_ENDED)) {
@@ -1450,7 +1451,7 @@ phrase_ta(MACRO_PROT_ARGS)
for (n = mdoc->last; n != NULL; n = n->parent) {
if (n->flags & MDOC_ENDED)
continue;
- if (n->tok == MDOC_It && n->type == MDOC_BODY)
+ if (n->tok == MDOC_It && n->type == ROFFT_BODY)
body = n;
if (n->tok == MDOC_Bl)
break;
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index e0443018256..dec59817153 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_man.c,v 1.86 2015/02/17 20:33:44 schwarze Exp $ */
+/* $OpenBSD: mdoc_man.c,v 1.87 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -20,11 +20,12 @@
#include <stdio.h>
#include <string.h>
-#include "mandoc.h"
#include "mandoc_aux.h"
-#include "out.h"
-#include "man.h"
+#include "mandoc.h"
+#include "roff.h"
#include "mdoc.h"
+#include "man.h"
+#include "out.h"
#include "main.h"
#define DECL_ARGS const struct mdoc_meta *meta, struct mdoc_node *n
@@ -490,7 +491,7 @@ print_width(const struct mdoc_bl *bl, const struct mdoc_node *child)
/* XXX Rough estimation, might have multiple parts. */
if (bl->type == LIST_enum)
chsz = (bl->count > 8) + 1;
- else if (child != NULL && child->type == MDOC_TEXT)
+ else if (child != NULL && child->type == ROFFT_TEXT)
chsz = strlen(child->string);
else
chsz = 0;
@@ -590,7 +591,7 @@ print_node(DECL_ARGS)
do_sub = 1;
n->flags &= ~MDOC_ENDED;
- if (MDOC_TEXT == n->type) {
+ if (n->type == ROFFT_TEXT) {
/*
* Make sure that we don't happen to start with a
* control character at the start of a line.
@@ -646,14 +647,14 @@ static int
cond_head(DECL_ARGS)
{
- return(MDOC_HEAD == n->type);
+ return(n->type == ROFFT_HEAD);
}
static int
cond_body(DECL_ARGS)
{
- return(MDOC_BODY == n->type);
+ return(n->type == ROFFT_BODY);
}
static int
@@ -776,7 +777,7 @@ static int
pre_sect(DECL_ARGS)
{
- if (MDOC_HEAD == n->type) {
+ if (n->type == ROFFT_HEAD) {
outflags |= MMAN_sp;
print_block(manacts[n->tok].prefix, 0);
print_word("");
@@ -793,7 +794,7 @@ static void
post_sect(DECL_ARGS)
{
- if (MDOC_HEAD != n->type)
+ if (n->type != ROFFT_HEAD)
return;
outflags &= ~MMAN_spc;
print_word("");
@@ -930,9 +931,9 @@ pre_bf(DECL_ARGS)
{
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
return(1);
- case MDOC_BODY:
+ case ROFFT_BODY:
break;
default:
return(0);
@@ -955,7 +956,7 @@ static void
post_bf(DECL_ARGS)
{
- if (MDOC_BODY == n->type)
+ if (n->type == ROFFT_BODY)
font_pop();
}
@@ -964,9 +965,9 @@ pre_bk(DECL_ARGS)
{
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
return(1);
- case MDOC_BODY:
+ case ROFFT_BODY:
outflags |= MMAN_Bk;
return(1);
default:
@@ -978,7 +979,7 @@ static void
post_bk(DECL_ARGS)
{
- if (MDOC_BODY == n->type)
+ if (n->type == ROFFT_BODY)
outflags &= ~MMAN_Bk;
}
@@ -1233,7 +1234,7 @@ post_fl(DECL_ARGS)
font_pop();
if ( ! (n->nchild ||
n->next == NULL ||
- n->next->type == MDOC_TEXT ||
+ n->next->type == ROFFT_TEXT ||
n->next->flags & MDOC_LINE))
outflags &= ~MMAN_spc;
}
@@ -1280,17 +1281,17 @@ pre_fo(DECL_ARGS)
{
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
pre_syn(n);
break;
- case MDOC_HEAD:
+ case ROFFT_HEAD:
if (n->child == NULL)
return(0);
if (MDOC_SYNPRETTY & n->flags)
print_block(".HP 4n", MMAN_nl);
font_push('B');
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
outflags &= ~(MMAN_spc | MMAN_nl);
print_word("(");
outflags &= ~MMAN_spc;
@@ -1306,11 +1307,11 @@ post_fo(DECL_ARGS)
{
switch (n->type) {
- case MDOC_HEAD:
+ case ROFFT_HEAD:
if (n->child != NULL)
font_pop();
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
post_fn(meta, n);
break;
default:
@@ -1366,7 +1367,7 @@ pre_it(DECL_ARGS)
const struct mdoc_node *bln;
switch (n->type) {
- case MDOC_HEAD:
+ case ROFFT_HEAD:
outflags |= MMAN_PP | MMAN_nl;
bln = n->parent->parent;
if (0 == bln->norm->Bl.comp ||
@@ -1465,7 +1466,7 @@ post_it(DECL_ARGS)
bln = n->parent->parent;
switch (n->type) {
- case MDOC_HEAD:
+ case ROFFT_HEAD:
switch (bln->norm->Bl.type) {
case LIST_diag:
outflags &= ~MMAN_spc;
@@ -1478,7 +1479,7 @@ post_it(DECL_ARGS)
break;
}
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
switch (bln->norm->Bl.type) {
case LIST_bullet:
/* FALLTHROUGH */
@@ -1572,16 +1573,16 @@ pre_nm(DECL_ARGS)
{
char *name;
- if (MDOC_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
outflags |= MMAN_Bk;
pre_syn(n);
}
- if (MDOC_ELEM != n->type && MDOC_HEAD != n->type)
+ if (n->type != ROFFT_ELEM && n->type != ROFFT_HEAD)
return(1);
name = n->child ? n->child->string : meta->name;
if (NULL == name)
return(0);
- if (MDOC_HEAD == n->type) {
+ if (n->type == ROFFT_HEAD) {
if (NULL == n->parent->prev)
outflags |= MMAN_sp;
print_block(".HP", 0);
@@ -1599,12 +1600,12 @@ post_nm(DECL_ARGS)
{
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
outflags &= ~MMAN_Bk;
break;
- case MDOC_HEAD:
+ case ROFFT_HEAD:
/* FALLTHROUGH */
- case MDOC_ELEM:
+ case ROFFT_ELEM:
if (n->child != NULL || meta->name != NULL)
font_pop();
break;
@@ -1768,10 +1769,10 @@ pre_vt(DECL_ARGS)
if (MDOC_SYNPRETTY & n->flags) {
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
pre_syn(n);
return(1);
- case MDOC_BODY:
+ case ROFFT_BODY:
break;
default:
return(0);
@@ -1785,7 +1786,7 @@ static void
post_vt(DECL_ARGS)
{
- if (MDOC_SYNPRETTY & n->flags && MDOC_BODY != n->type)
+ if (n->flags & MDOC_SYNPRETTY && n->type != ROFFT_BODY)
return;
font_pop();
}
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 5a9ec602703..adc3eb4e24c 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_term.c,v 1.212 2015/03/09 17:41:36 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.213 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -8,9 +8,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -26,11 +26,12 @@
#include <stdlib.h>
#include <string.h>
-#include "mandoc.h"
#include "mandoc_aux.h"
+#include "mandoc.h"
+#include "roff.h"
+#include "mdoc.h"
#include "out.h"
#include "term.h"
-#include "mdoc.h"
#include "main.h"
struct termpair {
@@ -329,7 +330,7 @@ print_mdoc_node(DECL_ARGS)
*/
switch (n->type) {
- case MDOC_TEXT:
+ case ROFFT_TEXT:
if (' ' == *n->string && MDOC_LINE & n->flags)
term_newln(p);
if (MDOC_DELIMC & n->flags)
@@ -338,14 +339,14 @@ print_mdoc_node(DECL_ARGS)
if (MDOC_DELIMO & n->flags)
p->flags |= TERMP_NOSPACE;
break;
- case MDOC_EQN:
+ case ROFFT_EQN:
if ( ! (n->flags & MDOC_LINE))
p->flags |= TERMP_NOSPACE;
term_eqn(p, n->eqn);
if (n->next != NULL && ! (n->next->flags & MDOC_LINE))
p->flags |= TERMP_NOSPACE;
break;
- case MDOC_TBL:
+ case ROFFT_TBL:
if (p->tbl.cols == NULL)
term_newln(p);
term_tbl(p, n->span);
@@ -365,11 +366,11 @@ print_mdoc_node(DECL_ARGS)
(ENDBODY_NOT == n->end ? n : n->body)->prev_font);
switch (n->type) {
- case MDOC_TEXT:
+ case ROFFT_TEXT:
break;
- case MDOC_TBL:
+ case ROFFT_TBL:
break;
- case MDOC_EQN:
+ case ROFFT_EQN:
break;
default:
if ( ! termacts[n->tok].post || MDOC_ENDED & n->flags)
@@ -566,9 +567,9 @@ print_bvspace(struct termp *p,
while (nn->prev == NULL) {
do {
nn = nn->parent;
- if (nn->type == MDOC_ROOT)
+ if (nn->type == ROFFT_ROOT)
return;
- } while (nn->type != MDOC_BLOCK);
+ } while (nn->type != ROFFT_BLOCK);
if (nn->tok == MDOC_Sh || nn->tok == MDOC_Ss)
return;
if (nn->tok == MDOC_It &&
@@ -612,7 +613,7 @@ termp_it_pre(DECL_ARGS)
int i, offset, width;
enum mdoc_list type;
- if (MDOC_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
print_bvspace(p, n->parent->parent, n);
return(1);
}
@@ -664,7 +665,7 @@ termp_it_pre(DECL_ARGS)
switch (type) {
case LIST_column:
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
break;
/*
@@ -681,8 +682,8 @@ termp_it_pre(DECL_ARGS)
ncols == 5 ? term_len(p, 3) : term_len(p, 1);
/*
- * Calculate the offset by applying all prior MDOC_BODY,
- * so we stop at the MDOC_HEAD (NULL == nn->prev).
+ * Calculate the offset by applying all prior ROFFT_BODY,
+ * so we stop at the ROFFT_HEAD (nn->prev == NULL).
*/
for (i = 0, nn = n->prev;
@@ -732,11 +733,11 @@ termp_it_pre(DECL_ARGS)
switch (type) {
case LIST_diag:
- if (MDOC_BODY == n->type)
+ if (n->type == ROFFT_BODY)
term_word(p, "\\ \\ ");
break;
case LIST_inset:
- if (MDOC_BODY == n->type && n->parent->head->nchild)
+ if (n->type == ROFFT_BODY && n->parent->head->nchild)
term_word(p, "\\ ");
break;
default:
@@ -747,7 +748,7 @@ termp_it_pre(DECL_ARGS)
switch (type) {
case LIST_diag:
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
term_fontpush(p, TERMFONT_BOLD);
break;
default:
@@ -775,13 +776,13 @@ termp_it_pre(DECL_ARGS)
case LIST_hyphen:
if (width <= (int)term_len(p, 2))
p->flags |= TERMP_HANG;
- if (MDOC_HEAD != n->type)
+ if (n->type != ROFFT_HEAD)
break;
p->flags |= TERMP_NOBREAK;
p->trailspace = 1;
break;
case LIST_hang:
- if (MDOC_HEAD != n->type)
+ if (n->type != ROFFT_HEAD)
break;
/*
@@ -800,7 +801,7 @@ termp_it_pre(DECL_ARGS)
p->trailspace = 1;
break;
case LIST_tag:
- if (MDOC_HEAD != n->type)
+ if (n->type != ROFFT_HEAD)
break;
p->flags |= TERMP_NOBREAK | TERMP_BRIND;
@@ -810,7 +811,7 @@ termp_it_pre(DECL_ARGS)
p->flags |= TERMP_DANGLE;
break;
case LIST_column:
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
break;
if (NULL == n->next) {
@@ -823,7 +824,7 @@ termp_it_pre(DECL_ARGS)
break;
case LIST_diag:
- if (MDOC_HEAD != n->type)
+ if (n->type != ROFFT_HEAD)
break;
p->flags |= TERMP_NOBREAK | TERMP_BRIND;
p->trailspace = 1;
@@ -847,7 +848,7 @@ termp_it_pre(DECL_ARGS)
* don't want to recalculate rmargin and offsets when
* using `Bd' or `Bl' within `-hang' overstep lists.
*/
- if (MDOC_HEAD == n->type &&
+ if (n->type == ROFFT_HEAD &&
NULL != n->next &&
NULL != n->next->child &&
(MDOC_Bl == n->next->child->tok ||
@@ -863,7 +864,7 @@ termp_it_pre(DECL_ARGS)
case LIST_hyphen:
/* FALLTHROUGH */
case LIST_tag:
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
p->rmargin = p->offset + width;
else
p->offset += width;
@@ -875,7 +876,7 @@ termp_it_pre(DECL_ARGS)
* XXX - this behaviour is not documented: the
* right-most column is filled to the right margin.
*/
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
break;
if (NULL == n->next && p->rmargin < p->maxrmargin)
p->rmargin = p->maxrmargin;
@@ -889,7 +890,7 @@ termp_it_pre(DECL_ARGS)
* HEAD character (temporarily bold, in some cases).
*/
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
switch (type) {
case LIST_bullet:
term_fontpush(p, TERMFONT_BOLD);
@@ -927,11 +928,11 @@ termp_it_pre(DECL_ARGS)
case LIST_hyphen:
/* FALLTHROUGH */
case LIST_enum:
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
return(0);
break;
case LIST_column:
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
return(0);
break;
default:
@@ -946,7 +947,7 @@ termp_it_post(DECL_ARGS)
{
enum mdoc_list type;
- if (MDOC_BLOCK == n->type)
+ if (n->type == ROFFT_BLOCK)
return;
type = n->parent->parent->parent->norm->Bl.type;
@@ -957,11 +958,11 @@ termp_it_post(DECL_ARGS)
case LIST_diag:
/* FALLTHROUGH */
case LIST_inset:
- if (MDOC_BODY == n->type)
+ if (n->type == ROFFT_BODY)
term_newln(p);
break;
case LIST_column:
- if (MDOC_BODY == n->type)
+ if (n->type == ROFFT_BODY)
term_flushln(p);
break;
default:
@@ -985,12 +986,12 @@ termp_nm_pre(DECL_ARGS)
{
const char *cp;
- if (MDOC_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
p->flags |= TERMP_PREKEEP;
return(1);
}
- if (MDOC_BODY == n->type) {
+ if (n->type == ROFFT_BODY) {
if (NULL == n->child)
return(0);
p->flags |= TERMP_NOSPACE;
@@ -1009,17 +1010,17 @@ termp_nm_pre(DECL_ARGS)
if (NULL == n->child && NULL == meta->name)
return(0);
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
synopsis_pre(p, n->parent);
- if (MDOC_HEAD == n->type &&
+ if (n->type == ROFFT_HEAD &&
NULL != n->next && NULL != n->next->child) {
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK | TERMP_BRIND;
p->trailspace = 1;
p->rmargin = p->offset + term_len(p, 1);
if (NULL == n->child) {
p->rmargin += term_strlen(p, meta->name);
- } else if (MDOC_TEXT == n->child->type) {
+ } else if (n->child->type == ROFFT_TEXT) {
p->rmargin += term_strlen(p, n->child->string);
if (n->child->next)
p->flags |= TERMP_HANG;
@@ -1039,14 +1040,14 @@ static void
termp_nm_post(DECL_ARGS)
{
- if (MDOC_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
- } else if (MDOC_HEAD == n->type &&
+ } else if (n->type == ROFFT_HEAD &&
NULL != n->next && NULL != n->next->child) {
term_flushln(p);
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG);
p->trailspace = 0;
- } else if (MDOC_BODY == n->type && n->child)
+ } else if (n->type == ROFFT_BODY && n->child != NULL)
term_flushln(p);
}
@@ -1059,7 +1060,7 @@ termp_fl_pre(DECL_ARGS)
if ( ! (n->nchild == 0 &&
(n->next == NULL ||
- n->next->type == MDOC_TEXT ||
+ n->next->type == ROFFT_TEXT ||
n->next->flags & MDOC_LINE)))
p->flags |= TERMP_NOSPACE;
@@ -1116,7 +1117,7 @@ termp_rs_pre(DECL_ARGS)
if (SEC_SEE_ALSO != n->sec)
return(1);
- if (MDOC_BLOCK == n->type && n->prev)
+ if (n->type == ROFFT_BLOCK && n->prev != NULL)
term_vspace(p);
return(1);
}
@@ -1212,7 +1213,7 @@ static int
termp_nd_pre(DECL_ARGS)
{
- if (n->type == MDOC_BODY)
+ if (n->type == ROFFT_BODY)
term_word(p, "\\(en");
return(1);
}
@@ -1221,14 +1222,14 @@ static int
termp_bl_pre(DECL_ARGS)
{
- return(MDOC_HEAD != n->type);
+ return(n->type != ROFFT_HEAD);
}
static void
termp_bl_post(DECL_ARGS)
{
- if (MDOC_BLOCK == n->type)
+ if (n->type == ROFFT_BLOCK)
term_newln(p);
}
@@ -1239,7 +1240,7 @@ termp_xr_pre(DECL_ARGS)
if (NULL == (n = n->child))
return(0);
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
term_word(p, n->string);
if (NULL == (n = n->next))
@@ -1249,7 +1250,7 @@ termp_xr_pre(DECL_ARGS)
term_word(p, "(");
p->flags |= TERMP_NOSPACE;
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
term_word(p, n->string);
p->flags |= TERMP_NOSPACE;
@@ -1319,13 +1320,13 @@ static int
termp_vt_pre(DECL_ARGS)
{
- if (MDOC_ELEM == n->type) {
+ if (n->type == ROFFT_ELEM) {
synopsis_pre(p, n);
return(termp_under_pre(p, pair, meta, n));
- } else if (MDOC_BLOCK == n->type) {
+ } else if (n->type == ROFFT_BLOCK) {
synopsis_pre(p, n);
return(1);
- } else if (MDOC_HEAD == n->type)
+ } else if (n->type == ROFFT_HEAD)
return(0);
return(termp_under_pre(p, pair, meta, n));
@@ -1359,7 +1360,7 @@ termp_sh_pre(DECL_ARGS)
{
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
/*
* Vertical space before sections, except
* when the previous section was empty.
@@ -1370,10 +1371,10 @@ termp_sh_pre(DECL_ARGS)
n->prev->body->child != NULL))
term_vspace(p);
break;
- case MDOC_HEAD:
+ case ROFFT_HEAD:
term_fontpush(p, TERMFONT_BOLD);
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
p->offset = term_len(p, p->defindent);
if (SEC_AUTHORS == n->sec)
p->flags &= ~(TERMP_SPLIT|TERMP_NOSPLIT);
@@ -1389,10 +1390,10 @@ termp_sh_post(DECL_ARGS)
{
switch (n->type) {
- case MDOC_HEAD:
+ case ROFFT_HEAD:
term_newln(p);
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
term_newln(p);
p->offset = 0;
break;
@@ -1431,7 +1432,7 @@ static int
termp_d1_pre(DECL_ARGS)
{
- if (MDOC_BLOCK != n->type)
+ if (n->type != ROFFT_BLOCK)
return(1);
term_newln(p);
p->offset += term_len(p, p->defindent + 1);
@@ -1467,7 +1468,7 @@ termp_fn_pre(DECL_ARGS)
p->flags |= TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG;
}
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
term_fontpush(p, TERMFONT_BOLD);
term_word(p, n->string);
term_fontpop(p);
@@ -1484,7 +1485,7 @@ termp_fn_pre(DECL_ARGS)
p->flags |= TERMP_NOSPACE;
for (n = n->next; n; n = n->next) {
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
term_fontpush(p, TERMFONT_UNDER);
if (pretty)
p->flags |= TERMP_NBRWORD;
@@ -1541,10 +1542,10 @@ termp_bd_pre(DECL_ARGS)
struct mdoc_node *nn;
int offset;
- if (MDOC_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
print_bvspace(p, n, n);
return(1);
- } else if (MDOC_HEAD == n->type)
+ } else if (n->type == ROFFT_HEAD)
return(0);
/* Handle the -offset argument. */
@@ -1588,7 +1589,7 @@ termp_bd_pre(DECL_ARGS)
for (nn = n->child; nn; nn = nn->next) {
if (DISP_centered == n->norm->Bd.type) {
- if (MDOC_TEXT == nn->type) {
+ if (nn->type == ROFFT_TEXT) {
len = term_strlen(p, nn->string);
p->offset = len >= rm ? 0 :
lm + len >= rm ? rm - len :
@@ -1641,7 +1642,7 @@ termp_bd_post(DECL_ARGS)
{
size_t rm, rmax;
- if (MDOC_BODY != n->type)
+ if (n->type != ROFFT_BODY)
return;
rm = p->rmargin;
@@ -1735,16 +1736,16 @@ termp_ss_pre(DECL_ARGS)
{
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
term_newln(p);
if (n->prev)
term_vspace(p);
break;
- case MDOC_HEAD:
+ case ROFFT_HEAD:
term_fontpush(p, TERMFONT_BOLD);
p->offset = term_len(p, (p->defindent+1)/2);
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
p->offset = term_len(p, p->defindent);
break;
default:
@@ -1758,7 +1759,7 @@ static void
termp_ss_post(DECL_ARGS)
{
- if (n->type == MDOC_HEAD || n->type == MDOC_BODY)
+ if (n->type == ROFFT_HEAD || n->type == ROFFT_BODY)
term_newln(p);
}
@@ -1849,7 +1850,7 @@ static int
termp_quote_pre(DECL_ARGS)
{
- if (MDOC_BODY != n->type && MDOC_ELEM != n->type)
+ if (n->type != ROFFT_BODY && n->type != ROFFT_ELEM)
return(1);
switch (n->tok) {
@@ -1916,7 +1917,7 @@ static void
termp_quote_post(DECL_ARGS)
{
- if (n->type != MDOC_BODY && n->type != MDOC_ELEM)
+ if (n->type != ROFFT_BODY && n->type != ROFFT_ELEM)
return;
p->flags |= TERMP_NOSPACE;
@@ -1984,7 +1985,7 @@ static int
termp_eo_pre(DECL_ARGS)
{
- if (n->type != MDOC_BODY)
+ if (n->type != ROFFT_BODY)
return(1);
if (n->end == ENDBODY_NOT &&
@@ -2005,7 +2006,7 @@ termp_eo_post(DECL_ARGS)
{
int body, tail;
- if (n->type != MDOC_BODY)
+ if (n->type != ROFFT_BODY)
return;
if (n->end != ENDBODY_NOT) {
@@ -2032,10 +2033,10 @@ termp_fo_pre(DECL_ARGS)
pretty = MDOC_SYNPRETTY & n->flags;
- if (MDOC_BLOCK == n->type) {
+ if (n->type == ROFFT_BLOCK) {
synopsis_pre(p, n);
return(1);
- } else if (MDOC_BODY == n->type) {
+ } else if (n->type == ROFFT_BODY) {
if (pretty) {
rmargin = p->rmargin;
p->rmargin = p->offset + term_len(p, 4);
@@ -2070,7 +2071,7 @@ static void
termp_fo_post(DECL_ARGS)
{
- if (MDOC_BODY != n->type)
+ if (n->type != ROFFT_BODY)
return;
p->flags |= TERMP_NOSPACE;
@@ -2087,9 +2088,9 @@ static int
termp_bf_pre(DECL_ARGS)
{
- if (MDOC_HEAD == n->type)
+ if (n->type == ROFFT_HEAD)
return(0);
- else if (MDOC_BODY != n->type)
+ else if (n->type != ROFFT_BODY)
return(1);
if (FONT_Em == n->norm->Bf.font)
@@ -2195,11 +2196,11 @@ termp_bk_pre(DECL_ARGS)
{
switch (n->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
break;
- case MDOC_HEAD:
+ case ROFFT_HEAD:
return(0);
- case MDOC_BODY:
+ case ROFFT_BODY:
if (n->parent->args || 0 == n->prev->nchild)
p->flags |= TERMP_PREKEEP;
break;
@@ -2215,7 +2216,7 @@ static void
termp_bk_post(DECL_ARGS)
{
- if (MDOC_BODY == n->type)
+ if (n->type == ROFFT_BODY)
p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
}
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index e7f1a7b87c8..4408402dcb1 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_validate.c,v 1.199 2015/02/23 13:54:39 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.200 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -8,9 +8,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -29,11 +29,12 @@
#include <string.h>
#include <time.h>
-#include "mdoc.h"
-#include "mandoc.h"
#include "mandoc_aux.h"
-#include "libmdoc.h"
+#include "mandoc.h"
+#include "roff.h"
+#include "mdoc.h"
#include "libmandoc.h"
+#include "libmdoc.h"
/* FIXME: .Bl -diag can't have non-text children in HEAD. */
@@ -295,15 +296,15 @@ mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n)
v_pre p;
switch (n->type) {
- case MDOC_TEXT:
+ case ROFFT_TEXT:
if (n->sec != SEC_SYNOPSIS || n->parent->tok != MDOC_Fd)
check_text(mdoc, n->line, n->pos, n->string);
/* FALLTHROUGH */
- case MDOC_TBL:
+ case ROFFT_TBL:
/* FALLTHROUGH */
- case MDOC_EQN:
+ case ROFFT_EQN:
/* FALLTHROUGH */
- case MDOC_ROOT:
+ case ROFFT_ROOT:
return;
default:
break;
@@ -327,13 +328,13 @@ mdoc_valid_post(struct mdoc *mdoc)
n->flags |= MDOC_VALID | MDOC_ENDED;
switch (n->type) {
- case MDOC_TEXT:
+ case ROFFT_TEXT:
/* FALLTHROUGH */
- case MDOC_EQN:
+ case ROFFT_EQN:
/* FALLTHROUGH */
- case MDOC_TBL:
+ case ROFFT_TBL:
break;
- case MDOC_ROOT:
+ case ROFFT_ROOT:
post_root(mdoc);
break;
default:
@@ -398,11 +399,11 @@ pre_display(PRE_ARGS)
{
struct mdoc_node *node;
- if (MDOC_BLOCK != n->type)
+ if (n->type != ROFFT_BLOCK)
return;
for (node = mdoc->last->parent; node; node = node->parent)
- if (MDOC_BLOCK == node->type)
+ if (node->type == ROFFT_BLOCK)
if (MDOC_Bd == node->tok)
break;
@@ -420,7 +421,7 @@ pre_bl(PRE_ARGS)
enum mdocargt mdoclt;
enum mdoc_list lt;
- if (n->type != MDOC_BLOCK)
+ if (n->type != ROFFT_BLOCK)
return;
/*
@@ -603,7 +604,7 @@ pre_bd(PRE_ARGS)
pre_literal(mdoc, n);
- if (n->type != MDOC_BLOCK)
+ if (n->type != ROFFT_BLOCK)
return;
for (i = 0; n->args && i < (int)n->args->argc; i++) {
@@ -716,7 +717,7 @@ static void
pre_obsolete(PRE_ARGS)
{
- if (MDOC_ELEM == n->type || MDOC_BLOCK == n->type)
+ if (n->type == ROFFT_ELEM || n->type == ROFFT_BLOCK)
mandoc_msg(MANDOCERR_MACRO_OBS, mdoc->parse,
n->line, n->pos, mdoc_macronames[n->tok]);
}
@@ -775,10 +776,10 @@ post_bf(POST_ARGS)
*/
np = mdoc->last;
- if (MDOC_HEAD != np->type)
+ if (np->type != ROFFT_HEAD)
return;
- assert(MDOC_BLOCK == np->parent->type);
+ assert(np->parent->type == ROFFT_BLOCK);
assert(MDOC_Bf == np->parent->tok);
/* Check the number of arguments. */
@@ -832,7 +833,7 @@ post_lb(POST_ARGS)
char *libname;
n = mdoc->last->child;
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
mandoc_asprintf(&libname, "library \\(Lq%s\\(Rq", n->string);
free(n->string);
n->string = libname;
@@ -881,7 +882,7 @@ post_fo(POST_ARGS)
n = mdoc->last;
- if (n->type != MDOC_HEAD)
+ if (n->type != ROFFT_HEAD)
return;
if (n->child == NULL) {
@@ -934,11 +935,11 @@ post_vt(POST_ARGS)
* specifically the BODY, should only have TEXT children.
*/
- if (MDOC_BODY != mdoc->last->type)
+ if (mdoc->last->type != ROFFT_BODY)
return;
for (n = mdoc->last->child; n; n = n->next)
- if (MDOC_TEXT != n->type)
+ if (n->type != ROFFT_TEXT)
mandoc_msg(MANDOCERR_VT_CHILD, mdoc->parse,
n->line, n->pos, mdoc_macronames[n->tok]);
}
@@ -972,7 +973,7 @@ post_nd(POST_ARGS)
n = mdoc->last;
- if (n->type != MDOC_BODY)
+ if (n->type != ROFFT_BODY)
return;
if (n->child == NULL)
@@ -989,7 +990,7 @@ post_d1(POST_ARGS)
n = mdoc->last;
- if (n->type != MDOC_BODY)
+ if (n->type != ROFFT_BODY)
return;
if (n->child == NULL)
@@ -1006,7 +1007,7 @@ post_literal(POST_ARGS)
n = mdoc->last;
- if (n->type != MDOC_BODY)
+ if (n->type != ROFFT_BODY)
return;
if (n->child == NULL)
@@ -1077,7 +1078,7 @@ post_at(POST_ARGS)
*/
n = n->child;
- assert(MDOC_TEXT == n->type);
+ assert(n->type == ROFFT_TEXT);
if (NULL == (std_att = mdoc_a2att(n->string))) {
mandoc_vmsg(MANDOCERR_AT_BAD, mdoc->parse,
n->line, n->pos, "At %s", n->string);
@@ -1109,7 +1110,7 @@ static void
post_en(POST_ARGS)
{
- if (MDOC_BLOCK == mdoc->last->type)
+ if (mdoc->last->type == ROFFT_BLOCK)
mdoc->last->norm->Es = mdoc->last_es;
}
@@ -1128,7 +1129,7 @@ post_it(POST_ARGS)
struct mdoc_node *nbl, *nit, *nch;
nit = mdoc->last;
- if (nit->type != MDOC_BLOCK)
+ if (nit->type != ROFFT_BLOCK)
return;
nbl = nit->parent->parent;
@@ -1175,7 +1176,7 @@ post_it(POST_ARGS)
assert(nit->head->child == NULL);
for (i = 0, nch = nit->child; nch; nch = nch->next)
- if (nch->type == MDOC_BODY)
+ if (nch->type == ROFFT_BODY)
i++;
if (i < cols || i > cols + 1)
@@ -1289,13 +1290,13 @@ post_bl_block_tag(POST_ARGS)
if (MDOC_It != nn->tok)
continue;
- assert(MDOC_BLOCK == nn->type);
+ assert(nn->type == ROFFT_BLOCK);
nn = nn->head->child;
if (nn == NULL)
break;
- if (MDOC_TEXT == nn->type) {
+ if (nn->type == ROFFT_TEXT) {
sz = strlen(nn->string) + 1;
break;
}
@@ -1403,13 +1404,13 @@ post_bl(POST_ARGS)
nbody = mdoc->last;
switch (nbody->type) {
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
post_bl_block(mdoc);
return;
- case MDOC_HEAD:
+ case ROFFT_HEAD:
post_bl_head(mdoc);
return;
- case MDOC_BODY:
+ case ROFFT_BODY:
break;
default:
return;
@@ -1484,7 +1485,7 @@ post_bk(POST_ARGS)
n = mdoc->last;
- if (n->type == MDOC_BLOCK && n->body->child == NULL) {
+ if (n->type == ROFFT_BLOCK && n->body->child == NULL) {
mandoc_msg(MANDOCERR_BLK_EMPTY,
mdoc->parse, n->line, n->pos, "Bk");
mdoc_node_delete(mdoc, n);
@@ -1503,7 +1504,7 @@ post_sm(struct mdoc *mdoc)
return;
}
- assert(nch->type == MDOC_TEXT);
+ assert(nch->type == ROFFT_TEXT);
if ( ! strcmp(nch->string, "on")) {
mdoc->flags &= ~MDOC_SMOFF;
@@ -1570,7 +1571,7 @@ post_st(POST_ARGS)
n = mdoc->last;
nch = n->child;
- assert(MDOC_TEXT == nch->type);
+ assert(nch->type == ROFFT_TEXT);
if (NULL == (p = mdoc_a2st(nch->string))) {
mandoc_vmsg(MANDOCERR_ST_BAD, mdoc->parse,
@@ -1590,7 +1591,7 @@ post_rs(POST_ARGS)
np = mdoc->last;
- if (np->type != MDOC_BODY)
+ if (np->type != ROFFT_BODY)
return;
if (np->child == NULL) {
@@ -1683,7 +1684,7 @@ post_hyph(POST_ARGS)
char *cp;
for (nch = mdoc->last->child; nch != NULL; nch = nch->next) {
- if (nch->type != MDOC_TEXT)
+ if (nch->type != ROFFT_TEXT)
continue;
cp = nch->string;
if (*cp == '\0')
@@ -1712,10 +1713,10 @@ post_sh(POST_ARGS)
post_ignpar(mdoc);
switch (mdoc->last->type) {
- case MDOC_HEAD:
+ case ROFFT_HEAD:
post_sh_head(mdoc);
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
switch (mdoc->lastsec) {
case SEC_NAME:
post_sh_name(mdoc);
@@ -1821,7 +1822,7 @@ post_sh_see_also(POST_ARGS)
lastpunct = "none";
continue;
}
- if (n->type != MDOC_TEXT)
+ if (n->type != ROFFT_TEXT)
break;
for (name = n->string; *name != '\0'; name++)
if (isalpha((const unsigned char)*name))
@@ -1980,10 +1981,10 @@ post_ignpar(POST_ARGS)
struct mdoc_node *np;
switch (mdoc->last->type) {
- case MDOC_HEAD:
+ case ROFFT_HEAD:
post_hyph(mdoc);
return;
- case MDOC_BODY:
+ case ROFFT_BODY:
break;
default:
return;
@@ -2014,7 +2015,7 @@ pre_par(PRE_ARGS)
if (NULL == mdoc->last)
return;
- if (MDOC_ELEM != n->type && MDOC_BLOCK != n->type)
+ if (n->type != ROFFT_ELEM && n->type != ROFFT_BLOCK)
return;
/*
@@ -2079,7 +2080,7 @@ pre_literal(PRE_ARGS)
pre_display(mdoc, n);
- if (MDOC_BODY != n->type)
+ if (n->type != ROFFT_BODY)
return;
/*
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index 4f07bb117a7..49c2aa1b475 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read.c,v 1.107 2015/03/17 07:32:21 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.108 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -8,9 +8,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -32,11 +32,12 @@
#include <string.h>
#include <unistd.h>
-#include "mandoc.h"
#include "mandoc_aux.h"
-#include "libmandoc.h"
+#include "mandoc.h"
+#include "roff.h"
#include "mdoc.h"
#include "man.h"
+#include "libmandoc.h"
#define REPARSE_LIMIT 1000
diff --git a/usr.bin/mandoc/roff.h b/usr.bin/mandoc/roff.h
new file mode 100644
index 00000000000..3105289fec8
--- /dev/null
+++ b/usr.bin/mandoc/roff.h
@@ -0,0 +1,29 @@
+/* $OpenBSD: roff.h,v 1.10 2015/04/02 21:03:18 schwarze Exp $ */
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+enum roff_type {
+ ROFFT_ROOT,
+ ROFFT_BLOCK,
+ ROFFT_HEAD,
+ ROFFT_BODY,
+ ROFFT_TAIL,
+ ROFFT_ELEM,
+ ROFFT_TEXT,
+ ROFFT_TBL,
+ ROFFT_EQN
+};
diff --git a/usr.bin/mandoc/st.c b/usr.bin/mandoc/st.c
index ae6718cec57..eaa6a20843d 100644
--- a/usr.bin/mandoc/st.c
+++ b/usr.bin/mandoc/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.8 2014/11/28 19:25:03 schwarze Exp $ */
+/* $OpenBSD: st.c,v 1.9 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -18,6 +18,7 @@
#include <string.h>
+#include "roff.h"
#include "mdoc.h"
#include "libmdoc.h"
diff --git a/usr.bin/mandoc/tree.c b/usr.bin/mandoc/tree.c
index 0d937808297..290b513b6f2 100644
--- a/usr.bin/mandoc/tree.c
+++ b/usr.bin/mandoc/tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tree.c,v 1.29 2015/02/05 00:13:34 schwarze Exp $ */
+/* $OpenBSD: tree.c,v 1.30 2015/04/02 21:03:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -24,6 +24,7 @@
#include <time.h>
#include "mandoc.h"
+#include "roff.h"
#include "mdoc.h"
#include "man.h"
#include "main.h"
@@ -64,33 +65,33 @@ print_mdoc(const struct mdoc_node *n, int indent)
t = p = NULL;
switch (n->type) {
- case MDOC_ROOT:
+ case ROFFT_ROOT:
t = "root";
break;
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
t = "block";
break;
- case MDOC_HEAD:
+ case ROFFT_HEAD:
t = "block-head";
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
if (n->end)
t = "body-end";
else
t = "block-body";
break;
- case MDOC_TAIL:
+ case ROFFT_TAIL:
t = "block-tail";
break;
- case MDOC_ELEM:
+ case ROFFT_ELEM:
t = "elem";
break;
- case MDOC_TEXT:
+ case ROFFT_TEXT:
t = "text";
break;
- case MDOC_TBL:
+ case ROFFT_TBL:
break;
- case MDOC_EQN:
+ case ROFFT_EQN:
t = "eqn";
break;
default:
@@ -99,38 +100,38 @@ print_mdoc(const struct mdoc_node *n, int indent)
}
switch (n->type) {
- case MDOC_TEXT:
+ case ROFFT_TEXT:
p = n->string;
break;
- case MDOC_BODY:
+ case ROFFT_BODY:
p = mdoc_macronames[n->tok];
break;
- case MDOC_HEAD:
+ case ROFFT_HEAD:
p = mdoc_macronames[n->tok];
break;
- case MDOC_TAIL:
+ case ROFFT_TAIL:
p = mdoc_macronames[n->tok];
break;
- case MDOC_ELEM:
+ case ROFFT_ELEM:
p = mdoc_macronames[n->tok];
if (n->args) {
argv = n->args->argv;
argc = n->args->argc;
}
break;
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
p = mdoc_macronames[n->tok];
if (n->args) {
argv = n->args->argv;
argc = n->args->argc;
}
break;
- case MDOC_TBL:
+ case ROFFT_TBL:
break;
- case MDOC_EQN:
+ case ROFFT_EQN:
p = "EQ";
break;
- case MDOC_ROOT:
+ case ROFFT_ROOT:
p = "root";
break;
default:
@@ -167,7 +168,7 @@ print_mdoc(const struct mdoc_node *n, int indent)
print_box(n->eqn->root->first, indent + 4);
if (n->child)
print_mdoc(n->child, indent +
- (n->type == MDOC_BLOCK ? 2 : 4));
+ (n->type == ROFFT_BLOCK ? 2 : 4));
if (n->next)
print_mdoc(n->next, indent);
}
@@ -184,27 +185,27 @@ print_man(const struct man_node *n, int indent)
t = p = NULL;
switch (n->type) {
- case MAN_ROOT:
+ case ROFFT_ROOT:
t = "root";
break;
- case MAN_ELEM:
+ case ROFFT_ELEM:
t = "elem";
break;
- case MAN_TEXT:
+ case ROFFT_TEXT:
t = "text";
break;
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
t = "block";
break;
- case MAN_HEAD:
+ case ROFFT_HEAD:
t = "block-head";
break;
- case MAN_BODY:
+ case ROFFT_BODY:
t = "block-body";
break;
- case MAN_TBL:
+ case ROFFT_TBL:
break;
- case MAN_EQN:
+ case ROFFT_EQN:
t = "eqn";
break;
default:
@@ -213,24 +214,24 @@ print_man(const struct man_node *n, int indent)
}
switch (n->type) {
- case MAN_TEXT:
+ case ROFFT_TEXT:
p = n->string;
break;
- case MAN_ELEM:
+ case ROFFT_ELEM:
/* FALLTHROUGH */
- case MAN_BLOCK:
+ case ROFFT_BLOCK:
/* FALLTHROUGH */
- case MAN_HEAD:
+ case ROFFT_HEAD:
/* FALLTHROUGH */
- case MAN_BODY:
+ case ROFFT_BODY:
p = man_macronames[n->tok];
break;
- case MAN_ROOT:
+ case ROFFT_ROOT:
p = "root";
break;
- case MAN_TBL:
+ case ROFFT_TBL:
break;
- case MAN_EQN:
+ case ROFFT_EQN:
p = "EQ";
break;
default:
@@ -254,7 +255,7 @@ print_man(const struct man_node *n, int indent)
print_box(n->eqn->root->first, indent + 4);
if (n->child)
print_man(n->child, indent +
- (n->type == MAN_BLOCK ? 2 : 4));
+ (n->type == ROFFT_BLOCK ? 2 : 4));
if (n->next)
print_man(n->next, indent);
}