source: trunk/SRC/ForOldVersion/keep_compatibility.pro @ 280

Last change on this file since 280 was 239, checked in by smasson, 17 years ago

cleaning + minor bugfix related to the path definition

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