ruby-changes:36399
From: akr <ko1@a...>
Date: Wed, 19 Nov 2014 00:13:22 +0900 (JST)
Subject: [ruby-changes:36399] akr:r48480 (trunk): * internal.h: Gather declarations in non-header files.
akr 2014-11-19 00:13:05 +0900 (Wed, 19 Nov 2014) New Revision: 48480 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48480 Log: * internal.h: Gather declarations in non-header files. Modified files: trunk/ChangeLog trunk/class.c trunk/complex.c trunk/enc/encdb.c trunk/encoding.c trunk/enum.c trunk/eval.c trunk/gc.c trunk/hash.c trunk/internal.h trunk/io.c trunk/marshal.c trunk/numeric.c trunk/object.c trunk/ruby.c trunk/signal.c trunk/sprintf.c trunk/string.c trunk/thread.c trunk/vm_backtrace.c Index: complex.c =================================================================== --- complex.c (revision 48479) +++ complex.c (revision 48480) @@ -1633,8 +1633,6 @@ isimagunit(int c) https://github.com/ruby/ruby/blob/trunk/complex.c#L1633 c == 'j' || c == 'J'); } -VALUE rb_cstr_to_rat(const char *, int); - static VALUE str2num(char *s) { Index: encoding.c =================================================================== --- encoding.c (revision 48479) +++ encoding.c (revision 48480) @@ -571,9 +571,6 @@ rb_encdb_set_unicode(int index) https://github.com/ruby/ruby/blob/trunk/encoding.c#L571 ((rb_raw_encoding *)rb_enc_from_index(index))->flags |= ONIGENC_FLAG_UNICODE; } -extern rb_encoding OnigEncodingUTF_8; -extern rb_encoding OnigEncodingUS_ASCII; - void rb_enc_init(void) { @@ -1334,8 +1331,6 @@ struct default_encoding { https://github.com/ruby/ruby/blob/trunk/encoding.c#L1331 static struct default_encoding default_external = {0}; -extern int Init_enc_set_filesystem_encoding(void); - static int enc_set_default_encoding(struct default_encoding *def, VALUE encoding, const char *name) { Index: ChangeLog =================================================================== --- ChangeLog (revision 48479) +++ ChangeLog (revision 48480) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Nov 18 23:23:45 2014 Tanaka Akira <akr@f...> + + * internal.h: Gather declarations in non-header files. + Tue Nov 18 23:45:52 2014 Tanaka Akira <akr@f...> * debug.c (SET_WHEN): Don't declare debug variables here. Index: enc/encdb.c =================================================================== --- enc/encdb.c (revision 48479) +++ enc/encdb.c (revision 48480) @@ -9,13 +9,6 @@ https://github.com/ruby/ruby/blob/trunk/enc/encdb.c#L9 **********************************************************************/ -int rb_encdb_replicate(const char *alias, const char *orig); -int rb_encdb_alias(const char *alias, const char *orig); -int rb_encdb_dummy(const char *name); -void rb_encdb_declare(const char *name); -void rb_enc_set_base(const char *name, const char *orig); -int rb_enc_set_dummy(int index); -void rb_encdb_set_unicode(int index); #define ENC_REPLICATE(name, orig) rb_encdb_replicate((name), (orig)) #define ENC_ALIAS(name, orig) rb_encdb_alias((name), (orig)) #define ENC_DUMMY(name) rb_encdb_dummy(name) Index: enum.c =================================================================== --- enum.c (revision 48479) +++ enum.c (revision 48480) @@ -14,8 +14,6 @@ https://github.com/ruby/ruby/blob/trunk/enum.c#L14 #include "node.h" #include "id.h" -VALUE rb_f_send(int argc, VALUE *argv, VALUE recv); - VALUE rb_mEnumerable; static ID id_next; Index: string.c =================================================================== --- string.c (revision 48479) +++ string.c (revision 48480) @@ -135,8 +135,6 @@ VALUE rb_cSymbol; https://github.com/ruby/ruby/blob/trunk/string.c#L135 #define SHARABLE_SUBSTRING_P(beg, len, end) 1 #endif -rb_encoding *rb_enc_get_from_index(int index); - static rb_encoding * get_actual_encoding(const int encidx, VALUE str) { @@ -720,7 +718,6 @@ rb_tainted_str_new_cstr(const char *ptr) https://github.com/ruby/ruby/blob/trunk/string.c#L718 VALUE rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts) { - extern VALUE rb_cEncodingConverter; rb_econv_t *ec; rb_econv_result_t ret; long len, olen; Index: object.c =================================================================== --- object.c (revision 48479) +++ object.c (revision 48480) @@ -162,7 +162,6 @@ rb_obj_equal(VALUE obj1, VALUE obj2) https://github.com/ruby/ruby/blob/trunk/object.c#L162 VALUE rb_obj_hash(VALUE obj) { - long rb_objid_hash(st_index_t index); VALUE oid = rb_obj_id(obj); #if SIZEOF_LONG == SIZEOF_VOIDP st_index_t index = NUM2LONG(oid); @@ -279,8 +278,6 @@ rb_obj_copy_ivar(VALUE dest, VALUE obj) https://github.com/ruby/ruby/blob/trunk/object.c#L278 } } -void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj); - static void init_copy(VALUE dest, VALUE obj) { Index: io.c =================================================================== --- io.c (revision 48479) +++ io.c (revision 48480) @@ -152,9 +152,6 @@ VALUE rb_eEOFError; https://github.com/ruby/ruby/blob/trunk/io.c#L152 VALUE rb_eIOError; VALUE rb_mWaitReadable; VALUE rb_mWaitWritable; -extern VALUE rb_eEAGAIN; -extern VALUE rb_eEWOULDBLOCK; -extern VALUE rb_eEINPROGRESS; static VALUE rb_eEAGAINWaitReadable; static VALUE rb_eEAGAINWaitWritable; @@ -4361,8 +4358,6 @@ rb_io_fptr_finalize(rb_io_t *fptr) https://github.com/ruby/ruby/blob/trunk/io.c#L4358 return 1; } -size_t rb_econv_memsize(rb_econv_t *); - RUBY_FUNC_EXPORTED size_t rb_io_memsize(const rb_io_t *fptr) { Index: thread.c =================================================================== --- thread.c (revision 48479) +++ thread.c (revision 48480) @@ -4662,8 +4662,6 @@ rb_thread_shield_destroy(VALUE self) https://github.com/ruby/ruby/blob/trunk/thread.c#L4662 /* variables for recursive traversals */ static ID recursive_key; -extern const struct st_hash_type st_hashtype_num; - static VALUE ident_hash_new(void) { Index: vm_backtrace.c =================================================================== --- vm_backtrace.c (revision 48479) +++ vm_backtrace.c (revision 48480) @@ -19,8 +19,6 @@ https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L19 static VALUE rb_cBacktrace; static VALUE rb_cBacktraceLocation; -extern VALUE ruby_engine_name; - static VALUE id2str(ID id) { Index: sprintf.c =================================================================== --- sprintf.c (revision 48479) +++ sprintf.c (revision 48480) @@ -23,8 +23,6 @@ https://github.com/ruby/ruby/blob/trunk/sprintf.c#L23 #define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */ -extern const char ruby_digitmap[]; - static void fmt_setup(char*,size_t,int,int,int,int); static char Index: eval.c =================================================================== --- eval.c (revision 48479) +++ eval.c (revision 48480) @@ -509,7 +509,6 @@ setup_exception(rb_thread_t *th, int tag https://github.com/ruby/ruby/blob/trunk/eval.c#L509 if (NIL_P(rb_attr_get(mesg, idBt))) { at = rb_vm_backtrace_object(); if (mesg == sysstack_error) { - VALUE ruby_vm_sysstack_error_copy(void); mesg = ruby_vm_sysstack_error_copy(); } rb_ivar_set(mesg, idBt, at); @@ -1264,8 +1263,6 @@ add_activated_refinement(VALUE activated https://github.com/ruby/ruby/blob/trunk/eval.c#L1263 rb_hash_aset(activated_refinements, klass, iclass); } -VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements); - /* * call-seq: * refine(klass) { block } -> module Index: gc.c =================================================================== --- gc.c (revision 48479) +++ gc.c (revision 48480) @@ -2803,10 +2803,6 @@ rb_obj_id(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L2803 return nonspecial_obj_id(obj); } -size_t rb_str_memsize(VALUE); -size_t rb_ary_memsize(VALUE); -size_t rb_io_memsize(const rb_io_t *); -size_t rb_generic_ivar_memsize(VALUE); #include "regint.h" static size_t Index: class.c =================================================================== --- class.c (revision 48479) +++ class.c (revision 48480) @@ -30,9 +30,6 @@ https://github.com/ruby/ruby/blob/trunk/class.c#L30 #include "vm_core.h" #include <ctype.h> -int rb_vm_add_root_module(ID id, VALUE module); - - #define id_attached id__attached__ void @@ -939,7 +936,6 @@ move_refined_method(st_data_t key, st_da https://github.com/ruby/ruby/blob/trunk/class.c#L936 void rb_prepend_module(VALUE klass, VALUE module) { - void rb_vm_check_redefinition_by_prepend(VALUE klass); VALUE origin; int changed = 0; Index: hash.c =================================================================== --- hash.c (revision 48479) +++ hash.c (revision 48480) @@ -171,7 +171,6 @@ static const struct st_hash_type objhash https://github.com/ruby/ruby/blob/trunk/hash.c#L171 rb_any_hash, }; -extern const struct st_hash_type st_hashtype_num; #define identhash st_hashtype_num typedef int st_foreach_func(st_data_t, st_data_t, st_data_t); Index: numeric.c =================================================================== --- numeric.c (revision 48479) +++ numeric.c (revision 48480) @@ -670,7 +670,6 @@ rb_float_new_in_heap(double d) https://github.com/ruby/ruby/blob/trunk/numeric.c#L670 static VALUE flo_to_s(VALUE flt) { - char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve); enum {decimal_mant = DBL_MANT_DIG-DBL_DIG}; enum {float_dig = DBL_DIG+1}; char buf[float_dig + (decimal_mant + CHAR_BIT - 1) / CHAR_BIT + 10]; @@ -2776,7 +2775,6 @@ fix_uminus(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L2775 VALUE rb_fix2str(VALUE x, int base) { - extern const char ruby_digitmap[]; char buf[SIZEOF_VALUE*CHAR_BIT + 2], *b = buf + sizeof buf; long val = FIX2LONG(x); int neg = 0; Index: internal.h =================================================================== --- internal.h (revision 48479) +++ internal.h (revision 48480) @@ -14,6 +14,7 @@ https://github.com/ruby/ruby/blob/trunk/internal.h#L14 #include "ruby.h" #include "ruby/encoding.h" +#include "ruby/io.h" #if defined(__cplusplus) extern "C" { @@ -516,6 +517,7 @@ VALUE rb_ary_last(int, const VALUE *, VA https://github.com/ruby/ruby/blob/trunk/internal.h#L517 void rb_ary_set_len(VALUE, long); void rb_ary_delete_same(VALUE, VALUE); VALUE rb_ary_tmp_new_fill(long capa); +size_t rb_ary_memsize(VALUE); #ifdef __GNUC__ #define rb_ary_new_from_args(n, ...) \ __extension__ ({ \ @@ -528,6 +530,7 @@ VALUE rb_ary_tmp_new_fill(long capa); https://github.com/ruby/ruby/blob/trunk/internal.h#L530 #endif /* bignum.c */ +extern const char ruby_digitmap[]; VALUE rb_big_fdiv(VALUE x, VALUE y); VALUE rb_big_uminus(VALUE x); VALUE rb_integer_float_cmp(VALUE x, VALUE y); @@ -568,6 +571,7 @@ void ruby_register_rollback_func_for_ens https://github.com/ruby/ruby/blob/trunk/internal.h#L571 PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2); /* dmyext.c */ +void Init_enc(void); void Init_ext(void); /* encoding.c */ @@ -597,8 +601,22 @@ enum ruby_preserved_encindex { https://github.com/ruby/ruby/blob/trunk/internal.h#L601 #define rb_usascii_encindex() ENCINDEX_US_ASCII ID rb_id_encoding(void); void rb_gc_mark_encodings(void); +rb_encoding *rb_enc_get_from_index(int index); +int rb_encdb_replicate(const char *alias, const char *orig); +int rb_encdb_alias(const char *alias, const char *orig); +int rb_encdb_dummy(const char *name); +void rb_encdb_declare(const char *name); +void rb_enc_set_base(const char *name, const char *orig); +int rb_enc_set_dummy(int index); +void rb_encdb_set_unicode(int index); + +/* enum.c */ +VALUE rb_f_send(int argc, VALUE *argv, VALUE recv); /* error.c */ +extern VALUE rb_eEAGAIN; +extern VALUE rb_eEWOULDBLOCK; +extern VALUE rb_eEINPROGRESS; NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4)); VALUE rb_check_backtrace(VALUE); NORETURN(void rb_async_bug_errno(const char *,int)); @@ -646,6 +664,7 @@ NORETURN(void rb_syserr_fail_path_in(con https://github.com/ruby/ruby/blob/trunk/internal.h#L664 /* gc.c */ extern VALUE *ruby_initial_gc_stress_ptr; +extern int ruby_disable_gc; void Init_heap(void); void *ruby_mimmalloc(size_t size); void ruby_mimfree(void *ptr); @@ -656,6 +675,7 @@ void rb_gc_writebarrier_remember(VALUE o https://github.com/ruby/ruby/blob/trunk/internal.h#L675 #define rb_gc_writebarrier_remember(obj) 0 #endif void ruby_gc_set_params(int safe_level); +void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj); #if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32) #define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size) @@ -675,6 +695,7 @@ void rb_gc_resurrect(VALUE ptr); https://github.com/ruby/ruby/blob/trunk/internal.h#L695 struct st_table *rb_hash_tbl_raw(VALUE hash); VALUE rb_hash_has_key(VALUE hash, VALUE key); VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc); +long rb_objid_hash(st_index_t index); #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h) VALUE rb_hash_keys(VALUE hash); @@ -692,6 +713,7 @@ ssize_t rb_io_bufread(VALUE io, void *bu https://github.com/ruby/ruby/blob/trunk/internal.h#L713 void rb_stdio_set_default_encoding(void); void rb_write_error_str(VALUE mesg); VALUE rb_io_flush_raw(VALUE, int); +size_t rb_io_memsize(const rb_io_t *); /* iseq.c */ VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase); @@ -708,6 +730,13 @@ VALUE rb_get_load_path(void); https://github.com/ruby/ruby/blob/trunk/internal.h#L730 VALUE rb_get_expanded_load_path(void); NORETURN(void rb_load_fail(VALUE, const char*)); +/* loadpath.c */ +extern const char ruby_exec_prefix[]; +extern const char ruby_initial_load_paths[]; + +/* localeinit.c */ +int Init_enc_set_filesystem_encoding(void); + /* math.c */ VALUE rb_math_atan2(VALUE, VALUE); VALUE rb_math_cos(VALUE); @@ -904,6 +933,7 @@ void rb_last_status_clear(void); https://github.com/ruby/ruby/blob/trunk/internal.h#L933 /* rational.c */ VALUE rb_lcm(VALUE x, VALUE y); VALUE rb_rational_reciprocal(VALUE x); +VALUE rb_cstr_to_rat(const char *, int); /* re.c */ VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline); @@ -916,6 +946,9 @@ extern int ruby_enable_coredump; https://github.com/ruby/ruby/blob/trunk/internal.h#L946 int rb_get_next_signal(void); int rb_sigaltstack_size(void); +/* st.c */ +extern const struct st_hash_type st_hashtype_num; + /* strftime.c */ #ifdef RUBY_ENCODING_H size_t rb_strftime_timespec(char *s, size_t maxsize, const char *format, rb_encoding *enc, @@ -945,6 +978,7 @@ VALUE rb_external_str_with_enc(VALUE str https://github.com/ruby/ruby/blob/trunk/internal.h#L978 #define STR_SHARED_P(s) FL_ALL((s), STR_NOEMBED|ELTS_SHARED) #define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) #define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) +size_t rb_str_memsize(VALUE); /* struct.c */ VALUE rb_struct_init_copy(VALUE copy, VALUE s); @@ -970,6 +1004,26 @@ void ruby_kill(rb_pid_t pid, int sig); https://github.com/ruby/ruby/blob/trunk/internal.h#L1004 /* thread_pthread.c, thread_win32.c */ void Init_native_thread(void); +/* transcode.c */ +extern VALUE rb_cEncodingConverter; +size_t rb_econv_memsize(rb_econv_t *); + +/* us_ascii.c */ +extern rb_encoding OnigEncodingUS_ASCII; + +/* util.c */ +char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve); +char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve); + +/* utf_8.c */ +extern rb_encoding OnigEncodingUTF_8; + +/* variable.c */ +size_t rb_generic_ivar_memsize(VALUE); + +/* version.c */ +extern VALUE ruby_engine_name; + /* vm_insnhelper.h */ rb_serial_t rb_next_class_serial(void); @@ -986,6 +1040,10 @@ void rb_thread_mark(void *th); https://github.com/ruby/ruby/blob/trunk/internal.h#L1040 const void **rb_vm_get_insns_address_table(void); VALUE rb_sourcefilename(void); void rb_vm_pop_cfunc_frame(void); +int rb_vm_add_root_module(ID id, VALUE module); +void rb_vm_check_redefinition_by_prepend(VALUE klass); +VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements); +VALUE ruby_vm_sysstack_error_copy(void); /* vm_dump.c */ void rb_print_backtrace(void); Index: ruby.c =================================================================== --- ruby.c (revision 48479) +++ ruby.c (revision 48480) @@ -342,7 +342,6 @@ ruby_init_loadpath_safe(int safe_level) https://github.com/ruby/ruby/blob/trunk/ruby.c#L342 { VALUE load_path; ID id_initial_load_path_mark; - extern const char ruby_initial_load_paths[]; const char *paths = ruby_initial_load_paths; #if defined LOAD_RELATIVE # if defined HAVE_DLADDR || defined __CYGWIN__ || defined _WIN32 @@ -453,7 +452,6 @@ ruby_init_loadpath_safe(int safe_level) https://github.com/ruby/ruby/blob/trunk/ruby.c#L452 #define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), (path), (len)) #else - extern const char ruby_exec_prefix[]; const size_t exec_prefix_len = strlen(ruby_exec_prefix); #define RUBY_RELATIVE(path, len) rubylib_path_new((path), (len)) #define PREFIX_PATH() RUBY_RELATIVE(ruby_exec_prefix, exec_prefix_len) @@ -1249,9 +1247,6 @@ rb_f_chomp(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1247 return str; } -/* blank function in dmyext.c or generated by enc/make_encmake.rb */ -extern void Init_enc(void); - static VALUE process_options(int argc, char **argv, struct cmdline_options *opt) { Index: marshal.c =================================================================== --- marshal.c (revision 48479) +++ marshal.c (revision 48480) @@ -359,7 +359,6 @@ load_mantissa(double d, const char *buf, https://github.com/ruby/ruby/blob/trunk/marshal.c#L359 static void w_float(double d, struct dump_arg *arg) { - char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve); char buf[FLOAT_DIG + (DECIMAL_MANT + 7) / 8 + 10]; if (isinf(d)) { Index: signal.c =================================================================== --- signal.c (revision 48479) +++ signal.c (revision 48480) @@ -840,8 +840,6 @@ ruby_abort(void) https://github.com/ruby/ruby/blob/trunk/signal.c#L840 } -extern int ruby_disable_gc; - #ifdef SIGSEGV static RETSIGTYPE sigsegv(int sig SIGINFO_ARG) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/