diff --git a/ChangeLog b/ChangeLog index c82982c187..dcafaf5687 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +Mon Aug 25 00:52:31 2008 Tanaka Akira + + * configure.in (BUILTIN_TRANSSRCS): defined. + (BUILTIN_TRANSOBJS): defined. + + * enc/Makefile.in (BUILTIN_TRANSES): defined. + + * enc/make_encmake.rb (BUILTIN_TRANSES): defined. + + * enc/depend: don't generate rules for builtin transcoders. + + * common.mk (COMMONOBJS): add BUILTIN_TRANSOBJS. + (enc.mk): pass BUILTIN_TRANSOBJS. + (newline.c): new rule. + (newline.$(OBJEXT)): new ru.e + (srcs): newline.c added. + + * Makefile.in (BUILTIN_TRANSSRCS): defined. + (BUILTIN_TRANSOBJS): defined. + + * transcode.c (Init_transcode): call Init_newline. + Mon Aug 25 00:11:02 2008 Tanaka Akira * transcode.c (declare_transcoder): arguments order changed. diff --git a/Makefile.in b/Makefile.in index fc723b6ea2..8b4ad30549 100644 --- a/Makefile.in +++ b/Makefile.in @@ -57,6 +57,8 @@ SOLIBS = @SOLIBS@ MAINLIBS = @MAINLIBS@ ARCHMINIOBJS = @MINIOBJS@ BUILTIN_ENCOBJS = @BUILTIN_ENCOBJS@ +BUILTIN_TRANSSRCS = @BUILTIN_TRANSSRCS@ +BUILTIN_TRANSOBJS = @BUILTIN_TRANSOBJS@ RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@ RUBY_SO_NAME=@RUBY_SO_NAME@ diff --git a/common.mk b/common.mk index ec29affccd..c8d243ce05 100644 --- a/common.mk +++ b/common.mk @@ -81,6 +81,7 @@ COMMONOBJS = array.$(OBJEXT) \ thread.$(OBJEXT) \ cont.$(OBJEXT) \ $(BUILTIN_ENCOBJS) \ + $(BUILTIN_TRANSOBJS) \ $(MISSING) OBJS = dln.$(OBJEXT) \ @@ -381,7 +382,7 @@ encs: enc.mk $(LIBRUBY) $(PREP) transdb.h enc.mk: $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \ $(srcdir)/lib/mkmf.rb $(RBCONFIG) - $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" $@ $(ENCS) + $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" --builtin-transes="$(BUILTIN_TRANSOBJS)" $@ $(ENCS) .PRECIOUS: $(MKFILES) @@ -661,6 +662,10 @@ unicode.$(OBJEXT): {$(VPATH)}unicode.c {$(VPATH)}regint.h \ utf_8.$(OBJEXT): {$(VPATH)}utf_8.c {$(VPATH)}regenc.h {$(VPATH)}config.h \ {$(VPATH)}defines.h {$(VPATH)}oniguruma.h +newline.c: $(srcdir)/enc/trans/newline.trans $(srcdir)/tool/transcode-tblgen.rb +newline.$(OBJEXT): {$(VPATH)}newline.c {$(VPATH)}defines.h {$(VPATH)}intern.h \ + {$(VPATH)}missing.h {$(VPATH)}st.h {$(VPATH)}transcode_data.h + INSNS = opt_sc.inc optinsn.inc optunifs.inc insns.inc insns_info.inc \ vmtc.inc vm.inc @@ -686,7 +691,7 @@ vmtc.inc: $(srcdir)/template/vmtc.inc.tmpl vm.inc: $(srcdir)/template/vm.inc.tmpl -srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c $(srcdir)/ext/ripper/ripper.c srcs-enc +srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}newline.c $(srcdir)/ext/ripper/ripper.c srcs-enc srcs-enc: enc.mk $(MAKE) -f enc.mk RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(MFLAGS) srcs @@ -715,6 +720,9 @@ prelude.c: $(srcdir)/tool/compile_prelude.rb $(RBCONFIG) $(PRELUDE_SCRIPTS) $(PR golf_prelude.c: $(srcdir)/tool/compile_prelude.rb $(RBCONFIG) $(srcdir)/prelude.rb $(srcdir)/golf_prelude.rb $(PREP) $(COMPILE_PRELUDE) $(srcdir)/golf_prelude.rb $@ +newline.c: + $(BASERUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo newline.c $(srcdir)/enc/trans/newline.trans + prereq: incs srcs preludes preludes: {$(VPATH)}miniprelude.c diff --git a/configure.in b/configure.in index 131cfddd44..26c2e00aca 100644 --- a/configure.in +++ b/configure.in @@ -2088,6 +2088,18 @@ BUILTIN_ENCOBJS= for e in $BUILTIN_ENCS; do BUILTIN_ENCOBJS="$BUILTIN_ENCOBJS `basename $e .c`"'.$(OBJEXT)'; done AC_SUBST(BUILTIN_ENCOBJS) +BUILTIN_TRANSES=["`sed -n -e '/^BUILTIN_TRANSES[ ]*=/{' \ + -e s/// -e :l -e '/\\\\$/N' -e 's/\\\\\\n/ /' -e 't l' -e p \ + -e '}' "${srcdir}/enc/Makefile.in"`"] +BUILTIN_TRANSSRCS= +BUILTIN_TRANSOBJS= +for e in $BUILTIN_TRANSES; do + BUILTIN_TRANSSRCS="$BUILTIN_TRANSSRCS `basename $e .trans`"'.c'; + BUILTIN_TRANSOBJS="$BUILTIN_TRANSOBJS `basename $e .trans`"'.$(OBJEXT)'; +done +AC_SUBST(BUILTIN_TRANSSRCS) +AC_SUBST(BUILTIN_TRANSOBJS) + AC_CONFIG_FILES($FIRSTMAKEFILE) AC_CONFIG_FILES(Makefile, [{ sed '/^MISSING/s/\$U\././g' Makefile diff --git a/enc/Makefile.in b/enc/Makefile.in index 460ec320df..b7762191c4 100644 --- a/enc/Makefile.in +++ b/enc/Makefile.in @@ -17,6 +17,8 @@ OBJEXT = @OBJEXT@ BUILTIN_ENCS = ascii.c us_ascii.c\ unicode.c utf_8.c +BUILTIN_TRANSES = newline.trans + RUBY_SO_NAME = @RUBY_SO_NAME@ LIBRUBY = @LIBRUBY@ LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@ diff --git a/enc/depend b/enc/depend index fd4423ebc3..2e448d3b1a 100644 --- a/enc/depend +++ b/enc/depend @@ -17,6 +17,8 @@ % end % } % } +% trans -= BUILTIN_TRANSES +% atrans -= BUILTIN_TRANSES % trans.uniq! % atrans = atrans.sort_by(&alphanumeric_order) % trans = trans.sort_by(&alphanumeric_order) diff --git a/enc/make_encmake.rb b/enc/make_encmake.rb index f8c7735047..107a387571 100644 --- a/enc/make_encmake.rb +++ b/enc/make_encmake.rb @@ -12,6 +12,7 @@ require 'erb' CONFIG["MAKEDIRS"] ||= '@$(MINIRUBY) -run -e mkdir -- -p' BUILTIN_ENCS = [] +BUILTIN_TRANSES = [] ENC_PATTERNS = [] NOENC_PATTERNS = [] @@ -20,6 +21,9 @@ until ARGV.empty? when /\A--builtin-encs=/ BUILTIN_ENCS.concat $'.split.map {|e| File.basename(e, '.*') << '.c'} ARGV.shift + when /\A--builtin-transes=/ + BUILTIN_TRANSES.concat $'.split.map {|e| File.basename(e, '.*') } + ARGV.shift when /\A--encs=/ ENC_PATTERNS.concat $'.split ARGV.shift diff --git a/transcode.c b/transcode.c index 4e53d10dac..7fb5cb9244 100644 --- a/transcode.c +++ b/transcode.c @@ -2424,6 +2424,8 @@ ecerr_error_bytes(VALUE self) return rb_attr_get(self, rb_intern("error_bytes")); } +extern void Init_newline(void); + void Init_transcode(void) { @@ -2470,4 +2472,6 @@ Init_transcode(void) rb_define_method(rb_eInvalidByteSequence, "source_encoding", ecerr_source_encoding, 0); rb_define_method(rb_eInvalidByteSequence, "destination_encoding", ecerr_destination_encoding, 0); rb_define_method(rb_eInvalidByteSequence, "error_bytes", ecerr_error_bytes, 0); + + Init_newline(); }