version 1.11, 2012/07/07 13:46:59 |
version 1.12, 2012/07/07 13:53:14 |
|
|
#include "config.h" |
#include "config.h" |
#endif |
#endif |
|
|
|
#include <assert.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <string.h> |
#include <string.h> |
|
|
|
|
struct mman *mm |
struct mman *mm |
|
|
struct mman { |
struct mman { |
|
int mode_space; /* spacing mode: 1 = on */ |
int need_space; /* next word needs prior ws */ |
int need_space; /* next word needs prior ws */ |
int need_nl; /* next word needs prior nl */ |
int need_nl; /* next word needs prior nl */ |
}; |
}; |
Line 64 static int pre_it(DECL_ARGS); |
|
Line 66 static int pre_it(DECL_ARGS); |
|
static int pre_nm(DECL_ARGS); |
static int pre_nm(DECL_ARGS); |
static int pre_ns(DECL_ARGS); |
static int pre_ns(DECL_ARGS); |
static int pre_pp(DECL_ARGS); |
static int pre_pp(DECL_ARGS); |
|
static int pre_sm(DECL_ARGS); |
static int pre_sp(DECL_ARGS); |
static int pre_sp(DECL_ARGS); |
static int pre_sect(DECL_ARGS); |
static int pre_sect(DECL_ARGS); |
static int pre_ux(DECL_ARGS); |
static int pre_ux(DECL_ARGS); |
Line 168 static const struct manact manacts[MDOC_MAX + 1] = { |
|
Line 171 static const struct manact manacts[MDOC_MAX + 1] = { |
|
{ NULL, NULL, NULL, NULL, NULL }, /* Sc */ |
{ NULL, NULL, NULL, NULL, NULL }, /* Sc */ |
{ cond_body, pre_enc, post_enc, "`", "'" }, /* So */ |
{ cond_body, pre_enc, post_enc, "`", "'" }, /* So */ |
{ cond_body, pre_enc, post_enc, "`", "'" }, /* Sq */ |
{ cond_body, pre_enc, post_enc, "`", "'" }, /* Sq */ |
{ NULL, NULL, NULL, NULL, NULL }, /* _Sm */ |
{ NULL, pre_sm, NULL, NULL, NULL }, /* Sm */ |
{ NULL, pre_enc, post_enc, "\\fI", "\\fP" }, /* Sx */ |
{ NULL, pre_enc, post_enc, "\\fI", "\\fP" }, /* Sx */ |
{ NULL, pre_enc, post_enc, "\\fB", "\\fP" }, /* Sy */ |
{ NULL, pre_enc, post_enc, "\\fB", "\\fP" }, /* Sy */ |
{ NULL, pre_enc, post_enc, "\\fR", "\\fP" }, /* Tn */ |
{ NULL, pre_enc, post_enc, "\\fR", "\\fP" }, /* Tn */ |
Line 229 print_word(struct mman *mm, const char *s) |
|
Line 232 print_word(struct mman *mm, const char *s) |
|
* Reassign needing space if we're not following opening |
* Reassign needing space if we're not following opening |
* punctuation. |
* punctuation. |
*/ |
*/ |
mm->need_space = |
mm->need_space = mm->mode_space && |
('(' != s[0] && '[' != s[0]) || '\0' != s[1]; |
(('(' != s[0] && '[' != s[0]) || '\0' != s[1]); |
|
|
for ( ; *s; s++) { |
for ( ; *s; s++) { |
switch (*s) { |
switch (*s) { |
Line 298 man_mdoc(void *arg, const struct mdoc *mdoc) |
|
Line 301 man_mdoc(void *arg, const struct mdoc *mdoc) |
|
|
|
memset(&mm, 0, sizeof(struct mman)); |
memset(&mm, 0, sizeof(struct mman)); |
|
|
|
mm.mode_space = 1; |
mm.need_nl = 1; |
mm.need_nl = 1; |
print_node(m, n, &mm); |
print_node(m, n, &mm); |
putchar('\n'); |
putchar('\n'); |
Line 628 pre_pp(DECL_ARGS) |
|
Line 632 pre_pp(DECL_ARGS) |
|
print_word(mm, ".PP"); |
print_word(mm, ".PP"); |
mm->need_nl = 1; |
mm->need_nl = 1; |
return(MDOC_Rs == n->tok); |
return(MDOC_Rs == n->tok); |
|
} |
|
|
|
static int |
|
pre_sm(DECL_ARGS) |
|
{ |
|
|
|
assert(n->child && MDOC_TEXT == n->child->type); |
|
if (0 == strcmp("on", n->child->string)) |
|
mm->mode_space = 1; |
|
else |
|
mm->mode_space = 0; |
|
return(0); |
} |
} |
|
|
static int |
static int |