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

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

improvements of headers (alignments of IDL prompt in examples)

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