1 /* $Id: whatnow.c 7526 2005-12-09 21:04:53Z kb $
2 
3 Copyright (C) 2000  The PARI group.
4 
5 This file is part of the PARI/GP package.
6 
7 PARI/GP is free software; you can redistribute it and/or modify it under the
8 terms of the GNU General Public License as published by the Free Software
9 Foundation. It is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY WHATSOEVER.
11 
12 Check the License for details. You should have received a copy of it, along
13 with the package; see the file 'COPYING'. If not, write to the Free Software
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
15 
16 #include "pari.h"
17 #include "paripriv.h"
18 #include "../language/anal.h"
19 
20 typedef struct whatnow_t
21 {
22   char *name, *oldarg, *newarg;
23 } whatnow_t;
24 
25 #define SAME NULL
26 #define REMOV (char *)1L
27 #define _REMOV {REMOV,NULL,NULL}
28 #define _SAME  {SAME,NULL,NULL}
29 
30 /* generated by PERL script ../util/dico */
31 static const whatnow_t whatnowlist[]={
32 _SAME,
33 _SAME,
34 _SAME,
35 _SAME,
36 {"elladd","(e,z1,z2)","(e,z1,z2)"},
37 _SAME,
38 {"matadjoint","(x)","(x)"},
39 _SAME,
40 {"ellak","(e,n)","(e,n)"},
41 _SAME,
42 {"algdep","(x,n,dec)","(x,n,dec)"},
43 {"nfalgtobasis","(nf,x)","(nf,x)"},
44 {"ellan","(e,n)","(e,n)"},
45 {"ellap","(e,n)","(e,n)"},
46 {"ellap","(e,n)","(e,n,1)"},
47 {"padicappr","(x,a)","(x,a)"},
48 _SAME,
49 _SAME,
50 _SAME,
51 {"matcompanion","(x)","(x)"},
52 _SAME,
53 _SAME,
54 {"nfbasis","(x)","(x)"},
55 {"nfbasis","(x)","(x,2)"},
56 {"nfbasistoalg","(nf,x)","(nf,x)"},
57 _SAME,
58 _SAME,
59 _SAME,
60 _SAME,
61 _SAME,
62 _SAME,
63 {"ellbil","(e,z1,z2)","(e,z1,z2)"},
64 {"binomial","(x,y)","(x,y)"},
65 _SAME,
66 _SAME,
67 {"contfrac","(x,lmax)","(x,,lmax)"},
68 {"factor","(x,lim)","(x,lim)"},
69 {"bnfcertify","(bnf)","(bnf)"},
70 {"bnfunit","(bnf)","(bnf)"},
71 {"bnfclassunit","(P)","(P,2)"},
72 {"bnfclassunit","(P)","(P,1)"},
73 {"bnfclassunit","(P)","(P)"},
74 {"quadclassunit","(D,c1,c2,g)","(D,,[c1,c2,g])"},
75 {"bnfinit","(P)","(P,2)"},
76 {"bnfinit","(P)","(P,1)"},
77 {"bnfinit","(P)","(P)"},
78 {"bnfnarrow","(bnf)","(bnf)"},
79 {"bnrclass","(bnf,ideal)","(bnf,ideal)"},
80 {"bnrclass","(bnf,ideal)","(bnf,ideal,1)"},
81 {"bnrclass","(bnf,ideal)","(bnf,ideal,2)"},
82 {"quadclassunit","(D)","(D)"},
83 {"sizebyte","(x)","(x)"},
84 _SAME,
85 _SAME,
86 {"contfrac","(x)","(x)"},
87 {"contfrac","(b,x)","(x,b)"},
88 _SAME,
89 {"charpoly","(x,y)","(x,y)"},
90 {"charpoly","(x,y)","(x,y,1)"},
91 {"charpoly","(x,y)","(x,y,2)"},
92 {"ellchangecurve","(x,y)","(x,y)"},
93 _SAME,
94 {"ellchangepoint","(x,y)","(x,y)"},
95 {"qfbclassno","(x)","(x)"},
96 {"qfbclassno","(x)","(x,1)"},
97 {"polcoeff","(x,s)","(x,s)"},
98 {"x*y","(x,y)",""},
99 {"component","(x,s)","(x,s)"},
100 {"polcompositum","(pol1,pol2)","(pol1,pol2)"},
101 {"polcompositum","(pol1,pol2)","(pol1,pol2,1)"},
102 {"qfbcompraw","(x,y)","(x,y)"},
103 _SAME,
104 {"bnrconductor","(a1)","(a1)"},
105 {"bnrconductorofchar","(bnr,chi)","(bnr,chi)"},
106 _SAME,
107 _SAME,
108 _SAME,
109 {"serconvol","(x,y)","(x,y)"},
110 _SAME,
111 {"core","(x)","(x,1)"},
112 _SAME,
113 {"coredisc","(x)","(x,1)"},
114 _SAME,
115 _SAME,
116 {"truncate","(x)","(x,&e)"},
117 {"polcyclo","(n)","(n)"},
118 {"factorback","(fa)","(fa)"},
119 {"bnfdecodemodule","(nf,fa)","(nf,fa)"},
120 {"poldegree","(x)","(x)"},
121 {"denominator","(x)","(x)"},
122 {"lindep","(x)","(x,-1)"},
123 _SAME,
124 {"matdet","(x)","(x)"},
125 {"matdet","(x)","(x,1)"},
126 {"matdetint","(x)","(x)"},
127 {"matdiagonal","(x)","(x)"},
128 _SAME,
129 _SAME,
130 _SAME,
131 _SAME,
132 _SAME,
133 {"poldisc","(x)","(x)"},
134 {"nfdisc","(x)","(x)"},
135 {"nfdisc","(x)","(x,2)"},
136 {"bnrdisc","(bnr,subgroup)","(bnr,subgroup)"},
137 {"bnrdisc","(bnr)","(bnr,,,2)"},
138 {"bnrdisclist","(bnf,list)","(bnf,list)"},
139 {"bnrdisclist","(bnf,arch,bound)","(bnf,bound,arch)"},
140 {"bnrdisclist","(bnf,bound)","(bnf,bound,,1)"},
141 {"bnrdisclist","(bnf,bound)","(bnf,bound)"},
142 {"bnrdisc","(bnr,subgroup)","(bnr,subgroup,,1)"},
143 {"bnrdisc","(bnr,subgroup)","(bnr,subgroup,,3)"},
144 _SAME,
145 {"divrem","(x,y)","(x,y)"},
146 {"sumdiv","(n,X,expr)","(n,X,expr)"},
147 {"mateigen","(x)","(x)"},
148 _SAME,
149 _SAME,
150 _SAME,
151 {"Euler","",""},
152 _SAME,
153 _SAME,
154 {"vecextract","(x,y)","(x,y)"},
155 {"factorial","(x)","(x)"},
156 {"factorcantor","(x,p)","(x,p)"},
157 {"factorff","(x,p,a)","(x,p,a)"},
158 {"factormod","(x,p)","(x,p)"},
159 _SAME,
160 {"nfbasis","(x,p)","(x,,p)"},
161 {"nfdisc","(x,p)","(x,,p)"},
162 {"polred","(x,p)","(x,,p)"},
163 {"polred","(x,p)","(x,2,p)"},
164 _SAME,
165 _SAME,
166 {"factorpadic","(x,p,r)","(x,p,r,1)"},
167 {"factor","(x,l,hint)","(x)"},
168 {"factor","(x,l,hint)","(x)"},
169 {"fibonacci","(x)","(x)"},
170 _SAME,
171 _SAME,
172 _SAME,
173 _SAME,
174 _SAME,
175 _SAME,
176 {"ffinit","(p,n)","(p,n)"},
177 _SAME,
178 {"polgalois","(x)","(x)"},
179 {"nfgaloisapply","(nf,aut,x)","(nf,aut,x)"},
180 {"nfgaloisconj","(nf)","(nf)"},
181 {"nfgaloisconj","(nf)","(nf,2)"},
182 {"nfgaloisconj","","(nf,1)"},
183 {"gammah","(x)","(x)"},
184 _SAME,
185 {"matsolve","(a,b)","(a,b)"},
186 {"matsolvemod","(M,D,Y)","(M,D,Y)"},
187 {"matsolvemod","(M,D,Y)","(M,D,Y,1)"},
188 _SAME,
189 _SAME,
190 _SAME,
191 _SAME,
192 _SAME,
193 {"ellglobalred","(x,y)","(x,y)"},
194 _REMOV,
195 {"qfbhclassno","(x)","(x)"},
196 {"ellheight","(e,x)","(e,x)"},
197 {"ellheight","(e,x)","(e,x,1)"},
198 {"mathnf","(x)","(x)"},
199 {"mathnf","(x)","(x,1)"},
200 _REMOV,
201 {"mathnfmod","(x,d)","(x,d)"},
202 {"mathnfmodid","(x,d)","(x,d)"},
203 {"mathnf","(x)","(x,3)"},
204 {"mathess","(x)","(x)"},
205 {"hilbert","(x,y)","(x,y)"},
206 {"mathilbert","(n)","(n)"},
207 {"hilbert","(x,y,p)","(x,y,p)"},
208 {"vector","(n,X,expr)","(n,X,expr)"},
209 _SAME,
210 {"I","",""},
211 _SAME,
212 {"idealaddtoone","(nf,list)","(nf,list)"},
213 {"idealaddtoone","(nf,x,y)","(nf,x,y)"},
214 _SAME,
215 {"idealappr","(nf,x)","(nf,x,1)"},
216 _SAME,
217 _SAME,
218 _SAME,
219 {"idealdiv","(nf,x,y)","(nf,x,y,1)"},
220 _SAME,
221 {"idealhnf","(nf,x)","(nf,x)"},
222 {"idealhnf","(nf,x)","(nf,x)"},
223 _SAME,
224 _SAME,
225 {"idealinv","(nf,x)","(nf,x,1)"},
226 _SAME,
227 _SAME,
228 {"ideallistarch","(nf,list,arch)","(nf,list,arch)"},
229 {"ideallist","(nf,list)","(nf,list,2)"},
230 {"ideallistarch","","(nf,list,arch)"},
231 {"ideallistarch","","(nf,list,arch)"},
232 {"ideallist","","(nf,list,3)"},
233 {"ideallist","(nf,bound)","(nf,bound)"},
234 {"ideallist","(nf,bound)","(nf,bound,1)"},
235 {"idealred","(nf,x,vdir)","(nf,x,vdir)"},
236 _SAME,
237 {"idealmul","(nf,x,y)","(nf,x,y,1)"},
238 _SAME,
239 _SAME,
240 {"idealpow","(nf,x,y)","(nf,x,y,1)"},
241 _SAME,
242 {"idealtwoelt","(nf,x,a)","(nf,x,a)"},
243 _SAME,
244 {"matid","(n)","(n)"},
245 _SAME,
246 _SAME,
247 {"matimage","(x)","(x)"},
248 {"matimage","(x)","(x,1)"},
249 {"matimagecompl","(x)","(x)"},
250 _SAME,
251 _REMOV,
252 _REMOV,
253 _REMOV,
254 {"incgam","(s,x,y)","(s,x,y)"},
255 {"matindexrank","(x)","(x)"},
256 {"vecsort","(x)","(x,,1)"},
257 {"nfinit","(pol)","(pol)"},
258 {"nfinit","(x)","(x,2)"},
259 {"nfinit","(x)","(x,3)"},
260 {"ellinit","(x)","(x)"},
261 {"zetakinit","(x)","(x)"},
262 {"intformal","(x,y)","(x,y)"},
263 {"matintersect","(x,y)","(x,y)"},
264 {"intnum","(x=a,b,s)","(x=a,b,s,1)"},
265 {"intnum","(x=a,b,s)","(x=a,b,s,2)"},
266 _SAME,
267 {"intnum","(x=a,b,s)","(x=a,b,s,3)"},
268 {"matinverseimage","(x,y)","(x,y)"},
269 {"matisdiagonal","(x)","(x)"},
270 {"isfundamental","(x)","(x)"},
271 {"nfisideal","(nf,x)","(nf,x)"},
272 {"nfisincl","(x,y)","(x,y)"},
273 {"nfisincl","(nf1,nf2)","(nf1,nf2,1)"},
274 {"polisirreducible","(x)","(x)"},
275 {"nfisisom","(x,y)","(x,y)"},
276 {"nfisisom","(x,y)","(x,y)"},
277 {"ellisoncurve","(e,x)","(e,x)"},
278 _SAME,
279 {"bnfisprincipal","(bnf,x)","(bnf,x,0)"},
280 {"bnfisprincipal","(bnf,x)","(bnf,x,2)"},
281 {"bnfisprincipal","(bnf,x)","(bnf,x)"},
282 {"bnfisprincipal","(bnf,x)","(bnf,x,3)"},
283 {"bnrisprincipal","(bnf,x)","(bnf,x)"},
284 _SAME,
285 {"ispseudoprime","(x)","(x)"},
286 {"sqrtint","(x)","(x)"},
287 {"setisset","(x)","(x)"},
288 {"issquarefree","(x)","(x)"},
289 _SAME,
290 {"bnfisunit","(bnf,x)","(bnf,x)"},
291 {"qfjacobi","(x)","(x)"},
292 {"besseljh","(n,x)","(n,x)"},
293 {"ellj","(x)","(x)"},
294 _REMOV,
295 {"besselk","(nu,x)","(nu,x)"},
296 {"besselk","(nu,x)","(nu,x,1)"},
297 {"matker","(x)","(x)"},
298 {"matker","(x)","(x,1)"},
299 {"matkerint","(x)","(x)"},
300 {"matkerint","(x)","(x,1)"},
301 _REMOV,
302 {"kronecker","(x,y)","(x,y)"},
303 _REMOV,
304 {"zetak","(nfz,s)","(nfz,s,1)"},
305 {"serlaplace","(x)","(x)"},
306 _SAME,
307 {"pollegendre","(n)","(n)"},
308 _SAME,
309 _SAME,
310 {"vecsort","(x)","(x,,2)"},
311 _SAME,
312 _SAME,
313 {"lindep","(x)","(x,1)"},
314 {"qflll","(x)","(x)"},
315 _REMOV,
316 {"qflll","(x)","(x,8)"},
317 {"qflllgram","(x)","(x)"},
318 _REMOV,
319 {"qflllgram","(x)","(x,8)"},
320 {"qflllgram","(x)","(x,1)"},
321 {"qflllgram","(x)","(x,4)"},
322 {"qflllgram","(x)","(x,5)"},
323 {"qflll","(x)","(x,1)"},
324 {"qflll","(x)","(x,2)"},
325 {"qflll","(x)","(x,4)"},
326 {"qflll","(x)","(x,5)"},
327 _REMOV,
328 {"log","(x)","(x)"},
329 _SAME,
330 {"elllocalred","(e)","(e)"},
331 _SAME,
332 {"log","(x)","(x,1)"},
333 {"elllseries","(e,s,N,A)","(e,s,A)"},
334 {"bnfmake","(sbnf)","(sbnf)"},
335 {"Mat","(x)","(x)"},
336 {"vecextract","(x,y,z)","(x,y,z)"},
337 {"ellheightmatrix","(e,x)","(e,x)"},
338 _SAME,
339 _SAME,
340 {"matrixqz","(x,p)","(x,-1)"},
341 {"matrixqz","(x,p)","(x,-2)"},
342 _SAME,
343 _SAME,
344 _SAME,
345 {"idealmin","(nf,ix,vdir)","(nf,ix,vdir)"},
346 {"qfminim","(x,bound,maxnum)","(x,bound,maxnum)"},
347 {"qfminim","(x,bound)","(x,bound,,1)"},
348 {"Mod","(x,y)","(x,y)"},
349 {"Mod","(x,y,p)","(x,y,1)"},
350 _SAME,
351 {"gcd","(x,y)","(x,y,1)"},
352 {"moebius","(n)","(n)"},
353 _SAME,
354 _SAME,
355 _SAME,
356 {"nfeltdiv","(nf,a,b)","(nf,a,b)"},
357 {"nfeltdiveuc","(nf,a,b)","(nf,a,b)"},
358 {"nfeltdivrem","(nf,a,b)","(nf,a,b)"},
359 {"nfhnf","(nf,x)","(nf,x)"},
360 {"nfhnfmod","(nf,x,detx)","(nf,x,detx)"},
361 {"nfeltmod","(nf,a,b)","(nf,a,b)"},
362 {"nfeltmul","(nf,a,b)","(nf,a,b)"},
363 {"nfeltpow","(nf,a,k)","(nf,a,k)"},
364 {"nfeltreduce","(nf,a,id)","(nf,a,id)"},
365 {"nfsnf","(nf,x)","(nf,x)"},
366 {"nfeltval","(nf,a,pr)","(nf,a,pr)"},
367 _SAME,
368 _SAME,
369 {"qfbnucomp","(x,y,l)","(x,y,l)"},
370 _SAME,
371 {"numerator","(x)","(x)"},
372 {"qfbnupow","(x,n)","(x,n)"},
373 {"O","(x)","(x)"},
374 _SAME,
375 {"ellordinate","(e,x)","(e,x)"},
376 {"znorder","(x)","(x)"},
377 {"ellorder","(e,x)","(e,x)"},
378 {"polredord","(x)","(x)"},
379 _SAME,
380 {"matpascal","(n)","(n)"},
381 {"qfperfection","(a)","(a)"},
382 {"numtoperm","(n,k)","(n,k)"},
383 {"permtonum","(vect)","(vect)"},
384 {"qfbprimeform","(x,p)","(x,p)"},
385 {"eulerphi","(x)","(x)"},
386 {"Pi","",""},
387 {"contfracpnqn","(x)","(x)"},
388 {"ellztopoint","(e,z)","(e,z)"},
389 {"polinterpolate","(xa,ya,x)","(xa,ya,p)"},
390 _SAME,
391 {"polred","(x)","(x,2)"},
392 _SAME,
393 {"polredabs","(x)","(x,1)"},
394 {"polredabs","(x)","(x,4)"},
395 {"polredabs","(x)","(x,8)"},
396 {"polredabs","(x)","(x,2)"},
397 _SAME,
398 {"variable","(x)","(x)"},
399 {"Pol","(x,v)","(x,v)"},
400 _SAME,
401 {"polylog","(m,x)","(m,x,1)"},
402 {"polylog","(m,x)","(m,x,2)"},
403 {"polylog","(m,x)","(m,x,3)"},
404 {"Polrev","(x,v)","(x,v)"},
405 {"polzagier","(n,m)","(n,m)"},
406 {"ellpow","(e,x,n)","(e,x,n)"},
407 {"qfbpowraw","(x,n)","(x,n)"},
408 {"precision","(x,n)","(x,n)"},
409 _SAME,
410 _SAME,
411 {"idealprimedec","(nf,p)","(nf,p)"},
412 _SAME,
413 {"znprimroot","(n)","(n)"},
414 {"idealprincipal","(nf,x)","(nf,x)"},
415 {"ideleprincipal","(nf,x)","(nf,x)"},
416 {"prod","(x,X=a,b,expr)","(X=a,b,expr,x)"},
417 _SAME,
418 _SAME,
419 {"prodinf","(X=a,expr)","(X=a,expr,1)"},
420 _SAME,
421 {"Qfb","(a,b,c)","(a,b,c)"},
422 {"Qfb","(a,b,c,d)","(a,b,c,d)"},
423 _SAME,
424 _SAME,
425 _SAME,
426 _SAME,
427 {"matrank","(x)","(x)"},
428 {"bnrclassno","(bnf,x)","(bnf,x)"},
429 {"bnrclassnolist","(bnf,liste)","(bnf,liste)"},
430 _SAME,
431 {"polrecip","(x)","(x)"},
432 {"qfbred","(x)","(x)"},
433 {"qfbred","(x)","(x)"},
434 {"qfbred","(x,d)","(x,2,,d)"},
435 {"poldiscreduced","(f)","(f)"},
436 {"quadregulator","(x)","(x)"},
437 _SAME,
438 {"polresultant","(x,y)","(x,y)"},
439 {"polresultant","(x,y)","(x,y,1)"},
440 {"serreverse","(x)","(x)"},
441 {"qfbred","(x)","(x,1)"},
442 {"qfbred","(x,d)","(x,3,,d)"},
443 {"round","(x)","(x,&e)"},
444 _SAME,
445 {"rnfdisc","(nf,pol)","(nf,pol)"},
446 _SAME,
447 {"rnfequation","(nf,pol)","(nf,pol,1)"},
448 {"rnfhnfbasis","(bnf,order)","(bnf,order)"},
449 _SAME,
450 _SAME,
451 _SAME,
452 _SAME,
453 _SAME,
454 {"polrootsmod","(x,p)","(x,p)"},
455 {"polrootsmod","(x,p)","(x,p,1)"},
456 {"polrootspadic","(x,p,r)","(x,p,r)"},
457 {"polroots","(x)","(x)"},
458 {"nfrootsof1","(nf)","(nf)"},
459 {"polroots","(x)","(x,1)"},
460 _SAME,
461 {"round","(x)","(x,&e)"},
462 {"Ser","(x,v)","(x,v)"},
463 {"Set","(x)","(x)"},
464 _SAME,
465 _SAME,
466 _SAME,
467 _SAME,
468 _SAME,
469 _SAME,
470 _SAME,
471 _SAME,
472 {"sigma","(k,x)","(x,k)"},
473 _SAME,
474 {"qfsign","(x)","(x)"},
475 {"bnfsignunit","(bnf)","(bnf)"},
476 {"factormod","(x,p)","(x,p,1)"},
477 _SAME,
478 _SAME,
479 _SAME,
480 {"sizedigit","(x)","(x)"},
481 {"nfbasis","(x)","(x,1)"},
482 {"bnfinit","(x)","(x,3)"},
483 {"nfdisc","(x)","(x,1)"},
484 {"factor","(x)","(x,0)"},
485 {"ellinit","(x)","(x,1)"},
486 {"polred","(x)","(x,1)"},
487 {"polred","(x)","(x,3)"},
488 {"matsnf","(x)","(x)"},
489 {"matsnf","(x)","(x,1)"},
490 {"matsnf","(x)","(x,4)"},
491 {"matsnf","(x)","(x,2)"},
492 _SAME,
493 {"vecsort","(x)","(x)"},
494 _SAME,
495 {"qfgaussred","(x)","(x)"},
496 _SAME,
497 {"gcd","(x,y)","(x,y,2)"},
498 {"polsturm","(x)","(x)"},
499 {"polsturm","(x,a,b)","(x,a,b)"},
500 {"polsubcyclo","(p,d)","(p,d)"},
501 {"ellsub","(e,a,b)","(e,a,b)"},
502 _SAME,
503 {"sum","(x,X=a,b,expr)","(X=a,b,expr,x)"},
504 _SAME,
505 {"sumalt","(X=a,expr)","(X=a,expr,1)"},
506 _SAME,
507 _SAME,
508 {"sumpos","(X=a,expr)","(X=a,expr,1)"},
509 {"matsupplement","(x)","(x)"},
510 {"polsylvestermatrix","(x,y)","(x,y)"},
511 _SAME,
512 _SAME,
513 {"elltaniyama","(e)","(e)"},
514 _SAME,
515 {"poltchebi","(n)","(n)"},
516 {"teichmuller","(x)","(x)"},
517 _SAME,
518 _SAME,
519 _REMOV,
520 _REMOV,
521 {"elltors","(e)","(e)"},
522 _SAME,
523 {"mattranspose","(x)","(x)"},
524 {"truncate","(x)","(x)"},
525 {"poltschirnhaus","(x)","(x)"},
526 _REMOV,
527 {"quadunit","(x)","(x)"},
528 _SAME,
529 _SAME,
530 {"Vec","(x)","(x)"},
531 {"vecsort","(x)","(x,,1)"},
532 {"vecsort","(x)","(x,,2)"},
533 _SAME,
534 _SAME,
535 _SAME,
536 _SAME,
537 {"vectorv","(n,X,expr)","(n,X,expr)"},
538 {"ellwp","(e)","(e)"},
539 {"weber","(x)","(x)"},
540 {"weber","(x)","(x,2)"},
541 _SAME,
542 {"ellpointtoz","(e,P)","(e,P)"},
543 _SAME,
544 _SAME,
545 {"ideallog","(nf,x,bid)","(nf,x,bid)"},
546 {"idealstar","(nf,I)","(nf,I)"},
547 {"idealstar","(nf,id)","(nf,id,1)"},
548 {"idealstar","(nf,id)","(nf,id,2)"},
549 _SAME,
550 
551 _SAME,
552 {"plotbox","(x,a)","(x,a)"},
553 {"plotcolor","(w,c)","(w,c)"},
554 {"plotcursor","(w)","(w)"},
555 _SAME,
556 {"plotdraw","(list)","(list)"},
557 {"plotinit","(w,x,y)","(w,x,y)"},
558 _SAME,
559 {"plotkill","(w)","(w)"},
560 {"plotlines","(w,x2,y2)","(w,x2,y2)"},
561 {"plotlines","(w,x2,y2)","(w,x2,y2)"},
562 {"plotmove","(w,x,y)","(w,x,y)"},
563 _SAME,
564 _SAME,
565 {"ploth","(X=a,b,expr)","(X=a,b,expr,1)"},
566 {"ploth","(X=a,b,expr)","(X=a,b,expr)"},
567 _SAME,
568 {"plotpoints","(w,x,y)","(w,x,y)"},
569 {"plotpoints","(w,x,y)","(w,x,y)"},
570 {"psdraw","(list)","(list)"},
571 {"psploth","(X=a,b,expr)","(X=a,b,expr)"},
572 {"psploth","(X=a,b,expr)","(X=a,b,expr,1)"},
573 {"psplothraw","(listx,listy)","(listx,listy)"},
574 {"printp","(x)","(x)"},
575 {"printp1","(x)","(x)"},
576 _SAME,
577 _SAME,
578 {"plotrbox","(w,dx,dy)","(w,dx,dy)"},
579 {"input","(x)","(x)"},
580 {"plotrline","(w,dx,dy)","(w,dx,dy)"},
581 {"plotrlines","(w,dx,dy)","(w,dx,dy,1)"},
582 {"plotrmove","(w,dx,dy)","(w,dx,dy)"},
583 {"plotrpoint","(w,dx,dy)","(w,dx,dy)"},
584 {"plotrpoints","(w,dx,dy)","(w,dx,dy)"},
585 {"plotscale","(w,x1,x2,y1,y2)","(w,x1,x2,y1,y2)"},
586 {"default","(n)","(realprecision,n)"},
587 {"default","(n)","(seriesprecision,n)"},
588 {"type","(x,t)","(x,t)"},
589 {"plotstring","(w,x)","(w,x)"},
590 _SAME,
591 {"printtex","(x)","(x)"},
592 _SAME
593 };
594 
595 /* If flag = 0 (default): check if s existed in 1.39.15 and print verbosely
596  * the answer.
597  * If flag > 0: silently return n+1 if function changed, 0 otherwise.
598  *   (where n is the index of s in whatnowlist).
599  * If flag < 0: -flag-1 is the index in whatnowlist
600  */
601 int
whatnow(char * s,int flag)602 whatnow(char *s, int flag)
603 {
604   int n;
605   char *def;
606   whatnow_t wp;
607   entree *ep;
608 
609   if (flag < 0) { n = -flag; flag = 0; }
610   else
611   {
612     if (flag && strlen(s)==1) return 0; /* special case "i" and "o" */
613     if (!is_identifier(s) || !is_entry_intern(s,funct_old_hash,NULL))
614     {
615       if (flag) return 0;
616       pari_err(talker,"as far as I can recall, this function never existed");
617     }
618     n = 0;
619     do
620       def = (oldfonctions[n++]).name;
621     while (def && strcmp(def,s));
622     if (!def)
623     {
624       int m=0;
625       do
626         def = (functions_oldgp[m++]).name;
627       while (def && strcmp(def,s));
628       n += m - 1;
629     }
630   }
631 
632   wp=whatnowlist[n-1]; def=wp.name;
633   if (def == SAME)
634   {
635     if (flag) return 0;
636     pari_err(talker,"this function did not change");
637   }
638   if (flag) return n;
639 
640   if (def == REMOV)
641     pari_err(talker,"this function was suppressed");
642   if (!strcmp(def,"x*y"))
643   {
644     pariprintf("  %s is now called *.\n\n",s);
645     pariprintf("    %s%s ===> %s%s\n\n",s,wp.oldarg,wp.name,wp.newarg);
646     return 1;
647   }
648   ep = is_entry(wp.name);
649   if (!ep) pari_err(bugparier,"whatnow");
650   pariputs("New syntax: "); term_color(c_ERR);
651   pariprintf("%s%s ===> %s%s\n\n",s,wp.oldarg,wp.name,wp.newarg);
652   term_color(c_HELP);
653   print_text(ep->help); pariputc('\n');
654   term_color(c_NONE); return 1;
655 }
656