summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-13 01:15:32 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-13 01:15:32 +0000
commit80a569906d1fcbede2278193226fef84cdaa96f4 ()
treed1c6a1134db4e7e796798e6caa78132cabbc3fd4
parent55fc5598453ed67a86692e3540fca34ce27d2f13 (diff)
* encoding.c (rb_enc_init): revert removing SJIS.
* enc/sjis.c: move to enc/shift_jis.c, to make encoding name equal to filename for convinience of loading lib. * enc/shift_jis.c: moved from enc/sjis.c. * common.mk: follows enc/shift_jis.c. * enc/Makefile.in: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog13
-rw-r--r--common.mk2
-rw-r--r--enc/Makefile.in2
-rw-r--r--enc/shift_jis.c (renamed from enc/sjis.c)0
-rw-r--r--encoding.c33
5 files changed, 35 insertions, 15 deletions
@@ -1,3 +1,16 @@
Sun Jan 13 09:22:33 2008 Nobuyoshi Nakada <[email protected]>
* common.mk (incs): includes encdb.h.
@@ -667,7 +667,7 @@ ascii.$(OBJEXT): {$(VPATH)}ascii.c {$(VPATH)}regenc.h {$(VPATH)}config.h \
euc_jp.$(OBJEXT): {$(VPATH)}euc_jp.c {$(VPATH)}regint.h \
{$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}regenc.h \
{$(VPATH)}oniguruma.h {$(VPATH)}st.h
-sjis.$(OBJEXT): {$(VPATH)}sjis.c {$(VPATH)}regint.h {$(VPATH)}config.h \
{$(VPATH)}defines.h {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h \
{$(VPATH)}st.h
unicode.$(OBJEXT): {$(VPATH)}unicode.c {$(VPATH)}regint.h \
@@ -15,7 +15,7 @@ DLEXT = @DLEXT@
OBJEXT = @OBJEXT@
BUILTIN_ENCS = ascii.c \
- euc_jp.c sjis.c \
unicode.c utf8.c
RUBY_SO_NAME = @RUBY_SO_NAME@
@@ -292,6 +292,8 @@ rb_enc_alias(const char *alias, const char *orig)
enum {
ENCINDEX_ASCII,
ENCINDEX_UTF8,
ENCINDEX_BUILTIN_MAX
};
@@ -302,6 +304,8 @@ rb_enc_init(void)
enc_table_count = enc_table_expand(ENCINDEX_BUILTIN_MAX);
#define ENC_REGISTER(enc) enc_register_at(ENCINDEX_##enc, rb_enc_name(ONIG_ENCODING_##enc), ONIG_ENCODING_##enc)
ENC_REGISTER(ASCII);
ENC_REGISTER(UTF8);
#undef ENC_REGISTER
}
@@ -366,21 +370,24 @@ rb_enc_find_index(const char *name)
OBJ_FREEZE(enclib);
if (RTEST(rb_protect(require_enc, enclib, 0)))
i = rb_enc_registered(name);
- else {
- st_data_t key = (st_data_t)name, orig;
- if (st_lookup(enc_table_replica_name, key, &orig)) {
- i = rb_enc_find_index((char *)orig);
- if (i < 0) {
- rb_raise(rb_eRuntimeError, "unknown original encoding name - %s for %s", (char *)orig, name);
- }
- i = rb_enc_replicate(name, rb_enc_from_index(i));
- st_delete(enc_table_replica_name, &key, &orig);
- } else if (st_lookup(enc_table_alias_name, key, &orig)) {
- i = rb_enc_alias(name, (char *)orig);
- st_delete(enc_table_replica_name, &key, &orig);
}
}
- rb_set_errinfo(Qnil);
}
return i;
}