version 1.1, 1999/10/08 02:12:02 |
version 1.10, 2005/02/09 11:44:05 |
|
|
|
%$OpenXM: OpenXM/src/kan96xx/Doc/gnuplot.sm1,v 1.9 2005/02/04 11:54:06 takayama Exp $ |
%%% 1999, 6/7 Mon. |
%%% 1999, 6/7 Mon. |
[(parse) (ox.sm1) pushfile] extension |
[(parse) (ox.sm1) pushfile] extension |
%%/plot.gnuplotexec (/home/nobuki/openXM/src/gnuplot-3.5beta6.347.orig/gnuplot) |
|
%% def |
|
[(getenv) (OpenXM_HOME)] extension /OpenXM_HOME set |
[(getenv) (OpenXM_HOME)] extension /OpenXM_HOME set |
|
|
%% [(gnuplot_forox)] getPathNameSm1 /plot.gnuplotexec set |
[(which) (gnuplot)] oxshell /plot.gnuplotexec set |
[OpenXM_HOME (/bin/gnuplot_forox)] 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 { |
|
plot.gnuplotexec tag 0 eq { |
|
(No gnuplot is installed in this system.) error |
|
} { } ifelse |
|
{ |
|
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 |
|
gnuplot.read.1 |
|
[(fp2fputs) [cccc nl] cat gnuplot.pfp] extension pop |
|
[(fp2fflush) gnuplot.pfp] extension pop |
|
gnuplot.read.1 |
|
gnuplot.sync.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 |
|
|
|
% It uses "@" to wait for the gnuplot. |
|
/gnuplot.sync.1 { |
|
[(fp2fputs) [(print "@";) nl] cat gnuplot.pfp] extension pop |
|
[(fp2fflush) gnuplot.pfp] extension pop |
|
{ |
|
[(fp2fgetc) gnuplot.fifoFp] extension 64 eq { exit} { } ifelse |
|
} loop |
|
} 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 |