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