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

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.4 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 begin
31      print, 'Il n''y a pas de journal ouvert !!'
32      GOTO, sortie
33journal
34;------------------------------------------------------------
35; we complete the journal ...
36;------------------------------------------------------------
37; We recuperate the journal as a vector of string :
38vectjournal = getfile(myuniquetmpdir+'idlsave.pro')
39FOR i = 0,n_elements(vectjournal)-1 DO  print, vectjournal[i]
40;------------------------------------------------------------
41; We cut the last line which is \@ps
42;------------------------------------------------------------
43IF strpos(vectjournal[n_elements(vectjournal)-1],'@ps') ne -1 then $
44  vectjournal = vectjournal[0:n_elements(vectjournal)-2 ]
45;------------------------------------------------------------
46; We correct it if needed...
47;------------------------------------------------------------
48for i = 0, n_elements(vectjournal)-1 do $
49 if strpos(vectjournal[i],'text_box' ) EQ -1 then $
50 vectjournal[i] = strtrim(strcompress(vectjournal[i]), 2)
51FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
52;2 lines are identical ??
53for i = 0, n_elements(vectjournal)-2 do $
54 if vectjournal[i] EQ vectjournal[i+1] then vectjournal[i] = ' '
55FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
56;
57for i = 0, n_elements(vectjournal)-1 do BEGIN & $
58 if strpos(vectjournal[i],'oups' ) NE -1 $
59 OR strpos(vectjournal[i],'Syntax error' ) NE -1 $
60 OR strpos(vectjournal[i],'Illegal character' ) NE -1 $
61 then BEGIN vectjournal[i] = ' ' & vectjournal[i-1] = ' ' & endif & endfor
62FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
63for i = 0, n_elements(vectjournal)-1 do BEGIN & $
64 if strpos(strtrim(vectjournal[i], 1),'retall' ) EQ 0 $
65 OR strpos(vectjournal[i],'@ps' ) NE -1 $
66 OR strpos(vectjournal[i],'@oups' ) NE -1 $
67 OR strpos(vectjournal[i],'@vzoom' ) NE -1 $
68 OR strpos(vectjournal[i],'help' ) NE -1 $
69 OR strpos(vectjournal[i],'print' ) NE -1 $
70 then  vectjournal[i] = ' ' & endfor
71FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
72for i = 0, n_elements(vectjournal)-1 do BEGIN & $
73 if strpos(strtrim(vectjournal[i], 1),'plt' ) NE -1 THEN BEGIN & $
74 if strpos(strtrim(vectjournal[i], 1),'noerase') NE -1 then $
75 vectjournal[i] = chkeywd(vectjournal[i],'noerase',1) ELSE $
76 vectjournal[i] = vectjournal[i]+',/noerase' & $
77 ENDIF & endfor
78FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
79for i = 0, n_elements(vectjournal)-1 do BEGIN & $
80 if strpos(vectjournal[i],'text_box' ) NE -1 then $
81 IF strpos(vectjournal[i],',pos=' ) EQ -1 then $
82 vectjournal[i] = vectjournal[i]+strmid(vectjournal[i+1], 1) & endfor
83
84; We complete it to transform it in a procedure equivalent to plein2dessin
85   vectjournal = ['reinitplt, /z,/invert' $
86   vectjournal = ['openps, infowidget= infowidget' $
87                  , vectjournal $
88                  ,'closeps, infowidget= infowidget' $
89                  ,'printps' ]
90FOR i = 0,n_elements(vectjournal)-1 DO print, vectjournal[i]
91; We rewrite idlsave.pro
92   putfile, myuniquetmpdir+'idlsave.pro', vectjournal
93; apply idlsave
94   cd,  current = curdir
95   cd, myuniquetmpdir
96@idlsave   
97   cd, curdir
98; We reopen the journal and we put in it all elements of vectjournal but the 2 first and the 3 last line.
99journal, myuniquetmpdir+'idlsave.pro'
100for i = 2, n_elements(vectjournal)-3 DO $
101printf,  !journal, vectjournal[i]
102
103;------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.