From 8702c4d0d73a050e0d2181e16bf1e0688d6322f0 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 5 Jan 2008 03:35:13 +0000 Subject: [PATCH] update rdoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- encoding.c | 2 +- io.c | 68 +++++++++++++++++++++++++++++++----------------------- proc.c | 2 +- string.c | 4 ++-- 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/encoding.c b/encoding.c index 83399c7635..e75a2a79c8 100644 --- a/encoding.c +++ b/encoding.c @@ -1010,7 +1010,7 @@ Init_Encoding(void) rb_enc_replicate("Windows-31J", rb_enc_from_index(ENCINDEX_SJIS)); rb_enc_alias("CP932", "Windows-31J"); - rb_enc_alias("csWindows31J", "Windows-31J"); /* IANA. IE6 accepts csWindows31J but Windows-31J. */ + rb_enc_alias("csWindows31J", "Windows-31J"); /* IANA. IE6 don't accept Windows-31J but csWindows31J. */ for (i = 0; i < enc_table_size; ++i) { rb_encoding *enc = enc_table[i].enc; diff --git a/io.c b/io.c index 12ea578dde..291ab50c03 100644 --- a/io.c +++ b/io.c @@ -3873,33 +3873,39 @@ rb_io_s_sysopen(int argc, VALUE *argv) /* * call-seq: - * open(path [, mode [, perm]] ) => io or nil - * open(path [, mode [, perm]] ) {|io| block } => obj + * open(path [, mode_enc [, perm]] ) => io or nil + * open(path [, mode_enc [, perm]] ) {|io| block } => obj * * Creates an IO object connected to the given stream, * file, or subprocess. * * If path does not start with a pipe character * (``|''), treat it as the name of a file to open using - * the specified mode (defaulting to ``r''). The mode is + * the specified mode (defaulting to ``r''). + * + * The mode_enc is * either a string or an integer. If it is an integer, it must be * bitwise-or of open(2) flags, such as File::RDWR or File::EXCL. - * If it is a string, it is either "mode", "mode:encoding", or - * "mode:encoding:encoding". "mode" is one of the following: + * If it is a string, it is either "mode", "mode:ext_enc", or + * "mode:ext_enc:int_enc". + * The mode is one of the following: * * r: read (default) * w: write * a: append * * The mode can be followed by "b" (means binary-mode), or "+" - * (means both reading and writing allowed) or both. If one - * encoding is specified, read string will be tagged by the - * encoding in reading, and output string will be converted - * to the specified encoding in writing. If two encoding names - * are specified, the read string is converted from the former - * encoding to the latter encoding then tagged with the latter - * in read mode, and in write mode, the output string will be - * converted from the latter to the former before writing. + * (means both reading and writing allowed) or both. + * If ext_enc (external encoding) is specified, + * read string will be tagged by the encoding in reading, + * and output string will be converted + * to the specified encoding in writing. + * If two encoding names, + * ext_enc and int_enc (external encoding and internal encoding), + * are specified, the read string is converted from ext_enc + * to int_enc then tagged with the int_enc in read mode, + * and in write mode, the output string will be + * converted from int_enc to ext_enc before writing. * * If a file is being created, its initial permissions may be * set using the integer third parameter. @@ -5640,22 +5646,25 @@ io_encoding_set(rb_io_t *fptr, int argc, VALUE v1, VALUE v2) /* * call-seq: - * IO.pipe -> array - * IO.pipe(encoding) -> array - * IO.pipe(encoding1, encoding2) -> array + * IO.pipe -> [read_io, write_io] + * IO.pipe(ext_enc) -> [read_io, write_io] + * IO.pipe("ext_enc:int_enc") -> [read_io, write_io] + * IO.pipe(ext_enc, int_enc) -> [read_io, write_io] * * Creates a pair of pipe endpoints (connected to each other) and * returns them as a two-element array of IO objects: - * [ read_file, write_file ]. Not + * [ read_io, write_io ]. Not * available on all platforms. * - * If an optional argument is specified, read string from pipe is tagged - * with the encoding specified. If encoding is a comma separated two - * encoding names "A:B", the read string is converted from encoding A - * (external encoding) to encoding B (internal encoding), then tagged - * with B. If two optional arguments are specified, those must be - * encoding objects, and the first one is the external encoding, and the - * second one is the internal encoding. + * If an encoding (encoding name or encoding object) is specified as an optional argument, + * read string from pipe is tagged with the encoding specified. + * If the argument is a colon separated two encoding names "A:B", + * the read string is converted from encoding A (external encoding) + * to encoding B (internal encoding), then tagged with B. + * If two optional arguments are specified, those must be + * encoding objects or encoding names, + * and the first one is the external encoding, + * and the second one is the internal encoding. * * In the example below, the two processes close the ends of the pipe * that they are not using. This is not just a cosmetic nicety. The @@ -5975,15 +5984,16 @@ rb_io_internal_encoding(VALUE io) /* * call-seq: - * io.set_encoding(enc) => io - * io.set_encoding(enc1, enc2) => io + * io.set_encoding(ext_enc) => io + * io.set_encoding("ext_enc:int_enc") => io + * io.set_encoding(ext_enc, int_enc) => io * - * If single argument is specified, read string from pipe is tagged - * with the encoding specified. If encoding is a comma separated two + * If single argument is specified, read string from io is tagged + * with the encoding specified. If encoding is a colon separated two * encoding names "A:B", the read string is converted from encoding A * (external encoding) to encoding B (internal encoding), then tagged * with B. If two arguments are specified, those must be encoding - * objects, and the first one is the external encoding, and the + * objects or encoding names, and the first one is the external encoding, and the * second one is the internal encoding. */ diff --git a/proc.c b/proc.c index 132fd3ab64..cc744b1e13 100644 --- a/proc.c +++ b/proc.c @@ -184,7 +184,7 @@ proc_clone(VALUE self) * * define_method always defines a method without the tricks, * even if a non-lambda Proc object is given. - * This is only the exception which the tricks is changed. + * This is the only exception which the tricks are not preserved. * * class C * define_method(:e, &proc {}) diff --git a/string.c b/string.c index 6a491ddabd..dfd2de0b4e 100644 --- a/string.c +++ b/string.c @@ -103,11 +103,11 @@ single_byte_optimizable(VALUE str) if (rb_enc_mbminlen(enc) == 1 && rb_enc_mbmaxlen(enc) == 1) return 1; - /* Not precise. It may be ENC_CODERANGE_UNKNOWN. */ + /* Conservative. It may be ENC_CODERANGE_UNKNOWN. */ if (ENC_CODERANGE(str) == ENC_CODERANGE_7BIT) return 1; - /* Not precise. Possibly single byte. + /* Conservative. Possibly single byte. * "\xa1" in Shift_JIS for example. */ return 0; }