aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-03-19 21:51:20 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-03-19 21:51:20 +0000
commit79d152fe17d260ddca9686d56a71ecaa8d58ecd2 (patch)
tree67e99d2be668b0013c9877e147deb8a4e9483f07 /roff.c
parent4f76006bc436b161a057a905ad55d9b213a6a141 (diff)
downloadmandoc-79d152fe17d260ddca9686d56a71ecaa8d58ecd2.tar.gz
mandoc-79d152fe17d260ddca9686d56a71ecaa8d58ecd2.tar.zst
mandoc-79d152fe17d260ddca9686d56a71ecaa8d58ecd2.zip
Generalize the mparse_alloc() and roff_alloc() functions by giving
them an "options" argument, replacing the existing "inttype" and "quick" arguments, preparing for a future MPARSE_SO option. Store this argument in struct mparse and struct roff, replacing the existing "inttype", "parsetype", and "quick" members. No functional change except one tiny cosmetic fix in roff_TH().
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/roff.c b/roff.c
index f4342bdd..b3f1e01f 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.198 2014/03/08 04:43:54 schwarze Exp $ */
+/* $Id: roff.c,v 1.199 2014/03/19 21:51:20 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -103,9 +103,8 @@ struct roffreg {
};
struct roff {
- enum mparset parsetype; /* requested parse type */
struct mparse *parse; /* parse point */
- int quick; /* skip standard macro deletion */
+ int options; /* parse options */
struct roffnode *last; /* leaf of stack */
int rstack[RSTACK_MAX]; /* stack of !`ie' rules */
char control; /* control character */
@@ -463,14 +462,13 @@ roff_free(struct roff *r)
struct roff *
-roff_alloc(enum mparset type, struct mparse *parse, int quick)
+roff_alloc(struct mparse *parse, int options)
{
struct roff *r;
r = mandoc_calloc(1, sizeof(struct roff));
- r->parsetype = type;
r->parse = parse;
- r->quick = quick;
+ r->options = options;
r->rstackpos = -1;
roffhash_init();
@@ -1552,7 +1550,7 @@ roff_Dd(ROFF_ARGS)
{
const char *const *cp;
- if (0 == r->quick && MPARSE_MDOC != r->parsetype)
+ if (0 == ((MPARSE_MDOC | MPARSE_QUICK) & r->options))
for (cp = __mdoc_reserved; *cp; cp++)
roff_setstr(r, *cp, NULL, 0);
@@ -1565,7 +1563,7 @@ roff_TH(ROFF_ARGS)
{
const char *const *cp;
- if (0 == r->quick && MPARSE_MDOC != r->parsetype)
+ if (0 == (MPARSE_QUICK & r->options))
for (cp = __man_reserved; *cp; cp++)
roff_setstr(r, *cp, NULL, 0);