aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-02 22:48:17 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-02 22:48:17 +0000
commit8a1e7c36cb8b9ca64c677d1ff9d786c9e46fd7b0 (patch)
tree8875174fa99d2fb62fe97ec308a53905416a4e4f /mandocdb.c
parent483afc5a7a52b601da9e854d5645cd4b0a140184 (diff)
downloadmandoc-8a1e7c36cb8b9ca64c677d1ff9d786c9e46fd7b0.tar.gz
mandoc-8a1e7c36cb8b9ca64c677d1ff9d786c9e46fd7b0.tar.zst
mandoc-8a1e7c36cb8b9ca64c677d1ff9d786c9e46fd7b0.zip
Second step towards parser unification:
Replace struct mdoc_node and struct man_node by a unified struct roff_node. To be able to use the tok member for both mdoc(7) and man(7) without defining all the macros in roff.h, sacrifice a tiny bit of type safety and make tok an int rather than an enum. Almost mechanical, no functional change. Written on the Eurostar from Bruxelles to London on the way to p2k15.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 84e2d5bb..73d7b108 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.188 2015/04/02 21:36:50 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.189 2015/04/02 22:48:17 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -131,7 +131,7 @@ enum stmt {
};
typedef int (*mdoc_fp)(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
struct mdoc_handler {
mdoc_fp fp; /* optional handler */
@@ -157,32 +157,32 @@ static void mpages_merge(struct mparse *);
static void names_check(void);
static void parse_cat(struct mpage *, int);
static void parse_man(struct mpage *, const struct man_meta *,
- const struct man_node *);
+ const struct roff_node *);
static void parse_mdoc(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
static int parse_mdoc_body(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
static int parse_mdoc_head(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
static int parse_mdoc_Fd(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
-static void parse_mdoc_fname(struct mpage *, const struct mdoc_node *);
+ const struct roff_node *);
+static void parse_mdoc_fname(struct mpage *, const struct roff_node *);
static int parse_mdoc_Fn(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
static int parse_mdoc_Fo(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
static int parse_mdoc_Nd(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
static int parse_mdoc_Nm(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
static int parse_mdoc_Sh(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
static int parse_mdoc_Xr(struct mpage *, const struct mdoc_meta *,
- const struct mdoc_node *);
+ const struct roff_node *);
static void putkey(const struct mpage *, char *, uint64_t);
static void putkeys(const struct mpage *, char *, size_t, uint64_t);
static void putmdockey(const struct mpage *,
- const struct mdoc_node *, uint64_t);
+ const struct roff_node *, uint64_t);
static int render_string(char **, size_t *);
static void say(const char *, const char *, ...);
static int set_basedir(const char *, int);
@@ -1431,7 +1431,7 @@ putkey(const struct mpage *mpage, char *value, uint64_t type)
*/
static void
putmdockey(const struct mpage *mpage,
- const struct mdoc_node *n, uint64_t m)
+ const struct roff_node *n, uint64_t m)
{
for ( ; NULL != n; n = n->next) {
@@ -1444,9 +1444,9 @@ putmdockey(const struct mpage *mpage,
static void
parse_man(struct mpage *mpage, const struct man_meta *meta,
- const struct man_node *n)
+ const struct roff_node *n)
{
- const struct man_node *head, *body;
+ const struct roff_node *head, *body;
char *start, *title;
char byte;
size_t sz;
@@ -1570,7 +1570,7 @@ parse_man(struct mpage *mpage, const struct man_meta *meta,
static void
parse_mdoc(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
assert(NULL != n);
@@ -1603,7 +1603,7 @@ parse_mdoc(struct mpage *mpage, const struct mdoc_meta *meta,
static int
parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
char *start, *end;
size_t sz;
@@ -1646,7 +1646,7 @@ parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_meta *meta,
}
static void
-parse_mdoc_fname(struct mpage *mpage, const struct mdoc_node *n)
+parse_mdoc_fname(struct mpage *mpage, const struct roff_node *n)
{
char *cp;
size_t sz;
@@ -1668,7 +1668,7 @@ parse_mdoc_fname(struct mpage *mpage, const struct mdoc_node *n)
static int
parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
if (n->child == NULL)
@@ -1685,7 +1685,7 @@ parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_meta *meta,
static int
parse_mdoc_Fo(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
if (n->type != ROFFT_HEAD)
@@ -1699,7 +1699,7 @@ parse_mdoc_Fo(struct mpage *mpage, const struct mdoc_meta *meta,
static int
parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
char *cp;
@@ -1719,7 +1719,7 @@ parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_meta *meta,
static int
parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
if (n->type == ROFFT_BODY)
@@ -1729,7 +1729,7 @@ parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_meta *meta,
static int
parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
if (SEC_NAME == n->sec)
@@ -1751,7 +1751,7 @@ parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_meta *meta,
static int
parse_mdoc_Sh(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
return(n->sec == SEC_CUSTOM && n->type == ROFFT_HEAD);
@@ -1759,7 +1759,7 @@ parse_mdoc_Sh(struct mpage *mpage, const struct mdoc_meta *meta,
static int
parse_mdoc_head(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
return(n->type == ROFFT_HEAD);
@@ -1767,7 +1767,7 @@ parse_mdoc_head(struct mpage *mpage, const struct mdoc_meta *meta,
static int
parse_mdoc_body(struct mpage *mpage, const struct mdoc_meta *meta,
- const struct mdoc_node *n)
+ const struct roff_node *n)
{
return(n->type == ROFFT_BODY);