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

Last change on this file since 172 was 165, checked in by smasson, 18 years ago

bugfix of a bug introduced in revision 150

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