diff --git a/complex.c b/complex.c index 72e13b4e2ecde2..1fe68f80bebb97 100644 --- a/complex.c +++ b/complex.c @@ -1260,14 +1260,16 @@ nucomp_real_p(VALUE self) /* * call-seq: - * complex <=> object -> -1, 0, 1, or nil + * self <=> other -> -1, 0, 1, or nil + * + * Compares +self+ and +other+. * * Returns: * - * - self.real <=> object.real if both of the following are true: + * - self.real <=> other.real if both of the following are true: * * - self.imag == 0. - * - object.imag == 0. # Always true if object is numeric but not complex. + * - other.imag == 0 (always true if +other+ is numeric but not complex). * * - +nil+ otherwise. * @@ -1280,6 +1282,8 @@ nucomp_real_p(VALUE self) * Complex.rect(1) <=> Complex.rect(1, 1) # => nil # object.imag not zero. * Complex.rect(1) <=> 'Foo' # => nil # object.imag not defined. * + * \Class \Complex includes module Comparable, + * each of whose methods uses Complex#<=> for comparison. */ static VALUE nucomp_cmp(VALUE self, VALUE other) diff --git a/doc/jit/zjit.md b/doc/jit/zjit.md index b5a2f05604983f..c94270554fd349 100644 --- a/doc/jit/zjit.md +++ b/doc/jit/zjit.md @@ -47,7 +47,7 @@ ZJIT. Refer to [Building Ruby](rdoc-ref:contributing/building_ruby.md) for general build prerequists. Additionally, ZJIT requires Rust 1.85.0 or later. Release builds need only `rustc`. Development -builds require `cargo` and may download dependencies. +builds require `cargo` and may download dependencies. GNU Make is required. ### For normal use @@ -352,7 +352,7 @@ Ruby execution involves three distinct stacks and understanding them will help y The Ruby VM uses a single contiguous memory region (`ec->vm_stack`) containing two sub-stacks that grow toward each other. When they meet, stack overflow occurs. -See [doc/contributing/vm_stack_and_frames.md](contributing/vm_stack_and_frames.md) for detailed architecture and frame layout. +See [doc/contributing/vm_stack_and_frames.md](rdoc-ref:contributing/vm_stack_and_frames.md) for detailed architecture and frame layout. **Control Frame Stack:** diff --git a/io.c b/io.c index 99268e8f05b1a4..42017b1c253035 100644 --- a/io.c +++ b/io.c @@ -2659,9 +2659,6 @@ io_fillbuf(rb_io_t *fptr) fptr->rbuf.len = 0; fptr->rbuf.capa = IO_RBUF_CAPA_FOR(fptr); fptr->rbuf.ptr = ALLOC_N(char, fptr->rbuf.capa); -#ifdef _WIN32 - fptr->rbuf.capa--; -#endif } if (fptr->rbuf.len == 0) { retry: @@ -3329,10 +3326,6 @@ io_shift_cbuf(rb_io_t *fptr, int len, VALUE *strp) static int io_setstrbuf(VALUE *str, long len) { -#ifdef _WIN32 - if (len > 0) - len = (len + 1) & ~1L; /* round up for wide char */ -#endif if (NIL_P(*str)) { *str = rb_str_new(0, len); return TRUE; diff --git a/numeric.c b/numeric.c index a71060c55db252..87d50ae4a1b9e8 100644 --- a/numeric.c +++ b/numeric.c @@ -1468,10 +1468,17 @@ num_eql(VALUE x, VALUE y) * call-seq: * self <=> other -> zero or nil * - * Returns zero if +self+ is the same as +other+, +nil+ otherwise. + * Compares +self+ and +other+. * - * No subclass in the Ruby Core or Standard Library uses this implementation. + * Returns: + * + * - Zero, if +self+ is the same as +other+. + * - +nil+, otherwise. + * + * \Class \Numeric includes module Comparable, + * each of whose methods uses Numeric#<=> for comparison. * + * No subclass in the Ruby Core or Standard Library uses this implementation. */ static VALUE @@ -1561,30 +1568,32 @@ rb_dbl_cmp(double a, double b) /* * call-seq: - * self <=> other -> -1, 0, +1, or nil + * self <=> other -> -1, 0, 1, or nil + * + * Compares +self+ and +other+. * - * Returns a value that depends on the numeric relation - * between +self+ and +other+: + * Returns: * - * - -1, if +self+ is less than +other+. - * - 0, if +self+ is equal to +other+. - * - 1, if +self+ is greater than +other+. + * - +-1+, if +self+ is less than +other+. + * - +0+, if +self+ is equal to +other+. + * - +1+, if +self+ is greater than +other+. * - +nil+, if the two values are incommensurate. * * Examples: * + * 2.0 <=> 2.1 # => -1 * 2.0 <=> 2 # => 0 * 2.0 <=> 2.0 # => 0 * 2.0 <=> Rational(2, 1) # => 0 * 2.0 <=> Complex(2, 0) # => 0 * 2.0 <=> 1.9 # => 1 - * 2.0 <=> 2.1 # => -1 * 2.0 <=> 'foo' # => nil * - * This is the basis for the tests in the Comparable module. - * * Float::NAN <=> Float::NAN returns an implementation-dependent value. * + * \Class \Float includes module Comparable, + * each of whose methods uses Float#<=> for comparison. + * */ static VALUE @@ -4888,28 +4897,29 @@ fix_cmp(VALUE x, VALUE y) /* * call-seq: - * self <=> other -> -1, 0, +1, or nil + * self <=> other -> -1, 0, 1, or nil + * + * Compares +self+ and +other+. * * Returns: * - * - -1, if +self+ is less than +other+. - * - 0, if +self+ is equal to +other+. - * - 1, if +self+ is greater then +other+. + * - +-1+, if +self+ is less than +other+. + * - +0+, if +self+ is equal to +other+. + * - +1+, if +self+ is greater then +other+. * - +nil+, if +self+ and +other+ are incomparable. * * Examples: * * 1 <=> 2 # => -1 * 1 <=> 1 # => 0 - * 1 <=> 0 # => 1 - * 1 <=> 'foo' # => nil - * * 1 <=> 1.0 # => 0 * 1 <=> Rational(1, 1) # => 0 * 1 <=> Complex(1, 0) # => 0 + * 1 <=> 0 # => 1 + * 1 <=> 'foo' # => nil * - * This method is the basis for comparisons in module Comparable. - * + * \Class \Integer includes module Comparable, + * each of whose methods uses Integer#<=> for comparison. */ VALUE diff --git a/signal.c b/signal.c index 12af9058a25439..5110ea4401a4be 100644 --- a/signal.c +++ b/signal.c @@ -1346,31 +1346,36 @@ reserved_signal_p(int signo) /* * call-seq: - * Signal.trap( signal, command ) -> obj - * Signal.trap( signal ) {| | block } -> obj + * Signal.trap(signal, command) -> obj + * Signal.trap(signal) { ... } -> obj * - * Specifies the handling of signals. The first parameter is a signal - * name (a string such as ``SIGALRM'', ``SIGUSR1'', and so on) or a - * signal number. The characters ``SIG'' may be omitted from the - * signal name. The command or block specifies code to be run when the + * Specifies the handling of signals. Returns the previous handler for + * the given signal. + * + * Argument +signal+ is a signal name (a string or symbol such + * as +SIGALRM+ or +SIGUSR1+) or an integer signal number. When +signal+ + * is a string or symbol, the leading characters +SIG+ may be omitted. + * + * Argument +command+ or block provided specifies code to be run when the * signal is raised. - * If the command is the string ``IGNORE'' or ``SIG_IGN'', the signal - * will be ignored. - * If the command is ``DEFAULT'' or ``SIG_DFL'', the Ruby's default handler - * will be invoked. - * If the command is ``EXIT'', the script will be terminated by the signal. - * If the command is ``SYSTEM_DEFAULT'', the operating system's default - * handler will be invoked. - * Otherwise, the given command or block will be run. - * The special signal name ``EXIT'' or signal number zero will be - * invoked just prior to program termination. - * trap returns the previous handler for the given signal. + * + * Argument +command+ may also be a string or symbol with the following special + * values: + * + * - +IGNORE+, +SIG_IGN+: the signal will be ignored. + * - +DEFAULT+, +SIG_DFL+: Ruby's default handler will be invoked. + * - +EXIT+: the process will be terminated by the signal. + * - +SYSTEM_DEFAULT+: the operating system's default handler will be invoked. + * + * The special signal name +EXIT+ or signal number zero will be + * invoked just prior to program termination: * * Signal.trap(0, proc { puts "Terminating: #{$$}" }) * Signal.trap("CLD") { puts "Child died" } * fork && Process.wait * - * produces: + * Outputs: + * * Terminating: 27461 * Child died * Terminating: 27460 diff --git a/string.c b/string.c index b11b441ac58536..83219d1a26d085 100644 --- a/string.c +++ b/string.c @@ -12374,18 +12374,24 @@ sym_succ(VALUE sym) /* * call-seq: - * symbol <=> object -> -1, 0, +1, or nil + * self <=> other -> -1, 0, 1, or nil + * + * Compares +self+ and +other+, using String#<=>. * - * If +object+ is a symbol, - * returns the equivalent of symbol.to_s <=> object.to_s: + * Returns: * - * :bar <=> :foo # => -1 - * :foo <=> :foo # => 0 - * :foo <=> :bar # => 1 + * - symbol.to_s <=> other.to_s, if +other+ is a symbol. + * - +nil+, otherwise. + * + * Examples: * - * Otherwise, returns +nil+: + * :bar <=> :foo # => -1 + * :foo <=> :foo # => 0 + * :foo <=> :bar # => 1 + * :foo <=> 'bar' # => nil * - * :foo <=> 'bar' # => nil + * \Class \Symbol includes module Comparable, + * each of whose methods uses Symbol#<=> for comparison. * * Related: String#<=>. */ diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 3f905aa1d8caa2..83d4fb0c7b525e 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -2724,8 +2724,8 @@ def test_pos_dont_move_cursor_position def test_pos_with_buffer_end_cr bug6401 = '[ruby-core:44874]' with_tmpdir { - # Read buffer size is 8191. This generates '\r' at 8191. - lines = ["X" * 8187, "X"] + # Read buffer size is 8192. This generates '\r' at 8192. + lines = ["X" * 8188, "X"] generate_file("tmp", lines.join("\r\n") + "\r\n") open("tmp", "r") do |f|