зеркало из https://github.com/github/ruby.git
* configure.in (enc/Makefile): add external encoding objects list.
* common.mk (BUILTIN_ENCOBJS): renamed from ENCOBJS. * Makefile.in (BUILTIN_ENCOBJS): substitued by autoconf. * enc/Makefile.in: new file to compile external encoding sources. * encoding.c (rb_enc_find_index): auto-load external encoding objects as "ext/ENCODING_NAME". [ruby-dev:32606] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c5851d1d69
Коммит
f2bd108d8d
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
Sat Dec 15 18:56:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in (enc/Makefile): add external encoding objects list.
|
||||
|
||||
* common.mk (BUILTIN_ENCOBJS): renamed from ENCOBJS.
|
||||
|
||||
* Makefile.in (BUILTIN_ENCOBJS): substitued by autoconf.
|
||||
|
||||
* enc/Makefile.in: new file to compile external encoding sources.
|
||||
|
||||
* encoding.c (rb_enc_find_index): auto-load external encoding objects
|
||||
as "ext/ENCODING_NAME". [ruby-dev:32606]
|
||||
|
||||
Sat Dec 15 13:04:30 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* vm_core.h (rb_thread_t): new member machine_stack_maxsize and
|
||||
|
|
|
@ -51,6 +51,7 @@ DLDFLAGS = @LIBRUBY_DLDFLAGS@ $(EXTLDFLAGS) @ARCH_FLAG@
|
|||
SOLIBS = @SOLIBS@
|
||||
MAINLIBS = @MAINLIBS@
|
||||
MINIOBJS = @MINIOBJS@ miniprelude.$(OBJEXT)
|
||||
BUILTIN_ENCOBJS = @BUILTIN_ENCOBJS@
|
||||
|
||||
RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@
|
||||
RUBY_SO_NAME=@RUBY_SO_NAME@
|
||||
|
@ -93,6 +94,7 @@ ASFLAGS = @ASFLAGS@
|
|||
|
||||
OBJEXT = @OBJEXT@
|
||||
ASMEXT = S
|
||||
DLEXT = @DLEXT@
|
||||
MANTYPE = @MANTYPE@
|
||||
|
||||
INSTALLED_LIST= .installed.list
|
||||
|
|
|
@ -18,12 +18,6 @@ MAINOBJ = main.$(OBJEXT)
|
|||
EXTOBJS =
|
||||
DLDOBJS = $(DMYEXT)
|
||||
|
||||
ENCOBJS = ascii.$(OBJEXT) \
|
||||
euc_jp.$(OBJEXT) \
|
||||
sjis.$(OBJEXT) \
|
||||
unicode.$(OBJEXT) \
|
||||
utf8.$(OBJEXT)
|
||||
|
||||
COMMONOBJS = array.$(OBJEXT) \
|
||||
bignum.$(OBJEXT) \
|
||||
class.$(OBJEXT) \
|
||||
|
@ -79,7 +73,7 @@ COMMONOBJS = array.$(OBJEXT) \
|
|||
thread.$(OBJEXT) \
|
||||
cont.$(OBJEXT) \
|
||||
id.$(OBJEXT) \
|
||||
$(ENCOBJS) \
|
||||
$(BUILTIN_ENCOBJS) \
|
||||
$(MISSING)
|
||||
|
||||
OBJS = dln.$(OBJEXT) \
|
||||
|
|
33
configure.in
33
configure.in
|
@ -1203,6 +1203,7 @@ n=`expr "$DLEXT2" : '.*'`; test "$n" -gt "$len" && len=$n
|
|||
AC_DEFINE_UNQUOTED(DLEXT_MAXLEN, `expr $len + 1`)
|
||||
test ".$DLEXT" = "." || AC_DEFINE_UNQUOTED(DLEXT, ".$DLEXT")
|
||||
test ".$DLEXT2" = "." || AC_DEFINE_UNQUOTED(DLEXT2, ".$DLEXT2")
|
||||
AC_SUBST(DLEXT)
|
||||
|
||||
AC_SUBST(STRIP)dnl
|
||||
if test "$with_dln_a_out" = yes; then
|
||||
|
@ -1578,7 +1579,7 @@ AC_SUBST(EXPORT_PREFIX)
|
|||
AC_SUBST(MINIOBJS)
|
||||
AC_SUBST(THREAD_MODEL)
|
||||
|
||||
MAKEFILES="Makefile `echo $FIRSTMAKEFILE | sed 's/:.*//'`"
|
||||
MAKEFILES="Makefile `echo $FIRSTMAKEFILE | sed 's/:.*//'` enc/GNUmakefile"
|
||||
MAKEFILES="`echo $MAKEFILES`"
|
||||
AC_SUBST(MAKEFILES)
|
||||
|
||||
|
@ -1734,7 +1735,37 @@ else
|
|||
fi
|
||||
tr -d '\015' < largefile.h > confdefs.h
|
||||
|
||||
test -d enc || mkdir enc
|
||||
BUILTIN_ENCS="`sed -n '/^BUILTIN_ENCS[ ]*=/{s///;:l;/\\\\$/N;s/\\\\\\n/ /;t l;p}' \"${srcdir}/enc/Makefile.in\"`"
|
||||
BUILTIN_ENCS="`echo $BUILTIN_ENCS`"
|
||||
EXTERNAL_ENCS=
|
||||
for e in "${srcdir}/enc"/*.c; do
|
||||
e=`basename "$e" .c`
|
||||
case " $BUILTIN_ENCS " in
|
||||
*" $e "*) ;;
|
||||
*) EXTERNAL_ENCS="$EXTERNAL_ENCS $e";;
|
||||
esac
|
||||
done
|
||||
echo $EX
|
||||
BUILTIN_ENCOBJS=
|
||||
for e in $BUILTIN_ENCS; do BUILTIN_ENCOBJS="$BUILTIN_ENCOBJS $e"'.$(OBJEXT)'; done
|
||||
EXTERNAL_ENCOBJS=
|
||||
for e in $EXTERNAL_ENCS; do EXTERNAL_ENCOBJS="$EXTERNAL_ENCOBJS $e"'.$(OBJEXT)'; done
|
||||
ENCSOS=
|
||||
for e in $EXTERNAL_ENCS; do ENCSOS="$ENCSOS "'$(ENCSODIR)/'"$e"'.$(DLEXT)'; done
|
||||
|
||||
AC_SUBST(BUILTIN_ENCOBJS)
|
||||
AC_SUBST(EXTERNAL_ENCOBJS)
|
||||
AC_SUBST(ENCSOS)
|
||||
|
||||
AC_CONFIG_FILES($FIRSTMAKEFILE)
|
||||
AC_CONFIG_FILES(enc/Makefile, [{
|
||||
for e in $ENCS; do
|
||||
echo ''
|
||||
echo '$(ENCSODIR)/'"$e"'.$(DLEXT): '"$e"'.$(OBJEXT)'
|
||||
echo ' $(LDSHARED) $(DLDFLAGS) $< $(OUTFLAG)$''@'
|
||||
done >> enc/Makefile
|
||||
}], [ENCS="$EXTERNAL_ENCS"])
|
||||
AC_CONFIG_FILES(Makefile, [{
|
||||
sed '/^MISSING/s/\$U\././g' Makefile
|
||||
echo; test x"$EXEEXT" = x || echo 'miniruby: miniruby$(EXEEXT)'
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
srcdir = @srcdir@
|
||||
top_srcdir = $(srcdir:/enc=)
|
||||
arch = @arch@
|
||||
EXTOUT = $(top_srcdir)/@EXTOUT@
|
||||
hdrdir = $(top_srcdir)/include
|
||||
arch_hdrdir = $(EXTOUT)/include/$(arch)
|
||||
VPATH = $(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(top_srcdir):$(srcdir)
|
||||
ENCSODIR = $(EXTOUT)/$(arch)/enc
|
||||
DLEXT = @DLEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
|
||||
BUILTIN_ENCS = ascii \
|
||||
euc_jp sjis \
|
||||
unicode utf8
|
||||
|
||||
ENCOBJS = @EXTERNAL_ENCOBJS@
|
||||
ENCSOS = @ENCSOS@
|
||||
empty =
|
||||
CC = @CC@
|
||||
OUTFLAG = @OUTFLAG@$(empty)
|
||||
CFLAGS = @CFLAGS@ @ARCH_FLAG@
|
||||
XCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(top_srcdir) @XCFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
|
||||
XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS)
|
||||
LIBS = @LIBS@ $(EXTLIBS)
|
||||
LDSHARED = @LDSHARED@
|
||||
DLDFLAGS = @DLDFLAGS@ $(EXTLDFLAGS) @ARCH_FLAG@
|
||||
|
||||
all: $(ENCOBJS) $(ENCSOS)
|
||||
|
||||
.c.@OBJEXT@:
|
||||
$(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -c $<
|
24
encoding.c
24
encoding.c
|
@ -155,7 +155,7 @@ enc_register(const char *name, rb_encoding *encoding)
|
|||
}
|
||||
|
||||
static VALUE enc_based_encoding(VALUE);
|
||||
#define rb_enc_registered(name) rb_enc_find_index(name)
|
||||
int rb_enc_registered(const char *name);
|
||||
|
||||
int
|
||||
rb_enc_register(const char *name, rb_encoding *encoding)
|
||||
|
@ -252,7 +252,7 @@ rb_enc_from_index(int index)
|
|||
}
|
||||
|
||||
int
|
||||
rb_enc_find_index(const char *name)
|
||||
rb_enc_registered(const char *name)
|
||||
{
|
||||
int i;
|
||||
st_data_t alias = 0;
|
||||
|
@ -278,6 +278,26 @@ rb_enc_find_index(const char *name)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
require_enc(VALUE enclib)
|
||||
{
|
||||
return rb_require_safe(enclib, rb_safe_level());
|
||||
}
|
||||
|
||||
int
|
||||
rb_enc_find_index(const char *name)
|
||||
{
|
||||
int i = rb_enc_registered(name);
|
||||
if (i < 0) {
|
||||
VALUE enclib = rb_sprintf("enc/%s", name);
|
||||
OBJ_FREEZE(enclib);
|
||||
if (RTEST(rb_protect(require_enc, enclib, 0)))
|
||||
i = rb_enc_registered(name);
|
||||
rb_set_errinfo(Qnil);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
rb_encoding *
|
||||
rb_enc_find(const char *name)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче