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