void tree_mdoc(void *arg, const struct roff_man *mdoc) { print_meta(&mdoc->meta); putchar('\n'); print_mdoc(mdoc->first->child, 0); }
void html_mdoc(void *arg, const struct mdoc *mdoc) { print_mdoc(mdoc_meta(mdoc), mdoc_node(mdoc)->child, (struct html *)arg); putchar('\n'); }
void html_mdoc(void *arg, const struct mdoc *m) { struct html *h; struct tag *t; h = (struct html *)arg; print_gen_decls(h); t = print_otag(h, TAG_HTML, 0, NULL); print_mdoc(mdoc_meta(m), mdoc_node(m), h); print_tagq(h, t); printf("\n"); }
static void print_mdoc(const struct roff_node *n, int indent) { const char *p, *t; int i, j; size_t argc; struct mdoc_argv *argv; if (n == NULL) return; argv = NULL; argc = 0; t = p = NULL; switch (n->type) { case ROFFT_ROOT: t = "root"; break; case ROFFT_BLOCK: t = "block"; break; case ROFFT_HEAD: t = "head"; break; case ROFFT_BODY: if (n->end) t = "body-end"; else t = "body"; break; case ROFFT_TAIL: t = "tail"; break; case ROFFT_ELEM: t = "elem"; break; case ROFFT_TEXT: t = "text"; break; case ROFFT_TBL: break; case ROFFT_EQN: t = "eqn"; break; default: abort(); } switch (n->type) { case ROFFT_TEXT: p = n->string; break; case ROFFT_BODY: p = mdoc_macronames[n->tok]; break; case ROFFT_HEAD: p = mdoc_macronames[n->tok]; break; case ROFFT_TAIL: p = mdoc_macronames[n->tok]; break; case ROFFT_ELEM: p = mdoc_macronames[n->tok]; if (n->args) { argv = n->args->argv; argc = n->args->argc; } break; case ROFFT_BLOCK: p = mdoc_macronames[n->tok]; if (n->args) { argv = n->args->argv; argc = n->args->argc; } break; case ROFFT_TBL: break; case ROFFT_EQN: p = "EQ"; break; case ROFFT_ROOT: p = "root"; break; default: abort(); } if (n->span) { assert(NULL == p && NULL == t); print_span(n->span, indent); } else { for (i = 0; i < indent; i++) putchar(' '); printf("%s (%s)", p, t); for (i = 0; i < (int)argc; i++) { printf(" -%s", mdoc_argnames[argv[i].arg]); if (argv[i].sz > 0) printf(" ["); for (j = 0; j < (int)argv[i].sz; j++) printf(" [%s]", argv[i].value[j]); if (argv[i].sz > 0) printf(" ]"); } putchar(' '); if (NODE_DELIMO & n->flags) putchar('('); if (NODE_LINE & n->flags) putchar('*'); printf("%d:%d", n->line, n->pos + 1); if (NODE_DELIMC & n->flags) putchar(')'); if (NODE_EOS & n->flags) putchar('.'); if (NODE_BROKEN & n->flags) printf(" BROKEN"); if (NODE_NOSRC & n->flags) printf(" NOSRC"); if (NODE_NOPRT & n->flags) printf(" NOPRT"); putchar('\n'); } if (n->eqn) print_box(n->eqn->root->first, indent + 4); if (n->child) print_mdoc(n->child, indent + (n->type == ROFFT_BLOCK ? 2 : 4)); if (n->next) print_mdoc(n->next, indent); }
static void print_mdoc(const struct mdoc_node *n, int indent) { const char *p, *t; int i, j; size_t argc, sz; char **params; struct mdoc_argv *argv; argv = NULL; argc = sz = 0; params = NULL; t = p = NULL; switch (n->type) { case (MDOC_ROOT): t = "root"; break; case (MDOC_BLOCK): t = "block"; break; case (MDOC_HEAD): t = "block-head"; break; case (MDOC_BODY): if (n->end) t = "body-end"; else t = "block-body"; break; case (MDOC_TAIL): t = "block-tail"; break; case (MDOC_ELEM): t = "elem"; break; case (MDOC_TEXT): t = "text"; break; case (MDOC_TBL): /* FALLTHROUGH */ case (MDOC_EQN): break; default: abort(); /* NOTREACHED */ } switch (n->type) { case (MDOC_TEXT): p = n->string; break; case (MDOC_BODY): p = mdoc_macronames[n->tok]; break; case (MDOC_HEAD): p = mdoc_macronames[n->tok]; break; case (MDOC_TAIL): p = mdoc_macronames[n->tok]; break; case (MDOC_ELEM): p = mdoc_macronames[n->tok]; if (n->args) { argv = n->args->argv; argc = n->args->argc; } break; case (MDOC_BLOCK): p = mdoc_macronames[n->tok]; if (n->args) { argv = n->args->argv; argc = n->args->argc; } break; case (MDOC_TBL): /* FALLTHROUGH */ case (MDOC_EQN): break; case (MDOC_ROOT): p = "root"; break; default: abort(); /* NOTREACHED */ } if (n->span) { assert(NULL == p && NULL == t); print_span(n->span, indent); } else if (n->eqn) { assert(NULL == p && NULL == t); print_box(n->eqn->root, indent); } else { for (i = 0; i < indent; i++) putchar('\t'); printf("%s (%s)", p, t); for (i = 0; i < (int)argc; i++) { printf(" -%s", mdoc_argnames[argv[i].arg]); if (argv[i].sz > 0) printf(" ["); for (j = 0; j < (int)argv[i].sz; j++) printf(" [%s]", argv[i].value[j]); if (argv[i].sz > 0) printf(" ]"); } for (i = 0; i < (int)sz; i++) printf(" [%s]", params[i]); printf(" %d:%d\n", n->line, n->pos); } if (n->child) print_mdoc(n->child, indent + 1); if (n->next) print_mdoc(n->next, indent); }
/* ARGSUSED */ void tree_mdoc(void *arg, const struct mdoc *mdoc) { print_mdoc(mdoc_node(mdoc), 0); }
static void print_mdoc(const struct mdoc_node *n, int indent) { const char *p, *t; int i, j; size_t argc; struct mdoc_argv *argv; argv = NULL; argc = 0; t = p = NULL; switch (n->type) { case MDOC_ROOT: t = "root"; break; case MDOC_BLOCK: t = "block"; break; case MDOC_HEAD: t = "block-head"; break; case MDOC_BODY: if (n->end) t = "body-end"; else t = "block-body"; break; case MDOC_TAIL: t = "block-tail"; break; case MDOC_ELEM: t = "elem"; break; case MDOC_TEXT: t = "text"; break; case MDOC_TBL: break; case MDOC_EQN: t = "eqn"; break; default: abort(); /* NOTREACHED */ } switch (n->type) { case MDOC_TEXT: p = n->string; break; case MDOC_BODY: p = mdoc_macronames[n->tok]; break; case MDOC_HEAD: p = mdoc_macronames[n->tok]; break; case MDOC_TAIL: p = mdoc_macronames[n->tok]; break; case MDOC_ELEM: p = mdoc_macronames[n->tok]; if (n->args) { argv = n->args->argv; argc = n->args->argc; } break; case MDOC_BLOCK: p = mdoc_macronames[n->tok]; if (n->args) { argv = n->args->argv; argc = n->args->argc; } break; case MDOC_TBL: break; case MDOC_EQN: p = "EQ"; break; case MDOC_ROOT: p = "root"; break; default: abort(); /* NOTREACHED */ } if (n->span) { assert(NULL == p && NULL == t); print_span(n->span, indent); } else { for (i = 0; i < indent; i++) putchar('\t'); printf("%s (%s)", p, t); for (i = 0; i < (int)argc; i++) { printf(" -%s", mdoc_argnames[argv[i].arg]); if (argv[i].sz > 0) printf(" ["); for (j = 0; j < (int)argv[i].sz; j++) printf(" [%s]", argv[i].value[j]); if (argv[i].sz > 0) printf(" ]"); } putchar(' '); if (MDOC_LINE & n->flags) putchar('*'); printf("%d:%d", n->line, n->pos + 1); if (n->lastline != n->line) printf("-%d", n->lastline); putchar('\n'); } if (n->eqn) print_box(n->eqn->root->first, indent + 1); if (n->child) print_mdoc(n->child, indent + 1); if (n->next) print_mdoc(n->next, indent); }