Ruby  1.9.3p551(2014-11-13revision48407)
intern.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  intern.h -
4 
5  $Author: usa $
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 #if defined(HAVE_SYS_TIME_H)
40 #include <sys/time.h>
41 #endif
42 
43 #include "ruby/st.h"
44 
45 #if defined __GNUC__ && __GNUC__ >= 4
46 #pragma GCC visibility push(default)
47 #endif
48 
49 /*
50  * Functions and variables that are used by more than one source file of
51  * the kernel.
52  */
53 
54 #define ID_ALLOCATOR 1
55 
56 /* array.c */
57 void rb_mem_clear(register VALUE*, register long);
60 VALUE rb_ary_new(void);
61 VALUE rb_ary_new2(long);
62 VALUE rb_ary_new3(long,...);
63 VALUE rb_ary_new4(long, const VALUE *);
64 VALUE rb_ary_tmp_new(long);
65 void rb_ary_free(VALUE);
66 void rb_ary_modify(VALUE);
69 VALUE rb_ary_subseq(VALUE, long, long);
70 void rb_ary_store(VALUE, long, VALUE);
79 VALUE rb_ary_entry(VALUE, long);
94 VALUE rb_ary_replace(VALUE copy, VALUE orig);
95 VALUE rb_get_values_at(VALUE, long, int, VALUE*, VALUE(*)(VALUE,long));
96 VALUE rb_ary_resize(VALUE ary, long len);
97 /* bignum.c */
98 VALUE rb_big_new(long, int);
99 int rb_bigzero_p(VALUE x);
101 void rb_big_2comp(VALUE);
103 void rb_big_resize(VALUE big, long len);
108 VALUE rb_cstr_to_inum(const char*, int, int);
109 VALUE rb_str_to_inum(VALUE, int, int);
110 VALUE rb_cstr2inum(const char*, int);
111 VALUE rb_str2inum(VALUE, int);
112 VALUE rb_big2str(VALUE, int);
113 VALUE rb_big2str0(VALUE, int, int);
115 #define rb_big2int(x) rb_big2long(x)
117 #define rb_big2uint(x) rb_big2ulong(x)
119 #if HAVE_LONG_LONG
120 VALUE rb_ll2inum(LONG_LONG);
121 VALUE rb_ull2inum(unsigned LONG_LONG);
122 LONG_LONG rb_big2ll(VALUE);
123 unsigned LONG_LONG rb_big2ull(VALUE);
124 #endif /* HAVE_LONG_LONG */
125 DEPRECATED(void rb_quad_pack(char*,VALUE));
126 DEPRECATED(VALUE rb_quad_unpack(const char*,int));
127 void rb_big_pack(VALUE val, unsigned long *buf, long num_longs);
128 VALUE rb_big_unpack(unsigned long *buf, long num_longs);
129 int rb_uv_to_utf8(char[6],unsigned long);
130 VALUE rb_dbl2big(double);
131 double rb_big2dbl(VALUE);
148 /* rational.c */
150 #define rb_rational_raw1(x) rb_rational_raw((x), INT2FIX(1))
151 #define rb_rational_raw2(x,y) rb_rational_raw((x), (y))
153 #define rb_rational_new1(x) rb_rational_new((x), INT2FIX(1))
154 #define rb_rational_new2(x,y) rb_rational_new((x), (y))
156 #define rb_Rational1(x) rb_Rational((x), INT2FIX(1))
157 #define rb_Rational2(x,y) rb_Rational((x), (y))
158 /* complex.c */
160 #define rb_complex_raw1(x) rb_complex_raw((x), INT2FIX(0))
161 #define rb_complex_raw2(x,y) rb_complex_raw((x), (y))
163 #define rb_complex_new1(x) rb_complex_new((x), INT2FIX(0))
164 #define rb_complex_new2(x,y) rb_complex_new((x), (y))
167 #define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
168 #define rb_Complex2(x,y) rb_Complex((x), (y))
169 /* class.c */
180 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 */
205 VALUE rb_fiber_current(void);
207 /* enum.c */
208 /* enumerator.c */
210 #define RETURN_ENUMERATOR(obj, argc, argv) do { \
211  if (!rb_block_given_p()) \
212  return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
213  (argc), (argv)); \
214  } while (0)
215 /* error.c */
216 VALUE rb_exc_new(VALUE, const char*, long);
217 VALUE rb_exc_new2(VALUE, const char*);
219 PRINTF_ARGS(NORETURN(void rb_loaderror(const char*, ...)), 1, 2);
220 PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3);
221 NORETURN(void rb_invalid_str(const char*, const char*));
222 PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4);
223 PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int, void *, const char*, ...), 4, 5);
224 PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2);
225 NORETURN(void rb_load_fail(const char*));
226 NORETURN(void rb_error_frozen(const char*));
227 void rb_check_frozen(VALUE);
228 #define rb_check_frozen_internal(obj) do { \
229  VALUE frozen_obj = (obj); \
230  if (OBJ_FROZEN(frozen_obj)) { \
231  rb_error_frozen(rb_obj_classname(frozen_obj)); \
232  } \
233  } while (0)
234 #ifdef __GNUC__
235 #define rb_check_frozen(obj) __extension__({rb_check_frozen_internal(obj);})
236 #else
237 static inline void
239 {
241 }
242 #define rb_check_frozen(obj) rb_check_frozen_inline(obj)
243 #endif
244 
245 /* eval.c */
246 int rb_sourceline(void);
247 const char *rb_sourcefile(void);
249 
250 #if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
251 typedef struct {
252  int maxfd;
253  fd_set *fdset;
254 } rb_fdset_t;
255 
256 void rb_fd_init(rb_fdset_t *);
257 void rb_fd_term(rb_fdset_t *);
258 void rb_fd_zero(rb_fdset_t *);
259 void rb_fd_set(int, rb_fdset_t *);
260 void rb_fd_clr(int, rb_fdset_t *);
261 int rb_fd_isset(int, const rb_fdset_t *);
262 void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
263 void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
264 int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
265 
266 #define rb_fd_ptr(f) ((f)->fdset)
267 #define rb_fd_max(f) ((f)->maxfd)
268 
269 #elif defined(_WIN32)
270 
271 typedef struct {
272  int capa;
273  fd_set *fdset;
274 } rb_fdset_t;
275 
276 void rb_fd_init(rb_fdset_t *);
277 void rb_fd_term(rb_fdset_t *);
278 #define rb_fd_zero(f) ((f)->fdset->fd_count = 0)
279 void rb_fd_set(int, rb_fdset_t *);
280 #define rb_fd_clr(n, f) rb_w32_fdclr((n), (f)->fdset)
281 #define rb_fd_isset(n, f) rb_w32_fdisset((n), (f)->fdset)
282 #define rb_fd_copy(d, s, n) rb_w32_fd_copy((d), (s), (n))
283 void rb_w32_fd_copy(rb_fdset_t *, const fd_set *, int);
284 #define rb_fd_dup(d, s) rb_w32_fd_dup((d), (s))
285 void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
286 #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))
287 #define rb_fd_resize(n, f) ((void)(f))
288 
289 #define rb_fd_ptr(f) ((f)->fdset)
290 #define rb_fd_max(f) ((f)->fdset->fd_count)
291 
292 #else
293 
294 typedef fd_set rb_fdset_t;
295 #define rb_fd_zero(f) FD_ZERO(f)
296 #define rb_fd_set(n, f) FD_SET((n), (f))
297 #define rb_fd_clr(n, f) FD_CLR((n), (f))
298 #define rb_fd_isset(n, f) FD_ISSET((n), (f))
299 #define rb_fd_copy(d, s, n) (*(d) = *(s))
300 #define rb_fd_dup(d, s) (*(d) = *(s))
301 #define rb_fd_resize(n, f) ((void)(f))
302 #define rb_fd_ptr(f) (f)
303 #define rb_fd_init(f) FD_ZERO(f)
304 #define rb_fd_init_copy(d, s) (*(d) = *(s))
305 #define rb_fd_term(f) ((void)(f))
306 #define rb_fd_max(f) FD_SETSIZE
307 #define rb_fd_select(n, rfds, wfds, efds, timeout) select((n), (rfds), (wfds), (efds), (timeout))
308 
309 #endif
310 
313 VALUE rb_f_exit(int,VALUE*);
314 VALUE rb_f_abort(int,VALUE*);
315 void rb_remove_method(VALUE, const char*);
317 #define rb_disable_super(klass, name) ((void)0)
318 #define rb_enable_super(klass, name) ((void)0)
319 #define HAVE_RB_DEFINE_ALLOC_FUNC 1
324 void rb_clear_cache(void);
326 void rb_alias(VALUE, ID, ID);
327 void rb_attr(VALUE,ID,int,int,int);
328 int rb_method_boundp(VALUE, ID, int);
331 int rb_obj_respond_to(VALUE, ID, int);
332 int rb_respond_to(VALUE, ID);
334 void rb_interrupt(void);
336 void rb_backtrace(void);
337 ID rb_frame_this_func(void);
342 void rb_load(VALUE, int);
343 void rb_load_protect(VALUE, int, int*);
344 NORETURN(void rb_jump_tag(int));
345 int rb_provided(const char*);
346 int rb_feature_provided(const char *, const char **);
347 void rb_provide(const char*);
350 void rb_obj_call_init(VALUE, int, VALUE*);
352 VALUE rb_block_proc(void);
354 VALUE rb_block_lambda(void);
355 VALUE rb_proc_new(VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE);
359 int rb_proc_arity(VALUE);
361 VALUE rb_binding_new(void);
368 VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
369 void rb_set_end_proc(void (*)(VALUE), VALUE);
370 void rb_mark_end_proc(void);
371 void rb_exec_end_proc(void);
372 void ruby_finalize(void);
373 NORETURN(void ruby_stop(int));
374 int ruby_cleanup(volatile int);
375 DEPRECATED(void rb_gc_mark_threads(void));
376 void rb_thread_schedule(void);
377 void rb_thread_wait_fd(int);
378 int rb_thread_fd_writable(int);
379 void rb_thread_fd_close(int);
380 int rb_thread_alone(void);
381 void rb_thread_polling(void);
382 void rb_thread_sleep(int);
383 void rb_thread_sleep_forever(void);
384 VALUE rb_thread_stop(void);
389 VALUE rb_thread_create(VALUE (*)(ANYARGS), void*);
390 DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
391 int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
392 void rb_thread_wait_for(struct timeval);
394 VALUE rb_thread_main(void);
397 void rb_thread_atfork(void);
403 /* dir.c */
404 VALUE rb_dir_getwd(void);
405 /* file.c */
411 void rb_file_const(const char*, VALUE);
412 int rb_file_load_ok(const char *);
413 int rb_find_file_ext_safe(VALUE*, const char* const*, int);
415 int rb_find_file_ext(VALUE*, const char* const*);
417 DEPRECATED(char *rb_path_next(const char *));
418 DEPRECATED(char *rb_path_skip_prefix(const char *));
419 DEPRECATED(char *rb_path_last_separator(const char *));
420 DEPRECATED(char *rb_path_end(const char *));
423 int rb_is_absolute_path(const char *);
424 DEPRECATED(const char *ruby_find_basename(const char *name, long *baselen, long *alllen));
425 DEPRECATED(const char *ruby_find_extname(const char *name, long *len));
426 /* gc.c */
427 void ruby_set_stack_size(size_t);
428 NORETURN(void rb_memerror(void));
429 int ruby_stack_check(void);
430 size_t ruby_stack_length(VALUE**);
431 int rb_during_gc(void);
433 void rb_mark_tbl(struct st_table*);
434 void rb_mark_set(struct st_table*);
435 void rb_mark_hash(struct st_table*);
436 void rb_gc_mark_maybe(VALUE);
437 void rb_gc_mark(VALUE);
439 void rb_gc(void);
441 void rb_gc_finalize_deferred(void);
443 VALUE rb_gc_enable(void);
444 VALUE rb_gc_disable(void);
445 VALUE rb_gc_start(void);
446 #define Init_stack(addr) ruby_init_stack(addr)
447 void rb_gc_set_params(void);
448 /* hash.c */
449 void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
451 void rb_hash_foreach(VALUE, int (*)(ANYARGS), VALUE);
453 VALUE rb_hash_new(void);
463 typedef VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value);
465 struct st_table *rb_hash_tbl(VALUE);
466 int rb_path_check(const char*);
467 int rb_env_path_tainted(void);
468 VALUE rb_env_clear(void);
469 /* io.c */
470 #define rb_defout rb_stdout
487 VALUE rb_io_printf(int, VALUE*, VALUE);
488 VALUE rb_io_print(int, VALUE*, VALUE);
489 VALUE rb_io_puts(int, VALUE*, VALUE);
490 VALUE rb_io_fdopen(int, int, const char*);
492 VALUE rb_file_open(const char*, const char*);
493 VALUE rb_file_open_str(VALUE, const char*);
494 VALUE rb_gets(void);
495 void rb_write_error(const char*);
496 void rb_write_error2(const char*, long);
497 void rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds);
498 int rb_pipe(int *pipes);
499 int rb_reserved_fd_p(int fd);
500 #define RB_RESERVED_FD_P(fd) rb_reserved_fd_p(fd)
501 void rb_update_max_fd(int fd);
502 /* marshal.c */
505 void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE), VALUE (*loader)(VALUE, VALUE));
506 /* numeric.c */
507 NORETURN(void rb_num_zerodiv(void));
508 #define RB_NUM_COERCE_FUNCS_NEED_OPID 1
512 VALUE rb_float_new(double);
514 VALUE rb_fix2str(VALUE, int);
515 VALUE rb_dbl_cmp(double, double);
516 /* object.c */
517 int rb_eql(VALUE, VALUE);
540 VALUE rb_convert_type(VALUE,int,const char*,const char*);
541 VALUE rb_check_convert_type(VALUE,int,const char*,const char*);
542 VALUE rb_check_to_integer(VALUE, const char *);
550 double rb_cstr_to_dbl(const char*, int);
551 double rb_str_to_dbl(VALUE, int);
552 /* parse.y */
556 void rb_gc_mark_parser(void);
557 int rb_is_const_id(ID);
558 int rb_is_instance_id(ID);
559 int rb_is_class_id(ID);
560 int rb_is_local_id(ID);
561 int rb_is_junk_id(ID);
562 int rb_symname_p(const char*);
564 void rb_gc_mark_symbols(void);
565 VALUE rb_backref_get(void);
566 void rb_backref_set(VALUE);
567 VALUE rb_lastline_get(void);
568 void rb_lastline_set(VALUE);
570 /* process.c */
571 void rb_last_status_set(int status, rb_pid_t pid);
573 struct rb_exec_arg {
574  int argc;
576  const char *prog;
579 };
580 int rb_proc_exec_n(int, VALUE*, const char*);
581 int rb_proc_exec(const char*);
582 VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e);
583 int rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val);
584 void rb_exec_arg_fixup(struct rb_exec_arg *e);
585 int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s);
586 int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t);
587 int rb_exec(const struct rb_exec_arg*);
588 int rb_exec_err(const struct rb_exec_arg*, char*, size_t);
589 rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE);
590 rb_pid_t rb_fork_err(int*, int (*)(void*, char*, size_t), void*, VALUE, char*, size_t);
591 VALUE rb_f_exec(int,VALUE*);
592 rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
593 void rb_syswait(rb_pid_t pid);
594 rb_pid_t rb_spawn(int, VALUE*);
595 rb_pid_t rb_spawn_err(int, VALUE*, char*, size_t);
597 VALUE rb_detach_process(rb_pid_t pid);
598 /* range.c */
600 VALUE rb_range_beg_len(VALUE, long*, long*, long, int);
601 int rb_range_values(VALUE range, VALUE *begp, VALUE *endp, int *exclp);
602 /* random.c */
603 unsigned int rb_genrand_int32(void);
604 double rb_genrand_real(void);
605 void rb_reset_random_seed(void);
606 VALUE rb_random_bytes(VALUE rnd, long n);
608 unsigned int rb_random_int32(VALUE rnd);
609 double rb_random_real(VALUE rnd);
610 unsigned long rb_genrand_ulong_limited(unsigned long i);
611 /* re.c */
612 #define rb_memcmp memcmp
613 int rb_memcicmp(const void*,const void*,long);
614 void rb_match_busy(VALUE);
617 int rb_reg_backref_number(VALUE match, VALUE backref);
622 #define HAVE_RB_REG_NEW_STR 1
624 VALUE rb_reg_new(const char *, long, int);
625 VALUE rb_reg_alloc(void);
629 int rb_reg_options(VALUE);
630 /* ruby.c */
631 #define rb_argv rb_get_argv()
633 VALUE rb_get_argv(void);
634 void *rb_load_file(const char*);
635 void ruby_script(const char*);
636 void ruby_prog_init(void);
637 void ruby_set_argv(int, char**);
638 void *ruby_process_options(int, char**);
639 void ruby_init_loadpath(void);
640 void ruby_incpush(const char*);
641 /* signal.c */
642 VALUE rb_f_kill(int, VALUE*);
643 void rb_gc_mark_trap_list(void);
644 #ifdef POSIX_SIGNAL
645 #define posix_signal ruby_posix_signal
646 RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
647 #endif
648 void ruby_sig_finalize(void);
649 void rb_trap_exit(void);
650 void rb_trap_exec(void);
651 const char *ruby_signal_name(int);
652 void ruby_default_signal(int);
653 /* sprintf.c */
654 VALUE rb_f_sprintf(int, const VALUE*);
655 PRINTF_ARGS(VALUE rb_sprintf(const char*, ...), 1, 2);
656 VALUE rb_vsprintf(const char*, va_list);
657 PRINTF_ARGS(VALUE rb_str_catf(VALUE, const char*, ...), 2, 3);
658 VALUE rb_str_vcatf(VALUE, const char*, va_list);
659 VALUE rb_str_format(int, const VALUE *, VALUE);
660 /* string.c */
661 VALUE rb_str_new(const char*, long);
662 VALUE rb_str_new_cstr(const char*);
663 VALUE rb_str_new2(const char*);
668 VALUE rb_str_new_with_class(VALUE, const char*, long);
669 VALUE rb_str_new5(VALUE, const char*, long);
670 VALUE rb_tainted_str_new_cstr(const char*);
671 VALUE rb_tainted_str_new(const char*, long);
672 VALUE rb_tainted_str_new2(const char*);
673 VALUE rb_external_str_new(const char*, long);
674 VALUE rb_external_str_new_cstr(const char*);
675 VALUE rb_locale_str_new(const char*, long);
676 VALUE rb_locale_str_new_cstr(const char*);
677 VALUE rb_filesystem_str_new(const char*, long);
678 VALUE rb_filesystem_str_new_cstr(const char*);
679 VALUE rb_str_buf_new(long);
680 VALUE rb_str_buf_new_cstr(const char*);
681 VALUE rb_str_buf_new2(const char*);
682 VALUE rb_str_tmp_new(long);
683 VALUE rb_usascii_str_new(const char*, long);
684 VALUE rb_usascii_str_new_cstr(const char*);
685 VALUE rb_usascii_str_new2(const char*);
686 void rb_str_free(VALUE);
689 VALUE rb_str_buf_cat(VALUE, const char*, long);
690 VALUE rb_str_buf_cat2(VALUE, const char*);
691 VALUE rb_str_buf_cat_ascii(VALUE, const char*);
699 #define rb_str_dup_frozen rb_str_new_frozen
702 long rb_str_sublen(VALUE, long);
703 VALUE rb_str_substr(VALUE, long, long);
704 VALUE rb_str_subseq(VALUE, long, long);
705 void rb_str_modify(VALUE);
706 void rb_str_modify_expand(VALUE, long);
708 void rb_str_set_len(VALUE, long);
709 VALUE rb_str_resize(VALUE, long);
710 VALUE rb_str_cat(VALUE, const char*, long);
711 VALUE rb_str_cat2(VALUE, const char*);
714 st_index_t rb_memhash(const void *ptr, long len);
719 #define rb_hash_uint32(h, i) st_hash_uint32((h), (i))
720 #define rb_hash_uint(h, i) st_hash_uint((h), (i))
721 #define rb_hash_end(h) st_hash_end(h)
725 int rb_str_cmp(VALUE, VALUE);
726 VALUE rb_str_equal(VALUE str1, VALUE str2);
728 void rb_str_update(VALUE, long, long, VALUE);
732 VALUE rb_str_split(VALUE, const char*);
735 void rb_str_setter(VALUE, ID, VALUE*);
738 long rb_str_strlen(VALUE);
740 long rb_str_offset(VALUE, long);
741 size_t rb_str_capacity(VALUE);
743 #if defined(__GNUC__) && !defined(__PCC__)
744 #define rb_str_new_cstr(str) __extension__ ( \
745 { \
746  (__builtin_constant_p(str)) ? \
747  rb_str_new((str), (long)strlen(str)) : \
748  rb_str_new_cstr(str); \
749 })
750 #define rb_tainted_str_new_cstr(str) __extension__ ( \
751 { \
752  (__builtin_constant_p(str)) ? \
753  rb_tainted_str_new((str), (long)strlen(str)) : \
754  rb_tainted_str_new_cstr(str); \
755 })
756 #define rb_usascii_str_new_cstr(str) __extension__ ( \
757 { \
758  (__builtin_constant_p(str)) ? \
759  rb_usascii_str_new((str), (long)strlen(str)) : \
760  rb_usascii_str_new_cstr(str); \
761 })
762 #define rb_external_str_new_cstr(str) __extension__ ( \
763 { \
764  (__builtin_constant_p(str)) ? \
765  rb_external_str_new((str), (long)strlen(str)) : \
766  rb_external_str_new_cstr(str); \
767 })
768 #define rb_locale_str_new_cstr(str) __extension__ ( \
769 { \
770  (__builtin_constant_p(str)) ? \
771  rb_locale_str_new((str), (long)strlen(str)) : \
772  rb_locale_str_new_cstr(str); \
773 })
774 #define rb_str_buf_new_cstr(str) __extension__ ( \
775 { \
776  (__builtin_constant_p(str)) ? \
777  rb_str_buf_cat(rb_str_buf_new((long)strlen(str)), \
778  (str), (long)strlen(str)) : \
779  rb_str_buf_new_cstr(str); \
780 })
781 #define rb_str_buf_cat2(str, ptr) __extension__ ( \
782 { \
783  (__builtin_constant_p(ptr)) ? \
784  rb_str_buf_cat((str), (ptr), (long)strlen(ptr)) : \
785  rb_str_buf_cat2((str), (ptr)); \
786 })
787 #define rb_str_cat2(str, ptr) __extension__ ( \
788 { \
789  (__builtin_constant_p(ptr)) ? \
790  rb_str_cat((str), (ptr), (long)strlen(ptr)) : \
791  rb_str_cat2((str), (ptr)); \
792 })
793 #define rb_exc_new2(klass, ptr) __extension__ ( \
794 { \
795  (__builtin_constant_p(ptr)) ? \
796  rb_exc_new((klass), (ptr), (long)strlen(ptr)) : \
797  rb_exc_new2((klass), (ptr)); \
798 })
799 #endif
800 #define rb_str_new2 rb_str_new_cstr
801 #define rb_str_new3 rb_str_new_shared
802 #define rb_str_new4 rb_str_new_frozen
803 #define rb_str_new5 rb_str_new_with_class
804 #define rb_tainted_str_new2 rb_tainted_str_new_cstr
805 #define rb_str_buf_new2 rb_str_buf_new_cstr
806 #define rb_usascii_str_new2 rb_usascii_str_new_cstr
807 /* struct.c */
809 VALUE rb_struct_define(const char*, ...);
815 DEPRECATED(VALUE rb_struct_iv_get(VALUE, const char*));
820 /* thread.c */
821 typedef void rb_unblock_function_t(void *);
823 void rb_thread_check_ints(void);
824 int rb_thread_interrupted(VALUE thval);
826  rb_unblock_function_t *ubf, void *data2);
827 #define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
828 #define RUBY_UBF_PROCESS ((rb_unblock_function_t *)-1)
829 VALUE rb_mutex_new(void);
832 VALUE rb_mutex_lock(VALUE mutex);
834 VALUE rb_mutex_sleep(VALUE self, VALUE timeout);
836 VALUE rb_barrier_new(void);
840 /* time.c */
841 VALUE rb_time_new(time_t, long);
842 VALUE rb_time_nano_new(time_t, long);
844 struct timeval rb_time_interval(VALUE num);
845 struct timeval rb_time_timeval(VALUE time);
846 struct timespec rb_time_timespec(VALUE time);
847 /* variable.c */
850 void rb_set_class_path(VALUE, VALUE, const char*);
853 VALUE rb_path2class(const char*);
854 void rb_name_class(VALUE, ID);
856 void rb_autoload(VALUE, ID, const char*);
859 void rb_gc_mark_global_tbl(void);
860 VALUE rb_f_trace_var(int, VALUE*);
863 void rb_alias_variable(ID, ID);
867 void rb_mark_generic_ivar_tbl(void);
872 void rb_ivar_foreach(VALUE, int (*)(ANYARGS), st_data_t);
874 VALUE rb_iv_set(VALUE, const char*, VALUE);
875 VALUE rb_iv_get(VALUE, const char*);
879 void *rb_mod_const_at(VALUE, void*);
880 void *rb_mod_const_of(VALUE, void*);
881 VALUE rb_const_list(void*);
890 void rb_const_set(VALUE, ID, VALUE);
894 void rb_cvar_set(VALUE, ID, VALUE);
896 void rb_cv_set(VALUE, const char*, VALUE);
897 VALUE rb_cv_get(VALUE, const char*);
898 void rb_define_class_variable(VALUE, const char*, VALUE);
901 /* version.c */
902 void ruby_show_version(void);
903 void ruby_show_copyright(void);
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