;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; NAME: xfile ; ; PURPOSE: affiche ds un widget un fichier ASCII. ; c''est la meme chose que xdisplaydife mais ici on l''utilise pour ; visualiser le contenu d''une procedure ou d''une fonction ; meme si elle n''est pas ds le repertoire courant (grace a !path) ; ; CATEGORY: help ; ; CALLING SEQUENCE: xfile,'nom_fichier' ; ; INPUTS: ; nom_fichier:le nom d''une procedure ou d''une fonction a ; visualiser avec ou sans le .pro a la fin ; ; KEYWORD PARAMETERS:ceux de xdisplayfile ; ; EXAMPLE:xfile,'plt' ; ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) ; 7/1/99 ; 6/7/1999: compatibilite mac et windows ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ PRO xfile, filename, _extra = ex pfile = strlowcase(filename) ; ; il faut trouver le nom complet ; 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 ; on ouvre le fichier ds un widget xdisplayfile, pfile[i-1], _extra = ex ENDIF ELSE ras = report('le fichier demande n''existe pas...') ; ; return end