mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-19 11:27:34 +00:00
(tparam1): Add handling for `%pN', which
means use param N for the next substitution.
This commit is contained in:
parent
a032392731
commit
ccc4dea06e
1 changed files with 15 additions and 3 deletions
18
src/tparam.c
18
src/tparam.c
|
|
@ -138,7 +138,9 @@ tparam1 (string, outstring, len, up, left, argp)
|
|||
int outlen = 0;
|
||||
|
||||
register int tem;
|
||||
int *old_argp = argp;
|
||||
int *old_argp = argp; /* may move */
|
||||
int *fixed_argp = argp; /* never moves */
|
||||
int explicit_param_p = 0; /* set by %p */
|
||||
int doleft = 0;
|
||||
int doup = 0;
|
||||
|
||||
|
|
@ -163,7 +165,7 @@ tparam1 (string, outstring, len, up, left, argp)
|
|||
outlen *= 2;
|
||||
new = (char *) xrealloc (outstring, outlen);
|
||||
}
|
||||
|
||||
|
||||
op = new + offset;
|
||||
outend = new + outlen;
|
||||
outstring = new;
|
||||
|
|
@ -174,7 +176,10 @@ tparam1 (string, outstring, len, up, left, argp)
|
|||
if (c == '%')
|
||||
{
|
||||
c = *p++;
|
||||
tem = *argp;
|
||||
if (explicit_param_p)
|
||||
explicit_param_p = 0;
|
||||
else
|
||||
tem = *argp;
|
||||
switch (c)
|
||||
{
|
||||
case 'd': /* %d means output in decimal. */
|
||||
|
|
@ -198,6 +203,11 @@ tparam1 (string, outstring, len, up, left, argp)
|
|||
argp++;
|
||||
break;
|
||||
|
||||
case 'p': /* %pN means use param N in following susbt. */
|
||||
tem = fixed_argp[(*p++) - '1'];
|
||||
explicit_param_p = 1;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
/* For c-100: print quotient of value by 96, if nonzero,
|
||||
then do like %+. */
|
||||
|
|
@ -328,3 +338,5 @@ main (argc, argv)
|
|||
}
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* tparam.c ends here */
|
||||
|
|
|
|||
Loading…
Reference in a new issue