static int pre_bf(DECL_ARGS) { switch (n->type) { case ROFFT_BLOCK: return 1; case ROFFT_BODY: break; default: return 0; } switch (n->norm->Bf.font) { case FONT_Em: font_push('I'); break; case FONT_Sy: font_push('B'); break; default: font_push('R'); break; } return 1; }
static int pre_rv(DECL_ARGS) { int nchild; outflags |= MMAN_br | MMAN_nl; nchild = n->nchild; if (nchild > 0) { print_word("The"); for (n = n->child; n; n = n->next) { font_push('B'); print_word(n->string); font_pop(); outflags &= ~MMAN_spc; print_word("()"); if (n->next == NULL) continue; if (nchild > 2) { outflags &= ~MMAN_spc; print_word(","); } if (n->next->next == NULL) print_word("and"); } if (nchild > 1) print_word("functions return"); else print_word("function returns"); print_word("the value\\~0 if successful;"); } else print_word("Upon successful completion, " "the value\\~0 is returned;"); print_word("otherwise the value\\~\\-1 is returned" " and the global variable"); font_push('I'); print_word("errno"); font_pop(); print_word("is set to indicate the error."); outflags |= MMAN_nl; return(0); }
static int pre_rv(DECL_ARGS) { struct roff_node *nch; outflags |= MMAN_br | MMAN_nl; if (n->child != NULL) { print_word("The"); for (nch = n->child; nch != NULL; nch = nch->next) { font_push('B'); print_word(nch->string); font_pop(); outflags &= ~MMAN_spc; print_word("()"); if (nch->next == NULL) continue; if (nch->prev != NULL || nch->next->next != NULL) { outflags &= ~MMAN_spc; print_word(","); } if (nch->next->next == NULL) print_word("and"); } if (n->child != NULL && n->child->next != NULL) print_word("functions return"); else print_word("function returns"); print_word("the value\\~0 if successful;"); } else print_word("Upon successful completion, " "the value\\~0 is returned;"); print_word("otherwise the value\\~\\-1 is returned" " and the global variable"); font_push('I'); print_word("errno"); font_pop(); print_word("is set to indicate the error."); outflags |= MMAN_nl; return 0; }
static int pre_nm(DECL_ARGS) { char *name; if (n->type == ROFFT_BLOCK) { outflags |= MMAN_Bk; pre_syn(n); } if (n->type != ROFFT_ELEM && n->type != ROFFT_HEAD) return 1; name = n->child ? n->child->string : meta->name; if (NULL == name) return 0; if (n->type == ROFFT_HEAD) { if (NULL == n->parent->prev) outflags |= MMAN_sp; print_block(".HP", 0); printf(" %zun", strlen(name) + 1); outflags |= MMAN_nl; } font_push('B'); if (NULL == n->child) print_word(meta->name); return 1; }
static int pre_em(DECL_ARGS) { font_push('I'); return 1; }
static int pre_li(DECL_ARGS) { font_push('R'); return 1; }
static int pre_sy(DECL_ARGS) { font_push('B'); return 1; }
static int pre_ex(DECL_ARGS) { int nchild; outflags |= MMAN_br | MMAN_nl; print_word("The"); nchild = n->nchild; for (n = n->child; n; n = n->next) { font_push('B'); print_word(n->string); font_pop(); if (n->next == NULL) continue; if (nchild > 2) { outflags &= ~MMAN_spc; print_word(","); } if (n->next->next == NULL) print_word("and"); } if (nchild > 1) print_word("utilities exit\\~0"); else print_word("utility exits\\~0"); print_word("on success, and\\~>0 if an error occurs."); outflags |= MMAN_nl; return(0); }
static int pre_fn(DECL_ARGS) { pre_syn(n); n = n->child; if (NULL == n) return 0; if (NODE_SYNPRETTY & n->flags) print_block(".HP 4n", MMAN_nl); font_push('B'); print_node(meta, n); font_pop(); outflags &= ~MMAN_spc; print_word("("); outflags &= ~MMAN_spc; n = n->next; if (NULL != n) pre_fa(meta, n); return 0; }
static int pre_fo(DECL_ARGS) { switch (n->type) { case ROFFT_BLOCK: pre_syn(n); break; case ROFFT_HEAD: if (n->child == NULL) return 0; if (NODE_SYNPRETTY & n->flags) print_block(".HP 4n", MMAN_nl); font_push('B'); break; case ROFFT_BODY: outflags &= ~(MMAN_spc | MMAN_nl); print_word("("); outflags &= ~MMAN_spc; break; default: break; } return 1; }
static int pre_in(DECL_ARGS) { if (NODE_SYNPRETTY & n->flags) { pre_syn(n); font_push('B'); print_word("#include <"); outflags &= ~MMAN_spc; } else { print_word("<"); outflags &= ~MMAN_spc; font_push('I'); } return 1; }
static int pre_nm(DECL_ARGS) { char *name; if (MDOC_BLOCK == n->type) { outflags |= MMAN_Bk; pre_syn(n); } if (MDOC_ELEM != n->type && MDOC_HEAD != n->type) return(1); name = n->child ? n->child->string : meta->name; if (NULL == name) return(0); if (MDOC_HEAD == n->type) { if (NULL == n->parent->prev) outflags |= MMAN_sp; print_block(".HP", 0); printf(" %zun", strlen(name) + 1); outflags |= MMAN_nl; } font_push('B'); if (NULL == n->child) print_word(meta->name); return(1); }
static int pre_ex(DECL_ARGS) { struct roff_node *nch; outflags |= MMAN_br | MMAN_nl; print_word("The"); for (nch = n->child; nch != NULL; nch = nch->next) { font_push('B'); print_word(nch->string); font_pop(); if (nch->next == NULL) continue; if (nch->prev != NULL || nch->next->next != NULL) { outflags &= ~MMAN_spc; print_word(","); } if (nch->next->next == NULL) print_word("and"); } if (n->child != NULL && n->child->next != NULL) print_word("utilities exit\\~0"); else print_word("utility exits\\~0"); print_word("on success, and\\~>0 if an error occurs."); outflags |= MMAN_nl; return 0; }
static int pre_fd(DECL_ARGS) { pre_syn(n); font_push('B'); return 1; }
static int pre_ft(DECL_ARGS) { pre_syn(n); font_push('I'); return(1); }
static int pre_Ft(DECL_ARGS) { pre_syn(n); font_push('I'); return 1; }
static int pre_fl(DECL_ARGS) { font_push('B'); print_word("\\-"); outflags &= ~MMAN_spc; return(1); }
static int pre_fl(DECL_ARGS) { font_push('B'); print_word("\\-"); if (n->child != NULL) outflags &= ~MMAN_spc; return 1; }
static int pre__t(DECL_ARGS) { if (n->parent->tok == MDOC_Rs && n->parent->norm->Rs.quote_T) { print_word("\\(lq"); outflags &= ~MMAN_spc; } else font_push('I'); return 1; }
static int pre__t(DECL_ARGS) { if (n->parent && MDOC_Rs == n->parent->tok && n->parent->norm->Rs.quote_T) { print_word(""); putchar('\"'); outflags &= ~MMAN_spc; } else font_push('I'); return(1); }
static int pre_lk(DECL_ARGS) { const struct mdoc_node *link, *descr; if (NULL == (link = n->child)) return(0); if (NULL != (descr = link->next)) { font_push('I'); while (NULL != descr) { print_word(descr->string); descr = descr->next; } print_word(":"); font_pop(); } font_push('B'); print_word(link->string); font_pop(); return(0); }
static int pre_lk(DECL_ARGS) { const struct roff_node *link, *descr, *punct; if ((link = n->child) == NULL) return 0; /* Find beginning of trailing punctuation. */ punct = n->last; while (punct != link && punct->flags & NODE_DELIMC) punct = punct->prev; punct = punct->next; /* Link text. */ if ((descr = link->next) != NULL && descr != punct) { font_push('I'); while (descr != punct) { print_word(descr->string); descr = descr->next; } font_pop(); print_word(":"); } /* Link target. */ font_push('B'); print_word(link->string); font_pop(); /* Trailing punctuation. */ while (punct != NULL) { print_word(punct->string); punct = punct->next; } return 0; }
static int pre_vt(DECL_ARGS) { if (NODE_SYNPRETTY & n->flags) { switch (n->type) { case ROFFT_BLOCK: pre_syn(n); return 1; case ROFFT_BODY: break; default: return 0; } } font_push('I'); return 1; }
static int pre_vt(DECL_ARGS) { if (MDOC_SYNPRETTY & n->flags) { switch (n->type) { case MDOC_BLOCK: pre_syn(n); return(1); case MDOC_BODY: break; default: return(0); } } font_push('I'); return(1); }
static int pre_fa(DECL_ARGS) { int am_Fa; am_Fa = MDOC_Fa == n->tok; if (am_Fa) n = n->child; while (NULL != n) { font_push('I'); if (am_Fa || NODE_SYNPRETTY & n->flags) outflags |= MMAN_nbrword; print_node(meta, n); font_pop(); if (NULL != (n = n->next)) print_word(","); } return 0; }
static int pre_fo(DECL_ARGS) { switch (n->type) { case MDOC_BLOCK: pre_syn(n); break; case MDOC_HEAD: if (MDOC_SYNPRETTY & n->flags) print_block(".HP 4n", MMAN_nl); font_push('B'); break; case MDOC_BODY: outflags &= ~MMAN_spc; print_word("("); outflags &= ~MMAN_spc; break; default: break; } return(1); }
static int pre_it(DECL_ARGS) { const struct mdoc_node *bln; switch (n->type) { case MDOC_HEAD: outflags |= MMAN_PP | MMAN_nl; bln = n->parent->parent; if (0 == bln->norm->Bl.comp || (NULL == n->parent->prev && NULL == bln->parent->prev)) outflags |= MMAN_sp; outflags &= ~MMAN_br; switch (bln->norm->Bl.type) { case LIST_item: return(0); case LIST_inset: /* FALLTHROUGH */ case LIST_diag: /* FALLTHROUGH */ case LIST_ohang: if (bln->norm->Bl.type == LIST_diag) print_line(".B \"", 0); else print_line(".R \"", 0); outflags &= ~MMAN_spc; return(1); case LIST_bullet: /* FALLTHROUGH */ case LIST_dash: /* FALLTHROUGH */ case LIST_hyphen: print_width(bln->norm->Bl.width, NULL, 0); TPremain = 0; outflags |= MMAN_nl; font_push('B'); if (LIST_bullet == bln->norm->Bl.type) print_word("o"); else print_word("-"); font_pop(); outflags |= MMAN_nl; return(0); case LIST_enum: print_width(bln->norm->Bl.width, NULL, 0); TPremain = 0; outflags |= MMAN_nl; print_count(&bln->norm->Bl.count); outflags |= MMAN_nl; return(0); case LIST_hang: print_width(bln->norm->Bl.width, n->child, 6); TPremain = 0; outflags |= MMAN_nl; return(1); case LIST_tag: print_width(bln->norm->Bl.width, n->child, 0); putchar('\n'); outflags &= ~MMAN_spc; return(1); default: return(1); } default: break; } return(1); }
static int pre_it(DECL_ARGS) { const struct roff_node *bln; switch (n->type) { case ROFFT_HEAD: outflags |= MMAN_PP | MMAN_nl; bln = n->parent->parent; if (0 == bln->norm->Bl.comp || (NULL == n->parent->prev && NULL == bln->parent->prev)) outflags |= MMAN_sp; outflags &= ~MMAN_br; switch (bln->norm->Bl.type) { case LIST_item: return 0; case LIST_inset: case LIST_diag: case LIST_ohang: if (bln->norm->Bl.type == LIST_diag) print_line(".B \"", 0); else print_line(".BR \\& \"", 0); outflags &= ~MMAN_spc; return 1; case LIST_bullet: case LIST_dash: case LIST_hyphen: print_width(&bln->norm->Bl, NULL); TPremain = 0; outflags |= MMAN_nl; font_push('B'); if (LIST_bullet == bln->norm->Bl.type) print_word("\\(bu"); else print_word("-"); font_pop(); outflags |= MMAN_nl; return 0; case LIST_enum: print_width(&bln->norm->Bl, NULL); TPremain = 0; outflags |= MMAN_nl; print_count(&bln->norm->Bl.count); outflags |= MMAN_nl; return 0; case LIST_hang: print_width(&bln->norm->Bl, n->child); TPremain = 0; outflags |= MMAN_nl; return 1; case LIST_tag: print_width(&bln->norm->Bl, n->child); putchar('\n'); outflags &= ~MMAN_spc; return 1; default: return 1; } default: break; } return 1; }