* encoding.c (enc_init_db): moved to enc/encdb.c.

* transcode.c (init_transcoder_table): moved to enc/trans/transdb.c.

* enc/depend (enc/encdb.o enc/trans/transdb.o): depend on
  corresponding headers.

* common.mk (COMMONOBJS): moved transcode.o from OBJS


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-04-07 06:51:33 +00:00
Родитель 3f3fdb4869
Коммит 1369cfd16e
10 изменённых файлов: 76 добавлений и 58 удалений

Просмотреть файл

@ -1,3 +1,14 @@
Mon Apr 7 15:51:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (enc_init_db): moved to enc/encdb.c.
* transcode.c (init_transcoder_table): moved to enc/trans/transdb.c.
* enc/depend (enc/encdb.o enc/trans/transdb.o): depend on
corresponding headers.
* common.mk (COMMONOBJS): moved transcode.o from OBJS
Mon Apr 7 12:26:32 2008 Koichi Sasada <ko1@atdot.net>
* bootstraptest/test_knownbug.rb: add a known-bug.

Просмотреть файл

@ -18,7 +18,7 @@ NORMALMAINOBJ = main.$(OBJEXT)
MAINOBJ = $(NORMALMAINOBJ)
EXTOBJS =
DLDOBJS = $(DMYEXT)
MINIOBJS = $(ARCHMINIOBJS) dmyencoding.$(OBJEXT) dmytranscode.$(OBJEXT) miniprelude.$(OBJEXT)
MINIOBJS = $(ARCHMINIOBJS) dmyencoding.$(OBJEXT) miniprelude.$(OBJEXT)
COMMONOBJS = array.$(OBJEXT) \
bignum.$(OBJEXT) \
@ -62,6 +62,7 @@ COMMONOBJS = array.$(OBJEXT) \
string.$(OBJEXT) \
struct.$(OBJEXT) \
time.$(OBJEXT) \
transcode.$(OBJEXT) \
util.$(OBJEXT) \
variable.$(OBJEXT) \
version.$(OBJEXT) \
@ -80,7 +81,6 @@ COMMONOBJS = array.$(OBJEXT) \
OBJS = dln.$(OBJEXT) \
encoding.$(OBJEXT) \
prelude.$(OBJEXT) \
transcode.$(OBJEXT) \
$(COMMONOBJS)
GOLFOBJS = goruby.$(OBJEXT) golf_prelude.$(OBJEXT)
@ -445,7 +445,7 @@ dmyencoding.$(OBJEXT): {$(VPATH)}dmyencoding.c \
{$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}missing.h \
{$(VPATH)}intern.h {$(VPATH)}st.h {$(VPATH)}encoding.h \
{$(VPATH)}oniguruma.h {$(VPATH)}regenc.h
encoding.$(OBJEXT): dmyencoding.$(OBJEXT) {$(VPATH)}encdb.h
encoding.$(OBJEXT): dmyencoding.$(OBJEXT)
enum.$(OBJEXT): {$(VPATH)}enum.c {$(VPATH)}ruby.h {$(VPATH)}config.h \
{$(VPATH)}defines.h {$(VPATH)}missing.h {$(VPATH)}intern.h \
{$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h
@ -596,11 +596,10 @@ thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h {$(VPATH)}id.h \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}dln.h {$(VPATH)}vm.h \
{$(VPATH)}gc.h {$(VPATH)}thread_$(THREAD_MODEL).c
dmytranscode.$(OBJEXT): {$(VPATH)}transcode.c {$(VPATH)}ruby.h \
transcode.$(OBJEXT): {$(VPATH)}transcode.c {$(VPATH)}ruby.h \
{$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}missing.h \
{$(VPATH)}intern.h {$(VPATH)}st.h {$(VPATH)}encoding.h \
{$(VPATH)}oniguruma.h {$(VPATH)}transcode_data.h
transcode.$(OBJEXT): dmytranscode.$(OBJEXT) {$(VPATH)}transdb.h
cont.$(OBJEXT): {$(VPATH)}cont.c {$(VPATH)}ruby.h {$(VPATH)}config.h \
{$(VPATH)}defines.h {$(VPATH)}missing.h {$(VPATH)}intern.h \
{$(VPATH)}st.h {$(VPATH)}vm_core.h {$(VPATH)}signal.h {$(VPATH)}node.h \
@ -737,7 +736,7 @@ miniprelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb
prelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $(srcdir)/gem_prelude.rb $(RBCONFIG) $(PREP)
$(MINIRUBY) -I$(srcdir) -rrbconfig $(srcdir)/tool/compile_prelude.rb \
$(srcdir)/prelude.rb $(srcdir)/gem_prelude.rb $@.new
$(srcdir)/prelude.rb $(srcdir)/enc/prelude.rb $(srcdir)/gem_prelude.rb $@.new
$(IFCHANGE) "$@" "$@.new"
golf_prelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $(srcdir)/golf_prelude.rb $(PREP)

Просмотреть файл

@ -1,3 +1,2 @@
#define NO_ENCDB_H 1
#define NO_LOCALE_CHARMAP 1
#include "encoding.c"

Просмотреть файл

@ -1,2 +0,0 @@
#define NO_TRANSDB_H 1
#include "transcode.c"

Просмотреть файл

@ -54,5 +54,8 @@ enc/<%=e%>.$(OBJEXT): $(srcdir)/enc/<%=e%>.c
<%=COMPILE_C.sub(/\$\(<(?:.*)\)/) {"$(srcdir)/enc/#{e}.c"}%>
% end
enc/encdb.$(OBJEXT): encdb.h
enc/trans/transdb.$(OBJEXT): transdb.h
clean:
@$(RM) $(ENCSOS) $(ENCDEFS) $(ENCOBJS) $(TRANSSOS) $(TRANSDEFS) $(TRANSOBJS)

25
enc/encdb.c Normal file
Просмотреть файл

@ -0,0 +1,25 @@
/**********************************************************************
enc/encdb.c -
$Author$
created at: Mon Apr 7 15:51:31 2008
Copyright (C) 2008 Yukihiro Matsumoto
**********************************************************************/
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);
#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)
#define ENC_DEFINE(name) rb_encdb_declare(name)
void
Init_encdb(void)
{
#include "encdb.h"
}

6
enc/prelude.rb Normal file
Просмотреть файл

@ -0,0 +1,6 @@
%w'enc/init enc/trans/init'.each do |init|
begin
require(init)
rescue LoadError
end
end

18
enc/trans/transdb.c Normal file
Просмотреть файл

@ -0,0 +1,18 @@
/**********************************************************************
enc/trans/transdb.c -
$Author$
created at: Mon Apr 7 15:51:31 2008
Copyright (C) 2008 Yukihiro Matsumoto
**********************************************************************/
void rb_declare_transcoder(const char *enc1, const char *enc2, const char *lib);
void
Init_transdb(void)
{
#include "transdb.h"
}

Просмотреть файл

@ -34,29 +34,7 @@ static struct {
void rb_enc_init(void);
#ifndef NO_ENCDB_H
#undef ENC_REPLICATE
#undef ENC_ALIAS
#undef ENC_DUMMY
static int encdb_replicate(const char *alias, const char *orig);
static int encdb_alias(const char *alias, const char *orig);
static int encdb_dummy(const char *name);
static void encdb_declare(const char *name);
#define ENC_REPLICATE(name, orig) encdb_replicate(name, orig)
#define ENC_ALIAS(name, orig) encdb_alias(name, orig)
#define ENC_DUMMY(name) encdb_dummy(name)
#define ENC_DEFINE(name) encdb_declare(name)
#endif
static void
enc_init_db(void)
{
#ifdef NO_ENCDB_H
#define ENCODING_COUNT ENCINDEX_BUILTIN_MAX
#else
#include "encdb.h"
#endif
}
#define enc_autoload_p(enc) (!rb_enc_mbmaxlen(enc))
@ -251,9 +229,8 @@ rb_enc_register(const char *name, rb_encoding *encoding)
return index;
}
#ifndef NO_ENCDB_H
static void
encdb_declare(const char *name)
void
rb_encdb_declare(const char *name)
{
int idx = rb_enc_registered(name);
if (idx < 0) {
@ -261,7 +238,6 @@ encdb_declare(const char *name)
}
set_encoding_const(name, rb_enc_from_index(idx));
}
#endif
static void
enc_check_duplication(const char *name)
@ -293,7 +269,6 @@ rb_enc_replicate(const char *name, rb_encoding *encoding)
return idx;
}
#ifndef NO_ENCDB_H
static int
enc_replicate(int idx, const char *name, rb_encoding *origenc)
{
@ -310,8 +285,8 @@ enc_replicate(int idx, const char *name, rb_encoding *origenc)
return idx;
}
static int
encdb_replicate(const char *name, const char *orig)
int
rb_encdb_replicate(const char *name, const char *orig)
{
int origidx = rb_enc_registered(orig);
int idx = rb_enc_registered(name);
@ -321,7 +296,6 @@ encdb_replicate(const char *name, const char *orig)
}
return enc_replicate(idx, name, rb_enc_from_index(origidx));
}
#endif
int
rb_define_dummy_encoding(const char *name)
@ -333,9 +307,8 @@ rb_define_dummy_encoding(const char *name)
return index;
}
#ifndef NO_ENCDB_H
static int
encdb_dummy(const char *name)
int
rb_encdb_dummy(const char *name)
{
int index = enc_replicate(rb_enc_registered(name), name,
rb_ascii8bit_encoding());
@ -344,7 +317,6 @@ encdb_dummy(const char *name)
ENC_SET_DUMMY(enc);
return index;
}
#endif
int
rb_enc_dummy_p(rb_encoding *enc)
@ -398,9 +370,8 @@ rb_enc_alias(const char *alias, const char *orig)
return enc_alias(alias, idx);
}
#ifndef NO_ENCDB_H
static int
encdb_alias(const char *alias, const char *orig)
int
rb_encdb_alias(const char *alias, const char *orig)
{
int idx = rb_enc_registered(orig);
@ -409,7 +380,6 @@ encdb_alias(const char *alias, const char *orig)
}
return enc_alias(alias, idx);
}
#endif
enum {
ENCINDEX_ASCII,
@ -1225,8 +1195,6 @@ Init_Encoding(void)
rb_define_singleton_method(rb_cEncoding, "default_external", get_default_external, 0);
rb_define_singleton_method(rb_cEncoding, "locale_charmap", rb_locale_charmap, 0);
enc_init_db();
}
/* locale insensitive functions */

Просмотреть файл

@ -85,14 +85,6 @@ rb_declare_transcoder(const char *enc1, const char *enc2, const char *lib)
declare_transcoder(enc2, enc1, lib);
}
static void
init_transcoder_table(void)
{
#ifndef NO_TRANSDB_H
#include "transdb.h"
#endif
}
#define encoding_equal(enc1, enc2) (STRCASECMP(enc1, enc2) == 0)
static const rb_transcoder *
@ -451,7 +443,6 @@ Init_transcode(void)
{
transcoder_table = st_init_strcasetable();
transcoder_lib_table = st_init_strcasetable();
init_transcoder_table();
sym_invalid = ID2SYM(rb_intern("invalid"));
sym_ignore = ID2SYM(rb_intern("ignore"));