version 1.50, 2009/03/09 13:17:49 |
version 1.53, 2009/03/11 00:39:58 |
|
|
#define TTYPE_SYMB 16 |
#define TTYPE_SYMB 16 |
#define TTYPE_SYMBOL 17 |
#define TTYPE_SYMBOL 17 |
#define TTYPE_DIAG 18 |
#define TTYPE_DIAG 18 |
#define TTYPE_NMAX 19 |
#define TTYPE_LINK_ANCHOR 19 |
|
#define TTYPE_LINK_TEXT 20 |
|
#define TTYPE_NMAX 21 |
|
|
/* |
/* |
* These define "styles" for element types, like command arguments or |
* These define "styles" for element types, like command arguments or |
Line 82 const int ttypes[TTYPE_NMAX] = { |
|
Line 84 const int ttypes[TTYPE_NMAX] = { |
|
TERMP_BOLD, /* TTYPE_INCLUDE */ |
TERMP_BOLD, /* TTYPE_INCLUDE */ |
TERMP_BOLD, /* TTYPE_SYMB */ |
TERMP_BOLD, /* TTYPE_SYMB */ |
TERMP_BOLD, /* TTYPE_SYMBOL */ |
TERMP_BOLD, /* TTYPE_SYMBOL */ |
TERMP_BOLD /* TTYPE_DIAG */ |
TERMP_BOLD, /* TTYPE_DIAG */ |
|
TERMP_UNDERLINE, /* TTYPE_LINK_ANCHOR */ |
|
TERMP_BOLD /* TTYPE_LINK_TEXT */ |
}; |
}; |
|
|
static int arg_hasattr(int, const struct mdoc_node *); |
static int arg_hasattr(int, const struct mdoc_node *); |
Line 114 DECL_PREPOST(termp__t); |
|
Line 118 DECL_PREPOST(termp__t); |
|
DECL_PREPOST(termp_aq); |
DECL_PREPOST(termp_aq); |
DECL_PREPOST(termp_bd); |
DECL_PREPOST(termp_bd); |
DECL_PREPOST(termp_bq); |
DECL_PREPOST(termp_bq); |
|
DECL_PREPOST(termp_brq); |
DECL_PREPOST(termp_d1); |
DECL_PREPOST(termp_d1); |
DECL_PREPOST(termp_dq); |
DECL_PREPOST(termp_dq); |
DECL_PREPOST(termp_fd); |
DECL_PREPOST(termp_fd); |
Line 146 DECL_PRE(termp_fa); |
|
Line 151 DECL_PRE(termp_fa); |
|
DECL_PRE(termp_fl); |
DECL_PRE(termp_fl); |
DECL_PRE(termp_fx); |
DECL_PRE(termp_fx); |
DECL_PRE(termp_ic); |
DECL_PRE(termp_ic); |
|
DECL_PRE(termp_lk); |
DECL_PRE(termp_ms); |
DECL_PRE(termp_ms); |
|
DECL_PRE(termp_mt); |
DECL_PRE(termp_nd); |
DECL_PRE(termp_nd); |
DECL_PRE(termp_nm); |
DECL_PRE(termp_nm); |
DECL_PRE(termp_ns); |
DECL_PRE(termp_ns); |
Line 279 const struct termact __termacts[MDOC_MAX] = { |
|
Line 286 const struct termact __termacts[MDOC_MAX] = { |
|
{ termp_lb_pre, termp_lb_post }, /* Lb */ |
{ termp_lb_pre, termp_lb_post }, /* Lb */ |
{ termp_ap_pre, NULL }, /* Lb */ |
{ termp_ap_pre, NULL }, /* Lb */ |
{ termp_pp_pre, NULL }, /* Pp */ |
{ termp_pp_pre, NULL }, /* Pp */ |
|
{ termp_lk_pre, NULL }, /* Lk */ |
|
{ termp_mt_pre, NULL }, /* Mt */ |
|
{ termp_brq_pre, termp_brq_post }, /* Brq */ |
|
{ termp_brq_pre, termp_brq_post }, /* Bro */ |
|
{ NULL, NULL }, /* Brc */ |
}; |
}; |
|
|
const struct termact *termacts = __termacts; |
const struct termact *termacts = __termacts; |
Line 725 termp_st_pre(DECL_ARGS) |
|
Line 737 termp_st_pre(DECL_ARGS) |
|
{ |
{ |
const char *cp; |
const char *cp; |
|
|
if (node->child) { |
if (node->child && (cp = mdoc_a2st(node->child->string))) |
if (MDOC_TEXT != node->child->type) |
word(p, cp); |
errx(1, "expected text line arguments"); |
|
if ((cp = mdoc_a2st(node->child->string))) |
|
word(p, cp); |
|
} |
|
return(0); |
return(0); |
} |
} |
|
|
Line 839 termp_xr_pre(DECL_ARGS) |
|
Line 847 termp_xr_pre(DECL_ARGS) |
|
|
|
if (NULL == (n = node->child)) |
if (NULL == (n = node->child)) |
errx(1, "expected text line argument"); |
errx(1, "expected text line argument"); |
if (MDOC_TEXT != n->type) |
|
errx(1, "expected text line argument"); |
|
|
|
word(p, n->string); |
word(p, n->string); |
|
|
if (NULL == (n = n->next)) |
if (NULL == (n = n->next)) |
return(0); |
return(0); |
if (MDOC_TEXT != n->type) |
|
errx(1, "expected text line argument"); |
|
|
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
word(p, "("); |
word(p, "("); |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
word(p, n->string); |
word(p, n->string); |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
word(p, ")"); |
word(p, ")"); |
|
|
return(0); |
return(0); |
} |
} |
|
|
Line 982 termp_lb_pre(DECL_ARGS) |
|
Line 982 termp_lb_pre(DECL_ARGS) |
|
|
|
if (NULL == node->child) |
if (NULL == node->child) |
errx(1, "expected text line argument"); |
errx(1, "expected text line argument"); |
if (MDOC_TEXT != node->child->type) |
|
errx(1, "expected text line argument"); |
|
|
|
if ((lb = mdoc_a2lib(node->child->string))) { |
if ((lb = mdoc_a2lib(node->child->string))) { |
word(p, lb); |
word(p, lb); |
return(0); |
return(0); |
} |
} |
|
|
word(p, "library"); |
word(p, "library"); |
return(1); |
return(1); |
} |
} |
Line 1095 termp_fn_pre(DECL_ARGS) |
|
Line 1091 termp_fn_pre(DECL_ARGS) |
|
|
|
if (NULL == node->child) |
if (NULL == node->child) |
errx(1, "expected text line arguments"); |
errx(1, "expected text line arguments"); |
if (MDOC_TEXT != node->child->type) |
|
errx(1, "expected text line arguments"); |
|
|
|
/* FIXME: can be "type funcname" "type varname"... */ |
/* FIXME: can be "type funcname" "type varname"... */ |
|
|
Line 1108 termp_fn_pre(DECL_ARGS) |
|
Line 1102 termp_fn_pre(DECL_ARGS) |
|
|
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
for (n = node->child->next; n; n = n->next) { |
for (n = node->child->next; n; n = n->next) { |
if (MDOC_TEXT != n->type) |
|
errx(1, "expected text line arguments"); |
|
p->flags |= ttypes[TTYPE_FUNC_ARG]; |
p->flags |= ttypes[TTYPE_FUNC_ARG]; |
word(p, n->string); |
word(p, n->string); |
p->flags &= ~ttypes[TTYPE_FUNC_ARG]; |
p->flags &= ~ttypes[TTYPE_FUNC_ARG]; |
Line 1159 termp_fa_pre(DECL_ARGS) |
|
Line 1151 termp_fa_pre(DECL_ARGS) |
|
} |
} |
|
|
for (n = node->child; n; n = n->next) { |
for (n = node->child; n; n = n->next) { |
if (MDOC_TEXT != n->type) |
|
errx(1, "expected text line arguments"); |
|
|
|
p->flags |= ttypes[TTYPE_FUNC_ARG]; |
p->flags |= ttypes[TTYPE_FUNC_ARG]; |
word(p, n->string); |
word(p, n->string); |
p->flags &= ~ttypes[TTYPE_FUNC_ARG]; |
p->flags &= ~ttypes[TTYPE_FUNC_ARG]; |
|
|
if (n->next) |
if (n->next) |
word(p, ","); |
word(p, ","); |
} |
} |
Line 1528 termp_at_pre(DECL_ARGS) |
|
Line 1516 termp_at_pre(DECL_ARGS) |
|
|
|
att = NULL; |
att = NULL; |
|
|
if (node->child) { |
if (node->child) |
if (MDOC_TEXT != node->child->type) |
|
errx(1, "expected text line argument"); |
|
att = mdoc_a2att(node->child->string); |
att = mdoc_a2att(node->child->string); |
} |
|
|
|
if (NULL == att) |
if (NULL == att) |
att = "AT&T UNIX"; |
att = "AT&T UNIX"; |
|
|
Line 1544 termp_at_pre(DECL_ARGS) |
|
Line 1528 termp_at_pre(DECL_ARGS) |
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static int |
static int |
|
termp_brq_pre(DECL_ARGS) |
|
{ |
|
|
|
if (MDOC_BODY != node->type) |
|
return(1); |
|
word(p, "\\(lC"); |
|
p->flags |= TERMP_NOSPACE; |
|
return(1); |
|
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static void |
|
termp_brq_post(DECL_ARGS) |
|
{ |
|
|
|
if (MDOC_BODY != node->type) |
|
return; |
|
p->flags |= TERMP_NOSPACE; |
|
word(p, "\\(rC"); |
|
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static int |
termp_bq_pre(DECL_ARGS) |
termp_bq_pre(DECL_ARGS) |
{ |
{ |
|
|
if (MDOC_BODY != node->type) |
if (MDOC_BODY != node->type) |
return(1); |
return(1); |
word(p, "["); |
word(p, "\\(lB"); |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
return(1); |
return(1); |
} |
} |
Line 1562 termp_bq_post(DECL_ARGS) |
|
Line 1571 termp_bq_post(DECL_ARGS) |
|
|
|
if (MDOC_BODY != node->type) |
if (MDOC_BODY != node->type) |
return; |
return; |
word(p, "]"); |
p->flags |= TERMP_NOSPACE; |
|
word(p, "\\(rB"); |
} |
} |
|
|
|
|
Line 1624 termp_fo_post(DECL_ARGS) |
|
Line 1634 termp_fo_post(DECL_ARGS) |
|
|
|
if (MDOC_BODY != node->type) |
if (MDOC_BODY != node->type) |
return; |
return; |
|
p->flags |= TERMP_NOSPACE; |
word(p, ")"); |
word(p, ")"); |
|
p->flags |= TERMP_NOSPACE; |
word(p, ";"); |
word(p, ";"); |
newln(p); |
newln(p); |
} |
} |
Line 1747 termp____post(DECL_ARGS) |
|
Line 1759 termp____post(DECL_ARGS) |
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
word(p, node->next ? "," : "."); |
word(p, node->next ? "," : "."); |
} |
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static int |
|
termp_lk_pre(DECL_ARGS) |
|
{ |
|
const struct mdoc_node *n; |
|
|
|
if (NULL == (n = node->child)) |
|
errx(1, "expected line argument"); |
|
|
|
p->flags |= ttypes[TTYPE_LINK_ANCHOR]; |
|
word(p, n->string); |
|
p->flags &= ~ttypes[TTYPE_LINK_ANCHOR]; |
|
p->flags |= TERMP_NOSPACE; |
|
word(p, ":"); |
|
|
|
p->flags |= ttypes[TTYPE_LINK_TEXT]; |
|
for ( ; n; n = n->next) { |
|
word(p, n->string); |
|
} |
|
p->flags &= ~ttypes[TTYPE_LINK_TEXT]; |
|
|
|
return(0); |
|
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static int |
|
termp_mt_pre(DECL_ARGS) |
|
{ |
|
|
|
TERMPAIR_SETFLAG(p, pair, ttypes[TTYPE_LINK_ANCHOR]); |
|
return(1); |
|
} |
|
|