Ruby  2.1.3p242(2014-09-19revision47630)
intern.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  intern.h -
4 
5  $Author: nagachika $
6  created at: Thu Jun 10 14:22:17 JST 1993
7 
8  Copyright (C) 1993-2007 Yukihiro Matsumoto
9  Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
10  Copyright (C) 2000 Information-technology Promotion Agency, Japan
11 
12 **********************************************************************/
13 
14 #ifndef RUBY_INTERN_H
15 #define RUBY_INTERN_H 1
16 
17 #if defined(__cplusplus)
18 extern "C" {
19 #if 0
20 } /* satisfy cc-mode */
21 #endif
22 #endif
23 
24 #include "ruby/defines.h"
25 #ifdef RUBY_EXTCONF_H
26 #include RUBY_EXTCONF_H
27 #endif
28 
29 #ifdef HAVE_STDARG_PROTOTYPES
30 # include <stdarg.h>
31 #else
32 # include <varargs.h>
33 #endif
34 
35 #include "ruby/st.h"
36 
38 
39 /*
40  * Functions and variables that are used by more than one source file of
41  * the kernel.
42  */
43 
44 #define UNLIMITED_ARGUMENTS (-1)
45 
46 /* array.c */
47 void rb_mem_clear(register VALUE*, register long);
50 VALUE rb_ary_new(void);
51 VALUE rb_ary_new_capa(long capa);
52 VALUE rb_ary_new_from_args(long n, ...);
53 VALUE rb_ary_new_from_values(long n, const VALUE *elts);
54 VALUE rb_ary_tmp_new(long);
55 void rb_ary_free(VALUE);
56 void rb_ary_modify(VALUE);
60 VALUE rb_ary_subseq(VALUE, long, long);
61 void rb_ary_store(VALUE, long, VALUE);
66 VALUE rb_ary_cat(VALUE, const VALUE *, long);
71 VALUE rb_ary_entry(VALUE, long);
87 VALUE rb_ary_replace(VALUE copy, VALUE orig);
88 VALUE rb_get_values_at(VALUE, long, int, VALUE*, VALUE(*)(VALUE,long));
89 VALUE rb_ary_resize(VALUE ary, long len);
90 #define rb_ary_new2 rb_ary_new_capa
91 #define rb_ary_new3 rb_ary_new_from_args
92 #define rb_ary_new4 rb_ary_new_from_values
93 /* bignum.c */
94 VALUE rb_big_new(long, int);
95 int rb_bigzero_p(VALUE x);
97 void rb_big_2comp(VALUE);
99 void rb_big_resize(VALUE big, long len);
100 VALUE rb_cstr_to_inum(const char*, int, int);
101 VALUE rb_str_to_inum(VALUE, int, int);
102 VALUE rb_cstr2inum(const char*, int);
103 VALUE rb_str2inum(VALUE, int);
104 VALUE rb_big2str(VALUE, int);
105 DEPRECATED(VALUE rb_big2str0(VALUE, int, int));
107 #define rb_big2int(x) rb_big2long(x)
109 #define rb_big2uint(x) rb_big2ulong(x)
111 #if HAVE_LONG_LONG
112 LONG_LONG rb_big2ll(VALUE);
113 unsigned LONG_LONG rb_big2ull(VALUE);
114 #endif /* HAVE_LONG_LONG */
115 DEPRECATED(void rb_quad_pack(char*,VALUE));
116 DEPRECATED(VALUE rb_quad_unpack(const char*,int));
117 void rb_big_pack(VALUE val, unsigned long *buf, long num_longs);
118 VALUE rb_big_unpack(unsigned long *buf, long num_longs);
119 int rb_uv_to_utf8(char[6],unsigned long);
120 VALUE rb_dbl2big(double);
121 double rb_big2dbl(VALUE);
138 
139 /* For rb_integer_pack and rb_integer_unpack: */
140 /* "MS" in MSWORD and MSBYTE means "most significant" */
141 /* "LS" in LSWORD and LSBYTE means "least significant" */
142 #define INTEGER_PACK_MSWORD_FIRST 0x01
143 #define INTEGER_PACK_LSWORD_FIRST 0x02
144 #define INTEGER_PACK_MSBYTE_FIRST 0x10
145 #define INTEGER_PACK_LSBYTE_FIRST 0x20
146 #define INTEGER_PACK_NATIVE_BYTE_ORDER 0x40
147 #define INTEGER_PACK_2COMP 0x80
148 #define INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION 0x400
149 /* For rb_integer_unpack: */
150 #define INTEGER_PACK_FORCE_BIGNUM 0x100
151 #define INTEGER_PACK_NEGATIVE 0x200
152 /* Combinations: */
153 #define INTEGER_PACK_LITTLE_ENDIAN \
154  (INTEGER_PACK_LSWORD_FIRST | \
155  INTEGER_PACK_LSBYTE_FIRST)
156 #define INTEGER_PACK_BIG_ENDIAN \
157  (INTEGER_PACK_MSWORD_FIRST | \
158  INTEGER_PACK_MSBYTE_FIRST)
159 int rb_integer_pack(VALUE val, void *words, size_t numwords, size_t wordsize, size_t nails, int flags);
160 VALUE rb_integer_unpack(const void *words, size_t numwords, size_t wordsize, size_t nails, int flags);
161 size_t rb_absint_size(VALUE val, int *nlz_bits_ret);
162 size_t rb_absint_numwords(VALUE val, size_t word_numbits, size_t *nlz_bits_ret);
164 
165 /* rational.c */
167 #define rb_rational_raw1(x) rb_rational_raw((x), INT2FIX(1))
168 #define rb_rational_raw2(x,y) rb_rational_raw((x), (y))
170 #define rb_rational_new1(x) rb_rational_new((x), INT2FIX(1))
171 #define rb_rational_new2(x,y) rb_rational_new((x), (y))
173 #define rb_Rational1(x) rb_Rational((x), INT2FIX(1))
174 #define rb_Rational2(x,y) rb_Rational((x), (y))
177 /* complex.c */
179 #define rb_complex_raw1(x) rb_complex_raw((x), INT2FIX(0))
180 #define rb_complex_raw2(x,y) rb_complex_raw((x), (y))
182 #define rb_complex_new1(x) rb_complex_new((x), INT2FIX(0))
183 #define rb_complex_new2(x,y) rb_complex_new((x), (y))
186 #define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
187 #define rb_Complex2(x,y) rb_Complex((x), (y))
188 /* class.c */
199 VALUE rb_module_new(void);
211 void rb_define_method_id(VALUE, ID, VALUE (*)(ANYARGS), int);
213 void rb_undef(VALUE, ID);
214 void rb_define_protected_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
215 void rb_define_private_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
216 void rb_define_singleton_method(VALUE, const char*, VALUE(*)(ANYARGS), int);
218 /* compar.c */
219 int rb_cmpint(VALUE, VALUE, VALUE);
220 NORETURN(void rb_cmperr(VALUE, VALUE));
221 /* cont.c */
222 VALUE rb_fiber_new(VALUE (*)(ANYARGS), VALUE);
223 VALUE rb_fiber_resume(VALUE fib, int argc, VALUE *args);
224 VALUE rb_fiber_yield(int argc, VALUE *args);
225 VALUE rb_fiber_current(void);
227 /* enum.c */
228 VALUE rb_enum_values_pack(int, const VALUE*);
229 /* enumerator.c */
233 #ifndef RUBY_EXPORT
234 #define rb_enumeratorize_with_size(obj, id, argc, argv, size_fn) \
235  rb_enumeratorize_with_size(obj, id, argc, argv, (rb_enumerator_size_func *)(size_fn))
236 #endif
237 #define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
238  if (!rb_block_given_p()) \
239  return rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()),\
240  (argc), (argv), (size_fn)); \
241  } while (0)
242 #define RETURN_ENUMERATOR(obj, argc, argv) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
243 /* error.c */
244 VALUE rb_exc_new(VALUE, const char*, long);
245 VALUE rb_exc_new_cstr(VALUE, const char*);
247 #define rb_exc_new2 rb_exc_new_cstr
248 #define rb_exc_new3 rb_exc_new_str
249 PRINTF_ARGS(NORETURN(void rb_loaderror(const char*, ...)), 1, 2);
250 PRINTF_ARGS(NORETURN(void rb_loaderror_with_path(VALUE path, const char*, ...)), 2, 3);
251 PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3);
252 PRINTF_ARGS(NORETURN(void rb_name_error_str(VALUE, const char*, ...)), 2, 3);
253 NORETURN(void rb_invalid_str(const char*, const char*));
254 PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4);
255 PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int, void *, const char*, ...), 4, 5);
256 PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2);
257 NORETURN(void rb_error_frozen(const char*));
259 void rb_check_frozen(VALUE);
260 void rb_check_trusted(VALUE);
261 #define rb_check_frozen_internal(obj) do { \
262  VALUE frozen_obj = (obj); \
263  if (OBJ_FROZEN(frozen_obj)) { \
264  rb_error_frozen(rb_obj_classname(frozen_obj)); \
265  } \
266  } while (0)
267 #define rb_check_trusted_internal(obj) ((void) 0)
268 #ifdef __GNUC__
269 #define rb_check_frozen(obj) __extension__({rb_check_frozen_internal(obj);})
270 #define rb_check_trusted(obj) __extension__({rb_check_trusted_internal(obj);})
271 #else
272 static inline void
274 {
276 }
277 #define rb_check_frozen(obj) rb_check_frozen_inline(obj)
278 static inline void
280 {
282 }
283 #define rb_check_trusted(obj) rb_check_trusted_inline(obj)
284 #endif
285 void rb_check_copyable(VALUE obj, VALUE orig);
286 
287 #define OBJ_INIT_COPY(obj, orig) \
288  ((obj) != (orig) && (rb_obj_init_copy((obj), (orig)), 1))
289 
290 /* eval.c */
291 int rb_sourceline(void);
292 const char *rb_sourcefile(void);
293 VALUE rb_check_funcall(VALUE, ID, int, const VALUE*);
294 
295 NORETURN(void rb_error_arity(int, int, int));
296 #define rb_check_arity rb_check_arity /* for ifdef */
297 static inline void
298 rb_check_arity(int argc, int min, int max)
299 {
300  if ((argc < min) || (max != UNLIMITED_ARGUMENTS && argc > max))
301  rb_error_arity(argc, min, max);
302 }
303 
304 #if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
305 typedef struct {
306  int maxfd;
307  fd_set *fdset;
308 } rb_fdset_t;
309 
310 void rb_fd_init(rb_fdset_t *);
311 void rb_fd_term(rb_fdset_t *);
312 void rb_fd_zero(rb_fdset_t *);
313 void rb_fd_set(int, rb_fdset_t *);
314 void rb_fd_clr(int, rb_fdset_t *);
315 int rb_fd_isset(int, const rb_fdset_t *);
316 void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
317 void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
318 int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
319 
320 #define rb_fd_ptr(f) ((f)->fdset)
321 #define rb_fd_max(f) ((f)->maxfd)
322 
323 #elif defined(_WIN32)
324 
325 typedef struct {
326  int capa;
327  fd_set *fdset;
328 } rb_fdset_t;
329 
330 void rb_fd_init(rb_fdset_t *);
331 void rb_fd_term(rb_fdset_t *);
332 #define rb_fd_zero(f) ((f)->fdset->fd_count = 0)
333 void rb_fd_set(int, rb_fdset_t *);
334 #define rb_fd_clr(n, f) rb_w32_fdclr((n), (f)->fdset)
335 #define rb_fd_isset(n, f) rb_w32_fdisset((n), (f)->fdset)
336 #define rb_fd_copy(d, s, n) rb_w32_fd_copy((d), (s), (n))
337 void rb_w32_fd_copy(rb_fdset_t *, const fd_set *, int);
338 #define rb_fd_dup(d, s) rb_w32_fd_dup((d), (s))
339 void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
340 #define rb_fd_select(n, rfds, wfds, efds, timeout) rb_w32_select((n), (rfds) ? ((rb_fdset_t*)(rfds))->fdset : NULL, (wfds) ? ((rb_fdset_t*)(wfds))->fdset : NULL, (efds) ? ((rb_fdset_t*)(efds))->fdset: NULL, (timeout))
341 #define rb_fd_resize(n, f) ((void)(f))
342 
343 #define rb_fd_ptr(f) ((f)->fdset)
344 #define rb_fd_max(f) ((f)->fdset->fd_count)
345 
346 #else
347 
348 typedef fd_set rb_fdset_t;
349 #define rb_fd_zero(f) FD_ZERO(f)
350 #define rb_fd_set(n, f) FD_SET((n), (f))
351 #define rb_fd_clr(n, f) FD_CLR((n), (f))
352 #define rb_fd_isset(n, f) FD_ISSET((n), (f))
353 #define rb_fd_copy(d, s, n) (*(d) = *(s))
354 #define rb_fd_dup(d, s) (*(d) = *(s))
355 #define rb_fd_resize(n, f) ((void)(f))
356 #define rb_fd_ptr(f) (f)
357 #define rb_fd_init(f) FD_ZERO(f)
358 #define rb_fd_init_copy(d, s) (*(d) = *(s))
359 #define rb_fd_term(f) ((void)(f))
360 #define rb_fd_max(f) FD_SETSIZE
361 #define rb_fd_select(n, rfds, wfds, efds, timeout) select((n), (rfds), (wfds), (efds), (timeout))
362 
363 #endif
364 
367 VALUE rb_f_exit(int,VALUE*);
368 VALUE rb_f_abort(int,VALUE*);
369 void rb_remove_method(VALUE, const char*);
371 #define rb_disable_super(klass, name) ((void)0)
372 #define rb_enable_super(klass, name) ((void)0)
373 #define HAVE_RB_DEFINE_ALLOC_FUNC 1
378 void rb_clear_cache(void);
379 void rb_clear_constant_cache(void);
381 void rb_alias(VALUE, ID, ID);
382 void rb_attr(VALUE,ID,int,int,int);
383 int rb_method_boundp(VALUE, ID, int);
386 int rb_obj_respond_to(VALUE, ID, int);
387 int rb_respond_to(VALUE, ID);
389 void rb_interrupt(void);
391 void rb_backtrace(void);
392 ID rb_frame_this_func(void);
397 void rb_load(VALUE, int);
398 void rb_load_protect(VALUE, int, int*);
399 NORETURN(void rb_jump_tag(int));
400 int rb_provided(const char*);
401 int rb_feature_provided(const char *, const char **);
402 void rb_provide(const char*);
405 void rb_obj_call_init(VALUE, int, VALUE*);
407 VALUE rb_block_proc(void);
408 VALUE rb_block_lambda(void);
409 VALUE rb_proc_new(VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE);
413 int rb_proc_arity(VALUE);
415 VALUE rb_binding_new(void);
422 VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
423 void rb_set_end_proc(void (*)(VALUE), VALUE);
424 void rb_exec_end_proc(void);
425 void rb_thread_schedule(void);
426 void rb_thread_wait_fd(int);
427 int rb_thread_fd_writable(int);
428 void rb_thread_fd_close(int);
429 int rb_thread_alone(void);
430 DEPRECATED(void rb_thread_polling(void));
431 void rb_thread_sleep(int);
432 void rb_thread_sleep_forever(void);
433 void rb_thread_sleep_deadly(void);
434 VALUE rb_thread_stop(void);
439 VALUE rb_thread_create(VALUE (*)(ANYARGS), void*);
440 DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
441 int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
442 void rb_thread_wait_for(struct timeval);
444 VALUE rb_thread_main(void);
447 void rb_thread_atfork(void);
453 /* dir.c */
454 VALUE rb_dir_getwd(void);
455 /* file.c */
461 int rb_find_file_ext_safe(VALUE*, const char* const*, int);
463 int rb_find_file_ext(VALUE*, const char* const*);
467 int rb_is_absolute_path(const char *);
468 /* gc.c */
469 NORETURN(void rb_memerror(void));
470 int rb_during_gc(void);
472 void rb_mark_tbl(struct st_table*);
473 void rb_mark_set(struct st_table*);
474 void rb_mark_hash(struct st_table*);
475 void rb_gc_mark_maybe(VALUE);
476 void rb_gc_mark(VALUE);
478 void rb_gc(void);
480 void rb_gc_finalize_deferred(void);
482 VALUE rb_gc_enable(void);
483 VALUE rb_gc_disable(void);
484 VALUE rb_gc_start(void);
485 DEPRECATED(void rb_gc_set_params(void));
488 size_t rb_gc_count(void);
489 size_t rb_gc_stat(VALUE);
491 /* hash.c */
492 void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
494 void rb_hash_foreach(VALUE, int (*)(ANYARGS), VALUE);
496 VALUE rb_hash_new(void);
508 typedef VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value);
510 struct st_table *rb_hash_tbl(VALUE);
511 int rb_path_check(const char*);
512 int rb_env_path_tainted(void);
513 VALUE rb_env_clear(void);
514 /* io.c */
515 #define rb_defout rb_stdout
532 VALUE rb_io_printf(int, VALUE*, VALUE);
533 VALUE rb_io_print(int, VALUE*, VALUE);
534 VALUE rb_io_puts(int, VALUE*, VALUE);
535 VALUE rb_io_fdopen(int, int, const char*);
537 VALUE rb_file_open(const char*, const char*);
538 VALUE rb_file_open_str(VALUE, const char*);
539 VALUE rb_gets(void);
540 void rb_write_error(const char*);
541 void rb_write_error2(const char*, long);
542 void rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds);
543 int rb_pipe(int *pipes);
544 int rb_reserved_fd_p(int fd);
545 int rb_cloexec_open(const char *pathname, int flags, mode_t mode);
546 int rb_cloexec_dup(int oldfd);
547 int rb_cloexec_dup2(int oldfd, int newfd);
548 int rb_cloexec_pipe(int fildes[2]);
549 int rb_cloexec_fcntl_dupfd(int fd, int minfd);
550 #define RB_RESERVED_FD_P(fd) rb_reserved_fd_p(fd)
551 void rb_update_max_fd(int fd);
552 void rb_fd_fix_cloexec(int fd);
553 /* marshal.c */
556 void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE), VALUE (*loader)(VALUE, VALUE));
557 /* numeric.c */
558 NORETURN(void rb_num_zerodiv(void));
559 #define RB_NUM_COERCE_FUNCS_NEED_OPID 1
565 VALUE rb_fix2str(VALUE, int);
566 VALUE rb_dbl_cmp(double, double);
567 /* object.c */
568 int rb_eql(VALUE, VALUE);
591 VALUE rb_convert_type(VALUE,int,const char*,const char*);
592 VALUE rb_check_convert_type(VALUE,int,const char*,const char*);
593 VALUE rb_check_to_integer(VALUE, const char *);
603 double rb_cstr_to_dbl(const char*, int);
604 double rb_str_to_dbl(VALUE, int);
605 /* parse.y */
609 int rb_is_const_id(ID);
610 int rb_is_global_id(ID);
611 int rb_is_instance_id(ID);
612 int rb_is_attrset_id(ID);
613 int rb_is_class_id(ID);
614 int rb_is_local_id(ID);
615 int rb_is_junk_id(ID);
616 int rb_symname_p(const char*);
618 VALUE rb_backref_get(void);
619 void rb_backref_set(VALUE);
620 VALUE rb_lastline_get(void);
621 void rb_lastline_set(VALUE);
623 /* process.c */
624 void rb_last_status_set(int status, rb_pid_t pid);
626 struct rb_exec_arg {
628 };
629 DEPRECATED(int rb_proc_exec_n(int, VALUE*, const char*));
630 int rb_proc_exec(const char*);
631 DEPRECATED(VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e));
633 DEPRECATED(void rb_exec_arg_fixup(struct rb_exec_arg *e));
634 DEPRECATED(int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s));
635 DEPRECATED(int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t));
636 DEPRECATED(int rb_exec(const struct rb_exec_arg*));
637 DEPRECATED(int rb_exec_err(const struct rb_exec_arg*, char*, size_t));
638 DEPRECATED(rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE));
639 DEPRECATED(rb_pid_t rb_fork_err(int*, int (*)(void*, char*, size_t), void*, VALUE, char*, size_t));
640 VALUE rb_f_exec(int,VALUE*);
641 rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
642 void rb_syswait(rb_pid_t pid);
643 rb_pid_t rb_spawn(int, VALUE*);
644 rb_pid_t rb_spawn_err(int, VALUE*, char*, size_t);
646 VALUE rb_detach_process(rb_pid_t pid);
647 /* range.c */
649 VALUE rb_range_beg_len(VALUE, long*, long*, long, int);
650 int rb_range_values(VALUE range, VALUE *begp, VALUE *endp, int *exclp);
651 /* random.c */
652 unsigned int rb_genrand_int32(void);
653 double rb_genrand_real(void);
654 void rb_reset_random_seed(void);
655 VALUE rb_random_bytes(VALUE rnd, long n);
657 unsigned int rb_random_int32(VALUE rnd);
658 double rb_random_real(VALUE rnd);
659 unsigned long rb_random_ulong_limited(VALUE rnd, unsigned long limit);
660 unsigned long rb_genrand_ulong_limited(unsigned long i);
661 /* re.c */
662 #define rb_memcmp memcmp
663 int rb_memcicmp(const void*,const void*,long);
664 void rb_match_busy(VALUE);
667 int rb_reg_backref_number(VALUE match, VALUE backref);
672 #define HAVE_RB_REG_NEW_STR 1
674 VALUE rb_reg_new(const char *, long, int);
675 VALUE rb_reg_alloc(void);
679 int rb_reg_options(VALUE);
680 /* ruby.c */
681 #define rb_argv rb_get_argv()
683 VALUE rb_get_argv(void);
684 void *rb_load_file(const char*);
685 void *rb_load_file_str(VALUE);
686 /* signal.c */
687 VALUE rb_f_kill(int, VALUE*);
688 #ifdef POSIX_SIGNAL
689 #define posix_signal ruby_posix_signal
690 RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
691 #endif
692 void rb_trap_exit(void);
693 void rb_trap_exec(void);
694 const char *ruby_signal_name(int);
695 void ruby_default_signal(int);
696 /* sprintf.c */
697 VALUE rb_f_sprintf(int, const VALUE*);
698 PRINTF_ARGS(VALUE rb_sprintf(const char*, ...), 1, 2);
699 VALUE rb_vsprintf(const char*, va_list);
700 PRINTF_ARGS(VALUE rb_str_catf(VALUE, const char*, ...), 2, 3);
701 VALUE rb_str_vcatf(VALUE, const char*, va_list);
702 VALUE rb_str_format(int, const VALUE *, VALUE);
703 /* string.c */
704 VALUE rb_str_new(const char*, long);
705 VALUE rb_str_new_cstr(const char*);
708 VALUE rb_str_new_with_class(VALUE, const char*, long);
709 VALUE rb_tainted_str_new_cstr(const char*);
710 VALUE rb_tainted_str_new(const char*, long);
711 VALUE rb_external_str_new(const char*, long);
712 VALUE rb_external_str_new_cstr(const char*);
713 VALUE rb_locale_str_new(const char*, long);
714 VALUE rb_locale_str_new_cstr(const char*);
715 VALUE rb_filesystem_str_new(const char*, long);
716 VALUE rb_filesystem_str_new_cstr(const char*);
717 VALUE rb_str_buf_new(long);
718 VALUE rb_str_buf_new_cstr(const char*);
719 VALUE rb_str_buf_new2(const char*);
720 VALUE rb_str_tmp_new(long);
721 VALUE rb_usascii_str_new(const char*, long);
722 VALUE rb_usascii_str_new_cstr(const char*);
723 void rb_str_free(VALUE);
726 VALUE rb_str_buf_cat(VALUE, const char*, long);
727 VALUE rb_str_buf_cat2(VALUE, const char*);
728 VALUE rb_str_buf_cat_ascii(VALUE, const char*);
737 #define rb_str_dup_frozen rb_str_new_frozen
740 long rb_str_sublen(VALUE, long);
741 VALUE rb_str_substr(VALUE, long, long);
742 VALUE rb_str_subseq(VALUE, long, long);
743 char *rb_str_subpos(VALUE, long, long*);
744 void rb_str_modify(VALUE);
745 void rb_str_modify_expand(VALUE, long);
747 void rb_str_set_len(VALUE, long);
748 VALUE rb_str_resize(VALUE, long);
749 VALUE rb_str_cat(VALUE, const char*, long);
750 VALUE rb_str_cat2(VALUE, const char*);
753 st_index_t rb_memhash(const void *ptr, long len);
758 #define rb_hash_uint32(h, i) st_hash_uint32((h), (i))
759 #define rb_hash_uint(h, i) st_hash_uint((h), (i))
760 #define rb_hash_end(h) st_hash_end(h)
764 int rb_str_cmp(VALUE, VALUE);
765 VALUE rb_str_equal(VALUE str1, VALUE str2);
767 void rb_str_update(VALUE, long, long, VALUE);
771 VALUE rb_str_split(VALUE, const char*);
774 void rb_str_setter(VALUE, ID, VALUE*);
777 long rb_str_strlen(VALUE);
779 long rb_str_offset(VALUE, long);
780 size_t rb_str_capacity(VALUE);
783 #if defined(__GNUC__) && !defined(__PCC__)
784 #define rb_str_new_cstr(str) __extension__ ( \
785 { \
786  (__builtin_constant_p(str)) ? \
787  rb_str_new((str), (long)strlen(str)) : \
788  rb_str_new_cstr(str); \
789 })
790 #define rb_tainted_str_new_cstr(str) __extension__ ( \
791 { \
792  (__builtin_constant_p(str)) ? \
793  rb_tainted_str_new((str), (long)strlen(str)) : \
794  rb_tainted_str_new_cstr(str); \
795 })
796 #define rb_usascii_str_new_cstr(str) __extension__ ( \
797 { \
798  (__builtin_constant_p(str)) ? \
799  rb_usascii_str_new((str), (long)strlen(str)) : \
800  rb_usascii_str_new_cstr(str); \
801 })
802 #define rb_external_str_new_cstr(str) __extension__ ( \
803 { \
804  (__builtin_constant_p(str)) ? \
805  rb_external_str_new((str), (long)strlen(str)) : \
806  rb_external_str_new_cstr(str); \
807 })
808 #define rb_locale_str_new_cstr(str) __extension__ ( \
809 { \
810  (__builtin_constant_p(str)) ? \
811  rb_locale_str_new((str), (long)strlen(str)) : \
812  rb_locale_str_new_cstr(str); \
813 })
814 #define rb_str_buf_new_cstr(str) __extension__ ( \
815 { \
816  (__builtin_constant_p(str)) ? \
817  rb_str_buf_cat(rb_str_buf_new((long)strlen(str)), \
818  (str), (long)strlen(str)) : \
819  rb_str_buf_new_cstr(str); \
820 })
821 #define rb_str_buf_cat2(str, ptr) __extension__ ( \
822 { \
823  (__builtin_constant_p(ptr)) ? \
824  rb_str_buf_cat((str), (ptr), (long)strlen(ptr)) : \
825  rb_str_buf_cat2((str), (ptr)); \
826 })
827 #define rb_str_cat2(str, ptr) __extension__ ( \
828 { \
829  (__builtin_constant_p(ptr)) ? \
830  rb_str_cat((str), (ptr), (long)strlen(ptr)) : \
831  rb_str_cat2((str), (ptr)); \
832 })
833 #define rb_exc_new_cstr(klass, ptr) __extension__ ( \
834 { \
835  (__builtin_constant_p(ptr)) ? \
836  rb_exc_new((klass), (ptr), (long)strlen(ptr)) : \
837  rb_exc_new_cstr((klass), (ptr)); \
838 })
839 #endif
840 #define rb_str_new2 rb_str_new_cstr
841 #define rb_str_new3 rb_str_new_shared
842 #define rb_str_new4 rb_str_new_frozen
843 #define rb_str_new5 rb_str_new_with_class
844 #define rb_tainted_str_new2 rb_tainted_str_new_cstr
845 #define rb_str_buf_new2 rb_str_buf_new_cstr
846 #define rb_usascii_str_new2 rb_usascii_str_new_cstr
847 /* struct.c */
849 VALUE rb_struct_define(const char*, ...);
850 VALUE rb_struct_define_under(VALUE, const char*, ...);
856 DEPRECATED(VALUE rb_struct_iv_get(VALUE, const char*));
861 VALUE rb_struct_define_without_accessor_under(VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc, ...);
862 
863 /* thread.c */
864 typedef void rb_unblock_function_t(void *);
866 void rb_thread_check_ints(void);
867 int rb_thread_interrupted(VALUE thval);
868 
869 /* Use rb_thread_call_without_gvl family instead. */
871  rb_unblock_function_t *ubf, void *data2));
872 #define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
873 #define RUBY_UBF_PROCESS ((rb_unblock_function_t *)-1)
874 VALUE rb_mutex_new(void);
877 VALUE rb_mutex_lock(VALUE mutex);
879 VALUE rb_mutex_sleep(VALUE self, VALUE timeout);
881 /* time.c */
882 VALUE rb_time_new(time_t, long);
883 VALUE rb_time_nano_new(time_t, long);
885 struct timeval rb_time_interval(VALUE num);
886 struct timeval rb_time_timeval(VALUE time);
887 struct timespec rb_time_timespec(VALUE time);
888 /* variable.c */
892 void rb_set_class_path(VALUE, VALUE, const char*);
895 VALUE rb_path2class(const char*);
896 void rb_name_class(VALUE, ID);
898 void rb_autoload(VALUE, ID, const char*);
901 VALUE rb_f_trace_var(int, VALUE*);
904 void rb_alias_variable(ID, ID);
911 void rb_ivar_foreach(VALUE, int (*)(ANYARGS), st_data_t);
916 void *rb_mod_const_at(VALUE, void*);
917 void *rb_mod_const_of(VALUE, void*);
918 VALUE rb_const_list(void*);
927 void rb_const_set(VALUE, ID, VALUE);
931 void rb_cvar_set(VALUE, ID, VALUE);
933 void rb_cv_set(VALUE, const char*, VALUE);
934 VALUE rb_cv_get(VALUE, const char*);
935 void rb_define_class_variable(VALUE, const char*, VALUE);
938 
939 ID rb_frame_callee(void);
942 int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
945 
946 /* deprecated */
947 DEPRECATED(void rb_frame_pop(void));
948 
949 
951 
952 #if defined(__cplusplus)
953 #if 0
954 { /* satisfy cc-mode */
955 #endif
956 } /* extern "C" { */
957 #endif
958 
959 #endif /* RUBY_INTERN_H */
960