diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-13 01:15:32 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-13 01:15:32 +0000 |
commit | 80a569906d1fcbede2278193226fef84cdaa96f4 (patch) | |
tree | d1c6a1134db4e7e796798e6caa78132cabbc3fd4 | |
parent | 55fc5598453ed67a86692e3540fca34ce27d2f13 (diff) | |
download | ruby-80a569906d1fcbede2278193226fef84cdaa96f4.tar.gz |
* 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-- | ChangeLog | 13 | ||||
-rw-r--r-- | common.mk | 2 | ||||
-rw-r--r-- | enc/Makefile.in | 2 | ||||
-rw-r--r-- | enc/shift_jis.c (renamed from enc/sjis.c) | 0 | ||||
-rw-r--r-- | encoding.c | 33 |
5 files changed, 35 insertions, 15 deletions
@@ -1,3 +1,16 @@ +Sun Jan 13 09:58:17 2008 NARUSE, Yui <naruse@ruby-lang.org> + + * 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. + Sun Jan 13 09:22:33 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * 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 \ +shift_jis.$(OBJEXT): {$(VPATH)}shift_jis.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 \ diff --git a/enc/Makefile.in b/enc/Makefile.in index 082be84c86..694803427f 100644 --- a/enc/Makefile.in +++ b/enc/Makefile.in @@ -15,7 +15,7 @@ DLEXT = @DLEXT@ OBJEXT = @OBJEXT@ BUILTIN_ENCS = ascii.c \ - euc_jp.c sjis.c \ + euc_jp.c shift_jis.c \ unicode.c utf8.c RUBY_SO_NAME = @RUBY_SO_NAME@ diff --git a/enc/sjis.c b/enc/shift_jis.c index dcf05bf86f..dcf05bf86f 100644 --- a/enc/sjis.c +++ b/enc/shift_jis.c diff --git a/encoding.c b/encoding.c index c62e32b3d7..b7debda0ba 100644 --- a/encoding.c +++ b/encoding.c @@ -292,6 +292,8 @@ rb_enc_alias(const char *alias, const char *orig) enum { ENCINDEX_ASCII, + ENCINDEX_EUC_JP, + ENCINDEX_SJIS, 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(EUC_JP); + ENC_REGISTER(SJIS); 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); + } + if (i < 0) { + 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 replica '%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); + if (i < 0) { + rb_raise(rb_eRuntimeError, "unknown original encoding name - '%s' for alias '%s'", (char *)orig, name); } + st_delete(enc_table_alias_name, &key, &orig); } - rb_set_errinfo(Qnil); } return i; } |