From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id d4654117 for ; Sun, 9 Oct 2016 13:17:27 -0500 (EST) Date: Sun, 9 Oct 2016 13:17:27 -0500 (EST) Message-Id: <2816826148428304490.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Delete complicated code dealing with .Bl -tag without -width, X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Delete complicated code dealing with .Bl -tag without -width, and just let it default to -width 6n, which agrees with the traditional -width Ds that is still in widespread use. I just pushed a patch upstream to GNU roff that does the same for groff_mdoc(7). Before, groff contained code that was even more complicated than mandoc, but both resulted in quite different user-visible output. Now, both agree, and output is nicer for both. Useless complication noticed by Carsten Kunze (Heirloom roff). Modified Files: -------------- mdocml: mandoc.h mdoc_term.c mdoc_validate.c read.c Revision Data ------------- Index: mdoc_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v retrieving revision 1.331 retrieving revision 1.332 diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.331 -r1.332 --- mdoc_term.c +++ mdoc_term.c @@ -631,10 +631,10 @@ termp_it_pre(DECL_ARGS) width = term_len(p, 2); break; case LIST_hang: + case LIST_tag: width = term_len(p, 8); break; case LIST_column: - case LIST_tag: width = term_len(p, 10); break; default: Index: mandoc.h =================================================================== RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v retrieving revision 1.209 retrieving revision 1.210 diff -Lmandoc.h -Lmandoc.h -u -p -r1.209 -r1.210 --- mandoc.h +++ mandoc.h @@ -98,7 +98,7 @@ enum mandocerr { MANDOCERR_ARG_EMPTY, /* empty argument, using 0n: macro arg */ MANDOCERR_BD_NOTYPE, /* missing display type, using -ragged: Bd */ MANDOCERR_BL_LATETYPE, /* list type is not the first argument: Bl arg */ - MANDOCERR_BL_NOWIDTH, /* missing -width in -tag list, using 8n */ + MANDOCERR_BL_NOWIDTH, /* missing -width in -tag list, using 6n */ MANDOCERR_EX_NONAME, /* missing utility name, using "": Ex */ MANDOCERR_FO_NOHEAD, /* missing function name, using "": Fo */ MANDOCERR_IT_NOHEAD, /* empty head in list item: Bl -type It */ Index: read.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/read.c,v retrieving revision 1.151 retrieving revision 1.152 diff -Lread.c -Lread.c -u -p -r1.151 -r1.152 --- read.c +++ read.c @@ -141,7 +141,7 @@ static const char * const mandocerrs[MAN "empty argument, using 0n", "missing display type, using -ragged", "list type is not the first argument", - "missing -width in -tag list, using 8n", + "missing -width in -tag list, using 6n", "missing utility name, using \"\"", "missing function name, using \"\"", "empty head in list item", Index: mdoc_validate.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v retrieving revision 1.308 retrieving revision 1.309 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.308 -r1.309 --- mdoc_validate.c +++ mdoc_validate.c @@ -67,7 +67,6 @@ static void post_bf(POST_ARGS); static void post_bk(POST_ARGS); static void post_bl(POST_ARGS); static void post_bl_block(POST_ARGS); -static void post_bl_block_tag(POST_ARGS); static void post_bl_head(POST_ARGS); static void post_bl_norm(POST_ARGS); static void post_bx(POST_ARGS); @@ -1099,22 +1098,7 @@ post_bl_block(POST_ARGS) post_prevpar(mdoc); - /* - * These are fairly complicated, so we've broken them into two - * functions. post_bl_block_tag() is called when a -tag is - * specified, but no -width (it must be guessed). The second - * when a -width is specified (macro indicators must be - * rewritten into real lengths). - */ - n = mdoc->last; - - if (n->norm->Bl.type == LIST_tag && - n->norm->Bl.width == NULL) { - post_bl_block_tag(mdoc); - assert(n->norm->Bl.width != NULL); - } - for (ni = n->body->child; ni != NULL; ni = ni->next) { if (ni->body == NULL) continue; @@ -1169,71 +1153,6 @@ rewrite_macro2len(char **arg) free(*arg); mandoc_asprintf(arg, "%zun", width); -} - -static void -post_bl_block_tag(POST_ARGS) -{ - struct roff_node *n, *nn; - size_t sz, ssz; - int i; - char buf[24]; - - /* - * Calculate the -width for a `Bl -tag' list if it hasn't been - * provided. Uses the first head macro. NOTE AGAIN: this is - * ONLY if the -width argument has NOT been provided. See - * rewrite_macro2len() for converting the -width string. - */ - - sz = 10; - n = mdoc->last; - - for (nn = n->body->child; nn != NULL; nn = nn->next) { - if (nn->tok != MDOC_It) - continue; - - assert(nn->type == ROFFT_BLOCK); - nn = nn->head->child; - - if (nn == NULL) - break; - - if (nn->type == ROFFT_TEXT) { - sz = strlen(nn->string) + 1; - break; - } - - if (0 != (ssz = macro2len(nn->tok))) - sz = ssz; - - break; - } - - /* Defaults to ten ens. */ - - (void)snprintf(buf, sizeof(buf), "%un", (unsigned int)sz); - - /* - * We have to dynamically add this to the macro's argument list. - * We're guaranteed that a MDOC_Width doesn't already exist. - */ - - assert(n->args != NULL); - i = (int)(n->args->argc)++; - - n->args->argv = mandoc_reallocarray(n->args->argv, - n->args->argc, sizeof(struct mdoc_argv)); - - n->args->argv[i].arg = MDOC_Width; - n->args->argv[i].line = n->line; - n->args->argv[i].pos = n->pos; - n->args->argv[i].sz = 1; - n->args->argv[i].value = mandoc_malloc(sizeof(char *)); - n->args->argv[i].value[0] = mandoc_strdup(buf); - - /* Set our width! */ - n->norm->Bl.width = n->args->argv[i].value[0]; } static void -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv