Ruby  2.0.0p195(2013-05-14revision40734)
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 #if defined(HAVE_SYS_TYPES_H)
36 #include <sys/types.h>
37 #endif
38 
39 #include "ruby/st.h"
40 
41 #if defined __GNUC__ && __GNUC__ >= 4
42 #pragma GCC visibility push(default)
43 #endif
44 
45 /*
46  * Functions and variables that are used by more than one source file of
47  * the kernel.
48  */
49 
50 #define UNLIMITED_ARGUMENTS (-1)
51 
52 /* array.c */
53 void rb_mem_clear(register VALUE*, register long);
56 VALUE rb_ary_new(void);
57 VALUE rb_ary_new2(long);
58 VALUE rb_ary_new3(long,...);
59 VALUE rb_ary_new4(long, const VALUE *);
60 VALUE rb_ary_tmp_new(long);
61 void rb_ary_free(VALUE);
62 void rb_ary_modify(VALUE);
66 VALUE rb_ary_subseq(VALUE, long, long);
67 void rb_ary_store(VALUE, long, VALUE);
76 VALUE rb_ary_entry(VALUE, long);
92 VALUE rb_ary_replace(VALUE copy, VALUE orig);
93 VALUE rb_get_values_at(VALUE, long, int, VALUE*, VALUE(*)(VALUE,long));
94 VALUE rb_ary_resize(VALUE ary, long len);
95 /* bignum.c */
96 VALUE rb_big_new(long, int);
97 int rb_bigzero_p(VALUE x);
99 void rb_big_2comp(VALUE);
101 void rb_big_resize(VALUE big, long len);
103 VALUE rb_int2big(SIGNED_VALUE);
105 VALUE rb_int2inum(SIGNED_VALUE);
106 VALUE rb_cstr_to_inum(const char*, int, int);
107 VALUE rb_str_to_inum(VALUE, int, int);
108 VALUE rb_cstr2inum(const char*, int);
109 VALUE rb_str2inum(VALUE, int);
110 VALUE rb_big2str(VALUE, int);
111 VALUE rb_big2str0(VALUE, int, int);
113 #define rb_big2int(x) rb_big2long(x)
115 #define rb_big2uint(x) rb_big2ulong(x)
117 #if HAVE_LONG_LONG
118 VALUE rb_ll2inum(LONG_LONG);
119 VALUE rb_ull2inum(unsigned LONG_LONG);
120 LONG_LONG rb_big2ll(VALUE);
121 unsigned LONG_LONG rb_big2ull(VALUE);
122 #endif /* HAVE_LONG_LONG */
123 DEPRECATED(void rb_quad_pack(char*,VALUE));
124 DEPRECATED(VALUE rb_quad_unpack(const char*,int));
125 void rb_big_pack(VALUE val, unsigned long *buf, long num_longs);
126 VALUE rb_big_unpack(unsigned long *buf, long num_longs);
127 int rb_uv_to_utf8(char[6],unsigned long);
128 VALUE rb_dbl2big(double);
129 double rb_big2dbl(VALUE);
146 /* rational.c */
148 #define rb_rational_raw1(x) rb_rational_raw((x), INT2FIX(1))
149 #define rb_rational_raw2(x,y) rb_rational_raw((x), (y))
151 #define rb_rational_new1(x) rb_rational_new((x), INT2FIX(1))
152 #define rb_rational_new2(x,y) rb_rational_new((x), (y))
154 #define rb_Rational1(x) rb_Rational((x), INT2FIX(1))
155 #define rb_Rational2(x,y) rb_Rational((x), (y))
156 /* complex.c */
158 #define rb_complex_raw1(x) rb_complex_raw((x), INT2FIX(0))
159 #define rb_complex_raw2(x,y) rb_complex_raw((x), (y))
161 #define rb_complex_new1(x) rb_complex_new((x), INT2FIX(0))
162 #define rb_complex_new2(x,y) rb_complex_new((x), (y))
165 #define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
166 #define rb_Complex2(x,y) rb_Complex((x), (y))
167 /* class.c */
179 VALUE rb_module_new(void);
191 void rb_define_method_id(VALUE, ID, VALUE (*)(ANYARGS), int);
193 void rb_undef(VALUE, ID);
194 void rb_define_protected_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
195 void rb_define_private_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
196 void rb_define_singleton_method(VALUE, const char*, VALUE(*)(ANYARGS), int);
198 /* compar.c */
199 int rb_cmpint(VALUE, VALUE, VALUE);
200 NORETURN(void rb_cmperr(VALUE, VALUE));
201 /* cont.c */
202 VALUE rb_fiber_new(VALUE (*)(ANYARGS), VALUE);
205 VALUE rb_fiber_current(void);
207 /* enum.c */
209 /* enumerator.c */
211 VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, VALUE *, VALUE (*)(ANYARGS));
212 #define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
213  if (!rb_block_given_p()) \
214  return rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()),\
215  (argc), (argv), (size_fn)); \
216  } while (0)
217 #define RETURN_ENUMERATOR(obj, argc, argv) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
218 /* error.c */
219 VALUE rb_exc_new(VALUE, const char*, long);
220 VALUE rb_exc_new2(VALUE, const char*);
222 PRINTF_ARGS(NORETURN(void rb_loaderror(const char*, ...)), 1, 2);
223 PRINTF_ARGS(NORETURN(void rb_loaderror_with_path(VALUE path, const char*, ...)), 2, 3);
224 PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3);
225 PRINTF_ARGS(NORETURN(void rb_name_error_str(VALUE, const char*, ...)), 2, 3);
226 NORETURN(void rb_invalid_str(const char*, const char*));
227 PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4);
228 PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int, void *, const char*, ...), 4, 5);
229 PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2);
230 NORETURN(void rb_error_frozen(const char*));
232 void rb_check_frozen(VALUE);
233 void rb_check_trusted(VALUE);
234 #define rb_check_frozen_internal(obj) do { \
235  VALUE frozen_obj = (obj); \
236  if (OBJ_FROZEN(frozen_obj)) { \
237  rb_error_frozen(rb_obj_classname(frozen_obj)); \
238  } \
239  } while (0)
240 #define rb_check_trusted_internal(obj) do { \
241  VALUE untrusted_obj = (obj); \
242  if (!OBJ_UNTRUSTED(untrusted_obj)) { \
243  rb_error_untrusted(untrusted_obj); \
244  } \
245  } while (0)
246 #ifdef __GNUC__
247 #define rb_check_frozen(obj) __extension__({rb_check_frozen_internal(obj);})
248 #define rb_check_trusted(obj) __extension__({rb_check_trusted_internal(obj);})
249 #else
250 static inline void
252 {
254 }
255 #define rb_check_frozen(obj) rb_check_frozen_inline(obj)
256 static inline void
258 {
260 }
261 #define rb_check_trusted(obj) rb_check_trusted_inline(obj)
262 #endif
263 void rb_check_copyable(VALUE obj, VALUE orig);
264 
265 #define OBJ_INIT_COPY(obj, orig) \
266  ((obj) != (orig) && (rb_obj_init_copy((obj), (orig)), 1))
267 
268 /* eval.c */
269 int rb_sourceline(void);
270 const char *rb_sourcefile(void);
272 
273 NORETURN(void rb_error_arity(int, int, int));
274 #define rb_check_arity(argc, min, max) do { \
275  if (((argc) < (min)) || ((argc) > (max) && (max) != UNLIMITED_ARGUMENTS)) \
276  rb_error_arity(argc, min, max); \
277  } while(0)
278 
279 #if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
280 typedef struct {
281  int maxfd;
282  fd_set *fdset;
283 } rb_fdset_t;
284 
285 void rb_fd_init(rb_fdset_t *);
286 void rb_fd_term(rb_fdset_t *);
287 void rb_fd_zero(rb_fdset_t *);
288 void rb_fd_set(int, rb_fdset_t *);
289 void rb_fd_clr(int, rb_fdset_t *);
290 int rb_fd_isset(int, const rb_fdset_t *);
291 void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
292 void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
293 int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
294 
295 #define rb_fd_ptr(f) ((f)->fdset)
296 #define rb_fd_max(f) ((f)->maxfd)
297 
298 #elif defined(_WIN32)
299 
300 typedef struct {
301  int capa;
302  fd_set *fdset;
303 } rb_fdset_t;
304 
305 void rb_fd_init(rb_fdset_t *);
306 void rb_fd_term(rb_fdset_t *);
307 #define rb_fd_zero(f) ((f)->fdset->fd_count = 0)
308 void rb_fd_set(int, rb_fdset_t *);
309 #define rb_fd_clr(n, f) rb_w32_fdclr((n), (f)->fdset)
310 #define rb_fd_isset(n, f) rb_w32_fdisset((n), (f)->fdset)
311 #define rb_fd_copy(d, s, n) rb_w32_fd_copy((d), (s), (n))
312 void rb_w32_fd_copy(rb_fdset_t *, const fd_set *, int);
313 #define rb_fd_dup(d, s) rb_w32_fd_dup((d), (s))
314 void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
315 #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))
316 #define rb_fd_resize(n, f) ((void)(f))
317 
318 #define rb_fd_ptr(f) ((f)->fdset)
319 #define rb_fd_max(f) ((f)->fdset->fd_count)
320 
321 #else
322 
323 typedef fd_set rb_fdset_t;
324 #define rb_fd_zero(f) FD_ZERO(f)
325 #define rb_fd_set(n, f) FD_SET((n), (f))
326 #define rb_fd_clr(n, f) FD_CLR((n), (f))
327 #define rb_fd_isset(n, f) FD_ISSET((n), (f))
328 #define rb_fd_copy(d, s, n) (*(d) = *(s))
329 #define rb_fd_dup(d, s) (*(d) = *(s))
330 #define rb_fd_resize(n, f) ((void)(f))
331 #define rb_fd_ptr(f) (f)
332 #define rb_fd_init(f) FD_ZERO(f)
333 #define rb_fd_init_copy(d, s) (*(d) = *(s))
334 #define rb_fd_term(f) ((void)(f))
335 #define rb_fd_max(f) FD_SETSIZE
336 #define rb_fd_select(n, rfds, wfds, efds, timeout) select((n), (rfds), (wfds), (efds), (timeout))
337 
338 #endif
339 
342 VALUE rb_f_exit(int,VALUE*);
343 VALUE rb_f_abort(int,VALUE*);
344 void rb_remove_method(VALUE, const char*);
346 #define rb_disable_super(klass, name) ((void)0)
347 #define rb_enable_super(klass, name) ((void)0)
348 #define HAVE_RB_DEFINE_ALLOC_FUNC 1
353 void rb_clear_cache(void);
355 void rb_alias(VALUE, ID, ID);
356 void rb_attr(VALUE,ID,int,int,int);
357 int rb_method_boundp(VALUE, ID, int);
360 int rb_obj_respond_to(VALUE, ID, int);
361 int rb_respond_to(VALUE, ID);
363 void rb_interrupt(void);
365 void rb_backtrace(void);
366 ID rb_frame_this_func(void);
371 void rb_load(VALUE, int);
372 void rb_load_protect(VALUE, int, int*);
373 NORETURN(void rb_jump_tag(int));
374 int rb_provided(const char*);
375 int rb_feature_provided(const char *, const char **);
376 void rb_provide(const char*);
379 void rb_obj_call_init(VALUE, int, VALUE*);
381 VALUE rb_block_proc(void);
382 VALUE rb_f_lambda(void);
383 VALUE rb_proc_new(VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE);
387 int rb_proc_arity(VALUE);
389 VALUE rb_binding_new(void);
395 VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
396 void rb_set_end_proc(void (*)(VALUE), VALUE);
397 void rb_exec_end_proc(void);
398 void rb_thread_schedule(void);
399 void rb_thread_wait_fd(int);
400 int rb_thread_fd_writable(int);
401 void rb_thread_fd_close(int);
402 int rb_thread_alone(void);
403 DEPRECATED(void rb_thread_polling(void));
404 void rb_thread_sleep(int);
405 void rb_thread_sleep_forever(void);
406 VALUE rb_thread_stop(void);
411 VALUE rb_thread_create(VALUE (*)(ANYARGS), void*);
412 DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
413 int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
414 void rb_thread_wait_for(struct timeval);
416 VALUE rb_thread_main(void);
419 void rb_thread_atfork(void);
424 /* dir.c */
425 VALUE rb_dir_getwd(void);
426 /* file.c */
432 int rb_find_file_ext_safe(VALUE*, const char* const*, int);
434 int rb_find_file_ext(VALUE*, const char* const*);
438 int rb_is_absolute_path(const char *);
439 /* gc.c */
440 NORETURN(void rb_memerror(void));
441 int rb_during_gc(void);
443 void rb_mark_tbl(struct st_table*);
444 void rb_mark_set(struct st_table*);
445 void rb_mark_hash(struct st_table*);
446 void rb_gc_mark_maybe(VALUE);
447 void rb_gc_mark(VALUE);
449 void rb_gc(void);
451 void rb_gc_finalize_deferred(void);
453 VALUE rb_gc_enable(void);
454 VALUE rb_gc_disable(void);
455 VALUE rb_gc_start(void);
456 void rb_gc_set_params(void);
457 /* hash.c */
458 void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
460 void rb_hash_foreach(VALUE, int (*)(ANYARGS), VALUE);
462 VALUE rb_hash_new(void);
473 typedef VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value);
475 struct st_table *rb_hash_tbl(VALUE);
476 int rb_path_check(const char*);
477 int rb_env_path_tainted(void);
478 VALUE rb_env_clear(void);
479 /* io.c */
480 #define rb_defout rb_stdout
497 VALUE rb_io_printf(int, VALUE*, VALUE);
498 VALUE rb_io_print(int, VALUE*, VALUE);
499 VALUE rb_io_puts(int, VALUE*, VALUE);
500 VALUE rb_io_fdopen(int, int, const char*);
502 VALUE rb_file_open(const char*, const char*);
503 VALUE rb_file_open_str(VALUE, const char*);
504 VALUE rb_gets(void);
505 void rb_write_error(const char*);
506 void rb_write_error2(const char*, long);
507 void rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds);
508 int rb_pipe(int *pipes);
509 int rb_reserved_fd_p(int fd);
510 int rb_cloexec_open(const char *pathname, int flags, mode_t mode);
511 int rb_cloexec_dup(int oldfd);
512 int rb_cloexec_dup2(int oldfd, int newfd);
513 int rb_cloexec_pipe(int fildes[2]);
514 int rb_cloexec_fcntl_dupfd(int fd, int minfd);
515 #define RB_RESERVED_FD_P(fd) rb_reserved_fd_p(fd)
516 void rb_update_max_fd(int fd);
517 void rb_fd_fix_cloexec(int fd);
518 /* marshal.c */
521 void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE), VALUE (*loader)(VALUE, VALUE));
522 /* numeric.c */
523 NORETURN(void rb_num_zerodiv(void));
524 #define RB_NUM_COERCE_FUNCS_NEED_OPID 1
530 VALUE rb_fix2str(VALUE, int);
531 VALUE rb_dbl_cmp(double, double);
532 /* object.c */
533 int rb_eql(VALUE, VALUE);
556 VALUE rb_convert_type(VALUE,int,const char*,const char*);
557 VALUE rb_check_convert_type(VALUE,int,const char*,const char*);
558 VALUE rb_check_to_integer(VALUE, const char *);
568 double rb_cstr_to_dbl(const char*, int);
569 double rb_str_to_dbl(VALUE, int);
570 /* parse.y */
574 int rb_is_const_id(ID);
575 int rb_is_global_id(ID);
576 int rb_is_instance_id(ID);
577 int rb_is_attrset_id(ID);
578 int rb_is_class_id(ID);
579 int rb_is_local_id(ID);
580 int rb_is_junk_id(ID);
581 int rb_symname_p(const char*);
583 VALUE rb_backref_get(void);
584 void rb_backref_set(VALUE);
585 VALUE rb_lastline_get(void);
586 void rb_lastline_set(VALUE);
588 /* process.c */
589 void rb_last_status_set(int status, rb_pid_t pid);
591 struct rb_exec_arg {
593 };
594 DEPRECATED(int rb_proc_exec_n(int, VALUE*, const char*));
595 int rb_proc_exec(const char*);
596 DEPRECATED(VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e));
598 DEPRECATED(void rb_exec_arg_fixup(struct rb_exec_arg *e));
599 DEPRECATED(int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s));
600 DEPRECATED(int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t));
601 DEPRECATED(int rb_exec(const struct rb_exec_arg*));
602 DEPRECATED(int rb_exec_err(const struct rb_exec_arg*, char*, size_t));
603 DEPRECATED(rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE));
604 DEPRECATED(rb_pid_t rb_fork_err(int*, int (*)(void*, char*, size_t), void*, VALUE, char*, size_t));
605 VALUE rb_f_exec(int,VALUE*);
606 rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
607 void rb_syswait(rb_pid_t pid);
608 rb_pid_t rb_spawn(int, VALUE*);
609 rb_pid_t rb_spawn_err(int, VALUE*, char*, size_t);
611 VALUE rb_detach_process(rb_pid_t pid);
612 /* range.c */
614 VALUE rb_range_beg_len(VALUE, long*, long*, long, int);
615 int rb_range_values(VALUE range, VALUE *begp, VALUE *endp, int *exclp);
616 /* random.c */
617 unsigned int rb_genrand_int32(void);
618 double rb_genrand_real(void);
619 void rb_reset_random_seed(void);
620 VALUE rb_random_bytes(VALUE rnd, long n);
622 unsigned int rb_random_int32(VALUE rnd);
623 double rb_random_real(VALUE rnd);
624 unsigned long rb_random_ulong_limited(VALUE rnd, unsigned long limit);
625 unsigned long rb_genrand_ulong_limited(unsigned long i);
626 /* re.c */
627 #define rb_memcmp memcmp
628 int rb_memcicmp(const void*,const void*,long);
629 void rb_match_busy(VALUE);
632 int rb_reg_backref_number(VALUE match, VALUE backref);
637 #define HAVE_RB_REG_NEW_STR 1
639 VALUE rb_reg_new(const char *, long, int);
640 VALUE rb_reg_alloc(void);
644 int rb_reg_options(VALUE);
645 /* ruby.c */
646 #define rb_argv rb_get_argv()
648 VALUE rb_get_argv(void);
649 void *rb_load_file(const char*);
650 /* signal.c */
651 VALUE rb_f_kill(int, VALUE*);
652 #ifdef POSIX_SIGNAL
653 #define posix_signal ruby_posix_signal
654 RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
655 #endif
656 void rb_trap_exit(void);
657 void rb_trap_exec(void);
658 const char *ruby_signal_name(int);
659 void ruby_default_signal(int);
660 /* sprintf.c */
661 VALUE rb_f_sprintf(int, const VALUE*);
662 PRINTF_ARGS(VALUE rb_sprintf(const char*, ...), 1, 2);
663 VALUE rb_vsprintf(const char*, va_list);
664 PRINTF_ARGS(VALUE rb_str_catf(VALUE, const char*, ...), 2, 3);
665 VALUE rb_str_vcatf(VALUE, const char*, va_list);
666 VALUE rb_str_format(int, const VALUE *, VALUE);
667 /* string.c */
668 VALUE rb_str_new(const char*, long);
669 VALUE rb_str_new_cstr(const char*);
670 VALUE rb_str_new2(const char*);
675 VALUE rb_str_new_with_class(VALUE, const char*, long);
676 VALUE rb_str_new5(VALUE, const char*, long);
677 VALUE rb_tainted_str_new_cstr(const char*);
678 VALUE rb_tainted_str_new(const char*, long);
679 VALUE rb_tainted_str_new2(const char*);
680 VALUE rb_external_str_new(const char*, long);
681 VALUE rb_external_str_new_cstr(const char*);
682 VALUE rb_locale_str_new(const char*, long);
683 VALUE rb_locale_str_new_cstr(const char*);
684 VALUE rb_filesystem_str_new(const char*, long);
685 VALUE rb_filesystem_str_new_cstr(const char*);
686 VALUE rb_str_buf_new(long);
687 VALUE rb_str_buf_new_cstr(const char*);
688 VALUE rb_str_buf_new2(const char*);
689 VALUE rb_str_tmp_new(long);
690 VALUE rb_usascii_str_new(const char*, long);
691 VALUE rb_usascii_str_new_cstr(const char*);
692 VALUE rb_usascii_str_new2(const char*);
693 void rb_str_free(VALUE);
696 VALUE rb_str_buf_cat(VALUE, const char*, long);
697 VALUE rb_str_buf_cat2(VALUE, const char*);
698 VALUE rb_str_buf_cat_ascii(VALUE, const char*);
707 #define rb_str_dup_frozen rb_str_new_frozen
710 long rb_str_sublen(VALUE, long);
711 VALUE rb_str_substr(VALUE, long, long);
712 VALUE rb_str_subseq(VALUE, long, long);
713 void rb_str_modify(VALUE);
714 void rb_str_modify_expand(VALUE, long);
716 void rb_str_set_len(VALUE, long);
717 VALUE rb_str_resize(VALUE, long);
718 VALUE rb_str_cat(VALUE, const char*, long);
719 VALUE rb_str_cat2(VALUE, const char*);
722 st_index_t rb_memhash(const void *ptr, long len);
727 #define rb_hash_uint32(h, i) st_hash_uint32((h), (i))
728 #define rb_hash_uint(h, i) st_hash_uint((h), (i))
729 #define rb_hash_end(h) st_hash_end(h)
733 int rb_str_cmp(VALUE, VALUE);
734 VALUE rb_str_equal(VALUE str1, VALUE str2);
736 void rb_str_update(VALUE, long, long, VALUE);
740 VALUE rb_str_split(VALUE, const char*);
743 void rb_str_setter(VALUE, ID, VALUE*);
746 long rb_str_strlen(VALUE);
748 long rb_str_offset(VALUE, long);
749 size_t rb_str_capacity(VALUE);
751 #if defined(__GNUC__) && !defined(__PCC__)
752 #define rb_str_new_cstr(str) __extension__ ( \
753 { \
754  (__builtin_constant_p(str)) ? \
755  rb_str_new((str), (long)strlen(str)) : \
756  rb_str_new_cstr(str); \
757 })
758 #define rb_tainted_str_new_cstr(str) __extension__ ( \
759 { \
760  (__builtin_constant_p(str)) ? \
761  rb_tainted_str_new((str), (long)strlen(str)) : \
762  rb_tainted_str_new_cstr(str); \
763 })
764 #define rb_usascii_str_new_cstr(str) __extension__ ( \
765 { \
766  (__builtin_constant_p(str)) ? \
767  rb_usascii_str_new((str), (long)strlen(str)) : \
768  rb_usascii_str_new_cstr(str); \
769 })
770 #define rb_external_str_new_cstr(str) __extension__ ( \
771 { \
772  (__builtin_constant_p(str)) ? \
773  rb_external_str_new((str), (long)strlen(str)) : \
774  rb_external_str_new_cstr(str); \
775 })
776 #define rb_locale_str_new_cstr(str) __extension__ ( \
777 { \
778  (__builtin_constant_p(str)) ? \
779  rb_locale_str_new((str), (long)strlen(str)) : \
780  rb_locale_str_new_cstr(str); \
781 })
782 #define rb_str_buf_new_cstr(str) __extension__ ( \
783 { \
784  (__builtin_constant_p(str)) ? \
785  rb_str_buf_cat(rb_str_buf_new((long)strlen(str)), \
786  (str), (long)strlen(str)) : \
787  rb_str_buf_new_cstr(str); \
788 })
789 #define rb_str_buf_cat2(str, ptr) __extension__ ( \
790 { \
791  (__builtin_constant_p(ptr)) ? \
792  rb_str_buf_cat((str), (ptr), (long)strlen(ptr)) : \
793  rb_str_buf_cat2((str), (ptr)); \
794 })
795 #define rb_str_cat2(str, ptr) __extension__ ( \
796 { \
797  (__builtin_constant_p(ptr)) ? \
798  rb_str_cat((str), (ptr), (long)strlen(ptr)) : \
799  rb_str_cat2((str), (ptr)); \
800 })
801 #define rb_exc_new2(klass, ptr) __extension__ ( \
802 { \
803  (__builtin_constant_p(ptr)) ? \
804  rb_exc_new((klass), (ptr), (long)strlen(ptr)) : \
805  rb_exc_new2((klass), (ptr)); \
806 })
807 #endif
808 #define rb_str_new2 rb_str_new_cstr
809 #define rb_str_new3 rb_str_new_shared
810 #define rb_str_new4 rb_str_new_frozen
811 #define rb_str_new5 rb_str_new_with_class
812 #define rb_tainted_str_new2 rb_tainted_str_new_cstr
813 #define rb_str_buf_new2 rb_str_buf_new_cstr
814 #define rb_usascii_str_new2 rb_usascii_str_new_cstr
815 /* struct.c */
817 VALUE rb_struct_define(const char*, ...);
823 DEPRECATED(VALUE rb_struct_iv_get(VALUE, const char*));
828 /* thread.c */
829 typedef void rb_unblock_function_t(void *);
831 void rb_thread_check_ints(void);
832 int rb_thread_interrupted(VALUE thval);
833 
834 /* Use rb_thread_call_without_gvl family instead. */
836  rb_unblock_function_t *ubf, void *data2));
837 #define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
838 #define RUBY_UBF_PROCESS ((rb_unblock_function_t *)-1)
839 VALUE rb_mutex_new(void);
842 VALUE rb_mutex_lock(VALUE mutex);
844 VALUE rb_mutex_sleep(VALUE self, VALUE timeout);
846 /* time.c */
847 VALUE rb_time_new(time_t, long);
848 VALUE rb_time_nano_new(time_t, long);
850 struct timeval rb_time_interval(VALUE num);
851 struct timeval rb_time_timeval(VALUE time);
852 struct timespec rb_time_timespec(VALUE time);
853 /* variable.c */
856 void rb_set_class_path(VALUE, VALUE, const char*);
859 VALUE rb_path2class(const char*);
860 void rb_name_class(VALUE, ID);
862 void rb_autoload(VALUE, ID, const char*);
865 VALUE rb_f_trace_var(int, VALUE*);
868 void rb_alias_variable(ID, ID);
875 void rb_ivar_foreach(VALUE, int (*)(ANYARGS), st_data_t);
877 VALUE rb_iv_set(VALUE, const char*, VALUE);
878 VALUE rb_iv_get(VALUE, const char*);
882 void *rb_mod_const_at(VALUE, void*);
883 void *rb_mod_const_of(VALUE, void*);
884 VALUE rb_const_list(void*);
893 void rb_const_set(VALUE, ID, VALUE);
897 void rb_cvar_set(VALUE, ID, VALUE);
899 void rb_cv_set(VALUE, const char*, VALUE);
900 VALUE rb_cv_get(VALUE, const char*);
901 void rb_define_class_variable(VALUE, const char*, VALUE);
904 
905 ID rb_frame_callee(void);
908 void rb_frame_pop(void);
909 int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
912 
913 #if defined __GNUC__ && __GNUC__ >= 4
914 #pragma GCC visibility pop
915 #endif
916 
917 #if defined(__cplusplus)
918 #if 0
919 { /* satisfy cc-mode */
920 #endif
921 } /* extern "C" { */
922 #endif
923 
924 #endif /* RUBY_INTERN_H */
925