зеркало из https://github.com/github/ruby.git
* common.mk (enc.mk): depends on rbconfig.rb.
* regenc.h (OnigEncodingDefine): external encoding definition macro. * enc/Makefile.in: fix for linking. * enc/depend, enc/make_encmake.rb: fix for Windows. * enc/{ascii,euc_jp,sjis,utf8,iso_8859_{1..16}}.c: renamed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
be137f3601
Коммит
dc4d4b3923
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
Thu Dec 20 17:07:54 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* common.mk (enc.mk): depends on rbconfig.rb.
|
||||
|
||||
* regenc.h (OnigEncodingDefine): external encoding definition macro.
|
||||
|
||||
* enc/Makefile.in: fix for linking.
|
||||
|
||||
* 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 <ko1@atdot.net>
|
||||
|
||||
* iseq.c (find_line_no): return 0 if not found.
|
||||
|
|
|
@ -343,8 +343,8 @@ encs: enc.mk
|
|||
$(MINIRUBY) -I$(srcdir)/lib -run -e mkdir -- -p "$(EXTOUT)/$(arch)/enc"
|
||||
$(MAKE) -f enc.mk -$(MAKEFLAGS)
|
||||
|
||||
enc.mk: miniruby$(EXEEXT) $(srcdir)/enc/make_encmake.rb \
|
||||
$(srcdir)/enc/Makefile.in $(srcdir)/enc/depend $(srcdir)/lib/mkmf.rb
|
||||
enc.mk: $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \
|
||||
$(srcdir)/lib/mkmf.rb rbconfig.rb
|
||||
$(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" $@
|
||||
|
||||
.PRECIOUS: $(MKFILES)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
srcdir = @srcdir@
|
||||
topdir = .
|
||||
libdir = @libdir@
|
||||
top_srcdir = $(srcdir:/enc=)
|
||||
arch = @arch@
|
||||
EXTOUT = @EXTOUT@
|
||||
|
@ -12,16 +14,22 @@ BUILTIN_ENCS = ascii.c \
|
|||
euc_jp.c sjis.c \
|
||||
unicode.c utf8.c
|
||||
|
||||
RUBY_SO_NAME = @RUBY_SO_NAME@
|
||||
LIBRUBY = @LIBRUBY@
|
||||
LIBRUBY_A = @LIBRUBY_A@
|
||||
LIBRUBYARG_STATIC = @LIBRUBYARG_STATIC@
|
||||
LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
|
||||
|
||||
empty =
|
||||
CC = @CC@
|
||||
OUTFLAG = @OUTFLAG@$(empty)
|
||||
CFLAGS = @CFLAGS@ @ARCH_FLAG@
|
||||
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(top_srcdir)
|
||||
DEFS = @DEFS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@ -DONIG_ENC_REGISTER=rb_enc_register
|
||||
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
|
||||
XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS)
|
||||
LIBS = @LIBS@ $(EXTLIBS)
|
||||
LIBS = @LIBRUBYARG@ @LIBS@ $(EXTLIBS)
|
||||
LDSHARED = @LDSHARED@
|
||||
DLDFLAGS = @DLDFLAGS@ $(EXTLDFLAGS) @ARCH_FLAG@
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingASCII = {
|
||||
OnigEncodingDefine(ASCII) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ASCII-8BIT",/* name */
|
||||
1, /* max byte length */
|
||||
|
|
29
enc/depend
29
enc/depend
|
@ -3,23 +3,43 @@
|
|||
! encs = encs.sort_by {|e| e.split(/(\d+)/).map {|n| Integer(n) rescue n}}
|
||||
|
||||
VPATH = <% %w[$(arch_hdrdir)/ruby $(hdrdir)/ruby $(top_srcdir) $(srcdir)].join(CONFIG["PATH_SEPARATOR"]) %>
|
||||
LIBPATH = <%libpathflag($DEFLIBPATH)%>
|
||||
|
||||
ENCOBJS = <%encs.map {|e|"#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%"\n" if encs.size>1%>
|
||||
ENCDEFS = <%encs.map {|e|"#{e}.def"}.join(" \\\n\t ") if DEFFILE%><%"\n" if encs.size>1%>
|
||||
ENCSOS = <%encs.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%>
|
||||
|
||||
all: $(ENCSOS)
|
||||
|
||||
.c.$(OBJEXT):
|
||||
! COMPILE_RULES.each do |rule|
|
||||
<% rule % %w[c $(OBJEXT)] %>
|
||||
<%COMPILE_C%>
|
||||
|
||||
! end
|
||||
! unless encs.empty?
|
||||
|
||||
$(ENCOBJS): regenc.h oniguruma.h config.h defines.h
|
||||
|
||||
! end
|
||||
! encs.each do |e|
|
||||
$(ENCSODIR)/<%e%>.$(DLEXT): <%e%>.$(OBJEXT)
|
||||
<%LINK_SO.gsub(/\n/, "\n\t")%>
|
||||
<%e%>.so: $(ENCSODIR)/<%e%>.$(DLEXT)
|
||||
! end
|
||||
|
||||
! end
|
||||
! link_so = LINK_SO.gsub(/\n/, "\n\t")
|
||||
! encs.each do |e|
|
||||
! deps = "#{e}.$(OBJEXT)"
|
||||
! deps << " #{e}-$(arch).def" if DEFFILE
|
||||
$(ENCSODIR)/<%e%>.$(DLEXT): <%deps%>
|
||||
<%link_so.sub(/\$\(OBJS\)/, deps)%>
|
||||
|
||||
! end
|
||||
! if DEFFILE
|
||||
! encs.each do |e|
|
||||
<%e%>-$(arch).def:
|
||||
echo EXPORTS > $@
|
||||
echo <%EXPORT_PREFIX%>Init_<%e.upcase%> >> $@
|
||||
|
||||
! end
|
||||
! end
|
||||
! encs.each do |e|
|
||||
<%e%>.$(OBJEXT): <%e%>.c
|
||||
|
@ -27,6 +47,7 @@ $(ENCSODIR)/<%e%>.$(DLEXT): <%e%>.$(OBJEXT)
|
|||
|
||||
clean:
|
||||
$(RM) $(ENCSOS)
|
||||
$(RM) $(ENCDEFS)
|
||||
$(RM) $(ENCOBJS)
|
||||
|
||||
distclean: clean
|
||||
|
|
|
@ -341,7 +341,7 @@ get_ctype_code_range(int ctype, OnigCodePoint* sb_out,
|
|||
}
|
||||
|
||||
|
||||
OnigEncodingType OnigEncodingEUC_JP = {
|
||||
OnigEncodingDefine(EUC_JP) = {
|
||||
mbc_enc_len,
|
||||
"EUC-JP", /* name */
|
||||
3, /* max enc length */
|
||||
|
|
|
@ -254,7 +254,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_1 = {
|
||||
OnigEncodingDefine(ISO_8859_1) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-1", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -224,7 +224,7 @@ iso_8859_10_get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_10 = {
|
||||
OnigEncodingDefine(ISO_8859_10) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-10", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -76,7 +76,7 @@ iso_8859_11_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding e
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_11 = {
|
||||
OnigEncodingDefine(ISO_8859_11) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-11", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -213,7 +213,7 @@ iso_8859_13_get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_13 = {
|
||||
OnigEncodingDefine(ISO_8859_13) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-13", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -225,7 +225,7 @@ iso_8859_14_get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_14 = {
|
||||
OnigEncodingDefine(ISO_8859_14) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-14", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -219,7 +219,7 @@ iso_8859_15_get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_15 = {
|
||||
OnigEncodingDefine(ISO_8859_15) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-15", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -222,7 +222,7 @@ iso_8859_16_get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_16 = {
|
||||
OnigEncodingDefine(ISO_8859_16) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-16", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -219,7 +219,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_2 = {
|
||||
OnigEncodingDefine(ISO_8859_2) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-2", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -219,7 +219,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_3 = {
|
||||
OnigEncodingDefine(ISO_8859_3) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-3", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -221,7 +221,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_4 = {
|
||||
OnigEncodingDefine(ISO_8859_4) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-4", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -209,7 +209,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_5 = {
|
||||
OnigEncodingDefine(ISO_8859_5) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-5", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -76,7 +76,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_6 = {
|
||||
OnigEncodingDefine(ISO_8859_6) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-6", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -206,7 +206,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
}
|
||||
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_7 = {
|
||||
OnigEncodingDefine(ISO_8859_7) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-7", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -76,7 +76,7 @@ iso_8859_8_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding en
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_8 = {
|
||||
OnigEncodingDefine(ISO_8859_8) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-8", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -213,7 +213,7 @@ iso_8859_9_get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingISO_8859_9 = {
|
||||
OnigEncodingDefine(ISO_8859_9) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ISO-8859-9", /* name */
|
||||
1, /* max enc length */
|
||||
|
|
|
@ -14,11 +14,13 @@ else
|
|||
BUILTIN_ENCS = []
|
||||
end
|
||||
|
||||
DEFFILE = (true if CONFIG["DLDFLAGS"].sub!(/\s+-def:\$\(DEFFILE\)\s+/, ' '))
|
||||
|
||||
mkin = File.read(File.join($srcdir, "Makefile.in"))
|
||||
mkin.gsub!(/@(#{CONFIG.keys.join('|')})@/) {CONFIG[$1]}
|
||||
if File.exist?(depend = File.join($srcdir, "depend"))
|
||||
tmp = ''
|
||||
eval(serb(File.read(depend), 'tmp'))
|
||||
eval(serb(File.read(depend), 'tmp'), binding, depend)
|
||||
mkin << "\n#### depend ####\n\n" << depend_rules(tmp).join
|
||||
end
|
||||
open(ARGV[0], 'wb') {|f|
|
||||
|
|
|
@ -351,7 +351,7 @@ get_ctype_code_range(int ctype, OnigCodePoint* sb_out,
|
|||
}
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingSJIS = {
|
||||
OnigEncodingDefine(SJIS) = {
|
||||
mbc_enc_len,
|
||||
"Shift_JIS", /* name */
|
||||
2, /* max byte length */
|
||||
|
|
|
@ -486,7 +486,7 @@ utf8_get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|||
flag, p, end, items);
|
||||
}
|
||||
|
||||
OnigEncodingType OnigEncodingUTF8 = {
|
||||
OnigEncodingDefine(UTF8) = {
|
||||
utf8_mbc_enc_len,
|
||||
"UTF-8", /* name */
|
||||
6, /* max byte length */
|
||||
|
|
16
regenc.h
16
regenc.h
|
@ -177,5 +177,21 @@ ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];
|
|||
(ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_UPPER) ||\
|
||||
ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_LOWER))
|
||||
|
||||
#ifdef ONIG_ENC_REGISTER
|
||||
extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*);
|
||||
#define OnigEncodingName(n) encoding_##n
|
||||
#define OnigEncodingDeclare(n) static OnigEncodingType OnigEncodingName(n)
|
||||
#define OnigEncodingDefine(n) \
|
||||
OnigEncodingDeclare(n); \
|
||||
void Init_##n(void) { \
|
||||
ONIG_ENC_REGISTER(OnigEncodingName(n).name, \
|
||||
&OnigEncodingName(n)); \
|
||||
} \
|
||||
OnigEncodingDeclare(n)
|
||||
#else
|
||||
#define OnigEncodingName(n) OnigEncoding##n
|
||||
#define OnigEncodingDeclare(n) OnigEncodingType OnigEncodingName(n)
|
||||
#define OnigEncodingDefine(n) OnigEncodingDeclare(n)
|
||||
#endif
|
||||
|
||||
#endif /* REGENC_H */
|
||||
|
|
Загрузка…
Ссылка в новой задаче