=================================================================== RCS file: /home/cvs/OpenXM/src/asir-doc/parts/builtin/io.texi,v retrieving revision 1.7 retrieving revision 1.13 diff -u -p -r1.7 -r1.13 --- OpenXM/src/asir-doc/parts/builtin/io.texi 2001/04/23 05:45:37 1.7 +++ OpenXM/src/asir-doc/parts/builtin/io.texi 2003/11/27 15:56:08 1.13 @@ -1,4 +1,4 @@ -@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/io.texi,v 1.6 2001/03/12 05:01:18 noro Exp $ +@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/io.texi,v 1.12 2003/11/01 23:58:44 takayama Exp $ \BJP @node 入出力,,, 組み込み函数 @section 入出力 @@ -16,6 +16,7 @@ * bsave bload:: * bload27:: * print:: +* access:: * open_file close_file get_line get_byte put_byte purge_stdin:: @end menu @@ -96,7 +97,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 +122,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 +141,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 +522,44 @@ 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 aceess,,, 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 +0 or 1 +@item file +\JP ファイル名 +\EG filename +@end table + +@itemize @bullet +\BJP +@item +@var{file} が存在すれば 1, 存在しなければ 0 を返す. +\E +@end itemize + \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} @@ -555,9 +583,9 @@ xyz123gahaha @item get_byte(@var{num}) \JP :: 識別子 @var{num} のファイルから 1 バイト読む. \EG :: Reads a byte from the file indicated by a descriptor @var{num}. -@item put_byte(@var{num}) -\JP :: 識別子 @var{num} のファイルに 1 バイト書く. -\EG :: Writes a byte to the file indicated by a descriptor @var{num}. +@item put_byte(@var{num},@var{c}) +\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 :: 標準入力のバッファをクリアする. @@ -587,6 +615,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 +645,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.