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

Last change on this file since 375 was 375, checked in by pinsard, 16 years ago

improvements of headers (paragraphs and alignments)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1;+
2;
3; @file_comments
4; display an ASCII file in a widget.
5;
6; It is the same thing that <proidl>XDISPLAYFILE</proidl> but here, we use it
7; to display the content of a procedure or of a function located in the !path
8; ".pro" suffix will be appended if needed.
9;
10; @categories
11; Utilities Widget
12;
13; @param FILENAME {in}{required} {type=scalar string}
14; It is the name of the procedure or of the function
15; we want to display (with or without .pro at the end).
16; FILENAME should be located in !path.
17; ".pro" suffix will be appended if needed.
18;
19; @keyword _EXTRA
20; Used to pass keywords to <proidl>XDISPLAYFILE</proidl>
21;
22; @restrictions
23; Triggers the <proidl>XMANAGER</proidl> if it is not already in use.
24;
25; @examples
26;
27;   IDL> xfile,'plt'
28;
29; @history
30; Sebastien Masson (smasson\@lodyc.jussieu.fr)
31; 7/1/99
32; 6/7/1999: compatibility mac and windows
33;
34; @version
35; $Id$
36;
37;-
38PRO xfile, filename, _EXTRA=ex
39;
40  compile_opt idl2, strictarrsubs
41;
42  usage="xfile, filename, _EXTRA = ex"
43;
44; check parameters
45  check_param = N_PARAMS()
46  if (check_param EQ 0) then begin
47     dummy = report(['No input parameter', $
48                     'Usage : ' + usage])
49     return
50  endif
51;
52; check arguments
53  if arg_present(filename) then begin
54     dummy = report(['No input parameter filename', $
55                     'Usage : ' + usage])
56     return
57  endif
58;
59; Are we sure filename is a string?
60   intype = size(filename, /type)
61   if intype NE 7 then begin
62      dummy = report(['Input parameter filename type : ' + size(filename,/TNAME) , $
63                      'Input parameter filename must be a string'])
64      return
65   endif
66;
67; find the file and display it!
68   pfile = find(filename, /firstfound)
69   if (pfile NE 'NOT FOUND') then begin
70     xdisplayfile, pfile[0], _EXTRA = ex
71   endif else begin
72     dummy = report(['Input parameter filename : ' + filename, $
73                     filename + ' does not exist ...'])
74   endelse
75;
76   return
77end
Note: See TracBrowser for help on using the repository browser.