Ruby
2.5.0dev(2017-10-22revision60238)
|
#include "internal.h"
#include "ruby/re.h"
#include "encindex.h"
#include "probes.h"
#include "gc.h"
#include "ruby_assert.h"
#include "id.h"
#include "debug_counter.h"
#include <math.h>
#include <ctype.h>
#include "missing/crypt.h"
Go to the source code of this file.
Data Structures | |
struct | mapping_buffer |
struct | tr |
Macros | |
#define | BEG(no) (regs->beg[(no)]) |
#define | END(no) (regs->end[(no)]) |
#define | HAVE_CRYPT_R 1 |
#define | STRING_ENUMERATORS_WANTARRAY 0 /* next major */ |
#define | RUBY_MAX_CHAR_LEN 16 |
#define | STR_IS_SHARED_M FL_USER6 |
#define | STR_TMPLOCK FL_USER7 |
#define | STR_NOFREE FL_USER18 |
#define | STR_FAKESTR FL_USER19 |
#define | STR_SET_NOEMBED(str) |
#define | STR_SET_EMBED(str) FL_UNSET((str), (STR_NOEMBED|STR_NOFREE)) |
#define | STR_SET_EMBED_LEN(str, n) |
#define | STR_SET_LEN(str, n) |
#define | STR_DEC_LEN(str) |
#define | TERM_LEN(str) rb_enc_mbminlen(rb_enc_get(str)) |
#define | TERM_FILL(ptr, termlen) |
#define | RESIZE_CAPA(str, capacity) |
#define | RESIZE_CAPA_TERM(str, capacity, termlen) |
#define | STR_SET_SHARED(str, shared_str) |
#define | STR_HEAP_PTR(str) (RSTRING(str)->as.heap.ptr) |
#define | STR_HEAP_SIZE(str) ((size_t)RSTRING(str)->as.heap.aux.capa + TERM_LEN(str)) |
#define | STR_ENC_GET(str) get_encoding(str) |
#define | SHARABLE_MIDDLE_SUBSTRING 0 |
#define | SHARABLE_SUBSTRING_P(beg, len, end) ((beg) + (len) == (end)) |
#define | STR_EMBEDDABLE_P(len, termlen) ((len) <= RSTRING_EMBED_LEN_MAX + 1 - (termlen)) |
#define | BARE_STRING_P(str) (!FL_ANY_RAW(str, FL_TAINT|FL_EXIVAR) && RBASIC_CLASS(str) == rb_cString) |
#define | STR_BUF_MIN_SIZE 127 |
#define | rb_str_dup_frozen rb_str_new_frozen |
#define | str_buf_cat2(str, ptr) str_buf_cat((str), (ptr), strlen(ptr)) |
#define | MIN_PRE_ALLOC_SIZE 48 |
#define | lesser(a, b) (((a)>(b))?(b):(a)) |
#define | rb_str_index(str, sub, offset) rb_strseq_index(str, sub, offset, 0) |
#define | rb_str_splice(str, beg, len, val) rb_str_update(str, beg, len, val) |
#define | CHAR_ESC_LEN 13 /* sizeof(\x{ hex of 32bit unsigned int } \0) */ |
#define | IS_EVSTR(p, e) ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{')) |
#define | CASE_MAPPING_ADDITIONAL_LENGTH 20 |
#define | CASEMAP_DEBUG 0 |
#define | CHECK_IF_ASCII(c) |
#define | TR_TABLE_SIZE 257 |
#define | ascii_isspace(c) isspacetable[(unsigned char)(c)] |
#define | WANTARRAY(m, size) (enumerator_wantarray(m) ? rb_ary_new_capa(size) : 0) |
#define | ENUM_ELEM(ary, e) enumerator_element(ary, e) |
#define | DEFAULT_REPLACE_CHAR(str) |
#define | sym_equal rb_obj_equal |
#define | rb_intern(str) rb_intern_const(str) |
Typedefs | |
typedef struct mapping_buffer | mapping_buffer |
typedef unsigned char * | USTR |
Enumerations | |
enum | neighbor_char { NEIGHBOR_NOT_CHAR, NEIGHBOR_FOUND, NEIGHBOR_WRAPPED } |
Variables | |
VALUE | rb_cString |
VALUE | rb_cSymbol |
const struct st_hash_type | rb_fstring_hash_type |
VALUE | rb_fs |
#define ascii_isspace | ( | c | ) | isspacetable[(unsigned char)(c)] |
#define BARE_STRING_P | ( | str | ) | (!FL_ANY_RAW(str, FL_TAINT|FL_EXIVAR) && RBASIC_CLASS(str) == rb_cString) |
Definition at line 259 of file string.c.
Referenced by rb_fstring().
#define CHAR_ESC_LEN 13 /* sizeof(\x{ hex of 32bit unsigned int } \0) */ |
Definition at line 5701 of file string.c.
Referenced by rb_str_escape(), and rb_str_inspect().
#define CHECK_IF_ASCII | ( | c | ) |
#define DEFAULT_REPLACE_CHAR | ( | str | ) |
#define IS_EVSTR | ( | p, | |
e | |||
) | ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{')) |
#define lesser | ( | a, | |
b | |||
) | (((a)>(b))?(b):(a)) |
Definition at line 3131 of file string.c.
Referenced by rb_str_cmp().
#define MIN_PRE_ALLOC_SIZE 48 |
Definition at line 2906 of file string.c.
Referenced by rb_str_concat_literals().
#define rb_intern | ( | str | ) | rb_intern_const(str) |
#define rb_str_dup_frozen rb_str_new_frozen |
#define rb_str_splice | ( | str, | |
beg, | |||
len, | |||
val | |||
) | rb_str_update(str, beg, len, val) |
#define RESIZE_CAPA | ( | str, | |
capacity | |||
) |
#define RESIZE_CAPA_TERM | ( | str, | |
capacity, | |||
termlen | |||
) |
Definition at line 170 of file string.c.
Referenced by rb_str_subseq().
#define str_buf_cat2 | ( | str, | |
ptr | |||
) | str_buf_cat((str), (ptr), strlen(ptr)) |
#define STR_DEC_LEN | ( | str | ) |
#define STR_EMBEDDABLE_P | ( | len, | |
termlen | |||
) | ((len) <= RSTRING_EMBED_LEN_MAX + 1 - (termlen)) |
Definition at line 175 of file string.c.
Referenced by rb_str_subseq().
#define STR_ENC_GET | ( | str | ) | get_encoding(str) |
Definition at line 164 of file string.c.
Referenced by rb_enc_str_asciionly_p(), rb_enc_str_scrub(), rb_str_concat(), rb_str_conv_enc_opts(), rb_str_export(), rb_str_export_locale(), rb_str_export_to_enc(), rb_str_include_range_p(), rb_str_ord(), rb_str_quote_unprintable(), rb_str_scrub(), rb_str_subpos(), and rb_str_symname_p().
#define STR_HEAP_PTR | ( | str | ) | (RSTRING(str)->as.heap.ptr) |
Definition at line 161 of file string.c.
Referenced by rb_str_free().
Definition at line 162 of file string.c.
Referenced by rb_str_free(), and rb_str_memsize().
#define STR_IS_SHARED_M FL_USER6 |
Definition at line 84 of file string.c.
Referenced by rb_str_tmp_frozen_release().
#define STR_NOFREE FL_USER18 |
Definition at line 86 of file string.c.
Referenced by rb_str_free(), rb_str_memsize(), and rb_str_tmp_frozen_release().
#define STR_SET_EMBED | ( | str | ) | FL_UNSET((str), (STR_NOEMBED|STR_NOFREE)) |
#define STR_SET_EMBED_LEN | ( | str, | |
n | |||
) |
#define STR_SET_LEN | ( | str, | |
n | |||
) |
Definition at line 100 of file string.c.
Referenced by rb_str_cat_conv_enc_opts(), and rb_str_initialize().
#define STR_SET_NOEMBED | ( | str | ) |
#define STR_SET_SHARED | ( | str, | |
shared_str | |||
) |
#define STR_TMPLOCK FL_USER7 |
Definition at line 85 of file string.c.
Referenced by rb_str_tmp_frozen_release(), rb_str_unlocktmp(), and RUBY_ALIAS_FUNCTION().
#define TERM_FILL | ( | ptr, | |
termlen | |||
) |
#define TERM_LEN | ( | str | ) | rb_enc_mbminlen(rb_enc_get(str)) |
Definition at line 120 of file string.c.
Referenced by rb_str_modify_expand(), rb_str_set_len(), and rb_str_subseq().
#define WANTARRAY | ( | m, | |
size | |||
) | (enumerator_wantarray(m) ? rb_ary_new_capa(size) : 0) |
typedef struct mapping_buffer mapping_buffer |
enum neighbor_char |
void Init_String | ( | void | ) |
Definition at line 10529 of file string.c.
References assert, rb_cObject, rb_cString, rb_define_class(), rb_vm_fstring_table(), and st_foreach.
Definition at line 2246 of file string.c.
References rb_check_convert_type_with_id(), and T_STRING.
Referenced by rb_check_id(), rb_num_get_rounding_option(), rb_str_include_range_p(), rb_String(), and rb_threadptr_error_print().
char* rb_enc_nth | ( | const char * | p, |
const char * | e, | ||
long | nth, | ||
rb_encoding * | enc | ||
) |
Definition at line 2320 of file string.c.
Referenced by rb_str_ellipsize().
int rb_enc_str_asciionly_p | ( | VALUE | str | ) |
Definition at line 641 of file string.c.
References ENC_CODERANGE_7BIT, FALSE, rb_enc_asciicompat, rb_enc_str_coderange(), STR_ENC_GET, and TRUE.
Referenced by rb_inspect(), and rb_reg_quote().
VALUE rb_enc_str_buf_cat | ( | VALUE | str, |
const char * | ptr, | ||
long | len, | ||
rb_encoding * | ptr_enc | ||
) |
Definition at line 2853 of file string.c.
References ENC_CODERANGE_UNKNOWN, NULL, and rb_enc_to_index().
Referenced by rb_reg_regsub().
int rb_enc_str_coderange | ( | VALUE | str | ) |
Definition at line 621 of file string.c.
References ENC_CODERANGE, ENC_CODERANGE_BROKEN, ENC_CODERANGE_UNKNOWN, ENCODING_GET, rb_enc_dummy_p(), rb_enc_from_index(), and rb_enc_mbminlen.
Referenced by rb_enc_str_asciionly_p(), rb_external_str_with_enc(), rb_reg_fragment_setenc(), rb_str_comparable(), and rb_str_hash().
VALUE rb_enc_str_new | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 759 of file string.c.
References rb_str_new().
Referenced by rb_enc_uint_chr(), rb_syntax_error_append(), and rb_w32_conv_from_wchar().
VALUE rb_enc_str_new_cstr | ( | const char * | ptr, |
rb_encoding * | enc | ||
) |
VALUE rb_enc_str_new_static | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | enc | ||
) |
VALUE rb_enc_str_scrub | ( | rb_encoding * | enc, |
VALUE | str, | ||
VALUE | repl | ||
) |
Definition at line 9645 of file string.c.
References ENC_CODERANGE, ENC_CODERANGE_UNKNOWN, and STR_ENC_GET.
long rb_enc_strlen | ( | const char * | p, |
const char * | e, | ||
rb_encoding * | enc | ||
) |
long rb_enc_strlen_cr | ( | const char * | p, |
const char * | e, | ||
rb_encoding * | enc, | ||
int * | cr | ||
) |
Definition at line 1709 of file string.c.
References rb_enc_mbmaxlen, and rb_enc_mbminlen.
Definition at line 1055 of file string.c.
References rb_default_external_encoding(), and rb_external_str_new_with_enc().
Definition at line 1061 of file string.c.
References rb_default_external_encoding(), rb_external_str_new_with_enc(), and strlen().
VALUE rb_external_str_new_with_enc | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | eenc | ||
) |
Definition at line 1008 of file string.c.
References rb_ascii8bit_encindex(), rb_enc_to_index(), and rb_usascii_encindex().
Referenced by rb_external_str_new(), rb_external_str_new_cstr(), rb_filesystem_str_new(), rb_filesystem_str_new_cstr(), rb_locale_str_new(), and rb_locale_str_new_cstr().
VALUE rb_external_str_with_enc | ( | VALUE | str, |
rb_encoding * | eenc | ||
) |
Definition at line 1042 of file string.c.
References ENC_CODERANGE_7BIT, rb_ascii8bit_encindex(), rb_default_internal_encoding(), rb_enc_associate_index(), rb_enc_str_coderange(), rb_enc_to_index(), rb_str_conv_enc(), and rb_usascii_encindex().
Definition at line 1079 of file string.c.
References rb_external_str_new_with_enc(), and rb_filesystem_encoding().
Definition at line 1085 of file string.c.
References rb_external_str_new_with_enc(), rb_filesystem_encoding(), and strlen().
Referenced by rb_parser_compile_file(), and rb_parser_compile_string().
RUBY_FUNC_EXPORTED VALUE rb_fstring | ( | VALUE | str | ) |
Definition at line 306 of file string.c.
References BARE_STRING_P, Check_Type, FL_TEST, OBJ_FREEZE_RAW, RSTRING_FSTR, STR_EMBED_P, and T_STRING.
Referenced by rb_iseq_pathobj_new().
Definition at line 388 of file string.c.
References rb_fstring_new(), and strlen().
Referenced by rb_autoload(), rb_insns_name_array(), rb_iseq_new_main(), and ruby_set_inplace_mode().
VALUE rb_fstring_enc_cstr | ( | const char * | ptr, |
rb_encoding * | enc | ||
) |
Definition at line 394 of file string.c.
References rb_fstring_enc_new(), and strlen().
VALUE rb_fstring_enc_new | ( | const char * | ptr, |
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 381 of file string.c.
Referenced by rb_fstring_enc_cstr().
Definition at line 374 of file string.c.
Referenced by rb_deprecate_constant(), and rb_fstring_cstr().
Definition at line 10129 of file string.c.
References rb_id2str, and rb_str_quote_unprintable().
Definition at line 1067 of file string.c.
References rb_external_str_new_with_enc(), and rb_locale_encoding().
Definition at line 1073 of file string.c.
References rb_external_str_new_with_enc(), rb_locale_encoding(), and strlen().
void rb_must_asciicompat | ( | VALUE | str | ) |
Definition at line 2098 of file string.c.
References rb_eEncCompatError, rb_enc_asciicompat, rb_enc_get(), rb_enc_name, and rb_raise().
Referenced by rb_str_to_inum().
Definition at line 1410 of file string.c.
References rb_funcall(), rb_obj_as_string_result(), RB_TYPE_P, and T_STRING.
Referenced by rb_inspect(), and rb_p().
Definition at line 1422 of file string.c.
References FL_ABLE, FL_TEST_RAW, OBJ_INFECT_RAW, rb_any_to_s(), RB_TYPE_P, RSTRING_FSTR, and T_STRING.
Referenced by rb_obj_as_string().
VALUE rb_setup_fake_str | ( | struct RString * | fake_str, |
const char * | name, | ||
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 368 of file string.c.
Referenced by rb_check_id_cstr(), rb_check_symbol_cstr(), rb_intern3(), rb_sym_intern(), and ruby_require_internal().
Definition at line 2900 of file string.c.
References rb_str_buf_append(), and StringValue.
Referenced by rb_keyword_error_new(), rb_load_fail(), rb_str_concat(), and rb_str_ellipsize().
Definition at line 2884 of file string.c.
References ENC_CODERANGE, ENC_CODERANGE_SET, ENCODING_GET, OBJ_INFECT, RSTRING_LEN, and RSTRING_PTR.
Referenced by rb_str_append().
Definition at line 2860 of file string.c.
References ALLOCA_N, buf, ENC_CODERANGE_7BIT, ENC_CODERANGE_VALID, ENCODING_GET, rb_enc_asciicompat, rb_enc_codelen(), rb_enc_from_index(), rb_enc_mbcput, rb_enc_mbmaxlen, and strlen().
int rb_str_buf_cat_escaped_char | ( | VALUE | result, |
unsigned int | c, | ||
int | unicode_p | ||
) |
VALUE rb_str_buf_new | ( | long | capa | ) |
Definition at line 1282 of file string.c.
Referenced by rb_econv_append(), rb_reg_regsub(), rb_str_buf_new_cstr(), rb_str_concat_literals(), and rb_str_encode_ospath().
Definition at line 1298 of file string.c.
References rb_str_buf_cat(), rb_str_buf_new(), and strlen().
Referenced by rb_load_fail().
size_t rb_str_capacity | ( | VALUE | str | ) |
Definition at line 675 of file string.c.
Referenced by rb_econv_append(), and rb_str_vcatf().
Definition at line 2746 of file string.c.
References rb_eArgError, and rb_raise().
Referenced by rb_str_cat_conv_enc_opts(), rb_str_concat(), rb_str_ellipsize(), rb_str_encode_ospath(), rb_str_initialize(), and rsock_inspect_sockaddr().
VALUE rb_str_cat_conv_enc_opts | ( | VALUE | newstr, |
long | ofs, | ||
const char * | ptr, | ||
long | len, | ||
rb_encoding * | from, | ||
int | ecflags, | ||
VALUE | ecopts | ||
) |
Definition at line 915 of file string.c.
References rb_eIndexError, rb_raise(), rb_str_cat(), rb_str_modify(), RSTRING_LEN, and STR_SET_LEN.
Definition at line 2756 of file string.c.
Referenced by rb_keyword_error_new().
Definition at line 2162 of file string.c.
References RString::capa.
Definition at line 8342 of file string.c.
References RSTRING_LEN.
Definition at line 3159 of file string.c.
References ENCODING_GET, lesser, memcmp(), rb_str_comparable(), and RSTRING_GETMEM.
Referenced by rb_iseq_pathobj_new().
long rb_str_coderange_scan_restartable | ( | const char * | s, |
const char * | e, | ||
rb_encoding * | enc, | ||
int * | cr | ||
) |
Definition at line 531 of file string.c.
References ENC_CODERANGE_BROKEN, ENC_CODERANGE_VALID, rb_ascii8bit_encindex(), and rb_enc_to_index().
Definition at line 3134 of file string.c.
References ENC_CODERANGE_7BIT, ENCODING_GET, FALSE, rb_enc_asciicompat, rb_enc_from_index(), rb_enc_str_coderange(), RSTRING_LEN, and TRUE.
Referenced by rb_str_cmp(), and rb_str_hash_cmp().
Definition at line 2999 of file string.c.
References ALLOCA_N, buf, ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, ENCINDEX_ASCII, ENCINDEX_US_ASCII, FIX2LONG, FIXNUM_P, len, ONIGERR_INVALID_CODE_POINT_VALUE, ONIGERR_TOO_BIG_WIDE_CHAR_VALUE, rb_enc_associate_index(), rb_enc_codelen(), rb_enc_mbcput, rb_enc_name, rb_enc_precise_mbclen(), rb_enc_to_index(), rb_eRangeError, RB_INTEGER_TYPE_P, rb_num_to_uint(), rb_raise(), rb_str_append(), rb_str_cat(), rb_str_resize(), RSTRING_LEN, RSTRING_PTR, and STR_ENC_GET.
Referenced by make_inspect(), rb_iseq_disasm(), and rb_iseq_disasm_insn().
Definition at line 2909 of file string.c.
References ENC_CODERANGE, ENCINDEX_US_ASCII, ENCODING_GET, ENCODING_GET_INLINED, LIKELY, MIN_PRE_ALLOC_SIZE, NULL, OBJ_INFECT_RAW, rb_enc_copy(), rb_enc_set_index(), rb_str_buf_new(), rb_str_new(), rb_str_resurrect(), RSTRING_LEN, RSTRING_PTR, and UNLIKELY.
VALUE rb_str_conv_enc | ( | VALUE | str, |
rb_encoding * | from, | ||
rb_encoding * | to | ||
) |
Definition at line 1002 of file string.c.
References Qnil, and rb_str_conv_enc_opts().
Referenced by rb_dir_getwd(), rb_external_str_with_enc(), rb_str_encode_ospath(), rb_str_export(), rb_str_export_locale(), and rb_str_export_to_enc().
VALUE rb_str_conv_enc_opts | ( | VALUE | str, |
rb_encoding * | from, | ||
rb_encoding * | to, | ||
int | ecflags, | ||
VALUE | ecopts | ||
) |
Definition at line 885 of file string.c.
References is_ascii_string, len, RString::ptr, rb_ascii8bit_encoding(), rb_enc_asciicompat, rb_enc_associate(), rb_enc_get(), rb_str_dup(), RSTRING_GETMEM, and STR_ENC_GET.
Referenced by rb_str_conv_enc(), and rb_w32_conv_from_wchar().
Definition at line 4473 of file string.c.
References RSTRING_LEN, and RSTRING_PTR.
Definition at line 5920 of file string.c.
References len, rb_enc_from_index(), and rb_enc_get_index().
Definition at line 1488 of file string.c.
Referenced by rb_str_conv_enc_opts(), rb_str_times(), rb_vm_set_progname(), rsock_ipaddr(), and ruby_set_script_name().
Shortens str and adds three dots, an ellipsis, if it is longer than len characters.
str | the string to ellipsize. |
len | the maximum string length. |
Definition at line 9575 of file string.c.
References Qnil, rb_eIndexError, rb_enc_asciicompat, rb_enc_associate(), rb_enc_from_encoding(), rb_enc_get(), rb_enc_mbminlen, rb_enc_nth(), rb_enc_step_back, rb_raise(), rb_str_append(), rb_str_cat(), rb_str_encode(), rb_str_new_with_class(), rb_str_subseq(), rb_usascii_str_new(), RSTRING_LEN, and RSTRING_PTR.
Definition at line 3214 of file string.c.
References Qfalse, Qtrue, rb_equal(), rb_respond_to(), RB_TYPE_P, and T_STRING.
Definition at line 1091 of file string.c.
References rb_default_external_encoding(), rb_str_conv_enc(), and STR_ENC_GET.
Definition at line 1097 of file string.c.
References rb_locale_encoding(), rb_str_conv_enc(), and STR_ENC_GET.
VALUE rb_str_export_to_enc | ( | VALUE | str, |
rb_encoding * | enc | ||
) |
Definition at line 1103 of file string.c.
References rb_str_conv_enc(), and STR_ENC_GET.
Definition at line 2238 of file string.c.
References RSTRING_LEN, and RSTRING_PTR.
void rb_str_free | ( | VALUE | str | ) |
Definition at line 1316 of file string.c.
References FL_TEST, NULL, RB_DEBUG_COUNTER_INC, RB_DEBUG_COUNTER_INC_IF, rb_vm_fstring_table(), RSTRING_FSTR, RUBY_FUNC_EXPORTED, ruby_sized_xfree(), st_data_t, st_delete, STR_EMBED_P, STR_HEAP_PTR, STR_HEAP_SIZE, STR_NOFREE, and STR_SHARED.
Definition at line 2549 of file string.c.
References OBJ_FROZEN, rb_obj_freeze(), rb_str_resize(), and RSTRING_LEN.
st_index_t rb_str_hash | ( | VALUE | str | ) |
Definition at line 3094 of file string.c.
References ENC_CODERANGE_7BIT, ENCODING_GET, rb_enc_str_coderange(), rb_memhash(), RSTRING_LEN, and RSTRING_PTR.
Definition at line 3104 of file string.c.
References memcmp(), rb_str_comparable(), and RSTRING_GETMEM.
Definition at line 4298 of file string.c.
References bp, ISASCII, ISDIGIT, NIL_P, Qfalse, Qtrue, rb_check_string_type(), rb_enc_asciicompat, rb_str_new_frozen(), RSTRING_LEN, RSTRING_PTR, RTEST, STR_ENC_GET, and StringValue.
VALUE rb_str_initialize | ( | VALUE | str, |
const char * | ptr, | ||
long | len, | ||
rb_encoding * | enc | ||
) |
Definition at line 936 of file string.c.
References rb_enc_associate(), rb_str_cat(), and STR_SET_LEN.
Definition at line 5813 of file string.c.
References buf, CHAR_ESC_LEN, ENCODING_GET, and rb_enc_from_index().
Definition at line 2620 of file string.c.
References rb_ensure(), rb_str_locktmp(), and rb_str_unlocktmp().
RUBY_FUNC_EXPORTED size_t rb_str_memsize | ( | VALUE | str | ) |
Definition at line 1338 of file string.c.
References FL_TEST, STR_HEAP_SIZE, STR_NOEMBED, STR_NOFREE, and STR_SHARED.
void rb_str_modify | ( | VALUE | str | ) |
Definition at line 2046 of file string.c.
Referenced by rb_str_cat_conv_enc_opts(), and rb_str_vcatf().
void rb_str_modify_expand | ( | VALUE | str, |
long | expand | ||
) |
Definition at line 2054 of file string.c.
References LONG_MAX, rb_eArgError, rb_raise(), RSTRING_LEN, and TERM_LEN.
Referenced by rb_str_encode_ospath(), and ruby_init_loadpath_safe().
Definition at line 737 of file string.c.
Referenced by asn1str_to_str(), rb_compile_cstr(), rb_enc_str_new(), rb_exc_new(), rb_execarg_commandline(), rb_io_ungetbyte(), rb_iseq_disasm(), rb_iseq_disasm_insn(), rb_parser_compile_cstr(), rb_parser_printf(), rb_reg_quote(), rb_str_concat_literals(), rb_tainted_str_new(), rb_usascii_str_new(), rsock_ipaddr(), ruby_init_loadpath(), and ruby_init_loadpath_safe().
Definition at line 771 of file string.c.
Referenced by rb_econv_open_exc(), rb_iseq_defined_string(), rb_load_file(), rb_parser_dump_tree(), rb_parser_fatal(), rb_parser_trace_lex_state(), rb_path2class(), rb_require(), rb_str_split(), rb_tainted_str_new_cstr(), rb_throw_obj(), rb_usascii_str_new_cstr(), rb_utf8_str_new_cstr(), ruby_eval_string_from_file(), and ruby_eval_string_from_file_protect().
Definition at line 1158 of file string.c.
References OBJ_FROZEN.
Referenced by rb_econv_substr_append(), rb_str_include_range_p(), and rb_str_subseq().
Definition at line 1149 of file string.c.
Referenced by rb_str_subseq().
Definition at line 1265 of file string.c.
Referenced by rb_str_ellipsize(), rb_str_subseq(), and rb_str_succ().
Definition at line 8909 of file string.c.
References rb_enc_codepoint, RSTRING_END, RSTRING_PTR, STR_ENC_GET, and UINT2NUM.
Definition at line 1854 of file string.c.
References LONG_MAX, rb_eArgError, rb_enc_check_str(), rb_enc_mbminlen, rb_raise(), RSTRING_GETMEM, and StringValue.
Definition at line 10108 of file string.c.
References Check_Type, len, NULL, RString::ptr, rb_default_external_encoding(), rb_default_internal_encoding(), RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, and T_STRING.
Referenced by rb_id_quote_unprintable().
Definition at line 2644 of file string.c.
References rb_eArgError, and rb_raise().
Referenced by rb_econv_append(), rb_reg_quote(), rb_str_concat(), rb_str_freeze(), ruby_init_loadpath_safe(), and VpAlloc().
Definition at line 1494 of file string.c.
References RSTRING_LEN, and RUBY_DTRACE_CREATE_HOOK.
Referenced by rb_str_concat_literals().
str | the string to be scrubbed |
repl | the replacement character |
Definition at line 9638 of file string.c.
References STR_ENC_GET.
void rb_str_set_len | ( | VALUE | str, |
long | len | ||
) |
Definition at line 2627 of file string.c.
References RString::capa, and TERM_LEN.
Referenced by rb_econv_append(), rb_file_expand_path_internal(), rb_str_encode_ospath(), and ruby_init_loadpath_safe().
Definition at line 9469 of file string.c.
References NIL_P, PRIsVALUE, rb_eTypeError, rb_id2str, rb_raise(), RB_TYPE_P, T_STRING, and val.
Definition at line 7602 of file string.c.
References rb_str_new_cstr(), and StringValue.
long rb_str_sublen | ( | VALUE | str, |
long | pos | ||
) |
Definition at line 2395 of file string.c.
Referenced by rb_reg_match2().
char* rb_str_subpos | ( | VALUE | str, |
long | beg, | ||
long * | lenp | ||
) |
Definition at line 2430 of file string.c.
References RSTRING_LEN, RSTRING_PTR, and STR_ENC_GET.
Definition at line 2406 of file string.c.
References len, RB_GC_GUARD, rb_str_new_frozen(), rb_str_new_shared(), rb_str_new_with_class(), RSTRING, RSTRING_LEN, RSTRING_PTR, SHARABLE_SUBSTRING_P, STR_EMBEDDABLE_P, and TERM_LEN.
Referenced by rb_path_to_class(), rb_reg_regsub(), and rb_str_ellipsize().
Definition at line 4030 of file string.c.
References rb_str_new_with_class(), RSTRING_LEN, and RSTRING_PTR.
int rb_str_symname_p | ( | VALUE | sym | ) |
Definition at line 10089 of file string.c.
References len, NULL, RString::ptr, rb_default_external_encoding(), rb_default_internal_encoding(), RSTRING_LEN, RSTRING_PTR, and STR_ENC_GET.
Definition at line 1896 of file string.c.
References INT2FIX, len, and rb_str_dup().
Definition at line 1170 of file string.c.
References OBJ_FROZEN_RAW.
Definition at line 1183 of file string.c.
References RString::as, assert, FL_TEST_RAW, FL_UNSET_RAW, OBJ_FROZEN_RAW, rb_gc_force_recycle(), RBASIC, RBASIC_CLASS, RSTRING, RUBY_FL_FREEZE, RString::shared, STR_EMBED_P, STR_IS_SHARED_M, STR_NOFREE, STR_SHARED, and STR_TMPLOCK.
Definition at line 1349 of file string.c.
References rb_convert_type_with_id(), and T_STRING.
Referenced by rb_string_value().
Definition at line 2610 of file string.c.
References FL_TEST, FL_UNSET, rb_eRuntimeError, rb_raise(), RUBY_FUNC_EXPORTED, and STR_TMPLOCK.
Referenced by rb_str_locktmp_ensure().
Definition at line 2107 of file string.c.
References RString::ptr, rb_str_to_str(), RB_TYPE_P, and T_STRING.
Referenced by rb_string_value_cstr(), and rb_string_value_ptr().
char* rb_string_value_cstr | ( | volatile VALUE * | ptr | ) |
Definition at line 2223 of file string.c.
References rb_string_value().
char* rb_string_value_ptr | ( | volatile VALUE * | ptr | ) |
Definition at line 2118 of file string.c.
References rb_string_value(), and RSTRING_PTR.
Definition at line 10206 of file string.c.
References rb_eArgError, rb_funcall_with_block(), rb_raise(), and rb_sym_to_proc().
Definition at line 854 of file string.c.
References OBJ_TAINT, and rb_str_new().
Definition at line 872 of file string.c.
References OBJ_TAINT, and rb_str_new_cstr().
Definition at line 10496 of file string.c.
References SYM2ID, and SYMBOL_P.
Referenced by rb_f_trace_var().
Definition at line 743 of file string.c.
References ENC_CODERANGE_7BIT, ENCODING_CODERANGE_SET, rb_str_new(), and rb_usascii_encindex().
Referenced by rb_fix2str(), and rb_str_ellipsize().
Definition at line 778 of file string.c.
References ENC_CODERANGE_7BIT, ENCODING_CODERANGE_SET, rb_str_new_cstr(), and rb_usascii_encindex().
Referenced by rb_locale_charmap().
Definition at line 751 of file string.c.
Referenced by ruby_init_loadpath_safe().
Definition at line 786 of file string.c.
References rb_enc_associate_index(), rb_str_new_cstr(), and rb_utf8_encindex().
RUBY_ALIAS_FUNCTION | ( | rb_str_dup_frozen(VALUE str) | , |
rb_str_new_frozen | , | ||
(str) | |||
) |
Definition at line 2596 of file string.c.
References FL_SET, FL_TEST, rb_eRuntimeError, rb_raise(), and STR_TMPLOCK.
RUBY_ALIAS_FUNCTION | ( | rb_str_buf_cat(VALUE str, const char *ptr, long len) | , |
rb_str_cat | , | ||
(str, ptr, len) | |||
) |
Definition at line 2762 of file string.c.
References ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_UNKNOWN, ENCODING_GET, and RSTRING_LEN.
VALUE rb_cString |
Definition at line 66 of file string.c.
Referenced by Init_String().
const struct st_hash_type rb_fstring_hash_type |