source: trunk/UTILITAIRE/xfile.pro @ 2

Last change on this file since 2 was 2, checked in by opalod, 22 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME: xfile
6;
7; PURPOSE: affiche ds un widget un fichier ASCII.
8;          c''est la meme chose que xdisplaydife mais ici on l''utilise pour
9;          visualiser le contenu d''une procedure ou d''une fonction
10;          meme si elle n''est pas ds le repertoire courant (grace a !path)
11;
12; CATEGORY: help
13;
14; CALLING SEQUENCE: xfile,'nom_fichier'
15;
16; INPUTS:
17;        nom_fichier:le nom d''une procedure ou d''une fonction a
18;        visualiser avec ou sans le .pro a la fin
19;
20; KEYWORD PARAMETERS:ceux de xdisplayfile
21;
22; EXAMPLE:xfile,'plt'
23;
24; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
25;                       7/1/99
26;                       6/7/1999: compatibilite mac et windows
27;-
28;------------------------------------------------------------
29;------------------------------------------------------------
30;------------------------------------------------------------
31PRO xfile, filename, _extra = ex
32pfile = strlowcase(filename)
33;
34; il faut trouver le nom complet
35;
36   if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro"
37   thisOS = strupcase(strmid(!version.os_family, 0, 3))
38   CASE thisOS of
39      'MAC':BEGIN & sep = ':' & pathsep = ',' & end
40      'WIN':BEGIN & sep = '\' & pathsep = ';' & end
41      ELSE: BEGIN & sep = '/' & pathsep = ':' & end
42   ENDCASE
43   cd, current = current
44   if strpos(pfile,sep) lt 0 then BEGIN
45      if rstrpos(current,sep) NE strlen(current)-1 then current = current+sep
46      multipath = str_sep(!path,pathsep)
47      if rstrpos(multipath[0],sep) NE strlen(multipath[0])-1 then multipath = multipath +sep
48      pfile = [current, multipath]+ pfile
49   ENDIF
50   i = 0
51   repeat begin
52      res = findfile(pfile[i])
53      i = i+1
54   endrep until res[0] NE '' OR i EQ n_elements(pfile)
55   if res[0] NE  '' then BEGIN
56; on ouvre le fichier ds un widget
57   xdisplayfile, pfile[i-1], _extra = ex
58   ENDIF ELSE ras = report('le fichier demande n''existe pas...')
59;
60;
61   return
62end
Note: See TracBrowser for help on using the repository browser.