Lines Matching defs:man

28 #include "man.h"
43 static int man_args(struct man *, int,
47 struct man *, enum mant);
98 man_unscope(struct man *man, const struct man_node *to)
103 n = man->last;
109 if (man->flags & (MAN_BLINE | MAN_ELINE) &&
112 man->parse, n->line, n->pos,
115 if (man->flags & MAN_ELINE)
116 man->flags &= ~MAN_ELINE;
120 man->flags &= ~MAN_BLINE;
122 man->last = n;
124 man_node_delete(man, man->last);
130 man->parse, n->line, n->pos,
135 * We might delete the man->last node
141 man->last = n;
143 man_valid_post(man);
153 man->next = (man->last == to) ?
200 * Next follow the implicit scope-smashings as defined by man.7:
246 rew_scope(enum man_type type, struct man *man, enum mant tok)
251 for (n = man->last; n; n = n->parent) {
269 man_unscope(man, n);
288 if ( ! man_args(man, line, pos, buf, &p))
290 for (nn = man->last->parent; nn; nn = nn->parent)
295 mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
301 mandoc_vmsg(MANDOCERR_RE_NOTOPEN, man->parse,
314 for (nn = man->last->parent; nn; nn = nn->parent)
319 mandoc_msg(MANDOCERR_BLK_NOTOPEN, man->parse,
321 rew_scope(MAN_BLOCK, man, MAN_PP);
323 line = man->last->line;
324 ppos = man->last->pos;
325 ntok = man->last->tok;
326 man_unscope(man, nn);
332 blk_imp(man, ntok, line, ppos, pos, buf);
344 rew_scope(MAN_BLOCK, man, tok);
345 man_block_alloc(man, line, ppos, tok);
346 man_head_alloc(man, line, ppos, tok);
347 head = man->last;
350 if (man_args(man, line, pos, buf, &p))
351 man_word_alloc(man, line, la, p);
355 man->parse, line, *pos, "%s ... %s",
358 man_unscope(man, head);
359 man_body_alloc(man, line, ppos, tok);
375 rew_scope(MAN_BODY, man, tok);
376 rew_scope(MAN_BLOCK, man, tok);
377 man_block_alloc(man, line, ppos, tok);
378 man_head_alloc(man, line, ppos, tok);
379 n = man->last;
385 if ( ! man_args(man, line, pos, buf, &p))
387 man_word_alloc(man, line, la, p);
395 man->flags |= MAN_BLINE;
397 } else if (n == man->last) {
398 man->flags |= MAN_BLINE;
402 rew_scope(MAN_HEAD, man, tok);
403 man_body_alloc(man, line, ppos, tok);
413 man_elem_alloc(man, line, ppos, tok);
414 n = man->last;
420 man->parse, line, *pos, "%s %s",
424 if (buf[*pos] != '\0' && man->last != n &&
427 man->parse, line, *pos, "%s ... %s",
432 if ( ! man_args(man, line, pos, buf, &p))
435 man->last->type == MAN_TEXT)
436 man_word_append(man, p);
438 man_word_alloc(man, line, la, p);
446 if (n != man->last &&
447 mandoc_eos(man->last->string, strlen(man->last->string)))
448 man->last->flags |= MAN_EOS;
456 if (n == man->last && man_macros[tok].flags & MAN_SCOPED) {
458 man->flags |= MAN_ELINE;
462 assert(man->last->type != MAN_ROOT);
463 man->next = MAN_NEXT_SIBLING;
471 for ( ; man->last; man->last = man->last->parent) {
472 if (man->last == n)
474 if (man->last->type == MAN_ROOT)
476 man_valid_post(man);
479 assert(man->last);
485 if (man->last->type != MAN_ROOT)
486 man_valid_post(man);
491 man_macroend(struct man *man)
494 man_unscope(man, man->first);
498 man_args(struct man *man, int line, int *pos, char *buf, char **v)
509 *v = mandoc_getarg(man->parse, v, line, pos);