Annotation of OpenXM/src/kan96xx/Doc/gnuplot.sm1, Revision 1.1.1.1
1.1 maekawa 1: %%% 1999, 6/7 Mon.
2: [(parse) (ox.sm1) pushfile] extension
3: %%/plot.gnuplotexec (/home/nobuki/openXM/src/gnuplot-3.5beta6.347.orig/gnuplot)
4: %% def
5: [(getenv) (OpenXM_HOME)] extension /OpenXM_HOME set
6:
7: %% [(gnuplot_forox)] getPathNameSm1 /plot.gnuplotexec set
8: [OpenXM_HOME (/bin/gnuplot_forox)] cat /plot.gnuplotexec set
9:
10: (SSkan/lib/plot.sm1 for ox_sm1_gnuplot. 1999/09/03. ) message
11:
12: /plotstart {
13: sm1connectr
14: ox.ccc 1 copy /gnuplot.ccc set
15: (Your peer is set to gnuplot.ccc) message
16: gnuplot.ccc $[(parse) (gnuplot.sm1) pushfile] extension $ oxsubmit
17: gnuplot.ccc $ plotstart.aux $ oxsubmit
18: gnuplot.ccc $ gnuplot.pid $ oxsubmit gnuplot.ccc oxpopcmo /gnuplot.pid set
19: } def
20:
21: /plotstart.aux {
22: /peer [(oxGetPort) (localhost)] extension def
23: [(sm1.socket) (close) [peer 2 get]] extension %% close the second.
24: /myport peer 1 get def
25: /myportStr peer 1 get toString def
26:
27: (port number = ) messagen myportStr message
28:
29: [(forkExec)
30: [ plot.gnuplotexec
31: [(r) myportStr] cat
32: ]
33: [ 3 4 << peer 0 get >> ] %% close ox_sm1 channel, this channel.
34: 0
35: ] extension /gnuplot.pid set
36: (gnuplot.pid = ) messagen gnuplot.pid message
37:
38: [(sm1.socket) (accept) [peer 0 get ]] extension /gnuplot.ff2 set
39: (Accepted ) messagen
40: gnuplot.ff2 message
41: } def
42:
43:
44: /gnuplot {
45: /cccc set
46: /fd gnuplot.ff2 0 get def
47: [(sm1.socket) (write) [fd
48: [cccc 10 (string) dc] cat]] extension
49: } def
50:
51: %% (plot sin(x);) gnuplot
52:
53: /isAlive {
54: [/in-isAlive /ans /i /nn] pushVariables
55: [ [ gnuplot.ccc ([(getchild)] extension ) oxsubmit ] pop
56: gnuplot.ccc oxpopcmo /gnuplot.pidList set
57: gnuplot.pidList isArray {
58: } {
59: (getchild returns the following strange output.) message
60: gnuplot.pidList message
61: /gnuplot.pidList [ ] def
62: } ifelse
63: gnuplot.pidList length 0 eq {
64: /ans 0 def
65: } {
66: /nn gnuplot.pidList length def
67: 0 1 nn 1 sub {
68: /i set
69: gnuplot.pidList i get gnuplot.pid eq {
70: /isAlive.LLL goto
71: } {
72: (length of gnuplot.pidList = ) messagen gnuplot.pidList length message
73: (gnuplot.pidList and gnuplot.pid are differenct) message
74: i nn 1 sub eq {
75: error
76: } { } ifelse
77: } ifelse
78: } for
79: /isAlive.LLL
80: /ans 1 def
81: } ifelse
82: /arg1 ans def
83: ] pop
84: popVariables
85: arg1
86: } def
87:
88: /demo0 {
89: (/u/nobuki/Trash/gnuplot-3.5beta6.347.orig/demo/airfoil.dem) pushfile /ff set
90: ff gnuplot
91: } def
92:
93: /rplot {
94: /rplot.arg set
95: isAlive {
96: gnuplot.ccc [ ($ ) rplot.arg ( $) ( gnuplot )] cat oxsubmit
97: } {
98: (You peer got error. Restaring gnuplot) message
99: gnuplot.ccc ( plotstart.aux ) oxsubmit
100: gnuplot.ccc $ gnuplot.pid $ oxsubmit gnuplot.ccc oxpopcmo /gnuplot.pid set
101: (New gnuplot.pid is ) messagen gnuplot.pid message
102: (We have started new gnuplot. Try your command again.) message
103: } ifelse
104: } def
105:
106:
107: /test0 {
108: (Type in ctrl-C and gnuplot.ccc oxreset . ) message
109: 0 1 10000 {
110: /i set
111: [$plot cos(x+$ i toString $);$] cat rplot
112: } for ;
113: } def
114:
115:
116:
117:
118: $plotstart ; (plot sin(x);) rplot$ message
119:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>