Ruby  1.9.3p392(2013-02-22revision39386)
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 #include "ruby/st.h"
35 
36 #if defined __GNUC__ && __GNUC__ >= 4
37 #pragma GCC visibility push(default)
38 #endif
39 
40 /*
41  * Functions and variables that are used by more than one source file of
42  * the kernel.
43  */
44 
45 #define ID_ALLOCATOR 1
46 
47 /* array.c */
48 void rb_mem_clear(register VALUE*, register long);
51 VALUE rb_ary_new(void);
52 VALUE rb_ary_new2(long);
53 VALUE rb_ary_new3(long,...);
54 VALUE rb_ary_new4(long, const VALUE *);
55 VALUE rb_ary_tmp_new(long);
56 void rb_ary_free(VALUE);
57 void rb_ary_modify(VALUE);
60 VALUE rb_ary_subseq(VALUE, long, long);
61 void rb_ary_store(VALUE, long, VALUE);
70 VALUE rb_ary_entry(VALUE, long);
85 VALUE rb_ary_replace(VALUE copy, VALUE orig);
86 VALUE rb_get_values_at(VALUE, long, int, VALUE*, VALUE(*)(VALUE,long));
87 VALUE rb_ary_resize(VALUE ary, long len);
88 /* bignum.c */
89 VALUE rb_big_new(long, int);
90 int rb_bigzero_p(VALUE x);
92 void rb_big_2comp(VALUE);
94 void rb_big_resize(VALUE big, long len);
99 VALUE rb_cstr_to_inum(const char*, int, int);
100 VALUE rb_str_to_inum(VALUE, int, int);
101 VALUE rb_cstr2inum(const char*, int);
102 VALUE rb_str2inum(VALUE, int);
103 VALUE rb_big2str(VALUE, int);
104 VALUE rb_big2str0(VALUE, int, int);
106 #define rb_big2int(x) rb_big2long(x)
108 #define rb_big2uint(x) rb_big2ulong(x)
110 #if HAVE_LONG_LONG
111 VALUE rb_ll2inum(LONG_LONG);
112 VALUE rb_ull2inum(unsigned LONG_LONG);
113 LONG_LONG rb_big2ll(VALUE);
114 unsigned LONG_LONG rb_big2ull(VALUE);
115 #endif /* HAVE_LONG_LONG */
116 DEPRECATED(void rb_quad_pack(char*,VALUE));
117 DEPRECATED(VALUE rb_quad_unpack(const char*,int));
118 void rb_big_pack(VALUE val, unsigned long *buf, long num_longs);
119 VALUE rb_big_unpack(unsigned long *buf, long num_longs);
120 int rb_uv_to_utf8(char[6],unsigned long);
121 VALUE rb_dbl2big(double);
122 double rb_big2dbl(VALUE);
139 /* rational.c */
141 #define rb_rational_raw1(x) rb_rational_raw((x), INT2FIX(1))
142 #define rb_rational_raw2(x,y) rb_rational_raw((x), (y))
144 #define rb_rational_new1(x) rb_rational_new((x), INT2FIX(1))
145 #define rb_rational_new2(x,y) rb_rational_new((x), (y))
147 #define rb_Rational1(x) rb_Rational((x), INT2FIX(1))
148 #define rb_Rational2(x,y) rb_Rational((x), (y))
149 /* complex.c */
151 #define rb_complex_raw1(x) rb_complex_raw((x), INT2FIX(0))
152 #define rb_complex_raw2(x,y) rb_complex_raw((x), (y))
154 #define rb_complex_new1(x) rb_complex_new((x), INT2FIX(0))
155 #define rb_complex_new2(x,y) rb_complex_new((x), (y))
158 #define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
159 #define rb_Complex2(x,y) rb_Complex((x), (y))
160 /* class.c */
172 VALUE rb_module_new(void);
183 void rb_define_method_id(VALUE, ID, VALUE (*)(ANYARGS), int);
185 void rb_undef(VALUE, ID);
186 void rb_define_protected_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
187 void rb_define_private_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
188 void rb_define_singleton_method(VALUE, const char*, VALUE(*)(ANYARGS), int);
190 /* compar.c */
191 int rb_cmpint(VALUE, VALUE, VALUE);
192 NORETURN(void rb_cmperr(VALUE, VALUE));
193 /* cont.c */
197 VALUE rb_fiber_current(void);
199 /* enum.c */
200 /* enumerator.c */
202 #define RETURN_ENUMERATOR(obj, argc, argv) do { \
203  if (!rb_block_given_p()) \
204  return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
205  (argc), (argv)); \
206  } while (0)
207 /* error.c */
208 VALUE rb_exc_new(VALUE, const char*, long);
209 VALUE rb_exc_new2(VALUE, const char*);
211 PRINTF_ARGS(NORETURN(void rb_loaderror(const char*, ...)), 1, 2);
212 PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3);
213 NORETURN(void rb_invalid_str(const char*, const char*));
214 PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4);
215 PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int, void *, const char*, ...), 4, 5);
216 PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2);
217 NORETURN(void rb_load_fail(const char*));
218 NORETURN(void rb_error_frozen(const char*));
219 void rb_check_frozen(VALUE);
220 #define rb_check_frozen_internal(obj) do { \
221  VALUE frozen_obj = (obj); \
222  if (OBJ_FROZEN(frozen_obj)) { \
223  rb_error_frozen(rb_obj_classname(frozen_obj)); \
224  } \
225  } while (0)
226 #ifdef __GNUC__
227 #define rb_check_frozen(obj) __extension__({rb_check_frozen_internal(obj);})
228 #else
229 static inline void
231 {
233 }
234 #define rb_check_frozen(obj) rb_check_frozen_inline(obj)
235 #endif
236 
237 /* eval.c */
238 int rb_sourceline(void);
239 const char *rb_sourcefile(void);
241 
242 #if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
243 typedef struct {
244  int maxfd;
245  fd_set *fdset;
246 } rb_fdset_t;
247 
248 void rb_fd_init(rb_fdset_t *);
249 void rb_fd_term(rb_fdset_t *);
250 void rb_fd_zero(rb_fdset_t *);
251 void rb_fd_set(int, rb_fdset_t *);
252 void rb_fd_clr(int, rb_fdset_t *);
253 int rb_fd_isset(int, const rb_fdset_t *);
254 void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
255 void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
256 int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
257 
258 #define rb_fd_ptr(f) ((f)->fdset)
259 #define rb_fd_max(f) ((f)->maxfd)
260 
261 #elif defined(_WIN32)
262 
263 typedef struct {
264  int capa;
265  fd_set *fdset;
266 } rb_fdset_t;
267 
268 void rb_fd_init(rb_fdset_t *);
269 void rb_fd_term(rb_fdset_t *);
270 #define rb_fd_zero(f) ((f)->fdset->fd_count = 0)
271 void rb_fd_set(int, rb_fdset_t *);
272 #define rb_fd_clr(n, f) rb_w32_fdclr((n), (f)->fdset)
273 #define rb_fd_isset(n, f) rb_w32_fdisset((n), (f)->fdset)
274 #define rb_fd_copy(d, s, n) rb_w32_fd_copy((d), (s), (n))
275 void rb_w32_fd_copy(rb_fdset_t *, const fd_set *, int);
276 #define rb_fd_dup(d, s) rb_w32_fd_dup((d), (s))
277 void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
278 #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))
279 #define rb_fd_resize(n, f) ((void)(f))
280 
281 #define rb_fd_ptr(f) ((f)->fdset)
282 #define rb_fd_max(f) ((f)->fdset->fd_count)
283 
284 #else
285 
286 typedef fd_set rb_fdset_t;
287 #define rb_fd_zero(f) FD_ZERO(f)
288 #define rb_fd_set(n, f) FD_SET((n), (f))
289 #define rb_fd_clr(n, f) FD_CLR((n), (f))
290 #define rb_fd_isset(n, f) FD_ISSET((n), (f))
291 #define rb_fd_copy(d, s, n) (*(d) = *(s))
292 #define rb_fd_dup(d, s) (*(d) = *(s))
293 #define rb_fd_resize(n, f) ((void)(f))
294 #define rb_fd_ptr(f) (f)
295 #define rb_fd_init(f) FD_ZERO(f)
296 #define rb_fd_init_copy(d, s) (*(d) = *(s))
297 #define rb_fd_term(f) ((void)(f))
298 #define rb_fd_max(f) FD_SETSIZE
299 #define rb_fd_select(n, rfds, wfds, efds, timeout) select((n), (rfds), (wfds), (efds), (timeout))
300 
301 #endif
302 
305 VALUE rb_f_exit(int,VALUE*);
306 VALUE rb_f_abort(int,VALUE*);
307 void rb_remove_method(VALUE, const char*);
309 #define rb_disable_super(klass, name) ((void)0)
310 #define rb_enable_super(klass, name) ((void)0)
311 #define HAVE_RB_DEFINE_ALLOC_FUNC 1
316 void rb_clear_cache(void);
318 void rb_alias(VALUE, ID, ID);
319 void rb_attr(VALUE,ID,int,int,int);
320 int rb_method_boundp(VALUE, ID, int);
323 int rb_obj_respond_to(VALUE, ID, int);
324 int rb_respond_to(VALUE, ID);
326 void rb_interrupt(void);
328 void rb_backtrace(void);
329 ID rb_frame_this_func(void);
334 void rb_load(VALUE, int);
335 void rb_load_protect(VALUE, int, int*);
336 NORETURN(void rb_jump_tag(int));
337 int rb_provided(const char*);
338 int rb_feature_provided(const char *, const char **);
339 void rb_provide(const char*);
342 void rb_obj_call_init(VALUE, int, VALUE*);
344 VALUE rb_block_proc(void);
345 VALUE rb_f_lambda(void);
346 VALUE rb_proc_new(VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE);
350 int rb_proc_arity(VALUE);
352 VALUE rb_binding_new(void);
358 VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
359 void rb_set_end_proc(void (*)(VALUE), VALUE);
360 void rb_mark_end_proc(void);
361 void rb_exec_end_proc(void);
362 void ruby_finalize(void);
363 NORETURN(void ruby_stop(int));
364 int ruby_cleanup(volatile int);
365 DEPRECATED(void rb_gc_mark_threads(void));
366 void rb_thread_schedule(void);
367 void rb_thread_wait_fd(int);
368 int rb_thread_fd_writable(int);
369 void rb_thread_fd_close(int);
370 int rb_thread_alone(void);
371 void rb_thread_polling(void);
372 void rb_thread_sleep(int);
373 void rb_thread_sleep_forever(void);
374 VALUE rb_thread_stop(void);
379 VALUE rb_thread_create(VALUE (*)(ANYARGS), void*);
380 DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
381 int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
382 void rb_thread_wait_for(struct timeval);
384 VALUE rb_thread_main(void);
387 void rb_thread_atfork(void);
392 /* dir.c */
393 VALUE rb_dir_getwd(void);
394 /* file.c */
400 void rb_file_const(const char*, VALUE);
401 int rb_file_load_ok(const char *);
402 int rb_find_file_ext_safe(VALUE*, const char* const*, int);
404 int rb_find_file_ext(VALUE*, const char* const*);
408 int rb_is_absolute_path(const char *);
409 /* gc.c */
410 void ruby_set_stack_size(size_t);
411 NORETURN(void rb_memerror(void));
412 int ruby_stack_check(void);
413 size_t ruby_stack_length(VALUE**);
414 int rb_during_gc(void);
416 void rb_mark_tbl(struct st_table*);
417 void rb_mark_set(struct st_table*);
418 void rb_mark_hash(struct st_table*);
419 void rb_gc_mark_maybe(VALUE);
420 void rb_gc_mark(VALUE);
422 void rb_gc(void);
424 void rb_gc_finalize_deferred(void);
426 VALUE rb_gc_enable(void);
427 VALUE rb_gc_disable(void);
428 VALUE rb_gc_start(void);
429 #define Init_stack(addr) ruby_init_stack(addr)
430 void rb_gc_set_params(void);
431 /* hash.c */
432 void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
434 void rb_hash_foreach(VALUE, int (*)(ANYARGS), VALUE);
436 VALUE rb_hash_new(void);
446 typedef VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value);
448 struct st_table *rb_hash_tbl(VALUE);
449 int rb_path_check(const char*);
450 int rb_env_path_tainted(void);
451 VALUE rb_env_clear(void);
452 /* io.c */
453 #define rb_defout rb_stdout
470 VALUE rb_io_printf(int, VALUE*, VALUE);
471 VALUE rb_io_print(int, VALUE*, VALUE);
472 VALUE rb_io_puts(int, VALUE*, VALUE);
473 VALUE rb_io_fdopen(int, int, const char*);
475 VALUE rb_file_open(const char*, const char*);
476 VALUE rb_file_open_str(VALUE, const char*);
477 VALUE rb_gets(void);
478 void rb_write_error(const char*);
479 void rb_write_error2(const char*, long);
480 void rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds);
481 int rb_pipe(int *pipes);
482 int rb_reserved_fd_p(int fd);
483 #define RB_RESERVED_FD_P(fd) rb_reserved_fd_p(fd)
484 void rb_update_max_fd(int fd);
485 /* marshal.c */
488 void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE), VALUE (*loader)(VALUE, VALUE));
489 /* numeric.c */
490 NORETURN(void rb_num_zerodiv(void));
491 #define RB_NUM_COERCE_FUNCS_NEED_OPID 1
495 VALUE rb_float_new(double);
497 VALUE rb_fix2str(VALUE, int);
498 VALUE rb_dbl_cmp(double, double);
499 /* object.c */
500 int rb_eql(VALUE, VALUE);
523 VALUE rb_convert_type(VALUE,int,const char*,const char*);
524 VALUE rb_check_convert_type(VALUE,int,const char*,const char*);
525 VALUE rb_check_to_integer(VALUE, const char *);
533 double rb_cstr_to_dbl(const char*, int);
534 double rb_str_to_dbl(VALUE, int);
535 /* parse.y */
539 void rb_gc_mark_parser(void);
540 int rb_is_const_id(ID);
541 int rb_is_instance_id(ID);
542 int rb_is_class_id(ID);
543 int rb_is_local_id(ID);
544 int rb_is_junk_id(ID);
545 int rb_symname_p(const char*);
547 void rb_gc_mark_symbols(void);
548 VALUE rb_backref_get(void);
549 void rb_backref_set(VALUE);
550 VALUE rb_lastline_get(void);
551 void rb_lastline_set(VALUE);
553 /* process.c */
554 void rb_last_status_set(int status, rb_pid_t pid);
556 struct rb_exec_arg {
557  int argc;
559  const char *prog;
562 };
563 int rb_proc_exec_n(int, VALUE*, const char*);
564 int rb_proc_exec(const char*);
565 VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e);
566 int rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val);
567 void rb_exec_arg_fixup(struct rb_exec_arg *e);
568 int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s);
569 int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t);
570 int rb_exec(const struct rb_exec_arg*);
571 int rb_exec_err(const struct rb_exec_arg*, char*, size_t);
572 rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE);
573 rb_pid_t rb_fork_err(int*, int (*)(void*, char*, size_t), void*, VALUE, char*, size_t);
574 VALUE rb_f_exec(int,VALUE*);
575 rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
576 void rb_syswait(rb_pid_t pid);
577 rb_pid_t rb_spawn(int, VALUE*);
578 rb_pid_t rb_spawn_err(int, VALUE*, char*, size_t);
580 VALUE rb_detach_process(rb_pid_t pid);
581 /* range.c */
583 VALUE rb_range_beg_len(VALUE, long*, long*, long, int);
584 int rb_range_values(VALUE range, VALUE *begp, VALUE *endp, int *exclp);
585 /* random.c */
586 unsigned int rb_genrand_int32(void);
587 double rb_genrand_real(void);
588 void rb_reset_random_seed(void);
589 VALUE rb_random_bytes(VALUE rnd, long n);
591 unsigned int rb_random_int32(VALUE rnd);
592 double rb_random_real(VALUE rnd);
593 unsigned long rb_genrand_ulong_limited(unsigned long i);
594 /* re.c */
595 #define rb_memcmp memcmp
596 int rb_memcicmp(const void*,const void*,long);
597 void rb_match_busy(VALUE);
600 int rb_reg_backref_number(VALUE match, VALUE backref);
605 #define HAVE_RB_REG_NEW_STR 1
607 VALUE rb_reg_new(const char *, long, int);
608 VALUE rb_reg_alloc(void);
612 int rb_reg_options(VALUE);
613 /* ruby.c */
614 #define rb_argv rb_get_argv()
616 VALUE rb_get_argv(void);
617 void *rb_load_file(const char*);
618 void ruby_script(const char*);
619 void ruby_prog_init(void);
620 void ruby_set_argv(int, char**);
621 void *ruby_process_options(int, char**);
622 void ruby_init_loadpath(void);
623 void ruby_incpush(const char*);
624 /* signal.c */
625 VALUE rb_f_kill(int, VALUE*);
626 void rb_gc_mark_trap_list(void);
627 #ifdef POSIX_SIGNAL
628 #define posix_signal ruby_posix_signal
629 RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
630 #endif
631 void ruby_sig_finalize(void);
632 void rb_trap_exit(void);
633 void rb_trap_exec(void);
634 const char *ruby_signal_name(int);
635 void ruby_default_signal(int);
636 /* sprintf.c */
637 VALUE rb_f_sprintf(int, const VALUE*);
638 PRINTF_ARGS(VALUE rb_sprintf(const char*, ...), 1, 2);
639 VALUE rb_vsprintf(const char*, va_list);
640 PRINTF_ARGS(VALUE rb_str_catf(VALUE, const char*, ...), 2, 3);
641 VALUE rb_str_vcatf(VALUE, const char*, va_list);
642 VALUE rb_str_format(int, const VALUE *, VALUE);
643 /* string.c */
644 VALUE rb_str_new(const char*, long);
645 VALUE rb_str_new_cstr(const char*);
646 VALUE rb_str_new2(const char*);
651 VALUE rb_str_new_with_class(VALUE, const char*, long);
652 VALUE rb_str_new5(VALUE, const char*, long);
653 VALUE rb_tainted_str_new_cstr(const char*);
654 VALUE rb_tainted_str_new(const char*, long);
655 VALUE rb_tainted_str_new2(const char*);
656 VALUE rb_external_str_new(const char*, long);
657 VALUE rb_external_str_new_cstr(const char*);
658 VALUE rb_locale_str_new(const char*, long);
659 VALUE rb_locale_str_new_cstr(const char*);
660 VALUE rb_filesystem_str_new(const char*, long);
661 VALUE rb_filesystem_str_new_cstr(const char*);
662 VALUE rb_str_buf_new(long);
663 VALUE rb_str_buf_new_cstr(const char*);
664 VALUE rb_str_buf_new2(const char*);
665 VALUE rb_str_tmp_new(long);
666 VALUE rb_usascii_str_new(const char*, long);
667 VALUE rb_usascii_str_new_cstr(const char*);
668 VALUE rb_usascii_str_new2(const char*);
669 void rb_str_free(VALUE);
672 VALUE rb_str_buf_cat(VALUE, const char*, long);
673 VALUE rb_str_buf_cat2(VALUE, const char*);
674 VALUE rb_str_buf_cat_ascii(VALUE, const char*);
682 #define rb_str_dup_frozen rb_str_new_frozen
685 long rb_str_sublen(VALUE, long);
686 VALUE rb_str_substr(VALUE, long, long);
687 VALUE rb_str_subseq(VALUE, long, long);
688 void rb_str_modify(VALUE);
689 void rb_str_modify_expand(VALUE, long);
691 void rb_str_set_len(VALUE, long);
692 VALUE rb_str_resize(VALUE, long);
693 VALUE rb_str_cat(VALUE, const char*, long);
694 VALUE rb_str_cat2(VALUE, const char*);
697 st_index_t rb_memhash(const void *ptr, long len);
702 #define rb_hash_uint32(h, i) st_hash_uint32((h), (i))
703 #define rb_hash_uint(h, i) st_hash_uint((h), (i))
704 #define rb_hash_end(h) st_hash_end(h)
708 int rb_str_cmp(VALUE, VALUE);
709 VALUE rb_str_equal(VALUE str1, VALUE str2);
711 void rb_str_update(VALUE, long, long, VALUE);
715 VALUE rb_str_split(VALUE, const char*);
718 void rb_str_setter(VALUE, ID, VALUE*);
721 long rb_str_strlen(VALUE);
723 long rb_str_offset(VALUE, long);
724 size_t rb_str_capacity(VALUE);
726 #if defined(__GNUC__) && !defined(__PCC__)
727 #define rb_str_new_cstr(str) __extension__ ( \
728 { \
729  (__builtin_constant_p(str)) ? \
730  rb_str_new((str), (long)strlen(str)) : \
731  rb_str_new_cstr(str); \
732 })
733 #define rb_tainted_str_new_cstr(str) __extension__ ( \
734 { \
735  (__builtin_constant_p(str)) ? \
736  rb_tainted_str_new((str), (long)strlen(str)) : \
737  rb_tainted_str_new_cstr(str); \
738 })
739 #define rb_usascii_str_new_cstr(str) __extension__ ( \
740 { \
741  (__builtin_constant_p(str)) ? \
742  rb_usascii_str_new((str), (long)strlen(str)) : \
743  rb_usascii_str_new_cstr(str); \
744 })
745 #define rb_external_str_new_cstr(str) __extension__ ( \
746 { \
747  (__builtin_constant_p(str)) ? \
748  rb_external_str_new((str), (long)strlen(str)) : \
749  rb_external_str_new_cstr(str); \
750 })
751 #define rb_locale_str_new_cstr(str) __extension__ ( \
752 { \
753  (__builtin_constant_p(str)) ? \
754  rb_locale_str_new((str), (long)strlen(str)) : \
755  rb_locale_str_new_cstr(str); \
756 })
757 #define rb_str_buf_new_cstr(str) __extension__ ( \
758 { \
759  (__builtin_constant_p(str)) ? \
760  rb_str_buf_cat(rb_str_buf_new((long)strlen(str)), \
761  (str), (long)strlen(str)) : \
762  rb_str_buf_new_cstr(str); \
763 })
764 #define rb_str_buf_cat2(str, ptr) __extension__ ( \
765 { \
766  (__builtin_constant_p(ptr)) ? \
767  rb_str_buf_cat((str), (ptr), (long)strlen(ptr)) : \
768  rb_str_buf_cat2((str), (ptr)); \
769 })
770 #define rb_str_cat2(str, ptr) __extension__ ( \
771 { \
772  (__builtin_constant_p(ptr)) ? \
773  rb_str_cat((str), (ptr), (long)strlen(ptr)) : \
774  rb_str_cat2((str), (ptr)); \
775 })
776 #define rb_exc_new2(klass, ptr) __extension__ ( \
777 { \
778  (__builtin_constant_p(ptr)) ? \
779  rb_exc_new((klass), (ptr), (long)strlen(ptr)) : \
780  rb_exc_new2((klass), (ptr)); \
781 })
782 #endif
783 #define rb_str_new2 rb_str_new_cstr
784 #define rb_str_new3 rb_str_new_shared
785 #define rb_str_new4 rb_str_new_frozen
786 #define rb_str_new5 rb_str_new_with_class
787 #define rb_tainted_str_new2 rb_tainted_str_new_cstr
788 #define rb_str_buf_new2 rb_str_buf_new_cstr
789 #define rb_usascii_str_new2 rb_usascii_str_new_cstr
790 /* struct.c */
792 VALUE rb_struct_define(const char*, ...);
798 DEPRECATED(VALUE rb_struct_iv_get(VALUE, const char*));
803 /* thread.c */
804 typedef void rb_unblock_function_t(void *);
806 void rb_thread_check_ints(void);
807 int rb_thread_interrupted(VALUE thval);
809  rb_unblock_function_t *ubf, void *data2);
810 #define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
811 #define RUBY_UBF_PROCESS ((rb_unblock_function_t *)-1)
812 VALUE rb_mutex_new(void);
815 VALUE rb_mutex_lock(VALUE mutex);
817 VALUE rb_mutex_sleep(VALUE self, VALUE timeout);
819 VALUE rb_barrier_new(void);
823 /* time.c */
824 VALUE rb_time_new(time_t, long);
827 struct timeval rb_time_interval(VALUE num);
828 struct timeval rb_time_timeval(VALUE time);
829 struct timespec rb_time_timespec(VALUE time);
830 /* variable.c */
833 void rb_set_class_path(VALUE, VALUE, const char*);
836 VALUE rb_path2class(const char*);
837 void rb_name_class(VALUE, ID);
839 void rb_autoload(VALUE, ID, const char*);
842 void rb_gc_mark_global_tbl(void);
843 VALUE rb_f_trace_var(int, VALUE*);
846 void rb_alias_variable(ID, ID);
850 void rb_mark_generic_ivar_tbl(void);
855 void rb_ivar_foreach(VALUE, int (*)(ANYARGS), st_data_t);
857 VALUE rb_iv_set(VALUE, const char*, VALUE);
858 VALUE rb_iv_get(VALUE, const char*);
862 void *rb_mod_const_at(VALUE, void*);
863 void *rb_mod_const_of(VALUE, void*);
864 VALUE rb_const_list(void*);
873 void rb_const_set(VALUE, ID, VALUE);
877 void rb_cvar_set(VALUE, ID, VALUE);
879 void rb_cv_set(VALUE, const char*, VALUE);
880 VALUE rb_cv_get(VALUE, const char*);
881 void rb_define_class_variable(VALUE, const char*, VALUE);
884 /* version.c */
885 void ruby_show_version(void);
886 void ruby_show_copyright(void);
887 
888 ID rb_frame_callee(void);
891 void rb_frame_pop(void);
892 int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
895 
896 #if defined __GNUC__ && __GNUC__ >= 4
897 #pragma GCC visibility pop
898 #endif
899 
900 #if defined(__cplusplus)
901 #if 0
902 { /* satisfy cc-mode */
903 #endif
904 } /* extern "C" { */
905 #endif
906 
907 #endif /* RUBY_INTERN_H */
908