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