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

Last change on this file since 136 was 136, checked in by pinsard, 18 years ago

some improvements and corrections in some .pro file according to
aspell and idldoc log file

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