Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
* - <tt>self.real <=> object.real</tt> if both of the following are true:
* - <tt>self.real <=> other.real</tt> if both of the following are true:
*
* - <tt>self.imag == 0</tt>.
* - <tt>object.imag == 0</tt>. # Always true if object is numeric but not complex.
* - <tt>other.imag == 0</tt> (always true if +other+ is numeric but not complex).
*
* - +nil+ otherwise.
*
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions doc/jit/zjit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:**

Expand Down
7 changes: 0 additions & 7 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
50 changes: 30 additions & 20 deletions numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
*
* <tt>Float::NAN <=> Float::NAN</tt> returns an implementation-dependent value.
*
* \Class \Float includes module Comparable,
* each of whose methods uses Float#<=> for comparison.
*
*/

static VALUE
Expand Down Expand Up @@ -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
Expand Down
41 changes: 23 additions & 18 deletions signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
* <em>produces:</em>
* Outputs:
*
* Terminating: 27461
* Child died
* Terminating: 27460
Expand Down
22 changes: 14 additions & 8 deletions string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tt>symbol.to_s <=> object.to_s</tt>:
* Returns:
*
* :bar <=> :foo # => -1
* :foo <=> :foo # => 0
* :foo <=> :bar # => 1
* - <tt>symbol.to_s <=> other.to_s</tt>, 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#<=>.
*/
Expand Down
4 changes: 2 additions & 2 deletions test/ruby/test_io_m17n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down