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

Annotation of OpenXM/src/asir-doc/parts/builtin/misc.texi, Revision 1.25

1.25    ! takayama    1: @comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/misc.texi,v 1.24 2018/03/28 07:44:06 takayama Exp $
1.3       noro        2: \BJP
1.1       noro        3: @node $B$=$NB>(B,,, $BAH$_9~$_H!?t(B
                      4: @section $B$=$NB>(B
1.3       noro        5: \E
                      6: \BEG
                      7: @node Miscellaneouses,,, Built-in Function
                      8: @section Miscellaneouses
                      9: \E
1.1       noro       10:
                     11: @menu
                     12: * ctrl::
                     13: * debug::
                     14: * error::
                     15: * help::
                     16: * time::
                     17: * cputime tstart tstop::
1.8       noro       18: * timer::
1.17      ohara      19: * currenttime::
                     20: * sleep::
1.1       noro       21: * heap::
                     22: * version::
                     23: * shell::
                     24: * map::
                     25: * flist::
                     26: * delete_history::
                     27: * get_rootdir::
1.2       noro       28: * getopt::
1.3       noro       29: * getenv::
1.1       noro       30: @end menu
                     31:
1.3       noro       32: \JP @node ctrl,,, $B$=$NB>(B
                     33: \EG @node ctrl,,, Miscellaneouses
1.1       noro       34: @subsection @code{ctrl}
                     35: @findex ctrl
                     36:
                     37: @table @t
                     38: @item ctrl("@var{switch}"[,@var{obj}])
1.3       noro       39: \JP :: $B4D6-@_Dj(B
                     40: \EG :: Sets the value of @var{switch}.
1.25    ! takayama   41: @item ctrl()
        !            42: \JP :: $B4D6-$NI=<((B
        !            43: \EG :: Show the values of @var{switch}'s.
        !            44: @item ctrl(|desc=1)
        !            45: JP :: $B4D6-$*$h$S$=$NC;$$@bL@$NI=<((B
        !            46: \EG :: Show the values of @var{swtich}'s and short descriptions
1.1       noro       47: @end table
                     48:
                     49: @table @var
                     50: @item return
1.3       noro       51: \JP $B@_Dj$5$l$F$$$kCM(B
                     52: \EG value of @var{switch}
1.1       noro       53: @item switch
1.3       noro       54: \JP $B%9%$%C%AL>(B
                     55: \EG switch name
1.1       noro       56: @item obj
1.3       noro       57: \JP $B%Q%i%a%?(B
                     58: \EG parameter
1.1       noro       59: @end table
                     60:
                     61: @itemize @bullet
1.3       noro       62: \BJP
1.1       noro       63: @item
                     64: @b{Asir} $B$N<B9T4D6-$N@_DjJQ99(B, $B;2>H$r9T$&(B.
                     65: @item @var{switch} $B$N$_$N>l9g(B, $B$=$N%9%$%C%A$N8=:_$N>uBV$rJV$9(B.
                     66: @item @var{obj} $B$,M?$($i$l$F$$$k$H$-(B, $B$=$NCM$r@_Dj$9$k(B.
                     67: @item
                     68: $B%9%$%C%A$OJ8;zNs$H$7$FF~NO$9$k(B. $B$9$J$o$A%@%V%k%/%)!<%H$G0O$`(B.
                     69: @item
1.3       noro       70: $B%9%$%C%A$O<!$NDL$j(B. $B0J2<$G(B, on $B$O(B 1, off $B$O(B 0 $B$r0UL#$9$k(B.
1.1       noro       71: @table @code
                     72: @item cputime
                     73: on $B$N;~(B CPU time $B$*$h$S(B GC time $B$rI=<((B, off $B$N;~(B $BI=<($7$J$$(B. @code{cputime()}
                     74: $B$r;2>H(B.
                     75: @code{ctrl("cputime",@var{onoff})} $B$O(B @code{cputime(@var{onoff})} $B$HF1$8$G$"$k(B.
                     76: @item nez
                     77: EZGCD $B$N%"%k%4%j%:%`$N@ZBX$((B. $B%G%U%)%k%H$G(B 1 $B$G$"$j(B, $B$H$/$K@ZBX$($kI,MW(B
                     78: $B$O$J$$(B.
                     79: @item echo
                     80: on $B$N;~$OI8=`F~NO$r7+$jJV$7$F=PNO$7(B, off $B$N;~$OI8=`F~NO$r7+$jJV$5$J$$(B.
                     81: @code{output} $B%3%^%s%I$rMQ$$$k:]$KM-8z$G$"$k(B.
                     82: @item bigfloat
                     83: on $B$N;~(B, $BF~NO$5$l$?IbF0>.?t$O(B @b{bigfloat} $B$KJQ49$5$l(B, $BIbF0>.?t1i;;$O(B
1.10      noro       84: @b{PARI} (@ref{pari}) $B$K$h$j9T$o$l$k(B. $B%G%U%)%k%H$NM-8z7e?t$O(B 9 $B7e$G$"$k(B.
1.1       noro       85: $BM-8z7e?t$rA}$d$7$?$$;~$K$O(B @code{setprec()} $B$rMQ$$$k(B.
                     86: off $B$N;~(B, $BF~NO$5$l$?IbF0>.?t$O(B, $BG\@:EYIbF0>.?t$KJQ49$5$l$k(B.
                     87: @cindex PARI
                     88: @item adj
                     89: $B%,!<%Y%C%8%3%l%/%7%g%s$NIQEY$NJQ99(B. 1 $B0J>e$NM-M}?t$,;XDj$G$-$k(B.
                     90: $B%G%U%)%k%HCM$O(B 3. 1 $B$K6a$$Dx(B, $B%,!<%Y%C%8%3%l%/%7%g%s$;$:$K%R!<%W$r(B
                     91: $BBg$-$/$H$k$h$&$K$J$k(B. $B@0?tCM$O%3%^%s%I%i%$%s$G;XDj$G$-$k(B.
                     92: @xref{$B%3%^%s%I%i%$%s%*%W%7%g%s(B}.
                     93: @item verbose
                     94: on $B$N;~(B, $BH!?t$N:FDj5A;~$K%a%C%;!<%8$rI=<($9$k(B.
1.14      ohara      95: @item quiet_mode
1.15      takayama   96: 1 $B$N$H$-(B, $B5/F0;~$KCx:n8"I=<($r9T$o$J$$(B.
                     97: @xref{$B%3%^%s%I%i%$%s%*%W%7%g%s(B}.
                     98: @item prompt
                     99: 0 $B$N$H$-%W%m%s%W%H$rI=<($7$J$$(B. 1 $B$N$H$-I8=`%W%m%s%W%H$rI=<((B.
                    100: C $B%9%?%$%k$N%U%)%^%C%HJ8;zNs$r$b$A$$$k$H%f!<%6Dj5A$N%W%m%s%W%H(B.
                    101: $BNc(B(asirgui $B$G$OIT2D(B):
1.16      ohara     102: @code{ ctrl("prompt","\033[32m[%d]:= \033[0m")}
1.1       noro      103: @item hex
                    104: 1 $B$N$H$-(B, $B@0?t$O(B 0x $B$G;O$^$k(B 16 $B?J?t$H$7$FI=<($5$l$k(B. -1 $B$N$H$-(B, 16 $B?J?t$O(B,
                    105: $B4V$K(B @samp{|} $B$r$O$5$s$G(B 8 $B7e$4$H$K6h@Z$C$FI=<($5$l$k(B.
1.13      noro      106: @item real_digit
                    107: $BG\@:EYIbF0>.?t$NI=<($N7e?t$r;XDj$9$k(B.
                    108: @item double_output
                    109: 1 $B$N$H$-(B, $BG\@:EYIbF0>.?t$O$D$M$K(B ddd.ddd $B$N7A$GI=<($5$l$k(B.
1.6       noro      110: @item fortran_output
                    111: 1 $B$N$H$-(B, $BB?9`<0$NI=<($,(B FORTRAN $B%9%?%$%k$K$J$k(B. $B$9$J$o$AQQ$,(B
                    112: @samp{^} $B$NBe$o$j$K(B @samp{**} $B$GI=$5$l$k(B.
                    113: ($B%G%U%)%k%HCM$O(B 0.)
1.1       noro      114: @item ox_batch
                    115: 1 $B$N$H$-(B, $BAw?.%P%C%U%!$,$$$C$Q$$$K$J$C$?;~$N$_<+F0E*$K(B flush.
                    116: 0 $B$N$H$-(B, $B%G!<%?(B, $B%3%^%s%IAw?.Kh$K(B flush. ($B%G%U%)%k%HCM$O(B 0.)
1.10      noro      117: @xref{$BJ,;67W;;(B}.
1.1       noro      118: @item ox_check
                    119: 1 $B$N$H$-(B, $BAw?.%G!<%?$rAj<j%W%m%;%9$,<u$1<h$l$k$+$I$&$+%A%'%C%/$9$k(B.
                    120: 0 $B$N$H$-$7$J$$(B. ($B%G%U%)%k%HCM$O(B 1.)
1.10      noro      121: @xref{$BJ,;67W;;(B}.
1.5       noro      122: @item ox_exchange_mathcap
                    123: 1 $B$N$H$-(B, OX server $B$H$N@\B33+;O;~$K(B, $B<+F0E*$K(B mathcap $B$N8r49$r9T$&(B.
                    124: ($B%G%U%)%k%HCM$O(B 1.)
1.10      noro      125: @xref{$BJ,;67W;;(B}.
1.20      takayama  126: @item debug_window
                    127: 1 $B$N;~(B debug_window $B$,%]%C%W%"%C%W$7$F3+$/(B.
                    128: ($B%G%U%)%k%HCM$O(B 0.)
                    129: @item fake_ox_reset
                    130: 1 $B$N$H$-(B, ox_reset $B$r<BAu$7$F$J$$%5!<%P!<$K$OBe$o$j$K(B ox_shutdown $B$rAw?.$9$k(B.
                    131: ox_reset $B$N<BAu$NM-L5$O(B mathcap $B$N(B optional argument ($BBh;M0z?t(B)
                    132: $B$KJ8;zNs(B no_ox_reset $B$,@_Dj$5$l$F$$$k$+$I$&$+$GH=CG$9$k(B.
                    133: ox_pari $B$rMxMQ$9$k$H$-$O$3$N%U%i%0$r(B1$B$K$7$F$*$/$3$H$,K>$^$7$$(B.
                    134: ($B%G%U%)%k%HCM$O(B 0.)
                    135: @xref{$BJ,;67W;;(B}.
1.23      takayama  136: @item plot_by_bigfloat
                    137: N $B$N$H$-(B, 10$B?J?t$G$N@:EY$r(B N $B7e$H$7$F(B, bigfloat $B$rMQ$$$F(B plot $B$r9T$&(B.
                    138: ($B%G%U%)%k%H$G$O(B double $B$rMQ$$$F(B plot $B$r9T$&(B.)
1.24      takayama  139: @item evalef
                    140: 0 $B$N;~(B eval $B$N0z?t$,I>2A$5$l$?$H$-$=$l0J>eI>2A$G$-$J$/$J$C$?>l9g(B, $BITDj85%j%9%H$K(B
                    141: $BEPO?$5$l$k(B. $B$?$H$($P(B eval(sin(0.1)) $B$H<B9T$9$k$H(B sin(0.1) $B$,$=$l0J>eI>2A$G$-$J$$$?$a(B
                    142: $BITDj85%j%9%H$KEPO?$5$l$k(B.
                    143: 1 $B$N;~$O(B, $BEPO?$5$l$J$$(B.
                    144: $B=iEy4X?t$N?tCMI>2A$r7+$jJV$79T$&;~$O$3$N%*%W%7%g%s$r;HMQ$9$Y$-$G$"$k(B.
                    145: ($B%G%U%)%k%HCM$O(B 0.)
                    146: @xref{ord}
1.1       noro      147: @end table
1.3       noro      148: \E
                    149: \BEG
                    150: @item
                    151: This function is used to set or to get the values of switches.
                    152: The switches are used to control an execution of @b{Asir}.
                    153: @item If @var{obj} is not specified, the value of @var{switch} is returned.
                    154: @item If @var{obj} is specified, the value of @var{switch} is set to
                    155: @var{obj}.
                    156: @item
                    157: Switches are specified by strings, namely, enclosed by two
                    158: double quotes.
                    159: @item
                    160: Here are of switches of @b{Asir}.
                    161: @table @code
                    162: @item cputime
                    163: If `on', CPU time and GC time is displayed at every top level evaluation
                    164: of @b{Asir} command; if `off', not displayed.
                    165: @xref{cputime tstart tstop}.
                    166: (The switch is also set by command @code{cputime(1)}, and
                    167: reset by @code{cputime(0)}.)
                    168: @item nez
                    169: Selection for EZGCD algorithm.  It is set to 1 by default.  Ordinary
                    170: users need not change this setting.
                    171: @item echo
                    172: If `on', inputs from the standard input will be echoed onto the
                    173: standard output.  When executing to load a file, the contents of the
                    174: file will be written onto the standard output.
                    175: If `off', the inputs will not be echoed.
                    176: This command will be useful when used with command @code{output}.
                    177: @item bigfloat
                    178: If `on', floating operations will be done by @b{PARI} system with arbitrary
                    179: precision floating point operations.
                    180: Default precision is set to 9 digits.  To change the precision, use
1.21      noro      181: command @code{setbprec setprec}.
1.3       noro      182: If `off', floating operations will be done by @b{Asir}'s own floating
                    183: operation routines with a fixed precision operations of
                    184: standard floating double.
                    185: @cindex PARI
                    186: @item adj
                    187: Sets the frequency of garbage collection. A rational number greater
                    188: than or equal to 1 can be specified. The default value is 3.
                    189: If a value closer to 1 is specified, larger heap is allocated
                    190: and as a result, the frequency of garbage collection decreases.
                    191: @xref{Command line options}.
                    192: @item verbose
                    193: If `on' a warning messages is displayed when a function is redefined.
1.14      ohara     194: @item quiet_mode
                    195: If 1 is set, the copyright notice has been displayed at boot time.
1.15      takayama  196: @item prompt
                    197: If the value is 0, then prompt is not output.
                    198: If the value is 1, then the standard prompt is output.
                    199: Asir prompt can be customized by giving a C-style format string.
                    200: Example (for unix asir);
1.16      ohara     201: @code{ ctrl("prompt","\033[32m[%d]:= \033[0m")}
                    202:
1.3       noro      203: @item hex
                    204: If 1 is set, integers are displayed as hexadecimal numbers with prefix
1.13      noro      205: @code{0x}. if -1 is set, hexadecimal numbers are displayed with
1.3       noro      206: @samp{|} inserted at every 8 hexadecimal digits.
1.13      noro      207: @item real_digit
                    208: Sets the number of digits used to print a floating double.
                    209: @item double_output
                    210: If set to 1, any floating double is printed in the style ddd.ddd.
1.6       noro      211: @item fortran_output
                    212: If `on' polynomials are displayed in FORTRAN style. That is, a power
                    213: is represented by @samp{**} instead of @samp{^}.
                    214: The default value is 'off.
1.3       noro      215: @item ox_batch
                    216: If 'on', the OpenXM send buffer is flushed only when the buffer is full.
                    217: If 'off', the buffer is always flushed at each sending of data or command.
                    218: The default value is 'off'.
1.10      noro      219: @xref{Distributed computation}.
1.3       noro      220: @item ox_check
                    221: If 'on' the check by mathcap is done before sending data.
1.5       noro      222: The default value is 'on'.
1.10      noro      223: @xref{Distributed computation}.
1.5       noro      224: @item ox_exchange_mathcap
                    225: If 'on' Asir forces the exchange of mathcaps at the communication startup.
1.3       noro      226: The default value is 'on'.
1.10      noro      227: @xref{Distributed computation}.
1.20      takayama  228: @item debug_window
                    229: When 1, a debug window pops up.
                    230: (The default value is 0.)
                    231: @item fake_ox_reset
                    232: When 1, the function ox_reset sends ox_shutdown insread of ox_reset
                    233: to servers which do not implement ox_reset protocol.
                    234: It is checked by the optional argument (the fourth argument)
                    235: containing the string "no_ox_reset"
                    236: of mathcap if ox_reset is implemented or not.
                    237: When you use ox_pari, it is recommended to set this flag 1.
                    238: (The default value is 0.)
                    239: @xref{Distributed computation}.
1.23      takayama  240: @item plot_by_bigfloat
                    241: If its value N is not equal to zero, then plotting is done by bigfloat.
                    242: (The double numbers are used as the default.)
1.24      takayama  243: @item evalef
                    244: When it is set to 0, the arguments of eval are registered to the list of
                    245: indeterminants when arguments are no longer to be simplified.
                    246: For example, when this flag is 0, sin(0.1) is registered to the list of
                    247: indeterminants when eval(sin(0.1)) is evaluated.
                    248: When it is set to 1, arguments are numerically evaluated.
                    249: It is recommended to turn on this option, when you repeat to evaluate elementary functions numerically.
                    250: (The default value is 0.)
                    251: @xref{ord}
1.3       noro      252: @end table
                    253: \E
1.1       noro      254: @end itemize
                    255:
1.25    ! takayama  256: @example
        !           257: [1917] ctrl();
        !           258: [[oxpari_start,0],[oxpari_id,-1],... snip ....,[plot_by_bigfloat,0],[debug_plot,0]]
        !           259: [1918] map(print,ctrl(|desc=1));
        !           260: [oxpari_start,0,oxpari starting function.]
        !           261: [oxpari_id,-1,Id of ox_pari.]
        !           262: ... snip ...
        !           263: [plot_by_bigfloat,0,If set to 1, computation is done by using MPFR bigfloat functions in ox_plot.]
        !           264: [debug_plot,0,If set to 1, ox_plot is executed with the message window.]
        !           265: @end example
        !           266:
1.1       noro      267: @table @t
1.3       noro      268: \JP @item $B;2>H(B
                    269: \EG @item References
1.1       noro      270: @fref{cputime tstart tstop}, @fref{output},
1.21      noro      271: @fref{pari}, @fref{setbprec setprec}, @fref{eval deval}.
1.1       noro      272: @end table
                    273:
1.23      takayama  274: @noindent
                    275: ChangeLog
                    276: @itemize @bullet
1.25    ! takayama  277: @item @xref{ChangeLog}
1.23      takayama  278: \BEG
                    279: @item plot_by_bigfloat switch is added on 2017.09.04. The following files are changed.
                    280: \E
                    281: \BJP
                    282: @item plot_by_bigfloat $B%9%$%C%A$O(B 2017.09.04 $B$K2C$($i$l$?(B. $BJQ99$r<u$1$?%U%!%$%k$O2<5-$N$H$*$j(B.
                    283: \E
                    284: @item 1.54 ctrl.c,
                    285:   1.14 bf.c,
                    286:   1.75 tcpf.c,
                    287:   1.13 calc.c,
                    288:   1.36 if.c,
                    289:   1.25 ifplot.h,
                    290:   1.33 plotf.c
                    291: @end itemize
                    292:
1.3       noro      293: \JP @node debug,,, $B$=$NB>(B
                    294: \EG @node debug,,, Miscellaneouses
1.1       noro      295: @subsection @code{debug}
                    296: @findex debug
                    297:
                    298: @table @t
                    299: @item debug
1.3       noro      300: \JP :: $B%G%P%C%0%b!<%I$KF~$k(B.
                    301: \EG :: Forces to enter into debugging mode.
1.1       noro      302: @end table
                    303:
                    304: @itemize @bullet
1.3       noro      305: \BJP
1.1       noro      306: @item
                    307: @code{debug} $B$OL50z?t$NH!?t$G$"$k$,(B, @samp{()} $B$J$7$G8F$S=P$;$k(B.
                    308: @item
                    309: $B%G%P%C%0%b!<%I$KF~$k$H%W%m%s%W%H$,(B @code{(debug)} $B$H$J$j(B, $B%3%^%s%I(B
                    310: $B<u$1IU$1>uBV$H$J$k(B. @code{quit} $B$rF~NO$9$k$H%G%P%C%,$+$iH4$1$k(B.
                    311: @item
                    312: $B%G%P%C%0%b!<%I$K$D$$$F$N>\:Y$O(B @xref{$B%G%P%C%,(B}.
1.3       noro      313: \E
                    314: \BEG
                    315: Function @code{debug} is a function with no argument.
                    316: It can be called without @samp{()}.
                    317: @item
                    318: In the debug-mode, you are prompted by @code{(debug)} and
                    319: the debugger is ready for commands.
                    320: Typing in @code{quit} (Note! without a semicolon.) brings you
                    321: to exit the debug-mode.
                    322: @item
1.10      noro      323: See @ref{Debugger} for details.
1.3       noro      324: \E
1.1       noro      325: @end itemize
                    326:
                    327: @example
                    328: [1] debug;
                    329: (debug) quit
                    330: 0
                    331: [2]
                    332: @end example
                    333:
1.3       noro      334: \JP @node error,,, $B$=$NB>(B
                    335: \EG @node error,,, Miscellaneouses
1.1       noro      336: @subsection @code{error}
                    337: @findex error
                    338:
                    339: @table @t
                    340: @item error(@var{message})
1.3       noro      341: \JP :: $B%W%m%0%i%`Cf$G6/@)E*$K%(%i!<$rH/@8$5$;$k(B.
                    342: \EG :: Forces @b{Asir} to cause an error and enter debugging mode.
1.1       noro      343: @end table
                    344:
                    345: @table @var
                    346: @item message
1.3       noro      347: \JP $BJ8;zNs(B
                    348: \EG string
1.1       noro      349: @end table
                    350:
                    351: @itemize @bullet
1.3       noro      352: \BJP
1.1       noro      353: @item
                    354: $B0lHL$K(B, $B0z?t$N4V0c$$$J$I(B, $BB39TIT2DG=$J%(%i!<$,AH$_9~$_H!?t$K$*$$$F(B
                    355: $BH/@8$7$?;~(B, $B%H%C%W%l%Y%k$KLa$kA0$K(B, $B2DG=$J$i$P$=$N%(%i!<$N;~E@$G(B
                    356: $B%G%P%C%0%b!<%I$KF~$k(B. @code{error()} $B$O(B, $B%f!<%6H!?t$NFbIt$G$3$N(B
                    357: $BF0:n$HF1MM$NF0:n$r9T$o$;$k$?$a$NH!?t$G$"$k(B.
                    358: @item
                    359: $B0z?t$O(B, @code{error()} $B$,8F$S=P$5$l$k:]$KI=<($5$l$k%a%C%;!<%8$G(B,
                    360: $BJ8;zNs$G$"$k(B.
                    361: @item
                    362: $B%f!<%6H!?t$K$*$$$F(B, $BJQ?t$r%A%'%C%/$7$F(B, $B$"$jF@$J$$CM$N>l9g$K(B @code{error()}
                    363: $B$r8F$S=P$9$h$&$K$7$F$*$1$P(B, $B$=$N;~E@$G<+F0E*$K%G%P%C%0%b!<%I$KF~$l$k(B.
1.3       noro      364: \E
                    365: \BEG
                    366: @item
                    367: When @b{Asir} encounters a serious error such that it finds difficult
                    368: to continue execution,
                    369: it, in general, tries to enter debugging mode before it returns to
                    370: top level.
                    371: The command @code{error()} forces a similar behavior in a user program.
                    372: @item
                    373: The argument is a string which will be displayed when @code{error()}
                    374: will be executed.
                    375: @item
                    376: You can enter the debug-mode when your program encounters an illegal
                    377: value for a program variable, if you have written the program
                    378: so as to call @code{error()} upon finding such an error in your program
                    379: text.
                    380: \E
1.1       noro      381: @end itemize
                    382:
                    383: @example
                    384: % cat mod3
                    385: def mod3(A) @{
                    386:         if ( type(A) >= 2 )
                    387:                 error("invalid argument");
                    388:         else
                    389:                 return A % 3;
                    390: @}
                    391: end$
                    392: % asir
                    393: [0] load("mod3");
                    394: 1
                    395: [3] mod3(5);
                    396: 2
                    397: [4] mod3(x);
                    398: invalid argument
                    399: stopped in mod3 at line 3 in file "./mod3"
                    400: 3                       error("invalid argument");
                    401: (debug) print A
                    402: A = x
                    403: (debug) quit
                    404: return to toplevel
                    405: [4]
                    406: @end example
                    407:
                    408: @table @t
1.3       noro      409: \JP @item $B;2>H(B
                    410: \EG @item References
1.1       noro      411: @fref{debug}.
                    412: @end table
                    413:
1.3       noro      414: \JP @node help,,, $B$=$NB>(B
                    415: \EG @node help,,, Miscellaneouses
1.1       noro      416: @subsection @code{help}
                    417: @findex help
                    418:
                    419: @table @t
                    420: @item help(["@var{function}"])
1.3       noro      421: \JP :: $BH!?t$N@bL@$rI=<($9$k(B.
                    422: \EG :: Displays the description of function @var{function}.
1.1       noro      423: @end table
                    424:
                    425: @table @var
                    426: @item return
                    427: 0
                    428: @item function
1.3       noro      429: \JP $BH!?tL>(B
                    430: \EG function name
1.1       noro      431: @end table
                    432:
                    433: @itemize @bullet
1.3       noro      434: \BJP
1.1       noro      435: @item
                    436: $BL50z?t$N;~(B, $B:G>.8B$N@bL@$,I=<($5$l$k(B. $BH!?tL>$,0z?t$H$7$FM?$($i$l$?(B
                    437: $B$H$-(B, $BI8=`%i%$%V%i%j%G%#%l%/%H%j$K$"$k(B @samp{help} $B$H$$$&%G%#%l%/%H%j(B
                    438: $B$KF1L>$N%U%!%$%k$,$"$l$P(B, $B4D6-JQ?t(B @code{PAGER} $B$K@_Dj$5$l$F$$$k%3%^%s%I(B,
                    439: $B$"$k$$$O(B @samp{more} $B$r8F$S=P$7$F$=$N%U%!%$%k$rI=<($9$k(B.
                    440: @item
1.4       noro      441: $B4D6-JQ?t(B @code{LANG} $B$,@_Dj$5$l$F$$$k>l9g(B, $B$=$NCM$,(B @code{"japan"} $B$^$?$O(B
1.19      ohara     442: @code{"ja_JP"} $B$G;O$^$k$J$i(B, @samp{help} $B$NBe$o$j$K(B @samp{help-ja}
                    443: $B$K$"$k%U%!%$%k$,I=<($5$l$k(B. $B$=$&$G$J$$>l9g(B, @samp{help-en}
1.4       noro      444: $B$K$"$k%U%!%$%k$,I=<($5$l$k(B.
                    445: @item
1.1       noro      446: Windows $BHG$G$O(B, $B%3%^%s%I%i%$%s$+$i$N%X%k%W8F$S=P$7$OL$%5%]!<%H$@$,(B,
                    447: $B%a%K%e!<$+$i(B HTML $B7A<0$N$b$N$r8F$S=P$7MQ$$$k$3$H$,$G$-$k(B.
1.3       noro      448: \E
                    449: \BEG
                    450: @item
                    451: If invoked without argument, it displays rough usage of @b{Asir}.
                    452: @item
                    453: If a function name is given and if there exists a file with the
                    454: same name in the directory @samp{help} under standard library directory,
                    455: the file is displayed by a command set to the environmental variable
                    456: @code{PAGER} or else command @samp{more}.
1.4       noro      457: @item
                    458: If the @code{LANG} environment variable is set and its value
                    459: begins with @code{"japan"} or @code{"ja_JP"}, then the file in
1.19      ohara     460: @samp{help-ja} is displayed. If its value does not begin with
                    461: @code{"japan"} or @code{"ja_JP"}, then the file in @samp{help-en}
1.4       noro      462: is displayed.
1.3       noro      463: @item
                    464: On Windows HTML-style help is available from the menu.
                    465: \E
1.1       noro      466: @end itemize
                    467:
1.3       noro      468: \JP @node time,,, $B$=$NB>(B
                    469: \EG @node time,,, Miscellaneouses
1.1       noro      470: @subsection @code{time}
                    471: @findex time
                    472:
                    473: @table @t
                    474: @item time()
1.3       noro      475: \JP :: $B%;%C%7%g%s3+;O$+$i8=:_$^$G$N(B CPU $B;~4V$*$h$S(B GC $B;~4V$rI=<($9$k(B
                    476: \BEG
                    477: :: Returns a four element list consisting of
                    478: total CPU time, GC time, the elapsed time
                    479: and also total memory quantities requested
                    480: from the start of current @b{Asir} session.
                    481: \E
1.1       noro      482: @end table
                    483:
                    484: @table @var
                    485: @item return
1.3       noro      486: \JP $B%j%9%H(B
                    487: \EG list
1.1       noro      488: @end table
                    489:
                    490: @itemize @bullet
1.3       noro      491: \BJP
1.1       noro      492: @item
                    493: CPU $B;~4V$*$h$S(B GC $B;~4V$NI=<($K4X$9$k%3%^%s%I$G$"$k(B.
                    494: @item
                    495: GC $B;~4V$H$O(B, $B%,!<%Y%8%3%l%/%?$K$h$j>CHq$5$l$?$H8+$J$5$l$k;~4V(B,
                    496: CPU $B;~4V$O(B, $BA4BN$N(B CPU $B;~4V$+$i(B GC $B;~4V$r0z$$$?;D$j$G(B, $BC10L$OIC$G$"$k(B.
                    497: @item
                    498: @code{time()} $B$O0z?t$J$7$G(B, $B%;%C%7%g%s3+;O$+$i8=:_$^$G$N(B CPU $B;~4V(B,
                    499: GC $B;~4V(B, $B8=:_$^$G$KMW5a$5$l$?%a%b%j$N$N$YMFNL(B, $B$*$h$S%;%C%7%g%s3+;O$+$i(B
                    500: $B8=:_$^$G$N7P2a;~4V$NI=<($r$9$k(B.
                    501: $B$9$J$o$A(B, @code{[CPU $B;~4V(B ($BIC(B), GC $B;~4V(B ($BIC(B), $B%a%b%jNL(B ($B%o!<%I(B), $B7P2a;~4V(B ($BIC(B)]}
                    502: $B$J$k%j%9%H$rJV$9(B. 1 $B%o!<%I$ODL>o(B 4 $B%P%$%H$G$"$k(B.
                    503: @item
                    504: $B7W;;$N<B9T3+;O;~(B, $B=*N;;~$N(B @code{time()} $B$+$i(B, $B$=$N7W;;$KBP$9$k(B
                    505: CPU $B;~4V(B, GC $B;~4V$,$o$+$k(B.
                    506: @item
                    507: $B%a%b%jNL$OB?G\D9?t$G$O$J$$$?$a(B, $B$"$kCM$r1[$($k$HL50UL#$JCM$H$J$k$?$a(B
                    508: $B$"$/$^$G$bL\0B$H$7$FMQ$$$k$Y$-$G$"$k(B.
                    509: @item
                    510: @code{ctrl()} $B$d(B @code{cputime()} $B$K$h$j(B @code{cputime} $B%9%$%C%A$,(B
                    511: on $B$K$J$C$F$$$k>l9g$K$O(B, $B%H%C%W%l%Y%k$NJ8$r0l$D$NC10L$H$7$F(B,
                    512: $B$=$N<B9T;~4V$,I=<($5$l$k(B. $B$7$+$7(B, $B%W%m%0%i%`$NFbIt$J$I$G(B, $BFCDj$N(B
                    513: $B7W;;$KBP$9$k7W;;;~4V$rCN$j$?$$;~$K$O(B, @code{time()} $B$J$I$r;H$&(B
                    514: $BI,MW$,$"$k(B.
                    515: @item
                    516: @code{getrusage()} $B$,;H$($k(B UNIX $B>e$G$O(B @code{time()} $B$O?.Mj@-$N$"$kCM(B
                    517: $B$rJV$9$,(B, Windows 95, 98 $B>e$G$O;~9o$rMQ$$$k$[$+J}K!$,$J$$$?$a7P2a;~4V$=$N$b$N(B
                    518: $B$,I=<($5$l$k(B. $B$h$C$F(B, $BBT$A>uBV$,$"$k$H(B, $B$=$l$b7P2a;~4V$K2C;;$5$l$k(B.
1.3       noro      519: \E
                    520: \BEG
                    521: @item
                    522: These are commands regarding CPU time and GC time.
                    523: @item
                    524: The GC time is the time regarded to spent by the garbage collector,
                    525: and the CPU time is the time defined by subtracting the GC time from
                    526: the total time consumed by command @b{Asir}.  Their unit is `second.'
                    527: @item
                    528: Command @code{time()} returns total CPU time and GC time measured
                    529: from the start of current @b{Asir} session. It also returns the elapsed
                    530: time. Time unit is `second.'
                    531: Moreover, it returns total memory quantities in words
                    532: (usually 4 bytes) which are requested
                    533: to the memory manager from the beginning of the current session.
                    534: The return value is a list and the format is @code{[CPU time, GC time,
                    535: Memory, Elapsed time]}.
                    536: @item
                    537: You can find the CPU time and GC time for some computation by taking
                    538: the difference of the figure reported by @code{time()} at the beginning
                    539: and the ending of the computation.
                    540: @item
                    541: Since arbitrary precision integers are NOT used for counting
                    542: the total amount of memory request, the number will eventually happen
                    543: to become meaningless due to integer overflow.
                    544: @item
                    545: When @code{cputime} switch is active by @code{ctrl()} or by
                    546: @code{cputime()}, the execution time will be displayed after every
                    547: evaluation of top level statement.
                    548: In a program, however, in order to know the execution time for a
                    549: sequence of computations, you have to use @code{time()} command, for
                    550: an example.
                    551: @item
                    552: On UNIX, if @code{getrusage()} is available, @code{time()} reports
                    553: reliable figures. On Windows NT it also gives reliable CPU time.
                    554: However, on Windows 95/98, the reported time is nothing but
                    555: the elapsed time of the real world.
                    556: Therefore, the time elapsed in the debug-mode and the time of waiting
                    557: for a reply to interruption prompting are added to the elapsed time.
                    558: \E
1.1       noro      559: @end itemize
                    560:
                    561: @example
                    562: [72] T0=time();
                    563: [2.390885,0.484358,46560,9.157768]
                    564: [73] G=hgr(katsura(4),[u4,u3,u2,u1,u0],2)$
                    565: [74] T1=time();
                    566: [8.968048,7.705907,1514833,63.359717]
                    567: [75] ["CPU",T1[0]-T0[0],"GC",T1[1]-T0[1]];
                    568: [CPU,6.577163,GC,7.221549]
                    569: @end example
                    570:
                    571: @table @t
1.3       noro      572: \JP @item $B;2>H(B
                    573: \EG @item References
1.17      ohara     574: @fref{cputime tstart tstop}, @fref{currenttime}.
1.1       noro      575: @end table
                    576:
1.3       noro      577: \JP @node cputime tstart tstop,,, $B$=$NB>(B
                    578: \EG @node cputime tstart tstop,,, Miscellaneouses
1.1       noro      579: @subsection @code{cputime}, @code{tstart}, @code{tstop}
                    580: @findex cputime
                    581: @findex tstart
                    582: @findex tstop
                    583:
                    584: @table @t
                    585: @item cputime(@var{onoff})
1.3       noro      586: \JP :: $B0z?t$,(B 0 $B$J$i$P(B @code{cputime} $B$NI=<($r;_$a$k(B. $B$=$l0J30$J$i$PI=<($r9T$&(B.
                    587: \BEG
                    588: :: Stop displaying @code{cputime} if its argument is 0, otherwise
                    589: start displaying @code{cputime} after every top level evaluation of
                    590: Asir command.
                    591: \E
1.1       noro      592: @item tstart()
1.3       noro      593: \JP :: CPU time $B7WB,3+;O(B.
                    594: \EG :: Resets and starts timer for CPU time and GC time.
1.1       noro      595: @item tstop()
1.3       noro      596: \JP :: CPU time $B7WB,=*N;$*$h$SI=<((B.
                    597: \BEG
                    598: :: Stops timer and then displays CPU time GC time elapsed from the
                    599: last time when timer was started.
                    600: \E
1.1       noro      601: @end table
                    602:
                    603: @table @var
                    604: @item return
                    605: 0
                    606: @item onoff
1.3       noro      607: \JP $B%U%i%0(B ($BG$0U(B)
                    608: \EG flag (arbitrary)
1.1       noro      609: @end table
                    610:
                    611: @itemize @bullet
1.3       noro      612: \BJP
1.1       noro      613: @item
                    614: @code{cputime()} $B$O(B, $B0z?t$,(B 0 $B$J$i$P(B CPU time $B$NI=<($r;_$a$k(B. $B$=$l0J30$J$i$PI=<($r9T$&(B.
                    615: @item
                    616: @code{tsart} $B$O0z?t$J$7(B, @samp{()} $B$J$7$G(B, CPU time $B7WB,$r3+;O$9$k(B.
                    617: @item
                    618: @code{tstop} $B$O0z?t$J$7(B, @samp{()} $B$J$7$G(B, CPU time $B7WB,$r=*N;(B,
                    619: $B$*$h$SI=<($9$k(B.
                    620: @item
                    621: @code{cputime(@var{onoff})} $B$O(B @code{ctrl("cputime",@var{onoff})} $B$HF1$8$G$"$k(B.
                    622: @item
                    623: @code{tstart}, @code{tstop} $B$O(B, $BF~$l;R$K$7$F;H$o$l$k$3$H$OA[Dj$7$F$$$J$$(B
                    624: $B$?$a(B, $B$=$N$h$&$J2DG=@-$,$"$k>l9g$K$O(B, @code{time()} $B$K$h$k7WB,$r9T$&(B
                    625: $BI,MW$,$"$k(B.
                    626: @item
                    627: @code{cputime()} $B$K$h$k(B on, off $B$O(B, $BC1$KI=<($N(B on, off $B$G$"$j(B, $B%H%C%W%l%Y%k(B
                    628: $B$N0l$D$NJ8$KBP$9$k7WB,$O>o$K9T$o$l$F$$$k(B. $B$h$C$F(B, $B7W;;$r;O$a$F$+$i$G$b(B,
                    629: $B7W;;=*N;A0$K%G%P%C%,$KF~$C$F(B @code{cputime(1)} $B$r<B9T$5$;$l$P7W;;;~4V$O(B
                    630: $BI=<($5$l$k(B.
1.3       noro      631: \E
                    632: \BEG
                    633: @item
                    634: Command @code{cputime()} with NON-ZERO argument enables @b{Asir} to display
                    635: CPU time and GC time after every evaluation of top level @b{Asir} command.
                    636: The command with argument 0 disables displaying them.
                    637: @item
                    638: Command @code{tstart()} starts measuring CPU time and GC time without
                    639: arguments.  The parentheses @samp{()} may be omitted.
                    640: @item
                    641: Command @code{tstop()} stops measuring CPU time and GC time and displays
                    642: them without arguments. The parentheses @samp{()} may be omitted.
                    643: @item
                    644: Command @code{cputime(@var{onoff})} has same meaning as
                    645: @code{ctrl("cputime",@var{onoff})}.
                    646: @item
                    647: Nested use of @code{tstart()} and @code{tstop()} is not expected.
                    648: If such an effect is desired, use @code{time()}.
                    649: @item
                    650: On and off states by @code{cputime()} have effects only to displaying
                    651: mode.  Time for evaluation of every top level statement is always
                    652: measured.
                    653: Therefore, even after a computation has already started,
                    654: you can let @b{Asir} display the timings, whenever you enter
                    655: the debug-mode and execute @code{cputime(1)}.
                    656: \E
1.1       noro      657: @end itemize
                    658:
                    659: @example
                    660: [49] tstart$
                    661: [50] fctr(x^10-y^10);
                    662: [[1,1],[x+y,1],[x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],[x-y,1],
                    663: [x^4+y*x^3+y^2*x^2+y^3*x+y^4,1]]
                    664: [51] tstop$
                    665: 80msec + gc : 40msec
                    666: @end example
                    667:
                    668: @table @t
1.3       noro      669: \JP @item $B;2>H(B
                    670: \EG @item References
1.17      ohara     671: @fref{time}, @fref{currenttime}, @fref{ctrl}.
1.1       noro      672: @end table
1.8       noro      673:
                    674: \JP @node timer,,, $B$=$NB>(B
                    675: \EG @node timer,,, Miscellaneouses
                    676: @subsection @code{timer}
                    677: @findex timer
                    678:
                    679: @table @t
                    680: @item timer(@var{interval},@var{expr},@var{val})
                    681: \JP :: $B@)8B;~4V$D$-$G7W;;$r<B9T$9$k(B.
1.17      ohara     682: \EG :: Compute an expression under the interval timer.
1.8       noro      683: @end table
                    684:
                    685: @table @var
                    686: @item return
                    687: \JP $B7k2L(B
                    688: \EG result
                    689:
                    690: @item interval
                    691: \JP $B@)8B;~4V(B ($BIC(B)
                    692: \EG interval (second)
                    693:
                    694: @item expr
                    695: \JP $B7W;;$9$k<0(B
                    696: \EG expression to be computed
                    697:
                    698: @item val
                    699: \JP $B%?%$%^$K$h$kCfCG;~$NLa$jCM(B
                    700: \EG a value to be returned when the timer is expired
                    701: @end table
                    702:
                    703: @itemize @bullet
                    704:
                    705: \BJP
                    706: @item
                    707: @code{timer()} $B$O(B, $B;~4V$r;XDj$7$F7W;;$r<B9T$9$k(B. $B;XDj;~4VFb$K7W;;$,40N;(B
                    708: $B$7$?>l9g$=$NCM$rJV$9(B. $B;XDj;~4VFb$K7W;;$,40N;$7$J$+$C$?>l9g(B, $BBh(B 3 $B0z?t(B
                    709: $B$rJV$9(B.
                    710:
                    711: @item
                    712: $BBh(B 3 $B0z?t$NCM$O(B, $B7W;;$,40N;$7$?>l9g$NCM$H6hJL$G$-$kI,MW$,$"$k(B.
                    713: \E
                    714:
                    715: \BEG
                    716: @item
                    717: @code{timer()} computes an expression under the interval timer.
                    718: If the computation finishes within the specified interval, it
                    719: returns the result of the computation. Otherwise it returns the third
                    720: argument.
                    721:
                    722: @item
                    723: The third argument should be distinguishable from the result on success.
                    724: \E
                    725:
                    726: @end itemize
                    727:
                    728: @example
                    729: [0] load("cyclic");
                    730: 1
                    731: [10] timer(10,dp_gr_main(cyclic(7),[c0,c1,c2,c3,c4,c5,c6],1,1,0),0);
                    732: interval timer expired (VTALRM)
                    733: 0
                    734: [11]
                    735: @end example
1.1       noro      736:
1.17      ohara     737: \JP @node currenttime,,, $B$=$NB>(B
                    738: \EG @node currenttime,,, Miscellaneouses
                    739: @subsection @code{currenttime}
                    740: @findex currenttime
                    741:
                    742: @table @t
                    743: @item currenttime()
                    744: \JP :: $B8=:_;~9o$r<hF@(B
                    745: \EG :: Get current time.
                    746: @end table
                    747:
                    748: @table @var
                    749: @item return
                    750: \JP 1970$BG/(B1$B7n(B1$BF|(B0$B;~(B0$BJ,(B0$BIC$+$i$N7P2aIC?t(B.
                    751: \EG UNIX time.
                    752: @end table
                    753:
                    754: @itemize @bullet
                    755:
                    756: @item
                    757: \JP @code{currenttime()} $B$O8=:_;~9o$rJV$9(B.  UNIX $B$N>l9g(B, time(3) $B$r8F$s$G$$$k$@$1$G$"$k(B.
                    758: \EG See also time(3) in UNIX manuals.
                    759:
                    760: @end itemize
                    761:
                    762: @example
                    763: [0] currenttime();
                    764: 1071639228
                    765: [1]
                    766: @end example
                    767:
                    768: \JP @node sleep,,, $B$=$NB>(B
                    769: \EG @node sleep,,, Miscellaneouses
                    770: @subsection @code{sleep}
                    771: @findex sleep
                    772:
                    773: @table @t
                    774: @item sleep(@var{interval})
                    775: \JP :: $B%W%m%;%9$N<B9T$rDd;_(B
                    776: \EG :: Suspend computation for an interval.
                    777: @end table
                    778:
                    779: @table @var
                    780: @item return
                    781: 1
                    782:
                    783: @item interval
                    784: \JP $BDd;_;~4V(B ($B%^%$%/%mIC(B)
                    785: \EG interval (micro second)
                    786: @end table
                    787:
                    788: @itemize @bullet
                    789:
                    790: @item
                    791: \JP @code{sleep()} $B$O(B, $B%W%m%;%9$N<B9T$rDd;_$9$k(B.  UNIX $B$N>l9g(B, usleep $B$r8F$s$G$$$k$@$1$G$"$k(B.
                    792: \EG See also usleep(3) in UNIX manuals.
                    793:
                    794: @end itemize
                    795:
                    796: @example
                    797: [0] sleep(1000);
                    798: 1
                    799: [1]
                    800: @end example
                    801:
1.3       noro      802: \JP @node heap,,, $B$=$NB>(B
                    803: \EG @node heap,,, Miscellaneouses
1.1       noro      804: @subsection @code{heap}
                    805: @findex heap
                    806:
                    807: @table @t
                    808: @item heap()
1.3       noro      809: \JP :: $B8=:_$N%R!<%W$NBg$-$5$rJV$9(B. ($BC10L(B:$B%P%$%H(B)
                    810: \EG :: Heap area size currently in use.
1.1       noro      811: @end table
                    812:
                    813: @table @var
                    814: @item return
1.3       noro      815: \JP $B<+A3?t(B
                    816: \EG non-negative integer
1.1       noro      817: @end table
                    818:
                    819: @itemize @bullet
1.3       noro      820: \BJP
1.1       noro      821: @item
                    822: $B8=:_$N%R!<%W$NBg$-$5(B($BC10L(B : $B%P%$%H(B) $B$rJV$9(B. $B%R!<%W$H$O(B, @b{Asir} $B$N(B
                    823: $B$5$^$6$^$J?t<0$d(B, $B%f!<%6%W%m%0%i%`$J$I$,$*$+$l$k%a%b%j$NNN0h$G(B, $B%,!<%Y%8(B
                    824: $B%3%l%/%?$K$h$j4IM}$5$l$F$$$k(B. $B%W%m%0%i%`$NF0:nCf$O(B, $B%R!<%W$NBg$-$5$O(B
                    825: $BC1D4Hs8:>/$G$"$j(B, $B<B%a%b%j$NNL$r$3$($FBg$-$/$J$C$?>l9g$K$O(B, OS $B$K$h$k(B
                    826: $B%9%o%C%W%(%j%"$X$NFI$_=q$-$,$[$H$s$I$N7W;;;~4V$r@j$a$k$3$H$K$J$k(B.
                    827: @item
                    828: $B<B%a%b%j$,>/$J$$>l9g$K$O(B, $B5/F0;~$N(B @code{-adj} $B%*%W%7%g%s$K$h$j(B,
                    829: GC $B<gBN$N@_Dj$r9T$C$F$*$/I,MW$,$"$k(B.
1.3       noro      830: \E
                    831: \BEG
                    832: @item
                    833: Command @code{heap()} returns an integer which is the byte size
                    834: of current @b{Asir} heap area.
                    835:
                    836: Heap is a memory area where various data for expressions and
                    837: user programs of @b{Asir} and is managed by the garbage collector.
                    838: While @b{Asir} is running, size of the heap is monotonously
                    839: non-decreasing against the time elapsed.  If it happens to exceed the
                    840: real memory size, most (real world) time is consumed for swapping between
                    841: real memory and disk memory.
                    842: @item
                    843: For a platform with little real memory, it is recommended to set up
                    844: @b{Asir} configuration tuned for GC functions by @code{-adj} option
                    845: at the activation of @b{Asir}. (@xref{Command line options}.)
                    846: \E
1.1       noro      847: @end itemize
                    848:
                    849: @example
                    850: % asir -adj 16
                    851: [0] load("fctrdata")$
                    852: 0
                    853: [97] cputime(1)$
                    854: 0msec
                    855: [98] heap();
                    856: 524288
                    857: 0msec
                    858: [99] fctr(Wang[8])$
                    859: 3.190sec + gc : 3.420sec
                    860: [100] heap();
                    861: 1118208
                    862: 0msec
                    863: [101] quit;
                    864: % asir
                    865: [0] load("fctrdata")$
                    866: 0
                    867: [97] cputime(1)$
                    868: 0msec
                    869: [98] heap();
                    870: 827392
                    871: 0msec
                    872: [99] fctr(Wang[8])$
                    873: 3.000sec + gc : 1.180sec
                    874: [100] heap();
                    875: 1626112
                    876: 0msec
                    877: [101] quit;
                    878: @end example
                    879:
                    880: @table @t
1.3       noro      881: \JP @item $B;2>H(B
                    882: \EG @item References
                    883: \JP @fref{$B%3%^%s%I%i%$%s%*%W%7%g%s(B}.
                    884: \EG @fref{Command line options}.
1.1       noro      885: @end table
                    886:
1.3       noro      887: \JP @node version,,, $B$=$NB>(B
                    888: \EG @node version,,, Miscellaneouses
1.1       noro      889: @subsection @code{version}
                    890: @findex version
                    891:
                    892: @table @t
                    893: @item version()
1.3       noro      894: \JP :: @b{Asir} $B$N%P!<%8%g%s$rJV$9(B.
                    895: \EG :: Version identification number of  @b{Asir}.
1.1       noro      896: @end table
                    897:
                    898: @table @var
                    899: @item return
1.3       noro      900: \JP $B<+A3?t(B
                    901: \EG integer
1.1       noro      902: @end table
                    903:
                    904: @itemize @bullet
1.3       noro      905: \BJP
1.1       noro      906: @item
1.3       noro      907: @b{Asir} $B$N%P!<%8%g%s$r<+A3?t$GJV$9(B.
                    908: \E
                    909: \BEG
1.17      ohara     910: @item
                    911: Command @code{version()} returns the version identification number,
                    912: an integer of @b{Asir} in use.
1.3       noro      913: \E
1.1       noro      914: @end itemize
                    915:
                    916: @example
                    917: [0] version();
1.3       noro      918: 991214
1.1       noro      919: @end example
                    920:
1.3       noro      921: \JP @node shell,,, $B$=$NB>(B
                    922: \EG @node shell,,, Miscellaneouses
1.1       noro      923: @subsection @code{shell}
                    924: @findex shell
                    925:
                    926: @table @t
                    927: @item shell(@var{command})
1.3       noro      928: \JP :: @var{command} $B$r%7%'%k%3%^%s%I$H$7$F<B9T$9$k(B.
                    929: \EG :: Execute shell commands described by a string @var{command}.
1.1       noro      930: @end table
                    931:
                    932: @table @var
                    933: @item return
1.3       noro      934: \JP $B<+A3?t(B
                    935: \EG integer
1.1       noro      936: @item command
1.3       noro      937: \JP $BJ8;zNs(B
                    938: \EG string
1.1       noro      939: @end table
                    940:
                    941: @itemize @bullet
1.3       noro      942: \BJP
1.1       noro      943: @item
                    944: @var{command} $B$r(B C $B$N(B @code{system()} $BH!?t$K$h$j%7%'%k%3%^%s%I$H$7$F<B9T$9$k(B.
                    945: $B%7%'%k$N=*N;%9%F!<%?%9$rJV$9(B.
1.3       noro      946: \E
                    947: \BEG
                    948: Execute shell commands described by a string @var{command}
                    949: by a C function @code{system()}.  This returns the exit status of shell
                    950: as its return value.
                    951: \E
1.1       noro      952: @end itemize
                    953:
                    954: @example
                    955: [0] shell("ls");
1.12      noro      956: alg           da            katsura       ralg          suit
                    957: algt          defs.h        kimura        ratint        test
                    958: alpi          edet          kimura3       robot         texput.log
                    959: asir.o        fee           mfee          sasa          wang
                    960: asir_symtab   gr            mksym         shira         wang_data
                    961: base          gr.h          mp            snf1          wt
                    962: bgk           help          msubst        solve
                    963: chou          hom           p             sp
                    964: const         ifplot        proot         strum
                    965: cyclic        is            r             sugar
1.1       noro      966: 0
                    967: [1]
                    968: @end example
                    969:
1.3       noro      970: \JP @node map,,, $B$=$NB>(B
                    971: \EG @node map,,, Miscellaneouses
1.1       noro      972: @subsection @code{map}
                    973: @findex map
                    974:
                    975: @table @t
                    976: @item map(@var{function},@var{arg0},@var{arg1},...)
1.3       noro      977: \JP :: $B%j%9%H(B, $BG[Ns$N3FMWAG$KH!?t$rE,MQ$9$k(B.
                    978: \EG :: Applies a function to each member of a list or an array.
1.1       noro      979: @end table
                    980:
                    981: @table @var
                    982: @item return
1.3       noro      983: \JP @var{arg0} $B$HF1$87?$N%*%V%8%'%/%H(B
                    984: \EG an object of the same type as @var{arg0}.
1.1       noro      985: @item function
1.3       noro      986: \JP $BH!?tL>(B
                    987: \EG the name of a function
1.1       noro      988: @item arg0
1.3       noro      989: \JP $B%j%9%H(B, $B%Y%/%H%k(B, $B9TNs(B
                    990: \EG list, vector or matrix
1.11      noro      991: @item arg1  ...
1.3       noro      992: \JP $BG$0U(B ($B;D$j$N0z?t(B)
                    993: \EG arbitrary (the rest of arguments)
1.1       noro      994: @end table
                    995:
                    996: @itemize @bullet
1.3       noro      997: \BJP
1.1       noro      998: @item
                    999: @var{arg0} $B$N3FMWAG$r:G=i$N0z?t(B, @var{arg1} $B0J2<$N;D$j$N0z?t$H$7$F(B
                   1000: $BH!?t(B @var{function} $B$r8F$S=P$7(B, @var{arg0} $B$NBP1~$9$kMWAG$N0LCV$K(B
                   1001: $BH!?t8F$S=P$7$N7k2L$,F~$C$?F1$87?$N%*%V%8%'%/%H$r@8@.$7$FJV$9(B.
                   1002: @item
                   1003: @var{function} $B$O(B, $B%@%V%k%/%)!<%H$N$J$$H!?tL>$rMQ$$$k(B.
                   1004: @item
                   1005: @var{function} $B$K%W%m%0%i%`JQ?t$O;H$($J$$(B.
                   1006: @item
                   1007: @var{arg0} $B$,%j%9%H(B, $B%Y%/%H%k(B, $B9TNs0J30$N>l9g(B, $BC1$K(B @var{arg0},
                   1008: @var{arg1}, ... $B$r0z?t$H$7$F(B @var{function} $B$r8F$S=P$7$=$N(B
                   1009: $B7k2L$rJV$9(B.
1.17      ohara    1010: @item
                   1011: @code{map} $B$N0z?t(B @var{function} $B$GM?$($i$l$kH!?t$O(B, $BFbItE*$K$bH!?t$H(B
                   1012: $B$7$F<BAu$5$l$F$$$J$1$l$P$J$i$J$$(B.  $B$=$&$G$J$1$l$P(B parse error $B$K$J$k(B.
1.18      ohara    1013: $BNc$($P(B @code{map} $B<+?H$d(B @code{car}, @code{cdr} $B$J$I$OFbItE*$K$OH!?t$G(B
                   1014: $B$O$J$/(B, Asir $B$NJ8K!$K$*$1$k%-!<%o!<%I$H$7$F<BAu$5$l$F$$$k(B.  $B$7$?$,$C$F(B
                   1015: @code{map} $B$N0z?t$K(B @code{map} $B$r$H$k$3$H$O$G$-$J$$(B.
1.3       noro     1016: \E
                   1017: \BEG
                   1018: @item
                   1019: Returns an object of the same type as @var{arg0}. Each member of the
                   1020: returned object is the return value of a function call where the first
                   1021: argument is the member of @var{arg0} corresponding to the member in
                   1022: the returned object and the rest of the argument are @var{arg1},
                   1023: @dots{}.
                   1024: @item
                   1025: @var{function} is a function name itself without @samp{"}.
                   1026: @item
                   1027: A program variable cannot be used as @var{function}.
                   1028: @item
                   1029: If @var{arg0} is neither list nor array this function simply
                   1030: returns the value of @var{function}(@var{arg0},@var{arg1},@dots{}).
                   1031: \E
1.1       noro     1032: @end itemize
                   1033:
                   1034: @example
                   1035: [82] def afo(X) @{ return X^3; @}
                   1036: [83] map(afo,[1,2,3]);
                   1037: [1,8,27]
                   1038: @end example
                   1039:
1.3       noro     1040: \JP @node flist,,, $B$=$NB>(B
                   1041: \EG @node flist,,, Miscellaneouses
1.1       noro     1042: @subsection @code{flist}
                   1043: @findex flist
                   1044:
                   1045: @table @t
1.22      noro     1046: @item flist([mname])
1.3       noro     1047: \JP :: $B8=:_Dj5A$5$l$F$$$kH!?tL>$rJ8;zNs%j%9%H$H$7$FJV$9(B.
                   1048: \EG :: Returns the list of function names currently defined.
1.22      noro     1049: @item mname
                   1050: \JP $B%b%8%e!<%kL>(B
                   1051: \EG a module name
1.1       noro     1052: @end table
                   1053:
                   1054: @table @var
                   1055: @item return
1.3       noro     1056: \JP $BJ8;zNs$N%j%9%H(B
                   1057: \EG list of character strings
1.1       noro     1058: @end table
                   1059:
                   1060: @itemize @bullet
1.3       noro     1061: \BJP
1.1       noro     1062: @item
                   1063: $B8=:_Dj5A$5$l$F$$$kAH$_9~$_H!?t(B, $B%f!<%6Dj5AH!?t$NH!?tL>$rJ8;zNs%j%9%H(B
1.22      noro     1064: $B$H$7$FJV$9(B. $B%b%8%e!<%kL>$,;XDj$5$l$?>l9g(B, $B$=$N%b%8%e!<%k$GDj5A$5$l$F$$$k(B
                   1065: $B4X?tL>$N$_$rJV$9(B.
1.1       noro     1066: @item
                   1067: $B%7%9%F%`H!?t$N8e$K%f!<%6Dj5AH!?t$,B3$/(B.
1.3       noro     1068: \E
                   1069: \BEG
                   1070: @item
                   1071: Returns the list of names of built-in functions and user defined functions
                   1072: currently defined. The return value is a list of character strings.
1.22      noro     1073: If a module name is specified, only the names of functions defined in the module
                   1074: are returned.
1.3       noro     1075: @item
                   1076: The names of built-in functions are followed by those of user defined
                   1077: functions.
                   1078: \E
1.1       noro     1079: @end itemize
                   1080:
                   1081: @example
                   1082: [77] flist();
                   1083: [defpoly,newalg,mainalg,algtorat,rattoalg,getalg,alg,algv,...]
                   1084: @end example
                   1085:
1.3       noro     1086: \JP @node delete_history,,, $B$=$NB>(B
                   1087: \EG @node delete_history,,, Miscellaneouses
1.1       noro     1088: @subsection @code{delete_history}
                   1089: @findex delete_history
                   1090:
                   1091: @table @t
                   1092: @item delete_history([@var{index}])
1.3       noro     1093: \JP :: $B%R%9%H%j$r>C5n$9$k(B.
                   1094: \EG :: Deletes the history.
1.1       noro     1095: @end table
                   1096:
                   1097: @table @var
                   1098: @item return
                   1099: 0
                   1100: @item index
1.3       noro     1101: \JP $B>C5n$7$?$$%R%9%H%j$NHV9f(B
                   1102: \EG Index of history to be deleted.
1.1       noro     1103: @end table
                   1104:
                   1105: @itemize @bullet
1.3       noro     1106: \BJP
1.1       noro     1107: @item
                   1108: $B0z?t$,$J$$$H$-(B, $B$3$l$^$G7W;;$7$?%R%9%H%j$rA4$F>C5n$9$k(B.
                   1109: @item
                   1110: $B0z?t$,$"$k$H$-(B, $B$=$NHV9f$N7k2L$N$_>C5n$9$k(B.
                   1111: @item
                   1112: $B$3$3$G%R%9%H%j$H$O(B, $BHV9f$D$-$N%W%m%s%W%H$KBP$7$F$NF~NO$rI>2A$7$FF@$i$l$?<0(B
                   1113: $B$G(B, $B$3$N<0$O(B @code{@@@var{number}} $B$K$h$j<h$j=P$9$3$H$,$G$-$k(B. $B$3$N$3$H$O(B,
                   1114: $B%,!<%Y%C%8%3%l%/%7%g%s$N:]$K$b$3$N<0$,@8$-;D$k$3$H$r0UL#$9$k(B.
                   1115: @item
                   1116: $BBg$-$J<0$,%R%9%H%j$H$7$F;D$C$?>l9g(B, $B0J9_$N%a%b%j4IM}$K;Y>c$rMh$9>l9g$,B?$$(B
                   1117: $B$?$a(B, @code{bsave()} $B$J$I$G%U%!%$%k$K%;!<%V$7$F(B, @code{delete_history()}
                   1118: $B$K$h$j%R%9%H%j$r>C5n$7$F$*$/$N$,M-8z$G$"$k(B.
1.3       noro     1119: \E
                   1120: \BEG
                   1121: @item
                   1122: Deletes all the histories without an argument.
                   1123: @item
                   1124: Deletes the history with index @var{index} if specified.
                   1125: @item
                   1126: A history is an expression which has been obtained by evaluating an input
                   1127: given for a prompt with an index. It can be taken out by @code{@@@var{index}},
                   1128: which means that the expression survives garbage collections.
                   1129: @item
                   1130: A large history may do harm in the subsequent memory management and
                   1131: deleting the history by @code{delete_history()}, after saving it in a file
                   1132: by @code{bsave()}, is often effective.
                   1133: \E
1.1       noro     1134: @end itemize
                   1135:
                   1136: @example
                   1137: [0] (x+y+z)^100$
                   1138: [1] @@0;
                   1139: ...
                   1140: [2] delete_history(0);
                   1141: [3] @@0;
                   1142: 0
                   1143: @end example
                   1144:
1.3       noro     1145: \JP @node get_rootdir,,, $B$=$NB>(B
                   1146: \EG @node get_rootdir,,, Miscellaneouses
1.1       noro     1147: @subsection @code{get_rootdir}
                   1148: @findex get_rootdir
                   1149:
                   1150: @table @t
                   1151: @item get_rootdir()
1.3       noro     1152: \JP :: Asir $B$N%k!<%H%G%#%l%/%H%jL>$r<h$j=P$9(B
                   1153: \EG :: Gets the name of @b{Asir} root directory.
1.1       noro     1154: @end table
                   1155:
                   1156: @table @var
                   1157: @item return
1.3       noro     1158: \JP $BJ8;zNs(B
                   1159: \EG string
1.1       noro     1160: @end table
                   1161:
                   1162: @itemize @bullet
1.3       noro     1163: \BJP
1.1       noro     1164: @item
                   1165: UNIX $BHG$N>l9g(B, $B4D6-JQ?t(B @code{ASIR_LIBDIR} $B$,Dj5A$5$l$F$$$k>l9g$K$O$=$NCM(B, $B$5$l$F$$$J$$>l9g(B
                   1166: $B$K$O(B @samp{/usr/local/lib/asir} $B$rJV$9(B.
                   1167: @item
                   1168: Windows $BHG$N>l9g(B, @samp{asirgui.exe} $B$N$"$k%G%#%l%/%H%j(B (@samp{bin} $B$H$$$&L>A0$N$O$:$G$"$k(B)
                   1169: $B$N?F%G%#%l%/%H%j$,JV$5$l$k(B.
                   1170: @item
                   1171: $B$3$N4X?t$,JV$9%G%#%l%/%H%jL>$r4p=`$H$7$?AjBP%Q%9L>$r;XDj$9$k$3$H$K$h$j(B, $B%$%s%9%H!<%k(B
                   1172: $B$5$l$?>l=j$K$h$i$J$$%U%!%$%kFI$_9~$_%W%m%0%i%`$r=q$/$3$H$,$G$-$k(B.
1.3       noro     1173: \E
                   1174: \BEG
                   1175: @item
                   1176: On UNIX it returns the value of an environment variable @code{ASIR_LIBDIR}
                   1177: or @samp{/usr/local/lib/asir} if @code{ASIR_LIBDIR} is not set.
                   1178: @item
                   1179: On Windows the name of @b{Asir} root directory is returned.
                   1180: @item
                   1181: By using relative path names from the value of this function,
                   1182: one can write programs which contain file operations independent
                   1183: of the install directory.
                   1184: \E
1.1       noro     1185: @end itemize
1.2       noro     1186:
                   1187:
1.3       noro     1188: \JP @node getopt,,, $B$=$NB>(B
                   1189: \EG @node getopt,,, Miscellaneouses
1.2       noro     1190: @subsection @code{getopt}
                   1191: @findex getopt
                   1192:
                   1193: @table @t
1.9       noro     1194: @item getopt([@var{key}])
1.3       noro     1195: \JP :: $B%*%W%7%g%s$NCM$rJV$9(B.
                   1196: \EG :: Returns the value of an option.
1.2       noro     1197: @end table
                   1198:
                   1199: @table @var
                   1200: @item return
1.3       noro     1201: \JP $B%*%V%8%'%/%H(B
                   1202: \EG object
1.2       noro     1203: @end table
                   1204:
                   1205: @itemize @bullet
1.3       noro     1206: \BJP
1.2       noro     1207: @item
                   1208: $B%f!<%6Dj5A4X?t$O(B, $B8GDj8D?t0z?t$G$7$+@k8@$G$-$J$$(B. $B%f!<%6Dj5A4X?t$G(B
                   1209: $B2DJQ8D0z?t$r<B8=$9$kJ}K!$N0l$D$H$7$F(B, $B%*%W%7%g%s$K$h$k0z?t$N;XDj(B
                   1210: $B$,$"$k(B (@pxref{$B%*%W%7%g%s;XDj(B}). $B;XDj$5$l$?%*%W%7%g%s$r4X?tFb$G(B
                   1211: $B<u$1<h$k$?$a$K$3$N4X?t$rMQ$$$k(B.
                   1212: @item
1.9       noro     1213: $BL50z?t$G8F$S=P$5$l$?>l9g(B, @code{getopt()} $B$O(B
                   1214: @code{[[key1,value1],[key2,value2],...]} $B$J$k%j%9%H$rJV$9(B.
                   1215: $B$3$3$G(B, @code{key} $B$O4X?t8F$S=P$7;~$K;XDj$5$l$?%*%W%7%g%s(B, @code{value}
                   1216: $B$O$=$NCM$G$"$k(B.
                   1217: @item
1.2       noro     1218: $B4X?t8F$S=P$7$N:]$K(B @var{key} $B$,%*%W%7%g%s$H$7$F;XDj$5$l$F$$$k(B
                   1219: $B>l9g$K$O(B, $B$=$NCM$rJV$9(B. $B$b$7;XDj$,$J$$>l9g$K$O(B, VOID $B7?%*%V%8%'%/%H(B
                   1220: ($B7?<1JL;R(B -1) $B$rJV$9(B. @code{getopt()} $B$,JV$7$?CM$N7?$r(B @code{type()}
                   1221: $B$GD4$Y$k$3$H$G(B, $B$=$N%*%W%7%g%s$,;XDj$5$l$?$+$I$&$+D4$Y$k$3$H$,$G$-$k(B.
                   1222: @item
                   1223: $B4X?t8F$S=P$7$K$*$1$k%*%W%7%g%s$N;XDj$O(B, $B@55,$N0z?t$J$i$S$N8e$m$K(B,
                   1224:
                   1225: @example
                   1226: xxx(A,B,C,D|x=X,y=Y,z=Z)
                   1227: @end example
                   1228:
                   1229: $B$H$$$&Iw$K(B, @samp{|} $B$KB3$/(B, @var{key=value} $B$N(B @samp{,} $B$G6h@Z$i$l$?(B
                   1230: $BJB$S$rCV$/$3$H$G9T$&(B.
1.3       noro     1231: \E
                   1232: \BEG
                   1233: @item
                   1234: When a user defined function is called, the number of arguments
                   1235: must be equal to that in the declaration of the function.
                   1236: A function with indefinite number of arguments can be realized
                   1237: by using @var{options} (@pxref{option}).
                   1238: The value of a specified option is retrieved by @code{getopt}.
1.9       noro     1239: @item
                   1240: If @code{getopt()} is called with no argument, then it returns a list
1.12      noro     1241: @code{[[key1,value1],} @code{[key2,value2],@dots{}]}.
                   1242: In the list, each @code{key}
1.9       noro     1243: is an option which was specified when the function executing @code{getopt}
                   1244: was invoked, and @code{value} is the value of the option.
1.3       noro     1245: @item
                   1246: If an option @var{key} is specified upon a function call, @code{getopt}
                   1247: return the value of the option. If such an option is not specified,
                   1248: the it returns an object of VOID type whose object identifier is
                   1249: -1. By examining the type of the returned value with @code{type()},
                   1250: one knows whether the option is set or not.
                   1251: @item
                   1252: Options are specified as follows:
                   1253:
                   1254: @example
                   1255: xxx(A,B,C,D|x=X,y=Y,z=Z)
                   1256: @end example
                   1257:
                   1258: That is, the options are specified by a sequence of @var{key=value} seperated
                   1259: by @samp{,}, after @samp{|}.
                   1260: \E
1.2       noro     1261: @end itemize
                   1262:
                   1263: @table @t
1.3       noro     1264: \JP @item $B;2>H(B
                   1265: \EG @item References
                   1266: \JP @fref{$B%*%W%7%g%s;XDj(B}, @fref{type}.
                   1267: \EG @fref{option}, @fref{type}.
                   1268: @end table
                   1269:
                   1270: \JP @node getenv,,, $B$=$NB>(B
                   1271: \EG @node getenv,,, Miscellaneouses
                   1272: @subsection @code{getenv}
                   1273: @findex getenv
                   1274:
                   1275: @table @t
                   1276: @item getenv(@var{name})
                   1277: \JP :: $B4D6-JQ?t$NCM$rJV$9(B.
                   1278: \EG :: Returns the value of an environment variable.
                   1279: @end table
                   1280:
                   1281: @table @var
                   1282: @item return
                   1283: @itemx name
                   1284: \JP $BJ8;zNs(B
                   1285: \EG string
1.2       noro     1286: @end table
                   1287:
1.3       noro     1288: @itemize @bullet
                   1289: @item
                   1290: \JP $B4D6-JQ?t(B @var{name} $B$NCM$rJV$9(B.
                   1291: \EG Returns the value of an environment variable @var{name}.
                   1292: @end itemize
                   1293:
                   1294: @example
                   1295: [0] getenv("HOME");
                   1296: /home/pcrf/noro
                   1297: @end example
1.1       noro     1298:
                   1299:
                   1300:

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