Ruby 4.1.0dev (2026-10-14 revision 186aa9afd18af33339feb7e5066de5c7dc2e1f32)
range.h
1#ifndef INTERNAL_RANGE_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_RANGE_H
11#include "internal/struct.h" /* for RSTRUCT */
12
13#define RANGE_FL_INIT FL_USER18
14#define RANGE_FL_EXCL FL_USER19
15
16/* range.c */
17static inline VALUE RANGE_BEG(VALUE r);
18static inline VALUE RANGE_END(VALUE r);
19static inline VALUE RANGE_EXCL(VALUE r);
20
21static inline VALUE
22RANGE_BEG(VALUE r)
23{
24 return RSTRUCT_GET_RAW(r, 0);
25}
26
27static inline VALUE
28RANGE_END(VALUE r)
29{
30 return RSTRUCT_GET_RAW(r, 1);
31}
32
33static inline VALUE
34RANGE_EXCL(VALUE r)
35{
36 if (FL_TEST_RAW(r, RANGE_FL_INIT)) {
37 return RBOOL(FL_TEST_RAW(r, RANGE_FL_EXCL));
38 }
39 return Qnil;
40}
41
43rb_range_component_beg_len(VALUE b, VALUE e, int excl,
44 rb_len_t *begp, rb_len_t *lenp, rb_len_t len, int err);
45
46#endif /* INTERNAL_RANGE_H */
#define FL_TEST_RAW
Old name of RB_FL_TEST_RAW.
Definition fl_type.h:128
#define Qnil
Old name of RUBY_Qnil.
int len
Length of the buffer.
Definition io.h:8
long rb_len_t
A signed integer type for lengths and indices of objects such as String and Array.
Definition value.h:131
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40