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