File: xbasimp.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (56 lines) | stat: -rw-r--r-- 1,556 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function xbasimp(win_num,filen,printer)
// This function will send the recorded graphics 
// to a Postscript file 
//!
// Copyright INRIA
[lhs,rhs]=argn(0);
cur_win=xget('window');
n=size(win_num,'*')
win_num=matrix(win_num,1,n);
if rhs<2,filen=TMPDIR+'/scilab.ps';end
flag=0;
if rhs==1 | rhs>=3 ,flag=1;end
fname=' ';
for i=1:n,
  fnamel=filen+'.'+string(win_num(i));
  fname=fname+fnamel+' ';
  // don't break next line
  //driver('Pos');xinit(fnamel);xtape('replay',win_num(i));driver('Pos');xend();
  // xg2ps is not documented it's only used here 
  // the third argument which is optional can be set to 0 1
  // 0 for b&w and 1 for color  : the default value is to use the screen 
  // status 
  xset('window',win_num(i));
  // get the color status of window win_num(i) 
  c_status= xget("use color")
  xg2ps(win_num(i),fnamel,c_status);
end
xset('window',cur_win)
//driver('Rec');
//Blpr 'titre' filename1 filename2 ....  lpr
if rhs <= 2 then 
  prs= getenv('PRINTERS','void')
  if prs<>"void" ;k=strindex(prs,':')
	       prs=part(prs,1:k(1)-1);
	       prc= 'lpr -P'+prs;
  else
	       prc= 'lpr'
  end
else 
	prc = 'lpr -P'+printer
end 
if flag==1,
  if getenv('WIN32','NO')=='OK' & getenv('COMPILER','NO')=='VC++' then 
	sci1 = strsubst(SCI,'/','\');
 	host(sci1+'\bin\Blpr.exe ''  '' '+fname+ ' | ' + sci1+'\bin\lpr.exe');
  else 
 	host('$SCI/bin/Blpr ''  '' '+fname+ ' |' + prc);
  end 
end
if rhs==1,
  if getenv('WIN32','NO')=='OK' & getenv('COMPILER','NO')=='VC++' then 
    host('del '+fname);
  else
    host('rm -f '+fname);
  end
end