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

Annotation of OpenXM/src/asir-doc/parts/builtin/io.texi, Revision 1.2

1.2     ! noro        1: @comment $OpenXM$
        !             2: \BJP
1.1       noro        3: @node $BF~=PNO(B,,, $BAH$_9~$_H!?t(B
                      4: @section $BF~=PNO(B
1.2     ! noro        5: \E
        !             6: \BEG
        !             7: @node Inputs and Outputs,,, Built-in Function
        !             8: @section Inputs and Outputs
        !             9: \E
1.1       noro       10:
                     11: @menu
                     12: * end quit::
                     13: * load::
                     14: * which::
                     15: * output::
                     16: * bsave bload::
                     17: * bload27::
                     18: * print::
                     19: @end menu
                     20:
1.2     ! noro       21: \JP @node end quit,,, $BF~=PNO(B
        !            22: \EG @node end quit,,, Inputs and Outputs
1.1       noro       23: @subsection @code{end}, @code{quit}
                     24: @findex end
                     25: @findex quit
                     26:
                     27: @table @t
                     28: @item end, quit
1.2     ! noro       29: \BJP
1.1       noro       30: :: $B8=:_FI$_9~$_Cf$N%U%!%$%k$rJD$8$k(B.
                     31: $B%H%C%W%l%Y%k$K$*$$$F$O%;%C%7%g%s$r=*N;$9$k$3$H$K$J$k(B.
1.2     ! noro       32: \E
        !            33: \BEG
        !            34: :: Close the currently reading file.
        !            35: At the top level, terminate the @b{Asir} session.
        !            36: \E
1.1       noro       37: @end table
                     38:
                     39: @itemize @bullet
1.2     ! noro       40: \BJP
1.1       noro       41: @item
                     42: @code{end}, @code{quit} $B$H$b$KL50z?t$NH!?t$G$"$k$,(B, @samp{()} $B$J$7$G(B
                     43: $B8F$S=P$9$3$H$,$G$-$k(B. $B$$$:$l$b8=:_FI$_9~$_Cf$N%U%!%$%k$rJD$8$k(B.
                     44: $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.
                     45: @item
                     46: $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
                     47: $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,
                     48: $B%U%!%$%k$N=*C<$K$O(B @code{end$} $B$r=q$/$N$,K>$^$7$$(B.
1.2     ! noro       49: \E
        !            50: \BEG
        !            51: @item
        !            52: These two functions take no arguments.  These functions can be called
        !            53: without a @samp{()}.  Either function close the current input file.
        !            54: This means the termination of the @b{Asir} session at the top level.
        !            55: @item
        !            56: An input file will be automatically closed if it is read to its end.
        !            57: However, if no @code{end$} is written at the last of the input file,
        !            58: the control will be returned to the top level and @b{Asir} will be
        !            59: waiting for an input without any prompting.
        !            60: Thus, in order to avoid confusion, putting a @code{end$} at the last
        !            61: line of the input file is strongly recommended.
        !            62: \E
1.1       noro       63: @end itemize
                     64:
                     65: @example
                     66: [6] quit;
                     67: %
                     68: @end example
                     69:
                     70: @table @t
1.2     ! noro       71: \JP @item $B;2>H(B
        !            72: \EG @item References
1.1       noro       73: @fref{load}.
                     74: @end table
                     75:
1.2     ! noro       76: \JP @node load,,, $BF~=PNO(B
        !            77: \EG @node load,,, Inputs and Outputs
1.1       noro       78: @subsection @code{load}
                     79: @findex load
                     80:
                     81: @table @t
                     82: @item load("@var{filename}")
1.2     ! noro       83: \JP :: @var{filename} $B$rFI$_9~$`(B.
        !            84: \EG :: Read a program file @var{filename}.
1.1       noro       85: @end table
                     86:
                     87: @table @var
                     88: @item return
                     89: (1|0)
                     90: @item filename
1.2     ! noro       91: \JP $B%U%!%$%kL>(B ($B%Q%9L>(B)
        !            92: \EG file (path) name
1.1       noro       93: @end table
                     94:
                     95: @itemize @bullet
1.2     ! noro       96: \BJP
1.1       noro       97: @item
                     98: $B<B:]$N%W%m%0%i%`$N=q$-J}$O(B, @xref{$B%f!<%68@8l(B Asir}.
                     99:  $B%F%-%9%H%U%!%$%k$rFI$_9~$`>l9g(B, @code{cpp}
                    100: $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.
                    101: @item
                    102: $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.
                    103: @item
                    104: $B%U%!%$%kL>$,(B @samp{/} $B$G;O$^$k>l9g$O@dBP%Q%9(B, @samp{.} $B$G;O$^$k>l9g$O(B
                    105: $B%+%l%s%H%G%#%l%/%H%j$+$i$NAjBP%Q%9$H8+$J$5$l$k(B. $B$=$l0J30$N>l9g(B,
                    106: $B4D6-JQ?t(B @code{ASIRLOADPATH} $B$K@_Dj$5$l$F$$$k%G%#%l%/%H%j$r:8$+$i=g$K(B
                    107: $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
                    108: $B%G%#%l%/%H%j(B ($B$"$k$$$O4D6-JQ?t(B @code{ASIR_LIBDIR} $B$K@_Dj$5$l$F$$$k(B
                    109: $B%G%#%l%/%H%j(B) $B$b%5!<%A$9$k(B.
1.2     ! noro      110: Windows $BHG$N>l9g(B, @code{ASIR_LIBDIR} $B$,@_Dj$5$l$F$$$J$$>l9g$K$O(B,
        !           111: @code{get_rootdir()/lib} $B$r%5!<%A$9$k(B.
1.1       noro      112: @item
                    113: $BFI$_9~$`%U%!%$%k$N:G8e$K(B, @code{end$} $B$,$J$$$H(B @code{load()}
                    114: $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,
                    115: $B:.Mp$r>7$/$*$=$l$,$"$k$N$G%U%!%$%k$N:G8e$K(B @code{end$} $B$r=q$$$F$*$/$3$H(B
                    116: $B$,K>$^$7$$(B. (@code{end;} $B$G$b$h$$$,(B, @code{end} $B$,JV$9CM(B 0 $B$,I=<($5$l$k(B
                    117: $B$?$a(B, @code{end$} $B$r$*4+$a$9$k(B. )
                    118: @item
                    119: Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
1.2     ! noro      120: \E
        !           121: \BEG
        !           122: @item
        !           123: @xref{User language Asir} for practical programming.
        !           124: Since text files are read through @code{cpp},
        !           125: the user can use, as in C programs, @code{#include} and @code{#define}
        !           126: in @b{Asir} program source codes.
        !           127: @item
        !           128: It returns 1 if the designated file exists, 0 otherwise.
        !           129: @item
        !           130: If the @var{filename} begins with @samp{/}, it is understood as an
        !           131: absolute path name; with  @samp{.}, relative path name from current
        !           132: directory; otherwise, the file is searched first from directories
        !           133: assigned to an environmental variable @code{ASIRLOADPATH}, then
        !           134: if the search ends up in failure, the standard library directory
        !           135: (or directories assigned to @code{ASIR_LIBDIR}) shall be searched.
        !           136: On Windows, @code{get_rootdir()/lib} is searched if
        !           137: @code{ASIR_LIBDIR} is not set.
        !           138: @item
        !           139: We recommend to write an @code{end} command at the last line of
        !           140: your program.  If not, @b{Asir} will not give you a prompt after it
        !           141: will have executed @code{load} command.
        !           142: (Escape with an interrupt character (@pxref{Interruption}),
        !           143: if you have lost yourself.)
        !           144: Even in such a situation,
        !           145: @b{Asir} itself is still ready to read keyboard inputs as usual.
        !           146: It is, however, embarrassing and may cause other errors.
        !           147: Therefore, to put an @code{end$} at the last line is desirable.
        !           148: (Command @code{end;} will work as well,
        !           149: but it also returns and displays verbose.)
        !           150: @item
        !           151: On Windows one has to use @samp{/} as the separator of directory names.
        !           152: \E
1.1       noro      153: @end itemize
                    154:
                    155: @table @t
1.2     ! noro      156: \JP @item $B;2>H(B
        !           157: \EG @item References
1.1       noro      158: @fref{end quit}, @fref{which}, @fref{get_rootdir}.
                    159: @end table
                    160:
1.2     ! noro      161: \JP @node which,,, $BF~=PNO(B
        !           162: \EG @node which,,, Inputs and Outputs
1.1       noro      163: @subsection @code{which}
                    164: @findex which
                    165:
                    166: @table @t
                    167: @item which("@var{filename}")
1.2     ! noro      168: \JP :: $B0z?t(B @var{filename} $B$KBP$7(B, @code{load()} $B$,FI$_9~$`%Q%9L>$rJV$9(B.
        !           169: \EG :: This returns the path name for the @var{filename} which @code{load()} will read.
1.1       noro      170: @end table
                    171:
                    172: @table @var
                    173: @item return
1.2     ! noro      174: \JP $B%Q%9L>(B
        !           175: \EG path name
1.1       noro      176: @item filename
1.2     ! noro      177: \JP $B%U%!%$%kL>(B ($B%Q%9L>(B) $B$^$?$O(B 0
        !           178: \EG filename (path name) or 0
1.1       noro      179: @end table
                    180:
                    181: @itemize @bullet
1.2     ! noro      182: \BJP
1.1       noro      183: @item
                    184: @code{load()} $B$,%U%!%$%k$r%5!<%A$9$k<j=g$K=>$C$F%5!<%A$7(B,
                    185: $B%U%!%$%k$,B8:_$9$k>l9g$K$O%Q%9L>$rJ8;zNs$H$7$F(B, $BB8:_$7$J$$>l9g(B
                    186: $B$K$O(B 0 $B$rJV$9(B.
                    187: @item
                    188: $B%5!<%A$N<j=g$K$D$$$F$O(B @code{load()} $B$r;2>H(B.
                    189: @item
                    190: Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
1.2     ! noro      191: \E
        !           192: \BEG
        !           193: @item
        !           194: This function searches directory trees according to the same procedure
        !           195: as @code{load()} will do.  Then, returns a string, the path name to the
        !           196: file if the named file exists; 0 unless otherwise.
        !           197: @item
        !           198: For details of searching procedure,
        !           199: refer to the description about @code{load()}.
        !           200: @item
        !           201: On Windows one has to use @samp{/} as the separator of directory names.
        !           202: \E
1.1       noro      203: @end itemize
                    204:
                    205: @example
                    206: [0] which("gr");
                    207: ./gb/gr
                    208: [1] which("/usr/local/lib/gr");
                    209: 0
                    210: [2] which("/usr/local/lib/asir/gr");
                    211: /usr/local/lib/asir/gr
                    212: @end example
                    213:
                    214: @table @t
1.2     ! noro      215: \JP @item $B;2>H(B
        !           216: \EG @item References
1.1       noro      217: @fref{load}.
                    218: @end table
                    219:
1.2     ! noro      220: \JP @node output,,, $BF~=PNO(B
        !           221: \EG @node output,,, Inputs and Outputs
1.1       noro      222: @subsection @code{output}
                    223: @findex output
                    224:
                    225: @table @t
                    226: @item output(["@var{filename}"])
1.2     ! noro      227: \JP :: $B0J9_$N=PNO@h$r(B @var{filename}$B$^$?$OI8=`=PNO$K@ZBX$($k(B.
        !           228: \EG :: Writes the return values and prompt onto file @var{filename}.
1.1       noro      229: @end table
                    230:
                    231: @table @var
                    232: @item return
                    233: 1
                    234: @item filename
1.2     ! noro      235: \JP $B%U%!%$%kL>(B
        !           236: \EG filename
1.1       noro      237: @end table
                    238:
                    239: @itemize @bullet
1.2     ! noro      240: \BJP
1.1       noro      241: @item
                    242: @b{Asir} $B$N=PNO$rI8=`=PNO$+$i(B, $B%U%!%$%k$X$N=PNO$K@ZBX$($k(B.
                    243: $B$J$*(B, $B%U%!%$%k=PNO$N4V$O(B, $BI8=`=PNO$K$O%-!<%\!<%I$+$i$NF~NO0J30(B,
                    244: $B=PNO$5$l$J$$(B.
                    245: @item
                    246: $BJL$N%U%!%$%k=PNO$K@ZBX$($k;~$K$O(B, $B:F$S(B @code{output("@var{filename}")}
                    247: $B$r<B9T$9$k(B.
                    248: $BKt(B, $B%U%!%$%k=PNO$r=*N;$7I8=`=PNO$KLa$j$?$$;~$K$O(B, $B0z?t$J$7$G(B
                    249: @code{output()} $B$r<B9T$9$k(B.
                    250: @item
                    251: $B;XDj$7$?%U%!%$%k(B @var{filename} $B$,B8:_$7$?;~$O(B, $B$=$N%U%!%$%k$NKvHx$K(B
                    252: $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.
                    253: @item
                    254: $B%U%!%$%k%M!<%`$r(B "" $B%@%V%k%/%)!<%H$J$7$G;XDj$r$7$?$j(B,
                    255: $B%f!<%6$,(B, $B=q$-9~$a$J$$%U%!%$%k$r;XDj$7$?$j$9$k$H(B,
                    256: $B%(%i!<$K$h$j%H%C%W%l%Y%k$KLa$k(B.
                    257: @item
                    258: $BF~NO$7$?$b$N$b9~$a$F%U%!%$%k$K=PNO$7$?$$>l9g$K$O(B, @code{ctrl("echo",1)}
                    259: $B$r<B9T$7$?8e$G%U%!%$%k=PNO$K@ZBX$($l$PNI$$(B.
                    260: @item
                    261: $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.
                    262: @item
                    263: $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,
                    264: @code{bload()}, @code{bsave()} $B$r;H$&$N$,(B, $B;~4V(B, $B6u4V$H$b$K8zN($,$h$$(B.
                    265: @item
                    266: Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
1.2     ! noro      267: \E
        !           268: \BEG
        !           269: @item
        !           270: Standard output stream of @b{Asir} is redirected to the specified file.
        !           271: While @b{Asir} is writing its outputs onto a file, no outputs, except for
        !           272: keyboard inputs and some of error messages, are written onto the standard
        !           273: output. (You cannot see the result on the display.)
        !           274: @item
        !           275: To direct the @b{Asir} outputs to the standard output, issue the command
        !           276: without argument, i.e., @code{output()}.
        !           277: @item
        !           278: If the specified file already exists, new outputs will be added to the
        !           279: tail of the file. If not, a file is newly created and the outputs
        !           280: will be written onto the file.
        !           281: @item
        !           282: When file name is specified without double quotes (@code{""}), or
        !           283: when protected file is specified, an error occurs and the system returns
        !           284: to the top level.
        !           285: @item
        !           286: If you want to write inputs from the key board onto the file as well
        !           287: as @b{Asir} outputs, put command @code{ctrl("echo",1)}, and then
        !           288: redirect the standard output to your desired file.
        !           289: @item
        !           290: Contents which are written onto the standard error output, CPU time etc.,
        !           291: are not written onto the file.
        !           292: @item
        !           293: Reading and writing algebraic expressions which contain neither
        !           294: functional forms nor unknown coefficients (@code{vtype()} References)
        !           295: are performed more efficiently, with respect to both time and space,
        !           296: by @code{bload()} and  @code{bsave()}.
        !           297: @item
        !           298: On Windows one has to use @samp{/} as the separator of directory names.
        !           299: \E
1.1       noro      300: @end itemize
                    301:
                    302: @example
                    303: [83] output("afo");
                    304: fctr(x^2-y^2);
                    305: print("afo");
                    306: output();
                    307: 1
                    308: [87] quit;
                    309: % cat afo
                    310: 1
                    311: [84] [[1,1],[x+y,1],[x-y,1]]
                    312: [85] afo
                    313: 0
                    314: [86]
                    315: @end example
                    316:
                    317: @table @t
1.2     ! noro      318: \JP @item $B;2>H(B
        !           319: \EG @item References
1.1       noro      320: @fref{ctrl}, @fref{bsave bload}.
                    321: @end table
                    322:
1.2     ! noro      323: \JP @node bsave bload,,, $BF~=PNO(B
        !           324: \EG @node bsave bload,,, Inputs and Outputs
1.1       noro      325: @subsection @code{bsave}, @code{bload}
                    326: @findex bsave
                    327: @findex bload
                    328:
                    329: @table @t
                    330: @item bsave(@var{obj},"@var{filename}")
1.2     ! noro      331: \JP :: @var{filename} $B$K(B @var{obj} $B$r%P%$%J%j7A<0$G=q$-9~$`(B.
        !           332: \EG :: This function writes @var{obj} onto @var{filename} in binary form.
1.1       noro      333: @item bsave("@var{filename}")
1.2     ! noro      334: \JP :: @var{filename} $B$+$i?t<0$r%P%$%J%j7A<0$GFI$_9~$`(B.
        !           335: \EG :: This function reads an expression from @var{filename} in binary form.
1.1       noro      336: @end table
                    337:
                    338: @table @var
                    339: @item return
1.2     ! noro      340: \JP @code{bsave()} : 1, @code{bload()} : $BFI$_9~$s$@?t<0(B
        !           341: \EG @code{bsave()} : 1, @code{bload()} : the expression read
1.1       noro      342: @item obj
1.2     ! noro      343: \JP $BH!?t7A<0(B, $BL$Dj78?t$r4^$^$J$$G$0U$N?t<0(B
        !           344: \BEG
        !           345: arbitrary expression which does not contain neither function forms
        !           346: nor unknown coefficients.
        !           347: \E
1.1       noro      348: @item filename
1.2     ! noro      349: \JP $B%U%!%$%kL>(B
        !           350: \EG filename
1.1       noro      351: @end table
                    352:
                    353: @itemize @bullet
1.2     ! noro      354: \BJP
1.1       noro      355: @item
                    356: @code{bsave()} $B$OFbIt7A<0$r$[$\$=$N$^$^%P%$%J%j7A<0$G%U%!%$%k$K=q$-9~$`(B.
                    357: @code{bload()} $B$O(B, @code{bsave()} $B$G=q$-9~$s$@?t<0$rFI$_9~$s$GFbIt7A<0(B
                    358: $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
                    359: (@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
                    360: $B%$%k$KJ]B8$9$k$3$H$,$G$-$k(B.
                    361: @item
                    362: @code{output()} $B$J$I$GJ]B8$7$?>l9g(B, $BFI$_9~$_;~$K%Q!<%6$,5/F0$5$l$k$,(B,
                    363: @code{bsave()} $B$GJ]B8$7$?$b$N$r(B @code{bload()} $B$GFI$`>l9g(B, $BD>@\(B
                    364: $BFbIt7A<0$,9=@.$G$-$k$?$a(B, $B;~4VE*(B, $B6u4VE*$K8zN($,$h$$(B.
                    365: @item
                    366: $BB?9`<0$N>l9g(B, $B=q$-9~$_;~$HFI$_9~$_;~$GJQ?t=g=x$,0[$J$k>l9g$,$"$k$,(B,
                    367: $B$=$N>l9g$K$O(B, $B<+F0E*$K8=:_$NJQ?t=g=x$K$*$1$kFbIt7A<0$KJQ49$5$l$k(B.
                    368: @item
                    369: Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
1.2     ! noro      370: \E
        !           371: \BEG
        !           372: @item
        !           373: Function @code{bsave()} writes an object onto a file in its internal
        !           374: form (not exact internal form but very similar).
        !           375: Function @code{bload()} read the expression from files
        !           376: which is written by @code{bsave()}.
        !           377: Current implementation support arbitrary expressions, including
        !           378: lists, arrays (i.e., vectors and matrices), except for function forms
        !           379: and unknown coefficients (@code{vtype()} References.)
        !           380: @item
        !           381: The parser is activated to retrieve expressions written by
        !           382: @code{output()} , whereas internal forms are directly reconstructed
        !           383: by @code{bload()} from the @code{bsave()}'ed object in the file.
        !           384: The latter is much more efficient with respect to both time and space.
        !           385: @item
        !           386: It may happen that the variable ordering at reading is changed from
        !           387: that at writing.  In such a case, the variable ordering in the internal
        !           388: expression is automatically rearranged according to the current
        !           389: variable ordering.
        !           390: @item
        !           391: On Windows one has to use @samp{/} as the separator of directory names.
        !           392: \E
1.1       noro      393: @end itemize
                    394:
                    395: @example
                    396: [0] A=(x+y+z+u+v+w)^20$
                    397: [1] bsave(A,"afo");
                    398: 1
                    399: [2] B = bload("afo")$
                    400: [3] A == B;
                    401: 1
                    402: [4] X=(x+y)^2;
                    403: x^2+2*y*x+y^2
                    404: [5] bsave(X,"afo")$
                    405: [6] quit;
                    406: % asir
                    407: [0] ord([y,x])$
                    408: [1] bload("afo");
                    409: y^2+2*x*y+x^2
                    410: @end example
                    411:
                    412: @table @t
1.2     ! noro      413: \JP @item $B;2>H(B
        !           414: \EG @item References
1.1       noro      415: @fref{output}.
                    416: @end table
                    417:
1.2     ! noro      418: \JP @node bload27,,, $BF~=PNO(B
        !           419: \EG @node bload27,,, Inputs and Outputs
1.1       noro      420: @subsection @code{bload27}
                    421: @findex bload27
                    422:
                    423: @table @t
                    424: @item xxx(@var{filename})
1.2     ! noro      425: \JP :: $B5lHG$G:n$i$l$?(B bsave file $B$NFI$_9~$_(B
        !           426: \EG :: Reads bsaved file created by older version of @b{Asir}.
1.1       noro      427: @end table
                    428:
                    429: @table @var
                    430: @item return
1.2     ! noro      431: \JP $BFI$_9~$s$@?t<0(B
        !           432: \EG expression read
1.1       noro      433: @item filename
1.2     ! noro      434: \JP $B%U%!%$%kL>(B
        !           435: \EG filename
1.1       noro      436: @end table
                    437:
                    438: @itemize @bullet
1.2     ! noro      439: \BJP
1.1       noro      440: @item
                    441: $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
                    442: $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
                    443: $BFI$_9~$a$J$$(B. $B$3$N$h$&$J%U%!%$%k$rFI$_9~$`$?$a$K(B @code{bload27} $B$rMQ$$$k(B.
                    444: @item
                    445: Windows $BHG$b%G%#%l%/%H%j$N%;%Q%l!<%?$H$7$F(B @samp{/} $B$rMQ$$$k(B.
1.2     ! noro      446: \E
        !           447: \BEG
        !           448: @item
        !           449: In older versions an arbitrary precision integer is represented as
        !           450: an array of 27bit integers. In the current version it is represented
        !           451: as an array of 32bit integers. By this incompatibility the bsaved
        !           452: file created by older versions cannot be read in the current version
        !           453: by @code{bload}.
        !           454: @code{bload27} is used to read such files.
        !           455: @item
        !           456: On Windows one has to use @samp{/} as the separator of directory names.
        !           457: \E
1.1       noro      458: @end itemize
                    459:
                    460: @table @t
1.2     ! noro      461: \JP @item $B;2>H(B
        !           462: \EG @item References
1.1       noro      463: @fref{bsave bload}.
                    464: @end table
                    465:
1.2     ! noro      466: \JP @node print,,, $BF~=PNO(B
        !           467: \EG @node print,,, Inputs and Outputs
1.1       noro      468: @subsection @code{print}
                    469: @findex print
                    470:
                    471: @table @t
                    472: @item print(@var{obj} [,@var{nl}])
1.2     ! noro      473: \JP :: @var{obj} $B$rI=<($9$k(B.
        !           474: \EG :: Displays (or outputs) @var{obj}.
1.1       noro      475: @end table
                    476:
                    477: @table @var
                    478: @item return
                    479: 0
                    480: @item obj
1.2     ! noro      481: \JP $BG$0U(B
        !           482: \EG arbitrary
1.1       noro      483: @item nl
1.2     ! noro      484: \JP $B%U%i%0(B ($BG$0U(B)
        !           485: \EG flag (arbitrary)
1.1       noro      486: @end table
                    487:
                    488: @itemize @bullet
1.2     ! noro      489: \BJP
1.1       noro      490: @item
                    491: @var{obj} $B$rI>2A$7$FI=<($9$k(B.
                    492: @item
                    493: $BBh(B 2 $B0z?t$,$J$$$+(B, $B$^$?$O(B 0, 2 $B0J30$N>l9g(B, $B2~9T$9$k(B.
                    494: $BBh(B 2 $B0z?t$,(B 1 $B$N>l9g(B, $B2~9T$;$:(B, $B=PNO$O%P%C%U%!$K=q$-9~$^$l(B,
                    495: $B%P%C%U%!$O%U%i%C%7%e$5$l$J$$(B.
                    496: $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.
                    497: @item
                    498: $B$3$NH!?t$NLa$jCM$O(B 0 $B$G$"$k$+$i(B, @code{print();}
                    499: $B$G<B9T$9$k$H(B, $B=PNO$N8e$K(B 0 $B$,JV$5$l$k(B.
                    500: @code{print()$} $B$H$9$l$P(B, $B:G8e$N(B 0 $B$O=PNO$5$l$J$$(B.
                    501: @item
                    502: $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.
1.2     ! noro      503: \E
        !           504: \BEG
        !           505: @item
        !           506: Displays (or outputs) @var{obj}.
        !           507: @item
        !           508: It normally adds linefeed code to cause the cursor moving to the next
        !           509: line.  If 0 or 2 is given as the second argument, it does not add a linefeed.
        !           510: If the second argument is 0, the output is simply written in the buffer.
        !           511: If the second argument is 2, the output is flushed.
        !           512: @item
        !           513: The return value of this function is 0.
        !           514: If command @code{print(@var{rat});} is performed at the top level,
        !           515: first the value of @var{rat} will be printed,
        !           516: followed by a linefeed, followed by a 0 which is the value of the
        !           517: function and followed by a linefeed and the next prompt.
        !           518: (If the command is terminated by a `$', e.g., @code{print(@var{rat})$},
        !           519: The last 0 will not be printed. )
        !           520: @item
        !           521: Formatted outputs are not currently supported.
        !           522: If one wishes to output multiple objects by a single @code{print()} command,
        !           523: use list like @code{[@var{obj1,...}]}, which is not so beautiful, but
        !           524: convenient to minimize programming efforts.
        !           525: \E
1.1       noro      526: @end itemize
                    527:
                    528: @example
                    529: [8] def cat(L) @{ while ( L != [] ) @{ print(car(L),0); L = cdr(L);@} print(""); @}
                    530: [9] cat([xyz,123,"gahaha"])$
                    531: xyz123gahaha
                    532: @end example
                    533:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>