Ruby
3.4.0dev (2024-11-05 revision 348a53415339076afc4a02fcd09f3ae36e9c4c61)
|
Public APIs related to rb_cRange. More...
#include "ruby/internal/attr/nonnull.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"
Go to the source code of this file.
Functions | |
VALUE | rb_range_new (VALUE beg, VALUE end, int excl) |
Creates a new Range. More... | |
VALUE | rb_range_beg_len (VALUE range, long *begp, long *lenp, long len, int err) |
Deconstructs a numerical range. More... | |
int | rb_range_values (VALUE range, VALUE *begp, VALUE *endp, int *exclp) |
Deconstructs a range into its components. More... | |
Public APIs related to rb_cRange.
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98. Definition in file range.h.
Deconstructs a numerical range.
As the arguments are long
based, it expects everything are in the long
domain.
[in] | range | A range of numerical endpoints. |
[out] | begp | Return value buffer. |
[out] | lenp | Return value buffer. |
[in] | len | Updated length. |
[in] | err | In case len is out of range...
|
rb_eTypeError | range is not a numerical range. |
rb_eRangeError | range cannot fit into long . |
RUBY_Qfalse | range is not an rb_cRange. |
RUBY_Qnil | len is out of range but err is zero. |
RUBY_Qtrue | Otherwise. |
beg
is the (possibly updated) left endpoint. len
is the (possibly updated) length of the range. Creates a new Range.
[in] | beg | "Left" or "lowest" endpoint of the range. |
[in] | end | "Right" or "highest" endpoint of the range. |
[in] | excl | Whether the range is open-ended. |
rb_eArgError | beg and end are not comparable. |
Deconstructs a range into its components.
[in] | range | Range or range-ish object. |
[out] | begp | Return value buffer. |
[out] | endp | Return value buffer. |
[out] | exclp | Return value buffer. |
RUBY_Qfalse | range is not an instance of rb_cRange. |
RUBY_Qtrue | Argument pointers are updated. |
*begp
is the left endpoint of the range. *endp
is the right endpoint of the range. *exclp
is whether the range is open-ended or not. Definition at line 1754 of file range.c.
Referenced by rb_arithmetic_sequence_extract(), and rb_range_beg_len().