diff6-10.chapter19.txt

このページは最後に更新されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

last mod. 2008-08-28 (木) 09:55:44

diff6-10

12,15c12,16
<  - It is automatically ``opened'' when a compilation starts, or when the
<    toplevel system is launched. Hence, it is possible to use unqualified
<    identifiers to refer to the functions provided by the Pervasives module,
<    without adding a open Pervasives directive. 
---
>  - It is automatically "opened" when a compilation starts, or when the toplevel
>    system is launched. Hence, it is possible to use unqualified identifiers to
>    refer to the functions provided by the Pervasives module, without adding a
>    open Pervasives directive. 
>   
27a29
> 
35a38
> 
100c103,115
<   type ('a, 'b, 'c) format
---
>   type int32
> >>
>     
>     The type of signed 32-bit integers.  See the Int32[] module. 
>   
> <<
>   type int64
> >>
>     
>     The type of signed 64-bit integers.  See the Int64[] module. 
>   
> <<
>   type nativeint
103,106c118,128
<                  The type of format strings. 'a is the type of the parameters 
<                of the format, 'c is the result type for the printf-style 
<                function, and 'b is the type of the first argument given to  \%a
<                and \%t printing functions (see module Printf[20.24]). 
---
>     The type of signed, platform-native integers (32 bits on 32-bit processors,
>    64 bits on 64-bit processors). See the Nativeint[] module. 
>   
> <<
>   type ('a, 'b, 'c, 'd) format4
> >>
>     
>     The type of format strings. 'a is the type of the parameters of the format,
>    'd is the result type for the printf-style function, 'b is the type of the
>    first argument given to \%a and \%t printing functions (see module
>    Printf[]), and 'c is the result type of these functions. 
112,113c134,136
<                  This type is used to implement the Lazy[20.15] module.  It
<                should not be used directly. 
---
>     This type is used to implement the Lazy[] module. It should not be used
>    directly. 
>   
123,126c146,148
<                  Exception raised when none of the cases of a pattern-matching 
<                apply. The arguments are the location of the pattern-matching 
<                in the source code (file name, position of first character, 
<                position of last character). 
---
>     Exception raised when none of the cases of a pattern-matching apply. The
>    arguments are the location of the match keyword in the source code (file
>    name, line number, column number). 
132,135c154,156
<                  Exception raised when an assertion fails. The arguments are 
<                the location of the pattern-matching in the source code  (file
<                name, position of first character, position of last  character).
<                
---
>     Exception raised when an assertion fails. The arguments are the location of
>    the assert keyword in the source code (file name, line number, column
>    number). 
141,142c162,163
<                  Exception raised by library functions to signal that the given
<                 arguments do not make sense. 
---
>     Exception raised by library functions to signal that the given arguments do
>    not make sense. 
148,149c169,170
<                  Exception raised by library functions to signal that they are 
<                undefined on the given arguments.  
---
>     Exception raised by library functions to signal that they are undefined on
>    the given arguments.  
155,156c176,177
<                  Exception raised by search functions when the desired object 
<                could not be found. 
---
>     Exception raised by search functions when the desired object could not be
>    found. 
162,163c183,184
<                  Exception raised by the garbage collector  when there is
<                insufficient memory to complete the computation. 
---
>     Exception raised by the garbage collector when there is insufficient memory
>    to complete the computation. 
169,173c190,193
<                  Exception raised by the bytecode interpreter when the
<                evaluation  stack reaches its maximal size. This often indicates
<                infinite  or excessively deep recursion in the user's program. 
<                (Not fully implemented by the native-code compiler;  see section
<                11.4.) 
---
>     Exception raised by the bytecode interpreter when the evaluation stack
>    reaches its maximal size. This often indicates infinite or excessively deep
>    recursion in the user's program. (Not fully implemented by the native-code
>    compiler; see section 11.5.) 
179,180c199,200
<                  Exception raised by the input/output functions to report  an
<                operating system error. 
---
>     Exception raised by the input/output functions to report an operating
>    system error. 
186,187c206,207
<                  Exception raised by input functions to signal that the  end of
<                file has been reached. 
---
>     Exception raised by input functions to signal that the end of file has been
>    reached. 
193,195c213,215
<                  Exception raised by division and remainder operations  when
<                their second argument is null.  (Not fully implemented by the
<                native-code compiler;  see section 11.4.) 
---
>     Exception raised by division and remainder operations when their second
>    argument is null. (Not fully implemented by the native-code compiler; see
>    section 11.5.) 
201,202c221,230
<                  A special case of Sys_error raised when no I/O is possible  on
<                a non-blocking I/O channel. 
---
>     A special case of Sys_error raised when no I/O is possible on a
>    non-blocking I/O channel. 
>   
> <<
>   exception Undefined_recursive_module of (string * int * int)
> >>
>     
>     Exception raised when an ill-founded recursive module definition is
>    evaluated. (See section 7.9.) The arguments are the location of the
>    definition in the source code (file name, line number, column number). 
213,214c241,242
<   This module is automatically opened at the beginning of each compilation. 
< All components of this module can therefore be referred by their short  name,
---
>   This module is automatically opened at the beginning of each compilation. All
> components of this module can therefore be referred by their short name,
218a247
> 
222d250
<    
229,230d256
<    
<    
237,238d262
<    
<    
245,246d268
<    
<    
251,252c273,274
<                 The Exit exception is not raised by any library function. It is
<                 provided for use in your programs.
---
>     The Exit exception is not raised by any library function. It is provided
>    for use in your programs.
259d280
<    
264,271c285,289
<                 e1 = e2 tests for structural equality of e1 and e2.  Mutable
<                structures (e.g. references and arrays) are equal  if and only
<                if their current contents are structurally equal,  even if the
<                two mutable objects are not the same physical object.  Equality
<                between functional values may raise Invalid_argument.  Equality
<                between cyclic data structures may not terminate.
<   
<    
---
>     e1 = e2 tests for structural equality of e1 and e2. Mutable structures
>    (e.g. references and arrays) are equal if and only if their current contents
>    are structurally equal, even if the two mutable objects are not the same
>    physical object. Equality between functional values raises Invalid_argument.
>    Equality between cyclic data structures does not terminate.
279,280d296
<    
<    
287,288d302
<    
<    
295,296d308
<    
<    
303,304d314
<    
<    
309,317c319,324
<                 Structural ordering functions. These functions coincide with 
<                the usual orderings over integers, characters, strings  and
<                floating-point numbers, and extend them to a  total ordering
<                over all types.  The ordering is compatible with (=). As in the
<                case  of (=), mutable structures are compared by contents. 
<                Comparison between functional values may raise Invalid_argument.
<                 Comparison between cyclic structures may not terminate.
<   
<    
---
>     Structural ordering functions. These functions coincide with the usual
>    orderings over integers, characters, strings and floating-point numbers, and
>    extend them to a total ordering over all types. The ordering is compatible
>    with (=). As in the case of (=), mutable structures are compared by
>    contents. Comparison between functional values raises Invalid_argument.
>    Comparison between cyclic structures does not terminate.
323,328c330,342
<                 compare x y returns 0 if x=y, a negative integer if  x<y, and a
<                positive integer if x>y. The same restrictions  as for = apply.
<                compare can be used as the comparison function  required by the
<                Set.Make[20.28.3] and Map.Make[20.18.3] functors.
<   
<    
---
>     compare x y returns 0 if x is equal to y, a negative integer if x is less
>    than y, and a positive integer if x is greater than y. The ordering
>    implemented by compare is compatible with the comparison predicates =, < and
>    > defined above, with one difference on the treatment of the float value
>    Pervasives.nan[19.2]. Namely, the comparison predicates treat nan as
>    different from any other float value, including itself; while compare treats
>    nan as equal to itself and less than any other float value. This treatment
>    of nan ensures that compare defines a total ordering relation.
>    compare applied to functional values may raise Invalid_argument. compare
>    applied to cyclic structures may not terminate.
>    The compare function can be used as the comparison function required by the
>    Set.Make[20.28] and Map.Make[20.18] functors, as well as the
>    List.sort[20.17] and Array.sort[20.2] functions.
336,337d349
<    
<    
344,345d355
<    
<    
350,357c360,365
<                 e1 == e2 tests for physical equality of e1 and e2.  On integers
<                and characters, physical equality is identical to structural 
<                equality. On mutable structures, e1 == e2 is true if and only if
<                 physical modification of e1 also affects e2.  On non-mutable
<                structures, the behavior of (==) is  implementation-dependent;
<                however, it is guaranteed that  e1 == e2 implies e1 = e2.
<   
<    
---
>     e1 == e2 tests for physical equality of e1 and e2. On integers and
>    characters, physical equality is identical to structural equality. On
>    mutable structures, e1 == e2 is true if and only if physical modification of
>    e1 also affects e2. On non-mutable structures, the behavior of (==) is
>    implementation-dependent; however, it is guaranteed that e1 == e2 implies
>    compare e1 e2 = 0.
370d377
<    
377,378d383
<    
<    
383,387c388,389
<                 The boolean ``and''. Evaluation is sequential, left-to-right: 
<                in e1 && e2, e1 is evaluated first, and if it returns false,  e2
<                is not evaluated at all.
<   
<    
---
>     The boolean "and". Evaluation is sequential, left-to-right: in e1 && e2, e1
>    is evaluated first, and if it returns false, e2 is not evaluated at all.
395d396
<    
400,404c401,402
<                 The boolean ``or''. Evaluation is sequential, left-to-right: 
<                in e1 || e2, e1 is evaluated first, and if it returns true,  e2
<                is not evaluated at all.
<   
<    
---
>     The boolean "or". Evaluation is sequential, left-to-right: in e1 || e2, e1
>    is evaluated first, and if it returns true, e2 is not evaluated at all.
412a411
> 
418d416
<    
425,426d422
<    
<    
433,434d428
<    
<    
441,442d434
<    
<    
449,450d440
<    
<    
457,458d446
<    
<    
465,466d452
<    
<    
471,477c457,461
<                 Integer division.  Raise Division_by_zero if the second
<                argument is 0.  Integer division rounds the real quotient of its
<                arguments towards zero.  More precisely, if x >= 0 and y > 0, x
<                / y is the greatest integer  less than or equal to the real
<                quotient of x by y. Moreover,  (-x) / y = x / (-y) = -(x / y).
<   
<    
---
>     Integer division. Raise Division_by_zero if the second argument is 0.
>    Integer division rounds the real quotient of its arguments towards zero.
>    More precisely, if x >= 0 and y > 0, x / y is the greatest integer less than
>    or equal to the real quotient of x by y. Moreover, (-x) / y = x / (-y) = -(x
>    / y).
483,489c467,470
<                 Integer remainder. If y is not zero, the result  of x mod y
<                satisfies the following properties:  x = (x / y) * y + x mod y
<                and  abs(x mod y) < abs(y).  If y = 0, x mod y raises
<                Division_by_zero.  Notice that x mod y is negative if and only
<                if x < 0.
<   
<    
---
>     Integer remainder. If y is not zero, the result of x mod y satisfies the
>    following properties: x = (x / y) * y + x mod y and abs(x mod y) <=
>    abs(y)-1. If y = 0, x mod y raises Division_by_zero. Notice that x mod y is
>    nonpositive if and only if x < 0. Raise Division_by_zero if y is zero.
495,497c476,477
<                 Return the absolute value of the argument.
<   
<    
---
>     Return the absolute value of the argument. Note that this may be negative
>    if the argument is min_int.
505,506d484
<    
<    
518d495
<    
525,526d501
<    
<    
533,534d507
<    
<    
541,542d513
<    
<    
549,550d519
<    
<    
555,559c524,526
<                 n lsl m shifts n to the left by m bits.  The result is
<                unspecified if m < 0 or m >= bitsize,  where bitsize is 32 on a
<                32-bit platform and  64 on a 64-bit platform.
<   
<    
---
>     n lsl m shifts n to the left by m bits. The result is unspecified if m < 0
>    or m >= bitsize, where bitsize is 32 on a 32-bit platform and 64 on a 64-bit
>    platform.
565,569c532,534
<                 n lsr m shifts n to the right by m bits.  This is a logical
<                shift: zeroes are inserted regardless of  the sign of n.  The
<                result is unspecified if m < 0 or m >= bitsize.
<   
<    
---
>     n lsr m shifts n to the right by m bits. This is a logical shift: zeroes
>    are inserted regardless of the sign of n. The result is unspecified if m < 0
>    or m >= bitsize.
575,577c540,542
<                 n asr m shifts n to the right by m bits.  This is an arithmetic
<                shift: the sign bit of n is replicated.  The result is
<                unspecified if m < 0 or m >= bitsize.
---
>     n asr m shifts n to the right by m bits. This is an arithmetic shift: the
>    sign bit of n is replicated. The result is unspecified if m < 0 or m >=
>    bitsize.
585,592c550,556
< precision (64 bits) numbers.  Floating-point operations never raise an
< exception on overflow,  underflow, division by zero, etc. Instead, special IEEE
< numbers  are returned as appropriate, such as infinity for 1.0 /. 0.0, 
< neg_infinity for -1.0 /. 0.0, and nan (``not a number'')  for 0.0 /. 0.0. These
< special numbers then propagate through  floating-point computations as
< expected: for instance,  1.0 /. infinity is 0.0, and any operation with nan as 
<  argument returns nan as result.
<    
---
> precision (64 bits) numbers. Floating-point operations never raise an exception
> on overflow, underflow, division by zero, etc. Instead, special IEEE numbers
> are returned as appropriate, such as infinity for 1.0 /. 0.0, neg_infinity for
> -1.0 /. 0.0, and nan ("not a number") for 0.0 /. 0.0. These special numbers
> then propagate through floating-point computations as expected: for instance,
> 1.0 /. infinity is 0.0, and any operation with nan as argument returns nan as
> result.
599,600d562
<    
<    
607,608d568
<    
<    
615,616d574
<    
<    
623,624d580
<    
<    
631,632d586
<    
<    
639,640d592
<    
<    
647,648d598
<    
<    
655,656d604
<    
<    
663,664d610
<    
<    
671,672d616
<    
<    
679,680d622
<    
<    
687,688d628
<    
<    
695,696d634
<    
<    
703,704d640
<    
<    
711,712d646
<    
<    
719,720d652
<    
<    
727,728d658
<    
<    
735,736d664
<    
<    
743,744d670
<    
<    
751,752d676
<    
<    
759,760d682
<    
<    
765,769c687,689
<                 Round the given float to an integer value.  floor f returns the
<                greatest integer value less than or  equal to f.  ceil f returns
<                the least integer value greater than or  equal to f.
<   
<    
---
>     Round the given float to an integer value. floor f returns the greatest
>    integer value less than or equal to f. ceil f returns the least integer
>    value greater than or equal to f.
777,778d696
<    
<    
783,787c701,703
<                 mod_float a b returns the remainder of a with respect to  b.
<                The returned value is a -. n *. b, where n  is the quotient a /.
<                b rounded towards zero to an integer.
<   
<    
---
>     mod_float a b returns the remainder of a with respect to b. The returned
>    value is a -. n *. b, where n is the quotient a /. b rounded towards zero to
>    an integer.
793,798c709,711
<                 frexp f returns the pair of the significant  and the exponent
<                of f. When f is zero, the  significant x and the exponent n of f
<                are equal to  zero. When f is non-zero, they are defined by  f =
<                x *. 2 ** n and 0.5 <= x < 1.0.
<   
<    
---
>     frexp f returns the pair of the significant and the exponent of f. When f
>    is zero, the significant x and the exponent n of f are equal to zero. When f
>    is non-zero, they are defined by f = x *. 2 ** n and 0.5 <= x < 1.0.
806,807d718
<    
<    
812,815c723
<                 modf f returns the pair of the fractional and integral  part of
<                f.
<   
<    
---
>     modf f returns the pair of the fractional and integral part of f.
823,824d730
<    
<    
831,832d736
<    
<    
839,840d742
<    
<    
845,846c747,748
<                 Truncate the given floating-point number to an integer.  The
<                result is unspecified if it falls outside the  range of
---
>     Truncate the given floating-point number to an integer. The result is
>    unspecified if the argument is nan or falls outside the range of
849,850d750
<    
<    
857,858d756
<    
<    
865,866d762
<    
<    
871,875c767,771
<                 A special floating-point value denoting the result of an 
<                undefined operation such as 0.0 /. 0.0. Stands for  ``not a
<                number''.
<   
<    
---
>     A special floating-point value denoting the result of an undefined
>    operation such as 0.0 /. 0.0. Stands for "not a number". Any floating-point
>    operation with nan as argument returns nan as result. As for floating-point
>    comparisons, =, <, <=, > and >= return false and <> returns true if one or
>    both of their arguments is nan.
883,884d778
<    
<    
889,892c783
<                 The smallest positive, non-zero, non-denormalized value of type
<                float.
<   
<    
---
>     The smallest positive, non-zero, non-denormalized value of type float.
900,901d790
<    
<    
933,936c822,823
<                 The five classes of floating-point numbers, as determined by 
<                the Pervasives.classify_float[19.2] function.
<   
<    
---
>     The five classes of floating-point numbers, as determined by the
>    Pervasives.classify_float[19.2] function.
942,943c829,830
<                 Return the class of the given floating-point number:  normal,
<                subnormal, zero, infinite, or not a number.
---
>     Return the class of the given floating-point number: normal, subnormal,
>    zero, infinite, or not a number.
951d837
<    
964d849
<    
971,972d855
<    
<    
977,979c860,861
<                 Return the character with the given ASCII code.  Raise
<                Invalid_argument "char_of_int" if the argument is  outside the
<                range 0--255.
---
>     Return the character with the given ASCII code. Raise Invalid_argument
>    "char_of_int" if the argument is outside the range 0--255.
986d867
<    
991,995c872,875
<                 Discard the value of its argument and return ().  For instance,
<                ignore(f x) discards the result of  the side-effecting function
<                f. It is equivalent to  f x; (), except that the latter may
<                generate a  compiler warning; writing ignore(f x) instead 
<                avoids the warning.
---
>     Discard the value of its argument and return (). For instance, ignore(f x)
>    discards the result of the side-effecting function f. It is equivalent to f
>    x; (), except that the latter may generate a compiler warning; writing
>    ignore(f x) instead avoids the warning.
1002d881
<    
1009,1010d887
<    
<    
1018,1019d894
<    
<    
1026,1027d900
<    
<    
1032,1038c905,910
<                 Convert the given string to an integer.  The string is read in
<                decimal (by default) or in hexadecimal,  octal or binary if the
<                string begins with 0x, 0o or 0b  respectively.  Raise Failure
<                "int_of_string" if the given string is not  a valid
<                representation of an integer.
<   
<    
---
>     Convert the given string to an integer. The string is read in decimal (by
>    default) or in hexadecimal (if it begins with 0x or 0X), octal (if it begins
>    with 0o or 0O), or binary (if it begins with 0b or 0B). Raise Failure
>    "int_of_string" if the given string is not a valid representation of an
>    integer, or if the integer represented exceeds the range of integers
>    representable in type int.
1046,1047d917
<    
<    
1052,1054c922,923
<                 Convert the given string to a float. Raise Failure
<                "float_of_string"  if the given string is not a valid
<                representation of a float.
---
>     Convert the given string to a float. Raise Failure "float_of_string" if the
>    given string is not a valid representation of a float.
1061d929
<    
1068,1069d935
<    
<    
1082d947
<    
1094d958
<    
1101,1102d964
<    
<    
1109,1110d970
<    
<    
1117,1118d976
<    
<    
1125,1126d982
<    
<    
1138d993
<    
1145,1146d999
<    
<    
1153,1154d1005
<    
<    
1161,1162d1011
<    
<    
1169,1170d1017
<    
<    
1175,1178c1022,1023
<                 Print a string, followed by a newline character, on  standard
<                output.
<   
<    
---
>     Print a string, followed by a newline character, on standard output and
>    flush standard output.
1184,1186c1029,1030
<                 Print a newline character on standard output, and flush 
<                standard output. This can be used to simulate line  buffering of
<                standard output.
---
>     Print a newline character on standard output, and flush standard output.
>    This can be used to simulate line buffering of standard output.
1193d1036
<    
1200,1201d1042
<    
<    
1208,1209d1048
<    
<    
1216,1217d1054
<    
<    
1224,1225d1060
<    
<    
1230,1233c1065,1066
<                 Print a string, followed by a newline character on standard
<                error  and flush standard error.
<   
<    
---
>     Print a string, followed by a newline character on standard error and flush
>    standard error.
1239,1240c1072
<                 Print a newline character on standard error, and flush 
<                standard error.
---
>     Print a newline character on standard error, and flush standard error.
1247d1078
<    
1252,1256c1083,1085
<                 Flush standard output, then read characters from standard input
<                 until a newline character is encountered. Return the string of 
<                all characters read, without the newline character at the end.
<   
<    
---
>     Flush standard output, then read characters from standard input until a
>    newline character is encountered. Return the string of all characters read,
>    without the newline character at the end.
1262,1266c1091,1093
<                 Flush standard output, then read one line from standard input 
<                and convert it to an integer. Raise Failure "int_of_string"  if
<                the line read is not a valid representation of an integer.
<   
<    
---
>     Flush standard output, then read one line from standard input and convert
>    it to an integer. Raise Failure "int_of_string" if the line read is not a
>    valid representation of an integer.
1272,1275c1099,1101
<                 Flush standard output, then read one line from standard input 
<                and convert it to a floating-point number.  The result is
<                unspecified if the line read is not a valid  representation of a
<                floating-point number.
---
>     Flush standard output, then read one line from standard input and convert
>    it to a floating-point number. The result is unspecified if the line read is
>    not a valid representation of a floating-point number.
1282d1107
<    
1318c1143
<                 fail if the file already exists. 
---
>     fail if Open_creat and the file already exists. 
1341,1342d1165
<    
<    
1347,1353c1170,1173
<                 Open the named file for writing, and return a new output
<                channel  on that file, positionned at the beginning of the file.
<                The  file is truncated to zero length if it already exists. It 
<                is created if it does not already exists.  Raise Sys_error if
<                the file could not be opened.
<   
<    
---
>     Open the named file for writing, and return a new output channel on that
>    file, positionned at the beginning of the file. The file is truncated to
>    zero length if it already exists. It is created if it does not already
>    exists. Raise Sys_error if the file could not be opened.
1359,1365c1179,1182
<                 Same as Pervasives.open_out[19.2], but the file is opened in
<                binary mode,  so that no translation takes place during writes.
<                On operating  systems that do not distinguish between text mode
<                and binary  mode, this function behaves like
<                Pervasives.open_out[19.2].
<   
<    
---
>     Same as Pervasives.open_out[19.2], but the file is opened in binary mode,
>    so that no translation takes place during writes. On operating systems that
>    do not distinguish between text mode and binary mode, this function behaves
>    like Pervasives.open_out[19.2].
1368,1369c1185
<   val open_out_gen :
<     open_flag list -> int -> string -> out_channel
---
>   val open_out_gen : open_flag list -> int -> string -> out_channel
1372,1379c1188,1192
<                 Open the named file for writing, as above. The extra argument
<                mode  specify the opening mode. The extra argument perm
<                specifies  the file permissions, in case the file must be
<                created.  Pervasives.open_out[19.2] and
<                Pervasives.open_out_bin[19.2] are special  cases of this
<                function.
<   
<    
---
>     open_out_gen mode perm filename opens the named file for writing, as
>    described above. The extra argument mode specify the opening mode. The extra
>    argument perm specifies the file permissions, in case the file must be
>    created. Pervasives.open_out[19.2] and Pervasives.open_out_bin[19.2] are
>    special cases of this function.
1385,1390c1198,1200
<                 Flush the buffer associated with the given output channel,  
<                performing all pending writes on that channel.  Interactive
<                programs must be careful about flushing standard  output and
<                standard error at the right time.
<   
<    
---
>     Flush the buffer associated with the given output channel, performing all
>    pending writes on that channel. Interactive programs must be careful about
>    flushing standard output and standard error at the right time.
1396,1398c1206
<                 Flush all opened output channels.
<   
<    
---
>     Flush all open output channels; ignore errors.
1406,1407d1213
<    
<    
1414,1415d1219
<    
<    
1420,1425c1224,1226
<                 output oc buf pos len writes len characters from string buf, 
<                starting at offset pos, to the given output channel oc.  Raise
<                Invalid_argument "output" if pos and len do not  designate a
<                valid substring of buf.
<   
<    
---
>     output oc buf pos len writes len characters from string buf, starting at
>    offset pos, to the given output channel oc. Raise Invalid_argument "output"
>    if pos and len do not designate a valid substring of buf.
1431,1435c1232,1233
<                 Write one 8-bit integer (as the single character with that
<                code)  on the given output channel. The given integer is taken
<                modulo  256.
<   
<    
---
>     Write one 8-bit integer (as the single character with that code) on the
>    given output channel. The given integer is taken modulo 256.
1441,1447c1239,1243
<                 Write one integer in binary format on the given output channel.
<                 The only reliable way to read it back is through the 
<                Pervasives.input_binary_int[19.2] function. The format is
<                compatible across  all machines for a given version of Objective
<                Caml.
<   
<    
---
>     Write one integer in binary format (4 bytes, big-endian) on the given
>    output channel. The given integer is taken modulo 2^32. The only reliable
>    way to read it back is through the Pervasives.input_binary_int[19.2]
>    function. The format is compatible across all machines for a given version
>    of Objective Caml.
1453,1461c1249,1254
<                 Write the representation of a structured value of any type  to
<                a channel. Circularities and sharing inside the value  are
<                detected and preserved. The object can be read back,  by the
<                function Pervasives.input_value[19.2]. See the description of
<                module  Marshal[20.19] for more information.
<                Pervasives.output_value[19.2] is equivalent  to
<                Marshal.to_channel[20.19] with an empty list of flags.
<   
<    
---
>     Write the representation of a structured value of any type to a channel.
>    Circularities and sharing inside the value are detected and preserved. The
>    object can be read back, by the function Pervasives.input_value[19.2]. See
>    the description of module Marshal[20.19] for more information.
>    Pervasives.output_value[19.2] is equivalent to Marshal.to_channel[20.19]
>    with an empty list of flags.
1467,1472c1260,1262
<                 seek_out chan pos sets the current writing position to pos  for
<                channel chan. This works only for regular files. On  files of
<                other kinds (such as terminals, pipes and sockets),  the
<                behavior is unspecified.
<   
<    
---
>     seek_out chan pos sets the current writing position to pos for channel
>    chan. This works only for regular files. On files of other kinds (such as
>    terminals, pipes and sockets), the behavior is unspecified.
1478,1480c1268,1269
<                 Return the current writing position for the given channel.
<   
<    
---
>     Return the current writing position for the given channel. Does not work on
>    channels opened with the Open_append flag (returns unspecified results).
1486,1490c1275,1277
<                 Return the total length (number of characters) of the  given
<                channel. This works only for regular files. On files of  other
<                kinds, the result is meaningless.
<   
<    
---
>     Return the size (number of characters) of the regular file on which the
>    given channel is opened. If the channel is opened on a file that is not a
>    regular file, the result is meaningless.
1496,1500c1283,1287
<                 Close the given channel, flushing all buffered write
<                operations.  Output functions raise a Sys_error exception when
<                they are  applied to a closed output channel, except close_out
<                and flush,  which do nothing when applied to an already closed
<                channel.
---
>     Close the given channel, flushing all buffered write operations. Output
>    functions raise a Sys_error exception when they are applied to a closed
>    output channel, except close_out and flush, which do nothing when applied to
>    an already closed channel. Note that close_out may raise Sys_error if the
>    operating system signals an error when flushing or closing.
1501a1289,1291
> <<
>   val close_out_noerr : out_channel -> unit
> >>
1502a1293
>     Same as close_out, but ignore all errors.
1508,1515c1299,1305
<                 set_binary_mode_out oc true sets the channel oc to binary 
<                mode: no translations take place during output. 
<                set_binary_mode_out oc false sets the channel oc to text  mode:
<                depending on the operating system, some translations  may take
<                place during output. For instance, under Windows,  end-of-lines
<                will be translated from \n to \r\n.  This function has no effect
<                under operating systems that  do not distinguish between text
<                mode and binary mode.
---
>     set_binary_mode_out oc true sets the channel oc to binary mode: no
>    translations take place during output. set_binary_mode_out oc false sets the
>    channel oc to text mode: depending on the operating system, some
>    translations may take place during output. For instance, under Windows,
>    end-of-lines will be translated from \n to \r\n. This function has no effect
>    under operating systems that do not distinguish between text mode and binary
>    mode.
1522d1311
<    
1527,1531c1316,1318
<                 Open the named file for reading, and return a new input channel
<                 on that file, positionned at the beginning of the file.  Raise
<                Sys_error if the file could not be opened.
<   
<    
---
>     Open the named file for reading, and return a new input channel on that
>    file, positionned at the beginning of the file. Raise Sys_error if the file
>    could not be opened.
1537,1543c1324,1327
<                 Same as Pervasives.open_in[19.2], but the file is opened in
<                binary mode,  so that no translation takes place during reads.
<                On operating  systems that do not distinguish between text mode
<                and binary  mode, this function behaves like
<                Pervasives.open_in[19.2].
<   
<    
---
>     Same as Pervasives.open_in[19.2], but the file is opened in binary mode, so
>    that no translation takes place during reads. On operating systems that do
>    not distinguish between text mode and binary mode, this function behaves
>    like Pervasives.open_in[19.2].
1546,1547c1330
<   val open_in_gen :
<     open_flag list -> int -> string -> in_channel
---
>   val open_in_gen : open_flag list -> int -> string -> in_channel
1550,1552c1333,1335
<                 Open the named file for reading, as above. The extra arguments 
<                mode and perm specify the opening mode and file permissions. 
<                Pervasives.open_in[19.2] and Pervasives.open_in_bin[19.2] are
---
>     open_in mode perm filename opens the named file for reading, as described
>    above. The extra arguments mode and perm specify the opening mode and file
>    permissions. Pervasives.open_in[19.2] and Pervasives.open_in_bin[19.2] are
1555,1556d1337
<    
<    
1561,1564c1342,1343
<                 Read one character from the given input channel.  Raise
<                End_of_file if there are no more characters to read.
<   
<    
---
>     Read one character from the given input channel. Raise End_of_file if there
>    are no more characters to read.
1570,1576c1349,1352
<                 Read characters from the given input channel, until a  newline
<                character is encountered. Return the string of  all characters
<                read, without the newline character at the end.  Raise
<                End_of_file if the end of the file is reached  at the beginning
<                of line.
<   
<    
---
>     Read characters from the given input channel, until a newline character is
>    encountered. Return the string of all characters read, without the newline
>    character at the end. Raise End_of_file if the end of the file is reached at
>    the beginning of line.
1582,1596c1358,1368
<                 input ic buf pos len reads up to len characters from  the given
<                channel ic, storing them in string buf, starting at  character
<                number pos.  It returns the actual number of characters read,
<                between 0 and  len (inclusive).  A return value of 0 means that
<                the end of file was reached.  A return value between 0 and len
<                exclusive means that  not all requested len characters were
<                read, either because  no more characters were available at that
<                time, or because  the implementation found it convenient to do a
<                partial read;  input must be called again to read the remaining
<                characters,  if desired. (See also Pervasives.really_input[19.2]
<                for reading  exactly len characters.)  Exception
<                Invalid_argument "input" is raised if pos and len  do not
<                designate a valid substring of buf.
<   
<    
---
>     input ic buf pos len reads up to len characters from the given channel ic,
>    storing them in string buf, starting at character number pos. It returns the
>    actual number of characters read, between 0 and len (inclusive). A return
>    value of 0 means that the end of file was reached. A return value between 0
>    and len exclusive means that not all requested len characters were read,
>    either because no more characters were available at that time, or because
>    the implementation found it convenient to do a partial read; input must be
>    called again to read the remaining characters, if desired. (See also
>    Pervasives.really_input[19.2] for reading exactly len characters.) Exception
>    Invalid_argument "input" is raised if pos and len do not designate a valid
>    substring of buf.
1602,1606c1374,1377
<                 really_input ic buf pos len reads len characters from channel
<                ic,  storing them in string buf, starting at character number
<                pos.  Raise End_of_file if the end of file is reached before len
<                 characters have been read.  Raise Invalid_argument
<                "really_input" if  pos and len do not designate a valid
---
>     really_input ic buf pos len reads len characters from channel ic, storing
>    them in string buf, starting at character number pos. Raise End_of_file if
>    the end of file is reached before len characters have been read. Raise
>    Invalid_argument "really_input" if pos and len do not designate a valid
1609,1610d1379
<    
<    
1615,1619c1384,1385
<                 Same as Pervasives.input_char[19.2], but return the 8-bit
<                integer representing  the character.  Raise End_of_file if an
<                end of file was reached.
<   
<    
---
>     Same as Pervasives.input_char[19.2], but return the 8-bit integer
>    representing the character. Raise End_of_file if an end of file was reached.
1625,1630c1391,1393
<                 Read an integer encoded in binary format from the given input 
<                channel. See Pervasives.output_binary_int[19.2].  Raise
<                End_of_file if an end of file was reached while reading the 
<                integer.
<   
<    
---
>     Read an integer encoded in binary format (4 bytes, big-endian) from the
>    given input channel. See Pervasives.output_binary_int[19.2]. Raise
>    End_of_file if an end of file was reached while reading the integer.
1637,1643c1400,1403
<                Pervasives.output_value[19.2], and return the corresponding
<                value.  This function is identical to
<                Marshal.from_channel[20.19];  see the description of module
<                Marshal[20.19] for more information,  in particular concerning
<                the lack of type safety.
<   
<    
---
>    Pervasives.output_value[19.2], and return the corresponding value. This
>    function is identical to Marshal.from_channel[20.19]; see the description of
>    module Marshal[20.19] for more information, in particular concerning the
>    lack of type safety.
1649,1653c1409,1411
<                 seek_in chan pos sets the current reading position to pos  for
<                channel chan. This works only for regular files. On  files of
<                other kinds, the behavior is unspecified.
<   
<    
---
>     seek_in chan pos sets the current reading position to pos for channel chan.
>    This works only for regular files. On files of other kinds, the behavior is
>    unspecified.
1661,1662d1418
<    
<    
1667,1671c1423,1427
<                 Return the total length (number of characters) of the  given
<                channel. This works only for regular files. On files of  other
<                kinds, the result is meaningless.
<   
<    
---
>     Return the size (number of characters) of the regular file on which the
>    given channel is opened. If the channel is opened on a file that is not a
>    regular file, the result is meaningless. The returned size does not take
>    into account the end-of-line translations that can be performed when reading
>    from a channel opened in text mode.
1677,1680c1433,1436
<                 Close the given channel. Input functions raise a Sys_error 
<                exception when they are applied to a closed input channel, 
<                except close_in, which does nothing when applied to an already 
<                closed channel.
---
>     Close the given channel. Input functions raise a Sys_error exception when
>    they are applied to a closed input channel, except close_in, which does
>    nothing when applied to an already closed channel. Note that close_in may
>    raise Sys_error if the operating system signals an error.
1681a1438,1440
> <<
>   val close_in_noerr : in_channel -> unit
> >>
1682a1442
>     Same as close_in, but ignore all errors.
1688,1695c1448,1454
<                 set_binary_mode_in ic true sets the channel ic to binary  mode:
<                no translations take place during input.  set_binary_mode_out ic
<                false sets the channel ic to text  mode: depending on the
<                operating system, some translations  may take place during
<                input. For instance, under Windows,  end-of-lines will be
<                translated from \r\n to \n.  This function has no effect under
<                operating systems that  do not distinguish between text mode and
<                binary mode.
---
>     set_binary_mode_in ic true sets the channel ic to binary mode: no
>    translations take place during input. set_binary_mode_out ic false sets the
>    channel ic to text mode: depending on the operating system, some
>    translations may take place during input. For instance, under Windows,
>    end-of-lines will be translated from \r\n to \n. This function has no effect
>    under operating systems that do not distinguish between text mode and binary
>    mode.
1703,1705c1462,1499
<   module LargeFile : sig  end
< >>
<     [19.2.1]
---
>   module LargeFile : >>
>    
>     sig
>   
>   
>    <<
>      val seek_out : Pervasives.out_channel -> int64 -> unit
>    >>
>   
>    <<
>      val pos_out : Pervasives.out_channel -> int64
>    >>
>   
>    <<
>      val out_channel_length : Pervasives.out_channel -> int64
>    >>
>   
>    <<
>      val seek_in : Pervasives.in_channel -> int64 -> unit
>    >>
>   
>    <<
>      val pos_in : Pervasives.in_channel -> int64
>    >>
>   
>    <<
>      val in_channel_length : Pervasives.in_channel -> int64
>    >>
>    
>     end
>   
>     Operations on large files. This sub-module provides 64-bit variants of the
>    channel functions that manipulate file positions and file sizes. By
>    representing positions and sizes by 64-bit integers (type int64) instead of
>    regular integers (type int), these alternate functions allow operating on
>    files whose sizes are greater than max_int.
>   
>   
1710d1503
<    
1717,1720c1510,1511
<                 The type of references (mutable indirection cells) containing 
<                a value of type 'a.
<   
<    
---
>     The type of references (mutable indirection cells) containing a value of
>    type 'a.
1728,1729d1518
<    
<    
1734,1737c1523,1524
<                 !r returns the current contents of reference r.  Equivalent to
<                fun r -> r.contents.
<   
<    
---
>     !r returns the current contents of reference r. Equivalent to fun r ->
>    r.contents.
1743,1746c1530,1531
<                 r := a stores the value of a in reference r.  Equivalent to fun
<                r v -> r.contents <- v.
<   
<    
---
>     r := a stores the value of a in reference r. Equivalent to fun r v ->
>    r.contents <- v.
1752,1755c1537,1538
<                 Increment the integer contained in the given reference. 
<                Equivalent to fun r -> r := succ !r.
<   
<    
---
>     Increment the integer contained in the given reference. Equivalent to fun r
>    -> r := succ !r.
1761,1762c1544,1545
<                 Decrement the integer contained in the given reference. 
<                Equivalent to fun r -> r := pred !r.
---
>     Decrement the integer contained in the given reference. Equivalent to fun r
>    -> r := pred !r.
1766,1768c1549,1550
< Program termination
< ===================
<    
---
> Operations on format strings
> ============================
1771c1553
<   val exit : int -> 'a
---
>   type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'c, 'c, 'd) format6 
1774,1782c1556,1557
<                 Terminate the process, returning the given status code  to the
<                operating system: usually 0 to indicate no errors,  and a small
<                positive integer to indicate failure.   All opened output
<                channels are flushed.  An implicit exit 0 is performed each time
<                a program  terminates normally. An implicit exit 2 is performed
<                if the program  terminates early because of an uncaught
<                exception.
<   
<    
---
>     See modules Printf[20.24] and Scanf[20.27] for more operations on format
>    strings.
1785c1560
<   val at_exit : (unit -> unit) -> unit
---
>   type ('a, 'b, 'c) format = ('a, 'b, 'c, 'c) format4 
1788,1799c1563,1566
<                 Register the given function to be called at program 
<                termination time. The functions registered with at_exit  will be
<                called when the program executes Pervasives.exit[19.2],  or
<                terminates, either normally or because of an uncaught exception.
<                 The functions are called in ``last in, first out'' order:  the
<                function most recently added with at_exit is called first.
<   
<    
<   
< 
< 19.2.1  Module Pervasives.LargeFile : Operations on large files.
< ================================================================
---
>     Simplified type for format strings, included for backward compatibility
>    with earlier releases of Objective Caml. 'a is the type of the parameters of
>    the format, 'c is the result type for the "printf"-style function, and 'b is
>    the type of the first argument given to %a and %t printing functions.
1802c1569
<   module LargeFile : sig
---
>   val string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string
1805,1812c1572
<   
<   This sub-module provides 64-bit variants of the channel functions  that
< manipulate file positions and file sizes. By representing  positions and sizes
< by 64-bit integers (type int64) instead of  regular integers (type int), these
< alternate functions allow  operating on files whose sizes are greater than
< max_int.
<   
<   
---
>     Converts a format string into a string.
1815c1575,1576
<   val seek_out : Pervasives.out_channel -> int64 -> unit
---
>   val format_of_string :
>     ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6
1817a1579
>     format_of_string s returns a format string read from the string literal s.
1820c1582,1584
<   val pos_out : Pervasives.out_channel -> int64
---
>   val (^^) :
>     ('a, 'b, 'c, 'd, 'e, 'f) format6 ->
>     ('f, 'b, 'c, 'e, 'g, 'h) format6 -> ('a, 'b, 'c, 'd, 'g, 'h) format6
1823,1826c1587,1588
<    
< <<
<   val out_channel_length : Pervasives.out_channel -> int64
< >>
---
>     f1 ^^f2 catenates formats f1 and f2. The result is a format that accepts
>    arguments from f1, then arguments from f2.
1829,1831d1590
< <<
<   val seek_in : Pervasives.in_channel -> int64 -> unit
< >>
1832a1592,1593
> Program termination
> ===================
1835c1596
<   val pos_in : Pervasives.in_channel -> int64
---
>   val exit : int -> 'a
1837a1599,1604
>     Terminate the process, returning the given status code to the operating
>    system: usually 0 to indicate no errors, and a small positive integer to
>    indicate failure.  All open output channels are flushed with flush_all. An
>    implicit exit 0 is performed each time a program terminates normally. An
>    implicit exit 2 is performed if the program terminates early because of an
>    uncaught exception.
1840c1607
<   val in_channel_length : Pervasives.in_channel -> int64
---
>   val at_exit : (unit -> unit) -> unit
1843,1845c1610,1615
< <<
<   end
< >>
---
>     Register the given function to be called at program termination time. The
>    functions registered with at_exit will be called when the program executes
>    Pervasives.exit[19.2], or terminates, either normally or because of an
>    uncaught exception. The functions are called in "last in, first out" order:
>    the function most recently added with at_exit is called first.
>

新規 編集 添付