Ruby  1.9.3p429(2013-05-15revision40747)
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 */
181 VALUE rb_module_new(void);
192 void rb_define_method_id(VALUE, ID, VALUE (*)(ANYARGS), int);
194 void rb_undef(VALUE, ID);
195 void rb_define_protected_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
196 void rb_define_private_method(VALUE, const char*, VALUE (*)(ANYARGS), int);
197 void rb_define_singleton_method(VALUE, const char*, VALUE(*)(ANYARGS), int);
199 /* compar.c */
200 int rb_cmpint(VALUE, VALUE, VALUE);
201 NORETURN(void rb_cmperr(VALUE, VALUE));
202 /* cont.c */
206 VALUE rb_fiber_current(void);
208 /* enum.c */
209 /* enumerator.c */
211 #define RETURN_ENUMERATOR(obj, argc, argv) do { \
212  if (!rb_block_given_p()) \
213  return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
214  (argc), (argv)); \
215  } while (0)
216 /* error.c */
217 VALUE rb_exc_new(VALUE, const char*, long);
218 VALUE rb_exc_new2(VALUE, const char*);
220 PRINTF_ARGS(NORETURN(void rb_loaderror(const char*, ...)), 1, 2);
221 PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3);
222 NORETURN(void rb_invalid_str(const char*, const char*));
223 PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4);
224 PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int, void *, const char*, ...), 4, 5);
225 PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2);
226 NORETURN(void rb_load_fail(const char*));
227 NORETURN(void rb_error_frozen(const char*));
228 void rb_check_frozen(VALUE);
229 #define rb_check_frozen_internal(obj) do { \
230  VALUE frozen_obj = (obj); \
231  if (OBJ_FROZEN(frozen_obj)) { \
232  rb_error_frozen(rb_obj_classname(frozen_obj)); \
233  } \
234  } while (0)
235 #ifdef __GNUC__
236 #define rb_check_frozen(obj) __extension__({rb_check_frozen_internal(obj);})
237 #else
238 static inline void
240 {
242 }
243 #define rb_check_frozen(obj) rb_check_frozen_inline(obj)
244 #endif
245 
246 /* eval.c */
247 int rb_sourceline(void);
248 const char *rb_sourcefile(void);
250 
251 #if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
252 typedef struct {
253  int maxfd;
254  fd_set *fdset;
255 } rb_fdset_t;
256 
257 void rb_fd_init(rb_fdset_t *);
258 void rb_fd_term(rb_fdset_t *);
259 void rb_fd_zero(rb_fdset_t *);
260 void rb_fd_set(int, rb_fdset_t *);
261 void rb_fd_clr(int, rb_fdset_t *);
262 int rb_fd_isset(int, const rb_fdset_t *);
263 void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
264 void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
265 int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
266 
267 #define rb_fd_ptr(f) ((f)->fdset)
268 #define rb_fd_max(f) ((f)->maxfd)
269 
270 #elif defined(_WIN32)
271 
272 typedef struct {
273  int capa;
274  fd_set *fdset;
275 } rb_fdset_t;
276 
277 void rb_fd_init(rb_fdset_t *);
278 void rb_fd_term(rb_fdset_t *);
279 #define rb_fd_zero(f) ((f)->fdset->fd_count = 0)
280 void rb_fd_set(int, rb_fdset_t *);
281 #define rb_fd_clr(n, f) rb_w32_fdclr((n), (f)->fdset)
282 #define rb_fd_isset(n, f) rb_w32_fdisset((n), (f)->fdset)
283 #define rb_fd_copy(d, s, n) rb_w32_fd_copy((d), (s), (n))
284 void rb_w32_fd_copy(rb_fdset_t *, const fd_set *, int);
285 #define rb_fd_dup(d, s) rb_w32_fd_dup((d), (s))
286 void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
287 #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))
288 #define rb_fd_resize(n, f) ((void)(f))
289 
290 #define rb_fd_ptr(f) ((f)->fdset)
291 #define rb_fd_max(f) ((f)->fdset->fd_count)
292 
293 #else
294 
295 typedef fd_set rb_fdset_t;
296 #define rb_fd_zero(f) FD_ZERO(f)
297 #define rb_fd_set(n, f) FD_SET((n), (f))
298 #define rb_fd_clr(n, f) FD_CLR((n), (f))
299 #define rb_fd_isset(n, f) FD_ISSET((n), (f))
300 #define rb_fd_copy(d, s, n) (*(d) = *(s))
301 #define rb_fd_dup(d, s) (*(d) = *(s))
302 #define rb_fd_resize(n, f) ((void)(f))
303 #define rb_fd_ptr(f) (f)
304 #define rb_fd_init(f) FD_ZERO(f)
305 #define rb_fd_init_copy(d, s) (*(d) = *(s))
306 #define rb_fd_term(f) ((void)(f))
307 #define rb_fd_max(f) FD_SETSIZE
308 #define rb_fd_select(n, rfds, wfds, efds, timeout) select((n), (rfds), (wfds), (efds), (timeout))
309 
310 #endif
311 
314 VALUE rb_f_exit(int,VALUE*);
315 VALUE rb_f_abort(int,VALUE*);
316 void rb_remove_method(VALUE, const char*);
318 #define rb_disable_super(klass, name) ((void)0)
319 #define rb_enable_super(klass, name) ((void)0)
320 #define HAVE_RB_DEFINE_ALLOC_FUNC 1
325 void rb_clear_cache(void);
327 void rb_alias(VALUE, ID, ID);
328 void rb_attr(VALUE,ID,int,int,int);
329 int rb_method_boundp(VALUE, ID, int);
332 int rb_obj_respond_to(VALUE, ID, int);
333 int rb_respond_to(VALUE, ID);
335 void rb_interrupt(void);
337 void rb_backtrace(void);
338 ID rb_frame_this_func(void);
343 void rb_load(VALUE, int);
344 void rb_load_protect(VALUE, int, int*);
345 NORETURN(void rb_jump_tag(int));
346 int rb_provided(const char*);
347 int rb_feature_provided(const char *, const char **);
348 void rb_provide(const char*);
351 void rb_obj_call_init(VALUE, int, VALUE*);
353 VALUE rb_block_proc(void);
354 VALUE rb_f_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);
367 VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
368 void rb_set_end_proc(void (*)(VALUE), VALUE);
369 void rb_mark_end_proc(void);
370 void rb_exec_end_proc(void);
371 void ruby_finalize(void);
372 NORETURN(void ruby_stop(int));
373 int ruby_cleanup(volatile int);
374 DEPRECATED(void rb_gc_mark_threads(void));
375 void rb_thread_schedule(void);
376 void rb_thread_wait_fd(int);
377 int rb_thread_fd_writable(int);
378 void rb_thread_fd_close(int);
379 int rb_thread_alone(void);
380 void rb_thread_polling(void);
381 void rb_thread_sleep(int);
382 void rb_thread_sleep_forever(void);
383 VALUE rb_thread_stop(void);
388 VALUE rb_thread_create(VALUE (*)(ANYARGS), void*);
389 DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
390 int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
391 void rb_thread_wait_for(struct timeval);
393 VALUE rb_thread_main(void);
396 void rb_thread_atfork(void);
401 /* dir.c */
402 VALUE rb_dir_getwd(void);
403 /* file.c */
409 void rb_file_const(const char*, VALUE);
410 int rb_file_load_ok(const char *);
411 int rb_find_file_ext_safe(VALUE*, const char* const*, int);
413 int rb_find_file_ext(VALUE*, const char* const*);
417 int rb_is_absolute_path(const char *);
418 /* gc.c */
419 void ruby_set_stack_size(size_t);
420 NORETURN(void rb_memerror(void));
421 int ruby_stack_check(void);
422 size_t ruby_stack_length(VALUE**);
423 int rb_during_gc(void);
425 void rb_mark_tbl(struct st_table*);
426 void rb_mark_set(struct st_table*);
427 void rb_mark_hash(struct st_table*);
428 void rb_gc_mark_maybe(VALUE);
429 void rb_gc_mark(VALUE);
431 void rb_gc(void);
433 void rb_gc_finalize_deferred(void);
435 VALUE rb_gc_enable(void);
436 VALUE rb_gc_disable(void);
437 VALUE rb_gc_start(void);
438 #define Init_stack(addr) ruby_init_stack(addr)
439 void rb_gc_set_params(void);
440 /* hash.c */
441 void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
443 void rb_hash_foreach(VALUE, int (*)(ANYARGS), VALUE);
445 VALUE rb_hash_new(void);
455 typedef VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value);
457 struct st_table *rb_hash_tbl(VALUE);
458 int rb_path_check(const char*);
459 int rb_env_path_tainted(void);
460 VALUE rb_env_clear(void);
461 /* io.c */
462 #define rb_defout rb_stdout
479 VALUE rb_io_printf(int, VALUE*, VALUE);
480 VALUE rb_io_print(int, VALUE*, VALUE);
481 VALUE rb_io_puts(int, VALUE*, VALUE);
482 VALUE rb_io_fdopen(int, int, const char*);
484 VALUE rb_file_open(const char*, const char*);
485 VALUE rb_file_open_str(VALUE, const char*);
486 VALUE rb_gets(void);
487 void rb_write_error(const char*);
488 void rb_write_error2(const char*, long);
489 void rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds);
490 int rb_pipe(int *pipes);
491 int rb_reserved_fd_p(int fd);
492 #define RB_RESERVED_FD_P(fd) rb_reserved_fd_p(fd)
493 void rb_update_max_fd(int fd);
494 /* marshal.c */
497 void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE), VALUE (*loader)(VALUE, VALUE));
498 /* numeric.c */
499 NORETURN(void rb_num_zerodiv(void));
500 #define RB_NUM_COERCE_FUNCS_NEED_OPID 1
504 VALUE rb_float_new(double);
506 VALUE rb_fix2str(VALUE, int);
507 VALUE rb_dbl_cmp(double, double);
508 /* object.c */
509 int rb_eql(VALUE, VALUE);
532 VALUE rb_convert_type(VALUE,int,const char*,const char*);
533 VALUE rb_check_convert_type(VALUE,int,const char*,const char*);
534 VALUE rb_check_to_integer(VALUE, const char *);
542 double rb_cstr_to_dbl(const char*, int);
543 double rb_str_to_dbl(VALUE, int);
544 /* parse.y */
548 void rb_gc_mark_parser(void);
549 int rb_is_const_id(ID);
550 int rb_is_instance_id(ID);
551 int rb_is_class_id(ID);
552 int rb_is_local_id(ID);
553 int rb_is_junk_id(ID);
554 int rb_symname_p(const char*);
556 void rb_gc_mark_symbols(void);
557 VALUE rb_backref_get(void);
558 void rb_backref_set(VALUE);
559 VALUE rb_lastline_get(void);
560 void rb_lastline_set(VALUE);
562 /* process.c */
563 void rb_last_status_set(int status, rb_pid_t pid);
565 struct rb_exec_arg {
566  int argc;
568  const char *prog;
571 };
572 int rb_proc_exec_n(int, VALUE*, const char*);
573 int rb_proc_exec(const char*);
574 VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e);
575 int rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val);
576 void rb_exec_arg_fixup(struct rb_exec_arg *e);
577 int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s);
578 int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t);
579 int rb_exec(const struct rb_exec_arg*);
580 int rb_exec_err(const struct rb_exec_arg*, char*, size_t);
581 rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE);
582 rb_pid_t rb_fork_err(int*, int (*)(void*, char*, size_t), void*, VALUE, char*, size_t);
583 VALUE rb_f_exec(int,VALUE*);
584 rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
585 void rb_syswait(rb_pid_t pid);
586 rb_pid_t rb_spawn(int, VALUE*);
587 rb_pid_t rb_spawn_err(int, VALUE*, char*, size_t);
589 VALUE rb_detach_process(rb_pid_t pid);
590 /* range.c */
592 VALUE rb_range_beg_len(VALUE, long*, long*, long, int);
593 int rb_range_values(VALUE range, VALUE *begp, VALUE *endp, int *exclp);
594 /* random.c */
595 unsigned int rb_genrand_int32(void);
596 double rb_genrand_real(void);
597 void rb_reset_random_seed(void);
598 VALUE rb_random_bytes(VALUE rnd, long n);
600 unsigned int rb_random_int32(VALUE rnd);
601 double rb_random_real(VALUE rnd);
602 unsigned long rb_genrand_ulong_limited(unsigned long i);
603 /* re.c */
604 #define rb_memcmp memcmp
605 int rb_memcicmp(const void*,const void*,long);
606 void rb_match_busy(VALUE);
609 int rb_reg_backref_number(VALUE match, VALUE backref);
614 #define HAVE_RB_REG_NEW_STR 1
616 VALUE rb_reg_new(const char *, long, int);
617 VALUE rb_reg_alloc(void);
621 int rb_reg_options(VALUE);
622 /* ruby.c */
623 #define rb_argv rb_get_argv()
625 VALUE rb_get_argv(void);
626 void *rb_load_file(const char*);
627 void ruby_script(const char*);
628 void ruby_prog_init(void);
629 void ruby_set_argv(int, char**);
630 void *ruby_process_options(int, char**);
631 void ruby_init_loadpath(void);
632 void ruby_incpush(const char*);
633 /* signal.c */
634 VALUE rb_f_kill(int, VALUE*);
635 void rb_gc_mark_trap_list(void);
636 #ifdef POSIX_SIGNAL
637 #define posix_signal ruby_posix_signal
638 RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
639 #endif
640 void ruby_sig_finalize(void);
641 void rb_trap_exit(void);
642 void rb_trap_exec(void);
643 const char *ruby_signal_name(int);
644 void ruby_default_signal(int);
645 /* sprintf.c */
646 VALUE rb_f_sprintf(int, const VALUE*);
647 PRINTF_ARGS(VALUE rb_sprintf(const char*, ...), 1, 2);
648 VALUE rb_vsprintf(const char*, va_list);
649 PRINTF_ARGS(VALUE rb_str_catf(VALUE, const char*, ...), 2, 3);
650 VALUE rb_str_vcatf(VALUE, const char*, va_list);
651 VALUE rb_str_format(int, const VALUE *, VALUE);
652 /* string.c */
653 VALUE rb_str_new(const char*, long);
654 VALUE rb_str_new_cstr(const char*);
655 VALUE rb_str_new2(const char*);
660 VALUE rb_str_new_with_class(VALUE, const char*, long);
661 VALUE rb_str_new5(VALUE, const char*, long);
662 VALUE rb_tainted_str_new_cstr(const char*);
663 VALUE rb_tainted_str_new(const char*, long);
664 VALUE rb_tainted_str_new2(const char*);
665 VALUE rb_external_str_new(const char*, long);
666 VALUE rb_external_str_new_cstr(const char*);
667 VALUE rb_locale_str_new(const char*, long);
668 VALUE rb_locale_str_new_cstr(const char*);
669 VALUE rb_filesystem_str_new(const char*, long);
670 VALUE rb_filesystem_str_new_cstr(const char*);
671 VALUE rb_str_buf_new(long);
672 VALUE rb_str_buf_new_cstr(const char*);
673 VALUE rb_str_buf_new2(const char*);
674 VALUE rb_str_tmp_new(long);
675 VALUE rb_usascii_str_new(const char*, long);
676 VALUE rb_usascii_str_new_cstr(const char*);
677 VALUE rb_usascii_str_new2(const char*);
678 void rb_str_free(VALUE);
681 VALUE rb_str_buf_cat(VALUE, const char*, long);
682 VALUE rb_str_buf_cat2(VALUE, const char*);
683 VALUE rb_str_buf_cat_ascii(VALUE, const char*);
691 #define rb_str_dup_frozen rb_str_new_frozen
694 long rb_str_sublen(VALUE, long);
695 VALUE rb_str_substr(VALUE, long, long);
696 VALUE rb_str_subseq(VALUE, long, long);
697 void rb_str_modify(VALUE);
698 void rb_str_modify_expand(VALUE, long);
700 void rb_str_set_len(VALUE, long);
701 VALUE rb_str_resize(VALUE, long);
702 VALUE rb_str_cat(VALUE, const char*, long);
703 VALUE rb_str_cat2(VALUE, const char*);
706 st_index_t rb_memhash(const void *ptr, long len);
711 #define rb_hash_uint32(h, i) st_hash_uint32((h), (i))
712 #define rb_hash_uint(h, i) st_hash_uint((h), (i))
713 #define rb_hash_end(h) st_hash_end(h)
717 int rb_str_cmp(VALUE, VALUE);
718 VALUE rb_str_equal(VALUE str1, VALUE str2);
720 void rb_str_update(VALUE, long, long, VALUE);
724 VALUE rb_str_split(VALUE, const char*);
727 void rb_str_setter(VALUE, ID, VALUE*);
730 long rb_str_strlen(VALUE);
732 long rb_str_offset(VALUE, long);
733 size_t rb_str_capacity(VALUE);
735 #if defined(__GNUC__) && !defined(__PCC__)
736 #define rb_str_new_cstr(str) __extension__ ( \
737 { \
738  (__builtin_constant_p(str)) ? \
739  rb_str_new((str), (long)strlen(str)) : \
740  rb_str_new_cstr(str); \
741 })
742 #define rb_tainted_str_new_cstr(str) __extension__ ( \
743 { \
744  (__builtin_constant_p(str)) ? \
745  rb_tainted_str_new((str), (long)strlen(str)) : \
746  rb_tainted_str_new_cstr(str); \
747 })
748 #define rb_usascii_str_new_cstr(str) __extension__ ( \
749 { \
750  (__builtin_constant_p(str)) ? \
751  rb_usascii_str_new((str), (long)strlen(str)) : \
752  rb_usascii_str_new_cstr(str); \
753 })
754 #define rb_external_str_new_cstr(str) __extension__ ( \
755 { \
756  (__builtin_constant_p(str)) ? \
757  rb_external_str_new((str), (long)strlen(str)) : \
758  rb_external_str_new_cstr(str); \
759 })
760 #define rb_locale_str_new_cstr(str) __extension__ ( \
761 { \
762  (__builtin_constant_p(str)) ? \
763  rb_locale_str_new((str), (long)strlen(str)) : \
764  rb_locale_str_new_cstr(str); \
765 })
766 #define rb_str_buf_new_cstr(str) __extension__ ( \
767 { \
768  (__builtin_constant_p(str)) ? \
769  rb_str_buf_cat(rb_str_buf_new((long)strlen(str)), \
770  (str), (long)strlen(str)) : \
771  rb_str_buf_new_cstr(str); \
772 })
773 #define rb_str_buf_cat2(str, ptr) __extension__ ( \
774 { \
775  (__builtin_constant_p(ptr)) ? \
776  rb_str_buf_cat((str), (ptr), (long)strlen(ptr)) : \
777  rb_str_buf_cat2((str), (ptr)); \
778 })
779 #define rb_str_cat2(str, ptr) __extension__ ( \
780 { \
781  (__builtin_constant_p(ptr)) ? \
782  rb_str_cat((str), (ptr), (long)strlen(ptr)) : \
783  rb_str_cat2((str), (ptr)); \
784 })
785 #define rb_exc_new2(klass, ptr) __extension__ ( \
786 { \
787  (__builtin_constant_p(ptr)) ? \
788  rb_exc_new((klass), (ptr), (long)strlen(ptr)) : \
789  rb_exc_new2((klass), (ptr)); \
790 })
791 #endif
792 #define rb_str_new2 rb_str_new_cstr
793 #define rb_str_new3 rb_str_new_shared
794 #define rb_str_new4 rb_str_new_frozen
795 #define rb_str_new5 rb_str_new_with_class
796 #define rb_tainted_str_new2 rb_tainted_str_new_cstr
797 #define rb_str_buf_new2 rb_str_buf_new_cstr
798 #define rb_usascii_str_new2 rb_usascii_str_new_cstr
799 /* struct.c */
801 VALUE rb_struct_define(const char*, ...);
807 DEPRECATED(VALUE rb_struct_iv_get(VALUE, const char*));
812 /* thread.c */
813 typedef void rb_unblock_function_t(void *);
815 void rb_thread_check_ints(void);
816 int rb_thread_interrupted(VALUE thval);
818  rb_unblock_function_t *ubf, void *data2);
819 #define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
820 #define RUBY_UBF_PROCESS ((rb_unblock_function_t *)-1)
821 VALUE rb_mutex_new(void);
824 VALUE rb_mutex_lock(VALUE mutex);
826 VALUE rb_mutex_sleep(VALUE self, VALUE timeout);
828 VALUE rb_barrier_new(void);
832 /* time.c */
833 VALUE rb_time_new(time_t, long);
834 VALUE rb_time_nano_new(time_t, long);
836 struct timeval rb_time_interval(VALUE num);
837 struct timeval rb_time_timeval(VALUE time);
838 struct timespec rb_time_timespec(VALUE time);
839 /* variable.c */
842 void rb_set_class_path(VALUE, VALUE, const char*);
845 VALUE rb_path2class(const char*);
846 void rb_name_class(VALUE, ID);
848 void rb_autoload(VALUE, ID, const char*);
851 void rb_gc_mark_global_tbl(void);
852 VALUE rb_f_trace_var(int, VALUE*);
855 void rb_alias_variable(ID, ID);
859 void rb_mark_generic_ivar_tbl(void);
864 void rb_ivar_foreach(VALUE, int (*)(ANYARGS), st_data_t);
866 VALUE rb_iv_set(VALUE, const char*, VALUE);
867 VALUE rb_iv_get(VALUE, const char*);
871 void *rb_mod_const_at(VALUE, void*);
872 void *rb_mod_const_of(VALUE, void*);
873 VALUE rb_const_list(void*);
882 void rb_const_set(VALUE, ID, VALUE);
886 void rb_cvar_set(VALUE, ID, VALUE);
888 void rb_cv_set(VALUE, const char*, VALUE);
889 VALUE rb_cv_get(VALUE, const char*);
890 void rb_define_class_variable(VALUE, const char*, VALUE);
893 /* version.c */
894 void ruby_show_version(void);
895 void ruby_show_copyright(void);
896 
897 ID rb_frame_callee(void);
900 void rb_frame_pop(void);
901 int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
904 
905 #if defined __GNUC__ && __GNUC__ >= 4
906 #pragma GCC visibility pop
907 #endif
908 
909 #if defined(__cplusplus)
910 #if 0
911 { /* satisfy cc-mode */
912 #endif
913 } /* extern "C" { */
914 #endif
915 
916 #endif /* RUBY_INTERN_H */
917