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

Last change on this file since 231 was 231, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

  • 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;
22; if ex is a structure...
23IF size(ex, /type) EQ 8 THEN BEGIN
24;
25; list of the old and new keywords
26;
27  old = ['dummy'] & new = ['dummy']
28  old = [old, 'boite']              & new = [new, 'boxzoom']
29  old = [old, 'carte']              & new = [new, 'realcont']
30  old = [old, 'cont_thick']         & new = [new, 'coast_thick']
31  old = [old, 'def_key_periodique'] & new = [new, 'periodic']
32  old = [old, 'grille']             & new = [new, 'gridtype']
33  old = [old, 'hzsurht']            & new = [new, 'zratio']
34  old = [old, 'nocouleur']          & new = [new, 'nofill']
35  old = [old, 'petit']              & new = [new, 'small']
36  old = [old, 'petitdessin']        & new = [new, 'small']
37  old = [old, 'ysurx']              & new = [new, 'yxaspect']
38  old = [old, 'discret']            & new = [new, 'discrete']
39;  old = [old, ''] & new = [new, '']
40; supress the first dummy argument and make sure we use low case
41  old = strtrim(strlowcase(old[1:*]), 2)
42  new = strtrim(strlowcase(new[1:*]), 2)
43
44; what are the keywords of the present routine?
45;
46; in which routine are we???
47  help, calls = rname
48  rname = rname[0]
49  rname = strmid(rname, 0, strpos(rname, ' '))
50; is this routine a function?
51  fctlist = routine_info(/functions)
52  dummy = where(fctlist EQ rname, count)
53; keywords of the present routine
54  kwds = routine_info(rname, /parameters, functions = count)
55  IF kwds.num_kw_args NE 0 THEN BEGIN
56    kwds = strlowcase(kwds.kw_args)
57;
58; for all tags of ex structure
59; if one of them is included in the old list and if its new version
60; is among the keywords of the current routine then force the definition
61; of the new keyword with the old one.
62;
63    alltags = strlowcase(tag_names(ex))
64    FOR i = 0, n_elements(alltags)-1 DO BEGIN
65      isold = (where(old EQ alltags[i], count))[0]
66      IF count EQ 1 THEN BEGIN
67        dummy = where(kwds EQ new[isold], count)
68        IF count EQ 1 THEN BEGIN
69          dummy = execute(new[isold] + ' = ex.' + alltags[i])
70;           dummy = execute('ex = get_extra(' + new[isold] + ' = ex.' $
71;                           + alltags[i] + ', _extra = ex)')
72        ENDIF
73      ENDIF
74    ENDFOR
75  ENDIF
76;
77ENDIF
Note: See TracBrowser for help on using the repository browser.