Ruby
3.4.0dev (2024-11-22 revision 0989400a925cd201defdca9eb28eb87200b30785)
|
Routines for code ranges. More...
#include "ruby/internal/attr/const.h"
#include "ruby/internal/attr/pure.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/fl_type.h"
#include "ruby/internal/value.h"
Go to the source code of this file.
Enumerations | |
enum | ruby_coderange_type { RUBY_ENC_CODERANGE_UNKNOWN = 0 , RUBY_ENC_CODERANGE_7BIT = ((int)RUBY_FL_USER8) , RUBY_ENC_CODERANGE_VALID = ((int)RUBY_FL_USER9) , RUBY_ENC_CODERANGE_BROKEN = ((int)(RUBY_FL_USER8|RUBY_FL_USER9)) , RUBY_ENC_CODERANGE_MASK } |
What rb_enc_str_coderange() returns. More... | |
Functions | |
static bool | RB_ENC_CODERANGE_CLEAN_P (enum ruby_coderange_type cr) |
Queries if a code range is "clean". More... | |
static enum ruby_coderange_type | RB_ENC_CODERANGE (VALUE obj) |
Queries the (inline) code range of the passed object. More... | |
static bool | RB_ENC_CODERANGE_ASCIIONLY (VALUE obj) |
Queries the (inline) code range of the passed object is RUBY_ENC_CODERANGE_7BIT. More... | |
static void | RB_ENC_CODERANGE_SET (VALUE obj, enum ruby_coderange_type cr) |
Destructively modifies the passed object so that its (inline) code range is the passed one. More... | |
static void | RB_ENC_CODERANGE_CLEAR (VALUE obj) |
Destructively clears the passed object's (inline) code range. More... | |
static enum ruby_coderange_type | RB_ENC_CODERANGE_AND (enum ruby_coderange_type a, enum ruby_coderange_type b) |
"Mix" two code ranges into one. More... | |
Routines for code ranges.
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 coderange.h.
enum ruby_coderange_type |
What rb_enc_str_coderange() returns.
Definition at line 33 of file coderange.h.
|
inlinestatic |
Queries the (inline) code range of the passed object.
The object must be capable of having inline encoding. Using this macro needs deep understanding of bit level object binary layout.
[in] | obj | Target object. |
Definition at line 80 of file coderange.h.
Referenced by RB_ENC_CODERANGE_ASCIIONLY().
|
inlinestatic |
"Mix" two code ranges into one.
This is handy for instance when you concatenate two strings into one. Consider one of then is valid but the other isn't. The result must be invalid. This macro computes that kind of mixture.
[in] | a | An enum ruby_coderange_type. |
[in] | b | Another enum ruby_coderange_type. |
a
"and" b
. Definition at line 144 of file coderange.h.
Referenced by rb_str_buf_append().
|
inlinestatic |
Queries the (inline) code range of the passed object is RUBY_ENC_CODERANGE_7BIT.
The object must be capable of having inline encoding. Using this macro needs deep understanding of bit level object binary layout.
[in] | obj | Target object. |
1 | It is ascii only. |
0 | Otherwise (including cases when the range is not known). |
Definition at line 114 of file coderange.h.
|
inlinestatic |
Queries if a code range is "clean".
"Clean" in this context means it is known and valid.
[in] | cr | An enum ruby_coderange_type. |
1 | It is. |
0 | It isn't. |
Definition at line 80 of file coderange.h.
|
inlinestatic |
Destructively clears the passed object's (inline) code range.
The object must be capable of having inline encoding. Using this macro needs deep understanding of bit level object binary layout.
[out] | obj | Target object. |
obj
's code range is RUBY_ENC_CODERANGE_UNKNOWN. Definition at line 144 of file coderange.h.
|
inlinestatic |
Destructively modifies the passed object so that its (inline) code range is the passed one.
The object must be capable of having inline encoding. Using this macro needs deep understanding of bit level object binary layout.
[out] | obj | Target object. |
[out] | cr | An enum ruby_coderange_type. |
obj
's code range is cr
. Definition at line 129 of file coderange.h.
Referenced by RB_ENCODING_CODERANGE_SET().