[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[223] | 3 | ; @file_comments |
---|
[242] | 4 | ; display an ASCII file in a widget. |
---|
[375] | 5 | ; |
---|
[262] | 6 | ; It is the same thing that <proidl>XDISPLAYFILE</proidl> but here, we use it |
---|
[239] | 7 | ; to display the content of a procedure or of a function located in the !path |
---|
| 8 | ; ".pro" suffix will be appended if needed. |
---|
[2] | 9 | ; |
---|
[223] | 10 | ; @categories |
---|
[266] | 11 | ; Utilities Widget |
---|
[2] | 12 | ; |
---|
[266] | 13 | ; @param FILENAME {in}{required} {type=scalar string} |
---|
[223] | 14 | ; It is the name of the procedure or of the function |
---|
[136] | 15 | ; we want to display (with or without .pro at the end). |
---|
[266] | 16 | ; FILENAME should be located in !path. |
---|
| 17 | ; ".pro" suffix will be appended if needed. |
---|
[2] | 18 | ; |
---|
[223] | 19 | ; @keyword _EXTRA |
---|
[260] | 20 | ; Used to pass keywords to <proidl>XDISPLAYFILE</proidl> |
---|
[2] | 21 | ; |
---|
[266] | 22 | ; @restrictions |
---|
| 23 | ; Triggers the <proidl>XMANAGER</proidl> if it is not already in use. |
---|
| 24 | ; |
---|
[223] | 25 | ; @examples |
---|
[2] | 26 | ; |
---|
[371] | 27 | ; IDL> xfile,'plt' |
---|
| 28 | ; |
---|
[223] | 29 | ; @history |
---|
| 30 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
| 31 | ; 7/1/99 |
---|
| 32 | ; 6/7/1999: compatibility mac and windows |
---|
[133] | 33 | ; |
---|
[223] | 34 | ; @version |
---|
| 35 | ; $Id$ |
---|
[133] | 36 | ; |
---|
[2] | 37 | ;- |
---|
[327] | 38 | PRO xfile, filename, _EXTRA=ex |
---|
[114] | 39 | ; |
---|
| 40 | compile_opt idl2, strictarrsubs |
---|
| 41 | ; |
---|
[266] | 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 | ; |
---|
[239] | 59 | ; Are we sure filename is a string? |
---|
| 60 | intype = size(filename, /type) |
---|
| 61 | if intype NE 7 then begin |
---|
[266] | 62 | dummy = report(['Input parameter filename type : ' + size(filename,/TNAME) , $ |
---|
| 63 | 'Input parameter filename must be a string']) |
---|
[239] | 64 | return |
---|
| 65 | endif |
---|
[266] | 66 | ; |
---|
[239] | 67 | ; find the file and display it! |
---|
[285] | 68 | pfile = find(filename, /firstfound) |
---|
[266] | 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 | ; |
---|
[2] | 76 | return |
---|
| 77 | end |
---|