summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-18 15:13:05 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-18 15:13:05 +0000
commit2b9191e5572f165ea88295094dcbf3f466684902 (patch)
treefc397b34b1c99c78970a248abfc3737bf310df71
parentcebd7eca53db168754836764928dafe296a09b91 (diff)
* internal.h: Gather declarations in non-header files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--class.c4
-rw-r--r--complex.c2
-rw-r--r--enc/encdb.c7
-rw-r--r--encoding.c5
-rw-r--r--enum.c2
-rw-r--r--eval.c3
-rw-r--r--gc.c4
-rw-r--r--hash.c1
-rw-r--r--internal.h58
-rw-r--r--io.c5
-rw-r--r--marshal.c1
-rw-r--r--numeric.c2
-rw-r--r--object.c3
-rw-r--r--ruby.c5
-rw-r--r--signal.c2
-rw-r--r--sprintf.c2
-rw-r--r--string.c3
-rw-r--r--thread.c2
-rw-r--r--vm_backtrace.c2
20 files changed, 62 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index 5b0613e..37bf700 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Nov 18 23:23:45 2014 Tanaka Akira <akr@fsij.org>
+
+ * internal.h: Gather declarations in non-header files.
+
Tue Nov 18 23:45:52 2014 Tanaka Akira <akr@fsij.org>
* debug.c (SET_WHEN): Don't declare debug variables here.
diff --git a/class.c b/class.c
index 9500a1f..d9ce5b5 100644
--- a/class.c
+++ b/class.c
@@ -30,9 +30,6 @@
#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_data_t value, st_data_t data)
void
rb_prepend_module(VALUE klass, VALUE module)
{
- void rb_vm_check_redefinition_by_prepend(VALUE klass);
VALUE origin;
int changed = 0;
diff --git a/complex.c b/complex.c
index 87f96f4..11a394c 100644
--- a/complex.c
+++ b/complex.c
@@ -1633,8 +1633,6 @@ isimagunit(int c)
c == 'j' || c == 'J');
}
-VALUE rb_cstr_to_rat(const char *, int);
-
static VALUE
str2num(char *s)
{
diff --git a/enc/encdb.c b/enc/encdb.c
index fa04a5f..172e643 100644
--- a/enc/encdb.c
+++ b/enc/encdb.c
@@ -9,13 +9,6 @@
**********************************************************************/
-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)
diff --git a/encoding.c b/encoding.c
index 1e3ca07..fc79d38 100644
--- a/encoding.c
+++ b/encoding.c
@@ -571,9 +571,6 @@ rb_encdb_set_unicode(int index)
((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 {
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)
{
diff --git a/enum.c b/enum.c
index 64bad8b..37990b7 100644
--- a/enum.c
+++ b/enum.c
@@ -14,8 +14,6 @@
#include "node.h"
#include "id.h"
-VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
-
VALUE rb_mEnumerable;
static ID id_next;
diff --git a/eval.c b/eval.c
index 1494e1d..8390c7d 100644
--- a/eval.c
+++ b/eval.c
@@ -509,7 +509,6 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
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_refinements,
rb_hash_aset(activated_refinements, klass, iclass);
}
-VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
-
/*
* call-seq:
* refine(klass) { block } -> module
diff --git a/gc.c b/gc.c
index d6aaf2e..5a94103 100644
--- a/gc.c
+++ b/gc.c
@@ -2803,10 +2803,6 @@ rb_obj_id(VALUE obj)
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
diff --git a/hash.c b/hash.c
index bd6134d..a0c1ced 100644
--- a/hash.c
+++ b/hash.c
@@ -171,7 +171,6 @@ static const struct st_hash_type objhash = {
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);
diff --git a/internal.h b/internal.h
index ab2cb8d..d859d05 100644
--- a/internal.h
+++ b/internal.h
@@ -14,6 +14,7 @@
#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 *, VALUE);
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);
#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_ensure(VALUE (*ensure_func)(ANYARGS), VALUE
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 {
#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(const char *func_name, int err, VALUE path)
/* 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 obj);
#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);
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 *buf, size_t size);
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);
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);
/* 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;
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, rb_encoding *eenc);
#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);
/* 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);
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);
diff --git a/io.c b/io.c
index 8c14b7b..0d75ee5 100644
--- a/io.c
+++ b/io.c
@@ -152,9 +152,6 @@ VALUE rb_eEOFError;
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)
return 1;
}
-size_t rb_econv_memsize(rb_econv_t *);
-
RUBY_FUNC_EXPORTED size_t
rb_io_memsize(const rb_io_t *fptr)
{
diff --git a/marshal.c b/marshal.c
index f9ba815..40546a7 100644
--- a/marshal.c
+++ b/marshal.c
@@ -359,7 +359,6 @@ load_mantissa(double d, const char *buf, long len)
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)) {
diff --git a/numeric.c b/numeric.c
index 36a2c18..5bbdbfb 100644
--- a/numeric.c
+++ b/numeric.c
@@ -670,7 +670,6 @@ rb_float_new_in_heap(double d)
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)
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;
diff --git a/object.c b/object.c
index 74521f8..eadc1be 100644
--- a/object.c
+++ b/object.c
@@ -162,7 +162,6 @@ rb_obj_equal(VALUE obj1, VALUE obj2)
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)
}
}
-void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj);
-
static void
init_copy(VALUE dest, VALUE obj)
{
diff --git a/ruby.c b/ruby.c
index 3894892..fdd843e 100644
--- a/ruby.c
+++ b/ruby.c
@@ -342,7 +342,6 @@ ruby_init_loadpath_safe(int safe_level)
{
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)
#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)
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)
{
diff --git a/signal.c b/signal.c
index 6d4a4f3..dd808df 100644
--- a/signal.c
+++ b/signal.c
@@ -840,8 +840,6 @@ ruby_abort(void)
}
-extern int ruby_disable_gc;
-
#ifdef SIGSEGV
static RETSIGTYPE
sigsegv(int sig SIGINFO_ARG)
diff --git a/sprintf.c b/sprintf.c
index e129272..d91d850 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -23,8 +23,6 @@
#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
diff --git a/string.c b/string.c
index 0c0d0dd..1fb78ec 100644
--- a/string.c
+++ b/string.c
@@ -135,8 +135,6 @@ VALUE rb_cSymbol;
#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)
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;
diff --git a/thread.c b/thread.c
index 039b858..a8cc250 100644
--- a/thread.c
+++ b/thread.c
@@ -4662,8 +4662,6 @@ rb_thread_shield_destroy(VALUE self)
/* variables for recursive traversals */
static ID recursive_key;
-extern const struct st_hash_type st_hashtype_num;
-
static VALUE
ident_hash_new(void)
{
diff --git a/vm_backtrace.c b/vm_backtrace.c
index 042c282..7b579d6 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -19,8 +19,6 @@
static VALUE rb_cBacktrace;
static VALUE rb_cBacktraceLocation;
-extern VALUE ruby_engine_name;
-
static VALUE
id2str(ID id)
{