version 1.63, 2015/04/02 21:36:51 |
version 1.68, 2015/09/26 12:55:16 |
|
|
#include "main.h" |
#include "main.h" |
|
|
static void print_box(const struct eqn_box *, int); |
static void print_box(const struct eqn_box *, int); |
static void print_man(const struct man_node *, int); |
static void print_man(const struct roff_node *, int); |
static void print_mdoc(const struct mdoc_node *, int); |
static void print_mdoc(const struct roff_node *, int); |
static void print_span(const struct tbl_span *, int); |
static void print_span(const struct tbl_span *, int); |
|
|
|
|
void |
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); |
print_mdoc(mdoc->first->child, 0); |
} |
} |
|
|
void |
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); |
print_man(man->first->child, 0); |
} |
} |
|
|
static void |
static void |
print_mdoc(const struct mdoc_node *n, int indent) |
print_mdoc(const struct roff_node *n, int indent) |
{ |
{ |
const char *p, *t; |
const char *p, *t; |
int i, j; |
int i, j; |
Line 74 print_mdoc(const struct mdoc_node *n, int indent) |
|
Line 74 print_mdoc(const struct mdoc_node *n, int indent) |
|
t = "block"; |
t = "block"; |
break; |
break; |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
t = "block-head"; |
t = "head"; |
break; |
break; |
case ROFFT_BODY: |
case ROFFT_BODY: |
if (n->end) |
if (n->end) |
t = "body-end"; |
t = "body-end"; |
else |
else |
t = "block-body"; |
t = "body"; |
break; |
break; |
case ROFFT_TAIL: |
case ROFFT_TAIL: |
t = "block-tail"; |
t = "tail"; |
break; |
break; |
case ROFFT_ELEM: |
case ROFFT_ELEM: |
t = "elem"; |
t = "elem"; |
Line 98 print_mdoc(const struct mdoc_node *n, int indent) |
|
Line 98 print_mdoc(const struct mdoc_node *n, int indent) |
|
break; |
break; |
default: |
default: |
abort(); |
abort(); |
/* NOTREACHED */ |
|
} |
} |
|
|
switch (n->type) { |
switch (n->type) { |
Line 138 print_mdoc(const struct mdoc_node *n, int indent) |
|
Line 137 print_mdoc(const struct mdoc_node *n, int indent) |
|
break; |
break; |
default: |
default: |
abort(); |
abort(); |
/* NOTREACHED */ |
|
} |
} |
|
|
if (n->span) { |
if (n->span) { |
Line 161 print_mdoc(const struct mdoc_node *n, int indent) |
|
Line 159 print_mdoc(const struct mdoc_node *n, int indent) |
|
} |
} |
|
|
putchar(' '); |
putchar(' '); |
|
if (MDOC_DELIMO & n->flags) |
|
putchar('('); |
if (MDOC_LINE & n->flags) |
if (MDOC_LINE & n->flags) |
putchar('*'); |
putchar('*'); |
printf("%d:%d\n", n->line, n->pos + 1); |
printf("%d:%d", n->line, n->pos + 1); |
|
if (MDOC_DELIMC & n->flags) |
|
putchar(')'); |
|
if (MDOC_EOS & n->flags) |
|
putchar('.'); |
|
putchar('\n'); |
} |
} |
|
|
if (n->eqn) |
if (n->eqn) |
Line 176 print_mdoc(const struct mdoc_node *n, int indent) |
|
Line 181 print_mdoc(const struct mdoc_node *n, int indent) |
|
} |
} |
|
|
static void |
static void |
print_man(const struct man_node *n, int indent) |
print_man(const struct roff_node *n, int indent) |
{ |
{ |
const char *p, *t; |
const char *p, *t; |
int i; |
int i; |
Line 200 print_man(const struct man_node *n, int indent) |
|
Line 205 print_man(const struct man_node *n, int indent) |
|
t = "block"; |
t = "block"; |
break; |
break; |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
t = "block-head"; |
t = "head"; |
break; |
break; |
case ROFFT_BODY: |
case ROFFT_BODY: |
t = "block-body"; |
t = "body"; |
break; |
break; |
case ROFFT_TBL: |
case ROFFT_TBL: |
break; |
break; |
Line 212 print_man(const struct man_node *n, int indent) |
|
Line 217 print_man(const struct man_node *n, int indent) |
|
break; |
break; |
default: |
default: |
abort(); |
abort(); |
/* NOTREACHED */ |
|
} |
} |
|
|
switch (n->type) { |
switch (n->type) { |
Line 238 print_man(const struct man_node *n, int indent) |
|
Line 242 print_man(const struct man_node *n, int indent) |
|
break; |
break; |
default: |
default: |
abort(); |
abort(); |
/* NOTREACHED */ |
|
} |
} |
|
|
if (n->span) { |
if (n->span) { |
Line 250 print_man(const struct man_node *n, int indent) |
|
Line 253 print_man(const struct man_node *n, int indent) |
|
printf("%s (%s) ", p, t); |
printf("%s (%s) ", p, t); |
if (MAN_LINE & n->flags) |
if (MAN_LINE & n->flags) |
putchar('*'); |
putchar('*'); |
printf("%d:%d\n", n->line, n->pos + 1); |
printf("%d:%d", n->line, n->pos + 1); |
|
if (MAN_EOS & n->flags) |
|
putchar('.'); |
|
putchar('\n'); |
} |
} |
|
|
if (n->eqn) |
if (n->eqn) |