version 1.13, 2019/04/14 23:59:11 |
version 1.17, 2019/05/01 15:05:39 |
|
|
void |
void |
macro_open(struct format *f, const char *name) |
macro_open(struct format *f, const char *name) |
{ |
{ |
|
if (f->parastate == PARA_WANT) { |
|
if (f->linestate != LINE_NEW) { |
|
putchar('\n'); |
|
f->linestate = LINE_NEW; |
|
} |
|
puts(".Pp"); |
|
} |
switch (f->linestate) { |
switch (f->linestate) { |
case LINE_MACRO: |
case LINE_MACRO: |
if (f->flags & FMT_NOSPC) { |
if (f->flags & FMT_NOSPC) { |
Line 42 macro_open(struct format *f, const char *name) |
|
Line 49 macro_open(struct format *f, const char *name) |
|
} |
} |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case LINE_TEXT: |
case LINE_TEXT: |
|
if (f->nofill) |
|
fputs(" \\c", stdout); |
putchar('\n'); |
putchar('\n'); |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case LINE_NEW: |
case LINE_NEW: |
Line 53 macro_open(struct format *f, const char *name) |
|
Line 62 macro_open(struct format *f, const char *name) |
|
fputs(name, stdout); |
fputs(name, stdout); |
f->flags &= FMT_IMPL; |
f->flags &= FMT_IMPL; |
f->flags |= FMT_ARG; |
f->flags |= FMT_ARG; |
|
f->parastate = PARA_MID; |
} |
} |
|
|
void |
void |
Line 138 macro_addarg(struct format *f, const char *arg, int fl |
|
Line 148 macro_addarg(struct format *f, const char *arg, int fl |
|
} |
} |
if (quote_now) |
if (quote_now) |
putchar('"'); |
putchar('"'); |
|
f->parastate = PARA_MID; |
} |
} |
|
|
void |
void |
|
|
macro_addnode(struct format *f, struct pnode *n, int flags) |
macro_addnode(struct format *f, struct pnode *n, int flags) |
{ |
{ |
struct pnode *nc; |
struct pnode *nc; |
int quote_now; |
int is_text, quote_now; |
|
|
assert(f->linestate == LINE_MACRO); |
assert(f->linestate == LINE_MACRO); |
|
|
Line 170 macro_addnode(struct format *f, struct pnode *n, int f |
|
Line 181 macro_addnode(struct format *f, struct pnode *n, int f |
|
|
|
if (n->node == NODE_TEXT || n->node == NODE_ESCAPE) { |
if (n->node == NODE_TEXT || n->node == NODE_ESCAPE) { |
macro_addarg(f, n->b, flags); |
macro_addarg(f, n->b, flags); |
|
f->parastate = PARA_MID; |
return; |
return; |
} |
} |
|
|
Line 199 macro_addnode(struct format *f, struct pnode *n, int f |
|
Line 211 macro_addnode(struct format *f, struct pnode *n, int f |
|
|
|
while (nc != NULL) { |
while (nc != NULL) { |
macro_addnode(f, nc, flags); |
macro_addnode(f, nc, flags); |
|
is_text = pnode_class(nc->node) == CLASS_TEXT; |
nc = TAILQ_NEXT(nc, child); |
nc = TAILQ_NEXT(nc, child); |
flags |= ARG_SPACE; |
if (nc == NULL || pnode_class(nc->node) != CLASS_TEXT) |
|
is_text = 0; |
|
if (is_text && (nc->flags & NFLAG_SPC) == 0) |
|
flags &= ~ARG_SPACE; |
|
else |
|
flags |= ARG_SPACE; |
} |
} |
if (quote_now) |
if (quote_now) |
putchar('"'); |
putchar('"'); |
|
f->parastate = PARA_MID; |
} |
} |
|
|
void |
void |
Line 222 macro_nodeline(struct format *f, const char *name, str |
|
Line 241 macro_nodeline(struct format *f, const char *name, str |
|
void |
void |
print_text(struct format *f, const char *word, int flags) |
print_text(struct format *f, const char *word, int flags) |
{ |
{ |
|
if (f->parastate == PARA_WANT) { |
|
if (f->linestate != LINE_NEW) { |
|
putchar('\n'); |
|
f->linestate = LINE_NEW; |
|
} |
|
puts(".Pp"); |
|
} |
switch (f->linestate) { |
switch (f->linestate) { |
case LINE_NEW: |
case LINE_NEW: |
break; |
break; |
Line 241 print_text(struct format *f, const char *word, int fla |
|
Line 267 print_text(struct format *f, const char *word, int fla |
|
putchar('e'); |
putchar('e'); |
} |
} |
f->linestate = LINE_TEXT; |
f->linestate = LINE_TEXT; |
|
f->parastate = PARA_MID; |
f->flags = 0; |
f->flags = 0; |
} |
} |
|
|