source: trunk/SRC/ToBeReviewed/POSTSCRIPT/ps.pro @ 240

Last change on this file since 240 was 240, checked in by pinsard, 17 years ago

replace some print by some report in some .pro (continuation)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.9 KB
Line 
1;+
2;
3; @file_comments
4; Redirect the content of the graphic window in a postscript,
5; by redoing commands in the postscript's environment.
6;
7; @categories
8; utilities
9;
10; @restrictions
11; We use journal which allows to stock commands we pass.
12;
13; @restrictions
14; Can break down if some weird commands are passed...
15; Comment: we erase Syntax error, Illegal characters, compatible
16; with oups, text_box...
17;
18; @history
19; Sebastien Masson (smasson\@lodyc.jussieu.fr)
20;                       5/3/1999
21;-
22;------------------------------------------------------------
23; We have to close the journal!
24;------------------------------------------------------------
25   if !journal EQ 0 then ras = report('ERROR: The Journal is not open !!')
26journal
27;------------------------------------------------------------
28; we complete the journal ...
29;------------------------------------------------------------
30; We recuperate the journal as a vector of string :
31vectjournal = getfile(myuniquetmpdir+'idlsave.pro')
32; FOR i = 0,n_elements(vectjournal)-1 DO  print, vectjournal[i]
33;------------------------------------------------------------
34; We cut the last line which is \@ps
35;------------------------------------------------------------
36IF strpos(vectjournal[n_elements(vectjournal)-1],'@ps') ne -1 then $
37  vectjournal = vectjournal[0:n_elements(vectjournal)-2 ]
38;------------------------------------------------------------
39; We correct it if needed...
40;------------------------------------------------------------
41for i = 0, n_elements(vectjournal)-1 do $
42 if strpos(vectjournal[i],'text_box' ) EQ -1 then $
43 vectjournal[i] = strtrim(strcompress(vectjournal[i]), 2)
44; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
45; if 2 lines are identical...
46for i = 0, n_elements(vectjournal)-2 do $
47 if vectjournal[i] EQ vectjournal[i+1] then vectjournal[i] = ' '
48; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
49;
50for i = 0, n_elements(vectjournal)-1 do BEGIN & $
51 if strpos(vectjournal[i],'oups' ) NE -1 $
52 OR strpos(vectjournal[i],'Syntax error' ) NE -1 $
53 OR strpos(vectjournal[i],'Illegal character' ) NE -1 $
54 then BEGIN vectjournal[i] = ' ' & vectjournal[i-1] = ' ' & endif & endfor
55; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
56for i = 0, n_elements(vectjournal)-1 do BEGIN & $
57 if strpos(strtrim(vectjournal[i], 1),'retall' ) EQ 0 $
58 OR strpos(vectjournal[i],'@ps' ) NE -1 $
59 OR strpos(vectjournal[i],'@oups' ) NE -1 $
60 OR strpos(vectjournal[i],'@vzoom' ) NE -1 $
61 OR strpos(vectjournal[i],'help' ) NE -1 $
62 OR strpos(vectjournal[i],'print' ) NE -1 $
63 then  vectjournal[i] = ' ' & endfor
64; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
65for i = 0, n_elements(vectjournal)-1 do BEGIN & $
66 if strpos(strtrim(vectjournal[i], 1),'plt' ) NE -1 THEN BEGIN & $
67 if strpos(strtrim(vectjournal[i], 1),'noerase') NE -1 then $
68 vectjournal[i] = chkeywd(vectjournal[i],'noerase',1) ELSE $
69 vectjournal[i] = vectjournal[i]+',/noerase' & $
70 ENDIF & endfor
71; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
72for i = 0, n_elements(vectjournal)-1 do BEGIN & $
73 if strpos(vectjournal[i],'text_box' ) NE -1 then $
74 IF strpos(vectjournal[i],',pos=' ) EQ -1 then $
75 vectjournal[i] = vectjournal[i]+strmid(vectjournal[i+1], 1) & endfor
76
77; We complete it to transform it in a procedure equivalent to plein2dessin
78   vectjournal = ['openps, infowidget= infowidget' $
79                  , vectjournal $
80                  ,'closeps, infowidget= infowidget' $
81                  ,'printps' ]
82; FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
83; We rewrite idlsave.pro
84   putfile, myuniquetmpdir+'idlsave.pro', vectjournal
85; update the list of .pro and .sav in !PATH
86   path_cache, /rebuild
87; apply idlsave
88@idlsave   
89; We reopen the journal and we put in it all elements of vectjournal but the 2 first and the 3 last line.
90journal, myuniquetmpdir+'idlsave.pro'
91for i = 2, n_elements(vectjournal)-3 DO $
92printf,  !journal, vectjournal[i]
Note: See TracBrowser for help on using the repository browser.