Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

String
[Ruby]


String Conversion Routines

#define StringValue(v)   rb_string_value(&(v))
#define StringValuePtr(v)   rb_string_value_ptr(&(v))
#define StringValueCStr(v)   rb_string_value_cstr(&(v))
#define SafeStringValue(v)
#define Check_SafeStr(v)   rb_check_safe_str((VALUE)(v))
VALUE rb_str_to_str (VALUE)
VALUE rb_string_value (volatile VALUE *)
char * rb_string_value_ptr (volatile VALUE *)
char * rb_string_value_cstr (volatile VALUE *)
void rb_check_safe_obj (VALUE)
void rb_check_safe_str (VALUE)

Character Conversion Routines

#define NUM2CHR(x)
#define CHR2FIX(x)   INT2FIX((long)((x)&0xff))

String Functions

VALUE rb_str_new (const char *, long)
VALUE rb_str_new2 (const char *)
VALUE rb_str_new3 (VALUE)
VALUE rb_str_new4 (VALUE)
VALUE rb_str_new5 (VALUE, const char *, long)
VALUE rb_tainted_str_new (const char *, long)
VALUE rb_tainted_str_new2 (const char *)
VALUE rb_str_buf_new (long)
VALUE rb_str_buf_new2 (const char *)
VALUE rb_str_buf_append (VALUE, VALUE)
VALUE rb_str_buf_cat (VALUE, const char *, long)
VALUE rb_str_buf_cat2 (VALUE, const char *)
VALUE rb_obj_as_string (VALUE)
VALUE rb_check_string_type (VALUE)
VALUE rb_str_dup (VALUE)
VALUE rb_str_dup_frozen (VALUE)
VALUE rb_str_plus (VALUE, VALUE)
VALUE rb_str_times (VALUE, VALUE)
VALUE rb_str_substr (VALUE, long, long)
void rb_str_modify (VALUE)
VALUE rb_str_freeze (VALUE)
VALUE rb_str_resize (VALUE, long)
VALUE rb_str_cat (VALUE, const char *, long)
VALUE rb_str_cat2 (VALUE, const char *)
VALUE rb_str_append (VALUE, VALUE)
VALUE rb_str_concat (VALUE, VALUE)
int rb_str_hash (VALUE)
int rb_str_cmp (VALUE, VALUE)
VALUE rb_str_upto (VALUE, VALUE, int)
void rb_str_update (VALUE, long, long, VALUE)
VALUE rb_str_inspect (VALUE)
VALUE rb_str_dump (VALUE)
VALUE rb_str_split (VALUE, const char *)
void rb_str_associate (VALUE, VALUE)
VALUE rb_str_associated (VALUE)
void rb_str_setter (VALUE, ID, VALUE *)
VALUE rb_str_intern (VALUE)

Defines

#define STR2CSTR(x)   rb_str2cstr((VALUE)(x),0)

Functions

char * rb_str2cstr (VALUE, long *)


Define Documentation

#define Check_SafeStr  )     rb_check_safe_str((VALUE)(v))
 

obsolete macro - use SafeStringValue(v)

Definition at line 254 of file ruby.h.

Referenced by rb_mod_autoload().

#define CHR2FIX  )     INT2FIX((long)((x)&0xff))
 

Definition at line 318 of file ruby.h.

#define NUM2CHR  ) 
 

Value:

(((TYPE(x) == T_STRING)&&(RSTRING(x)->len>=1))?\
                     RSTRING(x)->ptr[0]:(char)(NUM2INT(x)&0xff))

Definition at line 316 of file ruby.h.

Referenced by rb_f_test(), and rb_io_putc().

#define SafeStringValue  ) 
 

Value:

do {\
    StringValue(v);\
    rb_check_safe_obj(v);\
} while (0)

Definition at line 249 of file ruby.h.

Referenced by apply2files(), check_dirname(), dir_initialize(), dir_s_chdir(), env_delete(), eval_under(), proc_exec_n(), rb_f_backquote(), rb_f_eval(), rb_f_exec(), rb_f_system(), rb_file_s_ftype(), rb_file_s_link(), rb_file_s_lstat(), rb_file_s_readlink(), rb_file_s_rename(), rb_file_s_stat(), rb_file_s_symlink(), rb_file_s_truncate(), rb_find_file(), rb_find_file_ext(), rb_io_initialize(), rb_io_reopen(), rb_io_s_foreach(), rb_io_s_popen(), rb_io_s_read(), rb_io_s_readlines(), rb_io_s_sysopen(), rb_load(), rb_open_file(), rb_stat(), rb_stat_init(), specific_eval(), test_check(), test_identical(), test_l(), test_R(), test_r(), test_W(), test_w(), test_X(), test_x(), and trap().

#define STR2CSTR  )     rb_str2cstr((VALUE)(x),0)
 

obsolete API - use StringValuePtr()

Definition at line 313 of file ruby.h.

#define StringValue  )     rb_string_value(&(v))
 

Definition at line 243 of file ruby.h.

Referenced by argf_getline(), argf_read(), compile(), env_aset(), env_fetch(), env_index(), error_print(), eval_under(), io_getpartial(), io_read(), marshal_load(), name_err_to_s(), opt_i_set(), pack_pack(), pack_unpack(), r_bytes0(), rb_ary_join(), rb_exc_new3(), rb_f_abort(), rb_f_eval(), rb_f_getenv(), rb_f_sprintf(), rb_f_syscall(), rb_file_s_basename(), rb_file_s_split(), rb_io_each_line(), rb_io_gets_m(), rb_io_readlines(), rb_io_s_foreach(), rb_io_sysread(), rb_load(), rb_longjmp(), rb_reg_eqq(), rb_reg_match(), rb_reg_s_quote(), rb_require_safe(), rb_str2cstr(), rb_str_append(), rb_str_casecmp(), rb_str_chomp_bang(), rb_str_count(), rb_str_crypt(), rb_str_delete_bang(), rb_str_each_line(), rb_str_include(), rb_str_justify(), rb_str_plus(), rb_str_replace(), rb_str_splice(), rb_str_split(), rb_str_squeeze_bang(), rb_str_sub_bang(), rb_str_to_dbl(), rb_str_to_inum(), rb_str_upto(), set_arg0(), specific_eval(), str_gsub(), syserr_initialize(), time_mload(), time_strftime(), and tr_trans().

#define StringValueCStr  )     rb_string_value_cstr(&(v))
 

Definition at line 245 of file ruby.h.

Referenced by apply2files(), path_check_0(), rb_file_join(), rb_file_s_atime(), rb_file_s_basename(), rb_file_s_dirname(), rb_file_s_extname(), rb_file_s_ftype(), rb_file_s_link(), rb_file_s_lstat(), rb_file_s_rename(), rb_file_s_size(), rb_file_s_stat(), rb_file_s_symlink(), rb_file_s_truncate(), rb_find_file(), rb_find_file_ext(), rb_stat(), rb_stat_init(), rb_str_to_inum(), test_l(), test_R(), test_r(), test_W(), test_w(), test_X(), and test_x().

#define StringValuePtr  )     rb_string_value_ptr(&(v))
 

Definition at line 244 of file ruby.h.

Referenced by env_has_key(), file_expand_path(), kcode_setter(), make_struct(), next_argv(), pack_pack(), pipe_open(), proc_initgroups(), process_sflag(), rb_cmperr(), rb_f_open(), rb_feature_p(), rb_io_reopen(), rb_io_s_popen(), rb_open_file(), rb_reg_initialize_m(), rb_reg_s_quote(), and specific_eval().


Function Documentation

void rb_check_safe_obj VALUE   ) 
 

Definition at line 246 of file eval.c.

References FRAME::last_func, OBJ_TAINTED, rb_eSecurityError, rb_id2name(), rb_raise(), rb_secure(), ruby_frame, ruby_safe_level, and VALUE.

Referenced by rb_check_safe_str(), and rb_require_safe().

void rb_check_safe_str VALUE   ) 
 

Definition at line 262 of file eval.c.

References rb_check_safe_obj(), rb_eTypeError, rb_obj_classname(), rb_raise(), T_STRING, TYPE, and VALUE.

VALUE rb_check_string_type VALUE   ) 
 

Definition at line 578 of file string.c.

References ELTS_SHARED, FL_SET, NIL_P, null_str, rb_check_convert_type(), RSTRING, T_STRING, and VALUE.

Referenced by env_indexes(), get_pat(), proc_setgroups(), range_step(), rb_ary_join(), rb_ary_times(), rb_f_kill(), rb_f_syscall(), rb_io_ctl(), rb_reg_eqq(), rb_str_index_m(), rb_struct_s_def(), rb_to_id(), and time_arg().

VALUE rb_obj_as_string VALUE   ) 
 

Definition at line 292 of file string.c.

References id_to_s, OBJ_TAINT, OBJ_TAINTED, rb_any_to_s(), rb_funcall(), T_STRING, TYPE, and VALUE.

Referenced by class_prefix(), compile_error(), err_append(), exc_inspect(), io_write(), pack_pack(), range_to_s(), rb_ary_join(), rb_check_type(), rb_eval(), rb_f_sprintf(), rb_inspect(), rb_io_puts(), rb_io_syswrite(), rb_p(), rb_str_sub_bang(), and str_gsub().

char* rb_str2cstr VALUE  ,
long * 
 

obsolete API - use StringValue()

Definition at line 2418 of file object.c.

References rb_warn(), RSTRING, RTEST, ruby_verbose, StringValue, and VALUE.

VALUE rb_str_append VALUE  ,
VALUE 
 

Definition at line 796 of file string.c.

References FL_TEST, OBJ_INFECT, rb_str_buf_append(), rb_str_modify(), REALLOC_N, RSTRING, STR_ASSOC, StringValue, and VALUE.

Referenced by argf_read(), compile_error(), fc_path(), inspect_i(), inspect_struct(), range_inspect(), range_to_s(), rb_eval(), rb_mod_to_s(), rb_stat_inspect(), and rb_str_concat().

void rb_str_associate VALUE  ,
VALUE 
 

Definition at line 510 of file string.c.

References ELTS_SHARED, FL_SET, FL_TEST, rb_ary_concat(), RESIZE_CAPA, RSTRING, STR_ASSOC, str_make_independent(), and VALUE.

Referenced by pack_pack().

VALUE rb_str_associated VALUE   ) 
 

Definition at line 530 of file string.c.

References FL_TEST, Qfalse, RSTRING, STR_ASSOC, and VALUE.

Referenced by pack_unpack().

VALUE rb_str_buf_append VALUE  ,
VALUE 
 

Definition at line 766 of file string.c.

References FL_TEST, FL_UNSET, OBJ_INFECT, rb_str_modify(), RESIZE_CAPA, RSTRING, STR_ASSOC, and VALUE.

Referenced by env_inspect(), exc_inspect(), inspect_ary(), inspect_i(), method_inspect(), rb_ary_join(), rb_file_join(), rb_reg_s_union(), and rb_str_append().

VALUE rb_str_buf_cat VALUE  ,
const char *  ,
long 
 

Definition at line 695 of file string.c.

References FL_TEST, FL_UNSET, rb_eArgError, rb_raise(), rb_str_modify(), RESIZE_CAPA, RSTRING, STR_ASSOC, and VALUE.

Referenced by appendline(), compile_error(), encodes(), env_inspect(), exc_inspect(), pack_pack(), qpencode(), rb_reg_expr_str(), rb_reg_regsub(), rb_str_buf_cat2(), rb_str_buf_new2(), rb_str_cat(), rb_str_inspect(), and w_nbyte().

VALUE rb_str_buf_cat2 VALUE  ,
const char * 
 

Definition at line 729 of file string.c.

References rb_str_buf_cat(), and VALUE.

Referenced by compile_error(), env_inspect(), inspect_ary(), inspect_hash(), inspect_i(), method_inspect(), rb_reg_desc(), rb_reg_s_union(), rb_reg_to_s(), rb_stat_inspect(), and rb_str_inspect().

VALUE rb_str_buf_new long   ) 
 

Definition at line 221 of file string.c.

References ALLOC_N, rb_cString, RSTRING, str_alloc(), STR_BUF_MIN_SIZE, and VALUE.

Referenced by appendline(), marshal_dump(), pack_pack(), rb_ary_join(), rb_f_sprintf(), rb_file_join(), rb_reg_regsub(), rb_reg_s_union(), and rb_str_buf_new2().

VALUE rb_str_buf_new2 const char *   ) 
 

VALUE rb_str_cat VALUE  ,
const char *  ,
long 
 

Definition at line 737 of file string.c.

References FL_TEST, rb_eArgError, rb_raise(), rb_str_buf_cat(), rb_str_modify(), REALLOC_N, RSTRING, STR_ASSOC, and VALUE.

Referenced by appendline(), here_document(), process_sflag(), range_inspect(), range_to_s(), rb_file_s_dirname(), rb_str_cat2(), rb_str_concat(), and time_strftime().

VALUE rb_str_cat2 VALUE  ,
const char * 
 

Definition at line 758 of file string.c.

References rb_str_cat(), and VALUE.

Referenced by err_append(), fc_path(), inspect_i(), inspect_obj(), inspect_struct(), name_err_mesg_to_str(), next_argv(), path_check_0(), proc_options(), process_sflag(), pst_inspect(), rb_find_file_ext(), rb_mod_to_s(), rb_set_class_path(), and search_required().

int rb_str_cmp VALUE  ,
VALUE 
 

Definition at line 905 of file string.c.

References lesser, rb_memcmp(), RSTRING, and VALUE.

Referenced by rb_any_cmp(), rb_str_cmp_m(), rb_str_equal(), rb_str_upto(), and sort_2().

VALUE rb_str_concat VALUE  ,
VALUE 
 

Definition at line 836 of file string.c.

References FIX2INT, FIXNUM_P, rb_str_append(), rb_str_cat(), and VALUE.

Referenced by Init_String(), and literal_concat().

VALUE rb_str_dump VALUE   ) 
 

Definition at line 2635 of file string.c.

References IS_EVSTR, ISPRINT, OBJ_INFECT, rb_str_new5(), RSTRING, and VALUE.

Referenced by Init_String(), and sym_inspect().

VALUE rb_str_dup VALUE   ) 
 

Definition at line 310 of file string.c.

References rb_obj_class(), rb_str_replace(), str_alloc(), and VALUE.

Referenced by exc_inspect(), fc_path(), range_inspect(), range_to_s(), rb_f_chomp(), rb_f_chop(), rb_f_gsub(), rb_f_sub(), rb_find_file_ext(), rb_mod_name(), rb_mod_to_s(), rb_set_class_path(), rb_str_aref(), rb_str_capitalize(), rb_str_chomp(), rb_str_chop(), rb_str_delete(), rb_str_downcase(), rb_str_dup_frozen(), rb_str_justify(), rb_str_lstrip(), rb_str_reverse(), rb_str_rstrip(), rb_str_squeeze(), rb_str_strip(), rb_str_sub(), rb_str_swapcase(), rb_str_tr(), rb_str_tr_s(), rb_str_upcase(), and str_gsub().

VALUE rb_str_dup_frozen VALUE   ) 
 

Definition at line 633 of file string.c.

References ELTS_SHARED, FL_TEST, OBJ_FREEZE, OBJ_FROZEN, rb_str_dup(), RSTRING, and VALUE.

VALUE rb_str_freeze VALUE   ) 
 

Definition at line 626 of file string.c.

References rb_obj_freeze(), and VALUE.

int rb_str_hash VALUE   ) 
 

Definition at line 852 of file string.c.

References RSTRING, and VALUE.

Referenced by rb_any_hash(), and rb_str_hash_m().

VALUE rb_str_inspect VALUE   ) 
 

Definition at line 2563 of file string.c.

References IS_EVSTR, ismbchar, ISPRINT, mbclen, OBJ_INFECT, rb_str_buf_cat(), rb_str_buf_cat2(), rb_str_buf_new2(), RSTRING, and VALUE.

Referenced by Init_String(), and rb_invalid_str().

VALUE rb_str_intern VALUE   ) 
 

Definition at line 4388 of file string.c.

References ID, ID2SYM, rb_eArgError, rb_intern(), rb_raise(), RSTRING, and VALUE.

Referenced by Init_String(), and rb_eval().

void rb_str_modify VALUE   ) 
 

Definition at line 502 of file string.c.

References str_independent(), str_make_independent(), and VALUE.

Referenced by io_getpartial(), io_read(), rb_f_syscall(), rb_io_ctl(), rb_io_sysread(), rb_str_append(), rb_str_aset(), rb_str_buf_append(), rb_str_buf_cat(), rb_str_capitalize_bang(), rb_str_cat(), rb_str_chomp_bang(), rb_str_chop_bang(), rb_str_delete_bang(), rb_str_downcase_bang(), rb_str_lstrip_bang(), rb_str_replace(), rb_str_resize(), rb_str_reverse_bang(), rb_str_rstrip_bang(), rb_str_shared_replace(), rb_str_splice(), rb_str_squeeze_bang(), rb_str_sub_bang(), rb_str_swapcase_bang(), rb_str_upcase_bang(), and tr_trans().

VALUE rb_str_new const char *  ,
long 
 

VALUE rb_str_new2 const char *   ) 
 

VALUE rb_str_new3 VALUE   ) 
 

Definition at line 155 of file string.c.

References rb_obj_class(), str_new3(), and VALUE.

Referenced by rb_eval(), and rb_str_substr().

VALUE rb_str_new4 VALUE   ) 
 

Definition at line 182 of file string.c.

References ELTS_SHARED, FL_TEST, OBJ_FREEZE, OBJ_FROZEN, OBJ_INFECT, rb_obj_class(), RBASIC, RSTRING, STR_ASSOC, str_new(), str_new3(), str_new4(), and VALUE.

Referenced by rb_f_sprintf(), rb_hash_aset(), rb_load(), rb_reg_search(), rb_require_safe(), rb_str_substr(), test_identical(), and time_strftime().

VALUE rb_str_new5 VALUE  ,
const char *  ,
long 
 

Definition at line 210 of file string.c.

References rb_obj_class(), str_new(), and VALUE.

Referenced by rb_str_dump(), rb_str_each_line(), rb_str_justify(), rb_str_reverse(), rb_str_split_m(), rb_str_substr(), rb_str_succ(), and rb_str_times().

VALUE rb_str_plus VALUE  ,
VALUE 
 

Definition at line 383 of file string.c.

References OBJ_TAINT, OBJ_TAINTED, rb_str_new(), RSTRING, StringValue, and VALUE.

Referenced by Init_String().

VALUE rb_str_resize VALUE  ,
long 
 

Definition at line 672 of file string.c.

References FL_TEST, rb_eArgError, rb_raise(), rb_str_modify(), REALLOC_N, RSTRING, STR_NOCAPA, and VALUE.

Referenced by appendline(), argf_read(), dump(), io_getpartial(), io_read(), rb_f_sprintf(), rb_io_ctl(), rb_io_sysread(), rb_reg_quote(), rb_str_replace(), read_all(), syserr_initialize(), and w_nbyte().

void rb_str_setter VALUE  ,
ID  ,
VALUE
 

Definition at line 4605 of file string.c.

References ID, NIL_P, rb_eTypeError, rb_id2name(), rb_raise(), T_STRING, TYPE, and VALUE.

Referenced by Init_IO().

VALUE rb_str_split VALUE  ,
const char * 
 

Definition at line 3601 of file string.c.

References rb_str_new2(), rb_str_split_m(), StringValue, and VALUE.

VALUE rb_str_substr VALUE  ,
long  ,
long 
 

Definition at line 590 of file string.c.

References FL_TEST, OBJ_INFECT, Qnil, rb_str_new3(), rb_str_new4(), rb_str_new5(), RSTRING, STR_ASSOC, and VALUE.

Referenced by match_array(), match_select(), rb_reg_match_post(), rb_reg_match_pre(), rb_reg_nth_match(), rb_str_aref(), rb_str_aref_m(), and rb_str_split_m().

VALUE rb_str_times VALUE  ,
VALUE 
 

Definition at line 411 of file string.c.

References NUM2LONG, OBJ_INFECT, rb_eArgError, rb_raise(), rb_str_new5(), RSTRING, and VALUE.

Referenced by Init_String().

VALUE rb_str_to_str VALUE   ) 
 

Definition at line 252 of file string.c.

References rb_convert_type(), T_STRING, and VALUE.

Referenced by rb_string_value().

void rb_str_update VALUE  ,
long  ,
long  ,
VALUE 
 

Definition at line 1677 of file string.c.

References rb_str_splice(), and VALUE.

Referenced by eval().

VALUE rb_str_upto VALUE  ,
VALUE  ,
int 
 

Definition at line 1445 of file string.c.

References end, ID, rb_funcall(), rb_intern(), rb_str_cmp(), rb_str_equal(), rb_yield(), RSTRING, StringValue, and VALUE.

Referenced by rb_str_upto_m(), and str_step().

VALUE rb_string_value volatile VALUE  ) 
 

char* rb_string_value_cstr volatile VALUE  ) 
 

char* rb_string_value_ptr volatile VALUE  ) 
 

VALUE rb_tainted_str_new const char *  ,
long 
 

VALUE rb_tainted_str_new2 const char *   ) 
 


Generated on Wed Jan 18 23:32:13 2006 for Ruby by doxygen 1.3.5