Encoding loading

[email protected]$G$9!#e(B

encodinge$B$r<+F0E*$K%m!<%I$9$k$h$&$K$9$k%Q%C%A$G$9!#e(B

e$B$H$j$"$($:e(B enc/ENCODING
e$B$H$$$&%i%$%V%i%j$re(Brequiree$B$9$k$h$&$K$J$Ce(B
e$B$F$$$^$9!#e(Bwin32e$B7O$OL$BP1~$G$9$,!#e(B

Index: configure.in

— configure.in (revision 14234)
+++ configure.in (working copy)
@@ -1204,4 +1247,5 @@ AC_DEFINE_UNQUOTED(DLEXT_MAXLEN, `expr $
test “.$DLEXT” = “.” || AC_DEFINE_UNQUOTED(DLEXT, “.$DLEXT”)
test “.$DLEXT2” = “.” || AC_DEFINE_UNQUOTED(DLEXT2, “.$DLEXT2”)
+AC_SUBST(DLEXT)

AC_SUBST(STRIP)dnl
@@ -1579,5 +1630,5 @@ 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)
@@ -1735,5 +1786,34 @@ fi
tr -d ‘\015’ < largefile.h > confdefs.h

+test -d enc || mkdir enc
+BUILTIN_ENCS=‘ascii euc_jp sjis unicode utf8’
+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
    Index: common.mk
    ===================================================================
    — common.mk (revision 14234)
    +++ common.mk (working copy)
    @@ -19,10 +19,4 @@ RDOCOUT = $(EXTOUT)/rdoc
    DLDOBJS = $(DMYEXT)

-ENCOBJS = ascii.$(OBJEXT) \

  • euc_jp.$(OBJEXT) \
  • sjis.$(OBJEXT) \
  • unicode.$(OBJEXT) \
  • utf8.$(OBJEXT)

COMMONOBJS = array.$(OBJEXT)
bignum.$(OBJEXT)
@@ -80,5 +73,5 @@ COMMONOBJS = array.$(OBJEXT)
cont.$(OBJEXT)
id.$(OBJEXT) \

  • $(ENCOBJS) \
  • $(BUILTIN_ENCOBJS)
    $(MISSING)

Index: Makefile.in

— Makefile.in (revision 14234)
+++ Makefile.in (working copy)
@@ -52,4 +52,5 @@ SOLIBS = @SOLIBS@
MAINLIBS = @MAINLIBS@
MINIOBJS = @MINIOBJS@ miniprelude.$(OBJEXT)
+BUILTIN_ENCOBJS = @BUILTIN_ENCOBJS@

[email protected][email protected]
@@ -94,4 +95,5 @@ ASFLAGS = @ASFLAGS@
OBJEXT = @OBJEXT@
ASMEXT = S
+DLEXT = @DLEXT@
MANTYPE = @MANTYPE@

Index: enc/Makefile.in

— enc/Makefile.in (revision 0)
+++ enc/Makefile.in (revision 0)
@@ -0,0 +1,29 @@
+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@
+
+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 $<
    Index: encoding.c
    ===================================================================
    — encoding.c (revision 14234)
    +++ encoding.c (working copy)
    @@ -156,5 +156,5 @@ enc_register(const char *name, rb_encodi

static VALUE enc_based_encoding(VALUE);
-#define rb_enc_registered(name) rb_enc_find_index(name)
+int rb_enc_registered(const char *name);

int
@@ -253,5 +253,5 @@ rb_enc_from_index(int index)

int
-rb_enc_find_index(const char *name)
+rb_enc_registered(const char *name)
{
int i;
@@ -279,4 +279,24 @@ rb_enc_find_index(const char *name)
}

+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)

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:32606] encoding loading”
on Sat, 15 Dec 2007 13:11:43 +0900, Nobuyoshi N.
[email protected] writes:

|encodinge$B$r<+F0E*$K%m!<%I$9$k$h$&$K$9$k%Q%C%A$G$9!#e(B
|
|e$B$H$j$"$($:e(B enc/ENCODING e$B$H$$$&%i%$%V%i%j$re(Brequiree$B$9$k$h$&$K$J$Ce(B
|e$B$F$$$^$9!#e(Bwin32e$B7O$OL$BP1~$G$9$,!#e(B

e$B$$$:$l$K$7$F$bI,MW$G$9$+$i%3%_%C%H$7$F$/[email protected]$5$$!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs