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

Last change on this file was 495, checked in by pinsard, 10 years ago

fix thanks to coding rules; typo; dupe empty lines; trailing blanks

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