1 | ;+ |
---|
2 | ; |
---|
3 | ; @file_comments |
---|
4 | ; compatibility with old keywords |
---|
5 | ; if needed, force the definition of new keywords with the old ones. |
---|
6 | ; |
---|
7 | ; @categories compatibility with previous version |
---|
8 | ; |
---|
9 | ; @examples |
---|
10 | ; IDL> \@updatekwd |
---|
11 | ; (must be insert as an include in a procedure or function) |
---|
12 | ; |
---|
13 | ; @restrictions the compatibility can be made only if the keyword |
---|
14 | ; given through _extra are given with their complete name |
---|
15 | ; |
---|
16 | ; @history |
---|
17 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
18 | ; July 2005 |
---|
19 | ; @version |
---|
20 | ; $Id$ |
---|
21 | ; |
---|
22 | ;- |
---|
23 | ; |
---|
24 | ; if ex is a structure... |
---|
25 | IF size(ex, /type) EQ 8 THEN BEGIN |
---|
26 | ; |
---|
27 | ; list of the old and new keywords |
---|
28 | ; |
---|
29 | old = ['dummy'] & new = ['dummy'] |
---|
30 | old = [old, 'boite'] & new = [new, 'boxzoom'] |
---|
31 | old = [old, 'carte'] & new = [new, 'realcont'] |
---|
32 | old = [old, 'cont_thick'] & new = [new, 'coast_thick'] |
---|
33 | old = [old, 'def_key_periodique'] & new = [new, 'periodic'] |
---|
34 | old = [old, 'grille'] & new = [new, 'gridtype'] |
---|
35 | old = [old, 'hzsurht'] & new = [new, 'zratio'] |
---|
36 | old = [old, 'nocouleur'] & new = [new, 'nofill'] |
---|
37 | old = [old, 'petit'] & new = [new, 'small'] |
---|
38 | old = [old, 'petitdessin'] & new = [new, 'small'] |
---|
39 | old = [old, 'ysurx'] & new = [new, 'yxaspect'] |
---|
40 | old = [old, 'discret'] & new = [new, 'discrete'] |
---|
41 | ; old = [old, ''] & new = [new, ''] |
---|
42 | ; supress the first dummy argument and make sure we use low case |
---|
43 | old = strtrim(strlowcase(old[1:*]), 2) |
---|
44 | new = strtrim(strlowcase(new[1:*]), 2) |
---|
45 | ; |
---|
46 | ; what are the keywords of the present routine? |
---|
47 | ; |
---|
48 | ; in which routine are we??? |
---|
49 | help, calls = rname |
---|
50 | rname = rname[0] |
---|
51 | rname = strmid(rname, 0, strpos(rname, ' ')) |
---|
52 | ; is this routine a function? |
---|
53 | fctlist = routine_info(/functions) |
---|
54 | dummy = where(fctlist EQ rname, count) |
---|
55 | ; keywords of the present routine |
---|
56 | kwds = routine_info(rname, /parameters, functions = count) |
---|
57 | IF kwds.num_kw_args NE 0 THEN BEGIN |
---|
58 | kwds = strlowcase(kwds.kw_args) |
---|
59 | ; |
---|
60 | ; for all tags of ex structure |
---|
61 | ; if one of them is included in the old list and if its new version |
---|
62 | ; is among the keywords of the current routine then force the definition |
---|
63 | ; of the new keyword with the old one. |
---|
64 | ; |
---|
65 | alltags = strlowcase(tag_names(ex)) |
---|
66 | FOR i = 0, n_elements(alltags)-1 DO BEGIN |
---|
67 | isold = (where(old EQ alltags[i], count))[0] |
---|
68 | IF count EQ 1 THEN BEGIN |
---|
69 | dummy = where(kwds EQ new[isold], count) |
---|
70 | IF count EQ 1 THEN BEGIN |
---|
71 | dummy = execute(new[isold] + ' = ex.' + alltags[i]) |
---|
72 | ; dummy = execute('ex = get_extra(' + new[isold] + ' = ex.' $ |
---|
73 | ; + alltags[i] + ', _extra = ex)') |
---|
74 | ENDIF |
---|
75 | ENDIF |
---|
76 | ENDFOR |
---|
77 | ENDIF |
---|
78 | ; |
---|
79 | ENDIF |
---|