Ruby  3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
Macros | Functions
string.h File Reference

(b76ad15ed0da636161de0243c547ee1e6fc95681)

Internal header for String. More...

#include "ruby/internal/config.h"
#include <stddef.h>
#include "internal/compilers.h"
#include "ruby/internal/stdbool.h"
#include "ruby/encoding.h"
#include "ruby/ruby.h"
Include dependency graph for string.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STR_NOEMBED   FL_USER1
 
#define STR_SHARED   FL_USER2 /* = ELTS_SHARED */
 
#define rb_fstring_lit(str)   rb_fstring_new((str), rb_strlen_lit(str))
 
#define rb_fstring_literal(str)   rb_fstring_lit(str)
 
#define rb_fstring_enc_lit(str, enc)   rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
 
#define rb_fstring_enc_literal(str, enc)   rb_fstring_enc_lit(str, enc)
 
#define rb_fstring_cstr(str)
 

Functions

VALUE rb_fstring (VALUE)
 
VALUE rb_fstring_cstr (const char *str)
 
VALUE rb_fstring_enc_new (const char *ptr, long len, rb_encoding *enc)
 
int rb_str_buf_cat_escaped_char (VALUE result, unsigned int c, int unicode_p)
 
int rb_str_symname_p (VALUE)
 
VALUE rb_str_quote_unprintable (VALUE)
 
char * rb_str_fill_terminator (VALUE str, const int termlen)
 
void rb_str_change_terminator_length (VALUE str, const int oldtermlen, const int termlen)
 
VALUE rb_str_locktmp_ensure (VALUE str, VALUE(*func)(VALUE), VALUE arg)
 
VALUE rb_str_chomp_string (VALUE str, VALUE chomp)
 
VALUE rb_external_str_with_enc (VALUE str, rb_encoding *eenc)
 
VALUE rb_str_cat_conv_enc_opts (VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, int ecflags, VALUE ecopts)
 
VALUE rb_enc_str_scrub (rb_encoding *enc, VALUE str, VALUE repl)
 
VALUE rb_str_escape (VALUE str)
 
size_t rb_str_memsize (VALUE)
 
char * rb_str_to_cstr (VALUE str)
 
const char * ruby_escaped_char (int c)
 
void rb_str_make_independent (VALUE str)
 
VALUE rb_str_tmp_frozen_acquire (VALUE str)
 
void rb_str_tmp_frozen_release (VALUE str, VALUE tmp)
 
VALUE rb_setup_fake_str (struct RString *fake_str, const char *name, long len, rb_encoding *enc)
 
VALUE rb_str_upto_each (VALUE, VALUE, int, int(*each)(VALUE, VALUE), VALUE)
 
VALUE rb_str_upto_endless_each (VALUE, int(*each)(VALUE, VALUE), VALUE)
 
VALUE rb_fstring_new (const char *ptr, long len)
 
VALUE rb_obj_as_string_result (VALUE str, VALUE obj)
 
VALUE rb_str_opt_plus (VALUE x, VALUE y)
 
VALUE rb_str_concat_literals (size_t num, const VALUE *strary)
 
VALUE rb_str_eql (VALUE str1, VALUE str2)
 
VALUE rb_id_quote_unprintable (ID)
 
VALUE rb_sym_proc_call (ID mid, int argc, const VALUE *argv, int kw_splat, VALUE passed_proc)
 
VALUE rb_ec_str_resurrect (struct rb_execution_context_struct *ec, VALUE str)
 

Detailed Description

Internal header for String.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Definition in file string.h.

Macro Definition Documentation

◆ rb_fstring_cstr

#define rb_fstring_cstr (   str)
Value:
(__builtin_constant_p(str) ? \
rb_fstring_new((str), (long)strlen(str)) : \

Definition at line 135 of file string.h.

◆ rb_fstring_enc_lit

#define rb_fstring_enc_lit (   str,
  enc 
)    rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))

Definition at line 79 of file string.h.

◆ rb_fstring_enc_literal

#define rb_fstring_enc_literal (   str,
  enc 
)    rb_fstring_enc_lit(str, enc)

Definition at line 80 of file string.h.

◆ rb_fstring_lit

#define rb_fstring_lit (   str)    rb_fstring_new((str), rb_strlen_lit(str))

Definition at line 77 of file string.h.

◆ rb_fstring_literal

#define rb_fstring_literal (   str)    rb_fstring_lit(str)

Definition at line 78 of file string.h.

◆ STR_NOEMBED

#define STR_NOEMBED   FL_USER1

Definition at line 19 of file string.h.

◆ STR_SHARED

#define STR_SHARED   FL_USER2 /* = ELTS_SHARED */

Definition at line 20 of file string.h.

Function Documentation

◆ rb_ec_str_resurrect()

VALUE rb_ec_str_resurrect ( struct rb_execution_context_struct ec,
VALUE  str 
)

Definition at line 1637 of file string.c.

References RSTRING_LEN, RUBY_DTRACE_CREATE_HOOK, and str.

◆ rb_enc_str_scrub()

VALUE rb_enc_str_scrub ( rb_encoding enc,
VALUE  str,
VALUE  repl 
)

Definition at line 10575 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_UNKNOWN, str, and STR_ENC_GET.

◆ rb_external_str_with_enc()

VALUE rb_external_str_with_enc ( VALUE  str,
rb_encoding eenc 
)

◆ rb_fstring()

VALUE rb_fstring ( VALUE  )

Definition at line 352 of file string.c.

References fstr_update_arg::fstr.

Referenced by rb_parser_lex_state_name(), and rb_str_to_interned_str().

◆ rb_fstring_cstr()

VALUE rb_fstring_cstr ( const char *  str)

Definition at line 459 of file string.c.

References ptr, rb_fstring_new(), and strlen().

◆ rb_fstring_enc_new()

VALUE rb_fstring_enc_new ( const char *  ptr,
long  len,
rb_encoding enc 
)

Definition at line 452 of file string.c.

◆ rb_fstring_new()

VALUE rb_fstring_new ( const char *  ptr,
long  len 
)

Definition at line 445 of file string.c.

Referenced by rb_fstring_cstr().

◆ rb_id_quote_unprintable()

VALUE rb_id_quote_unprintable ( ID  )

Definition at line 11055 of file string.c.

References rb_id2str, rb_str_escape(), rb_str_symname_p(), and str.

◆ rb_obj_as_string_result()

VALUE rb_obj_as_string_result ( VALUE  str,
VALUE  obj 
)

Definition at line 1534 of file string.c.

◆ rb_setup_fake_str()

VALUE rb_setup_fake_str ( struct RString fake_str,
const char *  name,
long  len,
rb_encoding enc 
)

◆ rb_str_buf_cat_escaped_char()

int rb_str_buf_cat_escaped_char ( VALUE  result,
unsigned int  c,
int  unicode_p 
)

Definition at line 6060 of file string.c.

◆ rb_str_cat_conv_enc_opts()

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 1006 of file string.c.

References len, ptr, rb_eIndexError, rb_raise(), rb_str_cat(), rb_str_modify(), RSTRING_LEN, and STR_SET_LEN.

◆ rb_str_change_terminator_length()

void rb_str_change_terminator_length ( VALUE  str,
const int  oldtermlen,
const int  termlen 
)

Definition at line 2369 of file string.c.

References RString::capa.

◆ rb_str_chomp_string()

VALUE rb_str_chomp_string ( VALUE  str,
VALUE  chomp 
)

Definition at line 9211 of file string.c.

References len, RSTRING_LEN, and str.

◆ rb_str_concat_literals()

VALUE rb_str_concat_literals ( size_t  num,
const VALUE strary 
)

Definition at line 3118 of file string.c.

◆ rb_str_eql()

VALUE rb_str_eql ( VALUE  str1,
VALUE  str2 
)

Definition at line 3443 of file string.c.

References Qtrue.

◆ rb_str_escape()

VALUE rb_str_escape ( VALUE  str)

Definition at line 6111 of file string.c.

References ENCODING_GET, rb_enc_from_index(), rb_encoding, RSTRING_PTR, and str.

Referenced by rb_id_quote_unprintable(), and rb_inspect().

◆ rb_str_fill_terminator()

char* rb_str_fill_terminator ( VALUE  str,
const int  termlen 
)

Definition at line 2445 of file string.c.

References len, RSTRING_LEN, RSTRING_PTR, and str.

◆ rb_str_locktmp_ensure()

VALUE rb_str_locktmp_ensure ( VALUE  str,
VALUE(*)(VALUE func,
VALUE  arg 
)

Definition at line 2826 of file string.c.

References rb_ensure(), rb_str_locktmp(), rb_str_unlocktmp(), and str.

◆ rb_str_make_independent()

void rb_str_make_independent ( VALUE  str)

Definition at line 219 of file string.c.

◆ rb_str_memsize()

size_t rb_str_memsize ( VALUE  )

Definition at line 1453 of file string.c.

References FL_TEST, str, STR_HEAP_SIZE, STR_NOEMBED, STR_NOFREE, and STR_SHARED.

◆ rb_str_opt_plus()

VALUE rb_str_opt_plus ( VALUE  x,
VALUE  y 
)

◆ rb_str_quote_unprintable()

VALUE rb_str_quote_unprintable ( VALUE  )

Definition at line 11034 of file string.c.

References len, ptr, and rb_encoding.

◆ rb_str_symname_p()

int rb_str_symname_p ( VALUE  )

◆ rb_str_tmp_frozen_acquire()

VALUE rb_str_tmp_frozen_acquire ( VALUE  str)

Definition at line 1280 of file string.c.

References OBJ_FROZEN_RAW.

◆ rb_str_tmp_frozen_release()

void rb_str_tmp_frozen_release ( VALUE  str,
VALUE  tmp 
)

Definition at line 1287 of file string.c.

References RBASIC_CLASS.

◆ rb_str_to_cstr()

char* rb_str_to_cstr ( VALUE  str)

Definition at line 2423 of file string.c.

◆ rb_str_upto_each()

VALUE rb_str_upto_each ( VALUE  ,
VALUE  ,
int  ,
int(*)(VALUE, VALUE each,
VALUE   
)

Definition at line 4460 of file string.c.

◆ rb_str_upto_endless_each()

VALUE rb_str_upto_endless_each ( VALUE  ,
int(*)(VALUE, VALUE each,
VALUE   
)

Definition at line 4542 of file string.c.

◆ rb_sym_proc_call()

VALUE rb_sym_proc_call ( ID  mid,
int  argc,
const VALUE argv,
int  kw_splat,
VALUE  passed_proc 
)

Definition at line 11159 of file string.c.

References argc, argv, rb_eArgError, rb_funcall_with_block_kw(), and rb_raise().

◆ ruby_escaped_char()

const char* ruby_escaped_char ( int  c)

Definition at line 6093 of file string.c.

References NULL.

strlen
size_t strlen(const char *)
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
rb_fstring_cstr
#define rb_fstring_cstr(str)
Definition: string.h:135