version 1.45, 2010/03/30 06:52:08 |
version 1.46, 2010/03/30 08:24:01 |
Line 1209 in_line_argn(MACRO_PROT_ARGS) |
|
Line 1209 in_line_argn(MACRO_PROT_ARGS) |
|
struct mdoc_arg *arg; |
struct mdoc_arg *arg; |
char *p; |
char *p; |
|
|
/* Fixed maximum arguments per macro, if applicable. */ |
/* |
|
* A line macro that has a fixed number of arguments (maxargs). |
|
* Only open the scope once the first non-leading-punctuation is |
|
* found (unless MDOC_IGNDELIM is noted, like in `Pf'), then |
|
* keep it open until the maximum number of arguments are |
|
* exhausted. |
|
*/ |
|
|
switch (tok) { |
switch (tok) { |
case (MDOC_Ap): |
case (MDOC_Ap): |
Line 1229 in_line_argn(MACRO_PROT_ARGS) |
|
Line 1235 in_line_argn(MACRO_PROT_ARGS) |
|
break; |
break; |
} |
} |
|
|
/* Macro argument processing. */ |
for (arg = NULL; ; ) { |
|
|
for (arg = NULL;; ) { |
|
la = *pos; |
la = *pos; |
c = mdoc_argv(m, line, tok, &arg, pos, buf); |
c = mdoc_argv(m, line, tok, &arg, pos, buf); |
|
|
Line 1249 in_line_argn(MACRO_PROT_ARGS) |
|
Line 1253 in_line_argn(MACRO_PROT_ARGS) |
|
return(0); |
return(0); |
} |
} |
|
|
/* Open the element scope. */ |
for (flushed = j = 0; ; ) { |
|
|
if ( ! mdoc_elem_alloc(m, line, ppos, tok, arg)) |
|
return(0); |
|
|
|
/* Process element arguments. */ |
|
|
|
for (flushed = j = 0; ; j++) { |
|
la = *pos; |
la = *pos; |
|
|
if (j == maxargs && ! flushed) { |
|
if ( ! rew_elem(m, tok)) |
|
return(0); |
|
flushed = 1; |
|
} |
|
|
|
c = mdoc_args(m, line, pos, buf, tok, &p); |
c = mdoc_args(m, line, pos, buf, tok, &p); |
|
|
if (ARGS_ERROR == c) |
if (ARGS_ERROR == c) |
Line 1274 in_line_argn(MACRO_PROT_ARGS) |
|
Line 1264 in_line_argn(MACRO_PROT_ARGS) |
|
if (ARGS_EOLN == c) |
if (ARGS_EOLN == c) |
break; |
break; |
|
|
|
if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) && |
|
0 == j && 1 == mdoc_isdelim(p)) { |
|
if ( ! mdoc_word_alloc(m, line, la, p)) |
|
return(0); |
|
continue; |
|
} else if (0 == j) |
|
if ( ! mdoc_elem_alloc(m, line, la, tok, arg)) |
|
return(0); |
|
|
|
if (j == maxargs && ! flushed) { |
|
if ( ! rew_elem(m, tok)) |
|
return(0); |
|
flushed = 1; |
|
} |
|
|
if (MDOC_MAX != (c = lookup(tok, p))) { |
if (MDOC_MAX != (c = lookup(tok, p))) { |
if ( ! flushed && ! rew_elem(m, tok)) |
if ( ! flushed && ! rew_elem(m, tok)) |
return(0); |
return(0); |
flushed = 1; |
flushed = 1; |
if ( ! mdoc_macro(m, c, line, la, pos, buf)) |
if ( ! mdoc_macro(m, c, line, la, pos, buf)) |
return(0); |
return(0); |
|
j++; |
break; |
break; |
} |
} |
|
|
Line 1297 in_line_argn(MACRO_PROT_ARGS) |
|
Line 1303 in_line_argn(MACRO_PROT_ARGS) |
|
* code is no here, it's unlikely to be removed. |
* code is no here, it's unlikely to be removed. |
*/ |
*/ |
|
|
|
#ifdef __OpenBSD__ |
if (MDOC_Xr == tok && j == maxargs) { |
if (MDOC_Xr == tok && j == maxargs) { |
if ( ! mdoc_elem_alloc(m, line, ppos, MDOC_Ns, NULL)) |
if ( ! mdoc_elem_alloc(m, line, la, MDOC_Ns, NULL)) |
return(0); |
return(0); |
if ( ! rew_elem(m, MDOC_Ns)) |
if ( ! rew_elem(m, MDOC_Ns)) |
return(0); |
return(0); |
} |
} |
|
#endif |
|
|
if ( ! mdoc_word_alloc(m, line, la, p)) |
if ( ! mdoc_word_alloc(m, line, la, p)) |
return(0); |
return(0); |
|
j++; |
} |
} |
|
|
/* Close out and append delimiters. */ |
if (0 == j && ! mdoc_elem_alloc(m, line, la, tok, arg)) |
|
return(0); |
|
|
|
/* Close out in a consistent state. */ |
|
|
if ( ! flushed && ! rew_elem(m, tok)) |
if ( ! flushed && ! rew_elem(m, tok)) |
return(0); |
return(0); |