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