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

Last change on this file since 223 was 223, checked in by pinsard, 17 years ago

improvements of some *.pro

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