[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 |
---|
| 25 | ; IDL> xfile,'plt' |
---|
[2] | 26 | ; |
---|
[223] | 27 | ; @history |
---|
| 28 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
| 29 | ; 7/1/99 |
---|
| 30 | ; 6/7/1999: compatibility mac and windows |
---|
[133] | 31 | ; |
---|
[223] | 32 | ; @version |
---|
| 33 | ; $Id$ |
---|
[133] | 34 | ; |
---|
[2] | 35 | ;- |
---|
[327] | 36 | PRO xfile, filename, _EXTRA=ex |
---|
[114] | 37 | ; |
---|
| 38 | compile_opt idl2, strictarrsubs |
---|
| 39 | ; |
---|
[266] | 40 | usage="xfile, filename, _EXTRA = ex" |
---|
| 41 | ; |
---|
| 42 | ; check parameters |
---|
| 43 | check_param = N_PARAMS() |
---|
| 44 | if (check_param EQ 0) then begin |
---|
| 45 | dummy = report(['No input parameter', $ |
---|
| 46 | 'Usage : ' + usage]) |
---|
| 47 | return |
---|
| 48 | endif |
---|
| 49 | ; |
---|
| 50 | ; check arguments |
---|
| 51 | if arg_present(filename) then begin |
---|
| 52 | dummy = report(['No input parameter filename', $ |
---|
| 53 | 'Usage : ' + usage]) |
---|
| 54 | return |
---|
| 55 | endif |
---|
| 56 | ; |
---|
[239] | 57 | ; Are we sure filename is a string? |
---|
| 58 | intype = size(filename, /type) |
---|
| 59 | if intype NE 7 then begin |
---|
[266] | 60 | dummy = report(['Input parameter filename type : ' + size(filename,/TNAME) , $ |
---|
| 61 | 'Input parameter filename must be a string']) |
---|
[239] | 62 | return |
---|
| 63 | endif |
---|
[266] | 64 | ; |
---|
[239] | 65 | ; find the file and display it! |
---|
[285] | 66 | pfile = find(filename, /firstfound) |
---|
[266] | 67 | if (pfile NE 'NOT FOUND') then begin |
---|
| 68 | xdisplayfile, pfile[0], _EXTRA = ex |
---|
| 69 | endif else begin |
---|
| 70 | dummy = report(['Input parameter filename : ' + filename, $ |
---|
| 71 | filename + ' does not exist ...']) |
---|
| 72 | endelse |
---|
| 73 | ; |
---|
[2] | 74 | return |
---|
| 75 | end |
---|