;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; ; @file_comments ; display in a widget an ASCII file. ; It is the same thing that xdisplayfile but here, we use it ; to display the content of a procedure or of a function, ; even if it is not in the current directory (thanks to the path). ; ; @categories ; Utilities ; ; @param FILENAME {in}{required} ; It is the name of the procedure or of the function ; we want to display (with or without .pro at the end). ; ; @keyword _EXTRA ; used to pass your keywords ; ; @examples 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 ; pfile = strlowcase(filename) ; ; we have to find the full name. ; if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro" thisOS = strupcase(strmid(!version.os_family, 0, 3)) CASE thisOS of 'MAC':BEGIN & sep = ':' & pathsep = ',' & end 'WIN':BEGIN & sep = '\' & pathsep = ';' & end ELSE: BEGIN & sep = '/' & pathsep = ':' & end ENDCASE cd, current = current if strpos(pfile,sep) lt 0 then BEGIN if rstrpos(current,sep) NE strlen(current)-1 then current = current+sep multipath = str_sep(!path,pathsep) if rstrpos(multipath[0],sep) NE strlen(multipath[0])-1 then multipath = multipath +sep pfile = [current, multipath]+ pfile ENDIF i = 0 repeat begin res = findfile(pfile[i]) i = i+1 endrep until res[0] NE '' OR i EQ n_elements(pfile) if res[0] NE '' then BEGIN ; we open the file in a widget xdisplayfile, pfile[i-1], _extra = ex ENDIF ELSE ras = report('le fichier demande n''existe pas...') ; ; return end