version 1.157, 2010/06/25 18:53:14 |
version 1.162, 2010/06/29 19:20:38 |
|
|
#include "mandoc.h" |
#include "mandoc.h" |
#include "out.h" |
#include "out.h" |
#include "term.h" |
#include "term.h" |
|
#include "regs.h" |
#include "mdoc.h" |
#include "mdoc.h" |
#include "chars.h" |
#include "chars.h" |
#include "main.h" |
#include "main.h" |
Line 72 static void termp____post(DECL_ARGS); |
|
Line 73 static void termp____post(DECL_ARGS); |
|
static void termp_an_post(DECL_ARGS); |
static void termp_an_post(DECL_ARGS); |
static void termp_aq_post(DECL_ARGS); |
static void termp_aq_post(DECL_ARGS); |
static void termp_bd_post(DECL_ARGS); |
static void termp_bd_post(DECL_ARGS); |
|
static void termp_bk_post(DECL_ARGS); |
static void termp_bl_post(DECL_ARGS); |
static void termp_bl_post(DECL_ARGS); |
static void termp_bq_post(DECL_ARGS); |
static void termp_bq_post(DECL_ARGS); |
static void termp_brq_post(DECL_ARGS); |
static void termp_brq_post(DECL_ARGS); |
Line 96 static int termp_ap_pre(DECL_ARGS); |
|
Line 98 static int termp_ap_pre(DECL_ARGS); |
|
static int termp_aq_pre(DECL_ARGS); |
static int termp_aq_pre(DECL_ARGS); |
static int termp_bd_pre(DECL_ARGS); |
static int termp_bd_pre(DECL_ARGS); |
static int termp_bf_pre(DECL_ARGS); |
static int termp_bf_pre(DECL_ARGS); |
|
static int termp_bk_pre(DECL_ARGS); |
static int termp_bl_pre(DECL_ARGS); |
static int termp_bl_pre(DECL_ARGS); |
static int termp_bold_pre(DECL_ARGS); |
static int termp_bold_pre(DECL_ARGS); |
static int termp_bq_pre(DECL_ARGS); |
static int termp_bq_pre(DECL_ARGS); |
Line 235 static const struct termact termacts[MDOC_MAX] = { |
|
Line 238 static const struct termact termacts[MDOC_MAX] = { |
|
{ NULL, NULL }, /* Fc */ |
{ NULL, NULL }, /* Fc */ |
{ termp_op_pre, termp_op_post }, /* Oo */ |
{ termp_op_pre, termp_op_post }, /* Oo */ |
{ NULL, NULL }, /* Oc */ |
{ NULL, NULL }, /* Oc */ |
{ NULL, NULL }, /* Bk */ |
{ termp_bk_pre, termp_bk_post }, /* Bk */ |
{ NULL, NULL }, /* Ek */ |
{ NULL, NULL }, /* Ek */ |
{ termp_bt_pre, NULL }, /* Bt */ |
{ termp_bt_pre, NULL }, /* Bt */ |
{ NULL, NULL }, /* Hf */ |
{ NULL, NULL }, /* Hf */ |
Line 322 print_mdoc_node(DECL_ARGS) |
|
Line 325 print_mdoc_node(DECL_ARGS) |
|
memset(&npair, 0, sizeof(struct termpair)); |
memset(&npair, 0, sizeof(struct termpair)); |
npair.ppair = pair; |
npair.ppair = pair; |
|
|
if (MDOC_TEXT != n->type) { |
if (MDOC_TEXT == n->type) |
if (termacts[n->tok].pre) |
|
chld = (*termacts[n->tok].pre)(p, &npair, m, n); |
|
} else |
|
term_word(p, n->string); |
term_word(p, n->string); |
|
else if (termacts[n->tok].pre && !n->end) |
|
chld = (*termacts[n->tok].pre)(p, &npair, m, n); |
|
|
if (chld && n->child) |
if (chld && n->child) |
print_mdoc_nodelist(p, &npair, m, n->child); |
print_mdoc_nodelist(p, &npair, m, n->child); |
|
|
term_fontpopq(p, font); |
term_fontpopq(p, font); |
|
|
if (MDOC_TEXT != n->type) |
if (MDOC_TEXT != n->type && |
if (termacts[n->tok].post) |
termacts[n->tok].post && |
(*termacts[n->tok].post)(p, &npair, m, n); |
! (MDOC_ENDED & n->flags)) { |
|
(*termacts[n->tok].post)(p, &npair, m, n); |
|
|
|
/* |
|
* Explicit end tokens not only call the post |
|
* handler, but also tell the respective block |
|
* that it must not call the post handler again. |
|
*/ |
|
if (n->end) |
|
n->pending->flags |= MDOC_ENDED; |
|
|
|
/* |
|
* End of line terminating an implicit block |
|
* while an explicit block is still open. |
|
* Continue the explicit block without spacing. |
|
*/ |
|
if (ENDBODY_NOSPACE == n->end) |
|
p->flags |= TERMP_NOSPACE; |
|
} |
|
|
if (MDOC_EOS & n->flags) |
if (MDOC_EOS & n->flags) |
p->flags |= TERMP_SENTENCE; |
p->flags |= TERMP_SENTENCE; |
|
|
Line 1275 synopsis_pre(struct termp *p, const struct mdoc_node * |
|
Line 1295 synopsis_pre(struct termp *p, const struct mdoc_node * |
|
* Obviously, if we're not in a SYNOPSIS or no prior macros |
* Obviously, if we're not in a SYNOPSIS or no prior macros |
* exist, do nothing. |
* exist, do nothing. |
*/ |
*/ |
if (NULL == n->prev || SEC_SYNOPSIS != n->sec) |
if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags)) |
return; |
return; |
|
|
/* |
/* |
Line 1540 termp_fn_pre(DECL_ARGS) |
|
Line 1560 termp_fn_pre(DECL_ARGS) |
|
|
|
term_word(p, ")"); |
term_word(p, ")"); |
|
|
if (SEC_SYNOPSIS == n->sec) |
if (MDOC_SYNPRETTY & n->flags) |
term_word(p, ";"); |
term_word(p, ";"); |
|
|
return(0); |
return(0); |
Line 1817 termp_in_pre(DECL_ARGS) |
|
Line 1837 termp_in_pre(DECL_ARGS) |
|
|
|
synopsis_pre(p, n); |
synopsis_pre(p, n); |
|
|
if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) { |
if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags) { |
term_fontpush(p, TERMFONT_BOLD); |
term_fontpush(p, TERMFONT_BOLD); |
term_word(p, "#include"); |
term_word(p, "#include"); |
term_word(p, "<"); |
term_word(p, "<"); |
|
|
termp_in_post(DECL_ARGS) |
termp_in_post(DECL_ARGS) |
{ |
{ |
|
|
if (SEC_SYNOPSIS == n->sec) |
if (MDOC_SYNPRETTY & n->flags) |
term_fontpush(p, TERMFONT_BOLD); |
term_fontpush(p, TERMFONT_BOLD); |
|
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
term_word(p, ">"); |
term_word(p, ">"); |
|
|
if (SEC_SYNOPSIS == n->sec) |
if (MDOC_SYNPRETTY & n->flags) |
term_fontpop(p); |
term_fontpop(p); |
} |
} |
|
|
Line 1984 termp_fo_post(DECL_ARGS) |
|
Line 2004 termp_fo_post(DECL_ARGS) |
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
term_word(p, ")"); |
term_word(p, ")"); |
|
|
if (SEC_SYNOPSIS == n->sec) { |
if (MDOC_SYNPRETTY & n->flags) { |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
term_word(p, ";"); |
term_word(p, ";"); |
} |
} |
Line 2100 termp_lk_pre(DECL_ARGS) |
|
Line 2120 termp_lk_pre(DECL_ARGS) |
|
return(0); |
return(0); |
} |
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static int |
|
termp_bk_pre(DECL_ARGS) |
|
{ |
|
|
|
switch (n->type) { |
|
case (MDOC_BLOCK): |
|
return(1); |
|
case (MDOC_HEAD): |
|
return(0); |
|
case (MDOC_BODY): |
|
p->flags |= TERMP_PREKEEP; |
|
return(1); |
|
default: |
|
abort(); |
|
} |
|
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static void |
|
termp_bk_post(DECL_ARGS) |
|
{ |
|
|
|
if (MDOC_BODY == n->type) |
|
p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); |
|
} |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static int |
static int |