[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.7

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

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