=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/builtin/io.texi,v retrieving revision 1.8 retrieving revision 1.15 diff -u -p -r1.8 -r1.15 --- OpenXM/src/asir-doc/parts/builtin/io.texi 2002/07/15 01:58:24 1.8 +++ OpenXM/src/asir-doc/parts/builtin/io.texi 2003/12/20 13:38:04 1.15 @@ -1,4 +1,4 @@ -@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/io.texi,v 1.7 2001/04/23 05:45:37 noro Exp $ +@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/io.texi,v 1.14 2003/12/18 10:26:20 ohara Exp $ \BJP @node 入出力,,, 組み込み函数 @section 入出力 @@ -16,6 +16,8 @@ * bsave bload:: * bload27:: * print:: +* access:: +* remove_file:: * open_file close_file get_line get_byte put_byte purge_stdin:: @end menu @@ -96,7 +98,7 @@ line of the input file is strongly recommended. @itemize @bullet \BJP @item -実際のプログラムの書き方は, @xref{ユーザ言語 Asir}. +実際のプログラムの書き方は, @pxref{ユーザ言語 Asir}. テキストファイルを読み込む場合, @code{cpp} を通すので, C のプログラム同様 @code{#include}, @code{#define} を使うことができる. @item @@ -121,7 +123,7 @@ Windows 版もディレクトリのセパレータとして @samp \E \BEG @item -@xref{User language Asir} for practical programming. +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. @@ -140,7 +142,7 @@ On Windows, @code{get_rootdir()/lib} is searched if 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 (@pxref{Interruption}), +(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. @@ -521,17 +523,63 @@ 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 +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(""); @} +[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,,, 入出力 +\EG @node access,,, Inputs and Outputs +@subsection @code{access} +@findex access + +@table @t +@item access(@var{file}) +\JP :: @var{file} の存在をテストする. +\EG :: testing an existence of @var{file}. +@end table + +@table @var +@item return +(1|0) +@item file +\JP ファイル名 +\EG filename +@end table + +@itemize @bullet +\BJP +@item +@var{file} が存在すれば 1, 存在しなければ 0 を返す. +\E +@end itemize + +\JP @node remove_file,,, 入出力 +\EG @node remove_file,,, Inputs and Outputs +@subsection @code{remove_file} +@findex remove_file + +@table @t +@item remove_file(@var{file}) +\JP :: @var{file} を消去する. +\EG :: Delete an file @var{file}. +@end table + +@table @var +@item return +1 +@item file +\JP ファイル名 +\EG filename +@end table + \JP @node open_file close_file get_line get_byte put_byte purge_stdin,,, 入出力 \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} @@ -559,7 +607,6 @@ xyz123gahaha \JP :: 識別子 @var{num} のファイルに 1 バイト @var{c} を書く. \EG :: Writes a byte @var{c} to the file indicated by a descriptor @var{num}. @item purge_stdin() -@item purge_stdin() \JP :: 標準入力のバッファをクリアする. \EG :: Clears the buffer for the standard input. @end table @@ -587,6 +634,9 @@ xyz123gahaha 用の場合 @code{"w"}, 末尾追加の場合 @code{"a"} など. 成功した場合, ファイル識別子として非負整数を返す. 失敗の場合エラーとなる. 不要になったファイルは @code{close_file()} でクローズする. +特別なファイル名 unix://stdin, unix://stdout, unix://stderr を与えると +それぞれ標準入力, 標準出力, 標準エラー出力をオープンする. +この場合モード指定は無視される. @item @code{get_line()} は現在オープンしているファイルから 1 行読み, 文字列として返す. 引数がない場合, 標準入力から 1 行読む. @item @code{get_byte()} は現在オープンしているファイルから 1 バイト読み @@ -614,6 +664,10 @@ 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.