;+ ; ; @file_comments ; display an ASCII file in a widget. ; It is the same thing that XDISPLAYFILE but here, we use it ; to display the content of a procedure or of a function located in the !path ; ".pro" suffix will be appended if needed. ; ; @categories ; Utilities Widget ; ; @param FILENAME {in}{required} {type=scalar string} ; It is the name of the procedure or of the function ; we want to display (with or without .pro at the end). ; FILENAME should be located in !path. ; ".pro" suffix will be appended if needed. ; ; @keyword _EXTRA ; Used to pass keywords to XDISPLAYFILE ; ; @restrictions ; Triggers the XMANAGER if it is not already in use. ; ; @examples ; IDL> xfile,'plt' ; ; @history ; Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 7/1/99 ; 6/7/1999: compatibility mac and windows ; ; @version ; $Id$ ; ;- ; PRO xfile, filename, _EXTRA = ex ; compile_opt idl2, strictarrsubs ; usage="xfile, filename, _EXTRA = ex" ; ; check parameters check_param = N_PARAMS() if (check_param EQ 0) then begin dummy = report(['No input parameter', $ 'Usage : ' + usage]) return endif ; ; check arguments if arg_present(filename) then begin dummy = report(['No input parameter filename', $ 'Usage : ' + usage]) return endif ; ; Are we sure filename is a string? intype = size(filename, /type) if intype NE 7 then begin dummy = report(['Input parameter filename type : ' + size(filename,/TNAME) , $ 'Input parameter filename must be a string']) return endif ; ; find the file and display it! pfile = find(filename, /first_found) if (pfile NE 'NOT FOUND') then begin xdisplayfile, pfile[0], _EXTRA = ex endif else begin dummy = report(['Input parameter filename : ' + filename, $ filename + ' does not exist ...']) endelse ; return end