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