aboutsummaryrefslogtreecommitdiffstats
path: root/src/tparam.c
diff options
context:
space:
mode:
authorThien-Thi Nguyen2003-12-24 07:31:42 +0000
committerThien-Thi Nguyen2003-12-24 07:31:42 +0000
commit9ad4bf7a45709eda54e2aa458a92413462506ea4 (patch)
tree8c22eda65048b7e2639376d1860d409443ecbae3 /src/tparam.c
parent08a39b830496f07d491f94d205da822ba7c05a1f (diff)
downloademacs-9ad4bf7a45709eda54e2aa458a92413462506ea4.tar.gz
emacs-9ad4bf7a45709eda54e2aa458a92413462506ea4.zip
(tparam1): Add handling for `%pN', which
means use param N for the next substitution.
Diffstat (limited to 'src/tparam.c')
-rw-r--r--src/tparam.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/tparam.c b/src/tparam.c
index 7306e0d5c10..ea208692161 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -144,7 +144,9 @@ tparam1 (string, outstring, len, up, left, argp)
144 int outlen = 0; 144 int outlen = 0;
145 145
146 register int tem; 146 register int tem;
147 int *old_argp = argp; 147 int *old_argp = argp; /* can move */
148 int *fixed_argp = argp; /* never moves */
149 int explicit_param_p = 0; /* set by %p */
148 int doleft = 0; 150 int doleft = 0;
149 int doup = 0; 151 int doup = 0;
150 152
@@ -180,7 +182,10 @@ tparam1 (string, outstring, len, up, left, argp)
180 if (c == '%') 182 if (c == '%')
181 { 183 {
182 c = *p++; 184 c = *p++;
183 tem = *argp; 185 if (explicit_param_p)
186 explicit_param_p = 0;
187 else
188 tem = *argp;
184 switch (c) 189 switch (c)
185 { 190 {
186 case 'd': /* %d means output in decimal. */ 191 case 'd': /* %d means output in decimal. */
@@ -203,7 +208,10 @@ tparam1 (string, outstring, len, up, left, argp)
203 *op++ = tem % 10 + '0'; 208 *op++ = tem % 10 + '0';
204 argp++; 209 argp++;
205 break; 210 break;
206 211 case 'p': /* %pN means use param N for next subst. */
212 tem = fixed_argp[(*p++) - '1'];
213 explicit_param_p = 1;
214 break;
207 case 'C': 215 case 'C':
208 /* For c-100: print quotient of value by 96, if nonzero, 216 /* For c-100: print quotient of value by 96, if nonzero,
209 then do like %+. */ 217 then do like %+. */