version 1.62, 2009/07/24 12:52:28 |
version 1.68, 2009/08/20 13:22:48 |
|
|
#include "term.h" |
#include "term.h" |
#include "mdoc.h" |
#include "mdoc.h" |
|
|
/* FIXME: macro arguments can be escaped. */ |
#define INDENT 5 |
|
#define HALFINDENT 3 |
|
|
#define TTYPE_PROG 0 |
#define TTYPE_PROG 0 |
#define TTYPE_CMD_FLAG 1 |
#define TTYPE_CMD_FLAG 1 |
Line 674 fmt_block_vspace(struct termp *p, |
|
Line 675 fmt_block_vspace(struct termp *p, |
|
|
|
if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Compact, bl)) |
if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Compact, bl)) |
return; |
return; |
|
assert(node); |
|
|
/* |
/* |
* Search through our prior nodes. If we follow a `Ss' or `Sh', |
* Search through our prior nodes. If we follow a `Ss' or `Sh', |
Line 819 termp_it_pre(DECL_ARGS) |
|
Line 821 termp_it_pre(DECL_ARGS) |
|
/* |
/* |
* List-type can override the width in the case of fixed-head |
* List-type can override the width in the case of fixed-head |
* values (bullet, dash/hyphen, enum). Tags need a non-zero |
* values (bullet, dash/hyphen, enum). Tags need a non-zero |
* offset. FIXME: double-check that correct. |
* offset. |
*/ |
*/ |
|
|
switch (type) { |
switch (type) { |
Line 1235 termp_rs_pre(DECL_ARGS) |
|
Line 1237 termp_rs_pre(DECL_ARGS) |
|
static int |
static int |
termp_rv_pre(DECL_ARGS) |
termp_rv_pre(DECL_ARGS) |
{ |
{ |
int i; |
const struct mdoc_node *nn; |
|
|
i = arg_getattr(MDOC_Std, node); |
|
assert(-1 != i); |
|
assert(node->args->argv[i].sz); |
|
|
|
term_newln(p); |
term_newln(p); |
term_word(p, "The"); |
term_word(p, "The"); |
|
|
p->flags |= ttypes[TTYPE_FUNC_NAME]; |
nn = node->child; |
term_word(p, *node->args->argv[i].value); |
assert(nn); |
p->flags &= ~ttypes[TTYPE_FUNC_NAME]; |
for ( ; nn; nn = nn->next) { |
p->flags |= TERMP_NOSPACE; |
p->flags |= ttypes[TTYPE_FUNC_NAME]; |
|
term_word(p, nn->string); |
|
p->flags &= ~ttypes[TTYPE_FUNC_NAME]; |
|
p->flags |= TERMP_NOSPACE; |
|
if (nn->next && NULL == nn->next->next) |
|
term_word(p, "(), and"); |
|
else if (nn->next) |
|
term_word(p, "(),"); |
|
else |
|
term_word(p, "()"); |
|
} |
|
|
term_word(p, "() function returns the value 0 if successful;"); |
if (node->child->next) |
term_word(p, "otherwise the value -1 is returned and the"); |
term_word(p, "functions return"); |
term_word(p, "global variable"); |
else |
|
term_word(p, "function returns"); |
|
|
|
term_word(p, "the value 0 if successful; otherwise the value " |
|
"-1 is returned and the global variable"); |
|
|
p->flags |= ttypes[TTYPE_VAR_DECL]; |
p->flags |= ttypes[TTYPE_VAR_DECL]; |
term_word(p, "errno"); |
term_word(p, "errno"); |
p->flags &= ~ttypes[TTYPE_VAR_DECL]; |
p->flags &= ~ttypes[TTYPE_VAR_DECL]; |
|
|
term_word(p, "is set to indicate the error."); |
term_word(p, "is set to indicate the error."); |
|
|
return(1); |
return(0); |
} |
} |
|
|
|
|
Line 1267 termp_rv_pre(DECL_ARGS) |
|
Line 1279 termp_rv_pre(DECL_ARGS) |
|
static int |
static int |
termp_ex_pre(DECL_ARGS) |
termp_ex_pre(DECL_ARGS) |
{ |
{ |
int i; |
const struct mdoc_node *nn; |
|
|
i = arg_getattr(MDOC_Std, node); |
|
assert(-1 != i); |
|
assert(node->args->argv[i].sz); |
|
|
|
term_word(p, "The"); |
term_word(p, "The"); |
p->flags |= ttypes[TTYPE_PROG]; |
|
term_word(p, *node->args->argv[i].value); |
|
p->flags &= ~ttypes[TTYPE_PROG]; |
|
term_word(p, "utility exits 0 on success, and >0 if an error occurs."); |
|
|
|
return(1); |
nn = node->child; |
|
assert(nn); |
|
for ( ; nn; nn = nn->next) { |
|
p->flags |= ttypes[TTYPE_PROG]; |
|
term_word(p, nn->string); |
|
p->flags &= ~ttypes[TTYPE_PROG]; |
|
p->flags |= TERMP_NOSPACE; |
|
if (nn->next && NULL == nn->next->next) |
|
term_word(p, ", and"); |
|
else if (nn->next) |
|
term_word(p, ","); |
|
else |
|
p->flags &= ~TERMP_NOSPACE; |
|
} |
|
|
|
if (node->child->next) |
|
term_word(p, "utilities exit"); |
|
else |
|
term_word(p, "utility exits"); |
|
|
|
term_word(p, "0 on success, and >0 if an error occurs."); |
|
|
|
return(0); |
} |
} |
|
|
|
|
Line 1397 termp_fd_post(DECL_ARGS) |
|
Line 1423 termp_fd_post(DECL_ARGS) |
|
static int |
static int |
termp_sh_pre(DECL_ARGS) |
termp_sh_pre(DECL_ARGS) |
{ |
{ |
|
/* |
|
* XXX: undocumented: using two `Sh' macros in sequence has no |
|
* vspace between calls, only a newline. |
|
*/ |
switch (node->type) { |
switch (node->type) { |
case (MDOC_HEAD): |
case (MDOC_BLOCK): |
|
if (node->prev && MDOC_Sh == node->prev->tok) |
|
if (NULL == node->prev->body->child) |
|
break; |
term_vspace(p); |
term_vspace(p); |
|
break; |
|
case (MDOC_HEAD): |
pair->flag |= ttypes[TTYPE_SECTION]; |
pair->flag |= ttypes[TTYPE_SECTION]; |
break; |
break; |
case (MDOC_BODY): |
case (MDOC_BODY): |