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