[BACK]Return to io.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts / builtin

File: [local] / OpenXM / src / asir-doc / parts / builtin / io.texi (download)

Revision 1.17, Wed Apr 9 05:34:30 2014 UTC (10 years, 2 months ago) by takayama
Branch: MAIN
CVS Tags: RELEASE_1_3_1_13b, HEAD
Changes since 1.16: +12 -1 lines

Added references on cpp.

@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/io.texi,v 1.17 2014/04/09 05:34:30 takayama Exp $
\BJP
@node $BF~=PNO(B,,, $BAH$_9~$_H!?t(B
@section $BF~=PNO(B
\E
\BEG
@node Inputs and Outputs,,, Built-in Function
@section Inputs and Outputs
\E

@menu
* end quit::
* load::
* which::
* output::
* bsave bload::
* bload27::
* print::
* access::
* remove_file::
* open_file close_file get_line get_byte put_byte purge_stdin::
@end menu

\JP @node end quit,,, $BF~=PNO(B
\EG @node end quit,,, Inputs and Outputs
@subsection @code{end}, @code{quit}
@findex end
@findex quit

@table @t
@item end, quit
\BJP
:: $B8=:_FI$_9~$_Cf$N%U%!%$%k$rJD$8$k(B. 
$B%H%C%W%l%Y%k$K$*$$$F$O%;%C%7%g%s$r=*N;$9$k$3$H$K$J$k(B. 
\E
\BEG
:: Close the currently reading file.
At the top level, terminate the @b{Asir} session.
\E
@end table

@itemize @bullet
\BJP
@item
@code{end}, @code{quit} $B$H$b$KL50z?t$NH!?t$G$"$k$,(B, @samp{()} $B$J$7$G(B
$B8F$S=P$9$3$H$,$G$-$k(B. $B$$$:$l$b8=:_FI$_9~$_Cf$N%U%!%$%k$rJD$8$k(B. 
$B$3$l$O(B, $B%H%C%W%l%Y%k$K$*$$$F$O%;%C%7%g%s$r=*N;$5$;$k$3$H$K$J$k(B. 
@item
$B%U%!%$%k$N>l9g(B, $B%U%!%$%k$N=*C<$^$GFI$a$P(B, $B<+F0E*$K%U%!%$%k$OJD$8$i$l$k(B
$B$,(B, $B%H%C%W%l%Y%k$N>l9g%W%m%s%W%H$,=P$J$$$^$^(B, $BF~NOBT$A$K$J$k$N$G(B, 
$B%U%!%$%k$N=*C<$K$O(B @code{end$} $B$r=q$/$N$,K>$^$7$$(B. 
\E
\BEG
@item
These two functions take no arguments.  These functions can be called
without a @samp{()}.  Either function close the current input file.
This means the termination of the @b{Asir} session at the top level.
@item
An input file will be automatically closed if it is read to its end.
However, if no @code{end$} is written at the last of the input file,
the control will be returned to the top level and @b{Asir} will be
waiting for an input without any prompting.
Thus, in order to avoid confusion, putting a @code{end$} at the last
line of the input file is strongly recommended.
\E
@end itemize

@example
[6] quit;
%
@end example

@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{load}.
@end table

\JP @node load,,, $BF~=PNO(B
\EG @node load,,, Inputs and Outputs
@subsection @code{load}
@findex load

@table @t
@item load("@var{filename}")
\JP :: @var{filename} $B$rFI$_9~$`(B. 
\EG :: Reads a program file @var{filename}.
@end table

@table @var
@item return
(1|0)
@item filename
\JP $B%U%!%$%kL>(B ($B%Q%9L>(B)
\EG file (path) name
@end table

@itemize @bullet
\BJP
@item
$B<B:]$N%W%m%0%i%`$N=q$-J}$O(B, @pxref{$B%f!<%68@8l(B Asir}.
 $B%F%-%9%H%U%!%$%k$rFI$_9~$`>l9g(B, @code{cpp} 
$B$rDL$9$N$G(B, C $B$N%W%m%0%i%`F1MM(B @code{#include}, @code{#define} $B$r;H$&$3$H$,$G$-$k(B. 
unix $BHG$G$O(B, $B%7%9%F%`$K%$%s%9%H!<%k$5$l$F$$$k(B @code{cpp} $B$rMxMQ$7$F$$$k(B.
Windows $BHG$G$O(B @code{mcpp} @url{http://mcpp.sourceforge.net} $B$rMQ$$$F$$$k(B.
$B$3$l$K$O9T$ND9$5$K@)8B$,$"$k$N$GCm0U(B.
unix/OpenXM $BHG(B(Mac $BMQ(B cfep/asir $B$r4^$`(B)$B$G$O(B @code{OpenXM/bin/ox_cpp} $B$rMQ$$$F$$$k(B.
$B$3$l$O(B Portable C compiler @url{http://pcc.ludd.ltu.se} $B$KImB0$9$k(B @code{cpp} $B$G$"$k(B.
@item
$B;XDj$7$?%U%!%$%k$,B8:_$7$?;~$K$O(B 1 $B$rJV$7(B, $BB8:_$7$J$+$C$?;~$O(B 0 $B$rJV$9(B. 
@item
$B%U%!%$%kL>$,(B @samp{/} $B$G;O$^$k>l9g$O@dBP%Q%9(B, @samp{.} $B$G;O$^$k>l9g$O(B
$B%+%l%s%H%G%#%l%/%H%j$+$i$NAjBP%Q%9$H8+$J$5$l$k(B. $B$=$l0J30$N>l9g(B, 
$B4D6-JQ?t(B @code{ASIRLOADPATH} $B$K@_Dj$5$l$F$$$k%G%#%l%/%H%j$r:8$+$i=g$K(B
$B%5!<%A$9$k(B. $B$=$l$i$K3:Ev$9$k%U%!%$%k$,B8:_$7$J$$>l9g(B, $BI8=`%i%$%V%i%j(B
$B%G%#%l%/%H%j(B ($B$"$k$$$O4D6-JQ?t(B @code{ASIR_LIBDIR} $B$K@_Dj$5$l$F$$$k(B
$B%G%#%l%/%H%j(B) $B$b%5!<%A$9$k(B. 
Windows $BHG$N>l9g(B, @code{ASIR_LIBDIR} $B$,@_Dj$5$l$F$$$J$$>l9g$K$O(B, 
@code{get_rootdir()/lib} $B$r%5!<%A$9$k(B. 
@item
$BFI$_9~$`%U%!%$%k$N:G8e$K(B, @code{end$} $B$,$J$$$H(B @code{load()} 
$B=*N;8e$K%W%m%s%W%H$,$G$J$$$,(B, $B<B:]$K$OF~NO$r<u$1IU$1$k(B. $B$7$+$7(B, 
$B:.Mp$r>7$/$*$=$l$,$"$k$N$G%U%!%$%k$N:G8e$K(B @code{end$} $B$r=q$$$F$*$/$3$H(B
$B$,K>$^$7$$(B. (@code{end;} $B$G$b$h$$$,(B, @code{end} $B$,JV$9CM(B 0 $B$,I=<($5$l$k(B
$B$?$a(B, @code{end$} $B$r$*4+$a$9$k(B. )
@item
Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
\E
\BEG
@item
See @ref{User language Asir} for practical programming.
Since text files are read through @code{cpp},
the user can use, as in C programs, @code{#include} and @code{#define}
in @b{Asir} program source codes.
The @code{cpp} which is installed to the system with a C compler is used in the unix version.
The @code{mcpp} @url{http://mcpp.sourceforge.net} is used in the Windows version.
Note that the length of a line has a limit for an input @code{mcpp}.
The @code{OpenXM/bin/ox_cpp} is used in the unix/OpenXM version
(including cfep/asir for MacOS X).
This is the @code{cpp} distributed with the  Portable C compiler @url{http://pcc.ludd.ltu.se}.
@item
It returns 1 if the designated file exists, 0 otherwise.
@item
If the @var{filename} begins with @samp{/}, it is understood as an
absolute path name; with  @samp{.}, relative path name from current
directory; otherwise, the file is searched first from directories
assigned to an environmental variable @code{ASIRLOADPATH}, then
if the search ends up in failure, the standard library directory
(or directories assigned to @code{ASIR_LIBDIR}) shall be searched.
On Windows, @code{get_rootdir()/lib} is searched if 
@code{ASIR_LIBDIR} is not set.
@item
We recommend to write an @code{end} command at the last line of
your program.  If not, @b{Asir} will not give you a prompt after it
will have executed @code{load} command.
(Escape with an interrupt character (@ref{Interruption}),
if you have lost yourself.)
Even in such a situation,
@b{Asir} itself is still ready to read keyboard inputs as usual.
It is, however, embarrassing and may cause other errors.
Therefore, to put an @code{end$} at the last line is desirable.
(Command @code{end;} will work as well,
but it also returns and displays verbose.)
@item
On Windows one has to use @samp{/} as the separator of directory names.
\E
@end itemize

@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{end quit}, @fref{which}, @fref{get_rootdir}.
@end table

\JP @node which,,, $BF~=PNO(B
\EG @node which,,, Inputs and Outputs
@subsection @code{which}
@findex which

@table @t
@item which("@var{filename}")
\JP :: $B0z?t(B @var{filename} $B$KBP$7(B, @code{load()} $B$,FI$_9~$`%Q%9L>$rJV$9(B. 
\EG :: This returns the path name for the @var{filename} which @code{load()} will read.
@end table

@table @var
@item return
\JP $B%Q%9L>(B
\EG path name
@item filename
\JP $B%U%!%$%kL>(B ($B%Q%9L>(B) $B$^$?$O(B 0
\EG filename (path name) or 0
@end table

@itemize @bullet
\BJP
@item
@code{load()} $B$,%U%!%$%k$r%5!<%A$9$k<j=g$K=>$C$F%5!<%A$7(B, 
$B%U%!%$%k$,B8:_$9$k>l9g$K$O%Q%9L>$rJ8;zNs$H$7$F(B, $BB8:_$7$J$$>l9g(B
$B$K$O(B 0 $B$rJV$9(B. 
@item
$B%5!<%A$N<j=g$K$D$$$F$O(B @code{load()} $B$r;2>H(B. 
@item
Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
\E
\BEG
@item
This function searches directory trees according to the same procedure
as @code{load()} will do.  Then, returns a string, the path name to the
file if the named file exists; 0 unless otherwise.
@item
For details of searching procedure,
refer to the description about @code{load()}.
@item
On Windows one has to use @samp{/} as the separator of directory names.
\E
@end itemize

@example
[0] which("gr");               
./gb/gr
[1] which("/usr/local/lib/gr");
0
[2] which("/usr/local/lib/asir/gr");
/usr/local/lib/asir/gr
@end example

@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{load}.
@end table

\JP @node output,,, $BF~=PNO(B
\EG @node output,,, Inputs and Outputs
@subsection @code{output}
@findex output

@table @t
@item output(["@var{filename}"])
\JP :: $B0J9_$N=PNO@h$r(B @var{filename}$B$^$?$OI8=`=PNO$K@ZBX$($k(B. 
\EG :: Writes the return values and prompt onto file @var{filename}.
@end table

@table @var
@item return
1
@item filename
\JP $B%U%!%$%kL>(B
\EG filename
@end table

@itemize @bullet
\BJP
@item
@b{Asir} $B$N=PNO$rI8=`=PNO$+$i(B, $B%U%!%$%k$X$N=PNO$K@ZBX$($k(B. 
$B$J$*(B, $B%U%!%$%k=PNO$N4V$O(B, $BI8=`=PNO$K$O%-!<%\!<%I$+$i$NF~NO0J30(B, 
$B=PNO$5$l$J$$(B. 
@item
$BJL$N%U%!%$%k=PNO$K@ZBX$($k;~$K$O(B, $B:F$S(B @code{output("@var{filename}")} 
$B$r<B9T$9$k(B. 
$BKt(B, $B%U%!%$%k=PNO$r=*N;$7I8=`=PNO$KLa$j$?$$;~$K$O(B, $B0z?t$J$7$G(B 
@code{output()} $B$r<B9T$9$k(B. 
@item
$B;XDj$7$?%U%!%$%k(B @var{filename} $B$,B8:_$7$?;~$O(B, $B$=$N%U%!%$%k$NKvHx$K(B
$BDI=q$-$5$l(B, $BB8:_$7$J$+$C$?;~$K$O(B, $B?7$?$K%U%!%$%k$r:n@.$7(B, $B$=$3$K=q$-9~$^$l$k(B. 
@item
$B%U%!%$%k%M!<%`$r(B "" $B%@%V%k%/%)!<%H$J$7$G;XDj$r$7$?$j(B, 
$B%f!<%6$,(B, $B=q$-9~$a$J$$%U%!%$%k$r;XDj$7$?$j$9$k$H(B, 
$B%(%i!<$K$h$j%H%C%W%l%Y%k$KLa$k(B. 
@item
$BF~NO$7$?$b$N$b9~$a$F%U%!%$%k$K=PNO$7$?$$>l9g$K$O(B, @code{ctrl("echo",1)} 
$B$r<B9T$7$?8e$G%U%!%$%k=PNO$K@ZBX$($l$PNI$$(B. 
@item
$B7W;;;~4V$J$I(B, $BI8=`%(%i!<=PNO$K=q$-=P$5$l$k$b$N$O%U%!%$%k$K$O=q$-=P$5$l$J$$(B. 
@item
$BH!?t7A<0(B, $BL$Dj78?t(B (@code{vtype()} $B;2>H(B) $B$r4^$^$J$$?t<0$N%U%!%$%k$X$NFI$_=q$-$O(B, 
@code{bload()}, @code{bsave()} $B$r;H$&$N$,(B, $B;~4V(B, $B6u4V$H$b$K8zN($,$h$$(B. 
@item
Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
\E
\BEG
@item
Standard output stream of @b{Asir} is redirected to the specified file.
While @b{Asir} is writing its outputs onto a file, no outputs, except for
keyboard inputs and some of error messages, are written onto the standard
output. (You cannot see the result on the display.)
@item
To direct the @b{Asir} outputs to the standard output, issue the command
without argument, i.e., @code{output()}.
@item
If the specified file already exists, new outputs will be added to the
tail of the file. If not, a file is newly created and the outputs
will be written onto the file.
@item
When file name is specified without double quotes (@code{""}), or
when protected file is specified, an error occurs and the system returns
to the top level.
@item
If you want to write inputs from the key board onto the file as well
as @b{Asir} outputs, put command @code{ctrl("echo",1)}, and then
redirect the standard output to your desired file.
@item
Contents which are written onto the standard error output, CPU time etc.,
are not written onto the file.
@item
Reading and writing algebraic expressions which contain neither
functional forms nor unknown coefficients (@code{vtype()} References)
are performed more efficiently, with respect to both time and space,
by @code{bload()} and  @code{bsave()}.
@item
On Windows one has to use @samp{/} as the separator of directory names.
\E
@end itemize

@example
[83] output("afo");
fctr(x^2-y^2);
print("afo");
output();
1
[87] quit;
% cat afo
1
[84] [[1,1],[x+y,1],[x-y,1]]
[85] afo
0
[86]
@end example

@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{ctrl}, @fref{bsave bload}.
@end table

\JP @node bsave bload,,, $BF~=PNO(B
\EG @node bsave bload,,, Inputs and Outputs
@subsection @code{bsave}, @code{bload}
@findex bsave
@findex bload

@table @t
@item bsave(@var{obj},"@var{filename}")
\JP :: @var{filename} $B$K(B @var{obj} $B$r%P%$%J%j7A<0$G=q$-9~$`(B. 
\EG :: This function writes @var{obj} onto @var{filename} in binary form.
@item bload("@var{filename}")
\JP :: @var{filename} $B$+$i?t<0$r%P%$%J%j7A<0$GFI$_9~$`(B. 
\EG :: This function reads an expression from @var{filename} in binary form.
@end table

@table @var
@item return
\JP @code{bsave()} : 1, @code{bload()} : $BFI$_9~$s$@?t<0(B
\EG @code{bsave()} : 1, @code{bload()} : the expression read
@item obj
\JP $BH!?t7A<0(B, $BL$Dj78?t$r4^$^$J$$G$0U$N?t<0(B
\BEG
arbitrary expression which does not contain neither function forms
nor unknown coefficients.
\E
@item filename
\JP $B%U%!%$%kL>(B
\EG filename
@end table

@itemize @bullet
\BJP
@item
@code{bsave()} $B$OFbIt7A<0$r$[$\$=$N$^$^%P%$%J%j7A<0$G%U%!%$%k$K=q$-9~$`(B. 
@code{bload()} $B$O(B, @code{bsave()} $B$G=q$-9~$s$@?t<0$rFI$_9~$s$GFbIt7A<0(B
$B$KJQ49$9$k(B. $B8=:_$N%$%s%W%j%a%s%F!<%7%g%s$N@)8B$K$h$j(B, $BH!?t7A<0(B, $BL$Dj78?t(B 
(@code{vtype()} $B;2>H(B) $B$r4^$^$J$$%j%9%H(B, $BG[Ns$J$I$r4^$`G$0U$N?t<0$r%U%!(B
$B%$%k$KJ]B8$9$k$3$H$,$G$-$k(B.
@item
@code{output()} $B$J$I$GJ]B8$7$?>l9g(B, $BFI$_9~$_;~$K%Q!<%6$,5/F0$5$l$k$,(B, 
@code{bsave()} $B$GJ]B8$7$?$b$N$r(B @code{bload()} $B$GFI$`>l9g(B, $BD>@\(B
$BFbIt7A<0$,9=@.$G$-$k$?$a(B, $B;~4VE*(B, $B6u4VE*$K8zN($,$h$$(B. 
@item
$BB?9`<0$N>l9g(B, $B=q$-9~$_;~$HFI$_9~$_;~$GJQ?t=g=x$,0[$J$k>l9g$,$"$k$,(B, 
$B$=$N>l9g$K$O(B, $B<+F0E*$K8=:_$NJQ?t=g=x$K$*$1$kFbIt7A<0$KJQ49$5$l$k(B. 
@item
Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
\E
\BEG
@item
Function @code{bsave()} writes an object onto a file in its internal
form (not exact internal form but very similar).
Function @code{bload()} read the expression from files
which is written by @code{bsave()}.
Current implementation support arbitrary expressions, including
lists, arrays (i.e., vectors and matrices), except for function forms
and unknown coefficients (@code{vtype()} References.)
@item
The parser is activated to retrieve expressions written by
@code{output()} , whereas internal forms are directly reconstructed
by @code{bload()} from the @code{bsave()}'ed object in the file.
The latter is much more efficient with respect to both time and space.
@item
It may happen that the variable ordering at reading is changed from
that at writing.  In such a case, the variable ordering in the internal
expression is automatically rearranged according to the current
variable ordering.
@item
On Windows one has to use @samp{/} as the separator of directory names.
\E
@end itemize

@example
[0] A=(x+y+z+u+v+w)^20$
[1] bsave(A,"afo");
1
[2] B = bload("afo")$
[3] A == B;
1
[4] X=(x+y)^2; 
x^2+2*y*x+y^2
[5] bsave(X,"afo")$
[6] quit;
% asir
[0] ord([y,x])$    
[1] bload("afo");
y^2+2*x*y+x^2
@end example

@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{output}.
@end table

\JP @node bload27,,, $BF~=PNO(B
\EG @node bload27,,, Inputs and Outputs
@subsection @code{bload27}
@findex bload27

@table @t
@item bload27("@var{filename}") 
\JP :: $B5lHG$G:n$i$l$?(B bsave file $B$NFI$_9~$_(B
\EG :: Reads bsaved file created by older version of @b{Asir}.
@end table

@table @var
@item return
\JP $BFI$_9~$s$@?t<0(B
\EG expression read
@item filename
\JP $B%U%!%$%kL>(B
\EG filename
@end table

@itemize @bullet
\BJP
@item
$B5lHG$G$O(B, $BB?G\D9@0?t$,(B, 1 $B%o!<%I(B 27 bit $B$GI=8=$5$l$F$$$?$,(B, $B?7HG$G$O(B 1 $B%o!<%I(B 32 bit
$B$KJQ99$5$l$?(B. $B$3$N$?$a(B, $B5lHG$G(B @code{bsave} $B$5$l$?%P%$%J%j%U%!%$%k$O$=$N$^$^$G$O(B
$BFI$_9~$a$J$$(B. $B$3$N$h$&$J%U%!%$%k$rFI$_9~$`$?$a$K(B @code{bload27} $B$rMQ$$$k(B. 
@item
Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
\E
\BEG
@item
In older versions an arbitrary precision integer is represented as
an array of 27bit integers. In the current version it is represented
as an array of 32bit integers. By this incompatibility the bsaved
file created by older versions cannot be read in the current version
by @code{bload}.
@code{bload27} is used to read such files.
@item
On Windows one has to use @samp{/} as the separator of directory names.
\E
@end itemize

@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{bsave bload}.
@end table

\JP @node print,,, $BF~=PNO(B
\EG @node print,,, Inputs and Outputs
@subsection @code{print}
@findex print

@table @t
@item print(@var{obj} [,@var{nl}])
\JP :: @var{obj} $B$rI=<($9$k(B. 
\EG :: Displays (or outputs) @var{obj}.
@end table

@table @var
@item return
0
@item obj
\JP $BG$0U(B
\EG arbitrary
@item nl
\JP $B%U%i%0(B ($BG$0U(B)
\EG flag (arbitrary)
@end table

@itemize @bullet
\BJP
@item
@var{obj} $B$rI>2A$7$FI=<($9$k(B. 
@item
$BBh(B 2 $B0z?t$,$J$$$+(B, $B$^$?$O(B 0, 2 $B0J30$N>l9g(B, $B2~9T$9$k(B. 
$BBh(B 2 $B0z?t$,(B 0 $B$N>l9g(B, $B2~9T$;$:(B, $B=PNO$O%P%C%U%!$K=q$-9~$^$l(B, 
$B%P%C%U%!$O%U%i%C%7%e$5$l$J$$(B. 
$BBh(B 2 $B0z?t$,(B 2 $B$N>l9g(B, $B2~9T$7$J$$$,%P%C%U%!$O%U%i%C%7%e$5$l$k(B. 
@item
$B$3$NH!?t$NLa$jCM$O(B 0 $B$G$"$k$+$i(B, @code{print();}
$B$G<B9T$9$k$H(B, $B=PNO$N8e$K(B 0 $B$,JV$5$l$k(B.
@code{print()$} $B$H$9$l$P(B, $B:G8e$N(B 0 $B$O=PNO$5$l$J$$(B.
@item
$BJ#?t$N(B @var{obj} $B$rF1;~$K=PNO$7$?$$;~$O(B @var{obj} $B$r%j%9%H$K$9$k$H$h$$(B.
\E
\BEG
@item 
Displays (or outputs) @var{obj}.
@item 
It normally adds linefeed code to cause the cursor moving to the next
line.  If 0 or 2 is given as the second argument, it does not add a linefeed.
If the second argument is 0, the output is simply written in the buffer.
If the second argument is 2, the output is flushed.
@item 
The return value of this function is 0.
If command @code{print(@var{rat});} is performed at the top level,
first the value of @var{rat} will be printed,
followed by a linefeed, followed by a 0 which is the value of the
function and followed by a linefeed and the next prompt.
(If the command is terminated by a `$', e.g., @code{print(@var{rat})$},
The last 0 will not be printed. )
@item 
Formatted outputs are not currently supported.
If one wishes to output multiple objects by a single @code{print()} command,
use list like @code{[@var{obj1},...]}, which is not so beautiful, but
convenient to minimize programming efforts.
\E
@end itemize

@example
[8] def cat(L) @{ while ( L != [] ) @{ print(car(L),0); L = cdr(L);@}
print(""); @}
[9] cat([xyz,123,"gahaha"])$
xyz123gahaha
@end example

\JP @node access,,, $BF~=PNO(B
\EG @node access,,, Inputs and Outputs
@subsection @code{access}
@findex access

@table @t
@item access(@var{file})
\JP :: @var{file} $B$NB8:_$r%F%9%H$9$k(B. 
\EG :: testing an existence of @var{file}.
@end table

@table @var
@item return
(1|0)
@item file
\JP $B%U%!%$%kL>(B
\EG filename
@end table

@itemize @bullet
\BJP
@item
@var{file} $B$,B8:_$9$l$P(B 1, $BB8:_$7$J$1$l$P(B 0 $B$rJV$9(B. 
\E
@end itemize

\JP @node remove_file,,, $BF~=PNO(B
\EG @node remove_file,,, Inputs and Outputs
@subsection @code{remove_file}
@findex remove_file

@table @t
@item remove_file(@var{file})
\JP :: @var{file} $B$r>C5n$9$k(B. 
\EG :: Delete an file @var{file}.
@end table

@table @var
@item return
1
@item file
\JP $B%U%!%$%kL>(B
\EG filename
@end table

\JP @node open_file close_file get_line get_byte put_byte purge_stdin,,, $BF~=PNO(B
\EG @node open_file close_file get_line get_byte put_byte purge_stdin,,, Inputs and Outputs
@subsection @code{open_file}, @code{close_file}, @code{get_line}, @code{get_byte}, @code{put_byte}, @code{purge_stdin}
@findex open_file
@findex close_file
@findex get_line
@findex get_byte
@findex put_byte
@findex purge_stdin

@table @t
@item open_file("@var{filename}"[,"@var{mode}"])
\JP :: @var{filename} $B$r%*!<%W%s$9$k(B. 
\EG :: Opens @var{filename} for reading.
@item close_file(@var{num})
\JP :: $B<1JL;R(B @var{num} $B$N%U%!%$%k$r%/%m!<%:$9$k(B. 
\EG :: Closes the file indicated by a descriptor @var{num}.
@item get_line([@var{num}])
\JP :: $B<1JL;R(B @var{num} $B$N%U%!%$%k$+$i(B 1 $B9TFI$`(B. 
\EG :: Reads a line from the file indicated by a descriptor @var{num}.
@item get_byte(@var{num})
\JP :: $B<1JL;R(B @var{num} $B$N%U%!%$%k$+$i(B 1 $B%P%$%HFI$`(B. 
\EG :: Reads a byte from the file indicated by a descriptor @var{num}.
@item put_byte(@var{num},@var{c})
\JP :: $B<1JL;R(B @var{num} $B$N%U%!%$%k$K(B 1 $B%P%$%H(B @var{c} $B$r=q$/(B.
\EG :: Writes a byte @var{c} to the file indicated by a descriptor @var{num}.
@item purge_stdin()
\JP :: $BI8=`F~NO$N%P%C%U%!$r%/%j%"$9$k(B.
\EG :: Clears the buffer for the standard input.
@end table

@table @var
@item return
\JP @code{open_file()} : $B@0?t(B ($B<1JL;R(B); @code{close_file()} : 1; @code{get_line()} : $BJ8;zNs(B; @code{get_byte()}, @code{put_byte()} : $B@0?t(B
\EG @code{open_file()} : integer (fild id); @code{close_file()} : 1; @code{get_line()} : string; @code{get_byte()}, @code{put_byte()} : integer
@item filename
\JP $B%U%!%$%kL>(B ($B%Q%9L>(B)
\EG file (path) name
@item mode
\JP $BJ8;zNs(B
\EG string
@item num
\JP $BHsIi@0?t(B ($B%U%!%$%k<1JL;R(B)
\EG non-negative integer (file descriptor)
@end table

@itemize @bullet
\BJP
@item @code{open_file()} $B$O%U%!%$%k$r%*!<%W%s$9$k(B. @var{mode} $B;XDj$,(B
$B$J$$>l9gFI$_=P$7MQ(B, @var{mode} $B;XDj$,$"$k>l9g$K$O(B, C $B$NI8=`F~=PNO(B
$B4X?t(B @code{fopen()} $B$KBP$9$k%b!<%I;XDj$H$_$J$9(B. $B$?$H$($P?75,=q$-9~$_(B
$BMQ$N>l9g(B @code{"w"}, $BKvHxDI2C$N>l9g(B @code{"a"} $B$J$I(B.
$B@.8y$7$?>l9g(B, $B%U%!%$%k<1JL;R$H$7$FHsIi@0?t$rJV$9(B. $B<:GT$N>l9g%(%i!<$H$J$k(B. 
$BITMW$K$J$C$?%U%!%$%k$O(B @code{close_file()} $B$G%/%m!<%:$9$k(B. 
$BFCJL$J%U%!%$%kL>(B unix://stdin, unix://stdout, unix://stderr $B$rM?$($k$H(B
$B$=$l$>$lI8=`F~NO(B, $BI8=`=PNO(B, $BI8=`%(%i!<=PNO$r%*!<%W%s$9$k(B.
$B$3$N>l9g%b!<%I;XDj$OL5;k$5$l$k(B.
@item @code{get_line()} $B$O8=:_%*!<%W%s$7$F$$$k%U%!%$%k$+$i(B 1 $B9TFI$_(B, 
$BJ8;zNs$H$7$FJV$9(B. $B0z?t$,$J$$>l9g(B, $BI8=`F~NO$+$i(B 1 $B9TFI$`(B.
@item @code{get_byte()} $B$O8=:_%*!<%W%s$7$F$$$k%U%!%$%k$+$i(B 1 $B%P%$%HFI$_(B
$B@0?t$H$7$FJV$9(B.
@item @code{put_byte()} $B$O8=:_%*!<%W%s$7$F$$$k%U%!%$%k$K(B 1 $B%P%$%H=q$-(B, 
$B$=$N%P%$%H$r@0?t$H$7$FJV$9(B.
@item $B%U%!%$%k$N=*$j$^$GFI$s$@8e$K(B @code{get_line()} $B$,8F$P$l$?>l9g(B, 
$B@0?t$N(B 0 $B$rJV$9(B. 
@item $BFI$_=P$7$?J8;zNs$O(B, $BI,MW$,$"$l$P(B @code{sub_str()} $B$J$I$NJ8;zNs=hM}(B
$B4X?t$G2C9)$7$?$N$A(B @code{eval_str()} $B$K$h$jFbIt7A<0$KJQ49$G$-$k(B. 
@item @code{purge_stdin()} $B$O(B, $BI8=`F~NO%P%C%U%!$r6u$K$9$k(B. 
$B4X?tFb$G(B @code{get_line()} $B$K$h$jI8=`F~NO$+$iJ8;zNs$r<u$1<h$k>l9g(B,
$B4{$K%P%C%U%!Fb$KB8:_$9$kJ8;zNs$K$h$k8mF0:n$rKI$0$?$a$K$"$i$+$8$a(B
$B8F$S=P$9(B.
\E
\BEG
@item @code{open_file()} opens a file.
If @var{mode} is not specified, a file is opened for reading.
If @var{mode} is specified, it is used as the mode specification for
C standard I/O function @code{fopen()}. For example @code{"w"} requests
that the file is truncated to zero length or created for writing.
@code{"a"} requests that the file is opened for writing or created 
if it does not exist.
The stream pointer is set at the end of the file.
If successful, it returns a non-negative integer as the file descriptor.
Otherwise the system error function is called.
Unnecessary files should be closed by @code{close_file()}.
If the special file name unix://stdin or unix://stdout or unix://stderr
is given, it returns the file descriptor for the standard input or
the standard output or the standard error stream respectively.
The mode argument is ignored in this case.
@item @code{get_line()} reads a line from an opened file and returns the
line as a string. If no argument is supplied, it reads a line from the
standard input.
@item @code{get_byte()} reads a byte from an opened file and returns the
it as an integer.
@item @code{put_byte()} writes a byte from an opened file and returns the
the byte as an integer.
@item A @code{get_line()} call after reading the end of file returns
an integer 0.
@item Strings can be converted into internal forms with string manipulation
functions such as @code{sub_str()}, @code{eval_str()}.
@item @code{purge_stdin()} clears the buffer for the standard input.
When a function receives a character string from @code{get_line()},
this functions should be called in advance in order to avoid 
an incorrect behavior which is caused by the characters already
exists in the buffer.
\E
@end itemize

@example
[185] Id = open_file("test");
0
[186] get_line(Id);
12345

[187] get_line(Id);
67890

[188] get_line(Id);
0
[189] type(@@@@);
0
[190] close_file(Id);
1
[191] open_file("test");
1
[192] get_line(1);   
12345

[193] get_byte(1);
54                   /* the ASCII code of '6' */
[194] get_line(1);
7890                 /* the rest of the last line */
[195] def test() @{ return get_line(); @}
[196] def test1() @{ purge_stdin(); return get_line(); @}
[197] test();
                     /* a remaining newline character has been read */
                     /* returns immediately */
[198] test1();
123;                 /* input from a keyboard */
123;                 /* returned value */

[199] 

@end example

@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{eval_str}, @fref{str_len str_chr sub_str}.
@end table