Lines Matching defs:n

42 #define	PRE_ARGS  struct mdoc *mdoc, struct mdoc_node *n
295 mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n)
299 switch (n->type) {
301 if (n->sec != SEC_SYNOPSIS || n->parent->tok != MDOC_Fd)
302 check_text(mdoc, n->line, n->pos, n->string);
314 check_args(mdoc, n);
315 p = mdoc_valids[n->tok].pre;
317 (*p)(mdoc, n);
323 struct mdoc_node *n;
326 n = mdoc->last;
327 if (n->flags & MDOC_VALID)
329 n->flags |= MDOC_VALID | MDOC_ENDED;
331 switch (n->type) {
349 if (n->child != NULL)
350 n->child->flags &= ~MDOC_DELIMC;
351 if (n->last != NULL)
352 n->last->flags &= ~MDOC_DELIMO;
356 p = mdoc_valids[n->tok].post;
364 check_args(struct mdoc *mdoc, struct mdoc_node *n)
368 if (NULL == n->args)
371 assert(n->args->argc);
372 for (i = 0; i < (int)n->args->argc; i++)
373 check_argv(mdoc, n, &n->args->argv[i]);
377 check_argv(struct mdoc *mdoc, struct mdoc_node *n, struct mdoc_argv *v)
403 if (MDOC_BLOCK != n->type)
413 mdoc->parse, n->line, n->pos,
414 "%s in Bd", mdoc_macronames[n->tok]);
425 if (n->type != MDOC_BLOCK)
434 wa = (n->args == NULL) ? NULL : n->args->argv;
436 for (i = 0; n->args && i < (int)n->args->argc; i++) {
437 argv = n->args->argv + i;
476 if (n->norm->Bl.comp)
480 n->norm->Bl.comp = 1;
488 n->norm->Bl.width = "0n";
491 if (NULL != n->norm->Bl.width)
497 n->norm->Bl.width = argv->value[0];
506 if (NULL != n->norm->Bl.offs)
512 n->norm->Bl.offs = argv->value[0];
523 if (LIST__NONE != n->norm->Bl.type) {
525 mdoc->parse, n->line, n->pos,
532 if (n->norm->Bl.width ||
533 n->norm->Bl.offs ||
534 n->norm->Bl.comp)
536 mdoc->parse, n->line, n->pos, "Bl -%s",
537 mdoc_argnames[n->args->argv[0].arg]);
539 n->norm->Bl.type = lt;
541 n->norm->Bl.ncols = argv->sz;
542 n->norm->Bl.cols = (void *)argv->value;
548 if (LIST__NONE == n->norm->Bl.type) {
550 n->line, n->pos, "Bl");
551 n->norm->Bl.type = LIST_item;
561 switch (n->norm->Bl.type) {
563 if (NULL == n->norm->Bl.width)
565 n->line, n->pos, "Bl -tag");
576 if (n->norm->Bl.width)
586 if (NULL == n->norm->Bl.width)
587 n->norm->Bl.width = "2n";
590 if (NULL == n->norm->Bl.width)
591 n->norm->Bl.width = "3n";
596 pre_par(mdoc, n);
606 pre_literal(mdoc, n);
608 if (n->type != MDOC_BLOCK)
611 for (i = 0; n->args && i < (int)n->args->argc; i++) {
612 argv = n->args->argv + i;
633 n->line, n->pos, NULL);
642 if (NULL != n->norm->Bd.offs)
648 n->norm->Bd.offs = argv->value[0];
651 if (n->norm->Bd.comp)
655 n->norm->Bd.comp = 1;
664 if (DISP__NONE == n->norm->Bd.type)
665 n->norm->Bd.type = dt;
668 mdoc->parse, n->line, n->pos,
672 if (DISP__NONE == n->norm->Bd.type) {
674 n->line, n->pos, "Bd");
675 n->norm->Bd.type = DISP_ragged;
677 pre_par(mdoc, n);
686 if (n->args == NULL)
689 for (i = 1; i < n->args->argc; i++) {
690 argv = n->args->argv + i;
696 argv = n->args->argv;
698 n->norm->An.auth = AUTH_split;
700 n->norm->An.auth = AUTH_nosplit;
709 if (n->args && 1 == n->args->argc)
710 if (MDOC_Std == n->args->argv[0].arg)
714 n->line, n->pos, mdoc_macronames[n->tok]);
721 if (MDOC_ELEM == n->type || MDOC_BLOCK == n->type)
723 n->line, n->pos, mdoc_macronames[n->tok]);
732 n->line, n->pos, "Dt");
735 n->line, n->pos, "Dt after Os");
744 n->line, n->pos, "Os");
747 n->line, n->pos, "Os");
756 n->line, n->pos, "Dd");
759 n->line, n->pos, "Dd");
762 n->line, n->pos, "Dd after Dt");
765 n->line, n->pos, "Dd after Os");
833 struct mdoc_node *n;
837 n = mdoc->last->child;
838 assert(MDOC_TEXT == n->type);
840 if (NULL == (stdlibname = mdoc_a2lib(n->string)))
842 "library \\(Lq%s\\(Rq", n->string);
846 free(n->string);
847 n->string = libname;
853 const struct mdoc_node *n;
855 n = mdoc->last;
856 if (n->child)
858 mdoc->parse, n->line, n->pos,
859 "%s %s", mdoc_macronames[n->tok],
860 n->child->string);
866 const struct mdoc_node *n;
870 n = mdoc->last->child;
871 pos = strcspn(n->string, "()");
872 cp = n->string + pos;
875 n->line, n->pos + pos, n->string);
889 const struct mdoc_node *n;
891 n = mdoc->last;
893 if (n->type != MDOC_HEAD)
896 if (n->child == NULL) {
898 n->line, n->pos, "Fo");
901 if (n->child != n->last) {
903 n->child->next->line, n->child->next->pos,
904 "Fo ... %s", n->child->next->string);
905 while (n->child != n->last)
906 mdoc_node_delete(mdoc, n->last);
915 const struct mdoc_node *n;
918 for (n = mdoc->last->child; n != NULL; n = n->next) {
919 for (cp = n->string; *cp != '\0'; cp++) {
926 n->line, n->pos + (cp - n->string),
927 n->string);
936 const struct mdoc_node *n;
949 for (n = mdoc->last->child; n; n = n->next)
950 if (MDOC_TEXT != n->type)
952 n->line, n->pos, mdoc_macronames[n->tok]);
958 struct mdoc_node *n;
960 n = mdoc->last;
962 if (n->last != NULL &&
963 (n->last->tok == MDOC_Pp ||
964 n->last->tok == MDOC_Lp))
965 mdoc_node_relink(mdoc, n->last);
970 mdoc_deroff(&mdoc->meta.name, n);
974 n->line, n->pos, "Nm");
980 struct mdoc_node *n;
982 n = mdoc->last;
984 if (n->type != MDOC_BODY)
987 if (n->child == NULL)
989 n->line, n->pos, "Nd");
997 struct mdoc_node *n;
999 n = mdoc->last;
1001 if (n->type != MDOC_BODY)
1004 if (n->child == NULL)
1006 n->line, n->pos, "D1");
1014 struct mdoc_node *n;
1016 n = mdoc->last;
1018 if (n->type != MDOC_BODY)
1021 if (n->child == NULL)
1023 n->line, n->pos, mdoc_macronames[n->tok]);
1025 if (n->tok == MDOC_Bd &&
1026 n->norm->Bd.type != DISP_literal &&
1027 n->norm->Bd.type != DISP_unfilled)
1070 struct mdoc_node *n;
1074 n = mdoc->last;
1075 if (n->child == NULL) {
1077 mdoc_word_alloc(mdoc, n->line, n->pos, "AT&T UNIX");
1078 mdoc->last = n;
1088 n = n->child;
1089 assert(MDOC_TEXT == n->type);
1090 if (NULL == (std_att = mdoc_a2att(n->string))) {
1092 n->line, n->pos, "At %s", n->string);
1093 mandoc_asprintf(&att, "AT&T UNIX %s", n->string);
1097 free(n->string);
1098 n->string = att;
1203 struct mdoc_node *n, *ni, *nc;
1213 n = mdoc->last;
1215 if (LIST_tag == n->norm->Bl.type &&
1216 NULL == n->norm->Bl.width) {
1218 assert(n->norm->Bl.width);
1221 for (ni = n->body->child; ni; ni = ni->next) {
1242 } else if (0 == n->norm->Bl.comp &&
1243 LIST_column != n->norm->Bl.type) {
1282 struct mdoc_node *n, *nn;
1295 n = mdoc->last;
1297 for (nn = n->body->child; nn; nn = nn->next) {
1327 assert(n->args);
1328 i = (int)(n->args->argc)++;
1330 n->args->argv = mandoc_reallocarray(n->args->argv,
1331 n->args->argc, sizeof(struct mdoc_argv));
1333 n->args->argv[i].arg = MDOC_Width;
1334 n->args->argv[i].line = n->line;
1335 n->args->argv[i].pos = n->pos;
1336 n->args->argv[i].sz = 1;
1337 n->args->argv[i].value = mandoc_malloc(sizeof(char *));
1338 n->args->argv[i].value[0] = mandoc_strdup(buf);
1341 n->norm->Bl.width = n->args->argv[i].value[0];
1492 struct mdoc_node *n;
1494 n = mdoc->last;
1496 if (n->type == MDOC_BLOCK && n->body->child == NULL) {
1498 mdoc->parse, n->line, n->pos, "Bk");
1499 mdoc_node_delete(mdoc, n);
1536 struct mdoc_node *n;
1562 n = mdoc->first->child;
1563 while (n != NULL && mdoc_macros[n->tok].flags & MDOC_PROLOGUE)
1564 n = n->next;
1566 if (n == NULL)
1568 else if (n->tok != MDOC_Sh)
1570 n->line, n->pos, mdoc_macronames[n->tok]);
1576 struct mdoc_node *n, *nch;
1579 n = mdoc->last;
1580 nch = n->child;
1587 mdoc_node_delete(mdoc, n);
1750 struct mdoc_node *n;
1755 for (n = mdoc->last->child; n != NULL; n = n->next) {
1756 switch (n->tok) {
1762 if (n->next != NULL)
1764 mdoc->parse, n->line, n->pos, NULL);
1772 n->line, n->pos, mdoc_macronames[n->tok]);
1788 const struct mdoc_node *n;
1793 n = mdoc->last->child;
1795 while (n != NULL) {
1796 if (n->tok != MDOC_Xr || n->nchild < 2)
1801 name = n->child->string;
1802 sec = n->child->next->string;
1806 mdoc->parse, n->line, n->pos,
1812 mdoc->parse, n->line, n->pos,
1818 mdoc->parse, n->line, n->pos,
1826 n = n->next;
1827 if (n == NULL)
1829 if (n->tok == MDOC_Xr) {
1833 if (n->type != MDOC_TEXT)
1835 for (name = n->string; *name != '\0'; name++)
1838 lastpunct = n->string;
1839 if (n->next == NULL)
1841 n->line, n->pos, "%s after %s(%s)",
1843 n = n->next;
1848 child_an(const struct mdoc_node *n)
1851 for (n = n->child; n != NULL; n = n->next)
1852 if ((n->tok == MDOC_An && n->nchild) || child_an(n))
1869 struct mdoc_node *n;
1918 for (n = mdoc->last->child; n; n = n->next)
1919 n->sec = sec;
2026 if (MDOC_ELEM != n->type && MDOC_BLOCK != n->type)
2038 if (MDOC_Bl == n->tok && n->norm->Bl.comp)
2040 if (MDOC_Bd == n->tok && n->norm->Bd.comp)
2042 if (MDOC_It == n->tok && n->parent->norm->Bl.comp)
2048 mdoc_macronames[n->tok]);
2089 pre_display(mdoc, n);
2091 if (MDOC_BODY != n->type)
2099 switch (n->tok) {
2104 if (DISP_literal == n->norm->Bd.type)
2106 if (DISP_unfilled == n->norm->Bd.type)
2118 struct mdoc_node *n;
2124 n = mdoc->last;
2125 if (NULL == n->child || '\0' == n->child->string[0]) {
2127 mandoc_normdate(mdoc->parse, NULL, n->line, n->pos);
2132 mdoc_deroff(&datestr, n);
2137 datestr, n->line, n->pos);
2141 mdoc_node_delete(mdoc, n);
2147 struct mdoc_node *nn, *n;
2151 n = mdoc->last;
2165 nn = n->child;
2168 mdoc->parse, n->line, n->pos, "Dt");
2192 mdoc->parse, n->line, n->pos,
2226 mdoc_node_delete(mdoc, n);
2232 struct mdoc_node *n;
2240 n = mdoc->last->child;
2241 if (n && NULL != (n = n->next))
2242 *n->string = (char)toupper((unsigned char)*n->string);
2252 struct mdoc_node *n;
2254 n = mdoc->last;
2267 mdoc_deroff(&mdoc->meta.os, n);
2282 n->line, n->pos, "Os");
2292 mdoc_node_delete(mdoc, n);
2302 struct mdoc_node *n;
2304 n = mdoc->last;
2306 if (n->child)
2311 n->line, n->pos, "Ex");
2316 mdoc_word_alloc(mdoc, n->line, n->pos, mdoc->meta.name);
2317 mdoc->last = n;