diff --git a/ChangeLog b/ChangeLog index 4ca63c4c59..297848c3de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,65 @@ +Mon May 8 23:47:39 2000 Katsuyuki Komatsu + + * eval.c (rb_callcc): prev & next should be initialized to zero. + +Mon May 8 23:17:36 2000 Yukihiro Matsumoto + + * dln.c (dln_init): remove possible buffer overrun. This is + suggested by Aleksi Niemela + + * dln.c (init_funcname): ditto. + +Sat May 6 23:35:47 2000 Yukihiro Matsumoto + + * parse.y (lhs): should allow `obj.Attr = 5' type expression. + +Sat May 6 15:46:08 2000 WATANABE Hirofumi + + * 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 + + * parse.y (yylex): allow '$1foo' and such. + +Fri May 5 03:25:15 2000 Yukihiro Matsumoto + + * regex.c (re_compile_fastmap): charset_not for multibyte + characters excluded too many characters. + +Tue May 2 13:23:43 2000 Yukihiro Matsumoto + + * eval.c (rb_thread_schedule): little bit more impartial context + switching. + +Tue May 2 09:50:03 2000 Katsuyuki Komatsu + + * 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 + + * 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 * array.c (rb_ary_unshift_m): performance improvement. diff --git a/Makefile.in b/Makefile.in index 859525483a..deffe4d7a7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -81,7 +81,7 @@ OBJS = array.@OBJEXT@ \ version.@OBJEXT@ \ $(MISSING) -all: miniruby$(EXEEXT) @PREP@ rbconfig.rb +all: miniruby$(EXEEXT) @PREP@ rbconfig.rb $(LIBRUBY) @@MINIRUBY@ -Xext extmk.rb @EXTSTATIC@ miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) dmyext.@OBJEXT@ diff --git a/array.c b/array.c index e25e9d3784..6793fdde88 100644 --- a/array.c +++ b/array.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/config_s.dj b/config_s.dj index 90902472af..6ba2b89d89 100644 --- a/config_s.dj +++ b/config_s.dj @@ -51,6 +51,7 @@ s%@LIBRUBY_A@%libruby.a%g s%@LIBRUBYARG@%libruby.a%g s%@LIBRUBY_SO@%%g s%@SOLIBS@%%g +s%@DLDLIBS@%%g s%@srcdir%.%g s%@arch@%i386-djgpp%g s%@sitedir@%${prefix}/lib/ruby/site_ruby%g diff --git a/configure b/configure index 54ea0d5c01..ec6b66fb1f 100644 --- a/configure +++ b/configure @@ -4529,6 +4529,16 @@ EOF cat >> confdefs.h <<\EOF #define DLEXT ".dll" EOF +;; + cygwin*) DLEXT=so + cat >> confdefs.h <<\EOF +#define DLEXT ".so" +EOF + + DLEXT2=dll + cat >> confdefs.h <<\EOF +#define DLEXT2 ".dll" +EOF ;; *) DLEXT=so cat >> confdefs.h <<\EOF @@ -4572,7 +4582,7 @@ fi case "$target_os" in human*) 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_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4580,7 +4590,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsignal $LIBS" cat > conftest.$ac_ext <&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* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4619,7 +4629,7 @@ else fi 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_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4627,7 +4637,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lhmem $LIBS" cat > conftest.$ac_ext <&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* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4668,12 +4678,12 @@ fi for ac_func in select gettimeofday do 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 echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&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* eval "ac_cv_func_$ac_func=yes" else @@ -4721,7 +4731,7 @@ fi done 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 echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4729,7 +4739,7 @@ else rb_cv_missing__dtos18=no else cat > conftest.$ac_ext < @@ -4741,7 +4751,7 @@ main () } 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 rb_cv_missing__dtos18=yes else @@ -4763,7 +4773,7 @@ EOF fi 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 echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4771,7 +4781,7 @@ else rb_cv_missing_fconvert=no else cat > conftest.$ac_ext < @@ -4784,7 +4794,7 @@ main () } 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 rb_cv_missing_fconvert=yes else @@ -4869,6 +4879,15 @@ if test "$target_os" = "beos"; then esac fi +case "$target_os" in + cygwin*|beos*|openstep*|nextstep*|rhapsody*|macos*|os2_emx*) + DLDLIBS="" + ;; + *) + DLDLIBS="-lc" + ;; +esac + LIBRUBY_LDSHARED=$LDSHARED LIBRUBY_DLDFLAGS=$DLDFLAGS LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR).$(TEENY)' @@ -4981,6 +5000,7 @@ esac + ri_prefix= test "$program_prefix" != NONE && ri_prefix=$program_prefix @@ -5250,6 +5270,7 @@ s%@STATIC@%$STATIC%g s%@CCDLFLAGS@%$CCDLFLAGS%g s%@LDSHARED@%$LDSHARED%g s%@DLEXT@%$DLEXT%g +s%@DLEXT2@%$DLEXT2%g s%@STRIP@%$STRIP%g s%@EXTSTATIC@%$EXTSTATIC%g s%@setup@%$setup%g @@ -5264,6 +5285,7 @@ s%@LIBRUBY_ALIASES@%$LIBRUBY_ALIASES%g s%@LIBRUBY@%$LIBRUBY%g s%@LIBRUBYARG@%$LIBRUBYARG%g s%@SOLIBS@%$SOLIBS%g +s%@DLDLIBS@%$DLDLIBS%g s%@arch@%$arch%g s%@sitedir@%$sitedir%g s%@configure_args@%$configure_args%g diff --git a/configure.in b/configure.in index 83cb5783a7..c83b0ab74c 100644 --- a/configure.in +++ b/configure.in @@ -403,6 +403,7 @@ AC_SUBST(STATIC)dnl AC_SUBST(CCDLFLAGS)dnl AC_SUBST(LDSHARED)dnl AC_SUBST(DLEXT)dnl +AC_SUBST(DLEXT2)dnl STATIC= @@ -569,6 +570,10 @@ else AC_DEFINE(DLEXT, ".bundle");; os2_emx*) DLEXT=dll AC_DEFINE(DLEXT, ".dll");; + cygwin*) DLEXT=so + AC_DEFINE(DLEXT, ".so") + DLEXT2=dll + AC_DEFINE(DLEXT2, ".dll");; *) DLEXT=so AC_DEFINE(DLEXT, ".so");; esac @@ -711,6 +716,15 @@ if test "$target_os" = "beos"; then esac fi +case "$target_os" in + cygwin*|beos*|openstep*|nextstep*|rhapsody*|macos*|os2_emx*) + DLDLIBS="" + ;; + *) + DLDLIBS="-lc" + ;; +esac + LIBRUBY_LDSHARED=$LDSHARED LIBRUBY_DLDFLAGS=$DLDFLAGS LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR).$(TEENY)' @@ -819,6 +833,7 @@ AC_SUBST(LIBRUBY_ALIASES) AC_SUBST(LIBRUBY) AC_SUBST(LIBRUBYARG) AC_SUBST(SOLIBS) +AC_SUBST(DLDLIBS) ri_prefix= test "$program_prefix" != NONE && diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in index b0bd0c72d2..ca16e32e48 100644 --- a/cygwin/GNUmakefile.in +++ b/cygwin/GNUmakefile.in @@ -6,4 +6,3 @@ miniruby$(EXEEXT): $(RUBYCWDLL) $(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 - @NM@ --extern-only $(OBJS) dmyext.o | sed -n '/^........ [CD] _\(.*\)$$/s//#define \1 (*__imp_\1)/p' >import.h diff --git a/defines.h b/defines.h index 657e86d3f3..b5761d66ad 100644 --- a/defines.h +++ b/defines.h @@ -34,6 +34,14 @@ #include "win32/win32.h" #endif +#if defined __CYGWIN__ +# if defined USEIMPORTLIB +# define EXTERN extern __declspec(dllimport) +# else +# define EXTERN extern __declspec(dllexport) +# endif +#endif + #ifndef EXTERN #define EXTERN extern #endif @@ -62,7 +70,7 @@ #undef HAVE_SETITIMER #endif -#if defined(__CYGWIN__) || defined(DJGPP) || defined(__BOW__) +#if defined(DJGPP) || defined(__BOW__) #undef HAVE_SETITIMER #endif diff --git a/dir.c b/dir.c index 3a6fa53b1e..40a6b8cc28 100644 --- a/dir.c +++ b/dir.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/dln.c b/dln.c index a44c5a78c3..beef2f74a5 100644 --- a/dln.c +++ b/dln.c @@ -98,7 +98,7 @@ init_funcname(buf, file) if (*p == '/') slash = p; #endif - sprintf(buf, FUNCNAME_PATTERN, slash + 1); + snprintf(buf, MAXPATHLEN, FUNCNAME_PATTERN, slash + 1); for (p = buf; *p; p++) { /* Delete suffix if it exists */ if (*p == '.') { *p = '\0'; break; @@ -367,6 +367,10 @@ dln_init(prog) while (read(fd, p, 1) == 1) { if (*p == '\n' || *p == '\t' || *p == ' ') break; p++; + if (p-buf >= MAXPATHLEN) { + dln_errno = ENAMETOOLONG; + return -1; + } } *p = '\0'; @@ -605,7 +609,7 @@ load_1(fd, disp, need_init) struct nlist *sym; struct nlist *end; int init_p = 0; - char buf[256]; + char buf[MAXPATHLEN]; if (load_header(fd, &hdr, disp) == -1) return -1; 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 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))) ERRBUF_APPEND(strerror(errno)); @@ -1407,20 +1411,20 @@ dln_load(file) } /* find symbol for module initialize function. */ - /* The Be Book KernelKit Images section described to use - B_SYMBOL_TYPE_TEXT for symbol of function, not - B_SYMBOL_TYPE_CODE. Why ? */ - /* strcat(init_fct_symname, "__Fv"); */ /* parameter nothing. */ - /* "__Fv" dont need! The Be Book Bug ? */ + /* The Be Book KernelKit Images section described to use + B_SYMBOL_TYPE_TEXT for symbol of function, not + B_SYMBOL_TYPE_CODE. Why ? */ + /* strcat(init_fct_symname, "__Fv"); */ /* parameter nothing. */ + /* "__Fv" dont need! The Be Book Bug ? */ err_stat = get_image_symbol(img_id, buf, B_SYMBOL_TYPE_TEXT, (void **)&init_fct); if (err_stat != B_NO_ERROR) { - char real_name[1024]; - strcpy(real_name, buf); - strcat(real_name, "__Fv"); + char real_name[MAXPATHLEN]; + strcpy(real_name, buf); + strcat(real_name, "__Fv"); err_stat = get_image_symbol(img_id, real_name, - B_SYMBOL_TYPE_TEXT, (void **)&init_fct); + B_SYMBOL_TYPE_TEXT, (void **)&init_fct); } if ((B_BAD_IMAGE_ID == err_stat) || (B_BAD_INDEX == err_stat)) { diff --git a/eval.c b/eval.c index 38cdfe403f..faf41d194c 100644 --- a/eval.c +++ b/eval.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto 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; if (TYPE(val) != T_ARRAY) { - if (NIL_P(val)) + if (!check && NIL_P(val)) val = rb_ary_new2(0); else 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) { file = feature = RSTRING(fname)->ptr; 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); ext = strrchr(buf, '.'); + strcpy(ext, ".so"); + if (rb_provided(buf)) return Qfalse; strcpy(ext, DLEXT); 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); if (file) goto load_dyna; } @@ -4969,6 +4981,15 @@ rb_f_require(obj, fname) feature = buf; 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", RSTRING(fname)->ptr); @@ -6359,9 +6380,9 @@ thread_free(th) if (th->stk_ptr) free(th->stk_ptr); th->stk_ptr = 0; if (th->locals) st_free_table(th->locals); - if (th->status != THREAD_KILLED && th->prev) { - th->prev->next = th->next; - th->next->prev = th->prev; + if (th->status != THREAD_KILLED) { + if (th->prev) th->prev->next = th->next; + if (th->next) th->next->prev = th->prev; } if (th != main_thread) free(th); } @@ -6625,14 +6646,6 @@ rb_thread_schedule() 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) { FOREACH_THREAD_FROM(curr, th) { if ((th->wait_for&WAIT_JOIN) && rb_thread_dead(th->join)) { @@ -6640,8 +6653,6 @@ rb_thread_schedule() th->wait_for &= ~WAIT_JOIN; th->status = THREAD_RUNNABLE; num_waiting_on_join--; - if (!next || next->priority < th->priority) - next = th; } } END_FOREACH_FROM(curr, th); @@ -6651,7 +6662,7 @@ rb_thread_schedule() fd_set readfds; struct timeval delay_tv, *delay_ptr; double delay, now; /* OK */ - int n, max; + int n, max, found; do { max = 0; @@ -6676,8 +6687,7 @@ rb_thread_schedule() th->wait_for &= ~WAIT_TIME; th->status = THREAD_RUNNABLE; num_waiting_on_timer--; - if (!next || next->priority < th->priority) - next = th; + found = 1; } else if (th->delay < delay) { delay = th->delay; } @@ -6686,10 +6696,10 @@ rb_thread_schedule() END_FOREACH_FROM(curr, th); } /* Do the select if needed */ - if (num_waiting_on_fd > 0 || !next) { + if (num_waiting_on_fd > 0 || !found) { /* Convert delay to a timeval */ /* If a thread is runnable, just poll */ - if (next) { + if (found) { delay_tv.tv_sec = 0; delay_tv.tv_usec = 0; delay_ptr = &delay_tv; @@ -6728,8 +6738,7 @@ rb_thread_schedule() th->fd = 0; th->wait_for &= ~WAIT_FD; num_waiting_on_fd--; - if (!next || next->priority < th->priority) - next = th; /* Found one. */ + found = 1; } } END_FOREACH_FROM(curr, th); @@ -6737,9 +6746,17 @@ rb_thread_schedule() } /* The delays for some of the threads should have expired. 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) { curr_thread->file = ruby_sourcefile; curr_thread->line = ruby_sourceline; @@ -7765,6 +7782,7 @@ rb_callcc(self) for (tag=prot_tag; tag; tag=tag->prev) { scope_dup(tag->scope); } + th->prev = th->next = 0; if (THREAD_SAVE_CONTEXT(th)) { return th->result; } diff --git a/ext/Win32API/Win32API.c b/ext/Win32API/Win32API.c index 433d13abeb..27693c7257 100644 --- a/ext/Win32API/Win32API.c +++ b/ext/Win32API/Win32API.c @@ -132,6 +132,7 @@ Win32API_Call(argc, argv, obj) VALUE import_type; int nimport, timport, texport, i; int items; + int ret; items = rb_scan_args(argc, argv, "0*", &args); @@ -162,7 +163,7 @@ Win32API_Call(argc, argv, obj) mov eax, lParam push eax } -#elif defined(__CYGWIN__) || defined(__MINGW32__) +#elif defined __GNUC__ asm volatile ("pushl %0" :: "g" (lParam)); #else #error @@ -184,7 +185,7 @@ Win32API_Call(argc, argv, obj) mov eax, pParam push eax } -#elif defined(__CYGWIN__) || defined(__MINGW32__) +#elif defined __GNUC__ asm volatile ("pushl %0" :: "g" (pParam)); #else #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) { case _T_NUMBER: ApiFunctionNumber = (ApiNumber *) ApiFunction; @@ -214,6 +231,7 @@ Win32API_Call(argc, argv, obj) Return = INT2NUM(0); break; } +#endif return Return; } diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index cbe0e6e5fa..7caa5985c2 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -329,6 +329,11 @@ def create_makefile(target) $DLDFLAGS = '@DLDFLAGS@' + if $configure_args['--enable-shared'] + $libs = "@LIBRUBYARG@ " + $libs + $DLDFLAGS = $DLDFLAGS + " -L" + $topdir + end + if RUBY_PLATFORM =~ /beos/ and not $static $libs = $libs + " @LIBRUBYARG@" $DLDFLAGS = $DLDFLAGS + " -L" + $topdir @@ -339,8 +344,6 @@ def create_makefile(target) if File.exist? target + ".def" defflag = "--def=" + target + ".def" end - $libs = $libs + " @LIBRUBYARG@" - $DLDFLAGS = $DLDFLAGS + " -L" + $topdir end $srcdir = $top_srcdir + "/ext/" + $mdir @@ -499,16 +502,11 @@ def extmake(target) $OBJEXT = "@OBJEXT@" $LIBEXT = "a" $objs = nil + $libs = "@DLDLIBS@" $local_flags = "" - case RUBY_PLATFORM - when /cygwin|beos|openstep|nextstep|rhapsody|macos|i386-os2_emx/ - $libs = "" - when /mswin32/ + if /mswin32/ =~ RUBY_PLATFORM $LIBEXT = "lib" - $libs = "" $local_flags = "$(topdir)/rubymw.lib -link /EXPORT:Init_$(TARGET)" - else - $libs = "-lc" end $LOCAL_LIBS = "" # to be assigned in extconf.rb dir = with_config("opt-dir") diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 1adb7cc1b5..91ac8f6123 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -173,7 +173,7 @@ have_header("netinet/tcp.h") have_header("netinet/udp.h") $getaddr_info_ok = false -if try_run(< #include #include @@ -292,6 +292,22 @@ else have_header("resolv.h") end +if !try_link(< +#include +#include +#include +#include +int +main() +{ + socklen_t len; + return 0; +} +EOF + $CFLAGS="-Dsocklen_t=int "+$CFLAGS +end + have_header("sys/un.h") if have_func(test_func) diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 2ad653cc4a..bbd5057741 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -6,6 +6,8 @@ $Date$ created at: Thu Mar 31 12:21:29 JST 1994 + Copyright (C) 1993-2000 Yukihiro Matsumoto + ************************************************/ #include "ruby.h" diff --git a/file.c b/file.c index 15fcb943f9..19e44c4d13 100644 --- a/file.c +++ b/file.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/gc.c b/gc.c index 2584e4034c..086715a569 100644 --- a/gc.c +++ b/gc.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto 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 -/* 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; static int dont_gc; static int during_gc; @@ -351,7 +321,7 @@ VALUE *rb_gc_stack_start = 0; __inline__ #endif static int -looks_pointerp(ptr) +is_pointer_to_heap(ptr) void *ptr; { register RVALUE *p = RANY(ptr); @@ -376,7 +346,7 @@ mark_locations_array(x, n) register long n; { while (n--) { - if (looks_pointerp(*x)) { + if (is_pointer_to_heap(*x)) { rb_gc_mark(*x); } x++; @@ -438,7 +408,7 @@ void rb_gc_mark_maybe(obj) void *obj; { - if (looks_pointerp(obj)) { + if (is_pointer_to_heap(obj)) { rb_gc_mark(obj); } } @@ -585,13 +555,13 @@ rb_gc_mark(ptr) #endif 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); } - 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); } - 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); goto Top; } @@ -684,7 +654,7 @@ rb_gc_mark(ptr) default: rb_bug("rb_gc_mark(): unknown data type 0x%x(0x%x) %s", 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 == Qnil) return Qnil; - ptr = id ^ FIXNUM_FLAG; - if (!looks_pointerp(ptr)) { + ptr = id ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */ + if (!is_pointer_to_heap(ptr)) { rb_raise(rb_eRangeError, "0x%x is not id value", ptr); } if (BUILTIN_TYPE(ptr) == 0) { diff --git a/hash.c b/hash.c index a7f588ddeb..14afcbb7f3 100644 --- a/hash.c +++ b/hash.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/intern.h b/intern.h index 58ea0285e5..81b1a53a04 100644 --- a/intern.h +++ b/intern.h @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/io.c b/io.c index e87f5ecdf6..5beae00bcb 100644 --- a/io.c +++ b/io.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/lib/cgi.rb b/lib/cgi.rb index 016c66c032..7317670154 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -5,10 +5,10 @@ $Date$ cgi.rb -Version 1.20 +Version 1.31 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 @@ -108,7 +108,7 @@ and see MAKE COOKIE OBJECT. === GET ENVIRONMENT VALUE - require "CGI" + require "cgi" cgi = CGI.new value = cgi.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 -=== PRINT HTTP HEADER AND HTML STRING TO $> +=== PRINT HTTP HEADER AND HTML STRING TO $DEFAULT_OUTPUT ($>) require "cgi" cgi = CGI.new("html3") # add HTML generation methods @@ -176,6 +176,8 @@ HTTP_REFERER HTTP_USER_AGENT =end +require 'English' + class CGI CR = "\015" @@ -183,7 +185,7 @@ class CGI EOL = CR + LF v = $-v $-v = false - VERSION = "1.20" + VERSION = "1.31" RELEASE_DATE = "$Date$" $-v = v @@ -223,7 +225,7 @@ $-v = v end def stdoutput - $> + $DEFAULT_OUTPUT end private :env_table, :stdinput, :stdoutput @@ -237,10 +239,9 @@ $-v = v url_encoded_string = CGI::escape("string") =end def CGI::escape(string) - str = string.dup - str.gsub!(/ /n, '+') - str.gsub!(/([^a-zA-Z0-9_.-])/n){ sprintf("%%%02X", $1.unpack("C")[0]) } - str + string.gsub(/ /n, '+').gsub(/([^a-zA-Z0-9_.-])/n) do + sprintf("%%%02X", $1.unpack("C")[0]) + end end @@ -249,10 +250,9 @@ $-v = v string = CGI::unescape("url encoded string") =end def CGI::unescape(string) - str = string.dup - str.gsub!(/\+/n, ' ') - str.gsub!(/%([0-9a-fA-F]{2})/n){ [$1.hex].pack("c") } - str + string.gsub(/\+/n, ' ').gsub(/%([0-9a-fA-F]{2})/n) do + [$1.hex].pack("c") + end end @@ -261,12 +261,7 @@ $-v = v CGI::escapeHTML("string") =end def CGI::escapeHTML(string) - str = string.dup - str.gsub!(/&/n, '&') - str.gsub!(/\"/n, '"') - str.gsub!(/>/n, '>') - str.gsub!(//n, '>').gsub(/<A HREF="url"></A>" =end def CGI::escapeElement(string, *element) - str = string.dup - str.gsub!(/<\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?>/ni){ + string.gsub(/<\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?>/ni) do CGI::escapeHTML($&) - } - str + end end @@ -328,11 +319,9 @@ $-v = v # "<BR>" =end def CGI::unescapeElement(string, *element) - str = string.dup - str.gsub!(/<\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?>/ni){ + string.gsub(/<\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?>/ni) do CGI::unescapeHTML($&) - } - str + end end @@ -493,7 +482,7 @@ status: =begin -=== PRINT HTTP HEADER AND STRING TO $> +=== PRINT HTTP HEADER AND STRING TO $DEFAULT_OUTPUT ($>) cgi = CGI.new cgi.out{ "string" } # Content-Type: text/html @@ -555,7 +544,7 @@ convert string charset, and set language to "ja". =begin === PRINT cgi = CGI.new - cgi.print # default: cgi.print == $>.print + cgi.print # default: cgi.print == $DEFAULT_OUTPUT.print =end def print(*options) stdoutput.print(*options) @@ -637,7 +626,7 @@ convert string charset, and set language to "ja". if @value.kind_of?(String) buf.concat CGI::escape(@value) else - buf.concat(@value.filter{|v| CGI::escape(v) }.join("&")) + buf.concat(@value.collect{|v| CGI::escape(v) }.join("&")) end if @domain @@ -675,7 +664,7 @@ convert string charset, and set language to "ja". name, values = pairs.split('=',2) name = CGI::unescape(name) values ||= "" - values = values.split('&').filter{|v| CGI::unescape(v) } + values = values.split('&').collect{|v| CGI::unescape(v) } if cookies.has_key?(name) cookies[name].value.push(*values) else @@ -697,7 +686,7 @@ convert string charset, and set language to "ja". params = Hash.new([]) 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) params[key].push(value) else @@ -711,30 +700,28 @@ convert string charset, and set language to "ja". module QueryExtension - %w[ CONTENT_LENGTH SERVER_PORT ]. - each{|env| + for env in %w[ CONTENT_LENGTH SERVER_PORT ] eval( <<-END ) def #{env.sub(/^HTTP_/n, '').downcase} env_table["#{env}"] && Integer(env_table["#{env}"]) 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 REMOTE_IDENT REMOTE_USER REQUEST_METHOD SCRIPT_NAME SERVER_NAME SERVER_PROTOCOL SERVER_SOFTWARE HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM HTTP_HOST - HTTP_NEGOTIATE HTTP_PRAGMA HTTP_REFERER HTTP_USER_AGENT ]. - each{|env| + HTTP_NEGOTIATE HTTP_PRAGMA HTTP_REFERER HTTP_USER_AGENT ] eval( <<-END ) def #{env.sub(/^HTTP_/n, '').downcase} env_table["#{env}"] end END - } + end def raw_cookie env_table["HTTP_COOKIE"] @@ -761,7 +748,7 @@ convert string charset, and set language to "ja". stdinput.binmode content_length -= stdinput.read((boundary + EOL).size).size - require "tempfile.rb" + require "tempfile" until -1 == content_length head = nil @@ -771,10 +758,10 @@ convert string charset, and set language to "ja". until head and (/#{boundary}(?:#{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 "" - } + end next end @@ -793,13 +780,13 @@ convert string charset, and set language to "ja". end - buf.sub!(/\A((?:.|\n)*?)(?:#{EOL})?#{boundary}(#{EOL}|--)/n){ + buf = buf.sub(/\A((?:.|\n)*?)(?:#{EOL})?#{boundary}(#{EOL}|--)/n) do body.print $1 if "--" == $2 content_length = -1 end "" - } + end body.rewind @@ -849,24 +836,20 @@ convert string charset, and set language to "ja". # offline mode. read name=value pairs on standard input. def read_from_cmdline - require "shellwords.rb" + require "shellwords" - unless ARGV.empty? - str = ARGV.join(' ') + string = unless ARGV.empty? + ARGV.join(' ') else if STDIN.tty? STDERR.print( %|(offline mode: enter name=value pairs on standard input)\n| ) end - str = readlines.join(' ') - str.gsub!(/\n/n, '') - end + readlines.join(' ').gsub(/\n/n, '') + end.gsub(/\\=/n, '%3D').gsub(/\\&/n, '%26') - str.gsub!(/\\=/n, '%3D') - str.gsub!(/\\&/n, '%26') - - words = Shellwords.shellwords(str) + words = Shellwords.shellwords(string) if words.find{|x| /=/n === x } words.join('&') @@ -938,22 +921,17 @@ convert string charset, and set language to "ja". =end def CGI::pretty_shift(string, shift = " ") shift = " " if true == shift - str = string.dup - str.gsub!(/\n(?!\z)/n, "\n" + shift) - str + string.gsub(/\n(?!\z)/n, "\n" + shift) end def CGI::pretty_nest(string, shift = " ") - str = string.dup - str.gsub!(/(<(\w+).*?>)((?:.|\n)*?)(<\/\2>)/n){ + string.gsub(/(<(\w+).*?>)((?:.|\n)*?)(<\/\2>)/n) do $1 + CGI::pretty_shift(CGI::pretty_nest($3, shift), shift) + $4 - } - str + end end def CGI::pretty(string, shift = " ") - str = string.dup - str.gsub!(/<(?:.|\n)*?>/n, "\n\\0") - str.gsub!(/<(?:.|\n)*?>(?!\n)/n, "\\0\n") - CGI::pretty_nest(str, shift) + CGI::pretty_nest( + string.gsub(/<(?:.|\n)*?>/n, "\n\\0").gsub(/<(?:.|\n)*?>(?!\n)/n, "\\0\n"), shift + ) end @@ -1037,7 +1015,6 @@ convert string charset, and set language to "ja". module HtmlExtension - extend TagMaker =begin @@ -1699,162 +1676,176 @@ convert string charset, and set language to "ja". module Html3 - extend TagMaker def doctype %|| end - # - - - %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG DFN CODE SAMP KBD VAR - CITE FONT ADDRESS DIV center MAP APPLET PRE XMP LISTING DL OL UL DIR - MENU SELECT table TITLE STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM - BLOCKQUOTE CAPTION ]. - each{|element| - eval( <<-BEGIN + nn_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + def element_init + extend TagMaker + methods = "" + # - - + for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG + DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV center MAP + APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT table TITLE + STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE + CAPTION ] + methods.concat( <<-BEGIN + nn_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end - # - O EMPTY - %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT ISINDEX META ]. - each{|element| - eval( <<-BEGIN + nOE_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + # - O EMPTY + for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT + ISINDEX META ] + methods.concat( <<-BEGIN + nOE_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end - # O O or - O - %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr th td ]. - each{|element| - eval( <<-BEGIN + nO_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + # O O or - O + for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr + th td ] + methods.concat( <<-BEGIN + nO_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end + eval(methods) + end end # Html3 module Html4 - extend TagMaker def doctype %|| end - # - - - %w[ TT I B BIG SMALL EM STRONG DFN CODE SAMP KBD VAR CITE ABBR ACRONYM - SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT H1 H2 H3 H4 H5 H6 PRE Q - INS DEL DL OL UL LABEL SELECT OPTGROUP FIELDSET LEGEND BUTTON TABLE - TITLE STYLE SCRIPT NOSCRIPT TEXTAREA FORM A BLOCKQUOTE CAPTION ]. - each{|element| - eval( <<-BEGIN + nn_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + def element_init + extend TagMaker + methods = "" + # - - + for element in %w[ TT I B BIG SMALL EM STRONG DFN CODE SAMP KBD + VAR CITE ABBR ACRONYM SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT + H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL LABEL SELECT OPTGROUP + FIELDSET LEGEND BUTTON TABLE TITLE STYLE SCRIPT NOSCRIPT + TEXTAREA FORM A BLOCKQUOTE CAPTION ] + methods.concat( <<-BEGIN + nn_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end - # - O EMPTY - %w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META ]. - each{|element| - eval( <<-BEGIN + nOE_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + # - O EMPTY + for element in %w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META ] + methods.concat( <<-BEGIN + nOE_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end - # O O or - O - %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY COLGROUP TR TH TD HEAD]. - each{|element| - eval( <<-BEGIN + nO_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + # O O or - O + for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY + COLGROUP TR TH TD HEAD] + methods.concat( <<-BEGIN + nO_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end + eval(methods) + end end # Html4 module Html4Tr - extend TagMaker def doctype %|| end - # - - - %w[ TT I B U S STRIKE BIG SMALL EM STRONG DFN CODE SAMP KBD VAR CITE - ABBR ACRONYM FONT SUB SUP SPAN BDO ADDRESS DIV CENTER MAP OBJECT - APPLET H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL DIR MENU LABEL SELECT - OPTGROUP FIELDSET LEGEND BUTTON TABLE IFRAME NOFRAMES TITLE STYLE - SCRIPT NOSCRIPT TEXTAREA FORM A BLOCKQUOTE CAPTION ]. - each{|element| - eval( <<-BEGIN + nn_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + def element_init + extend TagMaker + methods = "" + # - - + for element in %w[ TT I B U S STRIKE BIG SMALL EM STRONG DFN + CODE SAMP KBD VAR CITE ABBR ACRONYM FONT SUB SUP SPAN BDO + ADDRESS DIV CENTER MAP OBJECT APPLET H1 H2 H3 H4 H5 H6 PRE Q + INS DEL DL OL UL DIR MENU LABEL SELECT OPTGROUP FIELDSET + LEGEND BUTTON TABLE IFRAME NOFRAMES TITLE STYLE SCRIPT + NOSCRIPT TEXTAREA FORM A BLOCKQUOTE CAPTION ] + methods.concat( <<-BEGIN + nn_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end - # - O EMPTY - %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT COL ISINDEX META ]. - each{|element| - eval( <<-BEGIN + nOE_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + # - O EMPTY + for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT + COL ISINDEX META ] + methods.concat( <<-BEGIN + nOE_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end - # O O or - O - %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY COLGROUP TR TH TD HEAD ]. - each{|element| - eval( <<-BEGIN + nO_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + # O O or - O + for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY + COLGROUP TR TH TD HEAD ] + methods.concat( <<-BEGIN + nO_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end + eval(methods) + end end # Html4Tr module Html4Fr - include Html4Tr - extend TagMaker def doctype %|| end - # - - - %w[ FRAMESET ]. - each{|element| - eval( <<-BEGIN + nn_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + def element_init + extend TagMaker + extend Html4Tr + element_init() + methods = "" + # - - + for element in %w[ FRAMESET ] + methods.concat( <<-BEGIN + nn_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end - # - O EMPTY - %w[ FRAME ]. - each{|element| - eval( <<-BEGIN + nOE_element_def(element) + <<-END ) - def #{element.downcase}(attributes = {}) - BEGIN - end - END - } + # - O EMPTY + for element in %w[ FRAME ] + methods.concat( <<-BEGIN + nOE_element_def(element) + <<-END ) + def #{element.downcase}(attributes = {}) + BEGIN + end + END + end + eval(methods) + end end # Html4Fr @@ -1875,17 +1866,22 @@ convert string charset, and set language to "ja". case type when "html3" extend Html3 + element_init() extend HtmlExtension when "html4" extend Html4 + element_init() extend HtmlExtension when "html4Tr" extend Html4Tr + element_init() extend HtmlExtension when "html4Fr" extend Html4Fr + element_init() extend HtmlExtension end + end if defined?(MOD_RUBY) and (RUBY_VERSION < "1.4.3") @@ -1905,6 +1901,25 @@ end == 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 2000/04/03 18:31:42 diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb index 5aa3a06053..967603f59c 100644 --- a/lib/cgi/session.rb +++ b/lib/cgi/session.rb @@ -1,5 +1,5 @@ # 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 'final' diff --git a/lib/debug.rb b/lib/debug.rb index 8af0aab96d..2f61e8da34 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -1,5 +1,5 @@ # 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 STDERR.print "-r debug.rb is not available in safe mode\n" @@ -526,7 +526,7 @@ EOHELP end def debug_funcname(id) - if id == 0 + if id.nil? "toplevel" else id.id2name diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 74238b98b0..38ef9615c2 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -328,6 +328,11 @@ def create_makefile(target) end $DLDFLAGS = CONFIG["DLDFLAGS"] + if $configure_args['--enable-shared'] + $libs = CONFIG["LIBRUBYARG"] + " " + $libs + $DLDFLAGS = $DLDFLAGS + " -L$(topdir)" + end + if RUBY_PLATFORM =~ /beos/ $libs = $libs + " " + CONFIG["LIBRUBYARG"] $DLDFLAGS = $DLDFLAGS + " -L" + CONFIG["prefix"] + "/lib" @@ -338,8 +343,6 @@ def create_makefile(target) if File.exist? target + ".def" defflag = "--def=" + target + ".def" end - $libs = $libs + " " + CONFIG["LIBRUBYARG"] - $DLDFLAGS = $DLDFLAGS + " -L$(topdir)" end unless $objs then @@ -460,13 +463,10 @@ end $OBJEXT = CONFIG["OBJEXT"] $objs = nil -$libs = "-lc" +$libs = CONFIG["DLDLIBS"] $local_flags = "" case RUBY_PLATFORM -when /cygwin|beos|openstep|nextstep|rhapsody/ - $libs = "" when /mswin32/ - $libs = "" $local_flags = "rubymw.lib -link /LIBPATH:$(topdir) /EXPORT:Init_$(TARGET)" end $LOCAL_LIBS = "" diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb index 4acaaadd3a..ca259416e0 100644 --- a/lib/net/telnet.rb +++ b/lib/net/telnet.rb @@ -5,7 +5,7 @@ $Date$ net/telnet.rb -Version 1.30 +Version 1.31 Wakou Aoyama @@ -24,7 +24,7 @@ Wakou Aoyama # if ignore timeout then set "Timeout" to false. "Waittime" => 0, # default: 0 "Proxy" => proxy # default: nil - # proxy is Telnet or TCPsocket object + # proxy is Net::Telnet or IO object }) Telnet object has socket class methods. @@ -157,6 +157,12 @@ of cource, set sync=true or flush is necessary. == HISTORY +=== Version 1.31 + +2000/05/02 21:48:39 + +- Proxy option: can receive IO object + === Version 1.30 2000/04/03 18:27:02 @@ -437,7 +443,7 @@ module Net EOL = CR + LF v = $-v $-v = false - VERSION = "1.30" + VERSION = "1.31" RELEASE_DATE = "$Date$" $-v = v @@ -487,12 +493,12 @@ module Net end if @options.has_key?("Proxy") - if @options["Proxy"].kind_of?(Telnet) + if @options["Proxy"].kind_of?(Net::Telnet) @sock = @options["Proxy"].sock - elsif @options["Proxy"].kind_of?(TCPsocket) + elsif @options["Proxy"].kind_of?(IO) @sock = @options["Proxy"] else - raise "Error; Proxy is Telnet or TCPSocket object." + raise "Error; Proxy is Net::Telnet or IO object." end else message = "Trying " + @options["Host"] + "...\n" diff --git a/lib/thread.rb b/lib/thread.rb index 75822b91be..20ce6aef5d 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -4,7 +4,7 @@ # by Yukihiro Matsumoto # # 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 diff --git a/lib/timeout.rb b/lib/timeout.rb index ab55e73ed6..ba93a62f15 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -2,7 +2,7 @@ # timeout.rb -- execution timeout # # 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 # diff --git a/object.c b/object.c index 797d8ffba4..ce3eb2c2f0 100644 --- a/object.c +++ b/object.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/parse.y b/parse.y index 466c5994ec..6c5aaa7c9d 100644 --- a/parse.y +++ b/parse.y @@ -525,6 +525,10 @@ mlhs_node : variable { $$ = attrset($1, $3); } + | primary '.' tCONSTANT + { + $$ = attrset($1, $3); + } | backref { rb_backref_error($1); @@ -547,6 +551,10 @@ lhs : variable { $$ = attrset($1, $3); } + | primary '.' tCONSTANT + { + $$ = attrset($1, $3); + } | backref { rb_backref_error($1); @@ -3319,13 +3327,16 @@ yylex() case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + tokadd('$'); while (ISDIGIT(c)) { tokadd(c); c = nextc(); } + if (is_identchar(c)) + break; pushback(c); tokfix(); - yylval.node = NEW_NTH_REF(atoi(tok())); + yylval.node = NEW_NTH_REF(atoi(tok()+1)); return tNTH_REF; default: diff --git a/process.c b/process.c index fec3833697..a8409e4ce5 100644 --- a/process.c +++ b/process.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/regex.c b/regex.c index c4b0ee35b9..9ddc4752de 100644 --- a/regex.c +++ b/regex.c @@ -2977,23 +2977,22 @@ re_compile_fastmap(bufp) for (j = 0,c = 0;j < (int)size; j++) { unsigned int cc = EXTRACT_MBC(&p[j*8]); beg = WC2MBC1ST(cc); - while (c < beg) { + while (c <= beg) { if (ismbchar(c)) fastmap[c] = 1; c++; } cc = EXTRACT_MBC(&p[j*8+4]); - beg = WC2MBC1ST(cc); if (cc < 0xff) { num_literal = 1; - while (c <= beg) { + while (c <= cc) { if (ismbchar(c)) fastmap[c] = 1; c++; } } - c = beg + 1; + c = WC2MBC1ST(cc); } for (j = c; j < (1 << BYTEWIDTH); j++) { diff --git a/ruby.c b/ruby.c index e030bd5152..0777ffd574 100644 --- a/ruby.c +++ b/ruby.c @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** ruby.c - @@ -8,9 +8,9 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto 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 #include diff --git a/ruby.h b/ruby.h index 55ef41eb3b..1c50d35bb4 100644 --- a/ruby.h +++ b/ruby.h @@ -7,7 +7,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto 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 #endif -#if defined(__CYGWIN32__) -#if defined(USEIMPORTLIB) -#include "import.h" -#else -#if !defined(__CYGWIN__) -#define environ (*__imp___cygwin_environ) -#endif -#endif -#endif - #ifdef _AIX #pragma alloca #endif diff --git a/signal.c b/signal.c index d32bd1f02b..da0aef4670 100644 --- a/signal.c +++ b/signal.c @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** signal.c - @@ -8,9 +8,9 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto 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 "rubysig.h" diff --git a/sprintf.c b/sprintf.c index 7dd2f074f2..204ea145d2 100644 --- a/sprintf.c +++ b/sprintf.c @@ -1,4 +1,4 @@ -/************************************************ +/********************************************************************** sprintf.c - @@ -8,9 +8,9 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto 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 diff --git a/string.c b/string.c index 597225d320..fe8e8e1cef 100644 --- a/string.c +++ b/string.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/variable.c b/variable.c index 949de9d48b..de034da0dd 100644 --- a/variable.c +++ b/variable.c @@ -8,7 +8,7 @@ Copyright (C) 1993-2000 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agancy, Japan + Copyright (C) 2000 Information-technology Promotion Agency, Japan **********************************************************************/ diff --git a/version.h b/version.h index 7cdfc17028..e25e82e93c 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #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_RELEASE_CODE 20000501 +#define RUBY_RELEASE_CODE 20000509 diff --git a/win32/config.status b/win32/config.status index 150e2f3b85..4e039c03f2 100644 --- a/win32/config.status +++ b/win32/config.status @@ -58,6 +58,7 @@ s%@LIBRUBY_ALIASES@%%g s%@LIBRUBY@%libruby.lib%g s%@LIBRUBYARG@%libruby.lib%g s%@SOLIBS@%%g +s%@DLDLIBS@%%g s%@arch@%i386-mswin32%g s%@sitedir@%${prefix}/lib/ruby/site_ruby%g s%@configure_args@%--with-make-prog=nmake%g diff --git a/win32/ruby.def b/win32/ruby.def index d5fa104fd9..1c0760308e 100644 --- a/win32/ruby.def +++ b/win32/ruby.def @@ -498,6 +498,7 @@ EXPORTS rb_str_new3 rb_str_new4 rb_str_to_str + rb_str_associate rb_obj_as_string rb_str_dup rb_str_plus @@ -508,6 +509,8 @@ EXPORTS rb_str_dup_frozen rb_str_resize rb_str_cat + rb_str_cat2 + rb_str_append rb_str_concat rb_str_hash rb_str_cmp @@ -568,17 +571,26 @@ EXPORTS rb_obj_instance_variables rb_obj_remove_instance_variable rb_const_get_at + rb_autoload_load rb_const_get rb_mod_remove_const rb_mod_const_at - rb_mod_constants rb_mod_const_of + rb_mod_constants rb_const_defined_at rb_autoload_defined rb_const_defined rb_const_set + rb_const_assign rb_define_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_set ;version.c