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