2000-05-09

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-05-09 04:53:16 +00:00
parent 2a34f89e35
commit 655e96fa59
40 changed files with 514 additions and 347 deletions

View File

@ -1,3 +1,65 @@
Mon May 8 23:47:39 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
* eval.c (rb_callcc): prev & next should be initialized to zero.
Mon May 8 23:17:36 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* dln.c (dln_init): remove possible buffer overrun. This is
suggested by Aleksi Niemela <aleksi.niemela@cinnober.com>
* dln.c (init_funcname): ditto.
Sat May 6 23:35:47 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* parse.y (lhs): should allow `obj.Attr = 5' type expression.
Sat May 6 15:46:08 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* ext/socket/extconf.rb: add a new configure option to force use
of the WIDE Project's getaddrinfo(): --enbale-wide-getaddrinfo.
Fri May 5 21:19:22 2000 MOROHOSHI Akihiko <moro@remus.dti.ne.jp>
* parse.y (yylex): allow '$1foo' and such.
Fri May 5 03:25:15 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* regex.c (re_compile_fastmap): charset_not for multibyte
characters excluded too many characters.
Tue May 2 13:23:43 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (rb_thread_schedule): little bit more impartial context
switching.
Tue May 2 09:50:03 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
* configure.in: add DLDLIBS to set platform specific library
for extensions.
* ext/extmk.rb.in: use @DLDLIBS@ instead of RUBY_PLATFORM choice.
* lib/mkmf.rb: use CONFIG["DLDLIBS"] instead of RUBY_PLATFORM choice.
* config_s.dj: add @DLDLIBS@.
* win32/config.status: ditto.
* win32/ruby.def: regular maintenance.
Mon May 1 23:42:44 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* configure.in, eval.c: add DLEXT2. now DLEXT on Cygwin is "so".
* defines.h: use dllimport, dllexport for Cygwin 1.1.x.
* ruby.h: ditto.
* cygwin/GNUmakefile.in: ditto.
* ext/Win32API/Win32API.c: directly "call" in asm statement for
gcc 2.95.x or newer.
Sat Apr 29 04:58:12 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp> Sat Apr 29 04:58:12 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* array.c (rb_ary_unshift_m): performance improvement. * array.c (rb_ary_unshift_m): performance improvement.

View File

@ -81,7 +81,7 @@ OBJS = array.@OBJEXT@ \
version.@OBJEXT@ \ version.@OBJEXT@ \
$(MISSING) $(MISSING)
all: miniruby$(EXEEXT) @PREP@ rbconfig.rb all: miniruby$(EXEEXT) @PREP@ rbconfig.rb $(LIBRUBY)
@@MINIRUBY@ -Xext extmk.rb @EXTSTATIC@ @@MINIRUBY@ -Xext extmk.rb @EXTSTATIC@
miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) dmyext.@OBJEXT@ miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) dmyext.@OBJEXT@

View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

View File

@ -51,6 +51,7 @@ s%@LIBRUBY_A@%libruby.a%g
s%@LIBRUBYARG@%libruby.a%g s%@LIBRUBYARG@%libruby.a%g
s%@LIBRUBY_SO@%%g s%@LIBRUBY_SO@%%g
s%@SOLIBS@%%g s%@SOLIBS@%%g
s%@DLDLIBS@%%g
s%@srcdir%.%g s%@srcdir%.%g
s%@arch@%i386-djgpp%g s%@arch@%i386-djgpp%g
s%@sitedir@%${prefix}/lib/ruby/site_ruby%g s%@sitedir@%${prefix}/lib/ruby/site_ruby%g

52
configure vendored
View File

@ -4529,6 +4529,16 @@ EOF
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define DLEXT ".dll" #define DLEXT ".dll"
EOF EOF
;;
cygwin*) DLEXT=so
cat >> confdefs.h <<\EOF
#define DLEXT ".so"
EOF
DLEXT2=dll
cat >> confdefs.h <<\EOF
#define DLEXT2 ".dll"
EOF
;; ;;
*) DLEXT=so *) DLEXT=so
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
@ -4572,7 +4582,7 @@ fi
case "$target_os" in case "$target_os" in
human*) human*)
echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6 echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6
echo "configure:4576: checking for _harderr in -lsignal" >&5 echo "configure:4586: checking for _harderr in -lsignal" >&5
ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'` ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -4580,7 +4590,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lsignal $LIBS" LIBS="-lsignal $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4584 "configure" #line 4594 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -4591,7 +4601,7 @@ int main() {
_harderr() _harderr()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:4595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:4605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -4619,7 +4629,7 @@ else
fi fi
echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6 echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6
echo "configure:4623: checking for hmemset in -lhmem" >&5 echo "configure:4633: checking for hmemset in -lhmem" >&5
ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'` ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -4627,7 +4637,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lhmem $LIBS" LIBS="-lhmem $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4631 "configure" #line 4641 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -4638,7 +4648,7 @@ int main() {
hmemset() hmemset()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:4642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:4652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -4668,12 +4678,12 @@ fi
for ac_func in select gettimeofday for ac_func in select gettimeofday
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:4672: checking for $ac_func" >&5 echo "configure:4682: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4677 "configure" #line 4687 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -4696,7 +4706,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:4700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:4710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -4721,7 +4731,7 @@ fi
done done
echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6 echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6
echo "configure:4725: checking whether PD libc _dtos18 fail to convert big number" >&5 echo "configure:4735: checking whether PD libc _dtos18 fail to convert big number" >&5
if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -4729,7 +4739,7 @@ else
rb_cv_missing__dtos18=no rb_cv_missing__dtos18=no
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4733 "configure" #line 4743 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
@ -4741,7 +4751,7 @@ main ()
} }
EOF EOF
if { (eval echo configure:4745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:4755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
rb_cv_missing__dtos18=yes rb_cv_missing__dtos18=yes
else else
@ -4763,7 +4773,7 @@ EOF
fi fi
echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6 echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6
echo "configure:4767: checking whether PD libc fconvert fail to round" >&5 echo "configure:4777: checking whether PD libc fconvert fail to round" >&5
if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -4771,7 +4781,7 @@ else
rb_cv_missing_fconvert=no rb_cv_missing_fconvert=no
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4775 "configure" #line 4785 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
@ -4784,7 +4794,7 @@ main ()
} }
EOF EOF
if { (eval echo configure:4788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:4798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
rb_cv_missing_fconvert=yes rb_cv_missing_fconvert=yes
else else
@ -4869,6 +4879,15 @@ if test "$target_os" = "beos"; then
esac esac
fi fi
case "$target_os" in
cygwin*|beos*|openstep*|nextstep*|rhapsody*|macos*|os2_emx*)
DLDLIBS=""
;;
*)
DLDLIBS="-lc"
;;
esac
LIBRUBY_LDSHARED=$LDSHARED LIBRUBY_LDSHARED=$LDSHARED
LIBRUBY_DLDFLAGS=$DLDFLAGS LIBRUBY_DLDFLAGS=$DLDFLAGS
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR).$(TEENY)' LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR).$(TEENY)'
@ -4981,6 +5000,7 @@ esac
ri_prefix= ri_prefix=
test "$program_prefix" != NONE && test "$program_prefix" != NONE &&
ri_prefix=$program_prefix ri_prefix=$program_prefix
@ -5250,6 +5270,7 @@ s%@STATIC@%$STATIC%g
s%@CCDLFLAGS@%$CCDLFLAGS%g s%@CCDLFLAGS@%$CCDLFLAGS%g
s%@LDSHARED@%$LDSHARED%g s%@LDSHARED@%$LDSHARED%g
s%@DLEXT@%$DLEXT%g s%@DLEXT@%$DLEXT%g
s%@DLEXT2@%$DLEXT2%g
s%@STRIP@%$STRIP%g s%@STRIP@%$STRIP%g
s%@EXTSTATIC@%$EXTSTATIC%g s%@EXTSTATIC@%$EXTSTATIC%g
s%@setup@%$setup%g s%@setup@%$setup%g
@ -5264,6 +5285,7 @@ s%@LIBRUBY_ALIASES@%$LIBRUBY_ALIASES%g
s%@LIBRUBY@%$LIBRUBY%g s%@LIBRUBY@%$LIBRUBY%g
s%@LIBRUBYARG@%$LIBRUBYARG%g s%@LIBRUBYARG@%$LIBRUBYARG%g
s%@SOLIBS@%$SOLIBS%g s%@SOLIBS@%$SOLIBS%g
s%@DLDLIBS@%$DLDLIBS%g
s%@arch@%$arch%g s%@arch@%$arch%g
s%@sitedir@%$sitedir%g s%@sitedir@%$sitedir%g
s%@configure_args@%$configure_args%g s%@configure_args@%$configure_args%g

View File

@ -403,6 +403,7 @@ AC_SUBST(STATIC)dnl
AC_SUBST(CCDLFLAGS)dnl AC_SUBST(CCDLFLAGS)dnl
AC_SUBST(LDSHARED)dnl AC_SUBST(LDSHARED)dnl
AC_SUBST(DLEXT)dnl AC_SUBST(DLEXT)dnl
AC_SUBST(DLEXT2)dnl
STATIC= STATIC=
@ -569,6 +570,10 @@ else
AC_DEFINE(DLEXT, ".bundle");; AC_DEFINE(DLEXT, ".bundle");;
os2_emx*) DLEXT=dll os2_emx*) DLEXT=dll
AC_DEFINE(DLEXT, ".dll");; AC_DEFINE(DLEXT, ".dll");;
cygwin*) DLEXT=so
AC_DEFINE(DLEXT, ".so")
DLEXT2=dll
AC_DEFINE(DLEXT2, ".dll");;
*) DLEXT=so *) DLEXT=so
AC_DEFINE(DLEXT, ".so");; AC_DEFINE(DLEXT, ".so");;
esac esac
@ -711,6 +716,15 @@ if test "$target_os" = "beos"; then
esac esac
fi fi
case "$target_os" in
cygwin*|beos*|openstep*|nextstep*|rhapsody*|macos*|os2_emx*)
DLDLIBS=""
;;
*)
DLDLIBS="-lc"
;;
esac
LIBRUBY_LDSHARED=$LDSHARED LIBRUBY_LDSHARED=$LDSHARED
LIBRUBY_DLDFLAGS=$DLDFLAGS LIBRUBY_DLDFLAGS=$DLDFLAGS
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR).$(TEENY)' LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR).$(TEENY)'
@ -819,6 +833,7 @@ AC_SUBST(LIBRUBY_ALIASES)
AC_SUBST(LIBRUBY) AC_SUBST(LIBRUBY)
AC_SUBST(LIBRUBYARG) AC_SUBST(LIBRUBYARG)
AC_SUBST(SOLIBS) AC_SUBST(SOLIBS)
AC_SUBST(DLDLIBS)
ri_prefix= ri_prefix=
test "$program_prefix" != NONE && test "$program_prefix" != NONE &&

View File

@ -6,4 +6,3 @@ miniruby$(EXEEXT): $(RUBYCWDLL)
$(RUBYCWDLL): $(OBJS) dmyext.o $(RUBYCWDLL): $(OBJS) dmyext.o
$(LDSHARED) $(DLDFLAGS) -o $(RUBYCWDLL) --output-lib=$(LIBRUBY_SO) --dllname=$(RUBYCWDLL) -Wl,-e,__cygwin_noncygwin_dll_entry@12 --add-stdcall-alias $(OBJS) dmyext.o $(LDSHARED) $(DLDFLAGS) -o $(RUBYCWDLL) --output-lib=$(LIBRUBY_SO) --dllname=$(RUBYCWDLL) -Wl,-e,__cygwin_noncygwin_dll_entry@12 --add-stdcall-alias $(OBJS) dmyext.o
@NM@ --extern-only $(OBJS) dmyext.o | sed -n '/^........ [CD] _\(.*\)$$/s//#define \1 (*__imp_\1)/p' >import.h

View File

@ -34,6 +34,14 @@
#include "win32/win32.h" #include "win32/win32.h"
#endif #endif
#if defined __CYGWIN__
# if defined USEIMPORTLIB
# define EXTERN extern __declspec(dllimport)
# else
# define EXTERN extern __declspec(dllexport)
# endif
#endif
#ifndef EXTERN #ifndef EXTERN
#define EXTERN extern #define EXTERN extern
#endif #endif
@ -62,7 +70,7 @@
#undef HAVE_SETITIMER #undef HAVE_SETITIMER
#endif #endif
#if defined(__CYGWIN__) || defined(DJGPP) || defined(__BOW__) #if defined(DJGPP) || defined(__BOW__)
#undef HAVE_SETITIMER #undef HAVE_SETITIMER
#endif #endif

2
dir.c
View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

12
dln.c
View File

@ -98,7 +98,7 @@ init_funcname(buf, file)
if (*p == '/') slash = p; if (*p == '/') slash = p;
#endif #endif
sprintf(buf, FUNCNAME_PATTERN, slash + 1); snprintf(buf, MAXPATHLEN, FUNCNAME_PATTERN, slash + 1);
for (p = buf; *p; p++) { /* Delete suffix if it exists */ for (p = buf; *p; p++) { /* Delete suffix if it exists */
if (*p == '.') { if (*p == '.') {
*p = '\0'; break; *p = '\0'; break;
@ -367,6 +367,10 @@ dln_init(prog)
while (read(fd, p, 1) == 1) { while (read(fd, p, 1) == 1) {
if (*p == '\n' || *p == '\t' || *p == ' ') break; if (*p == '\n' || *p == '\t' || *p == ' ') break;
p++; p++;
if (p-buf >= MAXPATHLEN) {
dln_errno = ENAMETOOLONG;
return -1;
}
} }
*p = '\0'; *p = '\0';
@ -605,7 +609,7 @@ load_1(fd, disp, need_init)
struct nlist *sym; struct nlist *sym;
struct nlist *end; struct nlist *end;
int init_p = 0; int init_p = 0;
char buf[256]; char buf[MAXPATHLEN];
if (load_header(fd, &hdr, disp) == -1) return -1; if (load_header(fd, &hdr, disp) == -1) return -1;
if (INVALID_OBJECT(hdr)) { if (INVALID_OBJECT(hdr)) {
@ -1181,7 +1185,7 @@ aix_loaderror(const char *pathname)
#define LOAD_ERRTAB_LEN (sizeof(load_errtab)/sizeof(load_errtab[0])) #define LOAD_ERRTAB_LEN (sizeof(load_errtab)/sizeof(load_errtab[0]))
#define ERRBUF_APPEND(s) strncat(errbuf, s, sizeof(errbuf)-strlen(errbuf)-1) #define ERRBUF_APPEND(s) strncat(errbuf, s, sizeof(errbuf)-strlen(errbuf)-1)
sprintf(errbuf, "load failed - %.200s ", pathname); snprintf(errbuf, 1024, "load failed - %.200s ", pathname);
if (!loadquery(1, &message[0], sizeof(message))) if (!loadquery(1, &message[0], sizeof(message)))
ERRBUF_APPEND(strerror(errno)); ERRBUF_APPEND(strerror(errno));
@ -1416,7 +1420,7 @@ dln_load(file)
B_SYMBOL_TYPE_TEXT, (void **)&init_fct); B_SYMBOL_TYPE_TEXT, (void **)&init_fct);
if (err_stat != B_NO_ERROR) { if (err_stat != B_NO_ERROR) {
char real_name[1024]; char real_name[MAXPATHLEN];
strcpy(real_name, buf); strcpy(real_name, buf);
strcat(real_name, "__Fv"); strcat(real_name, "__Fv");
err_stat = get_image_symbol(img_id, real_name, err_stat = get_image_symbol(img_id, real_name,

68
eval.c
View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/
@ -3437,7 +3437,7 @@ massign(self, node, val, check)
list = node->nd_head; list = node->nd_head;
if (TYPE(val) != T_ARRAY) { if (TYPE(val) != T_ARRAY) {
if (NIL_P(val)) if (!check && NIL_P(val))
val = rb_ary_new2(0); val = rb_ary_new2(0);
else else
val = rb_ary_new3(1, val); val = rb_ary_new3(1, val);
@ -4937,13 +4937,25 @@ rb_f_require(obj, fname)
else if (strcmp(".so", ext) == 0 || strcmp(".o", ext) == 0) { else if (strcmp(".so", ext) == 0 || strcmp(".o", ext) == 0) {
file = feature = RSTRING(fname)->ptr; file = feature = RSTRING(fname)->ptr;
if (strcmp(ext, DLEXT) != 0) { if (strcmp(ext, DLEXT) != 0) {
buf = ALLOCA_N(char, strlen(file)+sizeof(DLEXT)+1); buf = ALLOCA_N(char, strlen(file)+sizeof(DLEXT)+4);
strcpy(buf, feature); strcpy(buf, feature);
ext = strrchr(buf, '.'); ext = strrchr(buf, '.');
strcpy(ext, ".so");
if (rb_provided(buf)) return Qfalse;
strcpy(ext, DLEXT); strcpy(ext, DLEXT);
file = feature = buf; file = feature = buf;
if (rb_provided(feature)) return Qfalse;
} }
#ifdef DLEXT2
else if (strcmp(ext, DLEXT2) != 0) {
buf = ALLOCA_N(char, strlen(file)+sizeof(DLEXT2)+4);
strcpy(buf, feature);
ext = strrchr(buf, '.');
strcpy(ext, ".so");
if (rb_provided(buf)) return Qfalse;
strcpy(ext, DLEXT2);
file = feature = buf;
}
#endif
file = rb_find_file(file); file = rb_find_file(file);
if (file) goto load_dyna; if (file) goto load_dyna;
} }
@ -4969,6 +4981,15 @@ rb_f_require(obj, fname)
feature = buf; feature = buf;
goto load_dyna; goto load_dyna;
} }
#ifdef DLEXT2
strcpy(buf, RSTRING(fname)->ptr);
strcat(buf, DLEXT2);
file = rb_find_file(buf);
if (file) {
feature = buf;
goto load_dyna;
}
#endif
rb_raise(rb_eLoadError, "No such file to load -- %s", rb_raise(rb_eLoadError, "No such file to load -- %s",
RSTRING(fname)->ptr); RSTRING(fname)->ptr);
@ -6359,9 +6380,9 @@ thread_free(th)
if (th->stk_ptr) free(th->stk_ptr); if (th->stk_ptr) free(th->stk_ptr);
th->stk_ptr = 0; th->stk_ptr = 0;
if (th->locals) st_free_table(th->locals); if (th->locals) st_free_table(th->locals);
if (th->status != THREAD_KILLED && th->prev) { if (th->status != THREAD_KILLED) {
th->prev->next = th->next; if (th->prev) th->prev->next = th->next;
th->next->prev = th->prev; if (th->next) th->next->prev = th->prev;
} }
if (th != main_thread) free(th); if (th != main_thread) free(th);
} }
@ -6625,14 +6646,6 @@ rb_thread_schedule()
curr = curr->prev; curr = curr->prev;
} }
FOREACH_THREAD_FROM(curr, th) {
if (th->status == THREAD_RUNNABLE || th->status == THREAD_TO_KILL) {
if (!next || next->priority < th->priority)
next = th;
}
}
END_FOREACH_FROM(curr, th);
if (num_waiting_on_join) { if (num_waiting_on_join) {
FOREACH_THREAD_FROM(curr, th) { FOREACH_THREAD_FROM(curr, th) {
if ((th->wait_for&WAIT_JOIN) && rb_thread_dead(th->join)) { if ((th->wait_for&WAIT_JOIN) && rb_thread_dead(th->join)) {
@ -6640,8 +6653,6 @@ rb_thread_schedule()
th->wait_for &= ~WAIT_JOIN; th->wait_for &= ~WAIT_JOIN;
th->status = THREAD_RUNNABLE; th->status = THREAD_RUNNABLE;
num_waiting_on_join--; num_waiting_on_join--;
if (!next || next->priority < th->priority)
next = th;
} }
} }
END_FOREACH_FROM(curr, th); END_FOREACH_FROM(curr, th);
@ -6651,7 +6662,7 @@ rb_thread_schedule()
fd_set readfds; fd_set readfds;
struct timeval delay_tv, *delay_ptr; struct timeval delay_tv, *delay_ptr;
double delay, now; /* OK */ double delay, now; /* OK */
int n, max; int n, max, found;
do { do {
max = 0; max = 0;
@ -6676,8 +6687,7 @@ rb_thread_schedule()
th->wait_for &= ~WAIT_TIME; th->wait_for &= ~WAIT_TIME;
th->status = THREAD_RUNNABLE; th->status = THREAD_RUNNABLE;
num_waiting_on_timer--; num_waiting_on_timer--;
if (!next || next->priority < th->priority) found = 1;
next = th;
} else if (th->delay < delay) { } else if (th->delay < delay) {
delay = th->delay; delay = th->delay;
} }
@ -6686,10 +6696,10 @@ rb_thread_schedule()
END_FOREACH_FROM(curr, th); END_FOREACH_FROM(curr, th);
} }
/* Do the select if needed */ /* Do the select if needed */
if (num_waiting_on_fd > 0 || !next) { if (num_waiting_on_fd > 0 || !found) {
/* Convert delay to a timeval */ /* Convert delay to a timeval */
/* If a thread is runnable, just poll */ /* If a thread is runnable, just poll */
if (next) { if (found) {
delay_tv.tv_sec = 0; delay_tv.tv_sec = 0;
delay_tv.tv_usec = 0; delay_tv.tv_usec = 0;
delay_ptr = &delay_tv; delay_ptr = &delay_tv;
@ -6728,8 +6738,7 @@ rb_thread_schedule()
th->fd = 0; th->fd = 0;
th->wait_for &= ~WAIT_FD; th->wait_for &= ~WAIT_FD;
num_waiting_on_fd--; num_waiting_on_fd--;
if (!next || next->priority < th->priority) found = 1;
next = th; /* Found one. */
} }
} }
END_FOREACH_FROM(curr, th); END_FOREACH_FROM(curr, th);
@ -6737,9 +6746,17 @@ rb_thread_schedule()
} }
/* The delays for some of the threads should have expired. /* The delays for some of the threads should have expired.
Go through the loop once more, to check the delays. */ Go through the loop once more, to check the delays. */
} while (!next && delay != DELAY_INFTY); } while (!found && delay != DELAY_INFTY);
} }
FOREACH_THREAD_FROM(curr, th) {
if (th->status == THREAD_RUNNABLE || th->status == THREAD_TO_KILL) {
if (!next || next->priority < th->priority)
next = th;
}
}
END_FOREACH_FROM(curr, th);
if (!next) { if (!next) {
curr_thread->file = ruby_sourcefile; curr_thread->file = ruby_sourcefile;
curr_thread->line = ruby_sourceline; curr_thread->line = ruby_sourceline;
@ -7765,6 +7782,7 @@ rb_callcc(self)
for (tag=prot_tag; tag; tag=tag->prev) { for (tag=prot_tag; tag; tag=tag->prev) {
scope_dup(tag->scope); scope_dup(tag->scope);
} }
th->prev = th->next = 0;
if (THREAD_SAVE_CONTEXT(th)) { if (THREAD_SAVE_CONTEXT(th)) {
return th->result; return th->result;
} }

View File

@ -132,6 +132,7 @@ Win32API_Call(argc, argv, obj)
VALUE import_type; VALUE import_type;
int nimport, timport, texport, i; int nimport, timport, texport, i;
int items; int items;
int ret;
items = rb_scan_args(argc, argv, "0*", &args); items = rb_scan_args(argc, argv, "0*", &args);
@ -162,7 +163,7 @@ Win32API_Call(argc, argv, obj)
mov eax, lParam mov eax, lParam
push eax push eax
} }
#elif defined(__CYGWIN__) || defined(__MINGW32__) #elif defined __GNUC__
asm volatile ("pushl %0" :: "g" (lParam)); asm volatile ("pushl %0" :: "g" (lParam));
#else #else
#error #error
@ -184,7 +185,7 @@ Win32API_Call(argc, argv, obj)
mov eax, pParam mov eax, pParam
push eax push eax
} }
#elif defined(__CYGWIN__) || defined(__MINGW32__) #elif defined __GNUC__
asm volatile ("pushl %0" :: "g" (pParam)); asm volatile ("pushl %0" :: "g" (pParam));
#else #else
#error #error
@ -194,6 +195,22 @@ Win32API_Call(argc, argv, obj)
} }
} }
#if defined __GNUC__
asm volatile ("call *%1" : "=r" (ret) : "g" (ApiFunction));
switch (texport) {
case _T_NUMBER:
case _T_INTEGER:
Return = INT2NUM(ret);
break;
case _T_POINTER:
Return = rb_str_new2((char *)ret);
break;
case _T_VOID:
default:
Return = INT2NUM(0);
break;
}
#else
switch (texport) { switch (texport) {
case _T_NUMBER: case _T_NUMBER:
ApiFunctionNumber = (ApiNumber *) ApiFunction; ApiFunctionNumber = (ApiNumber *) ApiFunction;
@ -214,6 +231,7 @@ Win32API_Call(argc, argv, obj)
Return = INT2NUM(0); Return = INT2NUM(0);
break; break;
} }
#endif
return Return; return Return;
} }

View File

@ -329,6 +329,11 @@ def create_makefile(target)
$DLDFLAGS = '@DLDFLAGS@' $DLDFLAGS = '@DLDFLAGS@'
if $configure_args['--enable-shared']
$libs = "@LIBRUBYARG@ " + $libs
$DLDFLAGS = $DLDFLAGS + " -L" + $topdir
end
if RUBY_PLATFORM =~ /beos/ and not $static if RUBY_PLATFORM =~ /beos/ and not $static
$libs = $libs + " @LIBRUBYARG@" $libs = $libs + " @LIBRUBYARG@"
$DLDFLAGS = $DLDFLAGS + " -L" + $topdir $DLDFLAGS = $DLDFLAGS + " -L" + $topdir
@ -339,8 +344,6 @@ def create_makefile(target)
if File.exist? target + ".def" if File.exist? target + ".def"
defflag = "--def=" + target + ".def" defflag = "--def=" + target + ".def"
end end
$libs = $libs + " @LIBRUBYARG@"
$DLDFLAGS = $DLDFLAGS + " -L" + $topdir
end end
$srcdir = $top_srcdir + "/ext/" + $mdir $srcdir = $top_srcdir + "/ext/" + $mdir
@ -499,16 +502,11 @@ def extmake(target)
$OBJEXT = "@OBJEXT@" $OBJEXT = "@OBJEXT@"
$LIBEXT = "a" $LIBEXT = "a"
$objs = nil $objs = nil
$libs = "@DLDLIBS@"
$local_flags = "" $local_flags = ""
case RUBY_PLATFORM if /mswin32/ =~ RUBY_PLATFORM
when /cygwin|beos|openstep|nextstep|rhapsody|macos|i386-os2_emx/
$libs = ""
when /mswin32/
$LIBEXT = "lib" $LIBEXT = "lib"
$libs = ""
$local_flags = "$(topdir)/rubymw.lib -link /EXPORT:Init_$(TARGET)" $local_flags = "$(topdir)/rubymw.lib -link /EXPORT:Init_$(TARGET)"
else
$libs = "-lc"
end end
$LOCAL_LIBS = "" # to be assigned in extconf.rb $LOCAL_LIBS = "" # to be assigned in extconf.rb
dir = with_config("opt-dir") dir = with_config("opt-dir")

View File

@ -173,7 +173,7 @@ have_header("netinet/tcp.h")
have_header("netinet/udp.h") have_header("netinet/udp.h")
$getaddr_info_ok = false $getaddr_info_ok = false
if try_run(<<EOF) if not enable_config("wide-getaddrinfo", false) and try_run(<<EOF)
#include <sys/types.h> #include <sys/types.h>
#include <netdb.h> #include <netdb.h>
#include <string.h> #include <string.h>
@ -292,6 +292,22 @@ else
have_header("resolv.h") have_header("resolv.h")
end end
if !try_link(<<EOF)
#include <sys/types.h>
#include <netdb.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
int
main()
{
socklen_t len;
return 0;
}
EOF
$CFLAGS="-Dsocklen_t=int "+$CFLAGS
end
have_header("sys/un.h") have_header("sys/un.h")
if have_func(test_func) if have_func(test_func)

View File

@ -6,6 +6,8 @@
$Date$ $Date$
created at: Thu Mar 31 12:21:29 JST 1994 created at: Thu Mar 31 12:21:29 JST 1994
Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/ ************************************************/
#include "ruby.h" #include "ruby.h"

2
file.c
View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

50
gc.c
View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/
@ -142,36 +142,6 @@ xfree(x)
} }
#endif #endif
/* The way of garbage collecting which allows use of the cstack is due to */
/* Scheme In One Defun, but in C this time.
* COPYRIGHT (c) 1989 BY *
* PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. *
* ALL RIGHTS RESERVED *
Permission to use, copy, modify, distribute and sell this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all copies
and that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Paradigm Associates
Inc not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
PARADIGM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
PARADIGM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
gjc@paradigm.com
Paradigm Associates Inc Phone: 617-492-6079
29 Putnam Ave, Suite 6
Cambridge, MA 02138
*/
extern int ruby_in_compile; extern int ruby_in_compile;
static int dont_gc; static int dont_gc;
static int during_gc; static int during_gc;
@ -351,7 +321,7 @@ VALUE *rb_gc_stack_start = 0;
__inline__ __inline__
#endif #endif
static int static int
looks_pointerp(ptr) is_pointer_to_heap(ptr)
void *ptr; void *ptr;
{ {
register RVALUE *p = RANY(ptr); register RVALUE *p = RANY(ptr);
@ -376,7 +346,7 @@ mark_locations_array(x, n)
register long n; register long n;
{ {
while (n--) { while (n--) {
if (looks_pointerp(*x)) { if (is_pointer_to_heap(*x)) {
rb_gc_mark(*x); rb_gc_mark(*x);
} }
x++; x++;
@ -438,7 +408,7 @@ void
rb_gc_mark_maybe(obj) rb_gc_mark_maybe(obj)
void *obj; void *obj;
{ {
if (looks_pointerp(obj)) { if (is_pointer_to_heap(obj)) {
rb_gc_mark(obj); rb_gc_mark(obj);
} }
} }
@ -585,13 +555,13 @@ rb_gc_mark(ptr)
#endif #endif
default: default:
if (looks_pointerp(obj->as.node.u1.node)) { if (is_pointer_to_heap(obj->as.node.u1.node)) {
rb_gc_mark(obj->as.node.u1.node); rb_gc_mark(obj->as.node.u1.node);
} }
if (looks_pointerp(obj->as.node.u2.node)) { if (is_pointer_to_heap(obj->as.node.u2.node)) {
rb_gc_mark(obj->as.node.u2.node); rb_gc_mark(obj->as.node.u2.node);
} }
if (looks_pointerp(obj->as.node.u3.node)) { if (is_pointer_to_heap(obj->as.node.u3.node)) {
obj = RANY(obj->as.node.u3.node); obj = RANY(obj->as.node.u3.node);
goto Top; goto Top;
} }
@ -684,7 +654,7 @@ rb_gc_mark(ptr)
default: default:
rb_bug("rb_gc_mark(): unknown data type 0x%x(0x%x) %s", rb_bug("rb_gc_mark(): unknown data type 0x%x(0x%x) %s",
obj->as.basic.flags & T_MASK, obj, obj->as.basic.flags & T_MASK, obj,
looks_pointerp(obj)?"corrupted object":"non object"); is_pointer_to_heap(obj)?"corrupted object":"non object");
} }
} }
@ -1220,8 +1190,8 @@ id2ref(obj, id)
if (ptr == Qfalse) return Qfalse; if (ptr == Qfalse) return Qfalse;
if (ptr == Qnil) return Qnil; if (ptr == Qnil) return Qnil;
ptr = id ^ FIXNUM_FLAG; ptr = id ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
if (!looks_pointerp(ptr)) { if (!is_pointer_to_heap(ptr)) {
rb_raise(rb_eRangeError, "0x%x is not id value", ptr); rb_raise(rb_eRangeError, "0x%x is not id value", ptr);
} }
if (BUILTIN_TYPE(ptr) == 0) { if (BUILTIN_TYPE(ptr) == 0) {

2
hash.c
View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

2
io.c
View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

View File

@ -5,10 +5,10 @@ $Date$
cgi.rb cgi.rb
Version 1.20 Version 1.31
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
Wakou Aoyama <wakou@fsinet.or.jp> Wakou Aoyama <wakou@fsinet.or.jp>
@ -108,7 +108,7 @@ and see MAKE COOKIE OBJECT.
=== GET ENVIRONMENT VALUE === GET ENVIRONMENT VALUE
require "CGI" require "cgi"
cgi = CGI.new cgi = CGI.new
value = cgi.auth_type value = cgi.auth_type
# ENV["AUTH_TYPE"] # ENV["AUTH_TYPE"]
@ -141,7 +141,7 @@ HTTP_CACHE_CONTROL HTTP_FROM HTTP_HOST HTTP_NEGOTIATE HTTP_PRAGMA
HTTP_REFERER HTTP_USER_AGENT HTTP_REFERER HTTP_USER_AGENT
=== PRINT HTTP HEADER AND HTML STRING TO $> === PRINT HTTP HEADER AND HTML STRING TO $DEFAULT_OUTPUT ($>)
require "cgi" require "cgi"
cgi = CGI.new("html3") # add HTML generation methods cgi = CGI.new("html3") # add HTML generation methods
@ -176,6 +176,8 @@ HTTP_REFERER HTTP_USER_AGENT
=end =end
require 'English'
class CGI class CGI
CR = "\015" CR = "\015"
@ -183,7 +185,7 @@ class CGI
EOL = CR + LF EOL = CR + LF
v = $-v v = $-v
$-v = false $-v = false
VERSION = "1.20" VERSION = "1.31"
RELEASE_DATE = "$Date$" RELEASE_DATE = "$Date$"
$-v = v $-v = v
@ -223,7 +225,7 @@ $-v = v
end end
def stdoutput def stdoutput
$> $DEFAULT_OUTPUT
end end
private :env_table, :stdinput, :stdoutput private :env_table, :stdinput, :stdoutput
@ -237,10 +239,9 @@ $-v = v
url_encoded_string = CGI::escape("string") url_encoded_string = CGI::escape("string")
=end =end
def CGI::escape(string) def CGI::escape(string)
str = string.dup string.gsub(/ /n, '+').gsub(/([^a-zA-Z0-9_.-])/n) do
str.gsub!(/ /n, '+') sprintf("%%%02X", $1.unpack("C")[0])
str.gsub!(/([^a-zA-Z0-9_.-])/n){ sprintf("%%%02X", $1.unpack("C")[0]) } end
str
end end
@ -249,10 +250,9 @@ $-v = v
string = CGI::unescape("url encoded string") string = CGI::unescape("url encoded string")
=end =end
def CGI::unescape(string) def CGI::unescape(string)
str = string.dup string.gsub(/\+/n, ' ').gsub(/%([0-9a-fA-F]{2})/n) do
str.gsub!(/\+/n, ' ') [$1.hex].pack("c")
str.gsub!(/%([0-9a-fA-F]{2})/n){ [$1.hex].pack("c") } end
str
end end
@ -261,12 +261,7 @@ $-v = v
CGI::escapeHTML("string") CGI::escapeHTML("string")
=end =end
def CGI::escapeHTML(string) def CGI::escapeHTML(string)
str = string.dup string.gsub(/&/n, '&amp;').gsub(/\"/n, '&quot;').gsub(/>/n, '&gt;').gsub(/</n, '&lt;')
str.gsub!(/&/n, '&amp;')
str.gsub!(/\"/n, '&quot;')
str.gsub!(/>/n, '&gt;')
str.gsub!(/</n, '&lt;')
str
end end
@ -275,8 +270,7 @@ $-v = v
CGI::unescapeHTML("HTML escaped string") CGI::unescapeHTML("HTML escaped string")
=end =end
def CGI::unescapeHTML(string) def CGI::unescapeHTML(string)
str = string.dup string.gsub(/&(.*?);/n) do
str.gsub!(/&(.*?);/n){
match = $1.dup match = $1.dup
case match case match
when /\Aamp\z/ni then '&' when /\Aamp\z/ni then '&'
@ -295,8 +289,7 @@ $-v = v
end end
when /\A#x([0-9a-f]+)\z/ni then $1.hex.chr when /\A#x([0-9a-f]+)\z/ni then $1.hex.chr
end end
} end
str
end end
@ -309,11 +302,9 @@ $-v = v
# "<BR>&lt;A HREF="url"&gt;&lt;/A&gt" # "<BR>&lt;A HREF="url"&gt;&lt;/A&gt"
=end =end
def CGI::escapeElement(string, *element) def CGI::escapeElement(string, *element)
str = string.dup string.gsub(/<\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?>/ni) do
str.gsub!(/<\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?>/ni){
CGI::escapeHTML($&) CGI::escapeHTML($&)
} end
str
end end
@ -328,11 +319,9 @@ $-v = v
# "&lt;BR&gt;<A HREF="url"></A>" # "&lt;BR&gt;<A HREF="url"></A>"
=end =end
def CGI::unescapeElement(string, *element) def CGI::unescapeElement(string, *element)
str = string.dup string.gsub(/&lt;\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?&gt;/ni) do
str.gsub!(/&lt;\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?&gt;/ni){
CGI::unescapeHTML($&) CGI::unescapeHTML($&)
} end
str
end end
@ -493,7 +482,7 @@ status:
=begin =begin
=== PRINT HTTP HEADER AND STRING TO $> === PRINT HTTP HEADER AND STRING TO $DEFAULT_OUTPUT ($>)
cgi = CGI.new cgi = CGI.new
cgi.out{ "string" } cgi.out{ "string" }
# Content-Type: text/html # Content-Type: text/html
@ -555,7 +544,7 @@ convert string charset, and set language to "ja".
=begin =begin
=== PRINT === PRINT
cgi = CGI.new cgi = CGI.new
cgi.print # default: cgi.print == $>.print cgi.print # default: cgi.print == $DEFAULT_OUTPUT.print
=end =end
def print(*options) def print(*options)
stdoutput.print(*options) stdoutput.print(*options)
@ -637,7 +626,7 @@ convert string charset, and set language to "ja".
if @value.kind_of?(String) if @value.kind_of?(String)
buf.concat CGI::escape(@value) buf.concat CGI::escape(@value)
else else
buf.concat(@value.filter{|v| CGI::escape(v) }.join("&")) buf.concat(@value.collect{|v| CGI::escape(v) }.join("&"))
end end
if @domain if @domain
@ -675,7 +664,7 @@ convert string charset, and set language to "ja".
name, values = pairs.split('=',2) name, values = pairs.split('=',2)
name = CGI::unescape(name) name = CGI::unescape(name)
values ||= "" values ||= ""
values = values.split('&').filter{|v| CGI::unescape(v) } values = values.split('&').collect{|v| CGI::unescape(v) }
if cookies.has_key?(name) if cookies.has_key?(name)
cookies[name].value.push(*values) cookies[name].value.push(*values)
else else
@ -697,7 +686,7 @@ convert string charset, and set language to "ja".
params = Hash.new([]) params = Hash.new([])
query.split(/[&;]/n).each do |pairs| query.split(/[&;]/n).each do |pairs|
key, value = pairs.split('=',2).filter{|v| CGI::unescape(v) } key, value = pairs.split('=',2).collect{|v| CGI::unescape(v) }
if params.has_key?(key) if params.has_key?(key)
params[key].push(value) params[key].push(value)
else else
@ -711,30 +700,28 @@ convert string charset, and set language to "ja".
module QueryExtension module QueryExtension
%w[ CONTENT_LENGTH SERVER_PORT ]. for env in %w[ CONTENT_LENGTH SERVER_PORT ]
each{|env|
eval( <<-END ) eval( <<-END )
def #{env.sub(/^HTTP_/n, '').downcase} def #{env.sub(/^HTTP_/n, '').downcase}
env_table["#{env}"] && Integer(env_table["#{env}"]) env_table["#{env}"] && Integer(env_table["#{env}"])
end end
END END
} end
%w[ AUTH_TYPE CONTENT_TYPE GATEWAY_INTERFACE PATH_INFO for env in %w[ AUTH_TYPE CONTENT_TYPE GATEWAY_INTERFACE PATH_INFO
PATH_TRANSLATED QUERY_STRING REMOTE_ADDR REMOTE_HOST PATH_TRANSLATED QUERY_STRING REMOTE_ADDR REMOTE_HOST
REMOTE_IDENT REMOTE_USER REQUEST_METHOD SCRIPT_NAME REMOTE_IDENT REMOTE_USER REQUEST_METHOD SCRIPT_NAME
SERVER_NAME SERVER_PROTOCOL SERVER_SOFTWARE SERVER_NAME SERVER_PROTOCOL SERVER_SOFTWARE
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM HTTP_HOST HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM HTTP_HOST
HTTP_NEGOTIATE HTTP_PRAGMA HTTP_REFERER HTTP_USER_AGENT ]. HTTP_NEGOTIATE HTTP_PRAGMA HTTP_REFERER HTTP_USER_AGENT ]
each{|env|
eval( <<-END ) eval( <<-END )
def #{env.sub(/^HTTP_/n, '').downcase} def #{env.sub(/^HTTP_/n, '').downcase}
env_table["#{env}"] env_table["#{env}"]
end end
END END
} end
def raw_cookie def raw_cookie
env_table["HTTP_COOKIE"] env_table["HTTP_COOKIE"]
@ -761,7 +748,7 @@ convert string charset, and set language to "ja".
stdinput.binmode stdinput.binmode
content_length -= stdinput.read((boundary + EOL).size).size content_length -= stdinput.read((boundary + EOL).size).size
require "tempfile.rb" require "tempfile"
until -1 == content_length until -1 == content_length
head = nil head = nil
@ -771,10 +758,10 @@ convert string charset, and set language to "ja".
until head and (/#{boundary}(?:#{EOL}|--)/n === buf) until head and (/#{boundary}(?:#{EOL}|--)/n === buf)
if (not head) and (/#{EOL}#{EOL}/n === buf) if (not head) and (/#{EOL}#{EOL}/n === buf)
buf.sub!(/\A((?:.|\n)*?#{EOL})#{EOL}/n){ buf = buf.sub(/\A((?:.|\n)*?#{EOL})#{EOL}/n) do
head = $1.dup head = $1.dup
"" ""
} end
next next
end end
@ -793,13 +780,13 @@ convert string charset, and set language to "ja".
end end
buf.sub!(/\A((?:.|\n)*?)(?:#{EOL})?#{boundary}(#{EOL}|--)/n){ buf = buf.sub(/\A((?:.|\n)*?)(?:#{EOL})?#{boundary}(#{EOL}|--)/n) do
body.print $1 body.print $1
if "--" == $2 if "--" == $2
content_length = -1 content_length = -1
end end
"" ""
} end
body.rewind body.rewind
@ -849,24 +836,20 @@ convert string charset, and set language to "ja".
# offline mode. read name=value pairs on standard input. # offline mode. read name=value pairs on standard input.
def read_from_cmdline def read_from_cmdline
require "shellwords.rb" require "shellwords"
unless ARGV.empty? string = unless ARGV.empty?
str = ARGV.join(' ') ARGV.join(' ')
else else
if STDIN.tty? if STDIN.tty?
STDERR.print( STDERR.print(
%|(offline mode: enter name=value pairs on standard input)\n| %|(offline mode: enter name=value pairs on standard input)\n|
) )
end end
str = readlines.join(' ') readlines.join(' ').gsub(/\n/n, '')
str.gsub!(/\n/n, '') end.gsub(/\\=/n, '%3D').gsub(/\\&/n, '%26')
end
str.gsub!(/\\=/n, '%3D') words = Shellwords.shellwords(string)
str.gsub!(/\\&/n, '%26')
words = Shellwords.shellwords(str)
if words.find{|x| /=/n === x } if words.find{|x| /=/n === x }
words.join('&') words.join('&')
@ -938,22 +921,17 @@ convert string charset, and set language to "ja".
=end =end
def CGI::pretty_shift(string, shift = " ") def CGI::pretty_shift(string, shift = " ")
shift = " " if true == shift shift = " " if true == shift
str = string.dup string.gsub(/\n(?!\z)/n, "\n" + shift)
str.gsub!(/\n(?!\z)/n, "\n" + shift)
str
end end
def CGI::pretty_nest(string, shift = " ") def CGI::pretty_nest(string, shift = " ")
str = string.dup string.gsub(/(<(\w+).*?>)((?:.|\n)*?)(<\/\2>)/n) do
str.gsub!(/(<(\w+).*?>)((?:.|\n)*?)(<\/\2>)/n){
$1 + CGI::pretty_shift(CGI::pretty_nest($3, shift), shift) + $4 $1 + CGI::pretty_shift(CGI::pretty_nest($3, shift), shift) + $4
} end
str
end end
def CGI::pretty(string, shift = " ") def CGI::pretty(string, shift = " ")
str = string.dup CGI::pretty_nest(
str.gsub!(/<(?:.|\n)*?>/n, "\n\\0") string.gsub(/<(?:.|\n)*?>/n, "\n\\0").gsub(/<(?:.|\n)*?>(?!\n)/n, "\\0\n"), shift
str.gsub!(/<(?:.|\n)*?>(?!\n)/n, "\\0\n") )
CGI::pretty_nest(str, shift)
end end
@ -1037,7 +1015,6 @@ convert string charset, and set language to "ja".
module HtmlExtension module HtmlExtension
extend TagMaker
=begin =begin
@ -1699,162 +1676,176 @@ convert string charset, and set language to "ja".
module Html3 module Html3
extend TagMaker
def doctype def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">| %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">|
end end
def element_init
extend TagMaker
methods = ""
# - - # - -
%w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG DFN CODE SAMP KBD VAR for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG
CITE FONT ADDRESS DIV center MAP APPLET PRE XMP LISTING DL OL UL DIR DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV center MAP
MENU SELECT table TITLE STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT table TITLE
BLOCKQUOTE CAPTION ]. STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE
each{|element| CAPTION ]
eval( <<-BEGIN + nn_element_def(element) + <<-END ) methods.concat( <<-BEGIN + nn_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
# - O EMPTY # - O EMPTY
%w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT ISINDEX META ]. for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT
each{|element| ISINDEX META ]
eval( <<-BEGIN + nOE_element_def(element) + <<-END ) methods.concat( <<-BEGIN + nOE_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
# O O or - O # O O or - O
%w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr th td ]. for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr
each{|element| th td ]
eval( <<-BEGIN + nO_element_def(element) + <<-END ) methods.concat( <<-BEGIN + nO_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
eval(methods)
end
end # Html3 end # Html3
module Html4 module Html4
extend TagMaker
def doctype def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">| %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">|
end end
def element_init
extend TagMaker
methods = ""
# - - # - -
%w[ TT I B BIG SMALL EM STRONG DFN CODE SAMP KBD VAR CITE ABBR ACRONYM for element in %w[ TT I B BIG SMALL EM STRONG DFN CODE SAMP KBD
SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT H1 H2 H3 H4 H5 H6 PRE Q VAR CITE ABBR ACRONYM SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT
INS DEL DL OL UL LABEL SELECT OPTGROUP FIELDSET LEGEND BUTTON TABLE H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL LABEL SELECT OPTGROUP
TITLE STYLE SCRIPT NOSCRIPT TEXTAREA FORM A BLOCKQUOTE CAPTION ]. FIELDSET LEGEND BUTTON TABLE TITLE STYLE SCRIPT NOSCRIPT
each{|element| TEXTAREA FORM A BLOCKQUOTE CAPTION ]
eval( <<-BEGIN + nn_element_def(element) + <<-END ) methods.concat( <<-BEGIN + nn_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
# - O EMPTY # - O EMPTY
%w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META ]. for element in %w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META ]
each{|element| methods.concat( <<-BEGIN + nOE_element_def(element) + <<-END )
eval( <<-BEGIN + nOE_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
# O O or - O # O O or - O
%w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY COLGROUP TR TH TD HEAD]. for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY
each{|element| COLGROUP TR TH TD HEAD]
eval( <<-BEGIN + nO_element_def(element) + <<-END ) methods.concat( <<-BEGIN + nO_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
eval(methods)
end
end # Html4 end # Html4
module Html4Tr module Html4Tr
extend TagMaker
def doctype def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">| %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">|
end end
def element_init
extend TagMaker
methods = ""
# - - # - -
%w[ TT I B U S STRIKE BIG SMALL EM STRONG DFN CODE SAMP KBD VAR CITE for element in %w[ TT I B U S STRIKE BIG SMALL EM STRONG DFN
ABBR ACRONYM FONT SUB SUP SPAN BDO ADDRESS DIV CENTER MAP OBJECT CODE SAMP KBD VAR CITE ABBR ACRONYM FONT SUB SUP SPAN BDO
APPLET H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL DIR MENU LABEL SELECT ADDRESS DIV CENTER MAP OBJECT APPLET H1 H2 H3 H4 H5 H6 PRE Q
OPTGROUP FIELDSET LEGEND BUTTON TABLE IFRAME NOFRAMES TITLE STYLE INS DEL DL OL UL DIR MENU LABEL SELECT OPTGROUP FIELDSET
SCRIPT NOSCRIPT TEXTAREA FORM A BLOCKQUOTE CAPTION ]. LEGEND BUTTON TABLE IFRAME NOFRAMES TITLE STYLE SCRIPT
each{|element| NOSCRIPT TEXTAREA FORM A BLOCKQUOTE CAPTION ]
eval( <<-BEGIN + nn_element_def(element) + <<-END ) methods.concat( <<-BEGIN + nn_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
# - O EMPTY # - O EMPTY
%w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT COL ISINDEX META ]. for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT
each{|element| COL ISINDEX META ]
eval( <<-BEGIN + nOE_element_def(element) + <<-END ) methods.concat( <<-BEGIN + nOE_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
# O O or - O # O O or - O
%w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY COLGROUP TR TH TD HEAD ]. for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY
each{|element| COLGROUP TR TH TD HEAD ]
eval( <<-BEGIN + nO_element_def(element) + <<-END ) methods.concat( <<-BEGIN + nO_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
eval(methods)
end
end # Html4Tr end # Html4Tr
module Html4Fr module Html4Fr
include Html4Tr
extend TagMaker
def doctype def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">| %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">|
end end
def element_init
extend TagMaker
extend Html4Tr
element_init()
methods = ""
# - - # - -
%w[ FRAMESET ]. for element in %w[ FRAMESET ]
each{|element| methods.concat( <<-BEGIN + nn_element_def(element) + <<-END )
eval( <<-BEGIN + nn_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
# - O EMPTY # - O EMPTY
%w[ FRAME ]. for element in %w[ FRAME ]
each{|element| methods.concat( <<-BEGIN + nOE_element_def(element) + <<-END )
eval( <<-BEGIN + nOE_element_def(element) + <<-END )
def #{element.downcase}(attributes = {}) def #{element.downcase}(attributes = {})
BEGIN BEGIN
end end
END END
} end
eval(methods)
end
end # Html4Fr end # Html4Fr
@ -1875,17 +1866,22 @@ convert string charset, and set language to "ja".
case type case type
when "html3" when "html3"
extend Html3 extend Html3
element_init()
extend HtmlExtension extend HtmlExtension
when "html4" when "html4"
extend Html4 extend Html4
element_init()
extend HtmlExtension extend HtmlExtension
when "html4Tr" when "html4Tr"
extend Html4Tr extend Html4Tr
element_init()
extend HtmlExtension extend HtmlExtension
when "html4Fr" when "html4Fr"
extend Html4Fr extend Html4Fr
element_init()
extend HtmlExtension extend HtmlExtension
end end
end end
if defined?(MOD_RUBY) and (RUBY_VERSION < "1.4.3") if defined?(MOD_RUBY) and (RUBY_VERSION < "1.4.3")
@ -1905,6 +1901,25 @@ end
== HISTORY == HISTORY
=== Version 1.31 - wakou
2000/05/08 21:51:30
- improvement of time forming new CGI object accompanied with HTML generation methods.
=== Version 1.30 - wakou
2000/05/07 21:51:14
- require English.rb
- improvement of load time.
=== Version 1.21 - wakou
2000/05/02 21:44:12
- support for ruby 1.5.3 (2000-05-01) (Array#filter --> Array#collect!)
=== Version 1.20 - wakou === Version 1.20 - wakou
2000/04/03 18:31:42 2000/04/03 18:31:42

View File

@ -1,5 +1,5 @@
# Copyright (C) 2000 Network Applied Communication Laboratory, Inc. # Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
# Copyright (C) 2000 Information-technology Promotion Agancy, Japan # Copyright (C) 2000 Information-technology Promotion Agency, Japan
require 'cgi' require 'cgi'
require 'final' require 'final'

View File

@ -1,5 +1,5 @@
# Copyright (C) 2000 Network Applied Communication Laboratory, Inc. # Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
# Copyright (C) 2000 Information-technology Promotion Agancy, Japan # Copyright (C) 2000 Information-technology Promotion Agency, Japan
if $SAFE > 0 if $SAFE > 0
STDERR.print "-r debug.rb is not available in safe mode\n" STDERR.print "-r debug.rb is not available in safe mode\n"
@ -526,7 +526,7 @@ EOHELP
end end
def debug_funcname(id) def debug_funcname(id)
if id == 0 if id.nil?
"toplevel" "toplevel"
else else
id.id2name id.id2name

View File

@ -328,6 +328,11 @@ def create_makefile(target)
end end
$DLDFLAGS = CONFIG["DLDFLAGS"] $DLDFLAGS = CONFIG["DLDFLAGS"]
if $configure_args['--enable-shared']
$libs = CONFIG["LIBRUBYARG"] + " " + $libs
$DLDFLAGS = $DLDFLAGS + " -L$(topdir)"
end
if RUBY_PLATFORM =~ /beos/ if RUBY_PLATFORM =~ /beos/
$libs = $libs + " " + CONFIG["LIBRUBYARG"] $libs = $libs + " " + CONFIG["LIBRUBYARG"]
$DLDFLAGS = $DLDFLAGS + " -L" + CONFIG["prefix"] + "/lib" $DLDFLAGS = $DLDFLAGS + " -L" + CONFIG["prefix"] + "/lib"
@ -338,8 +343,6 @@ def create_makefile(target)
if File.exist? target + ".def" if File.exist? target + ".def"
defflag = "--def=" + target + ".def" defflag = "--def=" + target + ".def"
end end
$libs = $libs + " " + CONFIG["LIBRUBYARG"]
$DLDFLAGS = $DLDFLAGS + " -L$(topdir)"
end end
unless $objs then unless $objs then
@ -460,13 +463,10 @@ end
$OBJEXT = CONFIG["OBJEXT"] $OBJEXT = CONFIG["OBJEXT"]
$objs = nil $objs = nil
$libs = "-lc" $libs = CONFIG["DLDLIBS"]
$local_flags = "" $local_flags = ""
case RUBY_PLATFORM case RUBY_PLATFORM
when /cygwin|beos|openstep|nextstep|rhapsody/
$libs = ""
when /mswin32/ when /mswin32/
$libs = ""
$local_flags = "rubymw.lib -link /LIBPATH:$(topdir) /EXPORT:Init_$(TARGET)" $local_flags = "rubymw.lib -link /LIBPATH:$(topdir) /EXPORT:Init_$(TARGET)"
end end
$LOCAL_LIBS = "" $LOCAL_LIBS = ""

View File

@ -5,7 +5,7 @@ $Date$
net/telnet.rb net/telnet.rb
Version 1.30 Version 1.31
Wakou Aoyama <wakou@fsinet.or.jp> Wakou Aoyama <wakou@fsinet.or.jp>
@ -24,7 +24,7 @@ Wakou Aoyama <wakou@fsinet.or.jp>
# if ignore timeout then set "Timeout" to false. # if ignore timeout then set "Timeout" to false.
"Waittime" => 0, # default: 0 "Waittime" => 0, # default: 0
"Proxy" => proxy # default: nil "Proxy" => proxy # default: nil
# proxy is Telnet or TCPsocket object # proxy is Net::Telnet or IO object
}) })
Telnet object has socket class methods. Telnet object has socket class methods.
@ -157,6 +157,12 @@ of cource, set sync=true or flush is necessary.
== HISTORY == HISTORY
=== Version 1.31
2000/05/02 21:48:39
- Proxy option: can receive IO object
=== Version 1.30 === Version 1.30
2000/04/03 18:27:02 2000/04/03 18:27:02
@ -437,7 +443,7 @@ module Net
EOL = CR + LF EOL = CR + LF
v = $-v v = $-v
$-v = false $-v = false
VERSION = "1.30" VERSION = "1.31"
RELEASE_DATE = "$Date$" RELEASE_DATE = "$Date$"
$-v = v $-v = v
@ -487,12 +493,12 @@ module Net
end end
if @options.has_key?("Proxy") if @options.has_key?("Proxy")
if @options["Proxy"].kind_of?(Telnet) if @options["Proxy"].kind_of?(Net::Telnet)
@sock = @options["Proxy"].sock @sock = @options["Proxy"].sock
elsif @options["Proxy"].kind_of?(TCPsocket) elsif @options["Proxy"].kind_of?(IO)
@sock = @options["Proxy"] @sock = @options["Proxy"]
else else
raise "Error; Proxy is Telnet or TCPSocket object." raise "Error; Proxy is Net::Telnet or IO object."
end end
else else
message = "Trying " + @options["Host"] + "...\n" message = "Trying " + @options["Host"] + "...\n"

View File

@ -4,7 +4,7 @@
# by Yukihiro Matsumoto <matz@netlab.co.jp> # by Yukihiro Matsumoto <matz@netlab.co.jp>
# #
# Copyright (C) 2000 Network Applied Communication Laboratory, Inc. # Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
# Copyright (C) 2000 Information-technology Promotion Agancy, Japan # Copyright (C) 2000 Information-technology Promotion Agency, Japan
# #
unless defined? Thread unless defined? Thread

View File

@ -2,7 +2,7 @@
# timeout.rb -- execution timeout # timeout.rb -- execution timeout
# #
# Copyright (C) 2000 Network Applied Communication Laboratory, Inc. # Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
# Copyright (C) 2000 Information-technology Promotion Agancy, Japan # Copyright (C) 2000 Information-technology Promotion Agency, Japan
# #
#= SYNOPSIS #= SYNOPSIS
# #

View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

13
parse.y
View File

@ -525,6 +525,10 @@ mlhs_node : variable
{ {
$$ = attrset($1, $3); $$ = attrset($1, $3);
} }
| primary '.' tCONSTANT
{
$$ = attrset($1, $3);
}
| backref | backref
{ {
rb_backref_error($1); rb_backref_error($1);
@ -547,6 +551,10 @@ lhs : variable
{ {
$$ = attrset($1, $3); $$ = attrset($1, $3);
} }
| primary '.' tCONSTANT
{
$$ = attrset($1, $3);
}
| backref | backref
{ {
rb_backref_error($1); rb_backref_error($1);
@ -3319,13 +3327,16 @@ yylex()
case '1': case '2': case '3': case '1': case '2': case '3':
case '4': case '5': case '6': case '4': case '5': case '6':
case '7': case '8': case '9': case '7': case '8': case '9':
tokadd('$');
while (ISDIGIT(c)) { while (ISDIGIT(c)) {
tokadd(c); tokadd(c);
c = nextc(); c = nextc();
} }
if (is_identchar(c))
break;
pushback(c); pushback(c);
tokfix(); tokfix();
yylval.node = NEW_NTH_REF(atoi(tok())); yylval.node = NEW_NTH_REF(atoi(tok()+1));
return tNTH_REF; return tNTH_REF;
default: default:

View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

View File

@ -2977,23 +2977,22 @@ re_compile_fastmap(bufp)
for (j = 0,c = 0;j < (int)size; j++) { for (j = 0,c = 0;j < (int)size; j++) {
unsigned int cc = EXTRACT_MBC(&p[j*8]); unsigned int cc = EXTRACT_MBC(&p[j*8]);
beg = WC2MBC1ST(cc); beg = WC2MBC1ST(cc);
while (c < beg) { while (c <= beg) {
if (ismbchar(c)) if (ismbchar(c))
fastmap[c] = 1; fastmap[c] = 1;
c++; c++;
} }
cc = EXTRACT_MBC(&p[j*8+4]); cc = EXTRACT_MBC(&p[j*8+4]);
beg = WC2MBC1ST(cc);
if (cc < 0xff) { if (cc < 0xff) {
num_literal = 1; num_literal = 1;
while (c <= beg) { while (c <= cc) {
if (ismbchar(c)) if (ismbchar(c))
fastmap[c] = 1; fastmap[c] = 1;
c++; c++;
} }
} }
c = beg + 1; c = WC2MBC1ST(cc);
} }
for (j = c; j < (1 << BYTEWIDTH); j++) { for (j = c; j < (1 << BYTEWIDTH); j++) {

6
ruby.c
View File

@ -1,4 +1,4 @@
/************************************************ /**********************************************************************
ruby.c - ruby.c -
@ -8,9 +8,9 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
************************************************/ **********************************************************************/
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>

12
ruby.h
View File

@ -7,7 +7,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/
@ -73,16 +73,6 @@ extern "C" {
#include <alloca.h> #include <alloca.h>
#endif #endif
#if defined(__CYGWIN32__)
#if defined(USEIMPORTLIB)
#include "import.h"
#else
#if !defined(__CYGWIN__)
#define environ (*__imp___cygwin_environ)
#endif
#endif
#endif
#ifdef _AIX #ifdef _AIX
#pragma alloca #pragma alloca
#endif #endif

View File

@ -1,4 +1,4 @@
/************************************************ /**********************************************************************
signal.c - signal.c -
@ -8,9 +8,9 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
************************************************/ **********************************************************************/
#include "ruby.h" #include "ruby.h"
#include "rubysig.h" #include "rubysig.h"

View File

@ -1,4 +1,4 @@
/************************************************ /**********************************************************************
sprintf.c - sprintf.c -
@ -8,9 +8,9 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
************************************************/ **********************************************************************/
#include "ruby.h" #include "ruby.h"
#include <ctype.h> #include <ctype.h>

View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

View File

@ -8,7 +8,7 @@
Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agancy, Japan Copyright (C) 2000 Information-technology Promotion Agency, Japan
**********************************************************************/ **********************************************************************/

View File

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.3" #define RUBY_VERSION "1.5.3"
#define RUBY_RELEASE_DATE "2000-05-01" #define RUBY_RELEASE_DATE "2000-05-09"
#define RUBY_VERSION_CODE 153 #define RUBY_VERSION_CODE 153
#define RUBY_RELEASE_CODE 20000501 #define RUBY_RELEASE_CODE 20000509

View File

@ -58,6 +58,7 @@ s%@LIBRUBY_ALIASES@%%g
s%@LIBRUBY@%libruby.lib%g s%@LIBRUBY@%libruby.lib%g
s%@LIBRUBYARG@%libruby.lib%g s%@LIBRUBYARG@%libruby.lib%g
s%@SOLIBS@%%g s%@SOLIBS@%%g
s%@DLDLIBS@%%g
s%@arch@%i386-mswin32%g s%@arch@%i386-mswin32%g
s%@sitedir@%${prefix}/lib/ruby/site_ruby%g s%@sitedir@%${prefix}/lib/ruby/site_ruby%g
s%@configure_args@%--with-make-prog=nmake%g s%@configure_args@%--with-make-prog=nmake%g

View File

@ -498,6 +498,7 @@ EXPORTS
rb_str_new3 rb_str_new3
rb_str_new4 rb_str_new4
rb_str_to_str rb_str_to_str
rb_str_associate
rb_obj_as_string rb_obj_as_string
rb_str_dup rb_str_dup
rb_str_plus rb_str_plus
@ -508,6 +509,8 @@ EXPORTS
rb_str_dup_frozen rb_str_dup_frozen
rb_str_resize rb_str_resize
rb_str_cat rb_str_cat
rb_str_cat2
rb_str_append
rb_str_concat rb_str_concat
rb_str_hash rb_str_hash
rb_str_cmp rb_str_cmp
@ -568,17 +571,26 @@ EXPORTS
rb_obj_instance_variables rb_obj_instance_variables
rb_obj_remove_instance_variable rb_obj_remove_instance_variable
rb_const_get_at rb_const_get_at
rb_autoload_load
rb_const_get rb_const_get
rb_mod_remove_const rb_mod_remove_const
rb_mod_const_at rb_mod_const_at
rb_mod_constants
rb_mod_const_of rb_mod_const_of
rb_mod_constants
rb_const_defined_at rb_const_defined_at
rb_autoload_defined rb_autoload_defined
rb_const_defined rb_const_defined
rb_const_set rb_const_set
rb_const_assign
rb_define_const rb_define_const
rb_define_global_const rb_define_global_const
rb_cvar_declare
rb_cvar_set
rb_cvar_get
rb_cvar_defined
rb_cv_set
rb_cv_get
rb_define_class_variable
rb_iv_get rb_iv_get
rb_iv_set rb_iv_set
;version.c ;version.c