version 1.2, 1999/11/17 00:28:54 |
version 1.7, 2004/12/21 03:25:04 |
|
|
%$OpenXM$ |
%$OpenXM: OpenXM/src/kan96xx/Doc/gnuplot.sm1,v 1.6 2004/12/18 01:56:03 takayama Exp $ |
%%% 1999, 6/7 Mon. |
%%% 1999, 6/7 Mon. |
[(parse) (ox.sm1) pushfile] extension |
[(parse) (ox.sm1) pushfile] extension |
[(getenv) (OpenXM_HOME)] extension /OpenXM_HOME set |
[(getenv) (OpenXM_HOME)] extension /OpenXM_HOME set |
|
|
[OpenXM_HOME (/bin/gnuplot4ox)] cat /plot.gnuplotexec set |
[OpenXM_HOME (/bin/gnuplot)] cat /plot.gnuplotexec set |
|
%(gnuplot) /plot.gnuplotexec set |
|
|
(SSkan/lib/plot.sm1 for ox_sm1_gnuplot. 1999/09/03. ) message |
(SSkan/lib/plot.sm1 for ox_sm1_gnuplot. 1999/09/03. ) message |
|
|
|
/gnuplot.callingMethod 1 def % 0 : old, 1 : pipe, 2: file |
|
% If your gnuplot is version 3, then set the callingMethod to 0. |
|
|
/plotstart { |
/plotstart { |
sm1connectr |
sm1connectr |
ox.ccc 1 copy /gnuplot.ccc set |
ox.ccc 1 copy /gnuplot.ccc set |
|
|
} def |
} def |
|
|
/plotstart.aux { |
/plotstart.aux { |
|
{ |
|
gnuplot.callingMethod 0 eq { |
|
plotstart.aux.0 |
|
} { } ifelse |
|
gnuplot.callingMethod 1 eq { |
|
plotstart.aux.1 |
|
} { } ifelse |
|
gnuplot.callingMethod 2 eq { |
|
(Not yet implemented.) error |
|
} { } ifelse |
|
exit |
|
} loop |
|
} def |
|
/plotstart.aux.0 { |
/peer [(oxGetPort) (localhost)] extension def |
/peer [(oxGetPort) (localhost)] extension def |
[(sm1.socket) (close) [peer 2 get]] extension %% close the second. |
[(sm1.socket) (close) [peer 2 get]] extension %% close the second. |
/myport peer 1 get def |
/myport peer 1 get def |
|
|
gnuplot.ff2 message |
gnuplot.ff2 message |
} def |
} def |
|
|
|
/plotstart.aux.1 { |
|
[(getUniqueFileName) (/tmp/gnuplot.fifo.tmp)] extension /gnuplot.fifo set |
|
[(fp2mkfifo) gnuplot.fifo] extension /gnuplot.status set |
|
|
|
gnuplot.status -1 eq { |
|
(Warning: mkfifo failed.) message |
|
} { } ifelse |
|
|
|
gnuplot.fifo message |
|
[(fp2popen) plot.gnuplotexec (w)] extension /gnuplot.pfp set |
|
(Started gnuplot) message |
|
|
|
[(fp2fputs) [(set print ") gnuplot.fifo (" ; ) nl ] cat |
|
gnuplot.pfp ] extension message |
|
[(fp2fflush) gnuplot.pfp] extension message |
|
[(fp2fputs) [(set mouse ; ) nl ] cat gnuplot.pfp ] extension message |
|
[(fp2fflush) gnuplot.pfp] extension message |
|
|
|
[(fp2fopen) gnuplot.fifo (r)] extension /gnuplot.fifoFp set |
|
% This must be the last. Otherwise, fopen is blocked. |
|
% When mkfifo fails, then gnuplot.fifoFp will be null. (old cygwin) |
|
/gnuplot.pid -2 def % dummy. |
|
gnuplot.pid message |
|
} def |
|
|
|
/plotstop { |
|
gnuplot.ccc $ plotstop.aux $ oxsubmit |
|
} def |
|
|
|
/plotstop.aux { |
|
{ |
|
gnuplot.callingMethod 0 eq { |
|
plotstop.aux.0 |
|
} { } ifelse |
|
gnuplot.callingMethod 1 eq { |
|
plotstop.aux.1 |
|
} { } ifelse |
|
gnuplot.callingMethod 2 eq { |
|
(Not yet implemented.) error |
|
} { } ifelse |
|
exit |
|
} loop |
|
} def |
|
|
|
/plotstop.aux.0 { } def |
|
/plotstop.aux.1 { |
|
[(fp2fclose) gnuplot.pfp] extension pop |
|
gnuplot.fifoFp tag 0 eq { } |
|
{ |
|
[(fp2fclose) gnuplot.fifoFp] extension pop |
|
} ifelse |
|
% [(rm) gnuplot.fifo] oxshell pop % It is OS dependent. |
|
[(unlink) gnuplot.fifo] extension |
|
} def |
|
|
|
|
/gnuplot { |
/gnuplot { |
|
{ |
|
gnuplot.callingMethod 0 eq { |
|
gnuplot.0 |
|
} { } ifelse |
|
gnuplot.callingMethod 1 eq { |
|
gnuplot.1 |
|
} { } ifelse |
|
gnuplot.callingMethod 2 eq { |
|
(Not yet implemented.) error |
|
} { } ifelse |
|
exit |
|
} loop |
|
} def |
|
|
|
/gnuplot.0 { |
/cccc set |
/cccc set |
/fd gnuplot.ff2 0 get def |
/fd gnuplot.ff2 0 get def |
[(sm1.socket) (write) [fd |
[(sm1.socket) (write) [fd |
[cccc 10 (string) dc] cat]] extension |
[cccc 10 (string) dc] cat]] extension |
} def |
} def |
|
|
|
/gnuplot.1 { |
|
/cccc set |
|
[(fp2fputs) [cccc nl] cat gnuplot.pfp] extension pop |
|
[(fp2fflush) gnuplot.pfp] extension pop |
|
gnuplot.read.1 |
|
} def |
|
|
%% (plot sin(x);) gnuplot |
%% (plot sin(x);) gnuplot |
|
|
|
|
|
/gnuplot.read.1 { |
|
[ |
|
gnuplot.fifoFp tag 0 eq { } |
|
{ |
|
{ |
|
[(fp2select) gnuplot.fifoFp 0] extension 1 eq { |
|
[(fp2fgetc) gnuplot.fifoFp] extension |
|
} { exit } ifelse |
|
} loop |
|
} ifelse |
|
] { (string) dc } map cat |
|
} def |
|
|
/isAlive { |
/isAlive { |
|
{ |
|
gnuplot.callingMethod 0 eq { |
|
isAlive.0 |
|
} { } ifelse |
|
gnuplot.callingMethod 1 eq { |
|
isAlive.1 |
|
} { } ifelse |
|
gnuplot.callingMethod 2 eq { |
|
(Not yet implemented.) error |
|
} { } ifelse |
|
exit |
|
} loop |
|
} def |
|
|
|
/isAlive.0 { |
[/in-isAlive /ans /i /nn] pushVariables |
[/in-isAlive /ans /i /nn] pushVariables |
[ [ gnuplot.ccc ([(getchild)] extension ) oxsubmit ] pop |
[ [ gnuplot.ccc ([(getchild)] extension ) oxsubmit ] pop |
gnuplot.ccc oxpopcmo /gnuplot.pidList set |
gnuplot.ccc oxpopcmo /gnuplot.pidList set |
|
|
arg1 |
arg1 |
} def |
} def |
|
|
|
/isAlive.1 { |
|
1 |
|
} def |
|
|
/demo0 { |
/demo0 { |
(/u/nobuki/Trash/gnuplot-3.5beta6.347.orig/demo/airfoil.dem) pushfile /ff set |
(/u/nobuki/Trash/gnuplot-3.5beta6.347.orig/demo/airfoil.dem) pushfile /ff set |
ff gnuplot |
ff gnuplot |
|
|
|
|
|
|
$plotstart ; (plot sin(x);) rplot$ message |
$plotstart ; (plot sin(x);) rplot$ message |
|
$plotstart.aux ; (splot x**2-y**2;) gnuplot $ message |