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;
999 n = mdoc->last;
1000 assert(n->child->type == ROFFT_TEXT);
1003 if ((p = mdoc_a2lib(n->child->string)) != NULL) {
1004 n->child->flags |= NODE_NOPRT;
1005 roff_word_alloc(mdoc, n->line, n->pos, p);
1007 mdoc->last = n;
1011 mandoc_msg(MANDOCERR_LB_BAD, n->child->line,
1012 n->child->pos, "Lb %s", n->child->string);
1014 roff_word_alloc(mdoc, n->line, n->pos, "library");
1016 roff_word_alloc(mdoc, n->line, n->pos, "\\(lq");
1019 roff_word_alloc(mdoc, n->line, n->pos, "\\(rq");
1021 mdoc->last = n;
1027 struct roff_node *n;
1032 n = mdoc->last;
1034 if (n->child != NULL) {
1035 roff_word_alloc(mdoc, n->line, n->pos, "The");
1038 roff_word_alloc(mdoc, n->line, n->pos,
1041 roff_word_alloc(mdoc, n->line, n->pos,
1044 roff_word_alloc(mdoc, n->line, n->pos, "Upon successful "
1048 roff_word_alloc(mdoc, n->line, n->pos, "otherwise "
1051 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Va);
1053 roff_word_alloc(mdoc, n->line, n->pos, "errno");
1057 roff_word_alloc(mdoc, n->line, n->pos,
1060 mdoc->last = n;
1066 struct roff_node *n;
1070 n = mdoc->last;
1071 if (n->args && n->args->argc == 1)
1072 if (n->args->argv[0].arg == MDOC_Std)
1075 mandoc_msg(MANDOCERR_ARG_STD, n->line, n->pos,
1076 "%s", roff_name[n->tok]);
1082 struct roff_node *n, *nch;
1085 n = mdoc->last;
1086 nch = n->child;
1092 roff_node_delete(mdoc, n);
1100 mdoc->last= n;
1106 struct roff_node *n; /* The .Tg node. */
1114 n = mdoc->last;
1115 for (nn = n; nn != NULL; nn = nn->parent) {
1124 nt = nch = n->child;
1131 mandoc_msg(MANDOCERR_MACRO_EMPTY, n->line, n->pos, "Tg");
1133 roff_node_delete(mdoc, n);
1151 roff_node_delete(mdoc, n);
1157 nn = n;
1164 nn = nn->head->child == NULL ? n : nn->head;
1185 nn = nn->body->child == NULL ? n : nn->body;
1195 nn = nn->body->child == NULL ? n : nn->body;
1212 nn = n;
1215 nn = n;
1219 if (nn != n)
1220 n->flags |= NODE_NOPRT;
1226 struct roff_node *n;
1228 n = mdoc->last;
1229 if (n->type == ROFFT_ELEM || n->type == ROFFT_BLOCK)
1230 mandoc_msg(MANDOCERR_MACRO_OBS, n->line, n->pos,
1231 "%s", roff_name[n->tok]);
1237 struct roff_node *n;
1239 n = mdoc->last;
1240 mandoc_msg(MANDOCERR_MACRO_USELESS, n->line, n->pos,
1241 "%s", roff_name[n->tok]);
1315 struct roff_node *n, *nch;
1319 n = mdoc->last;
1320 nch = n->child;
1329 if (n->sec == SEC_DESCRIPTION ||
1330 n->sec == SEC_CUSTOM)
1331 tag_put(NULL, fn_prio++, n);
1348 const struct roff_node *n;
1350 n = mdoc->last;
1352 if (n->type != ROFFT_HEAD)
1355 if (n->child == NULL) {
1356 mandoc_msg(MANDOCERR_FO_NOHEAD, n->line, n->pos, "Fo");
1359 if (n->child != n->last) {
1361 n->child->next->line, n->child->next->pos,
1362 "Fo ... %s", n->child->next->string);
1363 while (n->child != n->last)
1364 roff_node_delete(mdoc, n->last);
1374 const struct roff_node *n;
1377 for (n = mdoc->last->child; n != NULL; n = n->next) {
1378 for (cp = n->string; *cp != '\0'; cp++) {
1384 mandoc_msg(MANDOCERR_FA_COMMA, n->line,
1385 n->pos + (int)(cp - n->string), "%s", n->string);
1395 struct roff_node *n;
1397 n = mdoc->last;
1399 if (n->sec == SEC_NAME && n->child != NULL &&
1400 n->child->type == ROFFT_TEXT && mdoc->meta.msec != NULL)
1401 mandoc_xr_add(mdoc->meta.msec, n->child->string, -1, -1);
1403 if (n->last != NULL && n->last->tok == MDOC_Pp)
1404 roff_node_relink(mdoc, n->last);
1407 deroff(&mdoc->meta.name, n);
1410 (mdoc->lastsec == SEC_NAME && n->child == NULL))
1411 mandoc_msg(MANDOCERR_NM_NONAME, n->line, n->pos, "Nm");
1413 switch (n->type) {
1424 if ((n->child != NULL && n->child->type == ROFFT_TEXT) ||
1429 roff_word_alloc(mdoc, n->line, n->pos, mdoc->meta.name);
1431 mdoc->last = n;
1437 struct roff_node *n;
1439 n = mdoc->last;
1441 if (n->type != ROFFT_BODY)
1444 if (n->sec != SEC_NAME)
1445 mandoc_msg(MANDOCERR_ND_LATE, n->line, n->pos, "Nd");
1447 if (n->child == NULL)
1448 mandoc_msg(MANDOCERR_ND_EMPTY, n->line, n->pos, "Nd");
1458 struct roff_node *n, *np;
1460 n = mdoc->last;
1461 switch (n->type) {
1463 if (n->end != ENDBODY_NOT) {
1464 if (n->tok == MDOC_Bd &&
1465 n->body->parent->args == NULL)
1466 roff_node_delete(mdoc, n);
1467 } else if (n->child == NULL)
1468 mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos,
1469 "%s", roff_name[n->tok]);
1470 else if (n->tok == MDOC_D1)
1474 if (n->tok == MDOC_Bd) {
1475 if (n->args == NULL) {
1477 n->line, n->pos, "Bd");
1479 while (n->body->child != NULL)
1481 n->body->child);
1482 roff_node_delete(mdoc, n);
1488 for (np = n->parent; np != NULL; np = np->parent) {
1490 mandoc_msg(MANDOCERR_BD_NEST, n->line,
1491 n->pos, "%s in Bd", roff_name[n->tok]);
1504 struct roff_node *n;
1506 n = mdoc->last;
1507 if (n->child != NULL) {
1512 switch (n->tok) {
1514 roff_word_alloc(mdoc, n->line, n->pos, "file");
1516 roff_word_alloc(mdoc, n->line, n->pos, "...");
1520 roff_word_alloc(mdoc, n->line, n->pos, "~");
1526 mdoc->last = n;
1532 struct roff_node *n, *nch;
1535 n = mdoc->last;
1536 nch = n->child;
1554 roff_word_alloc(mdoc, n->line, n->pos, "AT&T UNIX");
1556 mdoc->last = n;
1597 struct roff_node *n;
1599 n = mdoc->last;
1600 if (n->sec == SEC_ERRORS &&
1601 (n->parent->tok == MDOC_It ||
1602 (n->parent->tok == MDOC_Bq &&
1603 n->parent->parent->parent->tok == MDOC_It)))
1604 tag_put(NULL, TAG_STRONG, n);
1611 struct roff_node *n;
1613 n = mdoc->last;
1614 if ((n->prev == NULL ||
1615 (n->prev->type == ROFFT_TEXT &&
1616 strcmp(n->prev->string, "|") == 0)) &&
1617 (n->parent->tok == MDOC_It ||
1618 (n->parent->tok == MDOC_Xo &&
1619 n->parent->parent->prev == NULL &&
1620 n->parent->parent->parent->tok == MDOC_It)))
1621 tag_put(NULL, TAG_STRONG, n);
1635 struct roff_node *n;
1643 n = mdoc->last;
1644 if (n->prev != NULL && n->prev->tok == MDOC_Fl &&
1645 n->prev->child == NULL && n->child != NULL &&
1646 (n->flags & NODE_LINE) == 0) {
1647 mandoc_asprintf(&cp, "\\-%s", n->child->string);
1648 free(n->child->string);
1649 n->child->string = cp;
1650 roff_node_delete(mdoc, n->prev);
1658 struct roff_node *n;
1664 n = mdoc->last;
1665 switch (n->tok) {
1677 if (n->child == NULL)
1679 v = n->child->string;
1684 n->child->flags |= NODE_NOPRT;
1686 roff_word_alloc(mdoc, n->child->line, n->child->pos, v);
1690 mdoc->last = n;
1702 roff_word_alloc(mdoc, n->line, n->pos, os);
1704 mdoc->last = n;
1787 struct roff_node *n, *ni, *nc;
1791 n = mdoc->last;
1792 for (ni = n->body->child; ni != NULL; ni = ni->next) {
1809 } else if (n->norm->Bl.comp == 0 &&
1810 n->norm->Bl.type != LIST_column) {
2078 struct roff_node *n;
2080 n = mdoc->last;
2082 if (n->type == ROFFT_BLOCK && n->body->child == NULL) {
2083 mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos, "Bk");
2084 roff_node_delete(mdoc, n);
2120 struct roff_node *n;
2146 n = mdoc->meta.first->child;
2147 while (n->tok != MDOC_Dt ||
2148 n->child == NULL ||
2149 n->child->next == NULL ||
2150 n->child->next->next == NULL)
2151 n = n->next;
2152 n = n->child->next->next;
2153 mandoc_msg(MANDOCERR_ARCH_BAD, n->line, n->pos,
2161 n = mdoc->meta.first->child;
2162 while (n != NULL &&
2163 (n->type == ROFFT_COMMENT ||
2164 (n->tok >= MDOC_Dd &&
2165 mdoc_macro(n->tok)->flags & MDOC_PROLOGUE)))
2166 n = n->next;
2168 if (n == NULL)
2170 else if (n->tok != MDOC_Sh)
2171 mandoc_msg(MANDOCERR_SEC_BEFORE, n->line, n->pos,
2172 "%s", roff_name[n->tok]);
2270 struct roff_node *n, *nch;
2273 n = mdoc->last;
2274 for (nch = n->child; nch != NULL; nch = nch->next) {
2284 if (n->tag == NULL && n->flags & NODE_ID)
2285 n->tag = mandoc_strdup(nch->string);
2294 struct roff_node *n;
2296 n = mdoc->last;
2297 if (n->flags & NODE_LINE ||
2298 (n->next != NULL && n->next->flags & NODE_DELIMC))
2299 mandoc_msg(MANDOCERR_NS_SKIP, n->line, n->pos, NULL);
2341 struct roff_node *n;
2346 for (n = mdoc->last->child; n != NULL; n = n->next) {
2347 switch (n->tok) {
2349 if (hasnm && n->child != NULL)
2351 n->line, n->pos,
2352 "Nm %s", n->child->string);
2357 if (n->next != NULL)
2359 n->line, n->pos, NULL);
2362 if (n->type == ROFFT_TEXT &&
2363 n->string[0] == ',' && n->string[1] == '\0' &&
2364 n->next != NULL && n->next->tok == MDOC_Nm) {
2365 n = n->next;
2371 n->line, n->pos, "%s", roff_name[n->tok]);
2388 const struct roff_node *n;
2393 n = mdoc->last->child;
2395 while (n != NULL) {
2396 if (n->tok != MDOC_Xr ||
2397 n->child == NULL ||
2398 n->child->next == NULL)
2403 name = n->child->string;
2404 sec = n->child->next->string;
2407 mandoc_msg(MANDOCERR_XR_PUNCT, n->line,
2408 n->pos, "%s before %s(%s)",
2412 mandoc_msg(MANDOCERR_XR_ORDER, n->line,
2413 n->pos, "%s(%s) after %s(%s)",
2417 mandoc_msg(MANDOCERR_XR_ORDER, n->line,
2418 n->pos, "%s after %s", name, lastname);
2425 n = n->next;
2426 if (n == NULL)
2428 if (n->tok == MDOC_Xr) {
2432 if (n->type != ROFFT_TEXT)
2434 for (name = n->string; *name != '\0'; name++)
2437 lastpunct = n->string;
2438 if (n->next == NULL || n->next->tok == MDOC_Rs)
2439 mandoc_msg(MANDOCERR_XR_PUNCT, n->line,
2440 n->pos, "%s after %s(%s)",
2442 n = n->next;
2447 child_an(const struct roff_node *n)
2450 for (n = n->child; n != NULL; n = n->next)
2451 if ((n->tok == MDOC_An && n->child != NULL) || child_an(n))
2626 struct roff_node *n, *nch;
2628 n = mdoc->last;
2629 nch = n->child;
2632 n->line, n->pos, "Xr %s", nch->string);
2634 assert(nch->next == n->last);
2647 struct roff_node *n, *nch;
2650 n = mdoc->last;
2651 switch (n->type) {
2657 deroff(&tag, n);
2662 if ((nch = n->child) != NULL &&
2665 tag_put(NULL, TAG_STRONG, n);
2667 tag_put(tag, TAG_FALLBACK, n);
2678 if ((nch = n->child) != NULL &&
2683 roff_name[n->tok]);
2686 if ((nch = n->last) != NULL &&
2690 roff_name[n->tok]);
2698 struct roff_node *n, *np;
2700 n = mdoc->last;
2701 if (n->type != ROFFT_ELEM && n->type != ROFFT_BLOCK)
2703 if ((np = roff_node_prev(n)) == NULL)
2713 if (n->tok == MDOC_Bl && n->norm->Bl.comp)
2715 if (n->tok == MDOC_Bd && n->norm->Bd.comp)
2717 if (n->tok == MDOC_It && n->parent->norm->Bl.comp)
2721 "%s before %s", roff_name[np->tok], roff_name[n->tok]);
2742 struct roff_node *n;
2744 n = mdoc->last;
2745 n->flags |= NODE_NOPRT;
2748 mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Dd");
2751 mandoc_msg(MANDOCERR_PROLOG_LATE, n->line, n->pos, "Dd");
2754 n->line, n->pos, "Dd after Dt");
2757 n->line, n->pos, "Dd after Os");
2759 if (mdoc->quick && n != NULL)
2762 mdoc->meta.date = mandoc_normdate(n->child, n);
2768 struct roff_node *nn, *n;
2772 n = mdoc->last;
2773 n->flags |= NODE_NOPRT;
2776 mandoc_msg(MANDOCERR_DT_LATE, n->line, n->pos, "Dt");
2781 mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Dt");
2784 n->line, n->pos, "Dt after Os");
2798 nn = n->child;
2800 mandoc_msg(MANDOCERR_DT_NOTITLE, n->line, n->pos, "Dt");
2822 mandoc_msg(MANDOCERR_MSEC_MISSING, n->line, n->pos,
2865 struct roff_node *n, *nch;
2870 n = mdoc->last;
2871 nch = n->child;
2880 n->line, n->pos, "%s", macro);
2884 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
2889 roff_word_alloc(mdoc, n->line, n->pos, "BSD");
2893 mdoc->last = n;
2897 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
2900 roff_word_alloc(mdoc, n->line, n->pos, "-");
2902 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
2904 mdoc->last = n;
2921 struct roff_node *n;
2923 n = mdoc->last;
2924 n->flags |= NODE_NOPRT;
2927 mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Os");
2929 mandoc_msg(MANDOCERR_PROLOG_LATE, n->line, n->pos, "Os");
2944 deroff(&mdoc->meta.os, n);
2958 mandoc_msg(MANDOCERR_OS_UNAME, n->line, n->pos, "Os");
2981 if (n->child != NULL)
2982 mandoc_msg(MANDOCERR_OS_ARG, n->child->line, n->child->pos,
2983 "Os %s (%s)", n->child->string,
2987 while (n->tok != MDOC_Dd)
2988 if ((n = n->prev) == NULL)
2990 if ((n = n->child) == NULL)
2992 if (strncmp(n->string, "$" "Mdocdate", 9)) {
2994 mandoc_msg(MANDOCERR_MDOCDATE_MISSING, n->line,
2995 n->pos, "Dd %s (OpenBSD)", n->string);
2998 mandoc_msg(MANDOCERR_MDOCDATE, n->line,
2999 n->pos, "Dd %s (NetBSD)", n->string);