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