Lines Matching defs:n

304 	struct roff_node *n, *np;
313 n = mdoc->last;
314 switch (n->tok) {
316 n->tok = MDOC_Pp;
320 n->tok = MDOC_Ft;
334 if (mdoc->last == n)
342 mdoc->last = n;
344 switch (n->type) {
346 np = n->parent;
347 if (n->sec != SEC_SYNOPSIS ||
349 check_text(mdoc, n->line, n->pos, n->string);
350 if ((n->flags & NODE_NOFILL) == 0 &&
353 check_text_em(mdoc, n->line, n->pos, n->string);
356 check_toptext(mdoc, n->line, n->pos, n->string);
374 if (n->child != NULL)
375 n->child->flags &= ~NODE_DELIMC;
376 if (n->last != NULL)
377 n->last->flags &= ~NODE_DELIMO;
381 if (n->tok < ROFF_MAX) {
386 assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
387 p = mdoc_valids + (n->tok - MDOC_Dd);
390 if (mdoc->last == n)
391 mdoc_state(mdoc, n);
397 check_args(struct roff_man *mdoc, struct roff_node *n)
401 if (NULL == n->args)
404 assert(n->args->argc);
405 for (i = 0; i < (int)n->args->argc; i++)
406 check_argv(mdoc, n, &n->args->argv[i]);
410 check_argv(struct roff_man *mdoc, struct roff_node *n, struct mdoc_argv *v)
640 struct roff_node *n;
646 n = mdoc->last->parent;
647 n->norm->Bl.type = LIST__NONE;
655 wa = (n->args == NULL) ? NULL : n->args->argv;
657 for (i = 0; n->args && i < (int)n->args->argc; i++) {
658 argv = n->args->argv + i;
697 if (n->norm->Bl.comp)
700 n->norm->Bl.comp = 1;
707 n->norm->Bl.width = "0n";
710 if (NULL != n->norm->Bl.width)
715 n->norm->Bl.width = argv->value[0];
723 if (NULL != n->norm->Bl.offs)
728 n->norm->Bl.offs = argv->value[0];
739 if (LIST__NONE != n->norm->Bl.type) {
740 mandoc_msg(MANDOCERR_BL_REP, n->line, n->pos,
747 if (n->norm->Bl.width ||
748 n->norm->Bl.offs ||
749 n->norm->Bl.comp)
751 n->line, n->pos, "Bl -%s",
752 mdoc_argnames[n->args->argv[0].arg]);
754 n->norm->Bl.type = lt;
756 n->norm->Bl.ncols = argv->sz;
757 n->norm->Bl.cols = (void *)argv->value;
763 if (LIST__NONE == n->norm->Bl.type) {
764 mandoc_msg(MANDOCERR_BL_NOTYPE, n->line, n->pos, "Bl");
765 n->norm->Bl.type = LIST_item;
776 switch (n->norm->Bl.type) {
778 if (n->norm->Bl.width == NULL)
780 n->line, n->pos, "Bl -tag");
787 if (n->norm->Bl.width != NULL)
790 n->norm->Bl.width = NULL;
795 if (n->norm->Bl.width == NULL)
796 n->norm->Bl.width = "2n";
799 if (n->norm->Bl.width == NULL)
800 n->norm->Bl.width = "3n";
810 struct roff_node *n;
815 n = mdoc->last;
816 for (i = 0; n->args && i < (int)n->args->argc; i++) {
817 argv = n->args->argv + i;
837 mandoc_msg(MANDOCERR_BD_FILE, n->line, n->pos, NULL);
845 if (NULL != n->norm->Bd.offs)
850 n->norm->Bd.offs = argv->value[0];
853 if (n->norm->Bd.comp)
856 n->norm->Bd.comp = 1;
864 if (DISP__NONE == n->norm->Bd.type)
865 n->norm->Bd.type = dt;
867 mandoc_msg(MANDOCERR_BD_REP, n->line, n->pos,
871 if (DISP__NONE == n->norm->Bd.type) {
872 mandoc_msg(MANDOCERR_BD_NOTYPE, n->line, n->pos, "Bd");
873 n->norm->Bd.type = DISP_ragged;
884 struct roff_node *n;
888 n = mdoc->last;
889 if (n->args == NULL)
892 for (i = 1; i < n->args->argc; i++) {
893 argv = n->args->argv + i;
898 argv = n->args->argv;
900 n->norm->An.auth = AUTH_split;
902 n->norm->An.auth = AUTH_nosplit;
910 struct roff_node *n;
913 n = mdoc->last;
914 if (n->child != NULL)
915 mandoc_msg(MANDOCERR_ARG_SKIP, n->line,
916 n->pos, "%s %s", roff_name[n->tok], n->child->string);
918 while (n->child != NULL)
919 roff_node_delete(mdoc, n->child);
921 roff_word_alloc(mdoc, n->line, n->pos, n->tok == MDOC_Bt ?
924 mdoc->last = n;
930 struct roff_node *n;
933 n = mdoc->last->next;
935 roff_elem_alloc(mdoc, n->line, n->pos, tok);
937 roff_node_relink(mdoc, n);
938 n = mdoc->last = mdoc->last->parent;
940 if (n->next == NULL)
942 if (ic > 1 || n->next->next != NULL) {
943 roff_word_alloc(mdoc, n->line, n->pos, ",");
946 n = mdoc->last->next;
947 if (n->next == NULL) {
948 roff_word_alloc(mdoc, n->line, n->pos, "and");
957 struct roff_node *n;
962 n = mdoc->last;
964 roff_word_alloc(mdoc, n->line, n->pos, "The");
970 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Nm);
972 roff_word_alloc(mdoc, n->line, n->pos, mdoc->meta.name);
978 mandoc_msg(MANDOCERR_EX_NONAME, n->line, n->pos, "Ex");
982 roff_word_alloc(mdoc, n->line, n->pos,
985 roff_word_alloc(mdoc, n->line, n->pos,
988 mdoc->last = n;
994 struct roff_node *n, *nch;
1000 n = mdoc->last;
1001 nch = n->child;
1005 if (n->sec == SEC_SYNOPSIS) {
1006 roff_word_alloc(mdoc, n->line, n->pos, "/*");
1009 roff_word_alloc(mdoc, n->line, n->pos, "-l");
1018 roff_word_alloc(mdoc, n->line, n->pos, "*/");
1020 mdoc->last = n;
1024 if ((ccp = mdoc_a2lib(n->child->string)) != NULL) {
1025 n->child->flags |= NODE_NOPRT;
1026 roff_word_alloc(mdoc, n->line, n->pos, ccp);
1028 mdoc->last = n;
1032 mandoc_msg(MANDOCERR_LB_BAD, n->child->line,
1033 n->child->pos, "Lb %s", n->child->string);
1035 roff_word_alloc(mdoc, n->line, n->pos, "library");
1037 roff_word_alloc(mdoc, n->line, n->pos, "\\(lq");
1040 roff_word_alloc(mdoc, n->line, n->pos, "\\(rq");
1042 mdoc->last = n;
1048 struct roff_node *n;
1053 n = mdoc->last;
1055 if (n->child != NULL) {
1056 roff_word_alloc(mdoc, n->line, n->pos, "The");
1059 roff_word_alloc(mdoc, n->line, n->pos,
1062 roff_word_alloc(mdoc, n->line, n->pos,
1065 roff_word_alloc(mdoc, n->line, n->pos, "Upon successful "
1069 roff_word_alloc(mdoc, n->line, n->pos, "otherwise "
1072 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Va);
1074 roff_word_alloc(mdoc, n->line, n->pos, "errno");
1078 roff_word_alloc(mdoc, n->line, n->pos,
1081 mdoc->last = n;
1087 struct roff_node *n;
1091 n = mdoc->last;
1092 if (n->args && n->args->argc == 1)
1093 if (n->args->argv[0].arg == MDOC_Std)
1096 mandoc_msg(MANDOCERR_ARG_STD, n->line, n->pos,
1097 "%s", roff_name[n->tok]);
1103 struct roff_node *n, *nch;
1106 n = mdoc->last;
1107 nch = n->child;
1113 roff_node_delete(mdoc, n);
1121 mdoc->last= n;
1127 struct roff_node *n; /* The .Tg node. */
1135 n = mdoc->last;
1136 for (nn = n; nn != NULL; nn = nn->parent) {
1145 nt = nch = n->child;
1152 mandoc_msg(MANDOCERR_MACRO_EMPTY, n->line, n->pos, "Tg");
1154 roff_node_delete(mdoc, n);
1172 roff_node_delete(mdoc, n);
1178 nn = n;
1185 nn = nn->head->child == NULL ? n : nn->head;
1206 nn = nn->body->child == NULL ? n : nn->body;
1216 nn = nn->body->child == NULL ? n : nn->body;
1233 nn = n;
1236 nn = n;
1240 if (nn != n)
1241 n->flags |= NODE_NOPRT;
1247 struct roff_node *n;
1249 n = mdoc->last;
1250 if (n->type == ROFFT_ELEM || n->type == ROFFT_BLOCK)
1251 mandoc_msg(MANDOCERR_MACRO_OBS, n->line, n->pos,
1252 "%s", roff_name[n->tok]);
1258 struct roff_node *n;
1260 n = mdoc->last;
1261 mandoc_msg(MANDOCERR_MACRO_USELESS, n->line, n->pos,
1262 "%s", roff_name[n->tok]);
1336 struct roff_node *n, *nch;
1340 n = mdoc->last;
1341 nch = n->child;
1350 if (n->sec == SEC_DESCRIPTION ||
1351 n->sec == SEC_CUSTOM)
1352 tag_put(NULL, fn_prio++, n);
1369 const struct roff_node *n;
1371 n = mdoc->last;
1373 if (n->type != ROFFT_HEAD)
1376 if (n->child == NULL) {
1377 mandoc_msg(MANDOCERR_FO_NOHEAD, n->line, n->pos, "Fo");
1380 if (n->child != n->last) {
1382 n->child->next->line, n->child->next->pos,
1383 "Fo ... %s", n->child->next->string);
1384 while (n->child != n->last)
1385 roff_node_delete(mdoc, n->last);
1395 const struct roff_node *n;
1398 for (n = mdoc->last->child; n != NULL; n = n->next) {
1399 for (cp = n->string; *cp != '\0'; cp++) {
1405 mandoc_msg(MANDOCERR_FA_COMMA, n->line,
1406 n->pos + (int)(cp - n->string), "%s", n->string);
1416 struct roff_node *n;
1418 n = mdoc->last;
1420 if (n->sec == SEC_NAME && n->child != NULL &&
1421 n->child->type == ROFFT_TEXT && mdoc->meta.msec != NULL)
1422 mandoc_xr_add(mdoc->meta.msec, n->child->string, -1, -1);
1424 if (n->last != NULL && n->last->tok == MDOC_Pp)
1425 roff_node_relink(mdoc, n->last);
1428 deroff(&mdoc->meta.name, n);
1431 (mdoc->lastsec == SEC_NAME && n->child == NULL))
1432 mandoc_msg(MANDOCERR_NM_NONAME, n->line, n->pos, "Nm");
1434 switch (n->type) {
1445 if ((n->child != NULL && n->child->type == ROFFT_TEXT) ||
1450 roff_word_alloc(mdoc, n->line, n->pos, mdoc->meta.name);
1452 mdoc->last = n;
1458 struct roff_node *n;
1460 n = mdoc->last;
1462 if (n->type != ROFFT_BODY)
1465 if (n->sec != SEC_NAME)
1466 mandoc_msg(MANDOCERR_ND_LATE, n->line, n->pos, "Nd");
1468 if (n->child == NULL)
1469 mandoc_msg(MANDOCERR_ND_EMPTY, n->line, n->pos, "Nd");
1479 struct roff_node *n, *np;
1481 n = mdoc->last;
1482 switch (n->type) {
1484 if (n->end != ENDBODY_NOT) {
1485 if (n->tok == MDOC_Bd &&
1486 n->body->parent->args == NULL)
1487 roff_node_delete(mdoc, n);
1488 } else if (n->child == NULL)
1489 mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos,
1490 "%s", roff_name[n->tok]);
1491 else if (n->tok == MDOC_D1)
1495 if (n->tok == MDOC_Bd) {
1496 if (n->args == NULL) {
1498 n->line, n->pos, "Bd");
1500 while (n->body->child != NULL)
1502 n->body->child);
1503 roff_node_delete(mdoc, n);
1509 for (np = n->parent; np != NULL; np = np->parent) {
1511 mandoc_msg(MANDOCERR_BD_NEST, n->line,
1512 n->pos, "%s in Bd", roff_name[n->tok]);
1525 struct roff_node *n;
1527 n = mdoc->last;
1528 if (n->child != NULL) {
1533 switch (n->tok) {
1535 roff_word_alloc(mdoc, n->line, n->pos, "file");
1537 roff_word_alloc(mdoc, n->line, n->pos, "...");
1541 roff_word_alloc(mdoc, n->line, n->pos, "~");
1547 mdoc->last = n;
1553 struct roff_node *n, *nch;
1556 n = mdoc->last;
1557 nch = n->child;
1575 roff_word_alloc(mdoc, n->line, n->pos, "AT&T UNIX");
1577 mdoc->last = n;
1618 struct roff_node *n;
1620 n = mdoc->last;
1621 if (n->sec == SEC_ERRORS &&
1622 (n->parent->tok == MDOC_It ||
1623 (n->parent->tok == MDOC_Bq &&
1624 n->parent->parent->parent->tok == MDOC_It)))
1625 tag_put(NULL, TAG_STRONG, n);
1632 struct roff_node *n;
1634 n = mdoc->last;
1635 if ((n->prev == NULL ||
1636 (n->prev->type == ROFFT_TEXT &&
1637 strcmp(n->prev->string, "|") == 0)) &&
1638 (n->parent->tok == MDOC_It ||
1639 (n->parent->tok == MDOC_Xo &&
1640 n->parent->parent->prev == NULL &&
1641 n->parent->parent->parent->tok == MDOC_It)))
1642 tag_put(NULL, TAG_STRONG, n);
1656 struct roff_node *n;
1664 n = mdoc->last;
1665 if (n->prev != NULL && n->prev->tok == MDOC_Fl &&
1666 n->prev->child == NULL && n->child != NULL &&
1667 (n->flags & NODE_LINE) == 0) {
1668 mandoc_asprintf(&cp, "\\-%s", n->child->string);
1669 free(n->child->string);
1670 n->child->string = cp;
1671 roff_node_delete(mdoc, n->prev);
1679 struct roff_node *n;
1685 n = mdoc->last;
1686 switch (n->tok) {
1698 if (n->child == NULL)
1700 v = n->child->string;
1705 n->child->flags |= NODE_NOPRT;
1707 roff_word_alloc(mdoc, n->child->line, n->child->pos, v);
1711 mdoc->last = n;
1723 roff_word_alloc(mdoc, n->line, n->pos, os);
1725 mdoc->last = n;
1808 struct roff_node *n, *ni, *nc;
1812 n = mdoc->last;
1813 for (ni = n->body->child; ni != NULL; ni = ni->next) {
1830 } else if (n->norm->Bl.comp == 0 &&
1831 n->norm->Bl.type != LIST_column) {
2099 struct roff_node *n;
2101 n = mdoc->last;
2103 if (n->type == ROFFT_BLOCK && n->body->child == NULL) {
2104 mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos, "Bk");
2105 roff_node_delete(mdoc, n);
2141 struct roff_node *n;
2167 n = mdoc->meta.first->child;
2168 while (n->tok != MDOC_Dt ||
2169 n->child == NULL ||
2170 n->child->next == NULL ||
2171 n->child->next->next == NULL)
2172 n = n->next;
2173 n = n->child->next->next;
2174 mandoc_msg(MANDOCERR_ARCH_BAD, n->line, n->pos,
2182 n = mdoc->meta.first->child;
2183 while (n != NULL &&
2184 (n->type == ROFFT_COMMENT ||
2185 (n->tok >= MDOC_Dd &&
2186 mdoc_macro(n->tok)->flags & MDOC_PROLOGUE)))
2187 n = n->next;
2189 if (n == NULL)
2191 else if (n->tok != MDOC_Sh)
2192 mandoc_msg(MANDOCERR_SEC_BEFORE, n->line, n->pos,
2193 "%s", roff_name[n->tok]);
2291 struct roff_node *n, *nch;
2294 n = mdoc->last;
2295 for (nch = n->child; nch != NULL; nch = nch->next) {
2305 if (n->tag == NULL && n->flags & NODE_ID)
2306 n->tag = mandoc_strdup(nch->string);
2315 struct roff_node *n;
2317 n = mdoc->last;
2318 if (n->flags & NODE_LINE ||
2319 (n->next != NULL && n->next->flags & NODE_DELIMC))
2320 mandoc_msg(MANDOCERR_NS_SKIP, n->line, n->pos, NULL);
2362 struct roff_node *n;
2367 for (n = mdoc->last->child; n != NULL; n = n->next) {
2368 switch (n->tok) {
2370 if (hasnm && n->child != NULL)
2372 n->line, n->pos,
2373 "Nm %s", n->child->string);
2378 if (n->next != NULL)
2380 n->line, n->pos, NULL);
2383 if (n->type == ROFFT_TEXT &&
2384 n->string[0] == ',' && n->string[1] == '\0' &&
2385 n->next != NULL && n->next->tok == MDOC_Nm) {
2386 n = n->next;
2392 n->line, n->pos, "%s", roff_name[n->tok]);
2409 const struct roff_node *n;
2414 n = mdoc->last->child;
2416 while (n != NULL) {
2417 if (n->tok != MDOC_Xr ||
2418 n->child == NULL ||
2419 n->child->next == NULL)
2424 name = n->child->string;
2425 sec = n->child->next->string;
2428 mandoc_msg(MANDOCERR_XR_PUNCT, n->line,
2429 n->pos, "%s before %s(%s)",
2433 mandoc_msg(MANDOCERR_XR_ORDER, n->line,
2434 n->pos, "%s(%s) after %s(%s)",
2438 mandoc_msg(MANDOCERR_XR_ORDER, n->line,
2439 n->pos, "%s after %s", name, lastname);
2446 n = n->next;
2447 if (n == NULL)
2449 if (n->tok == MDOC_Xr) {
2453 if (n->type != ROFFT_TEXT)
2455 for (name = n->string; *name != '\0'; name++)
2458 lastpunct = n->string;
2459 if (n->next == NULL || n->next->tok == MDOC_Rs)
2460 mandoc_msg(MANDOCERR_XR_PUNCT, n->line,
2461 n->pos, "%s after %s(%s)",
2463 n = n->next;
2468 child_an(const struct roff_node *n)
2471 for (n = n->child; n != NULL; n = n->next)
2472 if ((n->tok == MDOC_An && n->child != NULL) || child_an(n))
2647 struct roff_node *n, *nch;
2649 n = mdoc->last;
2650 nch = n->child;
2653 n->line, n->pos, "Xr %s", nch->string);
2655 assert(nch->next == n->last);
2668 struct roff_node *n, *nch;
2671 n = mdoc->last;
2672 switch (n->type) {
2678 deroff(&tag, n);
2683 if ((nch = n->child) != NULL &&
2686 tag_put(NULL, TAG_STRONG, n);
2688 tag_put(tag, TAG_FALLBACK, n);
2699 if ((nch = n->child) != NULL &&
2704 roff_name[n->tok]);
2707 if ((nch = n->last) != NULL &&
2711 roff_name[n->tok]);
2719 struct roff_node *n, *np;
2721 n = mdoc->last;
2722 if (n->type != ROFFT_ELEM && n->type != ROFFT_BLOCK)
2724 if ((np = roff_node_prev(n)) == NULL)
2734 if (n->tok == MDOC_Bl && n->norm->Bl.comp)
2736 if (n->tok == MDOC_Bd && n->norm->Bd.comp)
2738 if (n->tok == MDOC_It && n->parent->norm->Bl.comp)
2742 "%s before %s", roff_name[np->tok], roff_name[n->tok]);
2763 struct roff_node *n;
2765 n = mdoc->last;
2766 n->flags |= NODE_NOPRT;
2769 mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Dd");
2772 mandoc_msg(MANDOCERR_PROLOG_LATE, n->line, n->pos, "Dd");
2775 n->line, n->pos, "Dd after Dt");
2778 n->line, n->pos, "Dd after Os");
2783 mdoc->meta.date = mandoc_normdate(n->child, n);
2789 struct roff_node *nn, *n;
2793 n = mdoc->last;
2794 n->flags |= NODE_NOPRT;
2797 mandoc_msg(MANDOCERR_DT_LATE, n->line, n->pos, "Dt");
2802 mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Dt");
2805 n->line, n->pos, "Dt after Os");
2819 nn = n->child;
2821 mandoc_msg(MANDOCERR_DT_NOTITLE, n->line, n->pos, "Dt");
2843 mandoc_msg(MANDOCERR_MSEC_MISSING, n->line, n->pos,
2884 struct roff_node *n, *nch;
2889 n = mdoc->last;
2890 nch = n->child;
2899 n->line, n->pos, "%s", macro);
2903 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
2908 roff_word_alloc(mdoc, n->line, n->pos, "BSD");
2912 mdoc->last = n;
2916 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
2919 roff_word_alloc(mdoc, n->line, n->pos, "-");
2921 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
2923 mdoc->last = n;
2940 struct roff_node *n;
2942 n = mdoc->last;
2943 n->flags |= NODE_NOPRT;
2946 mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Os");
2948 mandoc_msg(MANDOCERR_PROLOG_LATE, n->line, n->pos, "Os");
2963 deroff(&mdoc->meta.os, n);
2977 mandoc_msg(MANDOCERR_OS_UNAME, n->line, n->pos, "Os");
3000 if (n->child != NULL)
3001 mandoc_msg(MANDOCERR_OS_ARG, n->child->line, n->child->pos,
3002 "Os %s (%s)", n->child->string,
3006 while (n->tok != MDOC_Dd)
3007 if ((n = n->prev) == NULL)
3009 if ((n = n->child) == NULL)
3011 if (strncmp(n->string, "$" "Mdocdate", 9)) {
3013 mandoc_msg(MANDOCERR_MDOCDATE_MISSING, n->line,
3014 n->pos, "Dd %s (OpenBSD)", n->string);
3017 mandoc_msg(MANDOCERR_MDOCDATE, n->line,
3018 n->pos, "Dd %s (NetBSD)", n->string);