diff --git a/ChangeLog b/ChangeLog index a09b48bab0..64cedd5a37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Fri Dec 21 11:23:24 2007 Nobuyoshi Nakada + + * common.mk (enc.mk): depends on $(RBCONFIG) instead of rbconfig.rb. + + * encoding.c (Init_Encoding): ISO-8859-1 is no longer a replica. + + * regenc.h (OnigEncodingDefine): names of extension and encoding can + differ. + + * enc/Makefile.in: always shared. + + * enc/depend (deffile): should not upcase. + + * enc/{ascii,euc_jp,sjis,utf8,iso_8859_{1..16}}.c: fix for Init. + Fri Dec 21 09:26:48 2007 Tanaka Akira * tool/compile_prelude.rb: use erb. @@ -78,7 +93,6 @@ Thu Dec 20 17:07:54 2007 Nobuyoshi Nakada * enc/depend, enc/make_encmake.rb: fix for Windows. - * enc/{ascii,euc_jp,sjis,utf8,iso_8859_{1..16}}.c: renamed. Thu Dec 20 16:42:55 2007 Koichi Sasada diff --git a/common.mk b/common.mk index 1971641b61..010044b621 100644 --- a/common.mk +++ b/common.mk @@ -344,7 +344,7 @@ encs: enc.mk $(MAKE) -f enc.mk -$(MAKEFLAGS) enc.mk: $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \ - $(srcdir)/lib/mkmf.rb rbconfig.rb + $(srcdir)/lib/mkmf.rb $(RBCONFIG) $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" $@ .PRECIOUS: $(MKFILES) diff --git a/enc/Makefile.in b/enc/Makefile.in index a16124dc24..21be8ae02d 100644 --- a/enc/Makefile.in +++ b/enc/Makefile.in @@ -16,14 +16,14 @@ BUILTIN_ENCS = ascii.c \ RUBY_SO_NAME = @RUBY_SO_NAME@ LIBRUBY = @LIBRUBY@ -LIBRUBY_A = @LIBRUBY_A@ -LIBRUBYARG_STATIC = @LIBRUBYARG_STATIC@ LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@ +LIBRUBYARG_STATIC = $(LIBRUBYARG_SHARED) empty = CC = @CC@ OUTFLAG = @OUTFLAG@$(empty) -CFLAGS = @CFLAGS@ @ARCH_FLAG@ +CFLAGS = $(CCDLFLAGS) @CFLAGS@ @ARCH_FLAG@ +CCDLFLAGS = @CCDLFLAGS@ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(top_srcdir) DEFS = @DEFS@ CPPFLAGS = @CPPFLAGS@ -DONIG_ENC_REGISTER=rb_enc_register diff --git a/enc/ascii.c b/enc/ascii.c index 9428902a9f..3a40ad68be 100644 --- a/enc/ascii.c +++ b/enc/ascii.c @@ -38,7 +38,7 @@ ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc) return FALSE; } -OnigEncodingDefine(ASCII) = { +OnigEncodingDefine(ascii, ASCII) = { onigenc_single_byte_mbc_enc_len, "ASCII-8BIT",/* name */ 1, /* max byte length */ diff --git a/enc/depend b/enc/depend index 29ae9154b6..dcdffb8bae 100644 --- a/enc/depend +++ b/enc/depend @@ -35,9 +35,9 @@ $(ENCSODIR)/<%e%>.$(DLEXT): <%deps%> ! end ! if DEFFILE ! encs.each do |e| -<%e%>-$(arch).def: +<%e%>-$(arch).def: enc.mk echo EXPORTS > $@ - echo <%EXPORT_PREFIX%>Init_<%e.upcase%> >> $@ + echo <%EXPORT_PREFIX%>Init_<%e%> >> $@ ! end ! end diff --git a/enc/euc_jp.c b/enc/euc_jp.c index 240e110139..eca698c271 100644 --- a/enc/euc_jp.c +++ b/enc/euc_jp.c @@ -341,7 +341,7 @@ get_ctype_code_range(int ctype, OnigCodePoint* sb_out, } -OnigEncodingDefine(EUC_JP) = { +OnigEncodingDefine(euc_jp, EUC_JP) = { mbc_enc_len, "EUC-JP", /* name */ 3, /* max enc length */ diff --git a/enc/iso_8859_1.c b/enc/iso_8859_1.c index f7db6f931d..0c85c8befb 100644 --- a/enc/iso_8859_1.c +++ b/enc/iso_8859_1.c @@ -254,7 +254,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc) return FALSE; } -OnigEncodingDefine(ISO_8859_1) = { +OnigEncodingDefine(iso_8859_1, ISO_8859_1) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-1", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_10.c b/enc/iso_8859_10.c index 20606d7398..2b5affa4ee 100644 --- a/enc/iso_8859_10.c +++ b/enc/iso_8859_10.c @@ -224,7 +224,7 @@ iso_8859_10_get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(ISO_8859_10) = { +OnigEncodingDefine(iso_8859_10, ISO_8859_10) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-10", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_11.c b/enc/iso_8859_11.c index 463f52eff2..343993d01c 100644 --- a/enc/iso_8859_11.c +++ b/enc/iso_8859_11.c @@ -76,7 +76,7 @@ iso_8859_11_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding e return FALSE; } -OnigEncodingDefine(ISO_8859_11) = { +OnigEncodingDefine(iso_8859_11, ISO_8859_11) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-11", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_13.c b/enc/iso_8859_13.c index 3a9911550f..4b6db1adf3 100644 --- a/enc/iso_8859_13.c +++ b/enc/iso_8859_13.c @@ -213,7 +213,7 @@ iso_8859_13_get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(ISO_8859_13) = { +OnigEncodingDefine(iso_8859_13, ISO_8859_13) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-13", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_14.c b/enc/iso_8859_14.c index d4afd9db33..c54d8fcbd2 100644 --- a/enc/iso_8859_14.c +++ b/enc/iso_8859_14.c @@ -225,7 +225,7 @@ iso_8859_14_get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(ISO_8859_14) = { +OnigEncodingDefine(iso_8859_14, ISO_8859_14) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-14", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_15.c b/enc/iso_8859_15.c index 9deeec7ac4..de963706f4 100644 --- a/enc/iso_8859_15.c +++ b/enc/iso_8859_15.c @@ -219,7 +219,7 @@ iso_8859_15_get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(ISO_8859_15) = { +OnigEncodingDefine(iso_8859_15, ISO_8859_15) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-15", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_16.c b/enc/iso_8859_16.c index 76517f85c7..1cf4f65672 100644 --- a/enc/iso_8859_16.c +++ b/enc/iso_8859_16.c @@ -222,7 +222,7 @@ iso_8859_16_get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(ISO_8859_16) = { +OnigEncodingDefine(iso_8859_16, ISO_8859_16) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-16", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_2.c b/enc/iso_8859_2.c index 182a417f10..57340b3e15 100644 --- a/enc/iso_8859_2.c +++ b/enc/iso_8859_2.c @@ -219,7 +219,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc) return FALSE; } -OnigEncodingDefine(ISO_8859_2) = { +OnigEncodingDefine(iso_8859_2, ISO_8859_2) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-2", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_3.c b/enc/iso_8859_3.c index 952483a439..90c2636d5c 100644 --- a/enc/iso_8859_3.c +++ b/enc/iso_8859_3.c @@ -219,7 +219,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(ISO_8859_3) = { +OnigEncodingDefine(iso_8859_3, ISO_8859_3) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-3", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_4.c b/enc/iso_8859_4.c index a82ec3c3ba..cc103cd924 100644 --- a/enc/iso_8859_4.c +++ b/enc/iso_8859_4.c @@ -221,7 +221,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(ISO_8859_4) = { +OnigEncodingDefine(iso_8859_4, ISO_8859_4) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-4", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_5.c b/enc/iso_8859_5.c index 69908a2eeb..de7a0fd8bb 100644 --- a/enc/iso_8859_5.c +++ b/enc/iso_8859_5.c @@ -209,7 +209,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(ISO_8859_5) = { +OnigEncodingDefine(iso_8859_5, ISO_8859_5) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-5", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_6.c b/enc/iso_8859_6.c index b0da863b67..c0f3027904 100644 --- a/enc/iso_8859_6.c +++ b/enc/iso_8859_6.c @@ -76,7 +76,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc) return FALSE; } -OnigEncodingDefine(ISO_8859_6) = { +OnigEncodingDefine(iso_8859_6, ISO_8859_6) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-6", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_7.c b/enc/iso_8859_7.c index fc825b1363..2ff42ed53f 100644 --- a/enc/iso_8859_7.c +++ b/enc/iso_8859_7.c @@ -206,7 +206,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag, } -OnigEncodingDefine(ISO_8859_7) = { +OnigEncodingDefine(iso_8859_7, ISO_8859_7) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-7", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_8.c b/enc/iso_8859_8.c index 61cd84258b..3a075b0af3 100644 --- a/enc/iso_8859_8.c +++ b/enc/iso_8859_8.c @@ -76,7 +76,7 @@ iso_8859_8_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding en return FALSE; } -OnigEncodingDefine(ISO_8859_8) = { +OnigEncodingDefine(iso_8859_8, ISO_8859_8) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-8", /* name */ 1, /* max enc length */ diff --git a/enc/iso_8859_9.c b/enc/iso_8859_9.c index 95d92d906f..1921c591ba 100644 --- a/enc/iso_8859_9.c +++ b/enc/iso_8859_9.c @@ -213,7 +213,7 @@ iso_8859_9_get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(ISO_8859_9) = { +OnigEncodingDefine(iso_8859_9, ISO_8859_9) = { onigenc_single_byte_mbc_enc_len, "ISO-8859-9", /* name */ 1, /* max enc length */ diff --git a/enc/sjis.c b/enc/sjis.c index e3d656ffb5..5540a1fb70 100644 --- a/enc/sjis.c +++ b/enc/sjis.c @@ -351,7 +351,7 @@ get_ctype_code_range(int ctype, OnigCodePoint* sb_out, } } -OnigEncodingDefine(SJIS) = { +OnigEncodingDefine(sjis, SJIS) = { mbc_enc_len, "Shift_JIS", /* name */ 2, /* max byte length */ diff --git a/enc/utf8.c b/enc/utf8.c index 9f278b54b0..adfb2742a5 100644 --- a/enc/utf8.c +++ b/enc/utf8.c @@ -486,7 +486,7 @@ utf8_get_case_fold_codes_by_str(OnigCaseFoldType flag, flag, p, end, items); } -OnigEncodingDefine(UTF8) = { +OnigEncodingDefine(utf8, UTF8) = { utf8_mbc_enc_len, "UTF-8", /* name */ 6, /* max byte length */ diff --git a/encoding.c b/encoding.c index 5d416526c7..a85cfdfdf5 100644 --- a/encoding.c +++ b/encoding.c @@ -773,9 +773,6 @@ Init_Encoding(void) rb_define_singleton_method(rb_cEncoding, "default_external", get_default_external, 0); - /* should be imported from Oniguruma */ - rb_enc_replicate("ISO-8859-1", rb_enc_find(rb_enc_name(ONIG_ENCODING_ASCII))); - /* dummy for unsupported, statefull encoding */ rb_enc_replicate("ISO-2022-JP", rb_enc_find(rb_enc_name(ONIG_ENCODING_ASCII))); diff --git a/regenc.h b/regenc.h index 2512985ba0..d23a60acdf 100644 --- a/regenc.h +++ b/regenc.h @@ -181,9 +181,9 @@ ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[]; extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*); #define OnigEncodingName(n) encoding_##n #define OnigEncodingDeclare(n) static OnigEncodingType OnigEncodingName(n) -#define OnigEncodingDefine(n) \ +#define OnigEncodingDefine(f,n) \ OnigEncodingDeclare(n); \ - void Init_##n(void) { \ + void Init_##f(void) { \ ONIG_ENC_REGISTER(OnigEncodingName(n).name, \ &OnigEncodingName(n)); \ } \ @@ -191,7 +191,7 @@ extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*); #else #define OnigEncodingName(n) OnigEncoding##n #define OnigEncodingDeclare(n) OnigEncodingType OnigEncodingName(n) -#define OnigEncodingDefine(n) OnigEncodingDeclare(n) +#define OnigEncodingDefine(f,n) OnigEncodingDeclare(n) #endif #endif /* REGENC_H */