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