Lines Matching defs:n

302 	struct roff_node *n, *np;
311 n = mdoc->last;
312 switch (n->tok) {
314 n->tok = MDOC_Pp;
318 n->tok = MDOC_Ft;
332 if (mdoc->last == n)
340 mdoc->last = n;
342 switch (n->type) {
344 np = n->parent;
345 if (n->sec != SEC_SYNOPSIS ||
347 check_text(mdoc, n->line, n->pos, n->string);
348 if ((n->flags & NODE_NOFILL) == 0 &&
351 check_text_em(mdoc, n->line, n->pos, n->string);
354 check_toptext(mdoc, n->line, n->pos, n->string);
372 if (n->child != NULL)
373 n->child->flags &= ~NODE_DELIMC;
374 if (n->last != NULL)
375 n->last->flags &= ~NODE_DELIMO;
379 if (n->tok < ROFF_MAX) {
384 assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
385 p = mdoc_valids + (n->tok - MDOC_Dd);
388 if (mdoc->last == n)
389 mdoc_state(mdoc, n);
395 check_args(struct roff_man *mdoc, struct roff_node *n)
399 if (NULL == n->args)
402 assert(n->args->argc);
403 for (i = 0; i < (int)n->args->argc; i++)
404 check_argv(mdoc, n, &n->args->argv[i]);
408 check_argv(struct roff_man *mdoc, struct roff_node *n, struct mdoc_argv *v)
638 struct roff_node *n;
644 n = mdoc->last->parent;
645 n->norm->Bl.type = LIST__NONE;
653 wa = (n->args == NULL) ? NULL : n->args->argv;
655 for (i = 0; n->args && i < (int)n->args->argc; i++) {
656 argv = n->args->argv + i;
695 if (n->norm->Bl.comp)
698 n->norm->Bl.comp = 1;
705 n->norm->Bl.width = "0n";
708 if (NULL != n->norm->Bl.width)
713 n->norm->Bl.width = argv->value[0];
721 if (NULL != n->norm->Bl.offs)
726 n->norm->Bl.offs = argv->value[0];
737 if (LIST__NONE != n->norm->Bl.type) {
738 mandoc_msg(MANDOCERR_BL_REP, n->line, n->pos,
745 if (n->norm->Bl.width ||
746 n->norm->Bl.offs ||
747 n->norm->Bl.comp)
749 n->line, n->pos, "Bl -%s",
750 mdoc_argnames[n->args->argv[0].arg]);
752 n->norm->Bl.type = lt;
754 n->norm->Bl.ncols = argv->sz;
755 n->norm->Bl.cols = (void *)argv->value;
761 if (LIST__NONE == n->norm->Bl.type) {
762 mandoc_msg(MANDOCERR_BL_NOTYPE, n->line, n->pos, "Bl");
763 n->norm->Bl.type = LIST_item;
774 switch (n->norm->Bl.type) {
776 if (n->norm->Bl.width == NULL)
778 n->line, n->pos, "Bl -tag");
785 if (n->norm->Bl.width != NULL)
788 n->norm->Bl.width = NULL;
793 if (n->norm->Bl.width == NULL)
794 n->norm->Bl.width = "2n";
797 if (n->norm->Bl.width == NULL)
798 n->norm->Bl.width = "3n";
808 struct roff_node *n;
813 n = mdoc->last;
814 for (i = 0; n->args && i < (int)n->args->argc; i++) {
815 argv = n->args->argv + i;
835 mandoc_msg(MANDOCERR_BD_FILE, n->line, n->pos, NULL);
843 if (NULL != n->norm->Bd.offs)
848 n->norm->Bd.offs = argv->value[0];
851 if (n->norm->Bd.comp)
854 n->norm->Bd.comp = 1;
862 if (DISP__NONE == n->norm->Bd.type)
863 n->norm->Bd.type = dt;
865 mandoc_msg(MANDOCERR_BD_REP, n->line, n->pos,
869 if (DISP__NONE == n->norm->Bd.type) {
870 mandoc_msg(MANDOCERR_BD_NOTYPE, n->line, n->pos, "Bd");
871 n->norm->Bd.type = DISP_ragged;
882 struct roff_node *n;
886 n = mdoc->last;
887 if (n->args == NULL)
890 for (i = 1; i < n->args->argc; i++) {
891 argv = n->args->argv + i;
896 argv = n->args->argv;
898 n->norm->An.auth = AUTH_split;
900 n->norm->An.auth = AUTH_nosplit;
908 struct roff_node *n;
911 n = mdoc->last;
912 if (n->child != NULL)
913 mandoc_msg(MANDOCERR_ARG_SKIP, n->line,
914 n->pos, "%s %s", roff_name[n->tok], n->child->string);
916 while (n->child != NULL)
917 roff_node_delete(mdoc, n->child);
919 roff_word_alloc(mdoc, n->line, n->pos, n->tok == MDOC_Bt ?
922 mdoc->last = n;
928 struct roff_node *n;
931 n = mdoc->last->next;
933 roff_elem_alloc(mdoc, n->line, n->pos, tok);
935 roff_node_relink(mdoc, n);
936 n = mdoc->last = mdoc->last->parent;
938 if (n->next == NULL)
940 if (ic > 1 || n->next->next != NULL) {
941 roff_word_alloc(mdoc, n->line, n->pos, ",");
944 n = mdoc->last->next;
945 if (n->next == NULL) {
946 roff_word_alloc(mdoc, n->line, n->pos, "and");
955 struct roff_node *n;
960 n = mdoc->last;
962 roff_word_alloc(mdoc, n->line, n->pos, "The");
968 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Nm);
970 roff_word_alloc(mdoc, n->line, n->pos, mdoc->meta.name);
976 mandoc_msg(MANDOCERR_EX_NONAME, n->line, n->pos, "Ex");
980 roff_word_alloc(mdoc, n->line, n->pos,
983 roff_word_alloc(mdoc, n->line, n->pos,
986 mdoc->last = n;
992 struct roff_node *n;
996 n = mdoc->last;
997 assert(n->child->type == ROFFT_TEXT);
999 roff_word_alloc(mdoc, n->line, n->pos, "library");
1001 roff_word_alloc(mdoc, n->line, n->pos, "\\(lq");
1004 roff_word_alloc(mdoc, n->line, n->pos, "\\(rq");
1006 mdoc->last = n;
1012 struct roff_node *n;
1017 n = mdoc->last;
1019 if (n->child != NULL) {
1020 roff_word_alloc(mdoc, n->line, n->pos, "The");
1023 roff_word_alloc(mdoc, n->line, n->pos,
1026 roff_word_alloc(mdoc, n->line, n->pos,
1029 roff_word_alloc(mdoc, n->line, n->pos, "Upon successful "
1033 roff_word_alloc(mdoc, n->line, n->pos, "otherwise "
1036 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Va);
1038 roff_word_alloc(mdoc, n->line, n->pos, "errno");
1042 roff_word_alloc(mdoc, n->line, n->pos,
1045 mdoc->last = n;
1051 struct roff_node *n;
1055 n = mdoc->last;
1056 if (n->args && n->args->argc == 1)
1057 if (n->args->argv[0].arg == MDOC_Std)
1060 mandoc_msg(MANDOCERR_ARG_STD, n->line, n->pos,
1061 "%s", roff_name[n->tok]);
1067 struct roff_node *n, *nch;
1070 n = mdoc->last;
1071 nch = n->child;
1077 roff_node_delete(mdoc, n);
1085 mdoc->last= n;
1091 struct roff_node *n; /* The .Tg node. */
1099 n = mdoc->last;
1100 for (nn = n; nn != NULL; nn = nn->parent) {
1109 nt = nch = n->child;
1116 mandoc_msg(MANDOCERR_MACRO_EMPTY, n->line, n->pos, "Tg");
1118 roff_node_delete(mdoc, n);
1136 roff_node_delete(mdoc, n);
1142 nn = n;
1149 nn = nn->head->child == NULL ? n : nn->head;
1170 nn = nn->body->child == NULL ? n : nn->body;
1180 nn = nn->body->child == NULL ? n : nn->body;
1197 nn = n;
1200 nn = n;
1204 if (nn != n)
1205 n->flags |= NODE_NOPRT;
1211 struct roff_node *n;
1213 n = mdoc->last;
1214 if (n->type == ROFFT_ELEM || n->type == ROFFT_BLOCK)
1215 mandoc_msg(MANDOCERR_MACRO_OBS, n->line, n->pos,
1216 "%s", roff_name[n->tok]);
1222 struct roff_node *n;
1224 n = mdoc->last;
1225 mandoc_msg(MANDOCERR_MACRO_USELESS, n->line, n->pos,
1226 "%s", roff_name[n->tok]);
1300 struct roff_node *n, *nch;
1304 n = mdoc->last;
1305 nch = n->child;
1314 if (n->sec == SEC_DESCRIPTION ||
1315 n->sec == SEC_CUSTOM)
1316 tag_put(NULL, fn_prio++, n);
1333 const struct roff_node *n;
1335 n = mdoc->last;
1337 if (n->type != ROFFT_HEAD)
1340 if (n->child == NULL) {
1341 mandoc_msg(MANDOCERR_FO_NOHEAD, n->line, n->pos, "Fo");
1344 if (n->child != n->last) {
1346 n->child->next->line, n->child->next->pos,
1347 "Fo ... %s", n->child->next->string);
1348 while (n->child != n->last)
1349 roff_node_delete(mdoc, n->last);
1359 const struct roff_node *n;
1362 for (n = mdoc->last->child; n != NULL; n = n->next) {
1363 for (cp = n->string; *cp != '\0'; cp++) {
1369 mandoc_msg(MANDOCERR_FA_COMMA, n->line,
1370 n->pos + (int)(cp - n->string), "%s", n->string);
1380 struct roff_node *n;
1382 n = mdoc->last;
1384 if (n->sec == SEC_NAME && n->child != NULL &&
1385 n->child->type == ROFFT_TEXT && mdoc->meta.msec != NULL)
1386 mandoc_xr_add(mdoc->meta.msec, n->child->string, -1, -1);
1388 if (n->last != NULL && n->last->tok == MDOC_Pp)
1389 roff_node_relink(mdoc, n->last);
1392 deroff(&mdoc->meta.name, n);
1395 (mdoc->lastsec == SEC_NAME && n->child == NULL))
1396 mandoc_msg(MANDOCERR_NM_NONAME, n->line, n->pos, "Nm");
1398 switch (n->type) {
1409 if ((n->child != NULL && n->child->type == ROFFT_TEXT) ||
1414 roff_word_alloc(mdoc, n->line, n->pos, mdoc->meta.name);
1416 mdoc->last = n;
1422 struct roff_node *n;
1424 n = mdoc->last;
1426 if (n->type != ROFFT_BODY)
1429 if (n->sec != SEC_NAME)
1430 mandoc_msg(MANDOCERR_ND_LATE, n->line, n->pos, "Nd");
1432 if (n->child == NULL)
1433 mandoc_msg(MANDOCERR_ND_EMPTY, n->line, n->pos, "Nd");
1443 struct roff_node *n, *np;
1445 n = mdoc->last;
1446 switch (n->type) {
1448 if (n->end != ENDBODY_NOT) {
1449 if (n->tok == MDOC_Bd &&
1450 n->body->parent->args == NULL)
1451 roff_node_delete(mdoc, n);
1452 } else if (n->child == NULL)
1453 mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos,
1454 "%s", roff_name[n->tok]);
1455 else if (n->tok == MDOC_D1)
1459 if (n->tok == MDOC_Bd) {
1460 if (n->args == NULL) {
1462 n->line, n->pos, "Bd");
1464 while (n->body->child != NULL)
1466 n->body->child);
1467 roff_node_delete(mdoc, n);
1473 for (np = n->parent; np != NULL; np = np->parent) {
1475 mandoc_msg(MANDOCERR_BD_NEST, n->line,
1476 n->pos, "%s in Bd", roff_name[n->tok]);
1489 struct roff_node *n;
1491 n = mdoc->last;
1492 if (n->child != NULL) {
1497 switch (n->tok) {
1499 roff_word_alloc(mdoc, n->line, n->pos, "file");
1501 roff_word_alloc(mdoc, n->line, n->pos, "...");
1505 roff_word_alloc(mdoc, n->line, n->pos, "~");
1511 mdoc->last = n;
1517 struct roff_node *n, *nch;
1520 n = mdoc->last;
1521 nch = n->child;
1539 roff_word_alloc(mdoc, n->line, n->pos, "AT&T UNIX");
1541 mdoc->last = n;
1582 struct roff_node *n;
1584 n = mdoc->last;
1585 if (n->sec == SEC_ERRORS &&
1586 (n->parent->tok == MDOC_It ||
1587 (n->parent->tok == MDOC_Bq &&
1588 n->parent->parent->parent->tok == MDOC_It)))
1589 tag_put(NULL, TAG_STRONG, n);
1596 struct roff_node *n;
1598 n = mdoc->last;
1599 if ((n->prev == NULL ||
1600 (n->prev->type == ROFFT_TEXT &&
1601 strcmp(n->prev->string, "|") == 0)) &&
1602 (n->parent->tok == MDOC_It ||
1603 (n->parent->tok == MDOC_Xo &&
1604 n->parent->parent->prev == NULL &&
1605 n->parent->parent->parent->tok == MDOC_It)))
1606 tag_put(NULL, TAG_STRONG, n);
1620 struct roff_node *n;
1628 n = mdoc->last;
1629 if (n->prev != NULL && n->prev->tok == MDOC_Fl &&
1630 n->prev->child == NULL && n->child != NULL &&
1631 (n->flags & NODE_LINE) == 0) {
1632 mandoc_asprintf(&cp, "\\-%s", n->child->string);
1633 free(n->child->string);
1634 n->child->string = cp;
1635 roff_node_delete(mdoc, n->prev);
1643 struct roff_node *n;
1649 n = mdoc->last;
1650 switch (n->tok) {
1662 if (n->child == NULL)
1664 v = n->child->string;
1669 n->child->flags |= NODE_NOPRT;
1671 roff_word_alloc(mdoc, n->child->line, n->child->pos, v);
1675 mdoc->last = n;
1687 roff_word_alloc(mdoc, n->line, n->pos, os);
1689 mdoc->last = n;
1772 struct roff_node *n, *ni, *nc;
1776 n = mdoc->last;
1777 for (ni = n->body->child; ni != NULL; ni = ni->next) {
1794 } else if (n->norm->Bl.comp == 0 &&
1795 n->norm->Bl.type != LIST_column) {
2019 struct roff_node *n;
2021 n = mdoc->last;
2023 if (n->type == ROFFT_BLOCK && n->body->child == NULL) {
2024 mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos, "Bk");
2025 roff_node_delete(mdoc, n);
2061 struct roff_node *n;
2087 n = mdoc->meta.first->child;
2088 while (n->tok != MDOC_Dt ||
2089 n->child == NULL ||
2090 n->child->next == NULL ||
2091 n->child->next->next == NULL)
2092 n = n->next;
2093 n = n->child->next->next;
2094 mandoc_msg(MANDOCERR_ARCH_BAD, n->line, n->pos,
2102 n = mdoc->meta.first->child;
2103 while (n != NULL &&
2104 (n->type == ROFFT_COMMENT ||
2105 (n->tok >= MDOC_Dd &&
2106 mdoc_macro(n->tok)->flags & MDOC_PROLOGUE)))
2107 n = n->next;
2109 if (n == NULL)
2111 else if (n->tok != MDOC_Sh)
2112 mandoc_msg(MANDOCERR_SEC_BEFORE, n->line, n->pos,
2113 "%s", roff_name[n->tok]);
2211 struct roff_node *n, *nch;
2214 n = mdoc->last;
2215 for (nch = n->child; nch != NULL; nch = nch->next) {
2225 if (n->tag == NULL && n->flags & NODE_ID)
2226 n->tag = mandoc_strdup(nch->string);
2235 struct roff_node *n;
2237 n = mdoc->last;
2238 if (n->flags & NODE_LINE ||
2239 (n->next != NULL && n->next->flags & NODE_DELIMC))
2240 mandoc_msg(MANDOCERR_NS_SKIP, n->line, n->pos, NULL);
2282 struct roff_node *n;
2287 for (n = mdoc->last->child; n != NULL; n = n->next) {
2288 switch (n->tok) {
2290 if (hasnm && n->child != NULL)
2292 n->line, n->pos,
2293 "Nm %s", n->child->string);
2298 if (n->next != NULL)
2300 n->line, n->pos, NULL);
2303 if (n->type == ROFFT_TEXT &&
2304 n->string[0] == ',' && n->string[1] == '\0' &&
2305 n->next != NULL && n->next->tok == MDOC_Nm) {
2306 n = n->next;
2312 n->line, n->pos, "%s", roff_name[n->tok]);
2329 const struct roff_node *n;
2334 n = mdoc->last->child;
2336 while (n != NULL) {
2337 if (n->tok != MDOC_Xr ||
2338 n->child == NULL ||
2339 n->child->next == NULL)
2344 name = n->child->string;
2345 sec = n->child->next->string;
2348 mandoc_msg(MANDOCERR_XR_PUNCT, n->line,
2349 n->pos, "%s before %s(%s)",
2353 mandoc_msg(MANDOCERR_XR_ORDER, n->line,
2354 n->pos, "%s(%s) after %s(%s)",
2358 mandoc_msg(MANDOCERR_XR_ORDER, n->line,
2359 n->pos, "%s after %s", name, lastname);
2366 n = n->next;
2367 if (n == NULL)
2369 if (n->tok == MDOC_Xr) {
2373 if (n->type != ROFFT_TEXT)
2375 for (name = n->string; *name != '\0'; name++)
2378 lastpunct = n->string;
2379 if (n->next == NULL || n->next->tok == MDOC_Rs)
2380 mandoc_msg(MANDOCERR_XR_PUNCT, n->line,
2381 n->pos, "%s after %s(%s)",
2383 n = n->next;
2388 child_an(const struct roff_node *n)
2391 for (n = n->child; n != NULL; n = n->next)
2392 if ((n->tok == MDOC_An && n->child != NULL) || child_an(n))
2567 struct roff_node *n, *nch;
2569 n = mdoc->last;
2570 nch = n->child;
2573 n->line, n->pos, "Xr %s", nch->string);
2575 assert(nch->next == n->last);
2588 struct roff_node *n, *nch;
2591 n = mdoc->last;
2592 switch (n->type) {
2598 deroff(&tag, n);
2603 if ((nch = n->child) != NULL &&
2606 tag_put(NULL, TAG_STRONG, n);
2608 tag_put(tag, TAG_FALLBACK, n);
2619 if ((nch = n->child) != NULL &&
2624 roff_name[n->tok]);
2627 if ((nch = n->last) != NULL &&
2631 roff_name[n->tok]);
2639 struct roff_node *n, *np;
2641 n = mdoc->last;
2642 if (n->type != ROFFT_ELEM && n->type != ROFFT_BLOCK)
2644 if ((np = roff_node_prev(n)) == NULL)
2654 if (n->tok == MDOC_Bl && n->norm->Bl.comp)
2656 if (n->tok == MDOC_Bd && n->norm->Bd.comp)
2658 if (n->tok == MDOC_It && n->parent->norm->Bl.comp)
2662 "%s before %s", roff_name[np->tok], roff_name[n->tok]);
2683 struct roff_node *n;
2685 n = mdoc->last;
2686 n->flags |= NODE_NOPRT;
2689 mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Dd");
2692 mandoc_msg(MANDOCERR_PROLOG_LATE, n->line, n->pos, "Dd");
2695 n->line, n->pos, "Dd after Dt");
2698 n->line, n->pos, "Dd after Os");
2700 if (mdoc->quick && n != NULL)
2703 mdoc->meta.date = mandoc_normdate(n->child, n);
2709 struct roff_node *nn, *n;
2713 n = mdoc->last;
2714 n->flags |= NODE_NOPRT;
2717 mandoc_msg(MANDOCERR_DT_LATE, n->line, n->pos, "Dt");
2722 mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Dt");
2725 n->line, n->pos, "Dt after Os");
2739 nn = n->child;
2741 mandoc_msg(MANDOCERR_DT_NOTITLE, n->line, n->pos, "Dt");
2763 mandoc_msg(MANDOCERR_MSEC_MISSING, n->line, n->pos,
2806 struct roff_node *n, *nch;
2811 n = mdoc->last;
2812 nch = n->child;
2821 n->line, n->pos, "%s", macro);
2825 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
2830 roff_word_alloc(mdoc, n->line, n->pos, "BSD");
2834 mdoc->last = n;
2838 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
2841 roff_word_alloc(mdoc, n->line, n->pos, "-");
2843 roff_elem_alloc(mdoc, n->line, n->pos, MDOC_Ns);
2845 mdoc->last = n;
2862 struct roff_node *n;
2864 n = mdoc->last;
2865 n->flags |= NODE_NOPRT;
2868 mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Os");
2870 mandoc_msg(MANDOCERR_PROLOG_LATE, n->line, n->pos, "Os");
2885 deroff(&mdoc->meta.os, n);
2899 mandoc_msg(MANDOCERR_OS_UNAME, n->line, n->pos, "Os");
2922 if (n->child != NULL)
2923 mandoc_msg(MANDOCERR_OS_ARG, n->child->line, n->child->pos,
2924 "Os %s (%s)", n->child->string,
2928 while (n->tok != MDOC_Dd)
2929 if ((n = n->prev) == NULL)
2931 if ((n = n->child) == NULL)
2933 if (strncmp(n->string, "$" "Mdocdate", 9)) {
2935 mandoc_msg(MANDOCERR_MDOCDATE_MISSING, n->line,
2936 n->pos, "Dd %s (OpenBSD)", n->string);
2939 mandoc_msg(MANDOCERR_MDOCDATE, n->line,
2940 n->pos, "Dd %s (NetBSD)", n->string);