=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/builtin/misc.texi,v retrieving revision 1.7 retrieving revision 1.9 diff -u -p -r1.7 -r1.9 --- OpenXM/src/asir-doc/parts/builtin/misc.texi 2001/03/12 05:01:18 1.7 +++ OpenXM/src/asir-doc/parts/builtin/misc.texi 2002/07/15 07:59:27 1.9 @@ -1,4 +1,4 @@ -@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/misc.texi,v 1.6 2000/02/07 07:11:38 noro Exp $ +@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/misc.texi,v 1.8 2001/07/23 02:28:17 noro Exp $ \BJP @node その他,,, 組み込み函数 @section その他 @@ -15,6 +15,7 @@ * help:: * time:: * cputime tstart tstop:: +* timer:: * heap:: * version:: * shell:: @@ -562,6 +563,71 @@ the debug-mode and execute @code{cputime(1)}. @fref{time}, @fref{ctrl}. @end table +\JP @node timer,,, その他 +\EG @node timer,,, Miscellaneouses +@subsection @code{timer} +@findex timer + +@table @t +@item timer(@var{interval},@var{expr},@var{val}) +\JP :: 制限時間つきで計算を実行する. +\BEG +:: Compute an expression under the interval timer. +\E +@end table + +@table @var +@item return +\JP 結果 +\EG result + +@item interval +\JP 制限時間 (秒) +\EG interval (second) + +@item expr +\JP 計算する式 +\EG expression to be computed + +@item val +\JP タイマによる中断時の戻り値 +\EG a value to be returned when the timer is expired +@end table + +@itemize @bullet + +\BJP +@item +@code{timer()} は, 時間を指定して計算を実行する. 指定時間内に計算が完了 +した場合その値を返す. 指定時間内に計算が完了しなかった場合, 第 3 引数 +を返す. + +@item +第 3 引数の値は, 計算が完了した場合の値と区別できる必要がある. +\E + +\BEG +@item +@code{timer()} computes an expression under the interval timer. +If the computation finishes within the specified interval, it +returns the result of the computation. Otherwise it returns the third +argument. + +@item +The third argument should be distinguishable from the result on success. +\E + +@end itemize + +@example +[0] load("cyclic"); +1 +[10] timer(10,dp_gr_main(cyclic(7),[c0,c1,c2,c3,c4,c5,c6],1,1,0),0); +interval timer expired (VTALRM) +0 +[11] +@end example + \JP @node heap,,, その他 \EG @node heap,,, Miscellaneouses @subsection @code{heap} @@ -941,7 +1007,7 @@ of the install directory. @findex getopt @table @t -@item getopt(@var{key}) +@item getopt([@var{key}]) \JP :: オプションの値を返す. \EG :: Returns the value of an option. @end table @@ -960,6 +1026,11 @@ of the install directory. がある (@pxref{オプション指定}). 指定されたオプションを関数内で 受け取るためにこの関数を用いる. @item +無引数で呼び出された場合, @code{getopt()} は +@code{[[key1,value1],[key2,value2],...]} なるリストを返す. +ここで, @code{key} は関数呼び出し時に指定されたオプション, @code{value} +はその値である. +@item 関数呼び出しの際に @var{key} がオプションとして指定されている 場合には, その値を返す. もし指定がない場合には, VOID 型オブジェクト (型識別子 -1) を返す. @code{getopt()} が返した値の型を @code{type()} @@ -981,6 +1052,11 @@ must be equal to that in the declaration of the functi A function with indefinite number of arguments can be realized by using @var{options} (@pxref{option}). The value of a specified option is retrieved by @code{getopt}. +@item +If @code{getopt()} is called with no argument, then it returns a list +@code{[[key1,value1],[key2,value2],...]}. In the list, each @code{key} +is an option which was specified when the function executing @code{getopt} +was invoked, and @code{value} is the value of the option. @item If an option @var{key} is specified upon a function call, @code{getopt} return the value of the option. If such an option is not specified,