From ede1b9d0649da5ccb8121a22b29e35a968495858 Mon Sep 17 00:00:00 2001 From: schwarze Date: Sat, 18 Apr 2015 16:04:40 +0000 Subject: [PATCH] Replace the structs mdoc and man by a unified struct roff_man. Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15. --- usr.bin/mandoc/cgi.c | 6 +- usr.bin/mandoc/libman.h | 45 ++++---------- usr.bin/mandoc/libmandoc.h | 39 ++++++------ usr.bin/mandoc/libmdoc.h | 64 ++++++-------------- usr.bin/mandoc/main.c | 10 ++-- usr.bin/mandoc/main.h | 21 ++++--- usr.bin/mandoc/man.c | 106 +++++++++++++++++---------------- usr.bin/mandoc/man.h | 10 ++-- usr.bin/mandoc/man_html.c | 4 +- usr.bin/mandoc/man_macro.c | 18 +++--- usr.bin/mandoc/man_term.c | 4 +- usr.bin/mandoc/man_validate.c | 6 +- usr.bin/mandoc/mandoc.h | 13 ++-- usr.bin/mandoc/mandocdb.c | 6 +- usr.bin/mandoc/mdoc.c | 104 ++++++++++++++++---------------- usr.bin/mandoc/mdoc.h | 8 +-- usr.bin/mandoc/mdoc_argv.c | 20 +++---- usr.bin/mandoc/mdoc_html.c | 4 +- usr.bin/mandoc/mdoc_macro.c | 43 ++++++------- usr.bin/mandoc/mdoc_man.c | 6 +- usr.bin/mandoc/mdoc_term.c | 4 +- usr.bin/mandoc/mdoc_validate.c | 30 +++++----- usr.bin/mandoc/read.c | 14 ++--- usr.bin/mandoc/roff.h | 38 +++++++++++- usr.bin/mandoc/tree.c | 6 +- 25 files changed, 306 insertions(+), 323 deletions(-) diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c index b26cc41d76e..7adef3aa648 100644 --- a/usr.bin/mandoc/cgi.c +++ b/usr.bin/mandoc/cgi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgi.c,v 1.45 2015/03/27 21:17:16 schwarze Exp $ */ +/* $OpenBSD: cgi.c,v 1.46 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -817,8 +817,8 @@ format(const struct req *req, const char *file) struct manoutput conf; struct mparse *mp; struct mchars *mchars; - struct mdoc *mdoc; - struct man *man; + struct roff_man *mdoc; + struct roff_man *man; void *vp; int fd; int usepath; diff --git a/usr.bin/mandoc/libman.h b/usr.bin/mandoc/libman.h index 33125dc3f2c..a736ce74ca7 100644 --- a/usr.bin/mandoc/libman.h +++ b/usr.bin/mandoc/libman.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libman.h,v 1.45 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: libman.h,v 1.46 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -16,28 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -enum man_next { - MAN_NEXT_SIBLING = 0, - MAN_NEXT_CHILD -}; - -struct man { - struct mparse *parse; /* parse pointer */ - const char *defos; /* default OS argument for .TH */ - int quick; /* abort parse early */ - int flags; /* parse flags */ -#define MAN_ELINE (1 << 1) /* Next-line element scope. */ -#define MAN_BLINE (1 << 2) /* Next-line block scope. */ -#define MAN_LITERAL (1 << 4) /* Literal input. */ -#define MAN_NEWLINE (1 << 6) /* first macro/text in a line */ - enum man_next next; /* where to put the next node */ - struct roff_node *last; /* the last parsed node */ - struct roff_node *first; /* the first parsed node */ - struct roff_meta meta; /* document meta-data */ - struct roff *roff; -}; - -#define MACRO_PROT_ARGS struct man *man, \ +#define MACRO_PROT_ARGS struct roff_man *man, \ int tok, \ int line, \ int ppos, \ @@ -57,17 +36,17 @@ extern const struct man_macro *const man_macros; __BEGIN_DECLS -void man_word_alloc(struct man *, int, int, const char *); -void man_word_append(struct man *, const char *); -void man_block_alloc(struct man *, int, int, int); -void man_head_alloc(struct man *, int, int, int); -void man_body_alloc(struct man *, int, int, int); -void man_elem_alloc(struct man *, int, int, int); -void man_node_delete(struct man *, struct roff_node *); +void man_word_alloc(struct roff_man *, int, int, const char *); +void man_word_append(struct roff_man *, const char *); +void man_block_alloc(struct roff_man *, int, int, int); +void man_head_alloc(struct roff_man *, int, int, int); +void man_body_alloc(struct roff_man *, int, int, int); +void man_elem_alloc(struct roff_man *, int, int, int); +void man_node_delete(struct roff_man *, struct roff_node *); void man_hash_init(void); int man_hash_find(const char *); -void man_macroend(struct man *); -void man_valid_post(struct man *); -void man_unscope(struct man *, const struct roff_node *); +void man_macroend(struct roff_man *); +void man_valid_post(struct roff_man *); +void man_unscope(struct roff_man *, const struct roff_node *); __END_DECLS diff --git a/usr.bin/mandoc/libmandoc.h b/usr.bin/mandoc/libmandoc.h index d01454c643c..169a98a480f 100644 --- a/usr.bin/mandoc/libmandoc.h +++ b/usr.bin/mandoc/libmandoc.h @@ -1,15 +1,15 @@ -/* $OpenBSD: libmandoc.h,v 1.41 2015/01/15 04:26:06 schwarze Exp $ */ +/* $OpenBSD: libmandoc.h,v 1.42 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons - * Copyright (c) 2013, 2014 Ingo Schwarze + * Copyright (c) 2013, 2014, 2015 Ingo Schwarze * * 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 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 @@ -39,8 +39,7 @@ struct mchars; struct tbl_span; struct eqn; struct roff; -struct mdoc; -struct man; +struct roff_man; void mandoc_msg(enum mandocerr, struct mparse *, int, int, const char *); @@ -52,23 +51,23 @@ int mandoc_eos(const char *, size_t); int mandoc_strntoi(const char *, size_t, int); const char *mandoc_a2msec(const char*); -void mdoc_free(struct mdoc *); -struct mdoc *mdoc_alloc(struct roff *, struct mparse *, +void mdoc_free(struct roff_man *); +struct roff_man *mdoc_alloc(struct roff *, struct mparse *, const char *, int); -void mdoc_reset(struct mdoc *); -int mdoc_parseln(struct mdoc *, int, char *, int); -void mdoc_endparse(struct mdoc *); -void mdoc_addspan(struct mdoc *, const struct tbl_span *); -void mdoc_addeqn(struct mdoc *, const struct eqn *); +void mdoc_reset(struct roff_man *); +int mdoc_parseln(struct roff_man *, int, char *, int); +void mdoc_endparse(struct roff_man *); +void mdoc_addspan(struct roff_man *, const struct tbl_span *); +void mdoc_addeqn(struct roff_man *, const struct eqn *); -void man_free(struct man *); -struct man *man_alloc(struct roff *, struct mparse *, +void man_free(struct roff_man *); +struct roff_man *man_alloc(struct roff *, struct mparse *, const char *, int); -void man_reset(struct man *); -int man_parseln(struct man *, int, char *, int); -void man_endparse(struct man *); -void man_addspan(struct man *, const struct tbl_span *); -void man_addeqn(struct man *, const struct eqn *); +void man_reset(struct roff_man *); +int man_parseln(struct roff_man *, int, char *, int); +void man_endparse(struct roff_man *); +void man_addspan(struct roff_man *, const struct tbl_span *); +void man_addeqn(struct roff_man *, const struct eqn *); int preconv_cue(const struct buf *, size_t); int preconv_encode(struct buf *, size_t *, diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h index e11608cc12e..be4c7e569c0 100644 --- a/usr.bin/mandoc/libmdoc.h +++ b/usr.bin/mandoc/libmdoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libmdoc.h,v 1.70 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: libmdoc.h,v 1.71 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -16,37 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -enum mdoc_next { - MDOC_NEXT_SIBLING = 0, - MDOC_NEXT_CHILD -}; - -struct mdoc { - struct mparse *parse; /* parse pointer */ - const char *defos; /* default argument for .Os */ - int quick; /* abort parse early */ - int flags; /* parse flags */ -#define MDOC_LITERAL (1 << 1) /* in a literal scope */ -#define MDOC_PBODY (1 << 2) /* in the document body */ -#define MDOC_NEWLINE (1 << 3) /* first macro/text in a line */ -#define MDOC_PHRASELIT (1 << 4) /* literal within a partila phrase */ -#define MDOC_PPHRASE (1 << 5) /* within a partial phrase */ -#define MDOC_FREECOL (1 << 6) /* `It' invocation should close */ -#define MDOC_SYNOPSIS (1 << 7) /* SYNOPSIS-style formatting */ -#define MDOC_KEEP (1 << 8) /* in a word keep */ -#define MDOC_SMOFF (1 << 9) /* spacing is off */ -#define MDOC_NODELIMC (1 << 10) /* disable closing delimiter handling */ - enum mdoc_next next; /* where to put the next node */ - struct roff_node *last; /* the last node parsed */ - struct roff_node *first; /* the first node parsed */ - struct roff_node *last_es; /* the most recent Es node */ - struct roff_meta meta; /* document meta-data */ - enum roff_sec lastnamed; - enum roff_sec lastsec; - struct roff *roff; -}; - -#define MACRO_PROT_ARGS struct mdoc *mdoc, \ +#define MACRO_PROT_ARGS struct roff_man *mdoc, \ int tok, \ int line, \ int ppos, \ @@ -97,32 +67,32 @@ extern const struct mdoc_macro *const mdoc_macros; __BEGIN_DECLS void mdoc_macro(MACRO_PROT_ARGS); -void mdoc_word_alloc(struct mdoc *, int, int, const char *); -void mdoc_word_append(struct mdoc *, const char *); -void mdoc_elem_alloc(struct mdoc *, int, int, +void mdoc_word_alloc(struct roff_man *, int, int, const char *); +void mdoc_word_append(struct roff_man *, const char *); +void mdoc_elem_alloc(struct roff_man *, int, int, int, struct mdoc_arg *); -struct roff_node *mdoc_block_alloc(struct mdoc *, int, int, +struct roff_node *mdoc_block_alloc(struct roff_man *, int, int, int, struct mdoc_arg *); -struct roff_node *mdoc_head_alloc(struct mdoc *, int, int, int); -void mdoc_tail_alloc(struct mdoc *, int, int, int); -struct roff_node *mdoc_body_alloc(struct mdoc *, int, int, int); -struct roff_node *mdoc_endbody_alloc(struct mdoc *, int, int, int, +struct roff_node *mdoc_head_alloc(struct roff_man *, int, int, int); +void mdoc_tail_alloc(struct roff_man *, int, int, int); +struct roff_node *mdoc_body_alloc(struct roff_man *, int, int, int); +struct roff_node *mdoc_endbody_alloc(struct roff_man *, int, int, int, struct roff_node *, enum mdoc_endbody); -void mdoc_node_delete(struct mdoc *, struct roff_node *); -void mdoc_node_relink(struct mdoc *, struct roff_node *); +void mdoc_node_delete(struct roff_man *, struct roff_node *); +void mdoc_node_relink(struct roff_man *, struct roff_node *); void mdoc_hash_init(void); int mdoc_hash_find(const char *); const char *mdoc_a2att(const char *); const char *mdoc_a2st(const char *); const char *mdoc_a2arch(const char *); -void mdoc_valid_pre(struct mdoc *, struct roff_node *); -void mdoc_valid_post(struct mdoc *); -void mdoc_argv(struct mdoc *, int, int, +void mdoc_valid_pre(struct roff_man *, struct roff_node *); +void mdoc_valid_post(struct roff_man *); +void mdoc_argv(struct roff_man *, int, int, struct mdoc_arg **, int *, char *); void mdoc_argv_free(struct mdoc_arg *); -enum margserr mdoc_args(struct mdoc *, int, +enum margserr mdoc_args(struct roff_man *, int, int *, char *, int, char **); -void mdoc_macroend(struct mdoc *); +void mdoc_macroend(struct roff_man *); enum mdelim mdoc_isdelim(const char *); __END_DECLS diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 164ce3d9f0e..cb854d11544 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.138 2015/04/16 16:35:02 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.139 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze @@ -51,8 +51,8 @@ enum outmode { OUTMODE_ONE }; -typedef void (*out_mdoc)(void *, const struct mdoc *); -typedef void (*out_man)(void *, const struct man *); +typedef void (*out_mdoc)(void *, const struct roff_man *); +typedef void (*out_man)(void *, const struct roff_man *); typedef void (*out_free)(void *); enum outt { @@ -607,8 +607,8 @@ static void parse(struct curparse *curp, int fd, const char *file) { enum mandoclevel rctmp; - struct mdoc *mdoc; - struct man *man; + struct roff_man *mdoc; + struct roff_man *man; /* Begin by parsing the file itself. */ diff --git a/usr.bin/mandoc/main.h b/usr.bin/mandoc/main.h index 74f4b76a0fa..3c9cb5652b3 100644 --- a/usr.bin/mandoc/main.h +++ b/usr.bin/mandoc/main.h @@ -1,4 +1,4 @@ -/* $OpenBSD: main.h,v 1.16 2015/03/27 21:17:16 schwarze Exp $ */ +/* $OpenBSD: main.h,v 1.17 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -21,8 +21,7 @@ __BEGIN_DECLS struct mchars; -struct mdoc; -struct man; +struct roff_man; struct manoutput; /* @@ -34,15 +33,15 @@ struct manoutput; void *html_alloc(const struct mchars *, const struct manoutput *); -void html_mdoc(void *, const struct mdoc *); -void html_man(void *, const struct man *); +void html_mdoc(void *, const struct roff_man *); +void html_man(void *, const struct roff_man *); void html_free(void *); -void tree_mdoc(void *, const struct mdoc *); -void tree_man(void *, const struct man *); +void tree_mdoc(void *, const struct roff_man *); +void tree_man(void *, const struct roff_man *); -void man_mdoc(void *, const struct mdoc *); -void man_man(void *, const struct man *); +void man_mdoc(void *, const struct roff_man *); +void man_man(void *, const struct roff_man *); void *locale_alloc(const struct mchars *, const struct manoutput *); @@ -59,7 +58,7 @@ void *ps_alloc(const struct mchars *, const struct manoutput *); void pspdf_free(void *); -void terminal_mdoc(void *, const struct mdoc *); -void terminal_man(void *, const struct man *); +void terminal_mdoc(void *, const struct roff_man *); +void terminal_man(void *, const struct roff_man *); __END_DECLS diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index c3321fefb10..fcf289faa0e 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man.c,v 1.100 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: man.c,v 1.101 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -47,35 +47,37 @@ const char *const __man_macronames[MAN_MAX] = { const char * const *man_macronames = __man_macronames; -static void man_alloc1(struct man *); -static void man_breakscope(struct man *, int); -static void man_descope(struct man *, int, int); -static void man_free1(struct man *); -static struct roff_node *man_node_alloc(struct man *, int, int, +static void man_alloc1(struct roff_man *); +static void man_breakscope(struct roff_man *, int); +static void man_descope(struct roff_man *, int, int); +static void man_free1(struct roff_man *); +static struct roff_node *man_node_alloc(struct roff_man *, int, int, enum roff_type, int); -static void man_node_append(struct man *, struct roff_node *); +static void man_node_append(struct roff_man *, + struct roff_node *); static void man_node_free(struct roff_node *); -static void man_node_unlink(struct man *, struct roff_node *); -static int man_ptext(struct man *, int, char *, int); -static int man_pmacro(struct man *, int, char *, int); +static void man_node_unlink(struct roff_man *, + struct roff_node *); +static int man_ptext(struct roff_man *, int, char *, int); +static int man_pmacro(struct roff_man *, int, char *, int); const struct roff_node * -man_node(const struct man *man) +man_node(const struct roff_man *man) { return(man->first); } const struct roff_meta * -man_meta(const struct man *man) +man_meta(const struct roff_man *man) { return(&man->meta); } void -man_reset(struct man *man) +man_reset(struct roff_man *man) { man_free1(man); @@ -83,20 +85,20 @@ man_reset(struct man *man) } void -man_free(struct man *man) +man_free(struct roff_man *man) { man_free1(man); free(man); } -struct man * +struct roff_man * man_alloc(struct roff *roff, struct mparse *parse, const char *defos, int quick) { - struct man *p; + struct roff_man *p; - p = mandoc_calloc(1, sizeof(struct man)); + p = mandoc_calloc(1, sizeof(*p)); man_hash_init(); p->parse = parse; @@ -109,14 +111,14 @@ man_alloc(struct roff *roff, struct mparse *parse, } void -man_endparse(struct man *man) +man_endparse(struct roff_man *man) { man_macroend(man); } int -man_parseln(struct man *man, int ln, char *buf, int offs) +man_parseln(struct roff_man *man, int ln, char *buf, int offs) { if (man->last->type != ROFFT_EQN || ln > man->last->line) @@ -128,7 +130,7 @@ man_parseln(struct man *man, int ln, char *buf, int offs) } static void -man_free1(struct man *man) +man_free1(struct roff_man *man) { if (man->first) @@ -141,7 +143,7 @@ man_free1(struct man *man) } static void -man_alloc1(struct man *man) +man_alloc1(struct roff_man *man) { memset(&man->meta, 0, sizeof(man->meta)); @@ -150,12 +152,12 @@ man_alloc1(struct man *man) man->first = man->last; man->last->type = ROFFT_ROOT; man->last->tok = MAN_MAX; - man->next = MAN_NEXT_CHILD; + man->next = ROFF_NEXT_CHILD; } static void -man_node_append(struct man *man, struct roff_node *p) +man_node_append(struct roff_man *man, struct roff_node *p) { assert(man->last); @@ -163,12 +165,12 @@ man_node_append(struct man *man, struct roff_node *p) assert(p->type != ROFFT_ROOT); switch (man->next) { - case MAN_NEXT_SIBLING: + case ROFF_NEXT_SIBLING: man->last->next = p; p->prev = man->last; p->parent = man->last->parent; break; - case MAN_NEXT_CHILD: + case ROFF_NEXT_CHILD: man->last->child = p; p->parent = man->last; break; @@ -211,7 +213,7 @@ man_node_append(struct man *man, struct roff_node *p) } static struct roff_node * -man_node_alloc(struct man *man, int line, int pos, +man_node_alloc(struct roff_man *man, int line, int pos, enum roff_type type, int tok) { struct roff_node *p; @@ -229,58 +231,58 @@ man_node_alloc(struct man *man, int line, int pos, } void -man_elem_alloc(struct man *man, int line, int pos, int tok) +man_elem_alloc(struct roff_man *man, int line, int pos, int tok) { struct roff_node *p; p = man_node_alloc(man, line, pos, ROFFT_ELEM, tok); man_node_append(man, p); - man->next = MAN_NEXT_CHILD; + man->next = ROFF_NEXT_CHILD; } void -man_head_alloc(struct man *man, int line, int pos, int tok) +man_head_alloc(struct roff_man *man, int line, int pos, int tok) { struct roff_node *p; p = man_node_alloc(man, line, pos, ROFFT_HEAD, tok); man_node_append(man, p); - man->next = MAN_NEXT_CHILD; + man->next = ROFF_NEXT_CHILD; } void -man_body_alloc(struct man *man, int line, int pos, int tok) +man_body_alloc(struct roff_man *man, int line, int pos, int tok) { struct roff_node *p; p = man_node_alloc(man, line, pos, ROFFT_BODY, tok); man_node_append(man, p); - man->next = MAN_NEXT_CHILD; + man->next = ROFF_NEXT_CHILD; } void -man_block_alloc(struct man *man, int line, int pos, int tok) +man_block_alloc(struct roff_man *man, int line, int pos, int tok) { struct roff_node *p; p = man_node_alloc(man, line, pos, ROFFT_BLOCK, tok); man_node_append(man, p); - man->next = MAN_NEXT_CHILD; + man->next = ROFF_NEXT_CHILD; } void -man_word_alloc(struct man *man, int line, int pos, const char *word) +man_word_alloc(struct roff_man *man, int line, int pos, const char *word) { struct roff_node *n; 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; + man->next = ROFF_NEXT_SIBLING; } void -man_word_append(struct man *man, const char *word) +man_word_append(struct roff_man *man, const char *word) { struct roff_node *n; char *addstr, *newstr; @@ -291,7 +293,7 @@ man_word_append(struct man *man, const char *word) free(addstr); free(n->string); n->string = newstr; - man->next = MAN_NEXT_SIBLING; + man->next = ROFF_NEXT_SIBLING; } /* @@ -307,7 +309,7 @@ man_node_free(struct roff_node *p) } void -man_node_delete(struct man *man, struct roff_node *p) +man_node_delete(struct roff_man *man, struct roff_node *p) { while (p->child) @@ -318,7 +320,7 @@ man_node_delete(struct man *man, struct roff_node *p) } void -man_addeqn(struct man *man, const struct eqn *ep) +man_addeqn(struct roff_man *man, const struct eqn *ep) { struct roff_node *n; @@ -327,12 +329,12 @@ man_addeqn(struct man *man, const struct eqn *ep) if (ep->ln > man->last->line) n->flags |= MAN_LINE; man_node_append(man, n); - man->next = MAN_NEXT_SIBLING; + man->next = ROFF_NEXT_SIBLING; man_descope(man, ep->ln, ep->pos); } void -man_addspan(struct man *man, const struct tbl_span *sp) +man_addspan(struct roff_man *man, const struct tbl_span *sp) { struct roff_node *n; @@ -340,12 +342,12 @@ man_addspan(struct man *man, const struct tbl_span *sp) 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; + man->next = ROFF_NEXT_SIBLING; man_descope(man, sp->line, 0); } static void -man_descope(struct man *man, int line, int offs) +man_descope(struct roff_man *man, int line, int offs) { /* * Co-ordinate what happens with having a next-line scope open: @@ -365,7 +367,7 @@ man_descope(struct man *man, int line, int offs) } static int -man_ptext(struct man *man, int line, char *buf, int offs) +man_ptext(struct roff_man *man, int line, char *buf, int offs) { int i; @@ -390,7 +392,7 @@ man_ptext(struct man *man, int line, char *buf, int offs) if (man->last->tok != MAN_SH && man->last->tok != MAN_SS) { man_elem_alloc(man, line, offs, MAN_sp); - man->next = MAN_NEXT_SIBLING; + man->next = ROFF_NEXT_SIBLING; } return(1); } @@ -433,7 +435,7 @@ man_ptext(struct man *man, int line, char *buf, int offs) } static int -man_pmacro(struct man *man, int ln, char *buf, int offs) +man_pmacro(struct roff_man *man, int ln, char *buf, int offs) { struct roff_node *n; const char *cp; @@ -533,7 +535,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs) } void -man_breakscope(struct man *man, int tok) +man_breakscope(struct roff_man *man, int tok) { struct roff_node *n; @@ -593,7 +595,7 @@ man_breakscope(struct man *man, int tok) * point will also be adjusted accordingly. */ static void -man_node_unlink(struct man *man, struct roff_node *n) +man_node_unlink(struct roff_man *man, struct roff_node *n) { /* Adjust siblings. */ @@ -618,10 +620,10 @@ man_node_unlink(struct man *man, struct roff_node *n) /*assert(NULL == n->next);*/ if (n->prev) { man->last = n->prev; - man->next = MAN_NEXT_SIBLING; + man->next = ROFF_NEXT_SIBLING; } else { man->last = n->parent; - man->next = MAN_NEXT_CHILD; + man->next = ROFF_NEXT_CHILD; } } @@ -630,7 +632,7 @@ man_node_unlink(struct man *man, struct roff_node *n) } const struct mparse * -man_mparse(const struct man *man) +man_mparse(const struct roff_man *man) { assert(man && man->parse); diff --git a/usr.bin/mandoc/man.h b/usr.bin/mandoc/man.h index 50d05d1a31d..6dafbdefb35 100644 --- a/usr.bin/mandoc/man.h +++ b/usr.bin/mandoc/man.h @@ -1,4 +1,4 @@ -/* $OpenBSD: man.h,v 1.52 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: man.h,v 1.53 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -61,11 +61,11 @@ extern const char *const *man_macronames; __BEGIN_DECLS -struct man; +struct roff_man; -const struct roff_node *man_node(const struct man *); -const struct roff_meta *man_meta(const struct man *); -const struct mparse *man_mparse(const struct man *); +const struct roff_node *man_node(const struct roff_man *); +const struct roff_meta *man_meta(const struct roff_man *); +const struct mparse *man_mparse(const struct roff_man *); void man_deroff(char **, const struct roff_node *); __END_DECLS diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index a476cf8153d..594d815858b 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.68 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.69 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -143,7 +143,7 @@ print_bvspace(struct html *h, const struct roff_node *n) } void -html_man(void *arg, const struct man *man) +html_man(void *arg, const struct roff_man *man) { struct mhtml mh; diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index e187b022c3f..003cc5dbad5 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.66 2015/04/03 23:17:09 schwarze Exp $ */ +/* $OpenBSD: man_macro.c,v 1.67 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2012, 2013, 2014, 2015 Ingo Schwarze @@ -33,9 +33,9 @@ static void blk_close(MACRO_PROT_ARGS); static void blk_exp(MACRO_PROT_ARGS); static void blk_imp(MACRO_PROT_ARGS); static void in_line_eoln(MACRO_PROT_ARGS); -static int man_args(struct man *, int, +static int man_args(struct roff_man *, int, int *, char *, char **); -static void rew_scope(struct man *, int); +static void rew_scope(struct roff_man *, int); const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, MAN_NSCOPED }, /* br */ @@ -82,7 +82,7 @@ const struct man_macro * const man_macros = __man_macros; void -man_unscope(struct man *man, const struct roff_node *to) +man_unscope(struct roff_man *man, const struct roff_node *to) { struct roff_node *n; @@ -138,7 +138,7 @@ man_unscope(struct man *man, const struct roff_node *to) */ man->next = (man->last == to) ? - MAN_NEXT_CHILD : MAN_NEXT_SIBLING; + ROFF_NEXT_CHILD : ROFF_NEXT_SIBLING; } /* @@ -147,7 +147,7 @@ man_unscope(struct man *man, const struct roff_node *to) * scopes. When a scope is closed, it must be validated and actioned. */ static void -rew_scope(struct man *man, int tok) +rew_scope(struct roff_man *man, int tok) { struct roff_node *n; @@ -375,7 +375,7 @@ in_line_eoln(MACRO_PROT_ARGS) } assert(man->last->type != ROFFT_ROOT); - man->next = MAN_NEXT_SIBLING; + man->next = ROFF_NEXT_SIBLING; /* * Rewind our element scope. Note that when TH is pruned, we'll @@ -403,14 +403,14 @@ in_line_eoln(MACRO_PROT_ARGS) void -man_macroend(struct man *man) +man_macroend(struct roff_man *man) { man_unscope(man, man->first); } static int -man_args(struct man *man, int line, int *pos, char *buf, char **v) +man_args(struct roff_man *man, int line, int *pos, char *buf, char **v) { char *start; diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 66a72c964c5..d45ae873258 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.132 2015/04/06 22:06:06 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.133 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -136,7 +136,7 @@ static const struct termact termacts[MAN_MAX] = { void -terminal_man(void *arg, const struct man *man) +terminal_man(void *arg, const struct roff_man *man) { struct termp *p; const struct roff_meta *meta; diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index ba01575fb5d..e34c670b5d0 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.87 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: man_validate.c,v 1.88 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -33,7 +33,7 @@ #include "libmandoc.h" #include "libman.h" -#define CHKARGS struct man *man, struct roff_node *n +#define CHKARGS struct roff_man *man, struct roff_node *n typedef void (*v_check)(CHKARGS); @@ -96,7 +96,7 @@ static v_check man_valids[MAN_MAX] = { void -man_valid_post(struct man *man) +man_valid_post(struct roff_man *man) { struct roff_node *n; v_check *cp; diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 202f7169ea1..3f63912f32e 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.h,v 1.143 2015/02/23 13:30:02 schwarze Exp $ */ +/* $OpenBSD: mandoc.h,v 1.144 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -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 @@ -412,8 +412,7 @@ __BEGIN_DECLS struct mparse; struct mchars; -struct mdoc; -struct man; +struct roff_man; enum mandoc_esc mandoc_escape(const char **, const char **, int *); struct mchars *mchars_alloc(void); @@ -432,8 +431,8 @@ void mparse_keep(struct mparse *); enum mandoclevel mparse_open(struct mparse *, int *, const char *); enum mandoclevel mparse_readfd(struct mparse *, int, const char *); void mparse_reset(struct mparse *); -void mparse_result(struct mparse *, - struct mdoc **, struct man **, char **); +void mparse_result(struct mparse *, struct roff_man **, + struct roff_man **, char **); const char *mparse_getkeep(const struct mparse *); const char *mparse_strerror(enum mandocerr); const char *mparse_strlevel(enum mandoclevel); diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c index b819f7613a8..2a3683e3ed0 100644 --- a/usr.bin/mandoc/mandocdb.c +++ b/usr.bin/mandoc/mandocdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandocdb.c,v 1.143 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: mandocdb.c,v 1.144 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011-2015 Ingo Schwarze @@ -1089,8 +1089,8 @@ mpages_merge(struct mparse *mp) struct ohash_info str_info; struct mpage *mpage, *mpage_dest; struct mlink *mlink, *mlink_dest; - struct mdoc *mdoc; - struct man *man; + struct roff_man *mdoc; + struct roff_man *man; char *sodest; char *cp; int fd; diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 251cf24da2c..a442343bcab 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc.c,v 1.130 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: mdoc.c,v 1.131 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -82,26 +82,26 @@ const char * const *mdoc_macronames = __mdoc_macronames; const char * const *mdoc_argnames = __mdoc_argnames; static void mdoc_node_free(struct roff_node *); -static void mdoc_node_unlink(struct mdoc *, +static void mdoc_node_unlink(struct roff_man *, struct roff_node *); -static void mdoc_free1(struct mdoc *); -static void mdoc_alloc1(struct mdoc *); -static struct roff_node *node_alloc(struct mdoc *, int, int, +static void mdoc_free1(struct roff_man *); +static void mdoc_alloc1(struct roff_man *); +static struct roff_node *node_alloc(struct roff_man *, int, int, int, enum roff_type); -static void node_append(struct mdoc *, struct roff_node *); -static int mdoc_ptext(struct mdoc *, int, char *, int); -static int mdoc_pmacro(struct mdoc *, int, char *, int); +static void node_append(struct roff_man *, struct roff_node *); +static int mdoc_ptext(struct roff_man *, int, char *, int); +static int mdoc_pmacro(struct roff_man *, int, char *, int); const struct roff_node * -mdoc_node(const struct mdoc *mdoc) +mdoc_node(const struct roff_man *mdoc) { return(mdoc->first); } const struct roff_meta * -mdoc_meta(const struct mdoc *mdoc) +mdoc_meta(const struct roff_man *mdoc) { return(&mdoc->meta); @@ -111,7 +111,7 @@ mdoc_meta(const struct mdoc *mdoc) * Frees volatile resources (parse tree, meta-data, fields). */ static void -mdoc_free1(struct mdoc *mdoc) +mdoc_free1(struct roff_man *mdoc) { if (mdoc->first) @@ -129,7 +129,7 @@ mdoc_free1(struct mdoc *mdoc) * Allocate all volatile resources (parse tree, meta-data, fields). */ static void -mdoc_alloc1(struct mdoc *mdoc) +mdoc_alloc1(struct roff_man *mdoc) { memset(&mdoc->meta, 0, sizeof(mdoc->meta)); @@ -139,7 +139,7 @@ mdoc_alloc1(struct mdoc *mdoc) mdoc->first = mdoc->last; mdoc->last->type = ROFFT_ROOT; mdoc->last->tok = MDOC_MAX; - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; } /* @@ -149,7 +149,7 @@ mdoc_alloc1(struct mdoc *mdoc) * cross-parse non-volatile data is kept intact. */ void -mdoc_reset(struct mdoc *mdoc) +mdoc_reset(struct roff_man *mdoc) { mdoc_free1(mdoc); @@ -161,7 +161,7 @@ mdoc_reset(struct mdoc *mdoc) * After invocation, the pointer is no longer usable. */ void -mdoc_free(struct mdoc *mdoc) +mdoc_free(struct roff_man *mdoc) { mdoc_free1(mdoc); @@ -171,13 +171,13 @@ mdoc_free(struct mdoc *mdoc) /* * Allocate volatile and non-volatile parse resources. */ -struct mdoc * +struct roff_man * mdoc_alloc(struct roff *roff, struct mparse *parse, const char *defos, int quick) { - struct mdoc *p; + struct roff_man *p; - p = mandoc_calloc(1, sizeof(struct mdoc)); + p = mandoc_calloc(1, sizeof(*p)); p->parse = parse; p->defos = defos; @@ -190,14 +190,14 @@ mdoc_alloc(struct roff *roff, struct mparse *parse, } void -mdoc_endparse(struct mdoc *mdoc) +mdoc_endparse(struct roff_man *mdoc) { mdoc_macroend(mdoc); } void -mdoc_addeqn(struct mdoc *mdoc, const struct eqn *ep) +mdoc_addeqn(struct roff_man *mdoc, const struct eqn *ep) { struct roff_node *n; @@ -206,18 +206,18 @@ mdoc_addeqn(struct mdoc *mdoc, const struct eqn *ep) if (ep->ln > mdoc->last->line) n->flags |= MDOC_LINE; node_append(mdoc, n); - mdoc->next = MDOC_NEXT_SIBLING; + mdoc->next = ROFF_NEXT_SIBLING; } void -mdoc_addspan(struct mdoc *mdoc, const struct tbl_span *sp) +mdoc_addspan(struct roff_man *mdoc, const struct tbl_span *sp) { struct roff_node *n; n = node_alloc(mdoc, sp->line, 0, MDOC_MAX, ROFFT_TBL); n->span = sp; node_append(mdoc, n); - mdoc->next = MDOC_NEXT_SIBLING; + mdoc->next = ROFF_NEXT_SIBLING; } /* @@ -225,7 +225,7 @@ mdoc_addspan(struct mdoc *mdoc, const struct tbl_span *sp) * the macro (mdoc_pmacro()) or text parser (mdoc_ptext()). */ int -mdoc_parseln(struct mdoc *mdoc, int ln, char *buf, int offs) +mdoc_parseln(struct roff_man *mdoc, int ln, char *buf, int offs) { if (mdoc->last->type != ROFFT_EQN || ln > mdoc->last->line) @@ -275,7 +275,7 @@ mdoc_macro(MACRO_PROT_ARGS) static void -node_append(struct mdoc *mdoc, struct roff_node *p) +node_append(struct roff_man *mdoc, struct roff_node *p) { assert(mdoc->last); @@ -283,12 +283,12 @@ node_append(struct mdoc *mdoc, struct roff_node *p) assert(p->type != ROFFT_ROOT); switch (mdoc->next) { - case MDOC_NEXT_SIBLING: + case ROFF_NEXT_SIBLING: mdoc->last->next = p; p->prev = mdoc->last; p->parent = mdoc->last->parent; break; - case MDOC_NEXT_CHILD: + case ROFF_NEXT_CHILD: mdoc->last->child = p; p->parent = mdoc->last; break; @@ -353,7 +353,7 @@ node_append(struct mdoc *mdoc, struct roff_node *p) } static struct roff_node * -node_alloc(struct mdoc *mdoc, int line, int pos, +node_alloc(struct roff_man *mdoc, int line, int pos, int tok, enum roff_type type) { struct roff_node *p; @@ -379,17 +379,17 @@ node_alloc(struct mdoc *mdoc, int line, int pos, } void -mdoc_tail_alloc(struct mdoc *mdoc, int line, int pos, int tok) +mdoc_tail_alloc(struct roff_man *mdoc, int line, int pos, int tok) { struct roff_node *p; p = node_alloc(mdoc, line, pos, tok, ROFFT_TAIL); node_append(mdoc, p); - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; } struct roff_node * -mdoc_head_alloc(struct mdoc *mdoc, int line, int pos, int tok) +mdoc_head_alloc(struct roff_man *mdoc, int line, int pos, int tok) { struct roff_node *p; @@ -397,23 +397,23 @@ mdoc_head_alloc(struct mdoc *mdoc, int line, int pos, int tok) assert(mdoc->last); p = node_alloc(mdoc, line, pos, tok, ROFFT_HEAD); node_append(mdoc, p); - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; return(p); } struct roff_node * -mdoc_body_alloc(struct mdoc *mdoc, int line, int pos, int tok) +mdoc_body_alloc(struct roff_man *mdoc, int line, int pos, int tok) { struct roff_node *p; p = node_alloc(mdoc, line, pos, tok, ROFFT_BODY); node_append(mdoc, p); - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; return(p); } struct roff_node * -mdoc_endbody_alloc(struct mdoc *mdoc, int line, int pos, int tok, +mdoc_endbody_alloc(struct roff_man *mdoc, int line, int pos, int tok, struct roff_node *body, enum mdoc_endbody end) { struct roff_node *p; @@ -425,12 +425,12 @@ mdoc_endbody_alloc(struct mdoc *mdoc, int line, int pos, int tok, p->norm = body->norm; p->end = end; node_append(mdoc, p); - mdoc->next = MDOC_NEXT_SIBLING; + mdoc->next = ROFF_NEXT_SIBLING; return(p); } struct roff_node * -mdoc_block_alloc(struct mdoc *mdoc, int line, int pos, +mdoc_block_alloc(struct roff_man *mdoc, int line, int pos, int tok, struct mdoc_arg *args) { struct roff_node *p; @@ -456,12 +456,12 @@ mdoc_block_alloc(struct mdoc *mdoc, int line, int pos, break; } node_append(mdoc, p); - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; return(p); } void -mdoc_elem_alloc(struct mdoc *mdoc, int line, int pos, +mdoc_elem_alloc(struct roff_man *mdoc, int line, int pos, int tok, struct mdoc_arg *args) { struct roff_node *p; @@ -479,22 +479,22 @@ mdoc_elem_alloc(struct mdoc *mdoc, int line, int pos, break; } node_append(mdoc, p); - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; } void -mdoc_word_alloc(struct mdoc *mdoc, int line, int pos, const char *p) +mdoc_word_alloc(struct roff_man *mdoc, int line, int pos, const char *p) { struct roff_node *n; 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; + mdoc->next = ROFF_NEXT_SIBLING; } void -mdoc_word_append(struct mdoc *mdoc, const char *p) +mdoc_word_append(struct roff_man *mdoc, const char *p) { struct roff_node *n; char *addstr, *newstr; @@ -505,7 +505,7 @@ mdoc_word_append(struct mdoc *mdoc, const char *p) free(addstr); free(n->string); n->string = newstr; - mdoc->next = MDOC_NEXT_SIBLING; + mdoc->next = ROFF_NEXT_SIBLING; } static void @@ -522,7 +522,7 @@ mdoc_node_free(struct roff_node *p) } static void -mdoc_node_unlink(struct mdoc *mdoc, struct roff_node *n) +mdoc_node_unlink(struct roff_man *mdoc, struct roff_node *n) { /* Adjust siblings. */ @@ -547,10 +547,10 @@ mdoc_node_unlink(struct mdoc *mdoc, struct roff_node *n) if (mdoc && mdoc->last == n) { if (n->prev) { mdoc->last = n->prev; - mdoc->next = MDOC_NEXT_SIBLING; + mdoc->next = ROFF_NEXT_SIBLING; } else { mdoc->last = n->parent; - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; } } @@ -559,7 +559,7 @@ mdoc_node_unlink(struct mdoc *mdoc, struct roff_node *n) } void -mdoc_node_delete(struct mdoc *mdoc, struct roff_node *p) +mdoc_node_delete(struct roff_man *mdoc, struct roff_node *p) { while (p->child) { @@ -573,7 +573,7 @@ mdoc_node_delete(struct mdoc *mdoc, struct roff_node *p) } void -mdoc_node_relink(struct mdoc *mdoc, struct roff_node *p) +mdoc_node_relink(struct roff_man *mdoc, struct roff_node *p) { mdoc_node_unlink(mdoc, p); @@ -585,7 +585,7 @@ mdoc_node_relink(struct mdoc *mdoc, struct roff_node *p) * control character. */ static int -mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs) +mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs) { struct roff_node *n; char *c, *ws, *end; @@ -673,7 +673,7 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs) * behaviour that we want to work around it. */ mdoc_elem_alloc(mdoc, line, offs, MDOC_sp, NULL); - mdoc->next = MDOC_NEXT_SIBLING; + mdoc->next = ROFF_NEXT_SIBLING; mdoc_valid_post(mdoc); return(1); } @@ -701,7 +701,7 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs) * character. */ static int -mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs) +mdoc_pmacro(struct roff_man *mdoc, int ln, char *buf, int offs) { struct roff_node *n; const char *cp; diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h index 046255cae45..9527cc53154 100644 --- a/usr.bin/mandoc/mdoc.h +++ b/usr.bin/mandoc/mdoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc.h,v 1.64 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: mdoc.h,v 1.65 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -282,10 +282,10 @@ extern const char *const *mdoc_argnames; __BEGIN_DECLS -struct mdoc; +struct roff_man; -const struct roff_node *mdoc_node(const struct mdoc *); -const struct roff_meta *mdoc_meta(const struct mdoc *); +const struct roff_node *mdoc_node(const struct roff_man *); +const struct roff_meta *mdoc_meta(const struct roff_man *); void mdoc_deroff(char **, const struct roff_node *); __END_DECLS diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c index 131b448c7bf..7dc6f122db6 100644 --- a/usr.bin/mandoc/mdoc_argv.c +++ b/usr.bin/mandoc/mdoc_argv.c @@ -1,7 +1,7 @@ -/* $OpenBSD: mdoc_argv.c,v 1.58 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: mdoc_argv.c,v 1.59 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2012, 2014 Ingo Schwarze + * Copyright (c) 2012, 2014, 2015 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -50,12 +50,12 @@ struct mdocarg { }; static void argn_free(struct mdoc_arg *, int); -static enum margserr args(struct mdoc *, int, int *, +static enum margserr args(struct roff_man *, int, int *, char *, enum argsflag, char **); static int args_checkpunct(const char *, int); -static void argv_multi(struct mdoc *, int, +static void argv_multi(struct roff_man *, int, struct mdoc_argv *, int *, char *); -static void argv_single(struct mdoc *, int, +static void argv_single(struct roff_man *, int, struct mdoc_argv *, int *, char *); static const enum argvflag argvflags[MDOC_ARG_MAX] = { @@ -274,7 +274,7 @@ static const struct mdocarg mdocargs[MDOC_MAX] = { * Some flags take no argument, some one, some multiple. */ void -mdoc_argv(struct mdoc *mdoc, int line, int tok, +mdoc_argv(struct roff_man *mdoc, int line, int tok, struct mdoc_arg **reta, int *pos, char *buf) { struct mdoc_argv tmpv; @@ -411,7 +411,7 @@ argn_free(struct mdoc_arg *p, int iarg) } enum margserr -mdoc_args(struct mdoc *mdoc, int line, int *pos, +mdoc_args(struct roff_man *mdoc, int line, int *pos, char *buf, int tok, char **v) { struct roff_node *n; @@ -442,7 +442,7 @@ mdoc_args(struct mdoc *mdoc, int line, int *pos, } static enum margserr -args(struct mdoc *mdoc, int line, int *pos, +args(struct roff_man *mdoc, int line, int *pos, char *buf, enum argsflag fl, char **v) { char *p, *pp; @@ -652,7 +652,7 @@ args_checkpunct(const char *buf, int i) } static void -argv_multi(struct mdoc *mdoc, int line, +argv_multi(struct roff_man *mdoc, int line, struct mdoc_argv *v, int *pos, char *buf) { enum margserr ac; @@ -674,7 +674,7 @@ argv_multi(struct mdoc *mdoc, int line, } static void -argv_single(struct mdoc *mdoc, int line, +argv_single(struct roff_man *mdoc, int line, struct mdoc_argv *v, int *pos, char *buf) { enum margserr ac; diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index c0fea15cde0..7720dfb0142 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.105 2015/04/16 20:21:08 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.106 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -263,7 +263,7 @@ static const char * const lists[LIST_MAX] = { void -html_mdoc(void *arg, const struct mdoc *mdoc) +html_mdoc(void *arg, const struct roff_man *mdoc) { print_mdoc(mdoc_meta(mdoc), mdoc_node(mdoc)->child, diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index da67f34be1d..25a1d99940a 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.144 2015/04/05 23:04:22 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.145 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -40,18 +40,19 @@ static void in_line_argn(MACRO_PROT_ARGS); static void in_line(MACRO_PROT_ARGS); static void phrase_ta(MACRO_PROT_ARGS); -static void append_delims(struct mdoc *, int, int *, char *); -static void dword(struct mdoc *, int, int, const char *, +static void append_delims(struct roff_man *, int, int *, char *); +static void dword(struct roff_man *, int, int, const char *, enum mdelim, int); -static int find_pending(struct mdoc *, int, int, int, +static int find_pending(struct roff_man *, int, int, int, struct roff_node *); -static int lookup(struct mdoc *, int, int, int, const char *); +static int lookup(struct roff_man *, int, int, int, const char *); static int macro_or_word(MACRO_PROT_ARGS, int); -static int parse_rest(struct mdoc *, int, int, int *, char *); +static int parse_rest(struct roff_man *, int, int, int *, char *); static int rew_alt(int); -static void rew_elem(struct mdoc *, int); -static void rew_last(struct mdoc *, const struct roff_node *); -static void rew_pending(struct mdoc *, const struct roff_node *); +static void rew_elem(struct roff_man *, int); +static void rew_last(struct roff_man *, const struct roff_node *); +static void rew_pending(struct roff_man *, + const struct roff_node *); const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ap */ @@ -206,7 +207,7 @@ const struct mdoc_macro * const mdoc_macros = __mdoc_macros; * are errors. */ void -mdoc_macroend(struct mdoc *mdoc) +mdoc_macroend(struct roff_man *mdoc) { struct roff_node *n; @@ -231,7 +232,7 @@ mdoc_macroend(struct mdoc *mdoc) * or as a line macro if from == MDOC_MAX. */ static int -lookup(struct mdoc *mdoc, int from, int line, int ppos, const char *p) +lookup(struct roff_man *mdoc, int from, int line, int ppos, const char *p) { int res; @@ -252,14 +253,14 @@ lookup(struct mdoc *mdoc, int from, int line, int ppos, const char *p) * Rewind up to and including a specific node. */ static void -rew_last(struct mdoc *mdoc, const struct roff_node *to) +rew_last(struct roff_man *mdoc, const struct roff_node *to) { struct roff_node *n, *np; if (to->flags & MDOC_VALID) return; - mdoc->next = MDOC_NEXT_SIBLING; + mdoc->next = ROFF_NEXT_SIBLING; while (mdoc->last != to) { /* * Save the parent here, because we may delete the @@ -281,7 +282,7 @@ rew_last(struct mdoc *mdoc, const struct roff_node *to) * Rewind up to a specific block, including all blocks that broke it. */ static void -rew_pending(struct mdoc *mdoc, const struct roff_node *n) +rew_pending(struct roff_man *mdoc, const struct roff_node *n) { for (;;) { @@ -362,7 +363,7 @@ rew_alt(int tok) } static void -rew_elem(struct mdoc *mdoc, int tok) +rew_elem(struct roff_man *mdoc, int tok) { struct roff_node *n; @@ -380,7 +381,7 @@ rew_elem(struct mdoc *mdoc, int tok) * the rew_pending() call closing out the sub-block. */ static int -find_pending(struct mdoc *mdoc, int tok, int line, int ppos, +find_pending(struct roff_man *mdoc, int tok, int line, int ppos, struct roff_node *target) { struct roff_node *n; @@ -417,7 +418,7 @@ find_pending(struct mdoc *mdoc, int tok, int line, int ppos, * Punctuation consists of those tokens found in mdoc_isdelim(). */ static void -dword(struct mdoc *mdoc, int line, int col, const char *p, +dword(struct roff_man *mdoc, int line, int col, const char *p, enum mdelim d, int may_append) { @@ -451,7 +452,7 @@ dword(struct mdoc *mdoc, int line, int col, const char *p, } static void -append_delims(struct mdoc *mdoc, int line, int *pos, char *buf) +append_delims(struct roff_man *mdoc, int line, int *pos, char *buf) { char *p; int la; @@ -615,7 +616,7 @@ blk_exp_close(MACRO_PROT_ARGS) */ if (maxargs) - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; break; } @@ -1384,7 +1385,7 @@ in_line_eoln(MACRO_PROT_ARGS) if ((tok == MDOC_Pp || tok == MDOC_Lp) && ! (mdoc->flags & MDOC_SYNOPSIS)) { n = mdoc->last; - if (mdoc->next == MDOC_NEXT_SIBLING) + if (mdoc->next == ROFF_NEXT_SIBLING) n = n->parent; if (n->tok == MDOC_Nm) rew_last(mdoc, mdoc->last->parent); @@ -1410,7 +1411,7 @@ in_line_eoln(MACRO_PROT_ARGS) * or until the next macro, call that macro, and return 1. */ static int -parse_rest(struct mdoc *mdoc, int tok, int line, int *pos, char *buf) +parse_rest(struct roff_man *mdoc, int tok, int line, int *pos, char *buf) { int la; diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index a212740a5a7..d74278347e2 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.89 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: mdoc_man.c,v 1.90 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2011-2015 Ingo Schwarze * @@ -530,7 +530,7 @@ print_count(int *count) } void -man_man(void *arg, const struct man *man) +man_man(void *arg, const struct roff_man *man) { /* @@ -543,7 +543,7 @@ man_man(void *arg, const struct man *man) } void -man_mdoc(void *arg, const struct mdoc *mdoc) +man_mdoc(void *arg, const struct roff_man *mdoc) { const struct roff_meta *meta; struct roff_node *n; diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 901a3c1a961..10901e388bd 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.216 2015/04/04 17:46:58 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.217 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -249,7 +249,7 @@ static const struct termact termacts[MDOC_MAX] = { void -terminal_mdoc(void *arg, const struct mdoc *mdoc) +terminal_mdoc(void *arg, const struct roff_man *mdoc) { const struct roff_meta *meta; struct roff_node *n; diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 624ee0c6313..7e731c82ea4 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.201 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.202 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -38,8 +38,8 @@ /* FIXME: .Bl -diag can't have non-text children in HEAD. */ -#define PRE_ARGS struct mdoc *mdoc, struct roff_node *n -#define POST_ARGS struct mdoc *mdoc +#define PRE_ARGS struct roff_man *mdoc, struct roff_node *n +#define POST_ARGS struct roff_man *mdoc enum check_ineq { CHECK_LT, @@ -55,10 +55,10 @@ struct valids { v_post post; }; -static void check_text(struct mdoc *, int, int, char *); -static void check_argv(struct mdoc *, +static void check_text(struct roff_man *, int, int, char *); +static void check_argv(struct roff_man *, struct roff_node *, struct mdoc_argv *); -static void check_args(struct mdoc *, struct roff_node *); +static void check_args(struct roff_man *, struct roff_node *); static int child_an(const struct roff_node *); static enum roff_sec a2sec(const char *); static size_t macro2len(int); @@ -291,7 +291,7 @@ static const char * const secnames[SEC__MAX] = { void -mdoc_valid_pre(struct mdoc *mdoc, struct roff_node *n) +mdoc_valid_pre(struct roff_man *mdoc, struct roff_node *n) { v_pre p; @@ -317,7 +317,7 @@ mdoc_valid_pre(struct mdoc *mdoc, struct roff_node *n) } void -mdoc_valid_post(struct mdoc *mdoc) +mdoc_valid_post(struct roff_man *mdoc) { struct roff_node *n; v_post p; @@ -360,7 +360,7 @@ mdoc_valid_post(struct mdoc *mdoc) } static void -check_args(struct mdoc *mdoc, struct roff_node *n) +check_args(struct roff_man *mdoc, struct roff_node *n) { int i; @@ -373,7 +373,7 @@ check_args(struct mdoc *mdoc, struct roff_node *n) } static void -check_argv(struct mdoc *mdoc, struct roff_node *n, struct mdoc_argv *v) +check_argv(struct roff_man *mdoc, struct roff_node *n, struct mdoc_argv *v) { int i; @@ -382,7 +382,7 @@ check_argv(struct mdoc *mdoc, struct roff_node *n, struct mdoc_argv *v) } static void -check_text(struct mdoc *mdoc, int ln, int pos, char *p) +check_text(struct roff_man *mdoc, int ln, int pos, char *p) { char *cp; @@ -1037,7 +1037,7 @@ post_defaults(POST_ARGS) return; nn = mdoc->last; - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; switch (nn->tok) { case MDOC_Ar: @@ -1065,7 +1065,7 @@ post_at(POST_ARGS) n = mdoc->last; if (n->child == NULL) { - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; mdoc_word_alloc(mdoc, n->line, n->pos, "AT&T UNIX"); mdoc->last = n; return; @@ -1493,7 +1493,7 @@ post_bk(POST_ARGS) } static void -post_sm(struct mdoc *mdoc) +post_sm(struct roff_man *mdoc) { struct roff_node *nch; @@ -2304,7 +2304,7 @@ post_ex(POST_ARGS) return; } - mdoc->next = MDOC_NEXT_CHILD; + mdoc->next = ROFF_NEXT_CHILD; mdoc_word_alloc(mdoc, n->line, n->pos, mdoc->meta.name); mdoc->last = n; } diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 49c2aa1b475..53694145f81 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.108 2015/04/02 21:03:18 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.109 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -42,10 +42,10 @@ #define REPARSE_LIMIT 1000 struct mparse { - struct man *pman; /* persistent man parser */ - struct mdoc *pmdoc; /* persistent mdoc parser */ - struct man *man; /* man parser */ - struct mdoc *mdoc; /* mdoc parser */ + struct roff_man *pman; /* persistent man parser */ + struct roff_man *pmdoc; /* persistent mdoc parser */ + struct roff_man *man; /* man parser */ + struct roff_man *mdoc; /* mdoc parser */ struct roff *roff; /* roff parser (!NULL) */ const struct mchars *mchars; /* character table */ char *sodest; /* filename pointed to by .so */ @@ -930,8 +930,8 @@ mparse_free(struct mparse *curp) } void -mparse_result(struct mparse *curp, - struct mdoc **mdoc, struct man **man, char **sodest) +mparse_result(struct mparse *curp, struct roff_man **mdoc, + struct roff_man **man, char **sodest) { if (sodest && NULL != (*sodest = curp->sodest)) { diff --git a/usr.bin/mandoc/roff.h b/usr.bin/mandoc/roff.h index ece2613cb89..efbeff97521 100644 --- a/usr.bin/mandoc/roff.h +++ b/usr.bin/mandoc/roff.h @@ -1,7 +1,7 @@ -/* $OpenBSD: roff.h,v 1.12 2015/04/02 23:47:43 schwarze Exp $ */ +/* $OpenBSD: roff.h,v 1.13 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2014, 2015 Ingo Schwarze + * Copyright (c) 2013, 2014, 2015 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -58,6 +58,11 @@ enum roff_type { ROFFT_EQN }; +enum roff_next { + ROFF_NEXT_SIBLING = 0, + ROFF_NEXT_CHILD +}; + /* * Indicates that a BODY's formatting has ended, but * the scope is still open. Used for badly nested blocks. @@ -115,3 +120,32 @@ struct roff_meta { char *date; /* Normalized date. */ int hasbody; /* Document is not empty. */ }; + +struct roff_man { + struct roff_meta meta; /* Document meta-data. */ + struct mparse *parse; /* Parse pointer. */ + struct roff *roff; /* Roff parser state data. */ + const char *defos; /* Default operating system. */ + struct roff_node *first; /* The first node parsed. */ + struct roff_node *last; /* The last node parsed. */ + struct roff_node *last_es; /* The most recent Es node. */ + int quick; /* Abort parse early. */ + int flags; /* Parse flags. */ +#define MDOC_LITERAL (1 << 1) /* In a literal scope. */ +#define MDOC_PBODY (1 << 2) /* In the document body. */ +#define MDOC_NEWLINE (1 << 3) /* First macro/text in a line. */ +#define MDOC_PHRASELIT (1 << 4) /* Literal within a partial phrase. */ +#define MDOC_PPHRASE (1 << 5) /* Within a partial phrase. */ +#define MDOC_FREECOL (1 << 6) /* `It' invocation should close. */ +#define MDOC_SYNOPSIS (1 << 7) /* SYNOPSIS-style formatting. */ +#define MDOC_KEEP (1 << 8) /* In a word keep. */ +#define MDOC_SMOFF (1 << 9) /* Spacing is off. */ +#define MDOC_NODELIMC (1 << 10) /* Disable closing delimiter handling. */ +#define MAN_ELINE (1 << 11) /* Next-line element scope. */ +#define MAN_BLINE (1 << 12) /* Next-line block scope. */ +#define MAN_LITERAL MDOC_LITERAL +#define MAN_NEWLINE MDOC_NEWLINE + enum roff_sec lastsec; /* Last section seen. */ + enum roff_sec lastnamed; /* Last standard section seen. */ + enum roff_next next; /* Where to put the next node. */ +}; diff --git a/usr.bin/mandoc/tree.c b/usr.bin/mandoc/tree.c index d833fe59f4e..fe69f192f55 100644 --- a/usr.bin/mandoc/tree.c +++ b/usr.bin/mandoc/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.31 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: tree.c,v 1.32 2015/04/18 16:04:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -36,14 +36,14 @@ static void print_span(const struct tbl_span *, int); void -tree_mdoc(void *arg, const struct mdoc *mdoc) +tree_mdoc(void *arg, const struct roff_man *mdoc) { print_mdoc(mdoc_node(mdoc)->child, 0); } void -tree_man(void *arg, const struct man *man) +tree_man(void *arg, const struct roff_man *man) { print_man(man_node(man)->child, 0); -- 2.20.1