source: trunk/SRC/ForOldVersion/updatekwd.pro @ 134

Last change on this file since 134 was 133, checked in by navarro, 18 years ago

english and nicer header (1)

  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
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 Sebastien Masson (smasson\@lodyc.jussieu.fr)
17;                      July 2005
18; @version $Id$
19;
20;-
21; if ex is a structure...
22IF 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, 'discret']            & new = [new, 'discrete']
38;  old = [old, ''] & new = [new, '']
39; supress the first dummy argument and make sure we use lowcase
40  old = strtrim(strlowcase(old[1:*]), 2)
41  new = strtrim(strlowcase(new[1:*]), 2)
42
43; what are the keywords of the present routine?
44;
45; in which routine are we???
46  help, calls = rname
47  rname = rname[0]
48  rname = strmid(rname, 0, strpos(rname, ' '))
49; is this routine a function?
50  fctlist = routine_info(/functions)
51  dummy = where(fctlist EQ rname, count)
52; keywords of the present routine
53  kwds = routine_info(rname, /parameters, functions = count)
54  IF kwds.num_kw_args NE 0 THEN BEGIN
55    kwds = strlowcase(kwds.kw_args)
56;
57; for all tags of ex structure
58; if one of them is included in the old list and if its new version
59; is among the keywords of the current routine then force the definition
60; of the new keyword with the old one.
61;
62    alltags = strlowcase(tag_names(ex))
63    FOR i = 0, n_elements(alltags)-1 DO BEGIN
64      isold = (where(old EQ alltags[i], count))[0]
65      IF count EQ 1 THEN BEGIN
66        dummy = where(kwds EQ new[isold], count)
67        IF count EQ 1 THEN BEGIN
68          dummy = execute(new[isold] + ' = ex.' + alltags[i])
69;           dummy = execute('ex = get_extra(' + new[isold] + ' = ex.' $
70;                           + alltags[i] + ', _extra = ex)')
71        ENDIF
72      ENDIF
73    ENDFOR
74  ENDIF
75;
76ENDIF
Note: See TracBrowser for help on using the repository browser.