source: trunk/SRC/Utilities/xfile.pro @ 157

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

header improvements + xxx doc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments
7; display in a widget an ASCII file.
8; It is the same thing that xdisplayfile but here, we use it
9; to display the content of a procedure or of a function,
10; even if it is not in the current directory (thanks to the path).
11;
12; @categories
13; Utilities
14;
15; @param filename {in}{required}
16; It is the name of the procedure or of the function
17; we want to display (with or without .pro at the end).
18;
19; @keyword _extra
20; used to pass your keywords
21;
22; @examples xfile,'plt'
23;
24; @history Sebastien Masson (smasson\@lodyc.jussieu.fr)
25;                       7/1/99
26;                       6/7/1999: compatibility mac and windows
27;
28; @version $Id$
29;
30;-
31;------------------------------------------------------------
32;------------------------------------------------------------
33;------------------------------------------------------------
34PRO xfile, filename, _extra = ex
35;
36  compile_opt idl2, strictarrsubs
37;
38pfile = strlowcase(filename)
39;
40; we have to find the full name.
41;
42   if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro"
43   thisOS = strupcase(strmid(!version.os_family, 0, 3))
44   CASE thisOS of
45      'MAC':BEGIN & sep = ':' & pathsep = ',' & end
46      'WIN':BEGIN & sep = '\' & pathsep = ';' & end
47      ELSE: BEGIN & sep = '/' & pathsep = ':' & end
48   ENDCASE
49   cd, current = current
50   if strpos(pfile,sep) lt 0 then BEGIN
51      if rstrpos(current,sep) NE strlen(current)-1 then current = current+sep
52      multipath = str_sep(!path,pathsep)
53      if rstrpos(multipath[0],sep) NE strlen(multipath[0])-1 then multipath = multipath +sep
54      pfile = [current, multipath]+ pfile
55   ENDIF
56   i = 0
57   repeat begin
58      res = findfile(pfile[i])
59      i = i+1
60   endrep until res[0] NE '' OR i EQ n_elements(pfile)
61   if res[0] NE  '' then BEGIN
62; we open the file in a widget
63   xdisplayfile, pfile[i-1], _extra = ex
64   ENDIF ELSE ras = report('le fichier demande n''existe pas...')
65;
66;
67   return
68end
Note: See TracBrowser for help on using the repository browser.