Rev 12122 | Rev 14873 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 12122 | Rev 12247 | ||
---|---|---|---|
Line 19... | Line 19... | ||
19 | 19 | ||
20 | char *setpre=""; |
20 | char *setpre=""; |
21 | 21 | ||
22 | void sp_asis(char *p, int ptype) |
22 | void sp_asis(char *p, int ptype) |
23 | { |
23 | { |
24 |
|
24 | fprintf(outf,"%stmp%d=!nosubst %s\n\n",setpre,prepcnt,p); |
25 | } |
25 | } |
26 | 26 | ||
27 | void sp_evalue(char *p, int ptype) |
27 | void sp_evalue(char *p, int ptype) |
28 | { |
28 | { |
29 |
|
29 | char *p1, *p2, *pe; |
30 | 30 | ||
31 |
|
31 | p1=strparchr(p,','); |
32 |
|
32 | if(p1==NULL) { |
33 |
|
33 | fprintf(outf,"%stmp%d=%s\n\n",setpre,prepcnt,p); |
34 |
|
34 | return; |
35 |
|
35 | } |
36 |
|
36 | *p1++=0; fprintf(outf,"%sevaltmp=%s\n\n", setpre,p); |
37 |
|
37 | for(; p1!=NULL; p1=p2){ |
38 |
|
38 | p1=find_word_start(p1); |
39 |
|
39 | p2=strparchr(p1,','); |
40 |
|
40 | if(p2!=NULL) *p2++=0; |
41 |
|
41 | pe=strchr(p1,'='); |
42 |
|
42 | if(pe==NULL) continue; |
43 |
|
43 | *pe++=0; *find_word_end(p1)=0; |
44 |
|
44 | if(*p1==0) continue; |
45 |
|
45 | fprintf(outf,"%sevaltmp=!mathsubst %s=(%s) in $evaltmp\n", |
46 |
|
46 | setpre,p1,pe); |
47 |
|
47 | } |
48 |
|
48 | fprintf(outf,"%stmp%d=($evaltmp)\n",setpre,prepcnt); |
49 | } |
49 | } |
50 | 50 | ||
51 | /* simple roots.*/ |
51 | /* simple roots.*/ |
52 | void sp_solve(char *p, int ptype) |
52 | void sp_solve(char *p, int ptype) |
53 | { |
53 | { |
54 |
|
54 | fprintf(outf,"%stmp=!replace internal .. by , in %s \n\n\ |
55 | !distribute items $tmp into tmp1,tmp2,tmp3\n\ |
55 | !distribute items $tmp into tmp1,tmp2,tmp3\n\ |
56 | %stmp2=!replace internal = by , in $tmp2\n\ |
56 | %stmp2=!replace internal = by , in $tmp2\n\ |
57 | !distribute items $tmp2 into tmp4,tmp5\n\ |
57 | !distribute items $tmp2 into tmp4,tmp5\n\ |
58 | %stmp%d=!solve $tmp1 for $tmp4 = $tmp5 to $tmp3 \n", |
58 | %stmp%d=!solve $tmp1 for $tmp4 = $tmp5 to $tmp3 \n", |
59 | setpre,p,setpre,setpre,prepcnt); |
59 | setpre,p,setpre,setpre,prepcnt); |
60 | } |
60 | } |
61 | 61 | ||
62 | /* use maxima to do formal derivation. */ |
62 | /* use maxima to do formal derivation. */ |
63 | void sp_diff(char *p, int ptype) |
63 | void sp_diff(char *p, int ptype) |
64 | { |
64 | { |
65 |
|
65 | fprintf(outf,"%stmp=!translate ;\";': to $ $ in %s\n\n\ |
66 | %stmp=!lower $tmp\n\ |
66 | %stmp=!lower $tmp\n\ |
67 | %stmp%d=!exec maxima diff($tmp);\n", |
67 | %stmp%d=!exec maxima diff($tmp);\n", |
68 | setpre,p,setpre,setpre,prepcnt); |
68 | setpre,p,setpre,setpre,prepcnt); |
69 | } |
69 | } |
70 | 70 | ||
71 | /* use pari to compute matrix determinant. */ |
71 | /* use pari to compute matrix determinant. */ |
72 | void sp_det(char *p, int ptype) |
72 | void sp_det(char *p, int ptype) |
73 | { |
73 | { |
74 |
|
74 | fprintf(outf,"%stmp=!translate $ $ to ; in %s\n\n\ |
75 | %stmp%d=!exec pari matdet([$tmp])\n", |
75 | %stmp%d=!exec pari matdet([$tmp])\n", |
76 | setpre,p,setpre,prepcnt); |
76 | setpre,p,setpre,prepcnt); |
77 | } |
77 | } |
78 | 78 | ||
79 | /* use maxima to do formal integration, |
79 | /* use maxima to do formal integration, |
80 | * but pari for numerical integration. */ |
80 | * but pari for numerical integration. */ |
81 | void sp_int(char *p, int ptype) |
81 | void sp_int(char *p, int ptype) |
82 | { |
82 | { |
83 |
|
83 | char *s; |
84 | 84 | ||
85 |
|
85 | if((s=strchr(p,'='))!=NULL) *s=','; |
86 |
|
86 | if((s=strstr(p,".."))!=NULL) {*s=','; *(s+1)=' ';} |
87 |
|
87 | fprintf(outf,"%stmp=!translate ;\";': to $ $ in %s \n\ |
88 | %stmp=!lower $tmp\n\ |
88 | %stmp=!lower $tmp\n\ |
89 | !readproc slib/function/integrate $tmp\n\ |
89 | !readproc slib/function/integrate $tmp\n\ |
90 | %stmp%d=$slib_out\n", |
90 | %stmp%d=$slib_out\n", |
91 | setpre,p,setpre,setpre,prepcnt); |
91 | setpre,p,setpre,setpre,prepcnt); |
92 | } |
92 | } |
93 | 93 | ||
94 | void sp_htmlmath(char *p, int ptype) |
94 | void sp_htmlmath(char *p, int ptype) |
95 | { |
95 | { |
96 |
|
96 | fprintf(outf,"%stmp%d=!htmlmath %s\n\n",setpre,prepcnt,p); |
97 | } |
97 | } |
98 | 98 | ||
99 | void sp_teximg(char *p, int ptype) |
99 | void sp_teximg(char *p, int ptype) |
100 | { |
100 | { |
101 |
|
101 | fprintf(outf,"!readproc %s/teximg.phtml %s \n\ |
102 | %stmp%d=$ins_url\n", primitive_dir, p, setpre,prepcnt); |
102 | %stmp%d=$ins_url\n", primitive_dir, p, setpre,prepcnt); |
103 | } |
103 | } |
104 | 104 | ||
105 | void sp_texmath(char *p, int ptype) |
105 | void sp_texmath(char *p, int ptype) |
106 | { |
106 | { |
107 |
|
107 | fprintf(outf,"%stmp%d=!texmath %s\n\n",setpre,prepcnt,p); |
108 | } |
108 | } |
109 | 109 | ||
110 | void sp_maxima(char *p, int ptype) |
110 | void sp_maxima(char *p, int ptype) |
111 | { |
111 | { |
112 |
|
112 | fprintf(outf,"%st_=!replace internal \\( by ( in %s\n\ |
113 | %stmp%d=!exec maxima $t_\n\n",setpre,p,setpre,prepcnt); |
113 | %stmp%d=!exec maxima $t_\n\n",setpre,p,setpre,prepcnt); |
114 | } |
114 | } |
115 | 115 | ||
116 | void sp_yacas(char *p, int ptype) |
116 | void sp_yacas(char *p, int ptype) |
117 | { |
117 | { |
118 |
|
118 | fprintf(outf,"%st_=!replace internal \\( by ( in %s\n\ |
119 | %stmp%d=!exec yacas $t_\n\n",setpre,p,setpre,prepcnt); |
119 | %stmp%d=!exec yacas $t_\n\n",setpre,p,setpre,prepcnt); |
120 | } |
120 | } |
121 | 121 | ||
122 | void sp_pari(char *p, int ptype) |
122 | void sp_pari(char *p, int ptype) |
123 | { |
123 | { |
124 |
|
124 | fprintf(outf,"%st_=!replace internal \\( by ( in %s\n\ |
125 | %stmp%d=!exec pari $t_\n\n",setpre,p,setpre,prepcnt); |
125 | %stmp%d=!exec pari $t_\n\n",setpre,p,setpre,prepcnt); |
126 | } |
126 | } |
127 | 127 | ||
128 | void sp_simplify(char *p, int ptype) |
128 | void sp_simplify(char *p, int ptype) |
129 | { |
129 | { |
130 |
|
130 | fprintf(outf,"%stmp=!translate \";': to $ $ in %s\n\n\ |
131 | %stmp=!lower $tmp\n\ |
131 | %stmp=!lower $tmp\n\ |
132 | %stmp%d=!exec maxima fullratsimp($tmp);\n", |
132 | %stmp%d=!exec maxima fullratsimp($tmp);\n", |
133 | setpre,p,setpre,setpre,prepcnt); |
133 | setpre,p,setpre,setpre,prepcnt); |
134 | } |
134 | } |
135 | 135 | ||
136 | void sp_slib(char *p, int ptype) |
136 | void sp_slib(char *p, int ptype) |
137 | { |
137 | { |
138 |
|
138 | char *p2; |
139 |
|
139 | p=find_word_start(p); |
140 |
|
140 | for(p2=p;*p2!=0 && !isspace(*p2) && *p2!=',' && *p2!=';';p2++); |
141 |
|
141 | if(*p2!=0 && !isspace(*p2)) *p2=' '; |
142 |
|
142 | fprintf(outf,"!readproc slib/%s \n\ |
143 | %stmp%d=$slib_out\n",p,setpre,prepcnt); |
143 | %stmp%d=$slib_out\n",p,setpre,prepcnt); |
144 | } |
144 | } |
145 | 145 | ||
146 | void sp_draw(char *p, int ptype) |
146 | void sp_draw(char *p, int ptype) |
147 | { |
147 | { |
148 |
|
148 | char *p2; |
149 |
|
149 | p2=strchr(p,' '); if(p2==NULL) p2=strchr(p,'\n'); |
150 |
|
150 | if(p2==NULL) return; |
151 |
|
151 | *p2++=0; |
152 |
|
152 | fprintf(outf,"!readproc %s/draw.phtml %s \\\n%s \n\ |
153 | %stmp%d=$ins_url\n", primitive_dir, p, p2, setpre,prepcnt); |
153 | %stmp%d=$ins_url\n", primitive_dir, p, p2, setpre,prepcnt); |
154 | } |
154 | } |
155 | 155 | ||
156 | void sp_canvasdraw(char *p, int ptype) |
156 | void sp_canvasdraw(char *p, int ptype) |
157 | { |
157 | { |
158 |
|
158 | char *p2; |
159 |
|
159 | p2=strchr(p,' '); if(p2==NULL) p2=strchr(p,'\n'); |
160 |
|
160 | if(p2==NULL) return; |
161 |
|
161 | *p2++=0; |
162 |
|
162 | fprintf(outf,"!readproc %s/canvasdraw.phtml %s \\\n%s \n\ |
163 | %stmp%d=$canvasdraw_out\n", primitive_dir, p, p2, setpre,prepcnt); |
163 | %stmp%d=$canvasdraw_out\n", primitive_dir, p, p2, setpre,prepcnt); |
164 | } |
164 | } |
165 | 165 | ||
166 | void sp_shuffle(char *p, int ptype) |
166 | void sp_shuffle(char *p, int ptype) |
167 | { |
167 | { |
168 |
|
168 | fprintf(outf,"%stmp%d=!shuffle %s\n\n",setpre,prepcnt,p); |
169 | } |
169 | } |
170 | 170 | ||
171 | void sp_positionof(char *p, int ptype) |
171 | void sp_positionof(char *p, int ptype) |
172 | { |
172 | { |
173 |
|
173 | char *p1; |
174 |
|
174 | p1=strparchr(p,','); if(p1==NULL) { |
175 |
|
175 | fprintf(outf,"%stmp%d=%s\n\n",setpre,prepcnt,p); return; |
176 |
|
176 | } |
177 |
|
177 | *p1++=0; |
178 |
|
178 | fprintf(outf,"%stmp%d=!positionof item %s in %s\n\n",setpre,prepcnt,p, p1); |
179 | } |
179 | } |
180 | 180 | ||
181 | void sp_random(char *p, int ptype) |
181 | void sp_random(char *p, int ptype) |
182 | { |
182 | { |
183 |
|
183 | char *pr, *p2, buf[MAX_LINELEN+1]; |
184 |
|
184 | snprintf(buf,sizeof(buf),"%s",p); |
185 |
|
185 | for(p2=buf; *p2 && p2-buf<MAX_LINELEN; p2++) { |
186 |
|
186 | if(*p2=='(') { |
187 |
|
187 | p2=find_matching(p2+1,')'); continue; |
188 |
|
188 | } |
189 |
|
189 | if(*p2==',' || (*p2=='.' && *(p2+1)=='.')) break; |
190 |
|
190 | } |
191 |
|
191 | if(*p2==',') pr="randitem"; |
192 |
|
192 | else { |
193 |
|
193 | if(*p2=='.') { |
194 |
|
194 | *p2=','; *(p2+1)=' '; |
195 | } |
- | |
196 | if(ptype==pt_int) pr="randint"; else pr="random"; |
- | |
197 | } |
195 | } |
- | 196 | if(ptype==pt_int) pr="randint"; else pr="random"; |
|
- | 197 | } |
|
198 |
|
198 | fprintf(outf,"%stmp%d=!%s %s\n\n",setpre,prepcnt,pr,buf); |
199 | } |
199 | } |
200 | 200 | ||
201 | void sp_pickone(char *p, int ptype) |
201 | void sp_pickone(char *p, int ptype) |
202 | { |
202 | { |
203 |
|
203 | sp_random(p,pt_int); |
204 | } |
204 | } |
205 | 205 | ||
206 | void sp_item(char *p, int ptype) |
206 | void sp_item(char *p, int ptype) |
207 | { |
207 | { |
208 |
|
208 | char *pp, *p2, buf[MAX_LINELEN+1]; |
209 |
|
209 | pp=strparchr(p,','); |
210 |
|
210 | if(pp==NULL) pp=""; else *pp++=0; |
211 |
|
211 | strncpy(buf,p,MAX_LINELEN);buf[MAX_LINELEN]=0; |
212 |
|
212 | strip_enclosing_par(buf); |
213 |
|
213 | if((p2=strstr(buf,".."))!=NULL) string_modify(buf,p2,p2+2," to "); |
214 |
|
214 | fprintf(outf,"%stmp%d=!item %s of %s\n\n",setpre,prepcnt,buf,pp); |
215 | } |
215 | } |
216 | 216 | ||
217 | void sp_items(char *p, int ptype) |
217 | void sp_items(char *p, int ptype) |
218 | { |
218 | { |
219 |
|
219 | fprintf(outf,"%stmp%d=!itemcnt %s\n\n",setpre,prepcnt,p); |
220 | } |
220 | } |
221 | 221 | ||
222 | void sp_randitem(char *p, int ptype) |
222 | void sp_randitem(char *p, int ptype) |
223 | { |
223 | { |
224 |
|
224 | fprintf(outf,"%stmp=!nonempty items %s\n\n\ |
225 | %stmp%d=!randitem $tmp\n",setpre,p,setpre,prepcnt); |
225 | %stmp%d=!randitem $tmp\n",setpre,p,setpre,prepcnt); |
226 | } |
226 | } |
227 | 227 | ||
228 | void sp_column(char *p, int ptype) |
228 | void sp_column(char *p, int ptype) |
229 | { |
229 | { |
230 |
|
230 | char *pp, *p2, buf[MAX_LINELEN+1]; |
231 |
|
231 | pp=strparchr(p,','); |
232 |
|
232 | if(pp==NULL) pp=""; else *pp++=0; |
233 |
|
233 | strncpy(buf,p,MAX_LINELEN);buf[MAX_LINELEN]=0; |
234 |
|
234 | strip_enclosing_par(buf); |
235 |
|
235 | if((p2=strstr(buf,".."))!=NULL) string_modify(buf,p2,p2+2," to "); |
236 |
|
236 | fprintf(outf,"%stmp=!translate internal $ $ to ; in %s\n\n\ |
237 | %stmp=!column %s of $tmp\n\ |
237 | %stmp=!column %s of $tmp\n\ |
238 | %stmp%d=!translate internal $\\\n$ to ; in $tmp\n", |
238 | %stmp%d=!translate internal $\\\n$ to ; in $tmp\n", |
239 | setpre,pp,setpre, buf, setpre, prepcnt); |
239 | setpre,pp,setpre, buf, setpre, prepcnt); |
240 | } |
240 | } |
241 | 241 | ||
242 | void sp_row(char *p, int ptype) |
242 | void sp_row(char *p, int ptype) |
243 | { |
243 | { |
244 |
|
244 | char *pp, *p2, buf[MAX_LINELEN+1]; |
245 |
|
245 | pp=strparchr(p,','); |
246 |
|
246 | if(pp==NULL) pp=""; else *pp++=0; |
247 |
|
247 | strncpy(buf,p,MAX_LINELEN);buf[MAX_LINELEN]=0; |
248 |
|
248 | strip_enclosing_par(buf); |
249 |
|
249 | fprintf(outf,"%stmp=!translate internal $ $ to ; in %s\n\n", |
250 |
|
250 | setpre,pp); |
251 |
|
251 | if(strstr(buf,"column")!=NULL) { |
252 |
|
252 | fprintf(outf,"%stmp%d=!select $tmp where %s\n\n",setpre,prepcnt,buf); |
253 |
|
253 | return; |
254 |
|
254 | } |
255 |
|
255 | while((p2=strstr(buf,".."))!=NULL) |
256 |
|
256 | string_modify(buf,p2,p2+2," to "); |
257 |
|
257 | fprintf(outf,"%stmp=!row %s of $tmp\n\ |
258 | %stmp%d=!translate internal $\\\n$ to ; in $tmp\n", |
258 | %stmp%d=!translate internal $\\\n$ to ; in $tmp\n", |
259 | setpre, buf, setpre, prepcnt); |
259 | setpre, buf, setpre, prepcnt); |
260 | } |
260 | } |
261 | 261 | ||
262 | void sp_rows(char *p, int ptype) |
262 | void sp_rows(char *p, int ptype) |
263 | { |
263 | { |
264 |
|
264 | fprintf(outf,"%stmp=!translate internal $ $ to ; in %s\n\n\ |
265 | %stmp%d=!rowcnt $tmp\n",setpre,p,setpre,prepcnt); |
265 | %stmp%d=!rowcnt $tmp\n",setpre,p,setpre,prepcnt); |
266 | } |
266 | } |
267 | 267 | ||
268 | void sp_randrow(char *p, int ptype) |
268 | void sp_randrow(char *p, int ptype) |
269 | { |
269 | { |
270 |
|
270 | fprintf(outf,"%stmp=!translate internal $ $ to ; in %s\n\n\ |
271 | %stmp=!nonempty rows $tmp\n\ |
271 | %stmp=!nonempty rows $tmp\n\ |
272 | %stmp=!randrow $tmp\n\ |
272 | %stmp=!randrow $tmp\n\ |
273 | %stmp%d=!translate internal $\\\n$ to ; in $tmp\n", |
273 | %stmp%d=!translate internal $\\\n$ to ; in $tmp\n", |
274 | setpre,p,setpre,setpre,setpre,prepcnt); |
274 | setpre,p,setpre,setpre,setpre,prepcnt); |
275 | } |
275 | } |
276 | 276 | ||
277 | void sp_mathexp_cut(char *p, int ptype) |
277 | void sp_mathexp_cut(char *p, int ptype) |
278 | { |
278 | { |
279 |
|
279 | char *p2; |
280 |
|
280 | p2=find_word_end(find_word_start(p)); if(isspace(*p2)) *p2++=0; |
281 |
|
281 | p2=find_word_start(p2); |
282 |
|
282 | fprintf(outf,"%stmp%d=!exec mathexp cut %s\\\n%s\n\n", |
283 |
|
283 | setpre,prepcnt,p,p2); |
284 | } |
284 | } |
285 | 285 | ||
286 | void sp_wims(char *p, int ptype) |
286 | void sp_wims(char *p, int ptype) |
287 | { |
287 | { |
288 |
|
288 | p=find_word_start(p); |
289 |
|
289 | if(!isalpha(*p) || strncasecmp(p,"ins",3)==0) |
290 |
|
290 | fprintf(outf,"%stmp%d=%s\n\n",setpre,prepcnt,p); |
291 |
|
291 | else |
292 |
|
292 | fprintf(outf,"%stmp%d=!%s\n\n",setpre,prepcnt,p); |
293 | } |
293 | } |
294 | 294 | ||
295 | struct specialfn specialfn[]={ |
295 | struct specialfn specialfn[]={ |
296 |
|
296 | {"asis", sp_asis}, |
297 |
|
297 | {"canvasdraw", sp_canvasdraw}, |
298 |
|
298 | {"column", sp_column}, |
299 |
|
299 | {"deriv", sp_diff}, |
300 |
|
300 | {"derivative", sp_diff}, |
301 |
|
301 | {"det", sp_det}, |
302 |
|
302 | {"determinant", sp_det}, |
303 |
|
303 | {"diff", sp_diff}, |
304 |
|
304 | {"draw", sp_draw}, |
305 |
|
305 | {"evaluate", sp_evalue}, |
306 |
|
306 | {"evalue", sp_evalue}, |
307 |
|
307 | {"htmlmath", sp_htmlmath}, |
308 |
|
308 | {"int", sp_int}, |
309 |
|
309 | {"integral", sp_int}, |
310 |
|
310 | {"integrate", sp_int}, |
311 |
|
311 | {"item", sp_item}, |
312 |
|
312 | {"items", sp_items}, |
313 |
|
313 | {"mathexp_cut", sp_mathexp_cut}, |
314 |
|
314 | {"maxima", sp_maxima}, |
315 |
|
315 | {"pari", sp_pari}, |
316 |
|
316 | {"pickone", sp_pickone}, |
317 |
|
317 | {"position", sp_positionof}, |
318 |
|
318 | {"positionof", sp_positionof}, |
319 |
|
319 | {"randint", sp_pickone}, |
320 |
|
320 | {"randitem", sp_randitem}, |
321 |
|
321 | {"random", sp_random}, |
322 |
|
322 | {"randomitem", sp_randitem}, |
323 |
|
323 | {"randomrow", sp_randrow}, |
324 |
|
324 | {"randrow", sp_randrow}, |
325 |
|
325 | {"row", sp_row}, |
326 |
|
326 | {"rows", sp_rows}, |
327 |
|
327 | {"shuffle", sp_shuffle}, |
328 |
|
328 | {"simplify", sp_simplify}, |
329 |
|
329 | {"slib", sp_slib}, |
330 |
|
330 | {"solve", sp_solve}, |
331 |
|
331 | {"teximg", sp_teximg}, |
332 |
|
332 | {"texmath", sp_texmath}, |
333 |
|
333 | {"wims", sp_wims}, |
334 |
|
334 | {"yacas", sp_yacas} |
335 | }; |
335 | }; |
336 | int specialfn_no=(sizeof(specialfn)/sizeof(specialfn[0])); |
336 | int specialfn_no=(sizeof(specialfn)/sizeof(specialfn[0])); |
337 | 337 | ||
338 | /* This routine treats special functions */ |
338 | /* This routine treats special functions */ |
339 | void parmprep(char *p,int ptype) |
339 | void parmprep(char *p,int ptype) |
340 | { |
340 | { |
341 |
|
341 | char *pp, *p2, *pn, namebuf[32], buf[MAX_LINELEN+1]; |
342 |
|
342 | int i; |
343 | 343 | ||
344 |
|
344 | while((pp=strchr(p,'\n'))!=NULL) *pp=' '; |
345 |
|
345 | for(pp=p;*pp && pp-p<MAX_LINELEN;pp++) { |
346 | /* function names */ |
346 | /* function names */ |
347 |
|
347 | if(isalpha(*pp)) { |
348 |
|
348 | for(i=0;i<30 && (isalnum(pp[i]) || pp[i]=='_');i++) namebuf[i]=pp[i]; |
349 |
|
349 | namebuf[i]=0; p2=find_word_start(pp+i); |
350 |
|
350 | if((pp>p && isalnum(*(pp-1))) || *p2!='(') { |
351 | /* if(*p2=='\\' && *(p2+1)=='(') ovlstrcpy(p2,p2+1); */ |
351 | /* if(*p2=='\\' && *(p2+1)=='(') ovlstrcpy(p2,p2+1); */ |
352 |
|
352 | pp=p2-1; continue; |
353 |
|
353 | } |
354 |
|
354 | pn=pp; pp=p2+1; p2=find_matching(pp,')'); |
355 |
|
355 | if(p2==NULL) { |
356 |
|
356 | sp_error("unmatched_parentheses"); |
357 |
|
357 | pp=p2; continue; |
358 |
|
358 | } |
359 |
|
359 | i=search_list(specialfn,specialfn_no,sizeof(specialfn[0]),namebuf); |
360 |
|
360 | if(i<0) { |
361 |
|
361 | pp--; continue; |
362 | } |
- | |
363 | *p2=0; |
- | |
364 | snprintf(buf,sizeof(buf),"%s",pp); |
- | |
365 | if(specialfn[i].processor!=sp_asis) parmprep(buf,ptype); |
- | |
366 | specialfn[i].processor(buf,ptype); |
- | |
367 | string_modify(p, pn, p2+1, "$(tmp%d)",prepcnt); prepcnt++; |
- | |
368 | pp=pn+6; |
- | |
369 | } |
362 | } |
- | 363 | *p2=0; |
|
- | 364 | snprintf(buf,sizeof(buf),"%s",pp); |
|
- | 365 | if(specialfn[i].processor!=sp_asis) parmprep(buf,ptype); |
|
- | 366 | specialfn[i].processor(buf,ptype); |
|
- | 367 | string_modify(p, pn, p2+1, "$(tmp%d)",prepcnt); prepcnt++; |
|
- | 368 | pp=pn+6; |
|
370 | } |
369 | } |
- | 370 | } |
|
371 | } |
371 | } |
372 | 372 |