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