=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/process.texi,v retrieving revision 1.6 retrieving revision 1.15 diff -u -p -r1.6 -r1.15 --- OpenXM/src/asir-doc/parts/process.texi 2000/11/13 00:16:34 1.6 +++ OpenXM/src/asir-doc/parts/process.texi 2003/05/16 08:12:58 1.15 @@ -1,4 +1,4 @@ -@comment $OpenXM: OpenXM/src/asir-doc/parts/process.texi,v 1.5 2000/09/25 05:12:51 noro Exp $ +@comment $OpenXM: OpenXM/src/asir-doc/parts/process.texi,v 1.14 2003/04/20 08:01:26 noro Exp $ \BJP @node 分散計算,,, Top @chapter 分散計算 @@ -28,9 +28,20 @@ @section OpenXM \BJP -@b{Asir} は, 分散計算における通信プロトコルとして, @b{OpenXM} -(Open message eXchange protocol for Mathematics) を採用している. -@b{OpenXM} は, 主として数学オブジェクトをプロセス間でやりとりする +@b{Asir} は, 分散計算における通信プロトコルとして, +@b{OpenXM} +(Open message eXchange for Mathematics) プロトコルを採用している. +@b{OpenXM} プロジェクトについては, +@ifhtml + +@end ifhtml +@code{http://www.math.sci.kobe-u.ac.jp/OpenXM/} +@ifhtml + +@end ifhtml +を参照してほしい. + +@b{OpenXM} プロトコルは, 主として数学オブジェクトをプロセス間でやりとりする ための規約である. @b{OpenXM} においては \E \BEG @@ -38,6 +49,15 @@ On @b{Asir} distributed computations are done under @b (Open message eXchange protocol for Mathematics), which is a protocol for exchanging mainly mathematical objects between processes. +See +@ifhtml + +@end ifhtml +@code{http://www.math.sci.kobe-u.ac.jp/OpenXM/} +@ifhtml + +@end ifhtml +for the details of @b{OpenXM}. In @b{OpenXM} a distributed computation is done as follows: \E @@ -505,8 +525,8 @@ input @code{quit}. * ox_flush:: * ox_get_serverinfo:: * generate_port try_bind_listen try_connect try_accept register_server:: -* ifplot conplot plot plotover:: -* open_canvas clear_canvas draw_obj:: +* ifplot conplot plot polarplot plotover:: +* open_canvas clear_canvas draw_obj draw_string:: @end menu \JP @node ox_launch ox_launch_nox ox_shutdown,,, 分散計算に関する関数 @@ -533,7 +553,7 @@ input @code{quit}. @item host \JP 文字列または 0 \EG string or 0 -@item dir, command +@item dir command \JP 文字列 \EG string @item id @@ -779,7 +799,7 @@ ox_xterm*saveLines:1000 \EG @item References @fref{ox_rpc ox_cmo_rpc ox_execute_string}, @fref{ox_pop_cmo ox_pop_local}, -@fref{ifplot conplot plot plotover} +@fref{ifplot conplot plot polarplot plotover} @end table \JP @node ox_launch_generic,,, 分散計算に関する関数 @@ -800,10 +820,10 @@ ox_xterm*saveLines:1000 @item host \JP 文字列または 0 \EG string or 0 -@item launcher, server +@item launcher server \JP 文字列 \EG string -@item use_unix, use_ssh, use_x, conn_to_serv +@item use_unix use_ssh use_x conn_to_serv \JP 整数 \EG integer @end table @@ -948,10 +968,10 @@ the client executes @code{connect}. @item host \JP 文字列 \EG string -@item port,control_port,server_port +@item port control_port server_port \JP 整数または文字列 \EG integer or string -@item socket,control_socket,server_socket +@item socket control_socket server_socket \JP 整数 \EG integer @end table @@ -1085,7 +1105,8 @@ If X environment is not available or is not necessary, @end example @example -[5] ox_launch_nox("127.0.0.1","/usr/local/lib/asir","/usr/local/lib/asir/ox_asir"); +[5] ox_launch_nox("127.0.0.1","/usr/local/lib/asir", +"/usr/local/lib/asir/ox_asir"); 0 @end example @@ -1093,7 +1114,8 @@ If X environment is not available or is not necessary, [7] RemoteLibDir = "/usr/local/lib/asir/"$ [8] Machines = ["sumire","rokkaku","genkotsu","shinpuku"]; [sumire,rokkaku,genkotsu,shinpuku] -[9] Servers = map(ox_launch,Machines,RemoteLibDir,RemoteLibDir+"ox_asir"); +[9] Servers = map(ox_launch,Machines,RemoteLibDir, +RemoteLibDir+"ox_asir"); [0,1,2,3] @end example @@ -1130,7 +1152,7 @@ If X environment is not available or is not necessary, @item command \JP 文字列 \EG string -@item arg0, arg1, ... +@item arg0 ... \JP 任意 (引数) \EG arbitrary (arguments) @end table @@ -1260,7 +1282,7 @@ The result is pushed to the stack. @item @code{register_handler()} は, @kbd{C-c} などによる割り込みの際に, -@kbd{u} を指定することで, 無引数ユーザ定義関数 @var{func()} が呼び出される +@kbd{u} を指定することで, 無引数ユーザ定義関数 @var{func}() が呼び出される ように設定する. この関数に, @code{ox_reset()} を呼び出させることで, 割り込みの際に自動的に @b{OpenXM} server のリセットを行うことができる. @@ -1291,10 +1313,10 @@ specified in @b{OpenXM}. @samp{ox_asir} immediately en mode and pops up an window to input debug commands on X window system. @item -@code{register_handler()} registers a function @var{func()}. -If @kbd{u} is specified on a keybord interrupt, @var{func()} +@code{register_handler()} registers a function @var{func}(). +If @kbd{u} is specified on a keybord interrupt, @var{func}() is executed before returning the toplevel. -If @code{ox_reset()} calls are included in @var{func()}, +If @code{ox_reset()} calls are included in @var{func}(), one can automatically reset @b{OpenXM} servers on a keyboard interrupt. @item @@ -1444,14 +1466,16 @@ Finally call @code{ox_get} for a ready process. @end itemize @example -[3] ox_rpc(0,"fctr",x^100-y^100); +[341] ox_cmo_rpc(0,"fctr",x^2-1); 0 -[4] ox_push_cmd(0,258); +[342] ox_pop_cmo(0); +[[1,1],[x-1,1],[x+1,1]] +[343] ox_cmo_rpc(0,"newvect",3); 0 -[5] ox_select([0]); -[0] -[6] ox_get(0); -[[1,1],[x^2+y^2,1],[x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],...] +[344] ox_pop_cmo(0); +error([41,cannot convert to CMO object]) +[345] ox_pop_local(0); +[ 0 0 0 ] @end example @table @t @@ -1522,6 +1546,17 @@ Usually @b{OX_SYNC_BALL} will be ignored by the peer. \E @end itemize +@example +[3] ox_rpc(0,"fctr",x^100-y^100); +0 +[4] ox_push_cmd(0,258); +0 +[5] ox_select([0]); +[0] +[6] ox_get(0); +[[1,1],[x^2+y^2,1],[x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],...] +@end example + @table @t \JP @item 参照 \EG @item References @@ -1594,7 +1629,7 @@ is realized as combinations of @code{ox_push_cmd} and @findex ox_pops @table @t -@item ox_pops(@var{number}[,@var{nitem}) +@item ox_pops(@var{number}[,@var{nitem}]) \JP :: プロセス識別子 @var{number} のプロセスのスタックからデータを取り除く. \EG :: Removes data form the stack of a process whose identifier is @var{number}. @end table @@ -1839,7 +1874,7 @@ Mathcap をリストとして返す. \BEG @item If @var{id} is specified, the mathcap of the process whose identifier is @var{id} is returned. -@item If @var{id} is not specified, the list of @var{[id,Mathcap]} +@item If @var{id} is not specified, the list of [@var{id},@var{Mathcap}] is returned, where @var{id} is the identifier of a currently active process, and @var{Mathcap} is the mathcap of the process. identifier @var{id} is returned. @@ -1850,15 +1885,19 @@ identifier @var{id} is returned. [343] ox_get_serverinfo(0); [[199909080,Ox_system=ox_sm1.plain,Version=2.991118,HOSTTYPE=FreeBSD], [262,263,264,265,266,268,269,272,273,275,276], -[[514],[2130706434,1,2,4,5,17,19,20,22,23,24,25,26,30,31,60,61,27,33,40,16,34]]] +[[514],[2130706434,1,2,4,5,17,19,20,22,23,24,25,26,30,31,60,61,27, +33,40,16,34]]] [344] ox_get_serverinfo(); -[[0,[[199909080,Ox_system=ox_sm1.plain,Version=2.991118,HOSTTYPE=FreeBSD], +[[0,[[199909080,Ox_system=ox_sm1.plain,Version=2.991118, +HOSTTYPE=FreeBSD], [262,263,264,265,266,268,269,272,273,275,276], -[[514],[2130706434,1,2,4,5,17,19,20,22,23,24,25,26,30,31,60,61,27,33,40,16,34]]]], +[[514],[2130706434,1,2,4,5,17,19,20,22,23,24,25,26,30,31,60,61,27,33, +40,16,34]]]], [1,[[199901160,ox_asir], [276,275,258,262,263,266,267,268,274,269,272,265,264,273,300,270,271], [[514,2144202544], -[1,2,3,4,5,2130706433,2130706434,17,19,20,21,22,24,25,26,31,27,33,60],[0,1]]]]] +[1,2,3,4,5,2130706433,2130706434,17,19,20,21,22,24,25,26,31,27,33,60], +[0,1]]]]] @end example @table @t @@ -1867,11 +1906,12 @@ identifier @var{id} is returned. @fref{Mathcap}. @end table -\JP @node ifplot conplot plot plotover,,, 分散計算に関する関数 -\EG @node ifplot conplot plot plotover,,, Functions for distributed computation -@subsection @code{ifplot}, @code{conplot}, @code{plot}, @code{plotover} +\JP @node ifplot conplot plot polarplot plotover,,, 分散計算に関する関数 +\EG @node ifplot conplot plot polarplot plotover,,, Functions for distributed computation +@subsection @code{ifplot}, @code{conplot}, @code{plot}, @code{polarplot}, @code{plotover} @findex ifplot @findex conplot +@findex polarplot @findex plot @findex plotover @@ -1885,6 +1925,9 @@ identifier @var{id} is returned. @item plot(@var{func} [,@var{geometry}] [,@var{xrange}] [,@var{id}] [,@var{name}]) \JP :: 1 変数関数のグラフを表示する. \EG :: Displays the graph of a univariate function. +@item polarplot(@var{func} [,@var{geometry}] [,@var{thetarange}] [,@var{id}] [,@var{name}]) +\JP :: 極形式で与えられた曲線を表示する. +\EG :: Displays the graph of a curve given in polar form. @item plotover(@var{func},@var{id},@var{number}) \JP :: すでに存在しているウィンドウへ描画する. \EG Plots on the existing window real zeros of a bivariate function. @@ -1897,10 +1940,10 @@ identifier @var{id} is returned. @item func \JP 多項式 \EG polynomial -@item geometry, xrange, yrange, zrange +@item geometry xrange yrange zrange \JP リスト \EG list -@item id, number +@item id number \JP 整数 \EG integer @item name @@ -1913,15 +1956,20 @@ identifier @var{id} is returned. @item @code{ifplot()} は, 2 変数関数 @var{func} の実数上での零点の グラフの表示を行う. @code{conplot()} は, 同様の引数に対し, -等高線の表示を行う. @code{plot()} は 1 変数関数の -グラフの表示を行う. +等高線の表示を行う. +@code{plot()} は 1 変数関数のグラフの表示を行う. +@code{polarplot()} は 極形式 @var{r}=@var{f}(@var{theta}) で表された曲線のグラフの表示を行う. @item これらは OpenXM サーバとして実現されている. UNIX 上では @samp{ox_plot} が, Windows 上では @samp{engine} がこれらの機能 を提供しており, これらは @b{Asir} の標準ライブラリディレクトリにある. -これらは @code{ox_launch()} または @code{ox_launch_nox()} - により起動しておく必要がある. +アクティブな @samp{ox_plot} の id が @var{id} として指定された場合, +そのサーバが用いられる. id の指定がない場合には, 起動されて +いるサーバのうち, @samp{ox_plot} があればそのサーバが用いられる. +@samp{ox_plot} が起動されていない場合には, +@code{ox_launch_nox()} が自動的に実行されて, @samp{ox_plot} が +立ち上がり, それが用いられる. @item 引数の内, @var{func} は必須である. その他の引数はオプションである. @@ -1929,12 +1977,12 @@ identifier @var{id} is returned. @table @var @item geometry -ウィンドウのサイズをドット単位で @var{[x,y]} で指定する. -(@var{[}@code{300},@code{300}@var{]}. ) +ウィンドウのサイズをドット単位で [@var{x},@var{y}] で指定する. +([@code{300},@code{300}]. ) -@item xrange, yrange -変数の範囲の指定で, @var{[v,vmin,vmax]} で指定する. -(いずれの変数も @var{[v},@code{-2},@code{2}@var{]}.) +@item xrange yrange +変数の範囲の指定で, [@var{v},@var{vmin},@var{vmax}] で指定する. +(いずれの変数も [@var{v},@code{-2},@code{2}].) この指定がない場合, @var{func} に含まれる変数の内変数順序の上の変数 が @samp{x}, 下の変数が @samp{y} として扱われる. これを避けるためには @var{xrange}, @var{yrange} を指定する. また, @var{func} が 1 変数の @@ -1942,9 +1990,9 @@ identifier @var{id} is returned. @item zrange @code{conplot()} の場合のみ指定できる. 形式は -@var{[v,vmin,vmax} @code{[},@var{step} @code{]}@var{]} で, @var{step} が指定され -た場合には, 等高線の間隔が @var{(vmax-vmin)/step} となる. -(@var{[z},@code{-2},@code{2},@code{16}@var{]}.) +[@var{v},@var{vmin},@var{vmax} @code{[},@var{step} @code{]}] で, @var{step} が指定され +た場合には, 等高線の間隔が (@var{vmax}-@var{vmin})/@var{step} となる. +([@var{z},@code{-2},@code{2},@code{16}].) @item id 遠隔プロセスの番号, すなわち @code{ox_launch()} が返した番号を指定する. @@ -2029,12 +2077,20 @@ Function @code{ifplot()} draws a graph of real zeros o function. Function @code{conplot()} plots the contour lines for a same argument. Function @code{plot()} draws the graph of a uninivariate function. +Function @code{polarplot()} draws the graph of a curve given in polar form +@var{r}=@var{f}(@var{theta}). @item The plotting functions are realized by an OpenXM server. On UNIX it is @samp{ox_plot} in @b{Asir} root directory. On Windows @samp{engine} acts as @samp{ox_plot}. Of course, it must be activated by @code{ox_launch()} @code{ox_launch_nox()}. +If the identifier of an active @samp{ox_plot} is specified as @var{id}, +the server is used for drawing pictures. +If @var{id} is not specified, an available @samp{ox_plot} server +is used if it exists. If no @samp{ox_plot} server is available, +then @code{ox_launch_nox()} is automatically executed to +invoke @samp{ox_plot}. @item Argument @var{func} is indispensable. Other arguments are optional. @@ -2043,12 +2099,12 @@ are listed below. @table @var @item geometry -Window size is specified by @var{[x,y]} in unit `dot.' -(@var{[}@code{300},@code{300}@var{]} for UNIX version; +Window size is specified by [@var{x},@var{y}] in unit `dot.' +[@code{300},@code{300}] for UNIX version; -@item xrange, yrange -Value ranges of the variables are specified by @var{[v,vmin,vmax]}. -(@var{[v},@code{-2},@code{2}@var{]} for each variable.) +@item xrange yrange +Value ranges of the variables are specified by [@var{v},@var{vmin},@var{vmax}]. +([@var{v},@code{-2},@code{2}] for each variable.) If this specification is omitted, the indeterminate having the higher order in @var{func} is taken for @samp{x} and the one with lower order is taken for @samp{y}. To change this selection, specify explicitly @@ -2057,10 +2113,10 @@ For an uni-variate function, the specification is mand @item zrange This specification applies only to @code{conplot()}. The format is -@var{[v,vmin,vmax} @code{[},@var{step} @code{]}@var{]}. +[@var{v},@var{vmin},@var{vmax} @code{[},@var{step} @code{]}]. If @var{step} is specified, the height difference of contours is set to -@var{(vmax-vmin)/step}. -(@var{[z},@code{-2},@code{2},@code{16}@var{]}.) +(@var{vmax}-@var{vmin})/@var{step}. +([@var{z},@code{-2},@code{2},@code{16}].) @item id This specifies the number of the remote process by which you wish @@ -2114,7 +2170,7 @@ the window. @item Several operations are available on the window: by button operations -for UNIX version, and pull-down menus for Macintosh version. +for UNIX version, and pull-down menus for Windows version. @table @code @item quit @@ -2188,12 +2244,13 @@ plot*form*ydone*background:white @fref{ox_launch ox_launch_nox ox_shutdown}, @fref{ox_reset ox_intr register_handler} @end table -\JP @node open_canvas clear_canvas draw_obj,,, 分散計算に関する関数 -\EG @node open_canvas clear_canvas draw_obj,,, Functions for distributed computation -@subsection @code{open_canvas}, @code{clear_canvas}, @code{draw_obj} +\JP @node open_canvas clear_canvas draw_obj draw_string,,, 分散計算に関する関数 +\EG @node open_canvas clear_canvas draw_obj draw_string,,, Functions for distributed computation +@subsection @code{open_canvas}, @code{clear_canvas}, @code{draw_obj}, @code{draw_string} @findex open_canvas @findex clear_canvas @findex draw_obj +@findex draw_string @table @t @item open_canvas(@var{id}[,@var{geometry}]) @@ -2205,17 +2262,23 @@ plot*form*ydone*background:white @item draw_obj(@var{id},@var{index},@var{pointorsegment} [,@var{color}]) \JP :: キャンバス上に点または線分を描画する. \EG :: Draws a point or a line segment on a canvas. +@item draw_string(@var{id},@var{index},[@var{x},@var{y}],@var{string} [,@var{color}]) +\JP :: キャンバス上に文字列を描画する. +\EG :: Draws a character string on a canvas. @end table @table @var @item return 0 -@item id, index, color +@item id index color x y \JP 整数 \EG integer @item pointorsegment \JP リスト \EG list +@item string +\JP 文字列 +\EG character string @end table @itemize @bullet @@ -2231,8 +2294,8 @@ These functions are supplied by the OpenXM server @sam @item \BJP @code{open_canvas} は, 描画用のウィンドウ(キャンバス)を生成する. -@var{geometry} によりウィンドウのサイズを pixel 単位で @var{[x,y]} で指定する. -default size は @var{[}@code{300},@code{300}@var{]}. +@var{geometry} によりウィンドウのサイズを pixel 単位で [@var{x},@var{y}] で指定する. +default size は [@code{300},@code{300}]. キャンバスの識別子として, 整数値を OpenXM サーバのスタックに push する. この識別子は @code{draw_obj} の呼び出しに必要であり, @code{ox_pop_cmo} に より取り出して保持する必要がある. @@ -2240,8 +2303,8 @@ default size は @var{[}@code{300},@code{300}@var \BEG @code{open_canvas} opens a canvas, which is a window for drawing objecgts. One can specifies the size of a canvas in pixel by -supplying @var{geometry} option @var{[x,y]}. The default size is -@var{[}@code{300},@code{300}@var{]}. +supplying @var{geometry} option [@var{x},@var{y}]. The default size is +[@code{300},@code{300}]. This function pushes an integer value onto the stack of the OpenXM server. The value is used to distiguish the opened canvas and one has to pop and maintain the value by @code{ox_pop_cmo} for subsequent calls of @@ -2260,8 +2323,8 @@ and a canvas id @var{index}. \BJP @code{draw_obj} は, サーバ id @var{id}, キャンバス id @var{index} で指定されるキャンバスに点または線分を描画する. @var{pointorsegment} -が @var{[x,y]} の場合点の座標, @var{[x,y,u,v]} の場合 @var{[x,y]}, -@var{[u,v]} を結ぶ線分を表すと見なされる. +が [@var{x},@var{y}] の場合点の座標, [@var{x},@var{y},@var{u},@var{v}] の場合 [@var{x},@var{y}], +[@var{u},@var{v}] を結ぶ線分を表すと見なされる. キャンバスの座標は, 左上隅を原点として横方向に 第一座標, 縦方向に第二座標をとる. 値は pixel 単位で指定する. @var{color} の指定がある場合, @var{color/65536} mod 256, @@ -2269,15 +2332,25 @@ and a canvas id @var{index}. の値 (最大 255) とみなす. \E \BEG -@code{draw_obj_canvas} draws a point or a line segment on +@code{draw_obj} draws a point or a line segment on a canvas specified by a server id @var{id} and a canvas id @var{index}. -If @var{pointorsegment} is @var{[x,y]}, it is regarded as a point. -If @var{pointorsegment} is @var{[x,y,u,v]}, it is regarded -as a line segment which connects @var{[x,y]} and @var{[u,v]}. +If @var{pointorsegment} is [@var{x},@var{y}], it is regarded as a point. +If @var{pointorsegment} is [@var{x},@var{y},@var{u},@var{v}], it is regarded +as a line segment which connects [@var{x},@var{y}] and [@var{u},@var{v}]. If @var{color} is specified, @var{color/65536} mod 256, @var{color/256} mod 256, @var{color} mod 256 are regarded as the vaules of Red, Green, Blue (Max. 255) respectively. \E +@item +\BJP +@code{draw_string} は, サーバ id @var{id}, キャンバス id @var{index} +で指定されるキャンバスに文字列を描画する. 位置は [@var{x},@var{y}] により指定する. +\E +\BEG +@code{draw_string} draws a character string @var{string} on +a canvas specified by a server id @var{id} and a canvas id @var{index}. +The position of the string is specified by [@var{x},@var{y}]. +\E @end itemize @example @@ -2293,7 +2366,9 @@ of Red, Green, Blue (Max. 255) respectively. 0 [187] draw_obj(Id,Ind,[10,10,50,50],0xff00ff); 0 -[188] clear_canvas(Id,Ind); +[187] draw_string(Id,Ind,[100,50],"hello",0xffff00); +0 +[189] clear_canvas(Id,Ind); 0 @end example