1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[DOC] Integrate io_streams.rdoc into io.c (#6491)

Integrate io_streams.rdoc into io.c
This commit is contained in:
Burdette Lamar 2022-10-06 09:30:12 -05:00 committed by GitHub
parent cf3056be69
commit bbbdb574c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2022-10-06 23:30:40 +09:00
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>

47
io.c
View file

@ -2070,6 +2070,7 @@ io_writev(int argc, const VALUE *argv, VALUE io)
* Hello, World! * Hello, World!
* foobar2 * foobar2
* *
* Related: IO#read.
*/ */
static VALUE static VALUE
@ -3529,6 +3530,7 @@ io_write_nonblock(rb_execution_context_t *ec, VALUE io, VALUE str, VALUE ex)
* If you need the behavior like a single read(2) system call, * If you need the behavior like a single read(2) system call,
* consider #readpartial, #read_nonblock, and #sysread. * consider #readpartial, #read_nonblock, and #sysread.
* *
* Related: IO#write.
*/ */
static VALUE static VALUE
@ -4017,9 +4019,9 @@ rb_io_gets_internal(VALUE io)
* gets(limit, **line_opts) -> string or nil * gets(limit, **line_opts) -> string or nil
* gets(sep, limit, **line_opts) -> string or nil * gets(sep, limit, **line_opts) -> string or nil
* *
* Reads and returns a line from the stream * Reads and returns a line from the stream;
* (see {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO]);
* assigns the return value to <tt>$_</tt>. * assigns the return value to <tt>$_</tt>.
* See {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO].
* *
* With no arguments given, returns the next line * With no arguments given, returns the next line
* as determined by line separator <tt>$/</tt>, or +nil+ if none: * as determined by line separator <tt>$/</tt>, or +nil+ if none:
@ -4165,9 +4167,9 @@ static VALUE io_readlines(const struct getline_arg *arg, VALUE io);
* readlines(limit, **line_opts) -> array * readlines(limit, **line_opts) -> array
* readlines(sep, limit, **line_opts) -> array * readlines(sep, limit, **line_opts) -> array
* *
* Reads and returns all remaining line from the stream * Reads and returns all remaining line from the stream;
* (see {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO]);
* does not modify <tt>$_</tt>. * does not modify <tt>$_</tt>.
* See {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO].
* *
* With no arguments given, returns lines * With no arguments given, returns lines
* as determined by line separator <tt>$/</tt>, or +nil+ if none: * as determined by line separator <tt>$/</tt>, or +nil+ if none:
@ -4255,10 +4257,10 @@ io_readlines(const struct getline_arg *arg, VALUE io)
* each_line(sep, limit, **line_opts) {|line| ... } -> self * each_line(sep, limit, **line_opts) {|line| ... } -> self
* each_line -> enumerator * each_line -> enumerator
* *
* Calls the block with each remaining line read from the stream * Calls the block with each remaining line read from the stream;
* (see {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO]);
* does nothing if already at end-of-file; * does nothing if already at end-of-file;
* returns +self+. * returns +self+.
* See {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO].
* *
* With no arguments given, reads lines * With no arguments given, reads lines
* as determined by line separator <tt>$/</tt>: * as determined by line separator <tt>$/</tt>:
@ -4380,7 +4382,8 @@ rb_io_each_line(int argc, VALUE *argv, VALUE io)
* each_byte {|byte| ... } -> self * each_byte {|byte| ... } -> self
* each_byte -> enumerator * each_byte -> enumerator
* *
* Calls the given block with each byte (0..255) in the stream; returns +self+: * Calls the given block with each byte (0..255) in the stream; returns +self+.
* See {Byte IO}[rdoc-ref:io_streams.rdoc@Byte+IO].
* *
* f = File.new('t.rus') * f = File.new('t.rus')
* a = [] * a = []
@ -4527,7 +4530,8 @@ io_getc(rb_io_t *fptr, rb_encoding *enc)
* each_char {|c| ... } -> self * each_char {|c| ... } -> self
* each_char -> enumerator * each_char -> enumerator
* *
* Calls the given block with each character in the stream; returns +self+: * Calls the given block with each character in the stream; returns +self+.
* See {Character IO}[rdoc-ref:io_streams.rdoc@Character+IO].
* *
* f = File.new('t.rus') * f = File.new('t.rus')
* a = [] * a = []
@ -4688,7 +4692,8 @@ rb_io_each_codepoint(VALUE io)
* getc -> character or nil * getc -> character or nil
* *
* Reads and returns the next 1-character string from the stream; * Reads and returns the next 1-character string from the stream;
* returns +nil+ if already at end-of-file: * returns +nil+ if already at end-of-file.
* See {Character IO}[rdoc-ref:io_streams.rdoc@Character+IO].
* *
* f = File.open('t.txt') * f = File.open('t.txt')
* f.getc # => "F" * f.getc # => "F"
@ -4720,7 +4725,8 @@ rb_io_getc(VALUE io)
* readchar -> string * readchar -> string
* *
* Reads and returns the next 1-character string from the stream; * Reads and returns the next 1-character string from the stream;
* raises EOFError if already at end-of-file: * raises EOFError if already at end-of-file.
* See {Character IO}[rdoc-ref:io_streams.rdoc@Character+IO].
* *
* f = File.open('t.txt') * f = File.open('t.txt')
* f.readchar # => "F" * f.readchar # => "F"
@ -4749,7 +4755,8 @@ rb_io_readchar(VALUE io)
* getbyte -> integer or nil * getbyte -> integer or nil
* *
* Reads and returns the next byte (in range 0..255) from the stream; * Reads and returns the next byte (in range 0..255) from the stream;
* returns +nil+ if already at end-of-file: * returns +nil+ if already at end-of-file.
* See {Byte IO}[rdoc-ref:io_streams.rdoc@Byte+IO].
* *
* f = File.open('t.txt') * f = File.open('t.txt')
* f.getbyte # => 70 * f.getbyte # => 70
@ -4793,7 +4800,8 @@ rb_io_getbyte(VALUE io)
* readbyte -> integer * readbyte -> integer
* *
* Reads and returns the next byte (in range 0..255) from the stream; * Reads and returns the next byte (in range 0..255) from the stream;
* raises EOFError if already at end-of-file: * raises EOFError if already at end-of-file.
* See {Byte IO}[rdoc-ref:io_streams.rdoc@Byte+IO].
* *
* f = File.open('t.txt') * f = File.open('t.txt')
* f.readbyte # => 70 * f.readbyte # => 70
@ -4824,10 +4832,11 @@ rb_io_readbyte(VALUE io)
* *
* Pushes back ("unshifts") the given data onto the stream's buffer, * Pushes back ("unshifts") the given data onto the stream's buffer,
* placing the data so that it is next to be read; returns +nil+. * placing the data so that it is next to be read; returns +nil+.
* See {Byte IO}[rdoc-ref:io_streams.rdoc@Byte+IO].
* *
* Note that: * Note that:
* *
* - Calling the method hs no effect with unbuffered reads (such as IO#sysread). * - Calling the method has no effect with unbuffered reads (such as IO#sysread).
* - Calling #rewind on the stream discards the pushed-back data. * - Calling #rewind on the stream discards the pushed-back data.
* *
* When argument +integer+ is given, uses only its low-order byte: * When argument +integer+ is given, uses only its low-order byte:
@ -4884,10 +4893,11 @@ rb_io_ungetbyte(VALUE io, VALUE b)
* *
* Pushes back ("unshifts") the given data onto the stream's buffer, * Pushes back ("unshifts") the given data onto the stream's buffer,
* placing the data so that it is next to be read; returns +nil+. * placing the data so that it is next to be read; returns +nil+.
* See {Character IO}[rdoc-ref:io_streams.rdoc@Character+IO].
* *
* Note that: * Note that:
* *
* - Calling the method hs no effect with unbuffered reads (such as IO#sysread). * - Calling the method has no effect with unbuffered reads (such as IO#sysread).
* - Calling #rewind on the stream discards the pushed-back data. * - Calling #rewind on the stream discards the pushed-back data.
* *
* When argument +integer+ is given, interprets the integer as a character: * When argument +integer+ is given, interprets the integer as a character:
@ -5456,6 +5466,7 @@ rb_io_close(VALUE io)
* *
* If the stream was opened by IO.popen, #close sets global variable <tt>$?</tt>. * If the stream was opened by IO.popen, #close sets global variable <tt>$?</tt>.
* *
* See also {Open and Closed Streams}[rdoc-ref:io_streams.rdoc@Open+and+Closed+Streams].
*/ */
static VALUE static VALUE
@ -5515,6 +5526,8 @@ io_close(VALUE io)
* f.close_read # => nil * f.close_read # => nil
* f.closed? # => true * f.closed? # => true
* *
*
* See also {Open and Closed Streams}[rdoc-ref:io_streams.rdoc@Open+and+Closed+Streams].
*/ */
@ -5548,6 +5561,8 @@ rb_io_closed(VALUE io)
* f.close_read * f.close_read
* f.readlines # Raises IOError * f.readlines # Raises IOError
* *
* See also {Open and Closed Streams}[rdoc-ref:io_streams.rdoc@Open+and+Closed+Streams].
*
* Raises an exception if the stream is not duplexed. * Raises an exception if the stream is not duplexed.
* *
*/ */
@ -5604,6 +5619,7 @@ rb_io_close_read(VALUE io)
* f.close_write * f.close_write
* f.print 'nowhere' # Raises IOError. * f.print 'nowhere' # Raises IOError.
* *
* See also {Open and Closed Streams}[rdoc-ref:io_streams.rdoc@Open+and+Closed+Streams].
*/ */
static VALUE static VALUE
@ -8322,6 +8338,7 @@ deprecated_str_setter(VALUE val, ID id, VALUE *var)
* Writes the given objects to the stream; returns +nil+. * Writes the given objects to the stream; returns +nil+.
* Appends the output record separator <tt>$OUTPUT_RECORD_SEPARATOR</tt> * Appends the output record separator <tt>$OUTPUT_RECORD_SEPARATOR</tt>
* (<tt>$\\</tt>), if it is not +nil+. * (<tt>$\\</tt>), if it is not +nil+.
* See {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO].
* *
* With argument +objects+ given, for each object: * With argument +objects+ given, for each object:
* *
@ -8459,6 +8476,7 @@ rb_f_print(int argc, const VALUE *argv, VALUE _)
* putc(object) -> object * putc(object) -> object
* *
* Writes a character to the stream. * Writes a character to the stream.
* See {Character IO}[rdoc-ref:io_streams.rdoc@Character+IO].
* *
* If +object+ is numeric, converts to integer if necessary, * If +object+ is numeric, converts to integer if necessary,
* then writes the character whose code is the * then writes the character whose code is the
@ -8562,6 +8580,7 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
* returns +nil+.\ * returns +nil+.\
* Writes a newline after each that does not already end with a newline sequence. * Writes a newline after each that does not already end with a newline sequence.
* If called without arguments, writes a newline. * If called without arguments, writes a newline.
* See {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO].
* *
* Note that each added newline is the character <tt>"\n"<//tt>, * Note that each added newline is the character <tt>"\n"<//tt>,
* not the output record separator (<tt>$\\</tt>). * not the output record separator (<tt>$\\</tt>).