version 1.236, 2014/07/30 23:38:52 |
version 1.237, 2014/07/31 00:41:10 |
|
|
post_bl_head(POST_ARGS) |
post_bl_head(POST_ARGS) |
{ |
{ |
struct mdoc_node *np, *nn, *nnp; |
struct mdoc_node *np, *nn, *nnp; |
|
struct mdoc_argv *argv; |
int i, j; |
int i, j; |
|
|
if (LIST_column != mdoc->last->norm->Bl.type) |
if (LIST_column != mdoc->last->norm->Bl.type) |
Line 1458 post_bl_head(POST_ARGS) |
|
Line 1459 post_bl_head(POST_ARGS) |
|
return(hwarn_eq0(mdoc)); |
return(hwarn_eq0(mdoc)); |
|
|
/* |
/* |
* Convert old-style lists, where the column width specifiers |
* Append old-style lists, where the column width specifiers |
* trail as macro parameters, to the new-style ("normal-form") |
* trail as macro parameters, to the new-style ("normal-form") |
* lists where they're argument values following -column. |
* lists where they're argument values following -column. |
*/ |
*/ |
|
|
/* First, disallow both types and allow normal-form. */ |
if (mdoc->last->child == NULL) |
|
|
/* |
|
* TODO: technically, we can accept both and just merge the two |
|
* lists, but I'll leave that for another day. |
|
*/ |
|
|
|
if (mdoc->last->norm->Bl.ncols && mdoc->last->nchild) { |
|
mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_COLUMNS); |
|
return(0); |
|
} else if (NULL == mdoc->last->child) |
|
return(1); |
return(1); |
|
|
np = mdoc->last->parent; |
np = mdoc->last->parent; |
Line 1484 post_bl_head(POST_ARGS) |
|
Line 1475 post_bl_head(POST_ARGS) |
|
break; |
break; |
|
|
assert(j < (int)np->args->argc); |
assert(j < (int)np->args->argc); |
assert(0 == np->args->argv[j].sz); |
|
|
|
/* |
/* |
* Accommodate for new-style groff column syntax. Shuffle the |
* Accommodate for new-style groff column syntax. Shuffle the |
Line 1492 post_bl_head(POST_ARGS) |
|
Line 1482 post_bl_head(POST_ARGS) |
|
* column field. Then, delete the head children. |
* column field. Then, delete the head children. |
*/ |
*/ |
|
|
np->args->argv[j].sz = (size_t)mdoc->last->nchild; |
argv = np->args->argv + j; |
np->args->argv[j].value = mandoc_reallocarray(NULL, |
i = argv->sz; |
(size_t)mdoc->last->nchild, sizeof(char *)); |
argv->sz += mdoc->last->nchild; |
|
argv->value = mandoc_reallocarray(argv->value, |
|
argv->sz, sizeof(char *)); |
|
|
mdoc->last->norm->Bl.ncols = np->args->argv[j].sz; |
mdoc->last->norm->Bl.ncols = argv->sz; |
mdoc->last->norm->Bl.cols = (void *)np->args->argv[j].value; |
mdoc->last->norm->Bl.cols = (void *)argv->value; |
|
|
for (i = 0, nn = mdoc->last->child; nn; i++) { |
for (nn = mdoc->last->child; nn; i++) { |
np->args->argv[j].value[i] = nn->string; |
argv->value[i] = nn->string; |
nn->string = NULL; |
nn->string = NULL; |
nnp = nn; |
nnp = nn; |
nn = nn->next; |
nn = nn->next; |