[BACK]Return to process.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts

Annotation of OpenXM/src/asir-doc/parts/process.texi, Revision 1.15

1.15    ! noro        1: @comment $OpenXM: OpenXM/src/asir-doc/parts/process.texi,v 1.14 2003/04/20 08:01:26 noro Exp $
1.2       noro        2: \BJP
1.1       noro        3: @node $BJ,;67W;;(B,,, Top
                      4: @chapter $BJ,;67W;;(B
1.2       noro        5: \E
                      6: \BEG
                      7: @node Distributed computation,,, Top
                      8: @chapter Distributed computation
                      9: \E
1.1       noro       10:
                     11: @menu
                     12: * OpenXM::
                     13: * Mathcap::
1.2       noro       14: \BJP
1.1       noro       15: * $B%9%?%C%/%^%7%s%3%^%s%I(B::
                     16: * $B%G%P%C%0(B::
                     17: * $BJ,;67W;;$K4X$9$k4X?t(B::
1.2       noro       18: \E
                     19: \BEG
                     20: * Stackmachine commands::
                     21: * Debugging::
                     22: * Functions for distributed computation::
                     23: \E
1.1       noro       24: @end menu
                     25:
1.2       noro       26: \JP @node OpenXM,,, $BJ,;67W;;(B
                     27: \EG @node OpenXM,,, Distributed computation
1.1       noro       28: @section OpenXM
                     29:
1.2       noro       30: \BJP
1.10      noro       31: @b{Asir} $B$O(B, $BJ,;67W;;$K$*$1$kDL?.%W%m%H%3%k$H$7$F(B,
                     32: @b{OpenXM}
1.9       noro       33: (Open message eXchange for Mathematics) $B%W%m%H%3%k$r:NMQ$7$F$$$k(B.
1.10      noro       34: @b{OpenXM} $B%W%m%8%'%/%H$K$D$$$F$O(B,
                     35: @ifhtml
                     36: <A HREF="http://www.math.sci.kobe-u.ac.jp/OpenXM/">
                     37: @end ifhtml
                     38: @code{http://www.math.sci.kobe-u.ac.jp/OpenXM/}
                     39: @ifhtml
                     40: </A>
                     41: @end ifhtml
                     42: $B$r;2>H$7$F$[$7$$(B.
                     43:
1.9       noro       44: @b{OpenXM} $B%W%m%H%3%k$O(B, $B<g$H$7$F?t3X%*%V%8%'%/%H$r%W%m%;%94V$G$d$j$H$j$9$k(B
1.2       noro       45: $B$?$a$N5,Ls$G$"$k(B. @b{OpenXM} $B$K$*$$$F$O(B
                     46: \E
                     47: \BEG
1.3       noro       48: On @b{Asir} distributed computations are done under @b{OpenXM}
1.2       noro       49: (Open message eXchange protocol for Mathematics), which
                     50: is a protocol for exchanging mainly mathematical objects
                     51: between processes.
1.10      noro       52: See
                     53: @ifhtml
                     54: <A HREF="http://www.math.sci.kobe-u.ac.jp/OpenXM/">
                     55: @end ifhtml
                     56: @code{http://www.math.sci.kobe-u.ac.jp/OpenXM/}
                     57: @ifhtml
                     58: </A>
                     59: @end ifhtml
                     60: for the details of @b{OpenXM}.
1.2       noro       61: In @b{OpenXM} a distributed computation is done as follows:
                     62: \E
1.1       noro       63:
                     64: @enumerate
1.2       noro       65: \BJP
1.1       noro       66: @item client $B$,(B server $B$KBP$7$F7W;;<B9T0MMj$N%a%C%;!<%8$rAw$k(B.
                     67: @item server $B$,7W;;$r<B9T$9$k(B.
                     68: @item client $B$,(B server $B$K7k2LAwIU0MMj$N%a%C%;!<%8$rAw$k(B.
                     69: @item server $B$O7k2L$rJV$7(B, client $B$O7k2L$r<u$1<h$k(B
1.2       noro       70: \E
                     71: \BEG
                     72: @item A client requests something to a server.
                     73: @item The server does works according to the request.
                     74: @item The client requests to send data to the server.
                     75: @item The server sends the data to the client and the client gets the data.
                     76: \E
1.1       noro       77: @end enumerate
                     78:
1.2       noro       79: \BJP
1.1       noro       80: $B$H$$$&7A$GJ,;67W;;$,9T$o$l$k(B. server $B$O%9%?%C%/%^%7%s$G$"$k(B. $B$9$J$o$A(B,
                     81: client $B$+$iAw$i$l$?%G!<%?%*%V%8%'%/%H$O(B, $B;XDj$,$J$$8B$j(B server $B$N%9%?%C(B
                     82: $B%/$K@Q$^$l(B, $B%3%^%s%I$,Aw$i$l$?;~$K(B, $BI,MW$J$@$1%9%?%C%/$+$i%G!<%?$r<h$j=P(B
                     83: $B$7$F(B, $B4X?t8F$S=P$7$N0z?t$H$9$k(B.
1.2       noro       84: \E
                     85: \BEG
                     86: The server is a stack machine. That is data objects sent by the client
                     87: are pushed to the stack of the server.
                     88: If the server gets a command, then the data are
                     89: popped form the stack and they are used as arguments of a function call.
                     90: \E
1.1       noro       91:
1.2       noro       92: \BJP
                     93: @b{OpenXM} $B$K$*$$$FFCD'E*$J$3$H$O(B, $B7W;;7k2L$OC1$K(B server $B$N%9%?%C%/$K(B
1.1       noro       94: $B@Q$^$l$k$@$1$G(B, client $B$+$i$N0MMj$,$J$$8B$j(B, $BDL?.O)$K%G!<%?$ON.$l$J$$(B
                     95: $B$H$$$&E@$G$"$k(B.
1.2       noro       96: \E
1.1       noro       97:
1.2       noro       98: \BEG
                     99: In @b{OpenXM}, the result of a computation done in the server
                    100: is simply pushed to the stack and the data is not written to
                    101: the communication stream without requests from the client.
                    102: \E
                    103:
                    104: \BJP
1.1       noro      105: $B%W%m%H%3%k$K$O(B, $B%*%V%8%'%/%H$N6&DL%U%)!<%^%C%H$r5,Dj(B
                    106: $B$9$k(B @b{CMO} (Common Mathematical Object format), $B%W%m%;%9$KBP$9$k(B
                    107: $BF0:n$r;XDj$9$k(B @b{SM} (Stack Machine command) $B$,4^$^$l$k(B.
1.2       noro      108: $B$3$l$i$O(B, $B%G!<%?$rAw$k:]$K(B, $B%G!<%?$N<oN`$r;XDj$9$k(B
1.1       noro      109: $B$?$a$N(B @b{OX} expression $B$H$7$F%i%C%T%s%0$5$l$k(B.
                    110:
1.2       noro      111: @b{OpenXM} $B$K$h$kJ,;67W;;$r9T$&>l9g$K$O(B,
1.1       noro      112: $B$^$:(B, server $B$rN)$A>e$2$F(B, $BDL?.$r@.N)$5$;$kI,MW$,$"$k(B. $B$3$N$?$a$K(B,
                    113: @code{ox_launch()}, @code{ox_launch_nox()}, @code{ox_launch_generic()}
                    114: $B$J$I$N4X?t$,MQ0U$5$l$F$$$k(B. $B$5$i$K(B, $BDL?.$N@.N)$7$?(B server $B$KBP$7$F(B
                    115: $B0J2<$N$h$&$JA`:n$,4X?t$H$7$FMQ0U$5$l$F$$$k(B.
1.2       noro      116: \E
                    117:
                    118: \BEG
                    119: @b{OpenXM} protocol consists of two components:
                    120: @b{CMO} (Common Mathematical Object format) which determines
                    121: a common format of data representations and
                    122: @b{SM} (StackMachine command) which specifies actions on servers.
                    123: These are wrapped as @b{OX} expressions to indicate the sort of
                    124: data when they are sent.
                    125:
                    126: To execute a distributed computation by @b{OpenXM},
                    127: one has to invoke @b{OpenXM} servers and to establish communications
                    128: between the client and the servers.
                    129: @code{ox_launch()}, @code{ox_launch_nox()}, @code{ox_launch_generic()}
                    130: are preprared for such purposes. Furthermore the following functions
                    131: are available.
                    132: \E
1.1       noro      133:
                    134: @table @code
                    135: @item @code{ox_push_cmo()}
                    136:
1.2       noro      137: \JP $B%G!<%?$r(B server $B$N%9%?%C%/$K@Q$`(B
1.3       noro      138: \EG It requests a server to push an object to the stack of a server.
1.1       noro      139:
                    140: @item @code{ox_pop_cmo()}
1.2       noro      141: \JP $B%G!<%?$r(B server $B$N%9%?%C%/$+$i<h$j=P$9(B.
1.3       noro      142: \EG It request a server to pop an object from the stack of a server.
1.1       noro      143:
                    144: @item @code{ox_cmo_rpc()}
                    145:
1.2       noro      146: \JP server $B$N4X?t$r8F$S=P$7(B, $B7k2L$r%9%?%C%/$K@Q$`(B.
                    147: \BEG
                    148: It requests to execute a function on a server.
                    149: The result is pushed to the stack of the server.
                    150: \E
1.1       noro      151:
                    152: @item @code{ox_execute_string()}
                    153:
1.2       noro      154: \BJP
1.1       noro      155: server $B8GM-$N%f!<%68@8l(B (@b{Asir} $B$J$i(B Asir $B8@8l(B) $B$G=q$+$l$?J8;zNs$r(B
                    156: server $B$,<B9T$7(B, $B7k2L$r%9%?%C%/$K@Q$`(B.
1.2       noro      157: \E
                    158: \BEG
                    159: It requests a server to parse and execute a string
                    160: by the parser and the evaluater of the server.
                    161: The result is pushed to the stack of the server.
                    162: \E
1.1       noro      163:
                    164: @item @code{ox_push_cmd()}
                    165:
1.2       noro      166: \JP @b{SM} $B%3%^%s%I$NAw?.(B.
                    167: \EG It requests a server to execute a command.
1.1       noro      168:
                    169: @item @code{ox_get()}
                    170:
1.2       noro      171: \JP $B4{$KDL?.O)$K$"$k%G!<%?$N<h$j=P$7(B.
                    172: \EG It gets an object from a data stream.
1.1       noro      173: @end table
                    174:
1.2       noro      175: \JP @node Mathcap,,, $BJ,;67W;;(B
                    176: \EG @node Mathcap,,, Distributed computation
1.1       noro      177: @section Mathcap
                    178:
1.2       noro      179: \BJP
                    180: server, client $B$H$b$K(B, @b{OpenXM} $B$G5,Dj$5$l$F$$$kA4$F$N(B@b{CMO} $B%U%)!<(B
1.1       noro      181: $B%^%C%H(B, @b{SM} $B%3%^%s%I$r<BAu$7$F$$$k$H$O8B$i$J$$(B. $BAj<j$NCN$i$J$$%G!<%?(B,
1.2       noro      182: $B%3%^%s%I$rAw$C$?>l9g(B, $B8=>u$G$O7k2L$OM=A[$G$-$J$$(B. $B$3$N$?$a(B, @b{OpenXM}
1.1       noro      183: $B$G$O(B, $B$"$i$+$8$a8_$$$N%5%]!<%H$9$k(B @b{CMO}, @b{SM} $B$N%j%9%H$r8r49$7$"$C$F(B,
                    184: $BAj<j$NCN$i$J$$%G!<%?$rAw$i$J$$$h$&$K$9$k;EAH$_$rDs>'$7$F$$$k(B. $B$3$N$?$a$N(B
                    185: $B%G!<%?$,(B Mathcap $B$G$"$k(B. Mathcap $B$O(B @b{CMO} $B$H$7$F$O%j%9%H$G$"$j(B, $B$=$N(B
                    186: $BMWAG$O(B 32 bit $B@0?t$^$?$OJ8;zNs$G$"$k(B. $B8=:_$N5,Dj$G$O(B, Mathcap $B$O(B
                    187: $BD9$5$,(B 3 $B$N%j%9%H$G(B,
                    188:
1.2       noro      189: [[version $BHV9f(B, server $BL>(B],@b{SM}taglist,[[@b{OX}tag,@b{CMO}taglist],
                    190: [@b{OX}tag,@b{CMO}taglist],...]]
1.1       noro      191:
1.2       noro      192: $B$H$$$&7A$r$7$F$$$k(B. [@b{OX}tag,@b{CMO}taglist] $B$O(B,
1.1       noro      193: @b{OX}tag $B$G<($5$l$k%+%F%4%j$N%G!<%?$KBP$7$F(B, $B$I$N$h$&$J(B @b{CMO} $B$,;HMQ2D(B
                    194: $BG=$+$r<($9$b$N$G$"$k(B. $B$3$N;XDj$rJ#?t5v$9$3$H$K$h$j(B, $BNc$($P(B
                    195: @samp{ox_asir} $B$N$h$&$K(B, @b{CMO} $B%G!<%?0J30$K(B, @b{Asir} $B8GM-$N%G!<%?7A<0(B
                    196: $B$K$h$j(B, @b{CMO}$B$h$jB?$/$N<oN`$N%G!<%?Aw<u?.$r9T$($k$3$H$r<($;$k(B.
                    197:
                    198: $B%G!<%?Aw?.$N:]$K(B, $BAj<j%W%m%;%9$N(B Mathcap $B$,4{$KEPO?$5$l$F$$$k>l9g(B,
                    199: Mathcap $B$K$h$k%A%'%C%/$r9T$&$+H]$+$O(B,
                    200: @code{ctrl} $B%3%^%s%I$N(B @code{"ox_check"} $B%9%$%C%A$K$h$j7h$^$k(B.
                    201: $B$3$N%9%$%C%A$N=i4|CM$O(B 1 $B$G(B, $B%A%'%C%/$r9T$&$3$H$r0UL#$9$k(B.
                    202: @code{ctrl("ox_check",0)} $B$K$h$j%A%'%C%/$r9T$o$J$$$h$&$K$G$-$k(B.
1.2       noro      203: \E
                    204: \BEG
                    205: A server or a client does not necessarily implement full specifications
                    206: of @b{OpenXM}. If a program sends data unknown to its peer, an unrecoverable
                    207: error may occur. To avoid such a case @b{OpenXM} provides a scheme not
                    208: to send data unknown to peers. It is realized by exchanging the list of
                    209: supported @b{CMO} and @b{SM}. The list is called mathcap.
                    210: Mathcap is also defined as a @b{CMO} and the elements are 32bit integers
                    211: or strings.
                    212: The format of mathcap is as follows.
                    213:
1.3       noro      214: [[version number, server name],@b{SM}taglist,
                    215: [[@b{OX}tag,@b{CMO}taglist],[@b{OX}tag,@b{CMO}taglist],...]]
1.2       noro      216:
                    217: [@b{OX}tag,@b{CMO}taglist] indicates that available object tags for
                    218: a category of data specified by @b{OX}tag.
                    219: For example @samp{ox_asir} accepts the local object format used by @b{Asir}
                    220: and the mathcap from @samp{ox_asir} reflects the fact.
                    221:
                    222: If @code{"ox_check"} switch of @code{ctrl} is set to 1,
                    223: the check by a mathcap is done before data is sent.
                    224: If @code{"ox_check"} switch of @code{ctrl} is set to 0,
                    225: the check is not done.
                    226: By default it is set to 1.
                    227: \E
1.1       noro      228:
1.2       noro      229: \BJP
1.1       noro      230: @node $B%9%?%C%/%^%7%s%3%^%s%I(B,,, $BJ,;67W;;(B
                    231: @section $B%9%?%C%/%^%7%s%3%^%s%I(B
1.2       noro      232: \E
                    233: \BEG
                    234: @node Stackmachine commands,,, Distributed computation
                    235: @section Stackmachine commands
                    236: \E
1.1       noro      237:
1.2       noro      238: \BJP
1.1       noro      239: $B%9%?%C%/%^%7%s%3%^%s%I$O(B, $B%9%?%C%/%^%7%s$G$"$k(B server $B$K2?$i$+$NA`:n$r9T(B
                    240: $B$o$;$k$?$a$KMQ0U$5$l$F$$$k(B. $B$$$/$D$+$N%3%^%s%I$O(B, $B$h$/MQ$$$i$l$k7A$G(B, $BB>(B
1.2       noro      241: $B$N%3%^%s%I(B, $B%G!<%?$H$H$b$K(B, @b{Asir} $B$NAH$_9~$_4X?t$K$h$jAw$i$l$k$,(B, $B%f!<(B
1.1       noro      242: $B%6$,L@<(E*$K$"$k%3%^%s%I$rAw$kI,MW$,$7$P$7$P@8$:$k(B. $B%9%?%C%/%^%7%s%3%^%s(B
                    243: $B%I$O(B 32 bit $B0J2<$N@0?t$G$"$j(B, @code{ox_push_cmd()} $B%3%^%s%I$GAw?.$G$-$k(B.
                    244: $B0J2<$G(B, $BBeI=E*$J%9%?%C%/%^%7%s%3%^%s%I$K$D$$$F2r@b$9$k(B. @b{SM_xxx=yyy}
                    245: $B$G(B, @b{SM_xxx} $B$,(B mnemonic, @b{yyy} $B$,CM$G$"$k(B.
                    246:
                    247: $B0J2<$G(B, $B%9%?%C%/$+$i%G!<%?$r<h$j=P$9$H$O(B, $B%9%?%C%/$N0lHV>e$+$i%G!<%?$r(B
                    248: $B<h$j=|$/$3$H$r8@$&(B.
1.2       noro      249: \E
                    250:
                    251: \BEG
                    252: The stackmachine commands are provided to request a server to execute
                    253: various operations.
                    254: They are automatically sent by built-in functions of @b{Asir},
                    255: but one often has to send them manually. They are represented by
                    256: 32bit integers. One can send them by calling @code{ox_push_cmd()}.
                    257: Typical stackmachine commands are as follows.
                    258: @b{SM_xxx=yyy} means that @b{SM_xxx} is a mnemonic and that
                    259: @b{yyy} is its value.
                    260: \E
1.1       noro      261:
                    262: @table @b
                    263: @item SM_popSerializedLocalObject=258
                    264:
1.2       noro      265: \BJP
1.1       noro      266: server $B$,(B @samp{ox_asir} $B$N>l9g$K(B, $BI,$:$7$b(B @b{CMO} $B$GDj5A$5$l$F$$$J$$(B
1.2       noro      267: $B%*%V%8%'%/%H$r%9%?%C%/$+$i<h$j=P$7(B, $BDL?.O)$KN.$9(B.
                    268: \E
                    269: \BEG
                    270: An object not necessarily defined as @b{CMO} is popped from the stack
                    271: and is sent to the client. This is available only on @samp{ox_asir}.
                    272: \E
1.1       noro      273:
                    274: @item SM_popCMO=262
                    275:
1.2       noro      276: \JP @b{CMO} $B%*%V%8%'%/%H$r%9%?%C%/$+$i<h$j=P$7(B, $BDL?.O)$KN.$9(B.
                    277: \EG A @b{CMO} object is popped from the stack and is sent to the client.
1.1       noro      278:
                    279: @item SM_popString=263
                    280:
1.2       noro      281: \JP $B%9%?%C%/$+$i%G!<%?$r<h$j=P$7(B, $B2DFI7A<0$NJ8;zNs$KJQ49$7$FDL?.O)$KN.$9(B.
                    282: \EG An object is popped from the stack and is sent to the client as a readable string.
1.1       noro      283:
                    284: @item SM_mathcap=264
                    285:
1.2       noro      286: \JP server $B$N(B mathcap $B$r%9%?%C%/$K@Q$`(B.
                    287: \EG The server's mathcap is pushed to the stack.
1.1       noro      288:
                    289: @item SM_pops=265
                    290:
1.2       noro      291: \BJP
1.1       noro      292: $B%9%?%C%/$+$i<h$j=P$7$?%G!<%?$r8D?t$H$7$F(B, $B$=$N8D?tJ,%9%?%C%/$+$i(B
                    293: $B%G!<%?$r<h$j=|$/(B.
1.2       noro      294: \E
                    295: \BEG
                    296: Objects are removed from the stack. The number of object to be removed
                    297: is specified by the object at the top of the stack.
                    298: \E
1.1       noro      299:
                    300: @item SM_setName=266
                    301:
1.2       noro      302: \BJP
1.1       noro      303: $B%9%?%C%/$+$i%G!<%?$rJQ?tL>$H$7$F<h$j=P$7(B, $B<!$K<h$j=P$7$?%G!<%?$r$=$N(B
                    304: $BJQ?t$K3d$jEv$F$k(B. $B$3$N3d$jEv$F$O(B, server $B8GM-$N=hM}$H$7$F9T$o$l$k(B.
1.2       noro      305: \E
                    306: \BEG
                    307: A variable name is popped form the stack. Then an object is
                    308: popped and it is assigned to the variable. This assignment is done
                    309: by the local language of the server.
                    310: \E
1.1       noro      311:
                    312: @item SM_evalName=267
                    313:
1.2       noro      314: \JP $B%9%?%C%/$+$i<h$j=P$7$?%G!<%?$rJQ?tL>$H$7$F(B, $B$=$NCM$r%9%?%C%/$K:\$;$k(B.
                    315: \BEG
                    316: A variable name is popped from the stack.
                    317: Then the value of the variable is pushed to the stack.
                    318: \E
1.1       noro      319:
                    320: @item SM_executeStringByLocalParser=268
                    321:
1.2       noro      322: \BJP
1.1       noro      323: $B%9%?%C%/$+$i<h$j=P$7$?%G!<%?$r(B, server $B8GM-$N(B parser, evaluator $B$G(B
                    324: $B=hM}$7(B, $B7k2L$r%9%?%C%/$K:\$;$k(B.
1.2       noro      325: \E
                    326: \BEG
                    327: A string popped from the stack is parsed and evaluated.
                    328: The result is pushed to the stack.
                    329: \E
1.1       noro      330:
                    331: @item SM_executeFunction=269
                    332:
1.2       noro      333: \BJP
1.1       noro      334: $B%9%?%C%/$+$i(B, $B4X?tL>(B, $B0z?t$N8D?t(B, $B8D?tJ,$N0z?t$r<h$j=P$7(B, $B4X?t$r8F$S=P$7(B
                    335: $B7k2L$r%9%?%C%/$K:\$;$k(B.
1.2       noro      336: \E
                    337: \BEG
                    338: A function name, the number of arguments and the arguments are
                    339: popped from the stack. Then the function is executed and the result
                    340: is pushed to the stack.
                    341: \E
1.1       noro      342:
                    343: @item SM_beginBlock=270
1.2       noro      344: \JP $B%G!<%?%V%m%C%/$N$O$8$^$j(B.
                    345: \EG It indicates the beginning of a block.
1.1       noro      346:
                    347: @item SM_endBlock=271
1.2       noro      348: \JP $B%G!<%?%V%m%C%/$N=*$j(B.
                    349: \EG It indicates the end of a block.
1.1       noro      350:
                    351: @item SM_shutdown=272
                    352:
1.2       noro      353: \JP server $B$H$N8r?.$r@ZCG$7(B, server $B$r=*N;$5$;$k(B.
                    354: \EG It shuts down communications and terminates servers.
1.1       noro      355:
                    356: @item SM_setMathcap=273
                    357:
1.2       noro      358: \JP $B%9%?%C%/$N%G!<%?$r(B client $B$N(B mathcap $B$H$7$F(B, server $B$KEPO?$rMW5a$9$k(B.
                    359: \BEG
                    360: It requests a server to register the data at the top of the stack
                    361: as the client's mathcap.
                    362: \E
1.1       noro      363:
                    364: @item SM_getsp=275
                    365:
1.2       noro      366: \JP $B8=:_%9%?%C%/$K@Q$^$l$F$$$k%G!<%?$N?t$r%9%?%C%/$K:\$;$k(B.
                    367: \EG The number of objects in the current stack is pushed to the stack.
1.1       noro      368:
                    369: @item SM_dupErrors=276
                    370:
1.2       noro      371: \BJP
1.1       noro      372: $B8=:_%9%?%C%/$K@Q$^$l$F$$$k%*%V%8%'%/%H$NFb(B, $B%(%i!<%*%V%8%'%/%H$N$_(B
                    373: $B$r%j%9%H$K$7$F(B, $B%9%?%C%/$K:\$;$k(B.
1.2       noro      374: \E
                    375: \BEG
                    376: The list of all the error objects in the current stack is pushed to
                    377: the stack.
                    378: \E
1.1       noro      379:
                    380: @item SM_nop=300
                    381:
1.2       noro      382: \JP $B$J$K$b$7$J$$(B.
                    383: \EG Nothing is done.
1.1       noro      384: @end table
                    385:
1.2       noro      386: \BJP
1.1       noro      387: @node $B%G%P%C%0(B,,, $BJ,;67W;;(B
                    388: @section $B%G%P%C%0(B
1.2       noro      389: \E
                    390: \BEG
                    391: @node Debugging,,, Distributed computation
                    392: @section Debugging
                    393: \E
1.1       noro      394:
1.2       noro      395: \BJP
1.1       noro      396: $BJ,;67W;;$K$*$$$F$O(B, $B0lHL$K%G%P%C%0$,:$Fq$H$J$k(B. @samp{ox_asir} $B$K(B
                    397: $B$*$$$F$O(B, $B%G%P%C%0$N$?$a$N$$$/$D$+$N5!G=$rDs6!$7$F$$$k(B.
1.2       noro      398: \E
                    399: \BEG
                    400: In general, it is difficult to debug distributed computations.
                    401: @samp{ox_asir} provides several functions for debugging.
                    402: \E
1.1       noro      403:
                    404: @menu
1.2       noro      405: \BJP
1.1       noro      406: * $B%(%i!<%*%V%8%'%/%H(B::
                    407: * $B%j%;%C%H(B::
                    408: * $B%G%P%C%0MQ%]%C%W%"%C%W%&%#%s%I%&(B::
1.2       noro      409: \E
                    410: \BEG
                    411: * Error object::
                    412: * Resetting a server::
                    413: * Pop-up command window for debugging::
                    414: \E
1.1       noro      415: @end menu
                    416:
1.2       noro      417: \BJP
1.1       noro      418: @node $B%(%i!<%*%V%8%'%/%H(B,,, $B%G%P%C%0(B
                    419: @subsection $B%(%i!<%*%V%8%'%/%H(B
1.2       noro      420: \E
                    421: \BEG
                    422: @node Error object,,, Debugging
                    423: @subsection Error object
                    424: \E
1.1       noro      425:
1.2       noro      426: \BJP
                    427: @b{OpenXM} server $B$,<B9TCf$K%(%i!<$r5/$3$7$?>l9g(B, $B7k2L$N$+$o$j$K(B
1.1       noro      428: @b{CMO} $B%(%i!<%*%V%8%'%/%H$r%9%?%C%/$K@Q$`(B. $B%(%i!<%*%V%8%'%/%H$O(B, $BBP1~$9$k(B
                    429: @b{SM} $B%3%^%s%I$N%7%j%"%kHV9f$H(B, $B%(%i!<%a%C%;!<%8$+$i$J$j(B, $B$=$l$K$h$C$F(B
                    430: $B$I$N(B @b{SM} $B%3%^%s%I$,$I$N$h$&$J%(%i!<$r5/$3$7$?$,$"$kDxEYH=L@$9$k(B.
1.2       noro      431: \E
                    432: \BEG
                    433: When an error has occurred on an @b{OpenXM} server,
                    434: an error object is pushed to the stack instead of a result of the computation.
                    435: The error object consists of the serial number of the @b{SM} command
                    436: which caused the error, and an error message.
                    437: \E
1.1       noro      438:
                    439: @example
                    440: [340] ox_launch();
                    441: 0
                    442: [341] ox_rpc(0,"fctr",1.2*x);
                    443: 0
                    444: [342] ox_pop_cmo(0);
                    445: error([8,fctrp : invalid argument])
                    446: @end example
                    447:
1.2       noro      448: \BJP
1.1       noro      449: @node $B%j%;%C%H(B,,, $B%G%P%C%0(B
1.2       noro      450: @subsection $B%j%;%C%H(B
                    451: \E
                    452: \BEG
                    453: @node Resetting a server,,, Debugging
                    454: @subsection Resetting a server
                    455: \E
1.1       noro      456:
1.2       noro      457: \BJP
1.1       noro      458: @code{ox_reset()} $B$O8=:_<B9TCf$N(B server $B$r%j%;%C%H$7$F(B, $B%3%^%s%I<u$1IU$1(B
                    459: $B>uBV$KLa$9(B. $B$3$N5!G=$O(B, $BDL>o$N(B @b{Asir} $B%;%C%7%g%s$K$*$1$k%-!<%\!<%I3d$j9~$_(B
1.2       noro      460: $B$H$[$\F1MM$K(B, @b{OpenXM} server $B$r%j%;%C%H$G$-$k(B. $B$^$?(B, $B2?$i$+$N860x$G(B,
1.1       noro      461: $BDL?.O)$N%G!<%?$,:\$C$?$^$^$N>uBV$G(B @code{ox_rpc()} $B$J$I$r<B9T$9$k$H(B,
                    462: @code{ox_pop_cmo()} $B$J$I(B, $B%9%?%C%/$+$i$N<h$j=P$7$H(B, $B<B:]$KFI$^$l$k%G!<%?(B
                    463: $B$NBP1~$,IT@5$K$J$k(B. $B$=$N$h$&$J>l9g$K$bM-8z$G$"$k(B.
1.2       noro      464: \E
1.1       noro      465:
1.2       noro      466: \BEG
                    467: @code{ox_reset()} resets a process whose identifier is @var{number}.
                    468: After its execution the process is ready for receiving data.
                    469: This function corresponds to the keyboard interrupt on an usual @b{Asir}
                    470: session. It often happens that a request of a client does not correspond
                    471: correctly to the result from a server. It is caused by remaining data
                    472: on data streams. @code{ox_reset} is effective for such cases.
                    473: \E
1.1       noro      474:
1.2       noro      475: \BJP
1.1       noro      476: @node $B%G%P%C%0MQ%]%C%W%"%C%W%&%#%s%I%&(B,,, $B%G%P%C%0(B
                    477: @subsection $B%G%P%C%0MQ%]%C%W%"%C%W%&%#%s%I%&(B
1.2       noro      478: \E
                    479: \BEG
                    480: @node Pop-up command window for debugging,,, Debugging
                    481: @subsection Pop-up command window for debugging
                    482: \E
1.1       noro      483:
1.2       noro      484: \BJP
1.1       noro      485: server $B$K$O(B, client $B$K$*$1$k%-!<%\!<%I$KAjEv$9$kF~NO5!G=$,$J$$$?$a(B,
                    486: server $BB&$GF0:n$7$F$$$k%f!<%68@8l%W%m%0%i%`$N%G%P%C%0$,:$Fq$K$J$k(B. $B$3$N(B
                    487: $B$?$a(B, server $BB&$G$N%f!<%68@8l%W%m%0%i%`<B9TCf$N%(%i!<$*$h$S(B, client $B$+$i(B
                    488: $B$N(B @code{ox_rpc(@var{id},"debug")} $B<B9T$K$h$j(B, server $B$K%G%P%C%0%3%^%s%I(B
                    489: $B$rF~NO$9$k$?$a$N>.$5$J%&%#%s%I%&$,%]%C%W%"%C%W$9$k(B. $B$3$N%&%#%s%I%&$+$i$N(B
                    490: $BF~NO$KBP$9$k=PNO$O(B, log $BMQ$N(B @samp{xterm} $B$KI=<($5$l$k(B. $B$3$N%&%#%s%I%&$r(B
                    491: $BJD$8$k$K$O(B, @code{quit} $B$rF~NO$9$l$P$h$$(B.
1.2       noro      492: \E
                    493: \BEG
                    494: As a server does not have any standard input device such as a keyboard,
                    495: it is difficult to debug user programs running on the server.
                    496: @samp{ox_asir} pops up a small command window to input debug commands
                    497: when an error has occurred during user a program execution or
                    498: @code{ox_rpc(@var{id},"debug")} has been executed.
                    499: The responses to commands are shown in @samp{xterm} to display
                    500: standard outputs from the server. To close the small window,
                    501: input @code{quit}.
                    502: \E
1.1       noro      503:
1.2       noro      504: \BJP
1.1       noro      505: @node $BJ,;67W;;$K4X$9$k4X?t(B,,, $BJ,;67W;;(B
                    506: @section $BJ,;67W;;$K4X$9$k4X?t(B
1.2       noro      507: \E
                    508: \BEG
                    509: @node Functions for distributed computation,,, Distributed computation
                    510: @section Functions for distributed computation
                    511: \E
1.1       noro      512:
                    513: @menu
                    514: * ox_launch ox_launch_nox ox_shutdown::
                    515: * ox_launch_generic::
                    516: * ox_asir::
                    517: * ox_rpc ox_cmo_rpc ox_execute_string::
                    518: * ox_push_cmo ox_push_local::
                    519: * ox_pop_cmo ox_pop_local::
                    520: * ox_push_cmd ox_sync::
                    521: * ox_get::
                    522: * ox_pops::
1.4       noro      523: * ox_reset ox_intr register_handler::
1.1       noro      524: * ox_select::
                    525: * ox_flush::
                    526: * ox_get_serverinfo::
                    527: * generate_port try_bind_listen try_connect try_accept register_server::
1.12      noro      528: * ifplot conplot plot polarplot plotover::
1.8       noro      529: * open_canvas clear_canvas draw_obj draw_string::
1.1       noro      530: @end menu
                    531:
1.2       noro      532: \JP @node ox_launch ox_launch_nox ox_shutdown,,, $BJ,;67W;;$K4X$9$k4X?t(B
                    533: \EG @node ox_launch ox_launch_nox ox_shutdown,,, Functions for distributed computation
1.1       noro      534: @subsection @code{ox_launch}, @code{ox_launch_nox}, @code{ox_shutdown}
                    535: @findex ox_launch
                    536: @findex ox_launch_nox
                    537: @findex ox_shutdown
                    538:
                    539: @table @t
                    540: @item ox_launch([@var{host}[,@var{dir}],@var{command}])
                    541: @itemx ox_launch_nox([@var{host}[,@var{dir}],@var{command}])
1.2       noro      542: \JP :: $B1s3V%W%m%;%9$N5/F0$*$h$SDL?.$r3+;O$9$k(B.
                    543: \EG :: Initialize OpenXM servers.
1.1       noro      544: @item ox_shutdown(@var{id})
1.2       noro      545: \JP :: $B1s3V%W%m%;%9$r=*N;$5$;(B, $BDL?.$r=*N;$9$k(B.
                    546: \EG :: Terminates OpenXM servers.
1.1       noro      547: @end table
                    548:
                    549: @table @var
                    550: @item return
1.2       noro      551: \JP $B@0?t(B
                    552: \EG integer
1.1       noro      553: @item host
1.2       noro      554: \JP $BJ8;zNs$^$?$O(B 0
                    555: \EG string or 0
1.13      noro      556: @item dir command
1.2       noro      557: \JP $BJ8;zNs(B
                    558: \EG string
1.1       noro      559: @item id
1.2       noro      560: \JP $B@0?t(B
                    561: \EG integer
1.1       noro      562: @end table
                    563:
                    564: @itemize @bullet
1.2       noro      565: \BJP
1.1       noro      566: @item
                    567: @code{ox_launch()} $B$O(B, $B%[%9%H(B @var{host} $B>e$G%3%^%s%I(B @var{command} $B$r5/F0$7(B,
                    568: $B$3$N%W%m%;%9$HDL?.$r3+;O$9$k(B.
                    569: $B0z?t$,(B 3 $B$D$N>l9g(B, @var{host} $B>e$G(B,
                    570: @var{dir} $B$K$"$k(B @samp{ox_launch} $B$H$$$&%5!<%P5/F0MQ%W%m%0%i%`$rN)$A>e$2$k(B.
                    571: @samp{ox_launch} $B$O(B @var{command} $B$r5/F0$9$k(B.
                    572: @var{host} $B$,(B 0 $B$N;~(B, @b{Asir} $B$,F0:n$7$F$$$k(B
                    573: $B%^%7%s>e$G%3%^%s%I$r5/F0$9$k(B.
                    574: $BL50z?t$N>l9g(B, @var{host} $B$O(B 0, @var{dir} $B$O(B @code{get_rootdir()}
                    575: $B$GJV$5$l$k%G%#%l%/%H%j(B, @var{command} $B$OF1$8%G%#%l%/%H%j$N(B @samp{ox_asir}
                    576: $B$r0UL#$9$k(B.
1.2       noro      577:
1.1       noro      578: @item
                    579: @var{host} $B$,(B 0, $B$9$J$o$A%5!<%P$r(B local $B$K5/F0$9$k>l9g$K$O(B, @var{dir}
                    580: $B$r>JN,$G$-$k(B. $B$3$N>l9g(B, @var{dir} $B$O(B @code{get_rootdir()} $B$GJV$5$l$k(B
                    581: $B%G%#%l%/%H%j$H$J$k(B.
1.2       noro      582:
1.1       noro      583: @item
                    584: @var{command} $B$,(B @samp{/} $B$G;O$^$kJ8;zNs$N>l9g(B, $B@dBP%Q%9$H2r<a$5$l$k(B.
                    585: $B$=$l0J30$N>l9g(B, @var{dir} $B$+$i$NAjBP%Q%9$H2r<a$5$l$k(B.
1.2       noro      586:
1.1       noro      587: @item
                    588: UNIX $BHG$K$*$$$F$O(B, @code{ox_launch()} $B$O(B, @var{command} $B$NI8=`=PNO(B, $BI8=`(B
                    589: $B%(%i!<=PNO$rI=<($9$k$?$a$N(B @samp{xterm} $B$r5/F0$9$k(B.
                    590: @code{ox_launch_nox()} $B$O(B, @code{X} $B$J$7$N4D6-$N>l9g(B, $B$"$k$$$O(B @samp{xterm}
                    591: $B$r5/F0$;$:$K%5!<%P$rN)$A>e$2$k>l9g$KMQ$$$k(B. $B$3$N>l9g(B,
                    592: @var{command} $B$N=PNO$O(B @samp{/dev/null} $B$K@\B3$5$l$k(B.
                    593: @code{ox_launch()} $B$N>l9g$G$b(B, $B4D6-JQ?t(B @code{DISPLAY} $B$,@_Dj$5$l$F$$$J$$(B
                    594: $B>l9g$K$O(B, @code{ox_launch_nox()} $B$HF1$8F0:n$r$9$k(B.
                    595:
                    596: @item
                    597: $BJV$5$l$k@0?t$ODL?.$N$?$a$N<1JL;R$H$J$k(B.
                    598:
                    599: @item
                    600: @b{Asir} $B$HDL?.$9$k%W%m%;%9$OF10l$N%^%7%s>e$GF0:n$7$F$$$kI,MW$O$J$$(B. $B$^(B
                    601: $B$?(B, $BDL?.$K$*$1$k%P%$%H%*!<%@$O(B server, client $B4V$G$N:G=i$N(B negotiation
                    602: $B$G7h$^$k$?$a(B, $BAj<j@h$N%^%7%s$H%P%$%H%*!<%@$,0[$J$C$F$$$F$b9=$o$J$$(B.
                    603:
                    604: @item
                    605: @var{host} $B$K%^%7%sL>$r;XDj$9$k>l9g(B, $B0J2<$N=`Hw$,I,MW$G$"$k(B.
                    606: $B$3$3$G(B, @b{Asir} $B$NF0$$$F$$$k%[%9%H$r(B @code{A}, $BDL?.Aj<j$N%W%m%;%9(B
                    607: $B$,5/F0$5$l$k%[%9%H$r(B @code{B} $B$H$9$k(B.
                    608:
                    609: @enumerate
                    610: @item
                    611: $B%[%9%H(B @code{B} $B$N(B @samp{~/.rhosts} $B$K(B, $B%[%9%H(B @code{A} $B$N%[%9%H(B
                    612: $BL>$rEPO?$9$k(B.
                    613:
                    614: @item
                    615: @samp{ox_plot} $B$J$I(B, @code{X} $B$H$N%3%M%/%7%g%s$bMQ$$$i$l$k>l9g(B,
                    616: @code{Xserver} $B$KBP$7(B, $BI,MW$J%[%9%H$r(B authorize $B$5$;$k(B.
                    617: @code{xhost} $B$GI,MW$J%[%9%HL>$rDI2C$9$l$P$h$$(B.
                    618:
                    619: @item
                    620: @var{command} $B$K$h$C$F$O(B, $B%9%?%C%/$rBgNL$K;HMQ$9$k(B
                    621: $B$b$N$b$"$k$?$a(B, @samp{.cshrc} $B$G%9%?%C%/%5%$%:$rBg$-$a(B (16MB $BDxEY(B) $B$K(B
                    622: $B;XDj$7$F$*$/$N$,0BA4$G$"$k(B. $B%9%?%C%/%5%$%:$O(B @code{limit stacksize 16m}
                    623: $B$J$I$H;XDj$9$k(B.
                    624: @end enumerate
                    625:
                    626: @item
                    627: @var{command} $B$,(B, X $B>e$K%&%$%s%I%&$r3+$1$k>l9g(B,
                    628: @var{display}$B$,;XDj$5$l$l$P$=$NJ8;zNs$r(B, $B>JN,;~$K$O4D6-JQ?t(B
                    629: @code{DISPLAY} $B$NCM$rMQ$$$k(B.
                    630:
                    631: @item
1.5       noro      632: $B4D6-JQ?t(B @code{ASIR_RSH} $B$,%;%C%H$5$l$F$$$k>l9g(B, $B%5!<%P$NN)$A>e$2%W%m%0%i%`(B
                    633: $B$H$7$F(B@samp{rsh} $B$NBe$o$j$K$3$NJQ?t$NCM$,MQ$$$i$l$k(B. $BNc$($P(B,
                    634:
                    635: @example
                    636: % setenv ASIR_RSH "ssh -f -X -A "
                    637: @end example
                    638:
                    639: $B$K$h$j(B, $B%5!<%P$NN)$A>e$2$K(B @samp{ssh} $B$,MQ$$$i$l(B,
                    640: X11 $B$NDL?.$,(B forwarding $B$5$l$k(B. $B>\$7$/$O(B @samp{ssh} $B$N%^%K%e%"%k$r(B
                    641: $B;2>H(B.
                    642:
                    643: @item
1.1       noro      644: @code{ox_shutdown()} $B$O<1JL;R(B @var{id} $B$KBP1~$9$k1s3V%W%m%;%9(B
                    645: $B$r=*N;$5$;$k(B.
                    646:
                    647: @item
                    648: @b{Asir} $B$,@5>o$7$?>l9g$K$OA4$F$NF~=PNO%9%H%j!<%`$O<+F0E*$KJD$8$i$l(B,
                    649: $B5/F0$5$l$F$$$k%W%m%;%9$OA4$F=*N;$9$k$,(B, $B0[>o=*N;$7$?>l9g(B, $B1s3V%W%m%;%9(B
                    650: $B$,=*N;$7$J$$>l9g$b$"$k(B. @b{Asir} $B$,0[>o=*N;$7$?>l9g(B, $B1s3V%W%m%;%9$r(B
                    651: $B5/F0$7$?%^%7%s>e$G(B @code{ps} $B$J$I$r5/F0$7$F(B, $B$b$7(B @b{Asir} $B$+$i5/F0(B
                    652: $B$7$?%W%m%;%9$,;D$C$F$$$k>l9g(B, @code{kill} $B$9$kI,MW$,$"$k(B.
                    653:
                    654: @item
                    655: log $BI=<(MQ(B @samp{xterm} $B$O(B @samp{-name ox_term} $B%*%W%7%g%s$G5/F0$5$l$k(B.
                    656: $B$h$C$F(B, @samp{ox_term} $B$J$k%j%=!<%9L>$KBP$7$F(B @samp{xterm} $B$N%j%=!<%9@_Dj(B
                    657: $B$r9T$($P(B, log $BMQ(B @samp{xterm} $B$N5sF0$N$_$rJQ$($k$3$H$,$G$-$k(B.
                    658: $BNc$($P(B,
1.2       noro      659:
1.1       noro      660: @example
                    661: ox_xterm*iconic:on
                    662: ox_xterm*scrollBar:on
                    663: ox_xterm*saveLines:1000
                    664: @end example
1.2       noro      665:
1.1       noro      666: $B$K$h$j(B, icon $B$G5/F0(B, scrollbar $B$D$-(B, scrollbar $B$G;2>H$G$-$k9T?t(B
                    667: $B$,:GBg(B 1000 $B9T(B, $B$H$$$&;XDj$,$G$-$k(B.
1.5       noro      668:
1.2       noro      669: \E
                    670:
                    671: \BEG
                    672: @item
                    673: Function @code{ox_launch()} invokes a process to execute @var{command}
                    674: on a host @var{host} and enables @b{Asir} to communicate with that
                    675: process.
                    676: If the number of arguments is 3, @samp{ox_launch} in @var{dir}
                    677: is invoked on @var{host}. Then @samp{ox_launch} invokes @var{command}.
                    678: If @var{host} is equal to 0, all the commands are invoked
                    679: on the same machine as the @b{Asir} is running.
                    680: If no arguments are specified, @var{host}, @var{dir} and @var{command}
1.3       noro      681: are regarded as 0, the value of @code{get_rootdir()} and @samp{ox_asir} in
1.2       noro      682: the same directory respectively.
                    683:
                    684: @item
                    685: If @var{host} is equal to 0, then @var{dir} can be omitted.
                    686: In such a case @var{dir} is regarded as the value of @code{get_rootdir()}.
                    687:
                    688: @item
                    689: If @var{command} begins with @samp{/}, it is regarded as an absolute
                    690: pathname. Otherwise it is regarded as a relative pathname from
                    691: @var{dir}.
                    692:
                    693: @item
                    694: On UNIX, @code{ox_launch()} invokes @samp{xterm} to display
                    695: standard outputs from @var{command}.
                    696: If @code{X11} is not available or one wants to invoke servers without
                    697: @samp{xterm}, use @code{ox_launch_nox()}, where the outputs of
                    698: @var{command} are redirected to @samp{/dev/null}.
                    699: If the environment variable @code{DISPLAY} is not set,
                    700: @code{ox_launch()} and @code{ox_launch_nox()} behave identically.
                    701:
                    702: @item
                    703: The returned value is used as the identifier for communication.
                    704:
                    705: @item
                    706: The peers communicating with @b{Asir} are not necessarily processes
                    707: running on the same machine.
                    708: The communication will be successful even if
                    709: the byte order is different from those of the peer processes,
                    710: because the byte order for the communication is determined
                    711: by a negotiation between a client and a server.
                    712:
                    713: @item
                    714: The following preparations are necessary.
                    715: Here, Let @code{A} be the host on which @b{Asir} is running, and
                    716: @code{B} the host on which the peer process will run.
                    717:
                    718: @enumerate
                    719: @item
                    720: Register the hostname of the host @code{A} to the @samp{~/.rhosts} of
                    721: the host @code{B}.
                    722: That is, you should be allowed to access the host @code{B} from @code{A}
                    723: without supplying a password.
                    724:
                    725: @item
                    726: For cases where connection to @code{X} is also used,
                    727: let @code{Xserver} authorize the relevant hosts.
                    728: Adding the hosts can be done by command @code{xhost}.
1.5       noro      729:
                    730: @item
                    731: If an environment variable @code{ASIR_RSH} is set,
                    732: the content of this variable is used as a promgram to invoke
                    733: remote servers instead of @var{rsh}. For example,
                    734:
                    735: @example
                    736: % setenv ASIR_RSH "ssh -f -X -A "
                    737: @end example
                    738:
                    739: implies that remote servers are invoked by @samp{ssh} and that
                    740: X11 forwarding is enabled. See the manual of @samp{ssh} for the detail.
1.2       noro      741:
                    742: @item
                    743: Some @var{command}'s consume much stack space.  You are recommended
                    744: to set the stack size to about 16MB large in @samp{.cshrc} for safe.
                    745: To specify the size, put @code{limit stacksize 16m} for an example.
                    746: @end enumerate
                    747:
                    748: @item
                    749: When @var{command} opens a window on @code{X},
                    750: it uses the string specified for @var{display};
                    751: if the specification is omitted, it uses the value set for the
                    752: environment variable @code{DISPLAY}.
                    753:
                    754: @item
                    755: @code{ox_shutdown()} terminates OpenXM servers whose identifier
                    756: is @var{id}.
                    757:
                    758: @item
                    759: When @b{Asir} is terminated successfully, all I/O streams are
                    760: automatically closed, and all the processes invoked are also terminated.
                    761: However, some remote processes may not terminated when @b{Asir}
                    762: is terminated abnormally.
                    763: If ever @b{Asir} is terminated abnormally, you have to kill all the
                    764: unterminated process invoked by @b{Asir} on every remote host.
                    765: Check by @code{ps} command on the remote hosts to see if such processed
                    766: are alive.
                    767:
                    768: @item
                    769: @samp{xterm} for displaying the outputs from @var{command} is
                    770: invoked with @samp{-name ox_term} option. Thus, by
                    771: specifying resources for the resource name @samp{ox_term},
                    772: only the behaviour of the @samp{xterm} can be customized.
                    773:
                    774: @example
                    775: /* iconify on start */
                    776: ox_xterm*iconic:on
                    777: /* activate the scroll bar */
                    778: ox_xterm*scrollBar:on
                    779: /* 1000 lines can be shown by the scrollbar */
                    780: ox_xterm*saveLines:1000
                    781: @end example
                    782: \E
1.1       noro      783: @end itemize
                    784:
                    785: @example
                    786: [219] ox_launch();
                    787: 0
                    788: [220] ox_rpc(0,"fctr",x^10-y^10);
                    789: 0
                    790: [221] ox_pop_local(0);
                    791: [[1,1],[x^4+y*x^3+y^2*x^2+y^3*x+y^4,1],
                    792: [x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],[x-y,1],[x+y,1]]
                    793: [222] ox_shutdown(0);
                    794: 0
                    795: @end example
                    796:
                    797: @table @t
1.2       noro      798: \JP @item $B;2>H(B
                    799: \EG @item References
                    800: @fref{ox_rpc ox_cmo_rpc ox_execute_string},
                    801: @fref{ox_pop_cmo ox_pop_local},
1.12      noro      802: @fref{ifplot conplot plot polarplot plotover}
1.1       noro      803: @end table
                    804:
1.2       noro      805: \JP @node ox_launch_generic,,, $BJ,;67W;;$K4X$9$k4X?t(B
                    806: \EG @node ox_launch_generic,,, Functions for distributed computation
1.1       noro      807: @subsection @code{ox_launch_generic}
                    808: @findex ox_launch_generic
                    809:
                    810: @table @t
                    811: @item ox_launch_generic(@var{host},@var{launch},@var{server},@var{use_unix},@var{use_ssh},@var{use_x},@var{conn_to_serv})
1.2       noro      812: \JP :: $B1s3V%W%m%;%9$N5/F0$*$h$SDL?.$r3+;O$9$k(B.
                    813: \EG :: Initialize OpenXM servers.
1.1       noro      814: @end table
                    815:
                    816: @table @var
                    817: @item return
1.2       noro      818: \JP $B@0?t(B
                    819: \EG integer
1.1       noro      820: @item host
1.2       noro      821: \JP $BJ8;zNs$^$?$O(B 0
                    822: \EG string or 0
1.13      noro      823: @item launcher server
1.2       noro      824: \JP $BJ8;zNs(B
                    825: \EG string
1.13      noro      826: @item use_unix use_ssh use_x conn_to_serv
1.2       noro      827: \JP $B@0?t(B
                    828: \EG integer
1.1       noro      829: @end table
                    830:
                    831: @itemize @bullet
1.2       noro      832: \BJP
1.1       noro      833: @item
                    834: @code{ox_launch_generic()} $B$O(B,
                    835: $B%[%9%H(B @var{host} $B>e$G(B, $B%3%s%H%m!<%k%W%m%;%9(B @var{launch} $B$*$h$S(B
                    836: $B%5!<%P%W%m%;%9(B @var{server} $B$r5/F0$9$k(B. $B$=$NB>$N0z?t$O(B, $B;HMQ$9$k(B
                    837: protocol $B$N<oN`(B, X $B$N;HMQ(B/$BIT;HMQ(B, rsh/ssh $B$K$h$k%W%m%;%95/F0(B, connect
                    838: $BJ}K!$N;XDj$J$I$r9T$&%9%$%C%A$G$"$k(B.
1.2       noro      839:
1.1       noro      840: @item
                    841: @var{host} $B$,(B 0 $B$N>l9g(B, @b{Asir} $B$,F0:n$7$F$$$k%^%7%s>e$K(B, @var{launch},
                    842: @var{server} $B$rN)$A>e$2$k(B. $B$3$N>l9g(B, @var{use_unix} $B$NCM$K$+$+$o$i$:(B,
                    843: UNIX internal protocol $B$,MQ$$$i$l$k(B.
1.2       noro      844:
1.1       noro      845: @item
                    846: @var{use_unix} $B$,(B 1 $B$N>l9g(B, UNIX internal protocol $B$rMQ$$$k(B. 0 $B$N>l9g(B,
                    847: Internet protocol $B$rMQ$$$k(B.
1.2       noro      848:
1.1       noro      849: @item
                    850: @var{use_ssh} $B$,(B 1 $B$N>l9g(B, @samp{ssh} (Secure Shell) $B$K$h$j%3%s%H%m!<%k(B,
1.2       noro      851: $B%5!<%P%W%m%;%9$rN)$A>e$2$k(B. @samp{ssh-agent} $B$J$I$rMxMQ$7$F$$$J>l9g(B,
                    852: $B%Q%9%o!<%I$NF~NO$,I,MW$H$J$k(B.
1.1       noro      853: $BAj<j@h$G(B @samp{sshd} $B$,F0$$$F$$$J$$>l9g(B, $B<+F0E*$K(B @samp{rsh} $B$,MQ$$$i$l$k$,(B,
                    854: $B%Q%9%o!<%I$,I,MW$H$J$k>l9g$K$O(B, $B$=$N>l$G5/F0$K<:GT$9$k(B.
1.2       noro      855:
1.1       noro      856: @item
                    857: @var{use_x} $B$,(B 1 $B$N>l9g(B, X $B>e$G$NF0:n$r2>Dj$7(B, $B@_Dj$5$l$F$$$k(B DISPLAY$BJQ(B
                    858: $B?t$rMQ$$$F(B, log $BI=<(MQ(B @samp{xterm} $B$N$b$H$G(B @var{server} $B$,5/F0$5$l(B
                    859: $B$k(B. DISPLAY $BJQ?t$,%;%C%H$5$l$F$$$J$$>l9g$K$O(B, $B<+F0E*$K(B X $B$J$7$N@_Dj$H$J(B
                    860: $B$k(B. DISPLAY $B$,ITE,@Z$K%;%C%H$5$l$F$$$k>l9g$K$O(B, $B%3%s%H%m!<%k(B, $B%5!<%P$,%O(B
                    861: $B%s%0$9$k$N$GMWCm0U$G$"$k(B.
1.2       noro      862:
1.1       noro      863: @item
                    864: @var{conn_to_serv} $B$,(B 1 $B$N>l9g(B, @b{Asir} (client) $B$,@8@.$7$?%]!<%H$K(B
                    865: $BBP$7(B, client $B$,(B bind,listen $B$7(B, $B5/F0$5$l$?%W%m%;%9$,(B connect $B$9$k(B.
                    866: @var{conn_to_serv} $B$,(B 0 $B$N>l9g(B, $B5/F0$5$l$?%W%m%;%9$,(B bind, listen $B$7(B,
                    867: client $B$,(B connect $B$9$k(B.
1.2       noro      868: \E
                    869:
                    870: \BEG
                    871: @item
                    872: @code{ox_launch_generic()} invokes a control process @var{launch}
                    873: and a server process @var{server} on @var{host}. The other arguments
                    874: are switches for protocol family selection, on/off of the X environment,
                    875: method of process invocation and selection of connection type.
                    876:
                    877: @item
                    878: If @var{host} is equal to 0, processes
                    879: are invoked on the same machine as the @b{Asir} is running.
                    880: In this case UNIX internal protocol is always used.
                    881:
                    882: @item
                    883: If @var{use_unix} is equal to 1, UNIX internal protocol is used.
                    884: If @var{use_unix} is equal to 0, Internet protocol is used.
                    885:
                    886: @item
                    887: If @var{use_ssh} is equal to 1,@samp{ssh} (Secure Shell)
                    888: is used to invoke processes. If one does not use @samp{ssh-agent},
                    889: a password (passphrase) is required.
                    890: If @samp{sshd} is not running on the target machine,
                    891: @samp{rsh} is used instead. But it will immediately fail
                    892: if a password is required.
                    893:
                    894: @item
                    895: If @var{use_x} is equal to 1, it is assumed that X environment
                    896: is available. In such a case @var{server} is invoked under
                    897: @samp{xterm} by using the current @code{DISPLAY} variable.
                    898: If @code{DISPLAY} is not set, it is invoked without X.
                    899: Note that the processes will hang up if @code{DISPLAY} is incorrectly set.
                    900:
                    901: @item
                    902: If @var{conn_to_serv} is equal to 1, @b{Asir} (client)
                    903: executes @code{bind} and @code{listen}, and the invoked processes execute
                    904: @code{connect}.
                    905: If @var{conn_to_serv} is equal to 0, @b{Asir} (client)
                    906: the invoked processes execute @code{bind} and @code{listen}, and
                    907: the client executes @code{connect}.
                    908: \E
1.1       noro      909: @end itemize
                    910:
                    911: @example
                    912: [342] LIB=get_rootdir();
                    913: /export/home/noro/ca/Kobe/build/OpenXM/lib/asir
                    914: [343] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",0,0,0,0);
                    915: 1
                    916: [344] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,0,0,0);
                    917: 2
                    918: [345] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,1,0,0);
                    919: 3
                    920: [346] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,1,1,0);
                    921: 4
                    922: [347] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,1,1,1);
                    923: 5
                    924: [348] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,1,0,1);
                    925: 6
                    926: @end example
                    927:
                    928: @table @t
1.2       noro      929: \JP @item $B;2>H(B
                    930: \EG @item References
                    931: @fref{ox_launch ox_launch_nox ox_shutdown}, @fref{ox_launch_generic}
1.1       noro      932: @end table
                    933:
1.2       noro      934: \JP @node generate_port try_bind_listen try_connect try_accept register_server,,, $BJ,;67W;;$K4X$9$k4X?t(B
                    935: \EG @node generate_port try_bind_listen try_connect try_accept register_server,,, Functions for distributed computation
1.1       noro      936: @subsection @code{generate_port}, @code{try_bind_listen}, @code{try_connect}, @code{try_accept}, @code{register_server}
                    937: @findex generate_port
                    938: @findex try_bind_listen
                    939: @findex try_connect
                    940: @findex try_accept
                    941: @findex register_server
                    942:
                    943: @table @t
                    944: @item generate_port([@var{use_unix}])
1.2       noro      945: \JP :: port $B$N@8@.(B
                    946: \EG :: Generates a port number.
1.1       noro      947: @itemx try_bind_listen(@var{port})
1.2       noro      948: \JP :: port $B$KBP$7$F(B bind, listen
                    949: \EG :: Binds and listens on a port.
1.1       noro      950: @itemx try_connect(@var{host},@var{port})
1.2       noro      951: \JP :: port $B$KBP$7$F(B connect
                    952: \EG :: Connects to a port.
1.1       noro      953: @itemx try_accept(@var{socket},@var{port})
1.2       noro      954: \JP :: connect $BMW5a$r(B accept
                    955: \EG :: Accepts a connection request.
1.1       noro      956: @itemx register_server(@var{control_socket},@var{control_port},@var{server_socket},@var{server_port})
1.2       noro      957: \JP :: connection $B$N@.N)$7$?(B control socket, server socket $B$NEPO?(B
                    958: \EG :: Registers the sockets for which connections are established.
1.1       noro      959: @end table
                    960:
                    961: @table @var
                    962: @item return
1.2       noro      963: \JP @code{generate_port()} $B$N$_@0?t$^$?$OJ8;zNs(B. $B$=$NB>$O@0?t(B.
                    964: \EG integer or string for @code{generate_port()}, integer for the others
1.1       noro      965: @item use_unix
1.2       noro      966: \JP 0 $B$^$?$O(B 1
                    967: \EG 0 or 1
1.1       noro      968: @item host
1.2       noro      969: \JP $BJ8;zNs(B
                    970: \EG string
1.13      noro      971: @item port control_port server_port
1.2       noro      972: \JP $B@0?t$^$?$OJ8;zNs(B
                    973: \EG integer or string
1.13      noro      974: @item socket control_socket server_socket
1.2       noro      975: \JP $B@0?t(B
                    976: \EG integer
1.1       noro      977: @end table
                    978:
                    979: @itemize @bullet
1.2       noro      980: \BJP
1.1       noro      981: @item
                    982: $B$3$l$i$N4X?t$O(B, $B1s3V%W%m%;%9$HDL?.$r@.N)$5$;$k$?$a$N%W%j%_%F%#%V$G$"$k(B.
1.2       noro      983:
1.1       noro      984: @item
                    985: @code{generate_port()} $B$ODL?.$N$?$a$N(B port $B$r@8@.$9$k(B. $BL50z?t$"$k$$$O(B
                    986: $B0z?t$,(B 0 $B$N>l9g(B, Internet domain $B$N(B socket $B$N$?$a$N(B port $BHV9f(B, $B$=$l(B
                    987: $B0J30$N>l9g$K$O(B, UNIX domain (host-internal protocol) $B$N$?$a$N(B, $B%U%!%$%kL>(B
                    988: $B$r@8@.$9$k(B. port $BHV9f$O(B random $B$K@8@.$5$l$k$,(B, $B$=$N(B port $B$,;HMQCf$G$J$$(B
                    989: $BJ]>Z$O$J$$(B.
1.2       noro      990:
1.1       noro      991: @item
                    992: @code{try_bind_listen()} $B$O(B, $BM?$($i$l$?(B port $B$KBP$7(B, $B$=$N(B protocol $B$K(B
1.2       noro      993: $BBP1~$7$?(B socket $B$r@8@.$7(B, bind, listen $B$9$k(B. $B@.8y$7$?>l9g(B,
                    994: socket $B<1JL;R$rJV$9(B. $B<:GT$7$?>l9g(B, -1 $B$,JV$k(B.
                    995:
1.1       noro      996: @item
                    997: @code{try_connect()} $B$O(B, $B%[%9%H(B @var{host} $B$N(B port @var{port} $B$KBP$7(B
1.2       noro      998: connect $B$r;n$_$k(B. $B@.8y$7$?>l9g(B, socket $B<1JL;R$rJV$9(B. $B<:GT$7$?>l9g(B -1 $B$,JV$k(B.
                    999:
1.1       noro     1000: @item
                   1001: @code{try_accept()} $B$O(B, @var{socket} $B$KBP$9$k(B connect $BMW5a$r(B accept
                   1002: $B$7(B, $B?7$?$K@8@.$5$l$?(B socket $B$rJV$9(B. $B<:GT$7$?>l9g(B -1 $B$,JV$k(B.
                   1003: $B$$$:$l$N>l9g$K$b(B, @var{socket} $B$O<+F0E*$K(B close $B$5$l$k(B.
                   1004: $B0z?t(B @var{port} $B$O(B, @var{socket} $B$N(B protocol $B$rH=JL$9$k$?$a$KM?$($k(B.
1.2       noro     1005:
1.1       noro     1006: @item
                   1007: @code{register_server()} $B$O(B, control, server $B$=$l$>$l$N(B socket $B$r(B
                   1008: $B0lAH$K$7$F(B, server list $B$KEPO?$7(B, @code{ox_push_cmo()} $B$J$I$GMQ$$$k(B
                   1009: $B%W%m%;%9<1JL;R$rJV$9(B.
1.2       noro     1010:
1.1       noro     1011: @item
                   1012: $B1s3V%W%m%;%9$N5/F0$O(B, @code{shell()} $B$^$?$O<jF0$G9T$&(B.
1.2       noro     1013: \E
                   1014: \BEG
                   1015: @item
                   1016: These functions are primitives to establish communications between
                   1017: a client and servers.
                   1018:
                   1019: @item
                   1020: @code{generate_port()} generates a port name for communication.
                   1021: If the argument is not specified or equal to 0, a port number
                   1022: for Internet domain socket is generated randomly. Otherwise
                   1023: a file name for UNIX domain (host-internal protocol) is generated.
                   1024: Note that it is not assured that the generated port is not in use.
                   1025:
                   1026: @item
                   1027: @code{try_bind_listen()} creates a socket according to the protocol
                   1028: family indicated by the given port and executes @code{bind} and @code{listen}.
                   1029: It returns a socket identifier if it is successful. -1 indicates an error.
                   1030:
                   1031: @item
                   1032: @code{try_connect()} tries to connect to a port @var{port} on
                   1033: a host @var{host}.
                   1034: It returns a socket identifier if it is successful. -1 indicates an error.
                   1035:
                   1036: @item
                   1037: @code{try_accept()} accepts a connection request to a socket @var{socket}.
                   1038: It returns a new socket identifier if it is successful. -1 indicates an error.
                   1039: In any case @var{socket} is automatically closed.
                   1040: @var{port} is specified to distinguish the protocol family of @var{socket}.
                   1041:
                   1042: @item
                   1043: @code{register_server()} registers a pair of a control socket and a server
                   1044: socket. A process identifier indicating the pair is returned.
                   1045: The process identifier is used as an argument
                   1046: of @code{ox} functions such as @code{ox_push_cmo()}.
                   1047:
                   1048: @item
                   1049: Servers are invoked by using @code{shell()}, or manually.
                   1050: \E
1.1       noro     1051: @end itemize
                   1052:
                   1053: @example
                   1054: [340] CPort=generate_port();
                   1055: 39896
                   1056: [341] SPort=generate_port();
                   1057: 37222
                   1058: [342] CSocket=try_bind_listen(CPort);
                   1059: 3
                   1060: [343] SSocket=try_bind_listen(SPort);
                   1061: 5
                   1062:
                   1063: /*
1.2       noro     1064: \JP $B$3$3$G(B, ox_launch $B$r5/F0(B :
                   1065: \EG ox_launch is invoked here :
1.1       noro     1066: %  ox_launch "127.1" 0 39716 37043 ox_asir "shio:0"
                   1067: */
                   1068:
                   1069: [344] CSocket=try_accept(CSocket,CPort);
                   1070: 6
                   1071: [345] SSocket=try_accept(SSocket,SPort);
                   1072: 3
                   1073: [346] register_server(CSocket,CPort,SSocket,SPort);
                   1074: 0
                   1075: @end example
                   1076:
                   1077: @table @t
1.2       noro     1078: \JP @item $B;2>H(B
                   1079: \EG @item References
                   1080: @fref{ox_launch ox_launch_nox ox_shutdown},
                   1081: @fref{ox_launch_generic}, @fref{shell}, @fref{ox_push_cmo ox_push_local}
1.1       noro     1082: @end table
                   1083:
1.2       noro     1084: \JP @node ox_asir,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1085: \EG @node ox_asir,,, Functions for distributed computation
1.1       noro     1086: @subsection @samp{ox_asir}
                   1087:
1.2       noro     1088: \BJP
                   1089: @samp{ox_asir} $B$O(B, @b{Asir} $B$N$[$\A4$F$N5!G=$r(B @b{OpenXM} $B%5!<%P(B
                   1090: $B$H$7$FDs6!$9$k(B.
                   1091: @samp{ox_asir} $B$O(B, @code{ox_launch} $B$^$?$O(B @code{ox_launch_nox} $B$G(B
                   1092: $B5/F0$9$k(B. $B8e<T$O(B X $B4D6-$rMQ$$$J$$>l9g$N$?$a$KMQ0U$5$l$F$$$k(B.
                   1093: \E
                   1094: \BEG
                   1095: @samp{ox_asir} provides almost all the functionalities of @b{Asir} as
                   1096: an @b{OpenXM} server.
                   1097: @samp{ox_asir} is invoked by @code{ox_launch} or @code{ox_launch_nox}.
                   1098: If X environment is not available or is not necessary, one can use
                   1099: @code{ox_launch_nox}.
                   1100: \E
1.1       noro     1101:
                   1102: @example
                   1103: [5] ox_launch();
                   1104: 0
                   1105: @end example
                   1106:
                   1107: @example
1.14      noro     1108: [5] ox_launch_nox("127.0.0.1","/usr/local/lib/asir",
                   1109: "/usr/local/lib/asir/ox_asir");
1.1       noro     1110: 0
                   1111: @end example
                   1112:
                   1113: @example
                   1114: [7] RemoteLibDir = "/usr/local/lib/asir/"$
                   1115: [8] Machines = ["sumire","rokkaku","genkotsu","shinpuku"];
                   1116: [sumire,rokkaku,genkotsu,shinpuku]
1.14      noro     1117: [9] Servers = map(ox_launch,Machines,RemoteLibDir,
                   1118: RemoteLibDir+"ox_asir");
1.1       noro     1119: [0,1,2,3]
                   1120: @end example
                   1121:
                   1122: @table @t
1.2       noro     1123: \JP @item $B;2>H(B
                   1124: \EG @item References
                   1125: @fref{ox_launch ox_launch_nox ox_shutdown}
1.1       noro     1126: @end table
                   1127:
1.2       noro     1128: \JP @node ox_rpc ox_cmo_rpc ox_execute_string,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1129: \EG @node ox_rpc ox_cmo_rpc ox_execute_string,,, Functions for distributed computation
1.1       noro     1130: @subsection @code{ox_rpc}, @code{ox_cmo_rpc}, @code{ox_execute_string}
                   1131: @findex ox_rpc
                   1132: @findex ox_cmo_rpc
                   1133: @findex ox_execute_string
                   1134:
                   1135: @table @t
                   1136: @item ox_rpc(@var{number},@code{"@var{func}"},@var{arg0},...)
                   1137: @itemx ox_cmo_rpc(@var{number},@code{"@var{func}"},@var{arg0},...)
                   1138: @itemx ox_execute_string(@var{number},@code{"@var{command}"},...)
1.2       noro     1139: \JP :: $B%W%m%;%9$NH!?t8F$S=P$7(B
                   1140: \EG :: Calls a function on an OpenXM server
1.1       noro     1141: @end table
                   1142:
                   1143: @table @var
                   1144: @item return
                   1145: 0
                   1146: @item number
1.2       noro     1147: \JP $B?t(B ($B%W%m%;%9<1JL;R(B)
                   1148: \EG integer (process identifier)
1.1       noro     1149: @item func
1.2       noro     1150: \JP $BH!?tL>(B
                   1151: \EG function name
1.1       noro     1152: @item command
1.2       noro     1153: \JP $BJ8;zNs(B
                   1154: \EG string
1.13      noro     1155: @item arg0 ...
1.2       noro     1156: \JP $BG$0U(B ($B0z?t(B)
                   1157: \EG arbitrary (arguments)
1.1       noro     1158: @end table
                   1159:
                   1160: @itemize @bullet
1.2       noro     1161: \BJP
1.1       noro     1162: @item
                   1163: $B<1JL;R(B @var{number} $B$N%W%m%;%9$NH!?t$r8F$S=P$9(B.
1.2       noro     1164:
1.1       noro     1165: @item
                   1166: $BH!?t$N7W;;=*N;$rBT$?$:(B, $BD>$A$K(B 0 $B$rJV$9(B.
1.2       noro     1167:
1.1       noro     1168: @item
                   1169: @code{ox_rpc()} $B$O(B, $B%5!<%P$,(B @samp{ox_asir} $B$N>l9g$N$_MQ$$$k$3$H$,$G$-$k(B.
                   1170: $B$=$l0J30$N>l9g$O(B, @code{ox_cmo_rpc()} $B$rMQ$$$k(B.
1.2       noro     1171:
1.1       noro     1172: @item
                   1173: $BH!?t$,JV$9CM$O(B @code{ox_pop_local()}, @code{ox_pop_cmo()} $B$K$h$j<h$j=P$9(B.
1.2       noro     1174:
1.1       noro     1175: @item
                   1176: $B%5!<%P$,(B @samp{ox_asir} $B0J30$N$b$N(B ($BNc$($P(B Kan $B%5!<%P(B @samp{ox_sm1}$B$J$I(B)
                   1177: $B$N>l9g$K$O(B, @b{Open_XM} $B%W%m%H%3%k$G%5%]!<%H$5$l$F$$$k%G!<%?$N$_$r(B
                   1178: $BAw$k$3$H$,$G$-$k(B.
1.2       noro     1179:
1.1       noro     1180: @item
                   1181: @code{ox_execute_string} $B$O(B, $BAw$C$?J8;zNs(B @var{command} $B$r%5!<%P$,<+$i$N(B
                   1182: $B%f!<%68@8l%Q!<%6$G2r@O$7(B, $BI>2A$7$?7k2L$r%5!<%P$N%9%?%C%/$KCV$/$h$&$K(B
                   1183: $B;X<($9$k(B.
1.2       noro     1184: \E
                   1185:
                   1186: \BEG
                   1187: @item
                   1188: Calls a function on an @b{OpenXM} server whose identifier is @var{number}.
                   1189:
                   1190: @item
                   1191: It returns 0 immediately. It does not wait the termination of the function
                   1192: call.
                   1193:
                   1194: @item
                   1195: @code{ox_rpc()} can be used when the server is @samp{ox_asir}.
                   1196: Otherwise @code{ox_cmo_rpc()} should be used.
                   1197:
                   1198: @item
                   1199: The result of the function call is put on the stack of the server.
                   1200: It can be received by @code{ox_pop_local()} or @code{ox_pop_cmo()}.
                   1201:
                   1202: @item
                   1203: If the server is not @samp{ox_asir}, only data defined in
                   1204: @b{OpenXM} can be sent.
                   1205:
                   1206: @item
                   1207: @code{ox_execute_string} requests the server to parse and execute
                   1208: @var{command} by the parser and the evaluater of the server.
                   1209: The result is pushed to the stack.
                   1210: \E
1.1       noro     1211: @end itemize
                   1212:
                   1213: @example
                   1214: [234] ox_cmo_rpc(0,"dp_ht",dp_ptod((x+y)^10,[x,y]));
                   1215: 0
                   1216: [235] ox_pop_cmo(0);
                   1217: (1)*<<10,0>>
                   1218: [236] ox_execute_string(0,"12345 % 678;");
                   1219: 0
                   1220: [237] ox_pop_cmo(0);
                   1221: 141
                   1222: @end example
                   1223:
                   1224: @table @t
1.2       noro     1225: \JP @item $B;2>H(B
                   1226: \EG @item References
                   1227: @fref{ox_pop_cmo ox_pop_local}
1.1       noro     1228: @end table
                   1229:
1.4       noro     1230: \JP @node ox_reset ox_intr register_handler,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1231: \EG @node ox_reset ox_intr register_handler,,, Functions for distributed computation
                   1232: @subsection @code{ox_reset},@code{ox_intr},@code{register_handler}
1.1       noro     1233: @findex ox_reset
                   1234: @findex register_handler
                   1235:
                   1236: @table @t
                   1237: @item ox_reset(@var{number})
1.2       noro     1238: \JP :: $B%W%m%;%9$N%j%;%C%H(B
                   1239: \EG :: Resets an OpenXM server
1.4       noro     1240: @item ox_intr(@var{number})
                   1241: \JP :: $B%W%m%;%9$N$K(B @code{SIGINT} $BAwIU(B
                   1242: \EG :: Sends @code{SIGINT} to an OpenXM server
1.1       noro     1243: @item register_handler(@var{func})
1.2       noro     1244: \JP :: $B%W%m%;%9$N%j%;%C%H$N$?$a$N4X?tEPO?(B
                   1245: \EG :: Registers a function callable on a keyboard interrupt.
1.1       noro     1246: @end table
                   1247:
                   1248: @table @var
                   1249: @item return
                   1250: 1
                   1251: @item number
1.2       noro     1252: \JP $B?t(B ($B%W%m%;%9<1JL;R(B)
                   1253: \EG integer(process identifier)
1.1       noro     1254: @item func
1.2       noro     1255: \JP $B4X?t;R$^$?$O(B 0
                   1256: \EG functor or 0
1.1       noro     1257: @end table
                   1258:
                   1259: @itemize @bullet
1.2       noro     1260: \BJP
1.1       noro     1261: @item
                   1262: @code{ox_reset()} $B$O(B, $B<1JL;R(B @var{number} $B$N%W%m%;%9$r%j%;%C%H$7(B, $B%3%^%s(B
                   1263: $B%I<u$1IU$1>uBV$K$9$k(B.
1.2       noro     1264:
1.1       noro     1265: @item
                   1266: $B$=$N%W%m%;%9$,4{$K=q$-=P$7$?(B, $B$"$k$$$O8=:_=q$-=P$7Cf$N%G!<%?$,$"$k>l9g(B,
                   1267: $B$=$l$rA4ItFI$_=P$7(B, $B=PNO%P%C%U%!$r6u$K$7$?;~E@$GLa$k(B.
1.2       noro     1268:
1.1       noro     1269: @item
                   1270: $B;R%W%m%;%9$,(B RUN $B>uBV$N>l9g$G$b(B, $B3d$j9~$_$K$h$j6/@)E*$K7W;;$r=*N;$5$;$k(B.
1.2       noro     1271:
1.1       noro     1272: @item
                   1273: $BJ,;67W;;$r9T$&H!?t$N@hF,$G(B, $B;HMQ$9$k%W%m%;%9$KBP$7$F<B9T$9$k(B. $B$"$k$$$O(B
                   1274: $B7W;;ESCf$G$N6/@)CfCG$KMQ$$$k(B.
1.2       noro     1275:
1.1       noro     1276: @item
1.4       noro     1277: @code{ox_intr()} $B$O(B, $B<1JL;R(B @var{number} $B$N%W%m%;%9$r$KBP$7$F(B
                   1278: @code{SIGINT} $B$rAwIU$9$k(B. @code{SIGINT} $B$KBP$9$k%W%m%;%9$NF0:n$O(B
                   1279: $B5,Dj$5$l$F$$$J$$$,(B, @samp{ox_asir} $B$N>l9g(B, $B$?$@$A$K(B debug mode $B$K(B
                   1280: $BF~$k(B. X $B>e$GF0:n$7$F$$$k>l9g(B, $B%G%P%C%0%3%^%s%IF~NOMQ$N%&%#%s%I%&$,(B
                   1281: $B%]%C%W%"%C%W$9$k(B.
                   1282:
                   1283: @item
1.1       noro     1284: @code{register_handler()} $B$O(B, @kbd{C-c} $B$J$I$K$h$k3d$j9~$_$N:]$K(B,
1.13      noro     1285: @kbd{u} $B$r;XDj$9$k$3$H$G(B, $BL50z?t%f!<%6Dj5A4X?t(B @var{func}() $B$,8F$S=P$5$l$k(B
1.1       noro     1286: $B$h$&$K@_Dj$9$k(B. $B$3$N4X?t$K(B, @code{ox_reset()} $B$r8F$S=P$5$;$k$3$H$G(B,
1.2       noro     1287: $B3d$j9~$_$N:]$K<+F0E*$K(B @b{OpenXM} server $B$N%j%;%C%H$r9T$&$3$H$,$G$-$k(B.
                   1288:
1.1       noro     1289: @item
                   1290: @var{func} $B$K(B 0 $B$r;XDj$9$k$3$H$G(B, $B@_Dj$r2r=|$G$-$k(B.
1.2       noro     1291: \E
                   1292:
                   1293: \BEG
                   1294: @item
                   1295: @code{ox_reset()} resets a process whose identifier is @var{number}.
                   1296: After its execution the process is ready for receiving data.
                   1297:
                   1298: @item
                   1299: After executing @code{ox_reset()}, sending/receiving buffers and
                   1300: stream buffers are assured to be empty.
                   1301:
                   1302: @item
                   1303: Even if a process is running, the execution is safely stopped.
                   1304:
                   1305: @item
                   1306: @code{ox_reset()} may be used prior to a distirbuted computation.
                   1307: It can be also used to interrupt a distributed computation.
                   1308:
                   1309: @item
1.4       noro     1310: @code{ox_intr()} sends @code{SIGINT} to a process whose identifier is
                   1311: @var{number}. The action of a server against @code{SIGINT} is not
                   1312: specified in @b{OpenXM}. @samp{ox_asir} immediately enters the debug
                   1313: mode and pops up an window to input debug commands on X window system.
                   1314:
                   1315: @item
1.13      noro     1316: @code{register_handler()} registers a function @var{func}().
                   1317: If @kbd{u} is specified on a keybord interrupt, @var{func}()
1.2       noro     1318: is executed before returning the toplevel.
1.13      noro     1319: If @code{ox_reset()} calls are included in @var{func}(),
1.2       noro     1320: one can automatically reset @b{OpenXM} servers on a keyboard interrupt.
                   1321:
                   1322: @item
                   1323: If @var{func} is equal to 0, the setting is reset.
                   1324: \E
1.1       noro     1325: @end itemize
                   1326:
                   1327: @example
                   1328: [10] ox_launch();
                   1329: 0
                   1330: [11] ox_rpc(0,"fctr",x^100-y^100);
                   1331: 0
1.2       noro     1332: \BJP
                   1333: [12] ox_reset(0); /* xterm $B$N%&%#%s%I%&$K$O(B                             */
                   1334: 1                 /* usr1 : return to toplevel by SIGUSR1 $B$,I=<($5$l$k(B. */
                   1335: \E
                   1336: \BEG
                   1337: [12] ox_reset(0); /* usr1 : return to toplevel by SIGUSR1 */
                   1338: 1                 /* is displayed on the xterm.           */
                   1339: \E
1.1       noro     1340: @end example
                   1341:
                   1342: @example
                   1343: [340] Procs=[ox_launch(),ox_launch()];
                   1344: [0,1]
                   1345: [341] def reset() @{ extern Procs; map(ox_reset,Procs);@}
                   1346: [342] map(ox_rpc,Procs,"fctr",x^100-y^100);
                   1347: [0,0]
                   1348: [343] register_handler(reset);
                   1349: 1
                   1350: [344] interrupt ?(q/t/c/d/u/w/?) u
                   1351: Abort this computation? (y or n) y
                   1352: Calling the registered exception handler...done.
                   1353: return to toplevel
                   1354: @end example
                   1355: @table @t
1.2       noro     1356: \JP @item $B;2>H(B
                   1357: \EG @item References
                   1358: @fref{ox_rpc ox_cmo_rpc ox_execute_string}
1.1       noro     1359: @end table
                   1360:
1.2       noro     1361: \JP @node ox_push_cmo ox_push_local,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1362: \EG @node ox_push_cmo ox_push_local,,, Functions for distributed computation
1.1       noro     1363: @subsection @code{ox_push_cmo}, @code{ox_push_local}
                   1364: @findex ox_push_cmo
                   1365: @findex ox_push_local
                   1366:
                   1367: @table @t
                   1368: @item ox_push_cmo(@var{number},@var{obj})
                   1369: @itemx ox_push_local(@var{number},@var{obj})
1.2       noro     1370: \JP :: @var{obj} $B$r<1JL;R(B @var{number} $B$N%W%m%;%9$KAw?.(B
                   1371: \EG :: Sends @var{obj} to a process whose identifier is @var{number}.
1.1       noro     1372: @end table
                   1373:
                   1374: @table @var
                   1375: @item return
                   1376: 0
                   1377: @item number
1.2       noro     1378: \JP $B?t(B($B%W%m%;%9<1JL;R(B)
                   1379: \EG integer(process identifier)
1.1       noro     1380: @item obj
1.2       noro     1381: \JP $B%*%V%8%'%/%H(B
                   1382: \EG object
1.1       noro     1383: @end table
                   1384:
                   1385: @itemize @bullet
1.2       noro     1386: \BJP
1.1       noro     1387: @item $B<1JL;R(B @var{number} $B$N%W%m%;%9$K(B @var{obj} $B$rAw?.$9$k(B.
                   1388: @item @code{ox_push_cmo} $B$O(B, Asir $B0J30$N(B @b{Open_XM} $B%5!<%P$KAw?.(B
                   1389: $B$9$k:]$KMQ$$$k(B.
                   1390: @item @code{ox_push_local} $B$O(B, @samp{ox_asir}, @samp{ox_plot} $B$K(B
                   1391: $B%G!<%?$rAw$k>l9g$KMQ$$$k$3$H$,$G$-$k(B.
                   1392: @item $B%P%C%U%!$,$$$C$Q$$$K$J$i$J$$8B$j(B, $B$?$@$A$KI|5"$9$k(B.
1.2       noro     1393: \E
                   1394: \BEG
                   1395: @item
                   1396: Sends @var{obj} to a process whose identifier is @var{number}.
                   1397:
                   1398: @item
                   1399: @code{ox_push_cmo} is used to send data to an @b{Open_XM} other
                   1400: than @samp{ox_asir} and @samp{ox_plot}.
                   1401:
                   1402: @item
                   1403: @code{ox_push_local} is used to send data to @samp{ox_asir} and @samp{ox_plot}.
                   1404:
                   1405: @item
                   1406: The call immediately returns unless the stream buffer is full.
                   1407: \E
1.1       noro     1408: @end itemize
                   1409:
                   1410: @table @t
1.2       noro     1411: \JP @item $B;2>H(B
                   1412: \EG @item References
                   1413: @fref{ox_rpc ox_cmo_rpc ox_execute_string},
                   1414: @fref{ox_pop_cmo ox_pop_local}
1.1       noro     1415: @end table
                   1416:
1.2       noro     1417: \JP @node ox_pop_cmo ox_pop_local,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1418: \EG @node ox_pop_cmo ox_pop_local,,, Functions for distributed computation
1.1       noro     1419: @subsection @code{ox_pop_cmo}, @code{ox_pop_local}
                   1420: @findex ox_pop_local
                   1421: @findex ox_pop_cmo
                   1422:
                   1423: @table @t
                   1424: @item ox_pop_local(@var{number})
1.2       noro     1425: \JP :: $B%W%m%;%9<1JL;R(B @var{number} $B$+$i%G!<%?$r<u?.$9$k(B.
                   1426: \EG :: Receives data from a process whose identifier is @var{number}.
1.1       noro     1427: @end table
                   1428:
                   1429: @table @var
                   1430: @item return
1.2       noro     1431: \JP $B<u?.%G!<%?(B
                   1432: \EG received data
1.1       noro     1433: @item number
1.2       noro     1434: \JP $B?t(B ($B%W%m%;%9<1JL;R(B)
                   1435: \EG integer(process identifier)
1.1       noro     1436: @end table
                   1437:
                   1438: @itemize @bullet
1.2       noro     1439: \BJP
1.1       noro     1440: @item
                   1441: $B%W%m%;%9<1JL;R(B @var{number} $B$N%W%m%;%9$+$i%G!<%?$r<u?.$9$k(B.
                   1442: @item @code{ox_pop_cmo} $B$O(B, Asir $B0J30$N(B @b{Open_XM} $B%5!<%P$+$i<u?.(B
                   1443: $B$9$k:]$KMQ$$$k(B.
                   1444: @item @code{ox_pop_local} $B$O(B, @samp{ox_asir}, @samp{ox_plot} $B$+$i(B
                   1445: $B%G!<%?$r<u$1<h$k>l9g$KMQ$$$k$3$H$,$G$-$k(B.
                   1446: @item $B%5!<%P$,7W;;Cf$N>l9g%V%m%C%/$9$k(B. $B$3$l$rHr$1$k$?$a$K$O(B,
                   1447: @code{ox_push_cmd} $B$G(B @code{SM_popCMO} (262) $B$^$?$O(B @code{SM_popSerializedLocalObject} (258) $B$rAw$C$F$*$-(B, @code{ox_select} $B$G%W%m%;%9$,(B ready
                   1448: $B$K$J$C$F$$$k$3$H$r3N$+$a$F$+$i(B @code{ox_get} $B$9$l$P$h$$(B.
1.2       noro     1449: \E
                   1450: \BEG
1.1       noro     1451: @item
1.2       noro     1452: Receives data from a process whose identifier is @var{number}.
                   1453: @item
                   1454: @code{ox_pop_cmo} can be used to receive data form an @b{OpenXM} server
                   1455: other than @samp{ox_asir} and @samp{ox_plot}.
                   1456: @item
                   1457: @code{ox_pop_local} can be used to receive data from
                   1458: @samp{ox_asir}, @samp{ox_plot}.
                   1459: @item
                   1460: If no data is available, these functions block.
                   1461: To avoid it, send @code{SM_popCMO} (262) or
                   1462: @code{SM_popSerializedLocalObject} (258).
                   1463: Then check the process status by @code{ox_select}.
                   1464: Finally call @code{ox_get} for a ready process.
                   1465: \E
1.1       noro     1466: @end itemize
                   1467:
                   1468: @example
1.15    ! noro     1469: [341] ox_cmo_rpc(0,"fctr",x^2-1);
1.1       noro     1470: 0
1.15    ! noro     1471: [342] ox_pop_cmo(0);
        !          1472: [[1,1],[x-1,1],[x+1,1]]
        !          1473: [343] ox_cmo_rpc(0,"newvect",3);
1.1       noro     1474: 0
1.15    ! noro     1475: [344] ox_pop_cmo(0);
        !          1476: error([41,cannot convert to CMO object])
        !          1477: [345] ox_pop_local(0);
        !          1478: [ 0 0 0 ]
1.1       noro     1479: @end example
                   1480:
                   1481: @table @t
1.2       noro     1482: \JP @item $B;2>H(B
                   1483: \EG @item References
                   1484: @fref{ox_rpc ox_cmo_rpc ox_execute_string},
                   1485: @fref{ox_push_cmd ox_sync}, @fref{ox_select}, @fref{ox_get}
1.1       noro     1486: @end table
                   1487:
1.2       noro     1488: \JP @node ox_push_cmd ox_sync,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1489: \EG @node ox_push_cmd ox_sync,,, Functions for distributed computation
1.1       noro     1490: @subsection @code{ox_push_cmd}, @code{ox_sync}
                   1491: @findex ox_push_cmd
                   1492: @findex ox_sync
                   1493:
                   1494: @table @t
                   1495: @item ox_push_cmd(@var{number},@var{command})
1.2       noro     1496: \JP :: $B%W%m%;%9<1JL;R(B @var{number} $B$N%W%m%;%9$K%3%^%s%I(B @var{command} $B$rAw?.$9$k(B.
                   1497: \EG :: Sends a command @var{command} to a process whose identifier is @var{number}.
1.1       noro     1498: @item ox_sync(@var{number})
1.2       noro     1499: \JP :: $B%W%m%;%9<1JL;R(B @var{number} $B$N%W%m%;%9$K(B @b{OX_SYNC_BALL} $B$rAw?.$9$k(B.
                   1500: \EG :: Sends @b{OX_SYNC_BALL} to a process whose identifier is @var{number}.
1.1       noro     1501: @end table
                   1502:
                   1503: @table @var
                   1504: @item return
                   1505: 0
                   1506: @item number
1.2       noro     1507: \JP $B?t(B ($B%W%m%;%9<1JL;R(B)
                   1508: \EG integer(process identifier)
1.1       noro     1509: @item command
1.2       noro     1510: \JP $B?t(B ($B%3%^%s%I<1JL;R(B)
                   1511: \EG integer(command identifier)
1.1       noro     1512: @end table
                   1513:
                   1514: @itemize @bullet
1.2       noro     1515: \BJP
1.1       noro     1516: @item
                   1517: $B<1JL;R(B @var{number} $B$N%W%m%;%9$K%3%^%s%I$^$?$O(B @b{OX_SYNC_BALL} $B$rAw?.$9$k(B.
1.2       noro     1518:
1.1       noro     1519: @item
                   1520: @b{Open_XM} $B$K$*$$$FAw<u?.%G!<%?$O(B @b{OX_DATA}, @b{OX_COMMAND},
                   1521: @b{OX_SYNC_BALL}$B$N(B 3 $B<oN`$KJ,$+$l$k(B. $BDL>o(B, $B%3%^%s%I$O2?$i$+$NA`:n$K(B
                   1522: $BIU?o$7$F0EL[$N$&$A$KAw?.$5$l$k$,(B, $B$3$l$r%f!<%6$,8DJL$KAw$j$?$$>l9g$K(B
                   1523: $BMQ$$$i$l$k(B.
1.2       noro     1524:
1.1       noro     1525: @item
                   1526: @b{OX_SYNC_BALL} $B$O(B @code{ox_reset} $B$K$h$k7W;;CfCG(B, $BI|5"$N:]$KAw<u?.$5$l$k(B
                   1527: $B$,(B, $B$3$l$r8DJL$KAw$j$?$$>l9g$KMQ$$$k(B. $B$J$*(B, $BDL>o>uBV$G$O(B @b{OX_SYNC_BALL}
                   1528: $B$OL5;k$5$l$k(B.
1.2       noro     1529: \E
                   1530:
                   1531: \BEG
                   1532: @item
                   1533: Sends a command or @b{OX_SYNC_BALL} to a process whose identifier is
                   1534: @var{number}.
                   1535:
                   1536: @item
                   1537: Data in @b{OpenXM} are categorized into three types:
                   1538: @b{OX_DATA}, @b{OX_COMMAND}, @b{OX_SYNC_BALL}.
                   1539: Usually @b{OX_COMMAND} and @b{OX_SYNC_BALL} are
                   1540: sent implicitly with high level operations, but
                   1541: these functions are prepared to send these data explicitly.
                   1542:
                   1543: @item
                   1544: @b{OX_SYNC_BALL} is used on the reseting operation by @code{ox_reset}.
                   1545: Usually @b{OX_SYNC_BALL} will be ignored by the peer.
                   1546: \E
1.1       noro     1547: @end itemize
1.15    ! noro     1548:
        !          1549: @example
        !          1550: [3] ox_rpc(0,"fctr",x^100-y^100);
        !          1551: 0
        !          1552: [4] ox_push_cmd(0,258);
        !          1553: 0
        !          1554: [5] ox_select([0]);
        !          1555: [0]
        !          1556: [6] ox_get(0);
        !          1557: [[1,1],[x^2+y^2,1],[x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],...]
        !          1558: @end example
1.1       noro     1559:
                   1560: @table @t
1.2       noro     1561: \JP @item $B;2>H(B
                   1562: \EG @item References
1.4       noro     1563: @fref{ox_rpc ox_cmo_rpc ox_execute_string}, @fref{ox_reset ox_intr register_handler}
1.1       noro     1564: @end table
                   1565:
1.2       noro     1566: \JP @node ox_get,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1567: \EG @node ox_get,,, Functions for distributed computation
1.1       noro     1568: @subsection @code{ox_get}
                   1569: @findex ox_get
                   1570:
                   1571: @table @t
                   1572: @item ox_get(@var{number})
1.2       noro     1573: \JP :: $B%W%m%;%9<1JL;R(B @var{number} $B$N%W%m%;%9$+$i%G!<%?$r<u?.$9$k(B.
                   1574: \EG :: Receives data form a process whose identifer is @var{number}.
1.1       noro     1575: @end table
                   1576:
                   1577: @table @var
                   1578: @item return
1.2       noro     1579: \JP $B<u?.%G!<%?(B
1.1       noro     1580: @item number
1.2       noro     1581: \JP $B?t(B($B%W%m%;%9<1JL;R(B)
                   1582: \EG integer(process identifier)
1.1       noro     1583: @end table
                   1584:
                   1585: @itemize @bullet
1.2       noro     1586: \BJP
1.1       noro     1587: @item
                   1588: $B%W%m%;%9<1JL;R(B @var{number} $B$N%W%m%;%9$+$i%G!<%?$r<u?.$9$k(B. $B4{$K(B
                   1589: $B%9%H%j!<%`>e$K%G!<%?$,$"$k$3$H$r2>Dj$7$F$$$k(B.
1.2       noro     1590:
1.1       noro     1591: @item
                   1592: @code{ox_push_cmd} $B$HAH$_9g$o$;$FMQ$$$k(B.
1.2       noro     1593:
1.1       noro     1594: @item
                   1595: @code{ox_pop_cmo}, @code{ox_pop_local} $B$O(B, @code{ox_push_cmd} $B$H(B
                   1596: @code{ox_get} $B$NAH$_9g$o$;$G<B8=$5$l$F$$$k(B.
1.2       noro     1597: \E
                   1598: \BEG
                   1599: @item
                   1600: Receives data form a process whose identifer is @var{number}.
                   1601:
                   1602: @item
                   1603: One may use this function with @code{ox_push_cmd}.
                   1604:
                   1605: @item
                   1606: @code{ox_pop_cmo} and @code{ox_pop_local}
                   1607: is realized as combinations of @code{ox_push_cmd} and @code{ox_get}.
                   1608: \E
1.1       noro     1609: @end itemize
                   1610:
                   1611: @example
                   1612: [11] ox_push_cmo(0,123);
                   1613: 0
                   1614: [12] ox_push_cmd(0,262); /* 262=OX_popCMO */
                   1615: 0
                   1616: [13] ox_get(0);
                   1617: 123
                   1618: @end example
                   1619:
                   1620: @table @t
1.2       noro     1621: \JP @item $B;2>H(B
                   1622: \EG @item References
                   1623: @fref{ox_pop_cmo ox_pop_local}, @fref{ox_push_cmd ox_sync}
1.1       noro     1624: @end table
                   1625:
1.2       noro     1626: \JP @node ox_pops,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1627: \EG @node ox_pops,,, Functions for distributed computation
1.1       noro     1628: @subsection @code{ox_pops}
                   1629: @findex ox_pops
                   1630:
                   1631: @table @t
1.13      noro     1632: @item ox_pops(@var{number}[,@var{nitem}])
1.2       noro     1633: \JP :: $B%W%m%;%9<1JL;R(B @var{number} $B$N%W%m%;%9$N%9%?%C%/$+$i%G!<%?$r<h$j=|$/(B.
                   1634: \EG :: Removes data form the stack of a process whose identifier is @var{number}.
1.1       noro     1635: @end table
                   1636:
                   1637: @table @var
                   1638: @item return
                   1639: 0
                   1640: @item number
1.2       noro     1641: \JP $B?t(B ($B%W%m%;%9<1JL;R(B)
                   1642: \EG integer(process identifier)
1.1       noro     1643: @item nitem
1.2       noro     1644: \JP $B<+A3?t(B
                   1645: \EG non-negative integer
1.1       noro     1646: @end table
                   1647:
                   1648: @itemize @bullet
1.2       noro     1649: \BJP
                   1650: @item
                   1651: $B%W%m%;%9<1JL;R(B @var{number} $B$N%W%m%;%9$N%9%?%C%/$+$i%G!<%?$r<h$j=|$/(B.
1.1       noro     1652: @var{nitem} $B$,;XDj$5$l$F$$$k>l9g$O(B @var{nitem} $B8D(B, $B;XDj$N$J$$>l9g$O(B
                   1653: 1 $B8D<h$j=|$/(B.
1.2       noro     1654: \E
                   1655: \BEG
                   1656: @item
                   1657: Removes data form the stack of a process whose identifier is @var{number}.
                   1658: If @var{nitem} is specified, @var{nitem} items are removed.
                   1659: If @var{nitem} is not specified, 1 item is removed.
                   1660: \E
1.1       noro     1661: @end itemize
                   1662:
                   1663: @example
                   1664: [69] for(I=1;I<=10;I++)ox_push_cmo(0,I);
                   1665: [70] ox_pops(0,4);
                   1666: 0
                   1667: [71] ox_pop_cmo(0);
                   1668: 6
                   1669: @end example
                   1670:
                   1671: @table @t
1.2       noro     1672: \JP @item $B;2>H(B
                   1673: \EG @item References
                   1674: @fref{ox_pop_cmo ox_pop_local}
1.1       noro     1675: @end table
                   1676:
1.2       noro     1677: \JP @node ox_select,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1678: \EG @node ox_select,,, Functions for distributed computation
1.1       noro     1679: @subsection @code{ox_select}
                   1680: @findex ox_select
                   1681:
                   1682: @table @t
                   1683: @item ox_select(@var{nlist}[,@var{timeout}])
1.2       noro     1684: \JP :: $BFI$_=P$72DG=$J%W%m%;%9$N<1JL;R$rJV$9(B.
                   1685: \EG :: Returns the list of process identifiers on which data is available.
1.1       noro     1686: @end table
                   1687:
                   1688: @table @var
                   1689: @item return
1.2       noro     1690: \JP $B%j%9%H(B
                   1691: \EG list
1.1       noro     1692: @item nlist
1.2       noro     1693: \JP $B?t(B ($B;R%W%m%;%9<1JL;R(B) $B$N%j%9%H(B
                   1694: \EG list of integers (process identifier)
1.1       noro     1695: @item timeout
1.2       noro     1696: \JP $B?t(B
                   1697: \EG number
1.1       noro     1698: @end table
                   1699:
                   1700: @itemize @bullet
1.2       noro     1701: \BJP
1.1       noro     1702: @item
                   1703: $B<1JL;R%j%9%H(B @var{nlist} $B$N%W%m%;%9$N$&$A4{$K=PNO$rJV$7$F$$$k(B
                   1704: $B%W%m%;%9$N<1JL;R%j%9%H$rJV$9(B.
1.2       noro     1705:
1.1       noro     1706: @item
                   1707: $BA4$F$N%W%m%;%9$,(B RUN $B>uBV$N$H$-(B, $B$$$:$l$+$N%W%m%;%9$N=*N;$rBT$D(B.
                   1708: $BC"$7(B, @var{timeout} $B$,;XDj$5$l$F$$$k>l9g(B, @var{timeout} $BIC$@$1BT$D(B.
1.2       noro     1709:
1.1       noro     1710: @item
                   1711: @code{ox_push_cmd()} $B$G(B @code{SM_popCMO} $B$"$k$$$O(B
                   1712: @code{SM_popSerializedLocalObject} $B$rAw$C$F$*$-(B, @code{ox_select()} $B$G(B
                   1713: ready $B>uBV$N%W%m%;%9$rD4$Y$F(B@code{ox_get()} $B$9$k$3$H$G(B,
                   1714: @code{ox_pop_local()}, @code{ox_pop_cmo()}$B$GBT$A>uBV$KF~$k$N$rKI$0$3$H$,(B
                   1715: $B$G$-$k(B.
1.2       noro     1716: \E
                   1717: \BEG
                   1718: @item
                   1719: Returns the list of process identifiers on which data is available.
                   1720:
                   1721: @item
                   1722: If all the processes in @var{nlist} are running, it blocks until
                   1723: one of the processes returns data. If @var{timeout} is specified,
                   1724: it waits for only @var{timeout} seconds.
                   1725:
                   1726: @item
                   1727: By sending @code{SM_popCMO} or @code{SM_popSerializedLocalObject} with
                   1728: @code{ox_push_cmd()} in advance and by examining the process status with
                   1729: @code{ox_select()}, one can avoid a hanging up caused by @code{ox_pop_local()}
                   1730: or @code{ox_pop_cmo()}. In such a case, data can be received by
                   1731: @code{ox_get()}.
                   1732: \E
1.1       noro     1733: @end itemize
                   1734:
                   1735: @example
                   1736: ox_launch();
                   1737: 0
                   1738: [220] ox_launch();
                   1739: 1
                   1740: [221] ox_launch();
                   1741: 2
                   1742: [222] ox_rpc(2,"fctr",x^500-y^500);
                   1743: 0
                   1744: [223] ox_rpc(1,"fctr",x^100-y^100);
                   1745: 0
                   1746: [224] ox_rpc(0,"fctr",x^10-y^10);
                   1747: 0
                   1748: [225] P=[0,1,2];
                   1749: [0,1,2]
                   1750: [226] map(ox_push_cmd,P,258);
                   1751: [0,0,0]
                   1752: [227] ox_select(P);
                   1753: [0]
                   1754: [228] ox_get(0);
                   1755: [[1,1],[x^4+y*x^3+y^2*x^2+y^3*x+y^4,1],
                   1756: [x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],[x-y,1],[x+y,1]]
                   1757: @end example
                   1758:
                   1759: @table @t
1.2       noro     1760: \JP @item $B;2>H(B
                   1761: \EG @item References
                   1762: @fref{ox_pop_cmo ox_pop_local}, @fref{ox_push_cmd ox_sync}, @fref{ox_get}
1.1       noro     1763: @end table
                   1764:
1.2       noro     1765: \JP @node ox_flush ,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1766: \EG @node ox_flush ,,, Functions for distributed computation
1.1       noro     1767: @subsection @code{ox_flush}
                   1768: @findex ox_flush
                   1769:
                   1770: @table @t
                   1771: @item ox_flush(@var{id})
1.2       noro     1772: \JP :: $BAw?.%P%C%U%!$N6/@)(B flush
                   1773: \EG :: Flushes the sending buffer.
1.1       noro     1774: @end table
                   1775:
                   1776: @table @var
                   1777: @item return
                   1778: 1
                   1779: @item id
1.2       noro     1780: \JP $B;R%W%m%;%9<1JL;R(B
                   1781: \EG process identifier
1.1       noro     1782: @end table
                   1783:
                   1784: @itemize @bullet
1.2       noro     1785: \BJP
1.1       noro     1786: @item $BDL>o$O%P%C%A%b!<%I$O(B off $B$G$"$j(B, $B%G!<%?(B, $B%3%^%s%IAw?.$4$H$K(B
                   1787: $BAw?.%P%C%U%!$O(B flush $B$5$l$k(B.
1.2       noro     1788:
1.1       noro     1789: @item $B%P%C%A%b!<%I$O(B @code{"ctrl"} $B%3%^%s%I$N(B @code{"ox_batch"} $B%9%$%C%A(B
                   1790: $B$G(B on/off $B$G$-$k(B.
1.2       noro     1791:
1.1       noro     1792: @item $B:Y$+$$%G!<%?$rB??tAw$k>l9g$K(B, @code{ctrl("ox_batch",1)}
                   1793: $B$G%P%C%A%b!<%I$r(B on $B$K$9$k$H(B, $B%P%C%U%!$,$$$C$Q$$$K$J$C$?>l9g$K$N$_(B flush
                   1794: $B$5$l$k$?$a(B, overhead $B$,>.$5$/$J$k>l9g$,$"$k(B. $B$?$@$7$3$N>l9g$K$O(B, $B:G8e$K(B
                   1795: @code{ox_flush(@var{id})} $B$r<B9T$7$F(B, $B%P%C%U%!$r6/@)E*$K(B flush $B$9$kI,MW$,(B
                   1796: $B$"$k(B.
1.2       noro     1797:
1.1       noro     1798: @item @code{ox_pop_cmo}, @code{ox_pop_local} $B$N$h$&$K(B, $B%3%^%s%IAw?.8e(B
                   1799: $B$?$@$A$K%G!<%?BT$A$KF~$k4X?t$,%O%s%0$7$J$$$h$&(B, $B$3$l$i$N4X?t$NFbIt$G$O(B
                   1800: $B6/@)(B flush $B$,<B9T$5$l$F$$$k(B.
1.2       noro     1801: \E
                   1802:
                   1803: \BEG
                   1804: @item
                   1805: By default the batch mode is off and the sending buffer is flushed
                   1806: at every sending operation of data and command.
                   1807:
                   1808: @item
                   1809: The batch mode is set by @code{"ox_batch"} switch of @code{"ctrl"}.
                   1810:
                   1811: @item
                   1812: If one wants to send many pieces of small data,
                   1813: @code{ctrl("ox_batch",1)} may decrease the overhead of flush operations.
                   1814: Of course, one has to call @code{ox_flush(@var{id})} at the end of
                   1815: the sending operations.
                   1816:
                   1817: @item
                   1818: Functions such as @code{ox_pop_cmo} and @code{ox_pop_local}
                   1819: enter a waiting mode immediately after sending a command.
                   1820: These functions always flush the sending buffer.
                   1821: \E
1.1       noro     1822: @end itemize
                   1823:
                   1824: @example
                   1825: [340] ox_launch_nox();
                   1826: 0
                   1827: [341] cputime(1);
                   1828: 0
                   1829: 7e-05sec + gc : 4.8e-05sec(0.000119sec)
                   1830: [342] for(I=0;I<10000;I++)ox_push_cmo(0,I);
                   1831: 0.232sec + gc : 0.006821sec(0.6878sec)
                   1832: [343] ctrl("ox_batch",1);
                   1833: 1
                   1834: 4.5e-05sec(3.302e-05sec)
                   1835: [344] for(I=0;I<10000;I++)ox_push_cmo(0,I); ox_flush(0);
                   1836: 0.08063sec + gc : 0.06388sec(0.4408sec)
                   1837: [345] 1
                   1838: 9.6e-05sec(0.01317sec)
                   1839: @end example
                   1840:
                   1841: @table @t
1.2       noro     1842: \JP @item $B;2>H(B
                   1843: \EG @item References
                   1844: @fref{ox_pop_cmo ox_pop_local}, @fref{ctrl}
1.1       noro     1845: @end table
                   1846:
1.2       noro     1847: \JP @node ox_get_serverinfo ,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1848: \EG @node ox_get_serverinfo ,,, Functions for distributed computation
1.1       noro     1849: @subsection @code{ox_get_serverinfo}
                   1850: @findex ox_get_serverinfo
                   1851:
                   1852: @table @t
                   1853: @item ox_get_serverinfo([@var{id}])
1.2       noro     1854: \JP :: server $B$N(B Mathcap, $BF0:nCf$N%W%m%;%9<1JL;R$N<hF@(B
                   1855: \EG :: Gets server's mathcap and proess id.
1.1       noro     1856: @end table
                   1857:
                   1858: @table @var
                   1859: @item return
1.2       noro     1860: \JP $B%j%9%H(B
                   1861: \EG list
1.1       noro     1862: @item id
1.2       noro     1863: \JP $B;R%W%m%;%9<1JL;R(B
                   1864: \EG process identifier
1.1       noro     1865: @end table
                   1866:
                   1867: @itemize @bullet
1.2       noro     1868: \BJP
1.1       noro     1869: @item $B0z?t(B @var{id} $B$,$"$k$H$-(B, $B%W%m%;%9<1JL;R(B @var{id} $B$N%W%m%;%9$N(B
                   1870: Mathcap $B$r%j%9%H$H$7$FJV$9(B.
                   1871: @item $B0z?t$J$7$N$H$-(B, $B8=:_F0:nCf$N%W%m%;%9<1JL;R$*$h$S$=$N(B Mathcap $B$+$i(B
                   1872: $B$J$k%Z%"$r(B, $B%j%9%H$H$7$FJV$9(B.
1.2       noro     1873: \E
                   1874: \BEG
                   1875: @item If @var{id} is specified, the mathcap of the process whose
                   1876: identifier is @var{id} is returned.
1.13      noro     1877: @item If @var{id} is not specified, the list of [@var{id},@var{Mathcap}]
1.2       noro     1878: is returned, where @var{id} is the identifier of a currently active process,
                   1879: and @var{Mathcap} is the mathcap of the process.
                   1880: identifier @var{id} is returned.
                   1881: \E
1.1       noro     1882: @end itemize
                   1883:
                   1884: @example
                   1885: [343] ox_get_serverinfo(0);
                   1886: [[199909080,Ox_system=ox_sm1.plain,Version=2.991118,HOSTTYPE=FreeBSD],
                   1887: [262,263,264,265,266,268,269,272,273,275,276],
1.14      noro     1888: [[514],[2130706434,1,2,4,5,17,19,20,22,23,24,25,26,30,31,60,61,27,
                   1889: 33,40,16,34]]]
1.1       noro     1890: [344] ox_get_serverinfo();
1.14      noro     1891: [[0,[[199909080,Ox_system=ox_sm1.plain,Version=2.991118,
                   1892: HOSTTYPE=FreeBSD],
1.1       noro     1893: [262,263,264,265,266,268,269,272,273,275,276],
1.14      noro     1894: [[514],[2130706434,1,2,4,5,17,19,20,22,23,24,25,26,30,31,60,61,27,33,
                   1895: 40,16,34]]]],
1.1       noro     1896: [1,[[199901160,ox_asir],
                   1897: [276,275,258,262,263,266,267,268,274,269,272,265,264,273,300,270,271],
                   1898: [[514,2144202544],
1.14      noro     1899: [1,2,3,4,5,2130706433,2130706434,17,19,20,21,22,24,25,26,31,27,33,60],
                   1900: [0,1]]]]]
1.1       noro     1901: @end example
                   1902:
                   1903: @table @t
1.2       noro     1904: \JP @item $B;2>H(B
                   1905: \EG @item References
                   1906: @fref{Mathcap}.
1.1       noro     1907: @end table
                   1908:
1.12      noro     1909: \JP @node ifplot conplot plot polarplot plotover,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   1910: \EG @node ifplot conplot plot polarplot plotover,,, Functions for distributed computation
                   1911: @subsection @code{ifplot}, @code{conplot}, @code{plot}, @code{polarplot}, @code{plotover}
1.1       noro     1912: @findex ifplot
                   1913: @findex conplot
1.12      noro     1914: @findex polarplot
1.1       noro     1915: @findex plot
                   1916: @findex plotover
                   1917:
                   1918: @table @t
                   1919: @item ifplot(@var{func} [,@var{geometry}] [,@var{xrange}] [,@var{yrange}] [,@var{id}] [,@var{name}])
1.2       noro     1920: \JP :: 2 $BJQ?t4X?t$N<B?t>e$G$NNmE@$rI=<($9$k(B.
                   1921: \EG :: Displays real zeros of a bi-variate function.
1.1       noro     1922: @item conplot(@var{func} [,@var{geometry}] [,@var{xrange}] [,@var{yrange}] [,@var{zrange}] [,@var{id}] [,@var{name}])
1.2       noro     1923: \JP :: 2 $BJQ?t4X?t$N<B?t>e$G$NEy9b@~$rI=<($9$k(B.
                   1924: \EG :: Displays real contour lines of a bi-variate function.
1.1       noro     1925: @item plot(@var{func} [,@var{geometry}] [,@var{xrange}] [,@var{id}] [,@var{name}])
1.2       noro     1926: \JP :: 1 $BJQ?t4X?t$N%0%i%U$rI=<($9$k(B.
                   1927: \EG :: Displays the graph of a univariate function.
1.11      noro     1928: @item polarplot(@var{func} [,@var{geometry}] [,@var{thetarange}] [,@var{id}] [,@var{name}])
                   1929: \JP :: $B6K7A<0$GM?$($i$l$?6J@~$rI=<($9$k(B.
                   1930: \EG :: Displays the graph of a curve given in polar form.
1.1       noro     1931: @item plotover(@var{func},@var{id},@var{number})
1.2       noro     1932: \JP :: $B$9$G$KB8:_$7$F$$$k%&%#%s%I%&$XIA2h$9$k(B.
                   1933: \EG Plots on the existing window real zeros of a bivariate function.
1.1       noro     1934: @end table
                   1935:
                   1936: @table @var
                   1937: @item return
1.2       noro     1938: \JP $B@0?t(B
                   1939: \EG integer
1.1       noro     1940: @item func
1.2       noro     1941: \JP $BB?9`<0(B
                   1942: \EG polynomial
1.13      noro     1943: @item geometry  xrange  yrange  zrange
1.2       noro     1944: \JP $B%j%9%H(B
                   1945: \EG list
1.13      noro     1946: @item id  number
1.2       noro     1947: \JP $B@0?t(B
                   1948: \EG integer
1.1       noro     1949: @item name
1.2       noro     1950: \JP $BJ8;zNs(B
                   1951: \EG string
1.1       noro     1952: @end table
                   1953:
                   1954: @itemize @bullet
1.2       noro     1955: \BJP
1.1       noro     1956: @item
                   1957: @code{ifplot()} $B$O(B, 2 $BJQ?t4X?t(B @var{func} $B$N<B?t>e$G$NNmE@$N(B
                   1958: $B%0%i%U$NI=<($r9T$&(B. @code{conplot()} $B$O(B, $BF1MM$N0z?t$KBP$7(B,
1.11      noro     1959: $BEy9b@~$NI=<($r9T$&(B.
                   1960: @code{plot()} $B$O(B 1 $BJQ?t4X?t$N%0%i%U$NI=<($r9T$&(B.
1.13      noro     1961: @code{polarplot()} $B$O(B $B6K7A<0(B @var{r}=@var{f}(@var{theta}) $B$GI=$5$l$?6J@~$N%0%i%U$NI=<($r9T$&(B.
1.2       noro     1962:
1.1       noro     1963: @item
1.6       noro     1964: $B$3$l$i$O(B OpenXM $B%5!<%P$H$7$F<B8=$5$l$F$$$k(B. UNIX $B>e$G$O(B
                   1965: @samp{ox_plot} $B$,(B, Windows $B>e$G$O(B @samp{engine} $B$,$3$l$i$N5!G=(B
                   1966: $B$rDs6!$7$F$*$j(B, $B$3$l$i$O(B @b{Asir} $B$NI8=`%i%$%V%i%j%G%#%l%/%H%j$K$"$k(B.
1.11      noro     1967: $B%"%/%F%#%V$J(B @samp{ox_plot} $B$N(B id $B$,(B @var{id} $B$H$7$F;XDj$5$l$?>l9g(B,
                   1968: $B$=$N%5!<%P$,MQ$$$i$l$k(B. id $B$N;XDj$,$J$$>l9g$K$O(B, $B5/F0$5$l$F(B
                   1969: $B$$$k%5!<%P$N$&$A(B, @samp{ox_plot} $B$,$"$l$P$=$N%5!<%P$,MQ$$$i$l$k(B.
                   1970: @samp{ox_plot} $B$,5/F0$5$l$F$$$J$$>l9g$K$O(B,
                   1971: @code{ox_launch_nox()} $B$,<+F0E*$K<B9T$5$l$F(B, @samp{ox_plot} $B$,(B
                   1972: $BN)$A>e$,$j(B, $B$=$l$,MQ$$$i$l$k(B.
1.2       noro     1973:
1.1       noro     1974: @item
                   1975: $B0z?t$NFb(B, @var{func} $B$OI,?\$G$"$k(B. $B$=$NB>$N0z?t$O%*%W%7%g%s$G$"$k(B.
                   1976: $B%*%W%7%g%s$N7A<0$*$h$S$=$N%G%U%)%k%HCM(B ($B%+%C%3Fb(B) $B$O<!$NDL$j(B.
1.2       noro     1977:
1.1       noro     1978: @table @var
                   1979: @item geometry
1.13      noro     1980: $B%&%#%s%I%&$N%5%$%:$r%I%C%HC10L$G(B [@var{x},@var{y}] $B$G;XDj$9$k(B.
                   1981: ([@code{300},@code{300}]. )
1.2       noro     1982:
1.13      noro     1983: @item xrange  yrange
                   1984: $BJQ?t$NHO0O$N;XDj$G(B, [@var{v},@var{vmin},@var{vmax}] $B$G;XDj$9$k(B.
                   1985: ($B$$$:$l$NJQ?t$b(B [@var{v},@code{-2},@code{2}].)
1.1       noro     1986: $B$3$N;XDj$,$J$$>l9g(B, @var{func} $B$K4^$^$l$kJQ?t$NFbJQ?t=g=x$N>e$NJQ?t(B
                   1987: $B$,(B @samp{x}, $B2<$NJQ?t$,(B @samp{y} $B$H$7$F07$o$l$k(B. $B$3$l$rHr$1$k$?$a$K$O(B
                   1988: @var{xrange}, @var{yrange} $B$r;XDj$9$k(B. $B$^$?(B, @var{func} $B$,(B 1 $BJQ?t$N(B
                   1989: $B>l9g(B, $B$3$l$i$N;XDj$OI,?\$H$J$k(B.
1.2       noro     1990:
1.1       noro     1991: @item zrange
                   1992: @code{conplot()} $B$N>l9g$N$_;XDj$G$-$k(B. $B7A<0$O(B
1.13      noro     1993: [@var{v},@var{vmin},@var{vmax} @code{[},@var{step} @code{]}] $B$G(B, @var{step} $B$,;XDj$5$l(B
                   1994: $B$?>l9g$K$O(B, $BEy9b@~$N4V3V$,(B (@var{vmax}-@var{vmin})/@var{step} $B$H$J$k(B.
                   1995: ([@var{z},@code{-2},@code{2},@code{16}].)
1.2       noro     1996:
1.1       noro     1997: @item id
                   1998: $B1s3V%W%m%;%9$NHV9f(B, $B$9$J$o$A(B @code{ox_launch()} $B$,JV$7$?HV9f$r;XDj$9$k(B.
                   1999: ($B0lHV:G6a$K:n$i$l(B, $B$+$D%"%/%F%#%V$J%W%m%;%9$KBP1~$9$kHV9f(B.)
1.2       noro     2000:
1.1       noro     2001: @item name
                   2002: $B%&%#%s%I%&$NL>A0(B. (@code{Plot}.)
                   2003: $B@8@.$5$l$?%&%#%s%I%&$N%?%$%H%k$O(B @var{name:n/m} $B$H$J$k(B.
                   2004: $B$3$l$O(B, $B%W%m%;%9HV9f(B @var{n} $B$N%W%m%;%9$N(B, @var{m} $BHV$N%&%#%s%I%&$r0UL#$9$k(B.
                   2005: $B$3$NHV9f$O(B, @code{plotover()} $B$GMQ$$$i$l$k(B.
                   2006: @end table
1.2       noro     2007:
1.1       noro     2008: @item
                   2009: $B0l$D$N%W%m%;%9>e$GIA2h$G$-$k%&%#%s%I%&$N?t$O:GBg(B 128 $B8D$G$"$k(B.
1.2       noro     2010:
1.1       noro     2011: @item
                   2012: @code{plotover()} $B$O(B, $B;XDj$7$?%&%#%s%I%&>e$K(B, $B0z?t$G$"$k(B 2 $BJQ?tB?9`<0$N(B
                   2013: $BNmE@$r>e=q$-$9$k(B.
                   2014:
                   2015: @item
                   2016: $BIA2h=*N;8e$N%&%#%s%I%&>e$G(B, $B%^%&%9$N:8%\%?%s$r2!$7$J$,$i$N%I%i%C%0(B
                   2017: $B$GHO0O$r;XDj$7%\%?%s$rN%$9$H?7$?$J%&%#%s%I%&$,@8@.$5$l(B, $B;XDj$7$?(B
                   2018: $BHO0O$,3HBg$7$FI=<($5$l$k(B. $B%I%i%C%0$O:8>e$+$i1&2<$X$H9T$&(B.
                   2019: $B%I%i%C%0$r;O$a$?8e%-%c%s%;%k$9$k>l9g$O(B, $B%^%&%9%]%$%s%?$r;OE@$N>e$+(B
                   2020: $B:8$K;}$C$F$$$C$F%\%?%s$rN%$;$P$h$$(B. $B?7$7$$%&%$%s%I%&$N7A$O(B, $B;XDj(B
                   2021: $BNN0h$HAj;w$G(B, $B:GBgJU$,(B, $B85$N%&%#%s%I%&$N:GBgJU$H0lCW$9$k$h$&$K(B
                   2022: $BDj$a$i$l$k(B. $B0J2<$G@bL@$9$k(B @code{precise} $B$,(B on $B$N>l9g(B,
                   2023: $BA*Br$7$?NN0h$,F10l(B window $B>e$G=q$-D>$5$l$k(B.
                   2024:
                   2025: @item
                   2026: $B%&%#%s%I%&Fb$G1&%\%?%s$r2!$9$H(B, $B$=$NE@$N:BI8$,%&%#%s%I%&$N2<It$KI=<($5$l$k(B.
                   2027:
                   2028: @item
                   2029: @code{conplot()} $B$G@8@.$7$?%&%#%s%I%&$K$*$$$F(B, $B%&%#%s%I%&$N1&B&$N%^!<%+$r(B
                   2030: $BCf%\%?%s$G%I%i%C%0$9$k$H(B, $BBP1~$9$kEy9b@~$N?'$,JQ$o$j(B, $B1&>e$N(B
                   2031: $B%&%#%s%I%&$KBP1~$9$k%l%Y%k$,I=<($5$l$k(B.
                   2032:
                   2033: @item
1.2       noro     2034: UNIX $BHG$G$O$$$/$D$+$N%\%?%s$K$h$j(B
1.1       noro     2035: $B$$$/$D$+$N@_DjJQ99(B, $BA`:n$,$G$-$k(B. UNIX $BHG$G$O<!$N%\%?%s$,$"$k(B.
                   2036:
                   2037: @table @code
                   2038: @item quit
                   2039: window $B$rGK2u$9$k(B. $B7W;;$rCfCG$9$k>l9g(B, @code{ox_reset()} $B$rMQ$$$k(B.
1.2       noro     2040:
1.1       noro     2041: @item wide ($B%H%0%k(B)
                   2042: $B8=:_$NI=<(ItJ,$r=D2#3F(B 10 $BG\$7$?NN0h$rI=<($9$k(B. $B8=:_I=<($5$l$F$$$kHO0O$O(B
                   2043: $B$3$NI=<($K$*$$$FCf1{It$KD9J}7A$G<($5$l$k(B. $B$3$NI=<($GHO0O;XDj$r9T$&$H(B,
                   2044: $B$=$NHO0O$,?7$7$$%&%#%s%I%&$KIA2h$5$l$k(B.
1.2       noro     2045:
1.1       noro     2046: @item precise ($B%H%0%k(B)
                   2047: $BA*BrNN0h$r(B, $B@0?t1i;;$K$h$j(B, $B$h$j@53N$K:FIA2h$9$k(B. $B$3$l$O(B, @var{func} $B$,(B
                   2048: $BM-M}?t78?t$N(B 2 $BJQ?tB?9`<0$N>l9g$K$N$_M-8z$G$"$k(B. $B$3$N%b!<%I$G$O(B Sturm $BNs(B
                   2049: $B$HFsJ,K!$K$h$j(B, $B6h4VFb$NNmE@$N8D?t$r@53N$K5a$a$F$$$/$b$N$G(B, $B%G%U%)%k%H$N(B
                   2050: $B7W;;K!$h$j$b@53N$JIA2h$,4|BT$G$-$k(B. $B$?$@$7(B, $BIA2h;~4V$OM>7W$K$+$+$k>l9g$,(B
                   2051: $BB?$$(B. $B$3$N@bL@$+$iL@$i$+$J$h$&$K(B, $B$3$N5!G=$OM-M}?t78?t$NB?9`<0$NIA2h$KBP(B
                   2052: $B$7$F$N$_M-8z$G$"$k(B. ((x^2+y^2-1)^2 $B$NIA2h$G;n$7$F$_$h(B.)
                   2053:
                   2054: @item formula
                   2055: $BBP1~$9$k<0$rI=<($9$k(B.
1.2       noro     2056:
1.1       noro     2057: @item noaxis ($B%H%0%k(B)
                   2058: $B:BI8<4$r>C$9(B.
                   2059: @end table
                   2060:
                   2061: @item
                   2062: @samp{ox_plot} $B$,5/F0$5$l$k%^%7%s$K$h$C$F$O(B, $B%9%?%C%/$rBgNL$K;HMQ$9$k(B
                   2063: $B$b$N$b$"$k$?$a(B, @samp{.cshrc} $B$G%9%?%C%/%5%$%:$rBg$-$a(B (16MB $BDxEY(B) $B$K(B
                   2064: $B;XDj$7$F$*$/$N$,0BA4$G$"$k(B. $B%9%?%C%/%5%$%:$O(B @code{limit stacksize 16m}
                   2065: $B$J$I$H;XDj$9$k(B.
                   2066:
                   2067: @item
                   2068: @code{X} $B$G$O!"%&%$%s%I%&$N3FItJ,$K$D$$$F(B resource $B$K$h$j(B
                   2069: $B?'IU$1$d!"%\%?%s$N7A$rJQ$($k$3$H$,$G$-$k!#(B
                   2070: resource $B$N;XDj$N;EJ}$O0J2<$NDL$j!#!J%G%U%)%k%H$r<($7$F$*$/!K(B
                   2071: @code{plot*form*shapeStyle} $B$O!"(B@t{rectangle, oval, ellipse, roundedRectangle}
                   2072: $B$,!";XDj$G$-$k!#(B
1.2       noro     2073: \E
                   2074: \BEG
                   2075: @item
                   2076: Function @code{ifplot()} draws a graph of real zeros of a bi-variate
                   2077: function.
                   2078: Function @code{conplot()} plots the contour lines for a same argument.
                   2079: Function @code{plot()} draws the graph of a uninivariate function.
1.11      noro     2080: Function @code{polarplot()} draws the graph of a curve given in polar form
1.13      noro     2081: @var{r}=@var{f}(@var{theta}).
1.2       noro     2082:
                   2083: @item
1.6       noro     2084: The plotting functions are realized by an OpenXM server.
                   2085: On UNIX it is @samp{ox_plot} in @b{Asir} root directory.
                   2086: On Windows @samp{engine} acts as @samp{ox_plot}.
                   2087: Of course, it must be activated by @code{ox_launch()} @code{ox_launch_nox()}.
1.11      noro     2088: If the identifier of an active @samp{ox_plot} is specified as @var{id},
                   2089: the server is used for drawing pictures.
                   2090: If @var{id} is not specified, an available @samp{ox_plot} server
                   2091: is used if it exists. If no @samp{ox_plot} server is available,
                   2092: then @code{ox_launch_nox()} is automatically executed to
                   2093: invoke @samp{ox_plot}.
1.2       noro     2094:
                   2095: @item
                   2096: Argument @var{func} is indispensable. Other arguments are optional.
                   2097: The format of optional arguments and their default values (parenthesized)
                   2098: are listed below.
                   2099:
                   2100: @table @var
                   2101: @item geometry
1.13      noro     2102: Window size is specified by [@var{x},@var{y}] in unit `dot.'
                   2103: [@code{300},@code{300}] for UNIX version;
1.2       noro     2104:
1.13      noro     2105: @item xrange  yrange
                   2106: Value ranges of the variables are specified by [@var{v},@var{vmin},@var{vmax}].
                   2107: ([@var{v},@code{-2},@code{2}] for each variable.)
1.2       noro     2108: If this specification is omitted, the indeterminate having the higher
                   2109: order in @var{func} is taken for @samp{x} and the one with lower order
                   2110: is taken for @samp{y}.  To change this selection, specify explicitly
                   2111: by @var{xrange} and/or @var{yrange}.
                   2112: For an uni-variate function, the specification is mandatory.
                   2113:
                   2114: @item zrange
                   2115: This specification applies only to @code{conplot()}.  The format is
1.13      noro     2116: [@var{v},@var{vmin},@var{vmax} @code{[},@var{step} @code{]}].
1.2       noro     2117: If @var{step} is specified, the height difference of contours is set to
1.13      noro     2118: (@var{vmax}-@var{vmin})/@var{step}.
                   2119: ([@var{z},@code{-2},@code{2},@code{16}].)
1.2       noro     2120:
                   2121: @item id
                   2122: This specifies the number of the remote process by which you wish
                   2123: to draw a graph.
                   2124: (The number for the newest active process.)
                   2125:
                   2126: @item name
                   2127: The name of the window.
                   2128: (@code{Plot}.)
                   2129: The created window is titled @var{name:n/m} which means the @var{m}-th
                   2130: window of the process with process number @var{n}.
                   2131: These numbers are used for @code{plotover()}.
                   2132: @end table
                   2133:
                   2134: @item
                   2135: The maximum number of the windows that can be created on a process is
                   2136: 128.
                   2137:
                   2138: @item
                   2139: Function @code{plotover()} superposes reals zeros of its argument
                   2140: bi-variate function onto the specified window.
                   2141:
                   2142: @item
                   2143: Enlarged plot can be obtained for rectangular area which is specified,
                   2144: on an already existing window with a graph,
                   2145: by dragging cursor with the left button of mouse
                   2146: from the upper-left corner to lower-right corner
                   2147: and then releasing it.
                   2148: Then, a new window is created whose shape is similar to the specified
                   2149: area and whose size is determined so that the largest
                   2150: side of the new window has the same size of the largest side of
                   2151: the original window.
                   2152: If you wish to cancel the action, drag the cursor to any point
                   2153: above or left of the starting point.
                   2154:
                   2155: This facility is effective when @code{precise} button switch is
                   2156: inactive.  If @code{precise} is selected and active, the area specified
                   2157: by the cursor dragging will be rewritten on the same window. This
                   2158: will be explained later.
                   2159: @item
                   2160: A click of the right button will display the current coordinates of
                   2161: the cursor at the bottom area of the window.
                   2162:
                   2163: @item
                   2164: Place the cursor at any point in the right marker area on
                   2165: a window created by @code{conplot()},
                   2166: and drag the cursor with the middle mutton.  Then you will find the contour lines changing
                   2167: their colors depending on the movement of the cursor and the
                   2168: corresponding height level displayed on the upper right corner of
                   2169: the window.
                   2170:
                   2171: @item
                   2172: Several operations are available on the window: by button operations
1.7       noro     2173: for UNIX version, and pull-down menus for Windows version.
1.2       noro     2174:
                   2175: @table @code
                   2176: @item quit
                   2177: Destroys (kills) the window.  While computing, quit the current
                   2178: computation.
                   2179: If one wants to interrupt the computation, use @code{ox_reset()}.
                   2180:
                   2181: @item wide (toggle)
                   2182: Will display, on the same window, a new area enlarged by 10 times
                   2183: as large as the current area for both width-direction and
                   2184: height-direction.  The current area will be indicated by a rectangle
                   2185: placed at the center.  Area specification by dragging the cursor will
                   2186: create a new window with a plot of the graph in the specified area.
                   2187: @item precise (toggle)
                   2188: When selected and active,
                   2189: @code{ox_plot} redraws the specified area more precisely by integer
                   2190: arithmetic.
                   2191: This mode uses bisection method based on Sturm sequence computation to
                   2192: locate real zeros precisely.  More precise plotting can be expected
                   2193: by this technique than by the default plotting technique, at the expense
                   2194: of significant increase of computing time.  As you see by above
                   2195: explanation, this function is only effective to polynomials with
                   2196: rational coefficients.
                   2197: (Check how they differ for (x^2+y^2-1)^2.)
                   2198:
                   2199: @item formula
                   2200: Displays the expression for the graph.
                   2201:
                   2202: @item noaxis (toggle)
                   2203: Erase the coordinates.
                   2204: @end table
                   2205:
                   2206: @item
                   2207: Program @samp{ox_plot} may consume much stack space depending on
                   2208: which machine it is running.
                   2209: You are recommended to set the stack size to about 16MB as large
                   2210: in @samp{.cshrc} for safe.
                   2211: To specify the size, put @code{limit stacksize 16m} for an example.
                   2212:
                   2213: @item
                   2214: You can customize various resources of a window on @code{X}, e.g.,
                   2215: coloring, shape of buttons etc.
                   2216: The default setting of resources is shown below.
                   2217: For @code{plot*form*shapeStyle} you can select among
                   2218: @t{rectangle}, @t{oval}, @t{ellipse}, and @t{roundedRectangle}.
                   2219: \E
                   2220:
1.1       noro     2221: @example
                   2222: plot*background:white
                   2223: plot*form*shapeStyle:rectangle
                   2224: plot*form*background:white
                   2225: plot*form*quit*background:white
                   2226: plot*form*wide*background:white
                   2227: plot*form*precise*background:white
                   2228: plot*form*formula*background:white
                   2229: plot*form*noaxis*background:white
                   2230: plot*form*xcoord*background:white
                   2231: plot*form*ycoord*background:white
                   2232: plot*form*level*background:white
                   2233: plot*form*xdone*background:white
                   2234: plot*form*ydone*background:white
                   2235: @end example
                   2236: @end itemize
                   2237:
                   2238: @example
                   2239: @end example
                   2240:
                   2241: @table @t
1.2       noro     2242: \JP @item $B;2>H(B
                   2243: \EG @item References
1.4       noro     2244: @fref{ox_launch ox_launch_nox ox_shutdown}, @fref{ox_reset ox_intr register_handler}
1.6       noro     2245: @end table
                   2246:
1.8       noro     2247: \JP @node open_canvas clear_canvas draw_obj draw_string,,, $BJ,;67W;;$K4X$9$k4X?t(B
                   2248: \EG @node open_canvas clear_canvas draw_obj draw_string,,, Functions for distributed computation
                   2249: @subsection @code{open_canvas}, @code{clear_canvas}, @code{draw_obj}, @code{draw_string}
1.6       noro     2250: @findex open_canvas
                   2251: @findex clear_canvas
                   2252: @findex draw_obj
1.8       noro     2253: @findex draw_string
1.6       noro     2254:
                   2255: @table @t
                   2256: @item open_canvas(@var{id}[,@var{geometry}])
                   2257: \JP :: $BIA2hMQ%&%#%s%I%&(B ($B%-%c%s%P%9(B) $B$r@8@.$9$k(B.
                   2258: \EG :: Opens a canvas, which is a window for drawing objects.
                   2259: @item clear_canvas(@var{id},@var{index})
                   2260: \JP :: $B%-%c%s%P%9$r%/%j%"$9$k(B.
                   2261: \EG :: Clears a canvas.
                   2262: @item draw_obj(@var{id},@var{index},@var{pointorsegment} [,@var{color}])
                   2263: \JP :: $B%-%c%s%P%9>e$KE@$^$?$O@~J,$rIA2h$9$k(B.
                   2264: \EG :: Draws a point or a line segment on a canvas.
1.13      noro     2265: @item draw_string(@var{id},@var{index},[@var{x},@var{y}],@var{string} [,@var{color}])
1.8       noro     2266: \JP :: $B%-%c%s%P%9>e$KJ8;zNs$rIA2h$9$k(B.
                   2267: \EG :: Draws a character string on a canvas.
1.6       noro     2268: @end table
                   2269:
                   2270: @table @var
                   2271: @item return
                   2272: 0
1.13      noro     2273: @item id  index  color  x  y
1.6       noro     2274: \JP $B@0?t(B
                   2275: \EG integer
                   2276: @item pointorsegment
                   2277: \JP $B%j%9%H(B
                   2278: \EG list
1.8       noro     2279: @item string
                   2280: \JP $BJ8;zNs(B
                   2281: \EG character string
1.6       noro     2282: @end table
                   2283:
                   2284: @itemize @bullet
                   2285: @item
                   2286: \BJP
                   2287: $B$3$l$i$O(B OpenXM $B%5!<%P(B @samp{ox_plot} (Windows $B>e$G$O(B @samp{engine})
                   2288: $B$K$h$jDs6!$5$l$k(B.
                   2289: \E
                   2290: \BEG
                   2291: These functions are supplied by the OpenXM server @samp{ox_plot}
                   2292: (@samp{engine} on Windows).
                   2293: \E
                   2294: @item
                   2295: \BJP
                   2296: @code{open_canvas} $B$O(B, $BIA2hMQ$N%&%#%s%I%&(B($B%-%c%s%P%9(B)$B$r@8@.$9$k(B.
1.13      noro     2297: @var{geometry} $B$K$h$j%&%#%s%I%&$N%5%$%:$r(B pixel $BC10L$G(B [@var{x},@var{y}] $B$G;XDj$9$k(B.
                   2298: default size $B$O(B [@code{300},@code{300}].
1.6       noro     2299: $B%-%c%s%P%9$N<1JL;R$H$7$F(B, $B@0?tCM$r(B OpenXM $B%5!<%P$N%9%?%C%/$K(B push $B$9$k(B.
                   2300: $B$3$N<1JL;R$O(B @code{draw_obj} $B$N8F$S=P$7$KI,MW$G$"$j(B, @code{ox_pop_cmo} $B$K(B
                   2301: $B$h$j<h$j=P$7$FJ];}$9$kI,MW$,$"$k(B.
                   2302: \E
                   2303: \BEG
                   2304: @code{open_canvas} opens a canvas, which is a window for drawing objecgts.
                   2305: One can specifies the size of a canvas in pixel by
1.13      noro     2306: supplying @var{geometry} option [@var{x},@var{y}]. The default size is
                   2307: [@code{300},@code{300}].
1.6       noro     2308: This function pushes an integer value onto the stack of the OpenXM server.
                   2309: The value is used to distiguish the opened canvas and one has to pop
                   2310: and maintain the value by @code{ox_pop_cmo} for subsequent calls of
                   2311: @code{draw_obj}.
                   2312: \E
                   2313: @item
                   2314: \BJP
                   2315: @code{clear_canvas} $B$O(B, $B%5!<%P(B id @var{id}, $B%-%c%s%P%9(B id @var{index}
                   2316: $B$G;XDj$5$l$k%-%c%s%P%9$r%/%j%"$9$k(B.
                   2317: \E
                   2318: \BEG
                   2319: @code{clear_canvas} clears a canvas specified by a server id @var{id}
                   2320: and a canvas id @var{index}.
                   2321: \E
                   2322: @item
                   2323: \BJP
                   2324: @code{draw_obj} $B$O(B, $B%5!<%P(B id @var{id}, $B%-%c%s%P%9(B id @var{index}
                   2325: $B$G;XDj$5$l$k%-%c%s%P%9$KE@$^$?$O@~J,$rIA2h$9$k(B. @var{pointorsegment}
1.13      noro     2326: $B$,(B [@var{x},@var{y}] $B$N>l9gE@$N:BI8(B, [@var{x},@var{y},@var{u},@var{v}] $B$N>l9g(B [@var{x},@var{y}],
                   2327: [@var{u},@var{v}] $B$r7k$V@~J,$rI=$9$H8+$J$5$l$k(B.
1.6       noro     2328: $B%-%c%s%P%9$N:BI8$O(B, $B:8>e6y$r86E@$H$7$F2#J}8~$K(B
                   2329: $BBh0l:BI8(B, $B=DJ}8~$KBhFs:BI8$r$H$k(B. $BCM$O(B pixel $BC10L$G;XDj$9$k(B.
                   2330: @var{color} $B$N;XDj$,$"$k>l9g(B, @var{color/65536} mod 256,
                   2331: @var{color/256} mod 256, @var{color} mod 256 $B$r$=$l$>$l(B Red, Green, Blue
                   2332: $B$NCM(B ($B:GBg(B 255) $B$H$_$J$9(B.
                   2333: \E
                   2334: \BEG
1.8       noro     2335: @code{draw_obj} draws a point or a line segment on
1.6       noro     2336: a canvas specified by a server id @var{id} and a canvas id @var{index}.
1.13      noro     2337: If @var{pointorsegment} is [@var{x},@var{y}], it is regarded as a point.
                   2338: If @var{pointorsegment} is [@var{x},@var{y},@var{u},@var{v}], it is regarded
                   2339: as a line segment which connects [@var{x},@var{y}] and [@var{u},@var{v}].
1.6       noro     2340: If @var{color} is specified, @var{color/65536} mod 256,
                   2341: @var{color/256} mod 256, @var{color} mod 256 are regarded as the vaules
                   2342: of Red, Green, Blue (Max. 255) respectively.
                   2343: \E
1.8       noro     2344: @item
                   2345: \BJP
                   2346: @code{draw_string} $B$O(B, $B%5!<%P(B id @var{id}, $B%-%c%s%P%9(B id @var{index}
1.13      noro     2347: $B$G;XDj$5$l$k%-%c%s%P%9$KJ8;zNs$rIA2h$9$k(B. $B0LCV$O(B [@var{x},@var{y}] $B$K$h$j;XDj$9$k(B.
1.8       noro     2348: \E
                   2349: \BEG
                   2350: @code{draw_string} draws a character string @var{string} on
                   2351: a canvas specified by a server id @var{id} and a canvas id @var{index}.
1.13      noro     2352: The position of the string is specified by [@var{x},@var{y}].
1.8       noro     2353: \E
1.6       noro     2354: @end itemize
                   2355:
                   2356: @example
                   2357: [182] Id=ox_launch_nox(0,"ox_plot");
                   2358: 0
                   2359: [183] open_canvas(Id);
                   2360: 0
                   2361: [184] Ind=ox_pop_cmo(Id);
                   2362: 0
                   2363: [185] draw_obj(Id,Ind,[100,100]);
                   2364: 0
                   2365: [186] draw_obj(Id,Ind,[200,200],0xffff);
                   2366: 0
                   2367: [187] draw_obj(Id,Ind,[10,10,50,50],0xff00ff);
                   2368: 0
1.8       noro     2369: [187] draw_string(Id,Ind,[100,50],"hello",0xffff00);
                   2370: 0
                   2371: [189] clear_canvas(Id,Ind);
1.6       noro     2372: 0
                   2373: @end example
                   2374:
                   2375: @table @t
                   2376: \JP @item $B;2>H(B
                   2377: \EG @item References
                   2378: @fref{ox_launch ox_launch_nox ox_shutdown}, @fref{ox_reset ox_intr register_handler}, @fref{ox_pop_cmo ox_pop_local}.
1.1       noro     2379: @end table

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>