|
Ruby 1.9.2p290(2011-07-09revision32553)
|
00001 /********************************************************************** 00002 00003 intern.h - 00004 00005 $Author: yugui $ 00006 created at: Thu Jun 10 14:22:17 JST 1993 00007 00008 Copyright (C) 1993-2007 Yukihiro Matsumoto 00009 Copyright (C) 2000 Network Applied Communication Laboratory, Inc. 00010 Copyright (C) 2000 Information-technology Promotion Agency, Japan 00011 00012 **********************************************************************/ 00013 00014 #ifndef RUBY_INTERN_H 00015 #define RUBY_INTERN_H 1 00016 00017 #if defined(__cplusplus) 00018 extern "C" { 00019 #if 0 00020 } /* satisfy cc-mode */ 00021 #endif 00022 #endif 00023 00024 #ifdef HAVE_STDARG_PROTOTYPES 00025 # include <stdarg.h> 00026 #else 00027 # include <varargs.h> 00028 #endif 00029 #include "ruby/st.h" 00030 00031 /* 00032 * Functions and variables that are used by more than one source file of 00033 * the kernel. 00034 */ 00035 00036 #define ID_ALLOCATOR 1 00037 00038 /* array.c */ 00039 void rb_mem_clear(register VALUE*, register long); 00040 VALUE rb_assoc_new(VALUE, VALUE); 00041 VALUE rb_check_array_type(VALUE); 00042 VALUE rb_ary_new(void); 00043 VALUE rb_ary_new2(long); 00044 VALUE rb_ary_new3(long,...); 00045 VALUE rb_ary_new4(long, const VALUE *); 00046 VALUE rb_ary_tmp_new(long); 00047 void rb_ary_free(VALUE); 00048 VALUE rb_ary_freeze(VALUE); 00049 VALUE rb_ary_aref(int, VALUE*, VALUE); 00050 VALUE rb_ary_subseq(VALUE, long, long); 00051 void rb_ary_store(VALUE, long, VALUE); 00052 VALUE rb_ary_dup(VALUE); 00053 VALUE rb_ary_to_ary(VALUE); 00054 VALUE rb_ary_to_s(VALUE); 00055 VALUE rb_ary_push(VALUE, VALUE); 00056 VALUE rb_ary_pop(VALUE); 00057 VALUE rb_ary_shift(VALUE); 00058 VALUE rb_ary_unshift(VALUE, VALUE); 00059 VALUE rb_ary_entry(VALUE, long); 00060 VALUE rb_ary_each(VALUE); 00061 VALUE rb_ary_join(VALUE, VALUE); 00062 VALUE rb_ary_print_on(VALUE, VALUE); 00063 VALUE rb_ary_reverse(VALUE); 00064 VALUE rb_ary_sort(VALUE); 00065 VALUE rb_ary_sort_bang(VALUE); 00066 VALUE rb_ary_delete(VALUE, VALUE); 00067 VALUE rb_ary_delete_at(VALUE, long); 00068 VALUE rb_ary_clear(VALUE); 00069 VALUE rb_ary_plus(VALUE, VALUE); 00070 VALUE rb_ary_concat(VALUE, VALUE); 00071 VALUE rb_ary_assoc(VALUE, VALUE); 00072 VALUE rb_ary_rassoc(VALUE, VALUE); 00073 VALUE rb_ary_includes(VALUE, VALUE); 00074 VALUE rb_ary_cmp(VALUE, VALUE); 00075 VALUE rb_ary_replace(VALUE copy, VALUE orig); 00076 VALUE rb_get_values_at(VALUE, long, int, VALUE*, VALUE(*)(VALUE,long)); 00077 /* bignum.c */ 00078 VALUE rb_big_new(long, int); 00079 int rb_bigzero_p(VALUE x); 00080 VALUE rb_big_clone(VALUE); 00081 void rb_big_2comp(VALUE); 00082 VALUE rb_big_norm(VALUE); 00083 void rb_big_resize(VALUE big, long len); 00084 VALUE rb_uint2big(VALUE); 00085 VALUE rb_int2big(SIGNED_VALUE); 00086 VALUE rb_uint2inum(VALUE); 00087 VALUE rb_int2inum(SIGNED_VALUE); 00088 VALUE rb_cstr_to_inum(const char*, int, int); 00089 VALUE rb_str_to_inum(VALUE, int, int); 00090 VALUE rb_cstr2inum(const char*, int); 00091 VALUE rb_str2inum(VALUE, int); 00092 VALUE rb_big2str(VALUE, int); 00093 VALUE rb_big2str0(VALUE, int, int); 00094 SIGNED_VALUE rb_big2long(VALUE); 00095 #define rb_big2int(x) rb_big2long(x) 00096 VALUE rb_big2ulong(VALUE); 00097 #define rb_big2uint(x) rb_big2ulong(x) 00098 #if HAVE_LONG_LONG 00099 VALUE rb_ll2inum(LONG_LONG); 00100 VALUE rb_ull2inum(unsigned LONG_LONG); 00101 LONG_LONG rb_big2ll(VALUE); 00102 unsigned LONG_LONG rb_big2ull(VALUE); 00103 #endif /* HAVE_LONG_LONG */ 00104 void rb_quad_pack(char*,VALUE); 00105 VALUE rb_quad_unpack(const char*,int); 00106 void rb_big_pack(VALUE val, unsigned long *buf, long num_longs); 00107 VALUE rb_big_unpack(unsigned long *buf, long num_longs); 00108 int rb_uv_to_utf8(char[6],unsigned long); 00109 VALUE rb_dbl2big(double); 00110 double rb_big2dbl(VALUE); 00111 VALUE rb_big_cmp(VALUE, VALUE); 00112 VALUE rb_big_eq(VALUE, VALUE); 00113 VALUE rb_big_plus(VALUE, VALUE); 00114 VALUE rb_big_minus(VALUE, VALUE); 00115 VALUE rb_big_mul(VALUE, VALUE); 00116 VALUE rb_big_div(VALUE, VALUE); 00117 VALUE rb_big_idiv(VALUE, VALUE); 00118 VALUE rb_big_modulo(VALUE, VALUE); 00119 VALUE rb_big_divmod(VALUE, VALUE); 00120 VALUE rb_big_pow(VALUE, VALUE); 00121 VALUE rb_big_and(VALUE, VALUE); 00122 VALUE rb_big_or(VALUE, VALUE); 00123 VALUE rb_big_xor(VALUE, VALUE); 00124 VALUE rb_big_lshift(VALUE, VALUE); 00125 VALUE rb_big_rshift(VALUE, VALUE); 00126 /* rational.c */ 00127 VALUE rb_rational_raw(VALUE, VALUE); 00128 #define rb_rational_raw1(x) rb_rational_raw(x, INT2FIX(1)) 00129 #define rb_rational_raw2(x,y) rb_rational_raw(x, y) 00130 VALUE rb_rational_new(VALUE, VALUE); 00131 #define rb_rational_new1(x) rb_rational_new(x, INT2FIX(1)) 00132 #define rb_rational_new2(x,y) rb_rational_new(x, y) 00133 VALUE rb_Rational(VALUE, VALUE); 00134 #define rb_Rational1(x) rb_Rational(x, INT2FIX(1)) 00135 #define rb_Rational2(x,y) rb_Rational(x, y) 00136 /* complex.c */ 00137 VALUE rb_complex_raw(VALUE, VALUE); 00138 #define rb_complex_raw1(x) rb_complex_raw(x, INT2FIX(0)) 00139 #define rb_complex_raw2(x,y) rb_complex_raw(x, y) 00140 VALUE rb_complex_new(VALUE, VALUE); 00141 #define rb_complex_new1(x) rb_complex_new(x, INT2FIX(0)) 00142 #define rb_complex_new2(x,y) rb_complex_new(x, y) 00143 VALUE rb_complex_polar(VALUE, VALUE); 00144 VALUE rb_Complex(VALUE, VALUE); 00145 #define rb_Complex1(x) rb_Complex(x, INT2FIX(0)) 00146 #define rb_Complex2(x,y) rb_Complex(x, y) 00147 /* class.c */ 00148 VALUE rb_class_boot(VALUE); 00149 VALUE rb_class_new(VALUE); 00150 VALUE rb_mod_init_copy(VALUE, VALUE); 00151 VALUE rb_class_init_copy(VALUE, VALUE); 00152 VALUE rb_singleton_class_clone(VALUE); 00153 void rb_singleton_class_attached(VALUE,VALUE); 00154 VALUE rb_make_metaclass(VALUE, VALUE); 00155 void rb_check_inheritable(VALUE); 00156 VALUE rb_class_inherited(VALUE, VALUE); 00157 VALUE rb_define_class_id(ID, VALUE); 00158 VALUE rb_define_class_id_under(VALUE, ID, VALUE); 00159 VALUE rb_module_new(void); 00160 VALUE rb_define_module_id(ID); 00161 VALUE rb_define_module_id_under(VALUE, ID); 00162 VALUE rb_mod_included_modules(VALUE); 00163 VALUE rb_mod_include_p(VALUE, VALUE); 00164 VALUE rb_mod_ancestors(VALUE); 00165 VALUE rb_class_instance_methods(int, VALUE*, VALUE); 00166 VALUE rb_class_public_instance_methods(int, VALUE*, VALUE); 00167 VALUE rb_class_protected_instance_methods(int, VALUE*, VALUE); 00168 VALUE rb_class_private_instance_methods(int, VALUE*, VALUE); 00169 VALUE rb_obj_singleton_methods(int, VALUE*, VALUE); 00170 void rb_define_method_id(VALUE, ID, VALUE (*)(ANYARGS), int); 00171 void rb_frozen_class_p(VALUE); 00172 void rb_undef(VALUE, ID); 00173 void rb_define_protected_method(VALUE, const char*, VALUE (*)(ANYARGS), int); 00174 void rb_define_private_method(VALUE, const char*, VALUE (*)(ANYARGS), int); 00175 void rb_define_singleton_method(VALUE, const char*, VALUE(*)(ANYARGS), int); 00176 VALUE rb_singleton_class(VALUE); 00177 /* compar.c */ 00178 int rb_cmpint(VALUE, VALUE, VALUE); 00179 NORETURN(void rb_cmperr(VALUE, VALUE)); 00180 /* cont.c */ 00181 VALUE rb_fiber_new(VALUE (*)(ANYARGS), VALUE); 00182 VALUE rb_fiber_resume(VALUE fib, int argc, VALUE *args); 00183 VALUE rb_fiber_yield(int argc, VALUE *args); 00184 VALUE rb_fiber_current(void); 00185 VALUE rb_fiber_alive_p(VALUE); 00186 /* enum.c */ 00187 /* enumerator.c */ 00188 VALUE rb_enumeratorize(VALUE, VALUE, int, VALUE *); 00189 #define RETURN_ENUMERATOR(obj, argc, argv) do { \ 00190 if (!rb_block_given_p()) \ 00191 return rb_enumeratorize(obj, ID2SYM(rb_frame_this_func()), \ 00192 argc, argv); \ 00193 } while (0) 00194 /* error.c */ 00195 VALUE rb_exc_new(VALUE, const char*, long); 00196 VALUE rb_exc_new2(VALUE, const char*); 00197 VALUE rb_exc_new3(VALUE, VALUE); 00198 PRINTF_ARGS(NORETURN(void rb_loaderror(const char*, ...)), 1, 2); 00199 PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3); 00200 NORETURN(void rb_invalid_str(const char*, const char*)); 00201 PRINTF_ARGS(void rb_compile_error(const char*, int, const char*, ...), 3, 4); 00202 PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2); 00203 NORETURN(void rb_load_fail(const char*)); 00204 NORETURN(void rb_error_frozen(const char*)); 00205 void rb_check_frozen(VALUE); 00206 /* eval.c */ 00207 int rb_sourceline(void); 00208 const char *rb_sourcefile(void); 00209 VALUE rb_check_funcall(VALUE, ID, int, VALUE*); 00210 00211 #if defined(NFDBITS) && defined(HAVE_RB_FD_INIT) 00212 typedef struct { 00213 int maxfd; 00214 fd_set *fdset; 00215 } rb_fdset_t; 00216 00217 void rb_fd_init(volatile rb_fdset_t *); 00218 void rb_fd_term(rb_fdset_t *); 00219 void rb_fd_zero(rb_fdset_t *); 00220 void rb_fd_set(int, rb_fdset_t *); 00221 void rb_fd_clr(int, rb_fdset_t *); 00222 int rb_fd_isset(int, const rb_fdset_t *); 00223 void rb_fd_copy(rb_fdset_t *, const fd_set *, int); 00224 int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *); 00225 00226 #define rb_fd_ptr(f) ((f)->fdset) 00227 #define rb_fd_max(f) ((f)->maxfd) 00228 00229 #elif defined(_WIN32) 00230 00231 typedef struct { 00232 int capa; 00233 fd_set *fdset; 00234 } rb_fdset_t; 00235 00236 void rb_fd_init(volatile rb_fdset_t *); 00237 void rb_fd_term(rb_fdset_t *); 00238 #define rb_fd_zero(f) ((f)->fdset->fd_count = 0) 00239 void rb_fd_set(int, rb_fdset_t *); 00240 #define rb_fd_clr(n, f) rb_w32_fdclr(n, (f)->fdset) 00241 #define rb_fd_isset(n, f) rb_w32_fdisset(n, (f)->fdset) 00242 #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) 00243 #define rb_fd_resize(n, f) (void)(f) 00244 00245 #define rb_fd_ptr(f) ((f)->fdset) 00246 #define rb_fd_max(f) ((f)->fdset->fd_count) 00247 00248 #else 00249 00250 typedef fd_set rb_fdset_t; 00251 #define rb_fd_zero(f) FD_ZERO(f) 00252 #define rb_fd_set(n, f) FD_SET(n, f) 00253 #define rb_fd_clr(n, f) FD_CLR(n, f) 00254 #define rb_fd_isset(n, f) FD_ISSET(n, f) 00255 #define rb_fd_copy(d, s, n) (*(d) = *(s)) 00256 #define rb_fd_resize(n, f) (void)(f) 00257 #define rb_fd_ptr(f) (f) 00258 #define rb_fd_init(f) FD_ZERO(f) 00259 #define rb_fd_term(f) (void)(f) 00260 #define rb_fd_max(f) FD_SETSIZE 00261 #define rb_fd_select(n, rfds, wfds, efds, timeout) select(n, rfds, wfds, efds, timeout) 00262 00263 #endif 00264 00265 NORETURN(void rb_exc_raise(VALUE)); 00266 NORETURN(void rb_exc_fatal(VALUE)); 00267 VALUE rb_f_exit(int,VALUE*); 00268 VALUE rb_f_abort(int,VALUE*); 00269 void rb_remove_method(VALUE, const char*); 00270 void rb_remove_method_id(VALUE, ID); 00271 #define rb_disable_super(klass, name) ((void)0) 00272 #define rb_enable_super(klass, name) ((void)0) 00273 #define HAVE_RB_DEFINE_ALLOC_FUNC 1 00274 typedef VALUE (*rb_alloc_func_t)(VALUE); 00275 void rb_define_alloc_func(VALUE, rb_alloc_func_t); 00276 void rb_undef_alloc_func(VALUE); 00277 rb_alloc_func_t rb_get_alloc_func(VALUE); 00278 void rb_clear_cache(void); 00279 void rb_clear_cache_by_class(VALUE); 00280 void rb_alias(VALUE, ID, ID); 00281 void rb_attr(VALUE,ID,int,int,int); 00282 int rb_method_boundp(VALUE, ID, int); 00283 int rb_method_basic_definition_p(VALUE, ID); 00284 VALUE rb_eval_cmd(VALUE, VALUE, int); 00285 int rb_obj_respond_to(VALUE, ID, int); 00286 int rb_respond_to(VALUE, ID); 00287 VALUE rb_f_notimplement(int argc, VALUE *argv, VALUE obj); 00288 void rb_interrupt(void); 00289 VALUE rb_apply(VALUE, ID, VALUE); 00290 void rb_backtrace(void); 00291 ID rb_frame_this_func(void); 00292 VALUE rb_obj_instance_eval(int, VALUE*, VALUE); 00293 VALUE rb_obj_instance_exec(int, VALUE*, VALUE); 00294 VALUE rb_mod_module_eval(int, VALUE*, VALUE); 00295 VALUE rb_mod_module_exec(int, VALUE*, VALUE); 00296 void rb_load(VALUE, int); 00297 void rb_load_protect(VALUE, int, int*); 00298 NORETURN(void rb_jump_tag(int)); 00299 int rb_provided(const char*); 00300 int rb_feature_provided(const char *, const char **); 00301 void rb_provide(const char*); 00302 VALUE rb_f_require(VALUE, VALUE); 00303 VALUE rb_require_safe(VALUE, int); 00304 void rb_obj_call_init(VALUE, int, VALUE*); 00305 VALUE rb_class_new_instance(int, VALUE*, VALUE); 00306 VALUE rb_block_proc(void); 00307 VALUE rb_f_lambda(void); 00308 VALUE rb_proc_new(VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE); 00309 VALUE rb_obj_is_proc(VALUE); 00310 VALUE rb_proc_call(VALUE, VALUE); 00311 VALUE rb_proc_call_with_block(VALUE, int argc, VALUE *argv, VALUE); 00312 int rb_proc_arity(VALUE); 00313 VALUE rb_proc_lambda_p(VALUE); 00314 VALUE rb_binding_new(void); 00315 VALUE rb_obj_method(VALUE, VALUE); 00316 VALUE rb_method_call(int, VALUE*, VALUE); 00317 int rb_mod_method_arity(VALUE, ID); 00318 int rb_obj_method_arity(VALUE, ID); 00319 VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*); 00320 void rb_set_end_proc(void (*)(VALUE), VALUE); 00321 void rb_mark_end_proc(void); 00322 void rb_exec_end_proc(void); 00323 void ruby_finalize(void); 00324 NORETURN(void ruby_stop(int)); 00325 int ruby_cleanup(volatile int); 00326 void rb_gc_mark_threads(void); 00327 void rb_thread_schedule(void); 00328 void rb_thread_wait_fd(int); 00329 int rb_thread_fd_writable(int); 00330 void rb_thread_fd_close(int); 00331 int rb_thread_alone(void); 00332 void rb_thread_polling(void); 00333 void rb_thread_sleep(int); 00334 void rb_thread_sleep_forever(void); 00335 VALUE rb_thread_stop(void); 00336 VALUE rb_thread_wakeup(VALUE); 00337 VALUE rb_thread_run(VALUE); 00338 VALUE rb_thread_kill(VALUE); 00339 VALUE rb_thread_create(VALUE (*)(ANYARGS), void*); 00340 int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); 00341 int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *); 00342 void rb_thread_wait_for(struct timeval); 00343 VALUE rb_thread_current(void); 00344 VALUE rb_thread_main(void); 00345 VALUE rb_thread_local_aref(VALUE, ID); 00346 VALUE rb_thread_local_aset(VALUE, ID, VALUE); 00347 void rb_thread_atfork(void); 00348 void rb_thread_atfork_before_exec(void); 00349 VALUE rb_exec_recursive(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE); 00350 VALUE rb_exec_recursive_paired(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE,VALUE); 00351 VALUE rb_exec_recursive_outer(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE); 00352 /* dir.c */ 00353 VALUE rb_dir_getwd(void); 00354 /* file.c */ 00355 VALUE rb_file_s_expand_path(int, VALUE *); 00356 VALUE rb_file_expand_path(VALUE, VALUE); 00357 VALUE rb_file_s_absolute_path(int, VALUE *); 00358 VALUE rb_file_absolute_path(VALUE, VALUE); 00359 VALUE rb_file_dirname(VALUE fname); 00360 void rb_file_const(const char*, VALUE); 00361 int rb_file_load_ok(const char *); 00362 int rb_find_file_ext_safe(VALUE*, const char* const*, int); 00363 VALUE rb_find_file_safe(VALUE, int); 00364 int rb_find_file_ext(VALUE*, const char* const*); 00365 VALUE rb_find_file(VALUE); 00366 char *rb_path_next(const char *); 00367 char *rb_path_skip_prefix(const char *); 00368 char *rb_path_last_separator(const char *); 00369 char *rb_path_end(const char *); 00370 VALUE rb_file_directory_p(VALUE,VALUE); 00371 VALUE rb_str_encode_ospath(VALUE); 00372 int rb_is_absolute_path(const char *); 00373 /* gc.c */ 00374 void ruby_set_stack_size(size_t); 00375 NORETURN(void rb_memerror(void)); 00376 int ruby_stack_check(void); 00377 size_t ruby_stack_length(VALUE**); 00378 int rb_during_gc(void); 00379 void rb_gc_mark_locations(VALUE*, VALUE*); 00380 void rb_mark_tbl(struct st_table*); 00381 void rb_mark_set(struct st_table*); 00382 void rb_mark_hash(struct st_table*); 00383 void rb_gc_mark_maybe(VALUE); 00384 void rb_gc_mark(VALUE); 00385 void rb_gc_force_recycle(VALUE); 00386 void rb_gc(void); 00387 void rb_gc_copy_finalizer(VALUE,VALUE); 00388 void rb_gc_finalize_deferred(void); 00389 void rb_gc_call_finalizer_at_exit(void); 00390 VALUE rb_gc_enable(void); 00391 VALUE rb_gc_disable(void); 00392 VALUE rb_gc_start(void); 00393 #define Init_stack(addr) ruby_init_stack(addr) 00394 /* hash.c */ 00395 void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t); 00396 void rb_hash_foreach(VALUE, int (*)(ANYARGS), VALUE); 00397 VALUE rb_hash(VALUE); 00398 VALUE rb_hash_new(void); 00399 VALUE rb_hash_dup(VALUE); 00400 VALUE rb_hash_freeze(VALUE); 00401 VALUE rb_hash_aref(VALUE, VALUE); 00402 VALUE rb_hash_lookup(VALUE, VALUE); 00403 VALUE rb_hash_lookup2(VALUE, VALUE, VALUE); 00404 VALUE rb_hash_fetch(VALUE, VALUE); 00405 VALUE rb_hash_aset(VALUE, VALUE, VALUE); 00406 VALUE rb_hash_delete_if(VALUE); 00407 VALUE rb_hash_delete(VALUE,VALUE); 00408 struct st_table *rb_hash_tbl(VALUE); 00409 int rb_path_check(const char*); 00410 int rb_env_path_tainted(void); 00411 VALUE rb_env_clear(void); 00412 /* io.c */ 00413 #define rb_defout rb_stdout 00414 RUBY_EXTERN VALUE rb_fs; 00415 RUBY_EXTERN VALUE rb_output_fs; 00416 RUBY_EXTERN VALUE rb_rs; 00417 RUBY_EXTERN VALUE rb_default_rs; 00418 RUBY_EXTERN VALUE rb_output_rs; 00419 VALUE rb_io_write(VALUE, VALUE); 00420 VALUE rb_io_gets(VALUE); 00421 VALUE rb_io_getbyte(VALUE); 00422 VALUE rb_io_ungetc(VALUE, VALUE); 00423 VALUE rb_io_ungetbyte(VALUE, VALUE); 00424 VALUE rb_io_close(VALUE); 00425 VALUE rb_io_flush(VALUE); 00426 VALUE rb_io_eof(VALUE); 00427 VALUE rb_io_binmode(VALUE); 00428 VALUE rb_io_ascii8bit_binmode(VALUE); 00429 VALUE rb_io_addstr(VALUE, VALUE); 00430 VALUE rb_io_printf(int, VALUE*, VALUE); 00431 VALUE rb_io_print(int, VALUE*, VALUE); 00432 VALUE rb_io_puts(int, VALUE*, VALUE); 00433 VALUE rb_io_fdopen(int, int, const char*); 00434 VALUE rb_io_get_io(VALUE); 00435 VALUE rb_file_open(const char*, const char*); 00436 VALUE rb_file_open_str(VALUE, const char*); 00437 VALUE rb_gets(void); 00438 void rb_write_error(const char*); 00439 void rb_write_error2(const char*, long); 00440 void rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds); 00441 int rb_pipe(int *pipes); 00442 /* marshal.c */ 00443 VALUE rb_marshal_dump(VALUE, VALUE); 00444 VALUE rb_marshal_load(VALUE); 00445 void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE), VALUE (*loader)(VALUE, VALUE)); 00446 /* numeric.c */ 00447 void rb_num_zerodiv(void); 00448 #define RB_NUM_COERCE_FUNCS_NEED_OPID 1 00449 VALUE rb_num_coerce_bin(VALUE, VALUE, ID); 00450 VALUE rb_num_coerce_cmp(VALUE, VALUE, ID); 00451 VALUE rb_num_coerce_relop(VALUE, VALUE, ID); 00452 VALUE rb_float_new(double); 00453 VALUE rb_num2fix(VALUE); 00454 VALUE rb_fix2str(VALUE, int); 00455 VALUE rb_dbl_cmp(double, double); 00456 /* object.c */ 00457 int rb_eql(VALUE, VALUE); 00458 VALUE rb_any_to_s(VALUE); 00459 VALUE rb_inspect(VALUE); 00460 VALUE rb_obj_is_instance_of(VALUE, VALUE); 00461 VALUE rb_obj_is_kind_of(VALUE, VALUE); 00462 VALUE rb_obj_alloc(VALUE); 00463 VALUE rb_obj_clone(VALUE); 00464 VALUE rb_obj_dup(VALUE); 00465 VALUE rb_obj_init_copy(VALUE,VALUE); 00466 VALUE rb_obj_taint(VALUE); 00467 VALUE rb_obj_tainted(VALUE); 00468 VALUE rb_obj_untaint(VALUE); 00469 VALUE rb_obj_untrust(VALUE); 00470 VALUE rb_obj_untrusted(VALUE); 00471 VALUE rb_obj_trust(VALUE); 00472 VALUE rb_obj_freeze(VALUE); 00473 VALUE rb_obj_frozen_p(VALUE); 00474 VALUE rb_obj_id(VALUE); 00475 VALUE rb_obj_class(VALUE); 00476 VALUE rb_class_real(VALUE); 00477 VALUE rb_class_inherited_p(VALUE, VALUE); 00478 VALUE rb_convert_type(VALUE,int,const char*,const char*); 00479 VALUE rb_check_convert_type(VALUE,int,const char*,const char*); 00480 VALUE rb_check_to_integer(VALUE, const char *); 00481 VALUE rb_check_to_float(VALUE); 00482 VALUE rb_to_int(VALUE); 00483 VALUE rb_Integer(VALUE); 00484 VALUE rb_to_float(VALUE); 00485 VALUE rb_Float(VALUE); 00486 VALUE rb_String(VALUE); 00487 VALUE rb_Array(VALUE); 00488 double rb_cstr_to_dbl(const char*, int); 00489 double rb_str_to_dbl(VALUE, int); 00490 /* parse.y */ 00491 RUBY_EXTERN int ruby_sourceline; 00492 RUBY_EXTERN char *ruby_sourcefile; 00493 ID rb_id_attrset(ID); 00494 void rb_gc_mark_parser(void); 00495 int rb_is_const_id(ID); 00496 int rb_is_instance_id(ID); 00497 int rb_is_class_id(ID); 00498 int rb_is_local_id(ID); 00499 int rb_is_junk_id(ID); 00500 int rb_symname_p(const char*); 00501 int rb_sym_interned_p(VALUE); 00502 void rb_gc_mark_symbols(void); 00503 VALUE rb_backref_get(void); 00504 void rb_backref_set(VALUE); 00505 VALUE rb_lastline_get(void); 00506 void rb_lastline_set(VALUE); 00507 VALUE rb_sym_all_symbols(void); 00508 /* process.c */ 00509 void rb_last_status_set(int status, rb_pid_t pid); 00510 VALUE rb_last_status_get(void); 00511 struct rb_exec_arg { 00512 int argc; 00513 VALUE *argv; 00514 const char *prog; 00515 VALUE options; 00516 VALUE redirect_fds; 00517 }; 00518 int rb_proc_exec_n(int, VALUE*, const char*); 00519 int rb_proc_exec(const char*); 00520 VALUE rb_exec_arg_init(int argc, VALUE *argv, int accept_shell, struct rb_exec_arg *e); 00521 int rb_exec_arg_addopt(struct rb_exec_arg *e, VALUE key, VALUE val); 00522 void rb_exec_arg_fixup(struct rb_exec_arg *e); 00523 int rb_run_exec_options(const struct rb_exec_arg *e, struct rb_exec_arg *s); 00524 int rb_run_exec_options_err(const struct rb_exec_arg *e, struct rb_exec_arg *s, char*, size_t); 00525 int rb_exec(const struct rb_exec_arg*); 00526 int rb_exec_err(const struct rb_exec_arg*, char*, size_t); 00527 rb_pid_t rb_fork(int*, int (*)(void*), void*, VALUE); 00528 rb_pid_t rb_fork_err(int*, int (*)(void*, char*, size_t), void*, VALUE, char*, size_t); 00529 VALUE rb_f_exec(int,VALUE*); 00530 rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags); 00531 void rb_syswait(rb_pid_t pid); 00532 rb_pid_t rb_spawn(int, VALUE*); 00533 rb_pid_t rb_spawn_err(int, VALUE*, char*, size_t); 00534 VALUE rb_proc_times(VALUE); 00535 VALUE rb_detach_process(rb_pid_t pid); 00536 /* range.c */ 00537 VALUE rb_range_new(VALUE, VALUE, int); 00538 VALUE rb_range_beg_len(VALUE, long*, long*, long, int); 00539 int rb_range_values(VALUE range, VALUE *begp, VALUE *endp, int *exclp); 00540 /* random.c */ 00541 unsigned int rb_genrand_int32(void); 00542 double rb_genrand_real(void); 00543 void rb_reset_random_seed(void); 00544 VALUE rb_random_bytes(VALUE rnd, long n); 00545 VALUE rb_random_int(VALUE rnd, VALUE max); 00546 unsigned int rb_random_int32(VALUE rnd); 00547 double rb_random_real(VALUE rnd); 00548 /* re.c */ 00549 #define rb_memcmp memcmp 00550 int rb_memcicmp(const void*,const void*,long); 00551 void rb_match_busy(VALUE); 00552 VALUE rb_reg_nth_defined(int, VALUE); 00553 VALUE rb_reg_nth_match(int, VALUE); 00554 int rb_reg_backref_number(VALUE match, VALUE backref); 00555 VALUE rb_reg_last_match(VALUE); 00556 VALUE rb_reg_match_pre(VALUE); 00557 VALUE rb_reg_match_post(VALUE); 00558 VALUE rb_reg_match_last(VALUE); 00559 #define HAVE_RB_REG_NEW_STR 1 00560 VALUE rb_reg_new_str(VALUE, int); 00561 VALUE rb_reg_new(const char *, long, int); 00562 VALUE rb_reg_alloc(void); 00563 VALUE rb_reg_init_str(VALUE re, VALUE s, int options); 00564 VALUE rb_reg_match(VALUE, VALUE); 00565 VALUE rb_reg_match2(VALUE); 00566 int rb_reg_options(VALUE); 00567 /* ruby.c */ 00568 #define rb_argv rb_get_argv() 00569 RUBY_EXTERN VALUE rb_argv0; 00570 VALUE rb_get_argv(void); 00571 void *rb_load_file(const char*); 00572 void ruby_script(const char*); 00573 void ruby_prog_init(void); 00574 void ruby_set_argv(int, char**); 00575 void *ruby_process_options(int, char**); 00576 void ruby_init_loadpath(void); 00577 void ruby_incpush(const char*); 00578 /* signal.c */ 00579 VALUE rb_f_kill(int, VALUE*); 00580 void rb_gc_mark_trap_list(void); 00581 #ifdef POSIX_SIGNAL 00582 #define posix_signal ruby_posix_signal 00583 RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int); 00584 #endif 00585 void ruby_sig_finalize(void); 00586 void rb_trap_exit(void); 00587 void rb_trap_exec(void); 00588 const char *ruby_signal_name(int); 00589 void ruby_default_signal(int); 00590 /* sprintf.c */ 00591 VALUE rb_f_sprintf(int, const VALUE*); 00592 PRINTF_ARGS(VALUE rb_sprintf(const char*, ...), 1, 2); 00593 VALUE rb_vsprintf(const char*, va_list); 00594 PRINTF_ARGS(VALUE rb_str_catf(VALUE, const char*, ...), 2, 3); 00595 VALUE rb_str_vcatf(VALUE, const char*, va_list); 00596 VALUE rb_str_format(int, const VALUE *, VALUE); 00597 /* string.c */ 00598 VALUE rb_str_new(const char*, long); 00599 VALUE rb_str_new_cstr(const char*); 00600 VALUE rb_str_new2(const char*); 00601 VALUE rb_str_new_shared(VALUE); 00602 VALUE rb_str_new3(VALUE); 00603 VALUE rb_str_new_frozen(VALUE); 00604 VALUE rb_str_new4(VALUE); 00605 VALUE rb_str_new_with_class(VALUE, const char*, long); 00606 VALUE rb_str_new5(VALUE, const char*, long); 00607 VALUE rb_tainted_str_new_cstr(const char*); 00608 VALUE rb_tainted_str_new(const char*, long); 00609 VALUE rb_tainted_str_new2(const char*); 00610 VALUE rb_external_str_new(const char*, long); 00611 VALUE rb_external_str_new_cstr(const char*); 00612 VALUE rb_locale_str_new(const char*, long); 00613 VALUE rb_locale_str_new_cstr(const char*); 00614 VALUE rb_filesystem_str_new(const char*, long); 00615 VALUE rb_filesystem_str_new_cstr(const char*); 00616 VALUE rb_str_buf_new(long); 00617 VALUE rb_str_buf_new_cstr(const char*); 00618 VALUE rb_str_buf_new2(const char*); 00619 VALUE rb_str_tmp_new(long); 00620 VALUE rb_usascii_str_new(const char*, long); 00621 VALUE rb_usascii_str_new_cstr(const char*); 00622 VALUE rb_usascii_str_new2(const char*); 00623 void rb_str_free(VALUE); 00624 void rb_str_shared_replace(VALUE, VALUE); 00625 VALUE rb_str_buf_append(VALUE, VALUE); 00626 VALUE rb_str_buf_cat(VALUE, const char*, long); 00627 VALUE rb_str_buf_cat2(VALUE, const char*); 00628 VALUE rb_str_buf_cat_ascii(VALUE, const char*); 00629 VALUE rb_obj_as_string(VALUE); 00630 VALUE rb_check_string_type(VALUE); 00631 VALUE rb_str_dup(VALUE); 00632 VALUE rb_str_locktmp(VALUE); 00633 VALUE rb_str_unlocktmp(VALUE); 00634 VALUE rb_str_dup_frozen(VALUE); 00635 #define rb_str_dup_frozen rb_str_new_frozen 00636 VALUE rb_str_plus(VALUE, VALUE); 00637 VALUE rb_str_times(VALUE, VALUE); 00638 long rb_str_sublen(VALUE, long); 00639 VALUE rb_str_substr(VALUE, long, long); 00640 VALUE rb_str_subseq(VALUE, long, long); 00641 void rb_str_modify(VALUE); 00642 VALUE rb_str_freeze(VALUE); 00643 void rb_str_set_len(VALUE, long); 00644 VALUE rb_str_resize(VALUE, long); 00645 VALUE rb_str_cat(VALUE, const char*, long); 00646 VALUE rb_str_cat2(VALUE, const char*); 00647 VALUE rb_str_append(VALUE, VALUE); 00648 VALUE rb_str_concat(VALUE, VALUE); 00649 st_index_t rb_memhash(const void *ptr, long len); 00650 st_index_t rb_hash_start(st_index_t); 00651 st_index_t rb_hash_uint32(st_index_t, uint32_t); 00652 st_index_t rb_hash_uint(st_index_t, st_index_t); 00653 st_index_t rb_hash_end(st_index_t); 00654 #define rb_hash_uint32(h, i) st_hash_uint32(h, i) 00655 #define rb_hash_uint(h, i) st_hash_uint(h, i) 00656 #define rb_hash_end(h) st_hash_end(h) 00657 st_index_t rb_str_hash(VALUE); 00658 int rb_str_hash_cmp(VALUE,VALUE); 00659 int rb_str_comparable(VALUE, VALUE); 00660 int rb_str_cmp(VALUE, VALUE); 00661 VALUE rb_str_equal(VALUE str1, VALUE str2); 00662 VALUE rb_str_drop_bytes(VALUE, long); 00663 void rb_str_update(VALUE, long, long, VALUE); 00664 VALUE rb_str_replace(VALUE, VALUE); 00665 VALUE rb_str_inspect(VALUE); 00666 VALUE rb_str_dump(VALUE); 00667 VALUE rb_str_split(VALUE, const char*); 00668 void rb_str_associate(VALUE, VALUE); 00669 VALUE rb_str_associated(VALUE); 00670 void rb_str_setter(VALUE, ID, VALUE*); 00671 VALUE rb_str_intern(VALUE); 00672 VALUE rb_sym_to_s(VALUE); 00673 long rb_str_strlen(VALUE); 00674 VALUE rb_str_length(VALUE); 00675 long rb_str_offset(VALUE, long); 00676 size_t rb_str_capacity(VALUE); 00677 #if defined __GNUC__ 00678 #define rb_str_new_cstr(str) __extension__ ( \ 00679 { \ 00680 (__builtin_constant_p(str)) ? \ 00681 rb_str_new(str, (long)strlen(str)) : \ 00682 rb_str_new_cstr(str); \ 00683 }) 00684 #define rb_tainted_str_new_cstr(str) __extension__ ( \ 00685 { \ 00686 (__builtin_constant_p(str)) ? \ 00687 rb_tainted_str_new(str, (long)strlen(str)) : \ 00688 rb_tainted_str_new_cstr(str); \ 00689 }) 00690 #define rb_usascii_str_new_cstr(str) __extension__ ( \ 00691 { \ 00692 (__builtin_constant_p(str)) ? \ 00693 rb_usascii_str_new(str, (long)strlen(str)) : \ 00694 rb_usascii_str_new_cstr(str); \ 00695 }) 00696 #define rb_external_str_new_cstr(str) __extension__ ( \ 00697 { \ 00698 (__builtin_constant_p(str)) ? \ 00699 rb_external_str_new(str, (long)strlen(str)) : \ 00700 rb_external_str_new_cstr(str); \ 00701 }) 00702 #define rb_locale_str_new_cstr(str) __extension__ ( \ 00703 { \ 00704 (__builtin_constant_p(str)) ? \ 00705 rb_locale_str_new(str, (long)strlen(str)) : \ 00706 rb_locale_str_new_cstr(str); \ 00707 }) 00708 #define rb_str_buf_new_cstr(str) __extension__ ( \ 00709 { \ 00710 (__builtin_constant_p(str)) ? \ 00711 rb_str_buf_cat(rb_str_buf_new((long)strlen(str)), \ 00712 str, (long)strlen(str)) : \ 00713 rb_str_buf_new_cstr(str); \ 00714 }) 00715 #define rb_str_buf_cat2(str, ptr) __extension__ ( \ 00716 { \ 00717 (__builtin_constant_p(ptr)) ? \ 00718 rb_str_buf_cat(str, ptr, (long)strlen(ptr)) : \ 00719 rb_str_buf_cat2(str, ptr); \ 00720 }) 00721 #define rb_str_cat2(str, ptr) __extension__ ( \ 00722 { \ 00723 (__builtin_constant_p(ptr)) ? \ 00724 rb_str_cat(str, ptr, (long)strlen(ptr)) : \ 00725 rb_str_cat2(str, ptr); \ 00726 }) 00727 #define rb_exc_new2(klass, ptr) __extension__ ( \ 00728 { \ 00729 (__builtin_constant_p(ptr)) ? \ 00730 rb_exc_new(klass, ptr, (long)strlen(ptr)) : \ 00731 rb_exc_new2(klass, ptr); \ 00732 }) 00733 #endif 00734 #define rb_str_new2 rb_str_new_cstr 00735 #define rb_str_new3 rb_str_new_shared 00736 #define rb_str_new4 rb_str_new_frozen 00737 #define rb_str_new5 rb_str_new_with_class 00738 #define rb_tainted_str_new2 rb_tainted_str_new_cstr 00739 #define rb_str_buf_new2 rb_str_buf_new_cstr 00740 #define rb_usascii_str_new2 rb_usascii_str_new_cstr 00741 /* struct.c */ 00742 VALUE rb_struct_new(VALUE, ...); 00743 VALUE rb_struct_define(const char*, ...); 00744 VALUE rb_struct_alloc(VALUE, VALUE); 00745 VALUE rb_struct_initialize(VALUE, VALUE); 00746 VALUE rb_struct_aref(VALUE, VALUE); 00747 VALUE rb_struct_aset(VALUE, VALUE, VALUE); 00748 VALUE rb_struct_getmember(VALUE, ID); 00749 DEPRECATED(VALUE rb_struct_iv_get(VALUE, const char*)); 00750 VALUE rb_struct_s_members(VALUE); 00751 VALUE rb_struct_members(VALUE); 00752 VALUE rb_struct_alloc_noinit(VALUE); 00753 VALUE rb_struct_define_without_accessor(const char *, VALUE, rb_alloc_func_t, ...); 00754 /* thread.c */ 00755 typedef void rb_unblock_function_t(void *); 00756 typedef VALUE rb_blocking_function_t(void *); 00757 void rb_thread_check_ints(void); 00758 int rb_thread_interrupted(VALUE thval); 00759 VALUE rb_thread_blocking_region(rb_blocking_function_t *func, void *data1, 00760 rb_unblock_function_t *ubf, void *data2); 00761 #define RUBY_UBF_IO ((rb_unblock_function_t *)-1) 00762 #define RUBY_UBF_PROCESS ((rb_unblock_function_t *)-1) 00763 VALUE rb_mutex_new(void); 00764 VALUE rb_mutex_locked_p(VALUE mutex); 00765 VALUE rb_mutex_trylock(VALUE mutex); 00766 VALUE rb_mutex_lock(VALUE mutex); 00767 VALUE rb_mutex_unlock(VALUE mutex); 00768 VALUE rb_mutex_sleep(VALUE self, VALUE timeout); 00769 VALUE rb_mutex_synchronize(VALUE mutex, VALUE (*func)(VALUE arg), VALUE arg); 00770 VALUE rb_barrier_new(void); 00771 VALUE rb_barrier_wait(VALUE self); 00772 VALUE rb_barrier_release(VALUE self); 00773 VALUE rb_barrier_destroy(VALUE self); 00774 /* time.c */ 00775 VALUE rb_time_new(time_t, long); 00776 VALUE rb_time_nano_new(time_t, long); 00777 VALUE rb_time_num_new(VALUE, VALUE); 00778 /* variable.c */ 00779 VALUE rb_mod_name(VALUE); 00780 VALUE rb_class_path(VALUE); 00781 void rb_set_class_path(VALUE, VALUE, const char*); 00782 void rb_set_class_path_string(VALUE, VALUE, VALUE); 00783 VALUE rb_path_to_class(VALUE); 00784 VALUE rb_path2class(const char*); 00785 void rb_name_class(VALUE, ID); 00786 VALUE rb_class_name(VALUE); 00787 void rb_autoload(VALUE, ID, const char*); 00788 VALUE rb_autoload_load(VALUE, ID); 00789 VALUE rb_autoload_p(VALUE, ID); 00790 void rb_gc_mark_global_tbl(void); 00791 VALUE rb_f_trace_var(int, VALUE*); 00792 VALUE rb_f_untrace_var(int, VALUE*); 00793 VALUE rb_f_global_variables(void); 00794 void rb_alias_variable(ID, ID); 00795 struct st_table* rb_generic_ivar_table(VALUE); 00796 void rb_copy_generic_ivar(VALUE,VALUE); 00797 void rb_mark_generic_ivar(VALUE); 00798 void rb_mark_generic_ivar_tbl(void); 00799 void rb_free_generic_ivar(VALUE); 00800 VALUE rb_ivar_get(VALUE, ID); 00801 VALUE rb_ivar_set(VALUE, ID, VALUE); 00802 VALUE rb_ivar_defined(VALUE, ID); 00803 void rb_ivar_foreach(VALUE, int (*)(ANYARGS), st_data_t); 00804 st_index_t rb_ivar_count(VALUE); 00805 VALUE rb_iv_set(VALUE, const char*, VALUE); 00806 VALUE rb_iv_get(VALUE, const char*); 00807 VALUE rb_attr_get(VALUE, ID); 00808 VALUE rb_obj_instance_variables(VALUE); 00809 VALUE rb_obj_remove_instance_variable(VALUE, VALUE); 00810 void *rb_mod_const_at(VALUE, void*); 00811 void *rb_mod_const_of(VALUE, void*); 00812 VALUE rb_const_list(void*); 00813 VALUE rb_mod_constants(int, VALUE *, VALUE); 00814 VALUE rb_mod_remove_const(VALUE, VALUE); 00815 int rb_const_defined(VALUE, ID); 00816 int rb_const_defined_at(VALUE, ID); 00817 int rb_const_defined_from(VALUE, ID); 00818 VALUE rb_const_get(VALUE, ID); 00819 VALUE rb_const_get_at(VALUE, ID); 00820 VALUE rb_const_get_from(VALUE, ID); 00821 void rb_const_set(VALUE, ID, VALUE); 00822 VALUE rb_const_remove(VALUE, ID); 00823 VALUE rb_mod_const_missing(VALUE,VALUE); 00824 VALUE rb_cvar_defined(VALUE, ID); 00825 void rb_cvar_set(VALUE, ID, VALUE); 00826 VALUE rb_cvar_get(VALUE, ID); 00827 void rb_cv_set(VALUE, const char*, VALUE); 00828 VALUE rb_cv_get(VALUE, const char*); 00829 void rb_define_class_variable(VALUE, const char*, VALUE); 00830 VALUE rb_mod_class_variables(VALUE); 00831 VALUE rb_mod_remove_cvar(VALUE, VALUE); 00832 /* version.c */ 00833 void ruby_show_version(void); 00834 void ruby_show_copyright(void); 00835 00836 ID rb_frame_callee(void); 00837 VALUE rb_str_succ(VALUE); 00838 VALUE rb_time_succ(VALUE); 00839 void rb_frame_pop(void); 00840 int rb_frame_method_id_and_class(ID *idp, VALUE *klassp); 00841 00842 #if defined(__cplusplus) 00843 #if 0 00844 { /* satisfy cc-mode */ 00845 #endif 00846 } /* extern "C" { */ 00847 #endif 00848 00849 #endif /* RUBY_INTERN_H */ 00850
1.7.3