1 | ;+ |
---|
2 | ; NAME: keep_compatibility |
---|
3 | ; |
---|
4 | ; PURPOSE: |
---|
5 | ; 1) define key_forgetold = 1b - keyword_set(flag) |
---|
6 | ; 2) remove all oldcm_used.pro found in !path |
---|
7 | ; 3) define and create myuniquetmpdir and add it to !path |
---|
8 | ; 4) copy oldcm_full(_empty) to myuniquetmpdir+'oldcm_used.pro' |
---|
9 | ; |
---|
10 | ; CATEGORY: compatibility with old version |
---|
11 | ; |
---|
12 | ; CALLING SEQUENCE:keep_compatibility [, flag] |
---|
13 | ; |
---|
14 | ; INPUTS: |
---|
15 | ; |
---|
16 | ; flag: 1 or 0 to keep or forget the compatibility |
---|
17 | ; dir: the directory where we create oldcm_used.pro. |
---|
18 | ; if omitted, is automatically defined to |
---|
19 | ; 1b - keyword_set(key_forgetold) |
---|
20 | ; |
---|
21 | ; COMMON BLOCKS: cm_general |
---|
22 | ; |
---|
23 | ; SIDE EFFECTS: see purpose |
---|
24 | ; |
---|
25 | ; RESTRICTIONS: copy oldcm_full or oldcm_empty must be found in the |
---|
26 | ; !path. dir must aslo be in the !path |
---|
27 | ; |
---|
28 | ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
29 | ; June 2005 |
---|
30 | ; |
---|
31 | ;- |
---|
32 | PRO keep_compatibility, flag |
---|
33 | ; |
---|
34 | @cm_general |
---|
35 | ; |
---|
36 | ; version should be at least 6.0 |
---|
37 | ; |
---|
38 | IF fix(strmid(!version.release, 0, 1)) LT 6 THEN BEGIN |
---|
39 | print, ' *** ***** ***' |
---|
40 | print, ' *** ERROR ***' |
---|
41 | print, ' *** ***** ***' |
---|
42 | print, 'This version of SAXO needs at least IDL version 6.0' |
---|
43 | print, ' *** ***** ***' |
---|
44 | print, ' *** ERROR ***' |
---|
45 | print, ' *** ***** ***' |
---|
46 | return |
---|
47 | ENDIF |
---|
48 | ; |
---|
49 | IF n_elements(myuniquetmpdir) NE 0 THEN BEGIN |
---|
50 | !path = !path+ ':' + expand_path(myuniquetmpdir) |
---|
51 | return |
---|
52 | ENDIF |
---|
53 | ; |
---|
54 | if n_elements(flag) eq 0 then flag = 1b - keyword_set(key_forgetold) |
---|
55 | ; 1) automatic definition of key_forgetold |
---|
56 | key_forgetold = 1b - keyword_set(flag) |
---|
57 | ; |
---|
58 | ; 2) remove all oldcm_used.pro found in !path |
---|
59 | to_rm = find('oldcm_used') |
---|
60 | IF to_rm[0] NE 'NOT FOUND' THEN file_delete, to_rm |
---|
61 | ; |
---|
62 | ; 3) define and create myuniquetmpdir and add it to !path |
---|
63 | def_myuniquetmpdir |
---|
64 | ; |
---|
65 | ; 4) copy oldcm_full(_empty) to myuniquetmpdir+'oldcm_used.pro' |
---|
66 | ; select which file should be copied to oldcm_used.pro |
---|
67 | IF key_forgetold THEN BEGIN |
---|
68 | oldcm = find('oldcm_empty') |
---|
69 | print, 'We forget the compatibility with the old version' |
---|
70 | ENDIF ELSE BEGIN |
---|
71 | oldcm = find('oldcm_full') |
---|
72 | print, 'We keep the compatibility with the old version' |
---|
73 | ENDELSE |
---|
74 | ; |
---|
75 | oldcm = oldcm[0] |
---|
76 | IF oldcm EQ 'NOT FOUND' THEN BEGIN |
---|
77 | print, 'Error: oldcm_full or oldcm_empty must be found in the !path' |
---|
78 | stop |
---|
79 | ENDIF |
---|
80 | ; copy |
---|
81 | file_copy, oldcm, myuniquetmpdir + 'oldcm_used.pro', /overwrite |
---|
82 | ; |
---|
83 | ; make sure we can make the plots enev if we are using the demo mode |
---|
84 | ; |
---|
85 | demomode_compatibility |
---|
86 | ; |
---|
87 | ; make sure that the common variables are correctly initialized. |
---|
88 | ; |
---|
89 | IF size(ccmeshparameters, /type) NE 8 THEN BEGIN |
---|
90 | computegrid, 1, 1, 1, 1, 1, 1, /fullcgrid |
---|
91 | @cm_4data |
---|
92 | varname = '' |
---|
93 | vargrid = 'T' |
---|
94 | vardate = '0' |
---|
95 | varexp = '' |
---|
96 | varunit = '' |
---|
97 | valmask = 1.e20 |
---|
98 | ENDIF |
---|
99 | ; |
---|
100 | return |
---|
101 | END |
---|