diff options
-rw-r--r-- | ChangeLog | 51 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | configure | 445 | ||||
-rw-r--r-- | configure.in | 21 | ||||
-rw-r--r-- | dln.c | 4 | ||||
-rw-r--r-- | ext/aix_ld.rb | 2 | ||||
-rw-r--r-- | ext/etc/etc.c | 5 | ||||
-rw-r--r-- | ext/etc/extconf.rb | 23 | ||||
-rw-r--r-- | ext/extmk.rb.in | 31 | ||||
-rw-r--r-- | ext/tcltklib/extconf.rb | 11 | ||||
-rw-r--r-- | instruby.rb | 1 | ||||
-rw-r--r-- | intern.h | 1 | ||||
-rw-r--r-- | io.c | 10 | ||||
-rw-r--r-- | lib/find.rb | 2 | ||||
-rw-r--r-- | lib/open3.rb | 55 | ||||
-rw-r--r-- | lib/shell.rb | 3 | ||||
-rw-r--r-- | lib/telnet.rb | 40 | ||||
-rw-r--r-- | lib/tk.rb | 8 | ||||
-rw-r--r-- | lib/tkafter.rb | 1 | ||||
-rw-r--r-- | lib/tkcanvas.rb | 2 | ||||
-rw-r--r-- | parse.y | 166 | ||||
-rw-r--r-- | process.c | 6 | ||||
-rw-r--r-- | regex.c | 118 | ||||
-rw-r--r-- | regex.h | 6 | ||||
-rw-r--r-- | string.c | 7 | ||||
-rw-r--r-- | util.c | 252 | ||||
-rw-r--r-- | version.h | 4 |
27 files changed, 796 insertions, 480 deletions
@@ -1,3 +1,54 @@ +Mon Oct 5 18:31:53 1998 Yukihiro Matsumoto <[email protected]> + + * version 1.1c6 released. + +Fri Oct 2 14:22:33 1998 Yukihiro Matsumoto <[email protected]> + + * regex.c (re_search): `/\s*(--)$/ =~ "- --"' did not match, + because of wrong optimize condition. + +Mon Oct 1 01:55:16 1998 Yukihiro Matsumoto <[email protected]> + + * parse.y (rb_intern): should not raise exceptions. + + * parse.y (yylex): symbol like `:foo?=' should not be allowed. + + * ext/extmk.rb.in: makes *.a for static link modules. + +Fri Sep 25 12:01:19 1998 Yukihiro Matsumoto <[email protected]> + + * parse.y (yylex): `@foo!' should be an error. + +Thu Sep 24 14:55:06 1998 WATANABE Tetsuya <[email protected]> + + * ext/etc/etc.c (Init_etc): wrong field definition. + +Thu Sep 17 17:09:05 1998 Yukihiro Matsumoto <[email protected]> + + * io.c (io_reopen): was creating FILE* for wrong fd. + +Tue Sep 15 05:28:11 1998 Koji Arai <[email protected]> + + * regex.c (re_compile_pattern): forgot to fixup for the pattern + like (?=(A)|(B)). + +Mon Sep 14 14:42:27 1998 Yukihiro Matsumoto <[email protected]> + + * regex.c (re_match): beginning and end of the string, do not + automatically match `\b'. + + * string.c (scan_once): comsume at leaset on character. + + * regex.c (re_search): wrong behavior for negative range. + +Sat Sep 12 21:21:26 1998 Koji Arai <[email protected]> + + * regex.c (re_search): range value should be maintained. + +Thu Sep 10 10:55:00 1998 Yukihiro Matsumoto <[email protected]> + + * parse.y (backref_error): yyerror does not understand formats. + Tue Sep 8 18:05:33 1998 Yukihiro Matsumoto <[email protected]> * version 1.1c5 released. @@ -109,6 +109,7 @@ lib/mkmf.rb lib/monitor.rb lib/mutex_m.rb lib/observer.rb +lib/open3.rb lib/ostruct.rb lib/parsearg.rb lib/parsedate.rb @@ -1565,18 +1565,65 @@ else echo "$ac_t""no" 1>&6 fi # Dynamic linking for HP-UX +echo $ac_n "checking for setlocale in -lxpg4""... $ac_c" 1>&6 +echo "configure:1570: checking for setlocale in -lxpg4" >&5 +ac_lib_var=`echo xpg4'_'setlocale | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lxpg4 $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1578 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setlocale(); + +int main() { +setlocale() +; return 0; } +EOF +if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo xpg4 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lxpg4 $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + # FreeBSD needs this ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1575: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1622: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1580 "configure" +#line 1627 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -1584,7 +1631,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1588: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1635: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1609,7 +1656,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1613: checking for opendir in -ldir" >&5 +echo "configure:1660: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1617,7 +1664,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 1621 "configure" +#line 1668 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1628,7 +1675,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1650,7 +1697,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1654: checking for opendir in -lx" >&5 +echo "configure:1701: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1658,7 +1705,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 1662 "configure" +#line 1709 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1669,7 +1716,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1692,12 +1739,12 @@ fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1696: checking for ANSI C header files" >&5 +echo "configure:1743: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1701 "configure" +#line 1748 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1705,7 +1752,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1756: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1722,7 +1769,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1726 "configure" +#line 1773 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1740,7 +1787,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1744 "configure" +#line 1791 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1761,7 +1808,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1765 "configure" +#line 1812 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1772,7 +1819,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1801,17 +1848,17 @@ for ac_hdr in stdlib.h unistd.h limits.h sys/file.h sys/ioctl.h pwd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1805: checking for $ac_hdr" >&5 +echo "configure:1852: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1810 "configure" +#line 1857 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1839,12 +1886,12 @@ done echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:1843: checking for uid_t in sys/types.h" >&5 +echo "configure:1890: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1848 "configure" +#line 1895 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -1873,12 +1920,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1877: checking for size_t" >&5 +echo "configure:1924: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1882 "configure" +#line 1929 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1906,12 +1953,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:1910: checking for st_blksize in struct stat" >&5 +echo "configure:1957: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1915 "configure" +#line 1962 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1919,7 +1966,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:1923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -1941,12 +1988,12 @@ fi save_LIBOJBS="$LIBOBJS" echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:1945: checking for st_blocks in struct stat" >&5 +echo "configure:1992: checking for st_blocks in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1950 "configure" +#line 1997 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1954,7 +2001,7 @@ int main() { struct stat s; s.st_blocks; ; return 0; } EOF -if { (eval echo configure:1958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blocks=yes else @@ -1978,12 +2025,12 @@ fi LIBOBJS="$save_LIBOBJS" echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:1982: checking for st_rdev in struct stat" >&5 +echo "configure:2029: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1987 "configure" +#line 2034 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1991,7 +2038,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:1995: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -2013,7 +2060,7 @@ fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:2017: checking type of array argument to getgroups" >&5 +echo "configure:2064: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2021,7 +2068,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <<EOF -#line 2025 "configure" +#line 2072 "configure" #include "confdefs.h" /* Thanks to Mike Rendell for this test. */ @@ -2046,7 +2093,7 @@ main() } EOF -if { (eval echo configure:2050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -2060,7 +2107,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext <<EOF -#line 2064 "configure" +#line 2111 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -2084,12 +2131,12 @@ EOF echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2088: checking return type of signal handlers" >&5 +echo "configure:2135: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2093 "configure" +#line 2140 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -2106,7 +2153,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2127,19 +2174,19 @@ EOF # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2131: checking for working alloca.h" >&5 +echo "configure:2178: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2136 "configure" +#line 2183 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -2160,12 +2207,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2164: checking for alloca" >&5 +echo "configure:2211: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2169 "configure" +#line 2216 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -2188,7 +2235,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:2192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -2220,12 +2267,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2224: checking whether alloca needs Cray hooks" >&5 +echo "configure:2271: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2229 "configure" +#line 2276 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -2250,12 +2297,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2254: checking for $ac_func" >&5 +echo "configure:2301: 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 <<EOF -#line 2259 "configure" +#line 2306 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2278,7 +2325,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2305,7 +2352,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2309: checking stack direction for C alloca" >&5 +echo "configure:2356: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2313,7 +2360,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 2317 "configure" +#line 2364 "configure" #include "confdefs.h" find_stack_direction () { @@ -2332,7 +2379,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:2336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2354,12 +2401,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2358: checking for pid_t" >&5 +echo "configure:2405: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2363 "configure" +#line 2410 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2388,17 +2435,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2392: checking for vfork.h" >&5 +echo "configure:2439: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2397 "configure" +#line 2444 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2423,18 +2470,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2427: checking for working vfork" >&5 +echo "configure:2474: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2433: checking for vfork" >&5 +echo "configure:2480: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2438 "configure" +#line 2485 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -2457,7 +2504,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:2461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2478,7 +2525,7 @@ fi else cat > conftest.$ac_ext <<EOF -#line 2482 "configure" +#line 2529 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -2573,7 +2620,7 @@ main() { } } EOF -if { (eval echo configure:2577: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2596,7 +2643,7 @@ EOF fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2600: checking for 8-bit clean memcmp" >&5 +echo "configure:2647: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2604,7 +2651,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <<EOF -#line 2608 "configure" +#line 2655 "configure" #include "confdefs.h" main() @@ -2614,7 +2661,7 @@ main() } EOF -if { (eval echo configure:2618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -2635,12 +2682,12 @@ for ac_func in dup2 setenv memmove mkdir strcasecmp strerror strftime\ strchr strstr strtoul strdup crypt flock snprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2639: checking for $ac_func" >&5 +echo "configure:2686: 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 <<EOF -#line 2644 "configure" +#line 2691 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2663,7 +2710,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2696,12 +2743,12 @@ for ac_func in fmod killpg drand48 random wait4 waitpid syscall getcwd\ dlopen sigprocmask sigaction _setjmp setpgrp setsid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2700: checking for $ac_func" >&5 +echo "configure:2747: 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 <<EOF -#line 2705 "configure" +#line 2752 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2724,7 +2771,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2750,12 +2797,12 @@ done if test "$ac_cv_func_strftime" = no; then echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:2754: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:2801: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2759 "configure" +#line 2806 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -2763,7 +2810,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:2767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -2784,12 +2831,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:2788: checking for tm_zone in struct tm" >&5 +echo "configure:2835: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2793 "configure" +#line 2840 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_cv_struct_tm> @@ -2797,7 +2844,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:2801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -2817,12 +2864,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:2821: checking for tzname" >&5 +echo "configure:2868: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2826 "configure" +#line 2873 "configure" #include "confdefs.h" #include <time.h> #ifndef tzname /* For SGI. */ @@ -2832,7 +2879,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:2836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -2854,14 +2901,14 @@ EOF fi cat > conftest.$ac_ext <<EOF -#line 2858 "configure" +#line 2905 "configure" #include "confdefs.h" int main() { extern int daylight; int i = daylight; ; return 0; } EOF -if { (eval echo configure:2865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_DAYLIGHT 1 @@ -2881,7 +2928,7 @@ EOF else echo $ac_n "checking for BSD signal semantics""... $ac_c" 1>&6 -echo "configure:2885: checking for BSD signal semantics" >&5 +echo "configure:2932: checking for BSD signal semantics" >&5 if eval "test \"`echo '$''{'rb_cv_bsd_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2889,7 +2936,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2893 "configure" +#line 2940 "configure" #include "confdefs.h" #include <stdio.h> @@ -2911,7 +2958,7 @@ main() } EOF -if { (eval echo configure:2915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_bsd_signal=yes else @@ -2945,19 +2992,19 @@ EOF else echo $ac_n "checking whether getpgrp() has arg""... $ac_c" 1>&6 -echo "configure:2949: checking whether getpgrp() has arg" >&5 +echo "configure:2996: checking whether getpgrp() has arg" >&5 if eval "test \"`echo '$''{'rb_cv_bsdgetpgrp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2954 "configure" +#line 3001 "configure" #include "confdefs.h" #include <unistd.h> int main() { getpgrp(0); ; return 0; } EOF -if { (eval echo configure:2961: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_bsdgetpgrp=yes else @@ -2978,19 +3025,19 @@ EOF fi echo $ac_n "checking whether setpgrp() has args""... $ac_c" 1>&6 -echo "configure:2982: checking whether setpgrp() has args" >&5 +echo "configure:3029: checking whether setpgrp() has args" >&5 if eval "test \"`echo '$''{'rb_cv_bsdsetpgrp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2987 "configure" +#line 3034 "configure" #include "confdefs.h" #include <unistd.h> int main() { setpgrp(1, 1); ; return 0; } EOF -if { (eval echo configure:2994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_bsdsetpgrp=yes else @@ -3012,14 +3059,14 @@ EOF fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3016: checking whether byte ordering is bigendian" >&5 +echo "configure:3063: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 3023 "configure" +#line 3070 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3030,11 +3077,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 3038 "configure" +#line 3085 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3045,7 +3092,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3049: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -3065,7 +3112,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3069 "configure" +#line 3116 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -3078,7 +3125,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:3082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -3102,14 +3149,14 @@ EOF fi echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:3106: checking whether char is unsigned" >&5 +echo "configure:3153: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <<EOF -#line 3113 "configure" +#line 3160 "configure" #include "confdefs.h" #ifdef __CHAR_UNSIGNED__ yes @@ -3131,7 +3178,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3135 "configure" +#line 3182 "configure" #include "confdefs.h" /* volatile prevents gcc2 from optimizing the test away on sparcs. */ #if !defined(__STDC__) || __STDC__ != 1 @@ -3141,7 +3188,7 @@ main() { volatile char c = 255; exit(c < 0); } EOF -if { (eval echo configure:3145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -3166,7 +3213,7 @@ fi echo $ac_n "checking whether right shift preserve sign bit""... $ac_c" 1>&6 -echo "configure:3170: checking whether right shift preserve sign bit" >&5 +echo "configure:3217: checking whether right shift preserve sign bit" >&5 if eval "test \"`echo '$''{'rb_cv_rshift_sign'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3174,7 +3221,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3178 "configure" +#line 3225 "configure" #include "confdefs.h" int @@ -3186,7 +3233,7 @@ main() } EOF -if { (eval echo configure:3190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_rshift_sign=yes else @@ -3214,19 +3261,19 @@ EOF fi echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6 -echo "configure:3218: checking count field in FILE structures" >&5 +echo "configure:3265: checking count field in FILE structures" >&5 if eval "test \"`echo '$''{'rb_cv_fcnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3223 "configure" +#line 3270 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_cnt = 0; ; return 0; } EOF -if { (eval echo configure:3230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_cnt" else @@ -3236,14 +3283,14 @@ fi rm -f conftest* if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 3240 "configure" +#line 3287 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->__cnt = 0; ; return 0; } EOF -if { (eval echo configure:3247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="__cnt" else @@ -3254,14 +3301,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 3258 "configure" +#line 3305 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_r = 0; ; return 0; } EOF -if { (eval echo configure:3265: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_r" else @@ -3272,14 +3319,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 3276 "configure" +#line 3323 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->readCount = 0; ; return 0; } EOF -if { (eval echo configure:3283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="readCount" else @@ -3302,117 +3349,6 @@ EOF fi -if test "$ac_cv_func_getpwent" = yes; then - echo $ac_n "checking struct passwd""... $ac_c" 1>&6 -echo "configure:3308: checking struct passwd" >&5 - cat > conftest.$ac_ext <<EOF -#line 3310 "configure" -#include "confdefs.h" -#include <pwd.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pw_gecos" >/dev/null 2>&1; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define PW_GECOS 1 -EOF - -fi -rm -f conftest* - - cat > conftest.$ac_ext <<EOF -#line 3325 "configure" -#include "confdefs.h" -#include <pwd.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pw_change" >/dev/null 2>&1; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define PW_CHANGE 1 -EOF - -fi -rm -f conftest* - - cat > conftest.$ac_ext <<EOF -#line 3340 "configure" -#include "confdefs.h" -#include <pwd.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pw_quota" >/dev/null 2>&1; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define PW_QUOTA 1 -EOF - -fi -rm -f conftest* - - cat > conftest.$ac_ext <<EOF -#line 3355 "configure" -#include "confdefs.h" -#include <pwd.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pw_age" >/dev/null 2>&1; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define PW_AGE 1 -EOF - -fi -rm -f conftest* - - cat > conftest.$ac_ext <<EOF -#line 3370 "configure" -#include "confdefs.h" -#include <pwd.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pw_class" >/dev/null 2>&1; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define PW_CLASS 1 -EOF - -fi -rm -f conftest* - - cat > conftest.$ac_ext <<EOF -#line 3385 "configure" -#include "confdefs.h" -#include <pwd.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pw_comment" >/dev/null 2>&1; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define PW_COMMENT 1 -EOF - -fi -rm -f conftest* - - cat > conftest.$ac_ext <<EOF -#line 3400 "configure" -#include "confdefs.h" -#include <pwd.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "pw_expire" >/dev/null 2>&1; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define PW_EXPIRE 1 -EOF - -fi -rm -f conftest* - - echo "$ac_t""done" 1>&6 -fi - # Check whether --with-dln-a-out or --without-dln-a-out was given. if test "${with_dln_a_out+set}" = set; then withval="$with_dln_a_out" @@ -3429,7 +3365,7 @@ fi case "$host_os" in linux*) echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6 -echo "configure:3433: checking whether ELF binaries are produced" >&5 +echo "configure:3369: checking whether ELF binaries are produced" >&5 if eval "test \"`echo '$''{'rb_cv_linux_elf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3437,7 +3373,7 @@ else : else cat > conftest.$ac_ext <<EOF -#line 3441 "configure" +#line 3377 "configure" #include "confdefs.h" /* Test for whether ELF binaries are produced */ @@ -3457,7 +3393,7 @@ main() { } EOF -if { (eval echo configure:3461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_linux_elf=yes else @@ -3487,13 +3423,14 @@ STATIC= if test "$with_dln_a_out" != yes; then rb_cv_dlopen=unknown echo $ac_n "checking whether OS depend dynamic link works""... $ac_c" 1>&6 -echo "configure:3491: checking whether OS depend dynamic link works" >&5 +echo "configure:3427: checking whether OS depend dynamic link works" >&5 if test "$GCC" = yes; then case "$host_os" in nextstep*) ;; openstep*) ;; rhapsody*) ;; human*) ;; + cygwin32*) CCDLFLAGS=-DDLLIMPORT;; *) CCDLFLAGS=-fpic;; esac else @@ -3556,6 +3493,7 @@ echo "configure:3491: checking whether OS depend dynamic link works" >&5 ;; esac rb_cv_dlopen=yes ;; + cygwin32*) LDSHARED='../../miniruby ../cygwin32_ld.rb' ;; *) LDSHARED='ld' ;; esac echo "$ac_t""$rb_cv_dlopen" 1>&6 @@ -3565,13 +3503,13 @@ dln_a_out_works=no if test "$ac_cv_header_a_out_h" = yes; then if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6 -echo "configure:3569: checking whether matz's dln works" >&5 +echo "configure:3507: checking whether matz's dln works" >&5 cat confdefs.h > config.h if eval "test \"`echo '$''{'rb_cv_dln_a_out'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3575 "configure" +#line 3513 "configure" #include "confdefs.h" #define USE_DLN_A_OUT @@ -3581,7 +3519,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_dln_a_out=yes else @@ -3638,6 +3576,11 @@ EOF #define DLEXT ".bundle" EOF ;; + cygwin32*) DLEXT=dll + cat >> confdefs.h <<\EOF +#define DLEXT ".dll" +EOF +;; *) DLEXT=so cat >> confdefs.h <<\EOF #define DLEXT ".so" @@ -3678,7 +3621,7 @@ fi case "$host_os" in human*) echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6 -echo "configure:3682: checking for _harderr in -lsignal" >&5 +echo "configure:3625: 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 @@ -3686,7 +3629,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsignal $LIBS" cat > conftest.$ac_ext <<EOF -#line 3690 "configure" +#line 3633 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3697,7 +3640,7 @@ int main() { _harderr() ; return 0; } EOF -if { (eval echo configure:3701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3725,7 +3668,7 @@ else fi echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6 -echo "configure:3729: checking for hmemset in -lhmem" >&5 +echo "configure:3672: 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 @@ -3733,7 +3676,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lhmem $LIBS" cat > conftest.$ac_ext <<EOF -#line 3737 "configure" +#line 3680 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3744,7 +3687,7 @@ int main() { hmemset() ; return 0; } EOF -if { (eval echo configure:3748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3774,12 +3717,12 @@ fi for ac_func in select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3778: checking for $ac_func" >&5 +echo "configure:3721: 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 <<EOF -#line 3783 "configure" +#line 3726 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3802,7 +3745,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3827,7 +3770,7 @@ fi done echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6 -echo "configure:3831: checking whether PD libc _dtos18 fail to convert big number" >&5 +echo "configure:3774: 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 @@ -3835,7 +3778,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3839 "configure" +#line 3782 "configure" #include "confdefs.h" #include <stdio.h> @@ -3847,7 +3790,7 @@ main () } EOF -if { (eval echo configure:3851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_missing__dtos18=yes else @@ -3869,7 +3812,7 @@ EOF fi echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6 -echo "configure:3873: checking whether PD libc fconvert fail to round" >&5 +echo "configure:3816: 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 @@ -3877,7 +3820,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3881 "configure" +#line 3824 "configure" #include "confdefs.h" #include <stdio.h> @@ -3890,7 +3833,7 @@ main () } EOF -if { (eval echo configure:3894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_missing_fconvert=yes else @@ -3916,6 +3859,10 @@ EOF binsuffix=.x setup=Setup.x68 ;; + cygwin32*) + binsuffix=.exe + setup=Setup + ;; *) binsuffix= setup=Setup diff --git a/configure.in b/configure.in index b253e0f217..9ddce9983e 100644 --- a/configure.in +++ b/configure.in @@ -134,6 +134,7 @@ esac AC_CHECK_LIB(crypt, crypt) AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX +AC_CHECK_LIB(xpg4, setlocale) # FreeBSD needs this dnl Checks for header files. AC_HEADER_DIRENT @@ -274,18 +275,6 @@ else AC_DEFINE_UNQUOTED(FILE_COUNT, $rb_cv_fcnt) fi -if test "$ac_cv_func_getpwent" = yes; then - AC_MSG_CHECKING(struct passwd) - AC_EGREP_HEADER(pw_gecos, pwd.h, AC_DEFINE(PW_GECOS)) - AC_EGREP_HEADER(pw_change, pwd.h, AC_DEFINE(PW_CHANGE)) - AC_EGREP_HEADER(pw_quota, pwd.h, AC_DEFINE(PW_QUOTA)) - AC_EGREP_HEADER(pw_age, pwd.h, AC_DEFINE(PW_AGE)) - AC_EGREP_HEADER(pw_class, pwd.h, AC_DEFINE(PW_CLASS)) - AC_EGREP_HEADER(pw_comment, pwd.h, AC_DEFINE(PW_COMMENT)) - AC_EGREP_HEADER(pw_expire, pwd.h, AC_DEFINE(PW_EXPIRE)) - AC_MSG_RESULT(done) -fi - dnl wheather use dln_a_out ot not AC_ARG_WITH(dln-a-out, [--with-dln-a-out use dln_a_out if possible], [ case $withval in @@ -344,6 +333,7 @@ if test "$with_dln_a_out" != yes; then openstep*) ;; rhapsody*) ;; human*) ;; + cygwin32*) CCDLFLAGS=-DDLLIMPORT;; *) CCDLFLAGS=-fpic;; esac else @@ -406,6 +396,7 @@ if test "$with_dln_a_out" != yes; then ;; esac rb_cv_dlopen=yes ;; + cygwin32*) LDSHARED='../../miniruby ../cygwin32_ld.rb' ;; *) LDSHARED='ld' ;; esac AC_MSG_RESULT($rb_cv_dlopen) @@ -451,6 +442,8 @@ else AC_DEFINE(DLEXT, ".bundle");; rhapsody*) DLEXT=bundle AC_DEFINE(DLEXT, ".bundle");; + cygwin32*) DLEXT=dll + AC_DEFINE(DLEXT, ".dll");; *) DLEXT=so AC_DEFINE(DLEXT, ".so");; esac @@ -533,6 +526,10 @@ rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no)]) binsuffix=.x setup=Setup.x68 ;; + cygwin32*) + binsuffix=.exe + setup=Setup + ;; *) binsuffix= setup=Setup @@ -72,7 +72,7 @@ char *getenv(); int eaccess(); -#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(__CYGWIN32__) +#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(__CYGWIN32__) && !defined(_AIX) /* dynamic load with dlopen() */ # define USE_DLN_DLOPEN #endif @@ -1257,7 +1257,7 @@ dln_load(file) # endif /* Load file */ - if ((handle = dlopen(file, RTLD_LAZY|RTLD_GLOBAL)) == NULL) { + if ((handle = (void*)dlopen(file, RTLD_LAZY|RTLD_GLOBAL)) == NULL) { goto failed; } diff --git a/ext/aix_ld.rb b/ext/aix_ld.rb index 1058977b88..42b2087a46 100644 --- a/ext/aix_ld.rb +++ b/ext/aix_ld.rb @@ -43,7 +43,7 @@ def extract(nm, out) else next end - }.sort! + }.compact!.sort! uniq(data) exp = open(out, "w") for line in data diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 7bb7796663..1cf06768c8 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -239,7 +239,10 @@ Init_etc() sPasswd = struct_define("Passwd", "name", "passwd", "uid", "gid", - "gecos", "dir", "shell", +#ifdef PW_GECOS + "gecos", +#endif + "dir", "shell", #ifdef PW_CHANGE "change", #endif diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb index a02ff8c091..4cf04a3ec3 100644 --- a/ext/etc/extconf.rb +++ b/ext/etc/extconf.rb @@ -1,8 +1,31 @@ require 'mkmf' + +def etc_grep_header(field) + f = open("conftest.c", "w") + f.print <<EOF +#include <pwd.h> +EOF + f.close + begin + if xsystem("#{CPP} | egrep #{field}") + $defs.push(format("-D%s", field.upcase)) + end + ensure + system "rm -f conftest.c" + end +end + have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4 a = have_func("getlogin") b = have_func("getpwent") c = have_func("getgrent") if a or b or c + etc_grep_header("pw_gecos") + etc_grep_header("pw_change") + etc_grep_header("pw_quota") + etc_grep_header("pw_age") + etc_grep_header("pw_class") + etc_grep_header("pw_comment") + etc_grep_header("pw_expire") create_makefile("etc") end diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index e0e4569870..e8dc56604f 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -1,7 +1,7 @@ #! /usr/local/bin/ruby $".push 'mkmf.rb' #" -require 'find' +load '../lib/find.rb' if ARGV[0] == 'static' $force_static = TRUE @@ -319,7 +319,7 @@ clean:; @rm -f *.o *.so *.sl realclean: clean ", target, - if $static then "o" else "@DLEXT@" end, $dots, $dots + if $static then "a" else "@DLEXT@" end, $dots, $dots mfile.printf "\ @@ -335,7 +335,13 @@ install: install_rb(mfile) mfile.printf "\n" - if !$static && "@DLEXT@" != "o" + if $static + mfile.printf "\ +$(TARGET): $(OBJS) + @AR@ cru $(TARGET) $(OBJS) + @-@RANLIB@ $(LIBRUBY) 2> /dev/null || true +" + elsif "@DLEXT@" != "o" mfile.printf "\ $(TARGET): $(OBJS) $(LDSHARED) $(DLDFLAGS) -o $(TARGET) $(OBJS) $(LOCAL_LIBS) $(LIBS) @@ -346,26 +352,11 @@ $(TARGET): $(OBJS) $(TARGET): $(OBJS) ar cru $(TARGET) $(OBJS) " - elsif PLATFORM =~ "-nextstep" - mfile.printf "\ -$(TARGET): $(OBJS) - cc -r $(CFLAGS) -o $(TARGET) $(OBJS) -" - elsif PLATFORM =~ "-openstep" + elsif PLATFORM =~ "-nextstep" || PLATFORM =~ "-openstep" || PLATFORM =~ "-rhapsody" mfile.printf "\ $(TARGET): $(OBJS) cc -r $(CFLAGS) -o $(TARGET) $(OBJS) " - elsif PLATFORM =~ "-rhapsody" - mfile.printf "\ -$(TARGET): $(OBJS) - cc -r $(CFLAGS) -o $(TARGET) $(OBJS) -" - elsif $static - mfile.printf "\ -$(TARGET): $(OBJS) - ld -r -o $(TARGET) $(OBJS) -" else mfile.printf "\ $(TARGET): $(OBJS) @@ -505,7 +496,7 @@ exit if $install or $clean $extinit = "" unless $extinit if $extlist.size > 0 for s,t in $extlist - f = format("%s/%s.o", s, t) + f = format("%s/%s.a", s, t) if File.exist?(f) $extinit += format("\ \tInit_%s();\n\ diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb index 55cdc498c4..14c8e45ae5 100644 --- a/ext/tcltklib/extconf.rb +++ b/ext/tcltklib/extconf.rb @@ -11,9 +11,10 @@ $includes = [] def search_header(include, *path) pwd = Dir.getwd begin - for i in path.reverse! + for i in path.sort!.reverse! dir = Dir[i] for path in dir + next unless File.directory? path Dir.chdir path files = Dir[include] if files.size > 0 @@ -30,14 +31,14 @@ def search_header(include, *path) end search_header("tcl.h", - "/usr/include/tcl*", + "/usr/include/tcl{,8*,7*}", "/usr/include", - "/usr/local/include/tcl*", + "/usr/local/include/tcl{,8*,7*}", "/usr/local/include") search_header("tk.h", - "/usr/include/tk*", + "/usr/include/tk{,8*,4*}", "/usr/include", - "/usr/local/include/tk*", + "/usr/local/include/tk{,8*,4*}", "/usr/local/include") search_header("X11/Xlib.h", "/usr/include/X11*", diff --git a/instruby.rb b/instruby.rb index d6324425ae..7dee03a6c1 100644 --- a/instruby.rb +++ b/instruby.rb @@ -24,6 +24,7 @@ File.install "ruby#{binsuffix}", for dll in Dir['*.dll'] File.install dll, "#{bindir}/#{dll}", 0755, TRUE end +File.makedirs "#{prefix}/lib", TRUE for lib in ["libruby.so", "libruby.so.LIB"] if File.exist? lib File.install lib, "#{prefix}/lib", 0644, TRUE @@ -157,7 +157,6 @@ int env_path_tainted _((void)); /* io.c */ void eof_error _((void)); VALUE io_write _((VALUE, VALUE)); -VALUE io_gets_method _((int, VALUE*, VALUE)); VALUE io_gets _((VALUE)); VALUE io_getc _((VALUE)); VALUE io_ungetc _((VALUE, VALUE)); @@ -1359,12 +1359,15 @@ io_reopen(io, nfile) mode = io_mode_string(fptr); fd = fileno(fptr->f); - if (fileno(fptr->f) < 3) { + if (fd < 3) { /* need to keep stdio */ - dup2(fileno(orig->f), fd); + if (dup2(fileno(orig->f), fd) < 0) + rb_sys_fail(orig->path); } else { fclose(fptr->f); + if (dup2(fileno(orig->f), fd) < 0) + rb_sys_fail(orig->path); fptr->f = rb_fdopen(fd, mode); } @@ -1372,7 +1375,8 @@ io_reopen(io, nfile) fd = fileno(fptr->f2); fclose(fptr->f2); if (orig->f2) { - dup2(fileno(orig->f2), fd); + if (dup2(fileno(orig->f2), fd) < 0) + rb_sys_fail(orig->path); fptr->f2 = rb_fdopen(fd, "w"); } else { diff --git a/lib/find.rb b/lib/find.rb index 7a6dbce17a..3f1b82d2b3 100644 --- a/lib/find.rb +++ b/lib/find.rb @@ -1,5 +1,5 @@ # Usage: -# require "find.rb" +# require "find" # # Find.find('/foo','/bar') {|f| ...} # or diff --git a/lib/open3.rb b/lib/open3.rb new file mode 100644 index 0000000000..e8ba2783da --- /dev/null +++ b/lib/open3.rb @@ -0,0 +1,55 @@ +# Usage: +# require "open3" +# +# in, out, err = Open3.popen3('nroff -man') +# or +# include Open3 +# in, out, err = popen3('nroff -man') +# + +module Open3 + #[stdin, stdout, stderr] = popen3(command); + def popen3(cmd) + pw = pipe # pipe[0] for read, pipe[1] for write + pr = pipe + pe = pipe + + pid = fork + if pid == nil then # child + pw[1].close + STDIN.reopen(pw[0]) + pw[0].close + + pr[0].close + STDOUT.reopen(pr[1]) + pr[1].close + + pe[0].close + STDERR.reopen(pe[1]) + pe[1].close + + exec(cmd) + exit + else + pw[0].close + pr[1].close + pe[1].close + pi = [ pw[1], pr[0], pe[0] ] + end + end + module_function :popen3 +end + +if $0 == __FILE__ + a = Open3.popen3("nroff -man") + Thread.start do + while gets + a[0].print $_ + end + a[0].close + end + while a[1].gets + print ":", $_ + end +end + diff --git a/lib/shell.rb b/lib/shell.rb index 3d8dda0445..de6ee85be0 100644 --- a/lib/shell.rb +++ b/lib/shell.rb @@ -364,7 +364,8 @@ class Shell end end @system_commands[command] = FALSE - Shell.fail CommandNotFound, command +# Shell.fail CommandNotFound, command + raise CommandNotFound, command end # diff --git a/lib/telnet.rb b/lib/telnet.rb index 9c99e026d7..e5a8aa6b7b 100644 --- a/lib/telnet.rb +++ b/lib/telnet.rb @@ -1,8 +1,12 @@ # # telnet.rb -# ver0.14 1998/09/01 +# ver0.141 1998/09/22 # Wakou Aoyama <[email protected]> # +# ver0.141 1998/09/22 +# change default prompt +# /[$%#>] $/ --> /[$%#>] \Z/ +# # ver0.14 1998/09/01 # IAC WILL SGA send EOL --> CR+NULL # IAC WILL SGA IAC DO BIN send EOL --> CR @@ -34,7 +38,7 @@ # "Output_log" => "output_log", default: not output # "Dump_log" => "dump_log", default: not output # "Port" => 23, default: 23 -# "Prompt" => /[$%#>] $/, default: /[$%#>] $/ +# "Prompt" => /[$%#>] \Z/, default: /[$%#>] \Z/ # "Telnetmode" => TRUE, default: TRUE # "Timeout" => 10, default: 10 # "Waittime" => 0}) default: 0 @@ -60,13 +64,13 @@ # == send string and wait prompt # line = host.cmd("string") # line = host.cmd({"String" => "string", -# "Prompt" => /[$%#>] $//, +# "Prompt" => /[$%#>] \Z/, # "Timeout" => 10}) # # realtime output. of cource, set sync=TRUE or flush is necessary. # host.cmd("string"){|c| print c } # host.cmd({"String" => "string", -# "Prompt" => /[$%#>] $//, +# "Prompt" => /[$%#>] \Z/, # "Timeout" => 10}){|c| print c } # # == send string @@ -76,14 +80,14 @@ # host.login("username", "password") # host.login({"Name" => "username", # "Password" => "password", -# "Prompt" => /[$%#>] $/, +# "Prompt" => /[$%#>] \Z/, # "Timeout" => 10}) # # realtime output. of cource, set sync=TRUE or flush is necessary. # host.login("username", "password"){|c| print c } # host.login({"Name" => "username", # "Password" => "password", -# "Prompt" => /[$%#>] $/, +# "Prompt" => /[$%#>] \Z/, # "Timeout" => 10}){|c| print c } # # and Telnet object has socket class methods @@ -91,7 +95,7 @@ # == sample # localhost = Telnet.new({"Host" => "localhost", # "Timeout" => 10, -# "Prompt" => /[$%#>] $/}) +# "Prompt" => /[$%#>] \Z/}) # localhost.login("username", "password"){|c| print c } # localhost.cmd("command"){|c| print c } # localhost.close @@ -208,13 +212,13 @@ class Telnet < SimpleDelegator def initialize(options) @options = options - @options["Binmode"] = TRUE if not @options.include?("Binmode") - @options["Host"] = "localhost" if not @options.include?("Host") - @options["Port"] = 23 if not @options.include?("Port") - @options["Prompt"] = /[$%#>] $/ if not @options.include?("Prompt") - @options["Telnetmode"] = TRUE if not @options.include?("Telnetmode") - @options["Timeout"] = 10 if not @options.include?("Timeout") - @options["Waittime"] = 0 if not @options.include?("Waittime") + @options["Binmode"] = TRUE if not @options.include?("Binmode") + @options["Host"] = "localhost" if not @options.include?("Host") + @options["Port"] = 23 if not @options.include?("Port") + @options["Prompt"] = /[$%#>] \Z/ if not @options.include?("Prompt") + @options["Telnetmode"] = TRUE if not @options.include?("Telnetmode") + @options["Timeout"] = 10 if not @options.include?("Timeout") + @options["Waittime"] = 0 if not @options.include?("Waittime") @telnet_option = { "SGA" => FALSE, "BINARY" => FALSE } @@ -378,14 +382,14 @@ class Telnet < SimpleDelegator end if iterator? - line = waitfor(/login[: ]*$/){|c| yield c } + line = waitfor(/login[: ]*\Z/){|c| yield c } line.concat( cmd({"String" => username, - "Match" => /Password[: ]*$/}){|c| yield c } ) + "Match" => /Password[: ]*\Z/}){|c| yield c } ) line.concat( cmd(password){|c| yield c } ) else - line = waitfor(/login[: ]*$/) + line = waitfor(/login[: ]*\Z/) line.concat( cmd({"String" => username, - "Match" => /Password[: ]*$/}) ) + "Match" => /Password[: ]*\Z/}) ) line.concat( cmd(password) ) end line @@ -17,7 +17,7 @@ module TkComm Tk_WINDOWS = {} def error_at - frames = caller(1) + frames = caller() frames.delete_if do |c| c =~ %r!/tk(|core|thcore|canvas|text|entry|scrollbox)\.rb:\d+! end @@ -1575,7 +1575,11 @@ class TkObject<TkKernel when 1 configure name, args[0] when 0 - fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at + begin + cget name + rescue + fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at + end else fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at end diff --git a/lib/tkafter.rb b/lib/tkafter.rb index 23fc87dedb..be2e50ff3a 100644 --- a/lib/tkafter.rb +++ b/lib/tkafter.rb @@ -203,6 +203,7 @@ class TkAfter if !sleep == 'idle' && !sleep.kind_of?(Integer) fail format("%s need to be Integer", sleep.inspect) end + @init_sleep = sleep @init_proc = init_proc @init_args = init_args self diff --git a/lib/tkcanvas.rb b/lib/tkcanvas.rb index c4a7478c23..1cf24eeb7b 100644 --- a/lib/tkcanvas.rb +++ b/lib/tkcanvas.rb @@ -740,7 +740,7 @@ class TkImage<TkObject tk_call('image', 'type', @path) end def width - number(tk_call('image', 'height', @path)) + number(tk_call('image', 'width', @path)) end def TkImage.names @@ -178,9 +178,9 @@ static void top_local_setup(); %type <node> aref_args opt_block_arg block_arg %type <node> mrhs opt_list superclass iterator var_ref %type <node> f_arglist f_args f_optarg f_opt f_block_arg opt_f_block_arg -%type <node> array assoc_list assocs assoc undef_list +%type <node> array assoc_list assocs assoc undef_list backref %type <node> iter_var opt_iter_var iter_block iter_do_block -%type <node> mlhs mlhs_head mlhs_tail mlhs_basic mlhs_item lhs backref +%type <node> mlhs mlhs_head mlhs_tail mlhs_basic mlhs_entry mlhs_item lhs %type <id> variable symbol operation %type <id> cname fname op f_rest_arg %type <num> f_arg @@ -434,13 +434,13 @@ command_call : operation call_args } mlhs : mlhs_basic - | tLPAREN mlhs_item ')' + | tLPAREN mlhs_entry ')' { $$ = $2; } -mlhs_item : mlhs_basic - | tLPAREN mlhs_item ')' +mlhs_entry : mlhs_basic + | tLPAREN mlhs_entry ')' { $$ = NEW_MASGN(NEW_LIST($2), 0); } @@ -466,21 +466,22 @@ mlhs_basic : mlhs_head $$ = NEW_MASGN(0, $2); } -mlhs_head : lhs ',' - | tLPAREN mlhs_item ')' ',' +mlhs_item : lhs + | tLPAREN mlhs_entry ')' { $$ = $2; } -mlhs_tail : lhs +mlhs_head : mlhs_item ',' { - $$ = NEW_LIST($1); + $$ = $1; } - | tLPAREN mlhs_item ')' + +mlhs_tail : mlhs_item { - $$ = NEW_LIST($2); + $$ = NEW_LIST($1); } - | mlhs_tail ',' lhs + | mlhs_tail ',' mlhs_item { $$ = list_append($1, $3); } @@ -3013,7 +3014,7 @@ retry: } c = nextc(); } - if (c == '!' || c == '?') { + if ((c == '!' || c == '?') && is_identchar(tok()[0])) { tokadd(c); } else { @@ -3047,23 +3048,6 @@ retry: } } - if (lex_state == EXPR_FNAME) { - lex_state = EXPR_END; - if ((c = nextc()) == '=') { - tokadd(c); - } - else { - pushback(c); - } - } - else if (lex_state == EXPR_BEG || - lex_state == EXPR_DOT || - lex_state == EXPR_ARG){ - lex_state = EXPR_ARG; - } - else { - lex_state = EXPR_END; - } if (ISUPPER(tok()[0])) { result = tCONSTANT; } @@ -3071,6 +3055,23 @@ retry: result = tFID; } else { result = tIDENTIFIER; + if (lex_state == EXPR_FNAME) { + lex_state = EXPR_END; + if ((c = nextc()) == '=') { + tokadd(c); + } + else { + pushback(c); + } + } + } + if (lex_state == EXPR_BEG || + lex_state == EXPR_DOT || + lex_state == EXPR_ARG){ + lex_state = EXPR_ARG; + } + else { + lex_state = EXPR_END; } } tokfix(); @@ -3553,10 +3554,7 @@ attrset(recv, id, val) value_expr(recv); value_expr(val); - id &= ~ID_SCOPE_MASK; - id |= ID_ATTRSET; - - return NEW_CALL(recv, id, NEW_LIST(val)); + return NEW_CALL(recv, id_attrset(id), NEW_LIST(val)); } static void @@ -3565,10 +3563,10 @@ backref_error(node) { switch (nd_type(node)) { case NODE_NTH_REF: - yyerror("Can't set variable $%d", node->nd_nth); + Error("Can't set variable $%d", node->nd_nth); break; case NODE_BACK_REF: - yyerror("Can't set variable $%c", node->nd_nth); + Error("Can't set variable $%c", node->nd_nth); break; } } @@ -3969,7 +3967,7 @@ yywhile_loop(chop, split) eval_tree = NEW_OPT_N(eval_tree); } -static struct op_tbl rb_op_tbl[] = { +static struct op_tbl op_tbl[] = { tDOT2, "..", '+', "+", '-', "-", @@ -4015,14 +4013,14 @@ static struct op_tbl rb_op_tbl[] = { char *rb_id2name(); char *rb_class2name(); -static st_table *rb_symbol_tbl; - -#define sym_tbl rb_symbol_tbl +static st_table *sym_tbl; +static st_table *sym_rev_tbl; void Init_sym() { sym_tbl = st_init_strtable(); + sym_rev_tbl = st_init_numtable(); rb_global_variable((VALUE*)&cur_cref); rb_global_variable((VALUE*)&lex_lastline); } @@ -4038,8 +4036,7 @@ rb_intern(name) if (st_lookup(sym_tbl, name, &id)) return id; - id = ++last_id; - id <<= ID_SCOPE_SHIFT; + id = 0; switch (name[0]) { case '$': id |= ID_GLOBAL; @@ -4052,18 +4049,13 @@ rb_intern(name) /* operator */ int i; - id = 0; - for (i=0; rb_op_tbl[i].token; i++) { - if (*rb_op_tbl[i].name == *name && - strcmp(rb_op_tbl[i].name, name) == 0) { - id = rb_op_tbl[i].token; - break; + for (i=0; op_tbl[i].token; i++) { + if (*op_tbl[i].name == *name && + strcmp(op_tbl[i].name, name) == 0) { + id = op_tbl[i].token; + goto id_regist; } } - if (id == 0) { - NameError("Unknown operator `%s'", name); - } - break; } last = strlen(name)-1; @@ -4073,59 +4065,44 @@ rb_intern(name) strncpy(buf, name, last); buf[last] = '\0'; - id = rb_intern(buf); - id &= ~ID_SCOPE_MASK; - id |= ID_ATTRSET; + id = id_attrset(rb_intern(buf)); + goto id_regist; } else if (ISUPPER(name[0])) { - id |= ID_CONST; + id = ID_CONST; } else { - id |= ID_LOCAL; + id = ID_LOCAL; } break; } - st_add_direct(sym_tbl, strdup(name), id); + id |= ++last_id << ID_SCOPE_SHIFT; + id_regist: + name = strdup(name); + st_add_direct(sym_tbl, name, id); + st_add_direct(sym_rev_tbl, id, name); return id; } -struct find_ok { - ID id; - char *name; -}; - -static int -id_find(name, id1, ok) - char *name; - ID id1; - struct find_ok *ok; -{ - if (id1 == ok->id) { - ok->name = name; - return ST_STOP; - } - return ST_CONTINUE; -} - char * rb_id2name(id) ID id; { - struct find_ok ok; + char *name; if (id < LAST_TOKEN) { int i = 0; - for (i=0; rb_op_tbl[i].token; i++) { - if (rb_op_tbl[i].token == id) - return rb_op_tbl[i].name; + for (i=0; op_tbl[i].token; i++) { + if (op_tbl[i].token == id) + return op_tbl[i].name; } } - ok.name = 0; - ok.id = id; - st_foreach(sym_tbl, id_find, &ok); - if (!ok.name && is_attrset_id(id)) { + if (st_lookup(sym_rev_tbl, id, &name)) + return name; + + if (is_attrset_id(id)) { char *res; ID id2; @@ -4133,7 +4110,7 @@ rb_id2name(id) res = rb_id2name(id2); if (res) { - char *buf = ALLOCA_N(char,strlen(res)+2); + char *buf = ALLOCA_N(char, strlen(res)+2); strcpy(buf, res); strcat(buf, "="); @@ -4141,7 +4118,7 @@ rb_id2name(id) return rb_id2name(id); } } - return ok.name; + return 0; } int @@ -4160,23 +4137,6 @@ rb_is_instance_id(id) return FALSE; } -void -local_var_append(id) - ID id; -{ - struct local_vars tmp; - struct local_vars *save = lvtbl; - - if (the_scope->local_tbl) { - tmp.cnt = the_scope->local_tbl[0]; - tmp.tbl = the_scope->local_tbl; - lvtbl->dlev = 0; - } - lvtbl = &tmp; - local_cnt(id); - lvtbl = save; -} - static void special_local_set(c, val) char c; @@ -917,12 +917,12 @@ proc_setuid(obj, id) int uid; uid = NUM2INT(id); -#ifdef HAVE_SETRUID - setruid(uid); -#else #ifdef HAVE_SETREUID setreuid(uid, -1); #else +#ifdef HAVE_SETRUID + setruid(uid); +#else { if (geteuid() == uid) setuid(uid); @@ -865,7 +865,7 @@ calculate_must_string(start, end) char *start; char *end; { - int mcnt, mcnt2; + int mcnt; int max = 0; char *p = start; char *pend = end; @@ -925,8 +925,7 @@ calculate_must_string(start, end) p += mcnt; mcnt = EXTRACT_UNSIGNED_AND_INCR(p); while (mcnt--) { - EXTRACT_MBC_AND_INCR(p); - EXTRACT_MBC_AND_INCR(p); + p += 4; } break; @@ -1069,6 +1068,7 @@ re_compile_pattern(pattern, size, bufp) bufp->fastmap_accurate = 0; bufp->must = 0; bufp->must_skip = 0; + bufp->stclass = 0; /* Initialize the syntax table. */ init_syntax_once(); @@ -1585,23 +1585,22 @@ re_compile_pattern(pattern, size, bufp) if ((options ^ stackp[-1]) & RE_OPTION_IGNORECASE) { BUFPUSH((options&RE_OPTION_IGNORECASE)?casefold_off:casefold_on); } - options = *--stackp; - switch (c = *--stackp) { - case '(': - case ':': - pending_exact = 0; - if (fixup_alt_jump) - { /* Push a dummy failure point at the end of the - alternative for a possible future - `finalize_jump' to pop. See comments at - `push_dummy_failure' in `re_match'. */ - BUFPUSH(push_dummy_failure); + pending_exact = 0; + if (fixup_alt_jump) + { /* Push a dummy failure point at the end of the + alternative for a possible future + `finalize_jump' to pop. See comments at + `push_dummy_failure' in `re_match'. */ + BUFPUSH(push_dummy_failure); - /* We allocated space for this jump when we assigned - to `fixup_alt_jump', in the `handle_alt' case below. */ - store_jump(fixup_alt_jump, jump, b); - } - if (c == '(') { + /* We allocated space for this jump when we assigned + to `fixup_alt_jump', in the `handle_alt' case below. */ + store_jump(fixup_alt_jump, jump, b); + } + options = *--stackp; + switch (c = *--stackp) { + case '(': + { char *loc = bufp->buffer + *--stackp; *loc = regnum - stackp[-1]; BUFPUSH(stop_memory); @@ -2034,12 +2033,13 @@ re_compile_pattern(pattern, size, bufp) bufp->options |= RE_OPTIMIZE_ANCHOR; } else if (*laststart == charset || *laststart == charset_not) { - mcnt = *++laststart; - laststart += mcnt+1; - mcnt = EXTRACT_UNSIGNED_AND_INCR(laststart); - laststart += 4*mcnt; - if (*laststart == maybe_finalize_jump) { - bufp->options |= RE_OPTIMIZE_CCLASS; + p0 = laststart; + mcnt = *++p0 ; + p0 += mcnt+1; + mcnt = EXTRACT_UNSIGNED_AND_INCR(p0); + p0 += 4*mcnt; + if (*p0 == maybe_finalize_jump) { + bufp->stclass = laststart; } } } @@ -2331,9 +2331,7 @@ bm_search(little, llen, big, blen, skip, translate) int *skip; unsigned char *translate; { - int next[256]; int i, j, k; - unsigned char c; i = llen-1; if (translate) { @@ -2737,27 +2735,30 @@ re_search(bufp, string, size, startpos, range, regs) } if (bufp->must) { - int r = range; int len = ((unsigned char*)bufp->must)[0]; - int pos; + int pos, pbeg, pend; - if (range >= 0) { - r = 0; + pbeg = startpos; + pend = startpos + range; + if (pbeg > pend) { /* swap pbeg,pend */ + pos = pend; pend = pbeg; pbeg = pos; } + if (pend > size) pend = size; if (bufp->options & RE_OPTIMIZE_NO_BM) { pos = slow_search(bufp->must+1, len, - string+startpos, size-startpos-r, + string+pbeg, pend-pbeg, MAY_TRANSLATE()?translate:0); } else { pos = bm_search(bufp->must+1, len, - string+startpos, size-startpos-r, + string+pbeg, pend-pbeg, bufp->must_skip, MAY_TRANSLATE()?translate:0); } if (pos == -1) return -1; - if (bufp->options & RE_OPTIMIZE_EXACTN) { + if (range > 0 && (bufp->options & RE_OPTIMIZE_EXACTN)) { startpos += pos; + range -= pos; } } @@ -2826,29 +2827,33 @@ re_search(bufp, string, size, startpos, range, regs) #endif /* NO_ALLOCA */ if (range > 0) { - if (anchor && startpos < size && string[startpos-1] != '\n') { + if (anchor && startpos < size && startpos > 0 && string[startpos-1] != '\n') { while (range > 0 && string[startpos] != '\n') { range--; startpos++; } } - else if (fastmap && (bufp->options & RE_OPTIMIZE_CCLASS)) { - register unsigned char *p, c; + else if (fastmap && (bufp->stclass)) { + register unsigned char *p; + register unsigned short c; int irange = range; p = (unsigned char *)string+startpos; while (range > 0) { c = *p++; - if (ismbchar(c)) { - if (!fastmap[c]) break; - c = *p++; - range--; - if (fastmap[c] != 2) break; + if (ismbchar(c) && fastmap[c] != 2) { + c = c << 8 | *p++; + } + else if (MAY_TRANSLATE()) + c = translate[c]; + if (*bufp->stclass == charset) { + if (!is_in_list(c, bufp->stclass+1)) break; + } + else { + if (is_in_list(c, bufp->stclass+1)) break; } - else - if (!fastmap[MAY_TRANSLATE() ? translate[c] : c]) - break; range--; + if (c > 256) range--; } startpos += irange - range; } @@ -3022,9 +3027,6 @@ typedef union #define AT_STRINGS_BEG(d) (d == string) #define AT_STRINGS_END(d) (d == dend) -#define AT_WORD_BOUNDARY(d) \ - (AT_STRINGS_BEG(d) || AT_STRINGS_END(d) || IS_A_LETTER(d - 1) != IS_A_LETTER(d)) - /* We have two special cases to check for: 1) if we're past the end of string1, we have to look at the first character in string2; @@ -3751,12 +3753,28 @@ re_match(bufp, string_arg, size, pos, regs) continue; case wordbound: - if (AT_WORD_BOUNDARY(d)) + if (AT_STRINGS_BEG(d)) { + if (IS_A_LETTER(d)) break; + else goto fail; + } + if (AT_STRINGS_BEG(d)) { + if (IS_A_LETTER(d-1)) break; + else goto fail; + } + if (IS_A_LETTER(d - 1) != IS_A_LETTER(d)) break; goto fail; case notwordbound: - if (AT_WORD_BOUNDARY(d)) + if (AT_STRINGS_BEG(d)) { + if (IS_A_LETTER(d)) goto fail; + else break; + } + if (AT_STRINGS_END(d)) { + if (IS_A_LETTER(d-1)) goto fail; + else break; + } + if (IS_A_LETTER(d - 1) != IS_A_LETTER(d)) goto fail; break; @@ -169,8 +169,7 @@ extern long re_syntax_options; #define RE_MAY_IGNORECASE (1L<<2) #define RE_OPTIMIZE_ANCHOR (1L<<4) #define RE_OPTIMIZE_EXACTN (1L<<5) -#define RE_OPTIMIZE_CCLASS (1L<<6) -#define RE_OPTIMIZE_NO_BM (1L<<7) +#define RE_OPTIMIZE_NO_BM (1L<<6) /* For multi-byte char support */ #define MBCTYPE_ASCII 0 @@ -202,7 +201,8 @@ struct re_pattern_buffer to skip over totally implausible characters. */ char *must; /* Pointer to exact pattern which strings should have to be matched. */ - int *must_skip; /* Pointer to exact pattern skip table for bm_search */ + int *must_skip; /* Pointer to exact pattern skip table for bm_search */ + char *stclass; /* Pointer to character class list at top */ long options; /* Flags for options such as extended_pattern. */ long re_nsub; /* Number of subexpressions found by the compiler. */ char fastmap_accurate; @@ -2408,8 +2408,11 @@ scan_once(str, pat, start) if (reg_search(pat, str, *start, 0) >= 0) { match = backref_get(); regs = RMATCH(match)->regs; - if (END(0) == *start) { - *start = END(0)+1; + if (BEG(0) == END(0)) { + /* + * Always consume at least one character of the input string + */ + *start = END(0)+(ismbchar(RSTRING(str)->ptr[END(0)])?2:1); } else { *start = END(0); @@ -538,3 +538,255 @@ int main (int argc, char *argv[]) #endif #endif +/* mm.c */ + +static int mmkind, mmsize, high, low; + +#define A ((int*)a) +#define B ((int*)b) +#define C ((int*)c) +#define D ((int*)d) + +static void mmprepare(base, size) void *base; int size; +{ +#ifdef DEBUG + if (sizeof(int) != 4) die("sizeof(int) != 4"); + if (size <= 0) die("mmsize <= 0"); +#endif + + if ( ((int)base & (4-1)) == 0 && (size & (4-1)) == 0 ) + if (size >= 16) mmkind = 1; + else mmkind = 0; + else mmkind = -1; + + mmsize = size; + high = (size & (-16)); + low = (size & 0x0C ); +} + +static void mmswap(a, b) register char *a, *b; +{ + register int s; + if (a == b) return; + if (mmkind >= 0) { + if (mmkind > 0) { + register char *t = a + high; + do { + s = A[0]; A[0] = B[0]; B[0] = s; + s = A[1]; A[1] = B[1]; B[1] = s; + s = A[2]; A[2] = B[2]; B[2] = s; + s = A[3]; A[3] = B[3]; B[3] = s; a += 16; b += 16; + }while (a < t); + } + if (low != 0) { s = A[0]; A[0] = B[0]; B[0] = s; + if (low >= 8) { s = A[1]; A[1] = B[1]; B[1] = s; + if (low == 12) {s = A[2]; A[2] = B[2]; B[2] = s;}}} + }else{ + register char *t = a + mmsize; + do {s = *a; *a++ = *b; *b++ = s;} while (a < t); + } +} + +static void mmswapblock(a, b, size) register char *a, *b; int size; +{ + register int s; + if (mmkind >= 0) { + register char *t = a + (size & (-16)); register int lo = (size & 0x0C); + if (size >= 16) { + do { + s = A[0]; A[0] = B[0]; B[0] = s; + s = A[1]; A[1] = B[1]; B[1] = s; + s = A[2]; A[2] = B[2]; B[2] = s; + s = A[3]; A[3] = B[3]; B[3] = s; a += 16; b += 16; + }while (a < t); + } + if (lo != 0) { s = A[0]; A[0] = B[0]; B[0] = s; + if (lo >= 8) { s = A[1]; A[1] = B[1]; B[1] = s; + if (lo == 12) {s = A[2]; A[2] = B[2]; B[2] = s;}}} + }else{ + register char *t = a + size; + do {s = *a; *a++ = *b; *b++ = s;} while (a < t); + } +} + +static void mmrot3(a, b, c) register char *a, *b, *c; +{ + register int s; + if (mmkind >= 0) { + if (mmkind > 0) { + register char *t = a + high; + do { + s = A[0]; A[0] = B[0]; B[0] = C[0]; C[0] = s; + s = A[1]; A[1] = B[1]; B[1] = C[1]; C[1] = s; + s = A[2]; A[2] = B[2]; B[2] = C[2]; C[2] = s; + s = A[3]; A[3] = B[3]; B[3] = C[3]; C[3] = s; a += 16; b += 16; c += 16; + }while (a < t); + } + if (low != 0) { s = A[0]; A[0] = B[0]; B[0] = C[0]; C[0] = s; + if (low >= 8) { s = A[1]; A[1] = B[1]; B[1] = C[1]; C[1] = s; + if (low == 12) {s = A[2]; A[2] = B[2]; B[2] = C[2]; C[2] = s;}}} + }else{ + register char *t = a + mmsize; + do {s = *a; *a++ = *b; *b++ = *c; *c++ = s;} while (a < t); + } +} + +/* qs6.c */ +/*****************************************************/ +/* */ +/* qs6 (Quick sort function) */ +/* */ +/* by Tomoyuki Kawamura 1995.4.21 */ +/* [email protected] */ +/*****************************************************/ + +typedef struct { char *LL, *RR; } stack_node; /* Stack structure for L,l,R,r */ +#define PUSH(ll,rr) {top->LL = (ll); top->RR = (rr); ++top;} /* Push L,l,R,r */ +#define POP(ll,rr) {--top; ll = top->LL; rr = top->RR;} /* Pop L,l,R,r */ + +#define med3(a,b,c) ((*cmp)(a,b)<0 ? \ + ((*cmp)(b,c)<0 ? b : ((*cmp)(a,c)<0 ? c : a)) : \ + ((*cmp)(b,c)>0 ? b : ((*cmp)(a,c)<0 ? a : c)) ) + +void qsort (base, nel, size, cmp) void* base; size_t nel; size_t size; int (*cmp)(); +{ + register char *l, *r, *m; /* l,r:left,right group m:median point */ + register int t, eq_l, eq_r; /* eq_l: all items in left group are equal to S */ + char *L = base; /* left end of curren region */ + char *R = (char*)base + size*(nel-1); /* right end of current region */ + int chklim = 63; /* threshold of ordering element check */ + stack_node stack[32], *top = stack; /* 32 is enough for 32bit CPU */ + + if (nel <= 1) return; /* need not to sort */ + mmprepare( base, size ); + goto start; + + nxt: + if (stack == top) return; /* return if stack is empty */ + POP(L,R); + + for (;;) { + start: + if (L + size == R) {if ((*cmp)(L,R) > 0) mmswap(L,R); goto nxt;}/* 2 elements */ + + l = L; r = R; + t = (r - l + size) / size; /* number of elements */ + m = l + size * (t >> 1); /* calculate median value */ + + if (t >= 60) { + register char *m1; + register char *m3; + if (t >= 200) { + t = size*(t>>3); /* number of bytes in splitting 8 */ + { + register char *p1 = l + t; + register char *p2 = p1 + t; + register char *p3 = p2 + t; + m1 = med3( p1, p2, p3 ); + p1 = m + t; + p2 = p1 + t; + p3 = p2 + t; + m3 = med3( p1, p2, p3 ); + } + }else{ + t = size*(t>>2); /* number of bytes in splitting 4 */ + m1 = l + t; + m3 = m + t; + } + m = med3( m1, m, m3 ); + } + + if ((t = (*cmp)(l,m)) < 0) { /*3-5-?*/ + if ((t = (*cmp)(m,r)) < 0) { /*3-5-7*/ + if (chklim && nel >= chklim) { /* check if already ascending order */ + char *p; + chklim = 0; + for (p=l; p<r; p+=size) if ((*cmp)(p,p+size) > 0) goto fail; + goto nxt; + } + fail: goto loopA; /*3-5-7*/ + } + if (t > 0) { + if ((*cmp)(l,r) <= 0) {mmswap(m,r); goto loopA;} /*3-5-4*/ + mmrot3(r,m,l); goto loopA; /*3-5-2*/ + } + goto loopB; /*3-5-5*/ + } + + if (t > 0) { /*7-5-?*/ + if ((t = (*cmp)(m,r)) > 0) { /*7-5-3*/ + if (chklim && nel >= chklim) { /* check if already ascending order */ + char *p; + chklim = 0; + for (p=l; p<r; p+=size) if ((*cmp)(p,p+size) < 0) goto fail2; + while (l<r) {mmswap(l,r); l+=size; r-=size;} /* reverse region */ + goto nxt; + } + fail2: mmswap(l,r); goto loopA; /*7-5-3*/ + } + if (t < 0) { + if ((*cmp)(l,r) <= 0) {mmswap(l,m); goto loopB;} /*7-5-8*/ + mmrot3(l,m,r); goto loopA; /*7-5-6*/ + } + mmswap(l,r); goto loopA; /*7-5-5*/ + } + + if ((t = (*cmp)(m,r)) < 0) {goto loopA;} /*5-5-7*/ + if (t > 0) {mmswap(l,r); goto loopB;} /*5-5-3*/ + + /* deteming splitting type in case 5-5-5 */ /*5-5-5*/ + for (;;) { + if ((l += size) == r) goto nxt; /*5-5-5*/ + if (l == m) continue; + if ((t = (*cmp)(l,m)) > 0) {mmswap(l,r); l = L; goto loopA;} /*575-5*/ + if (t < 0) {mmswap(L,l); l = L; goto loopB;} /*535-5*/ + } + + loopA: eq_l = 1; eq_r = 1; /* splitting type A */ /* left <= median < right��*/ + for (;;) { + for (;;) { + if ((l += size) == r) + {l -= size; if (l != m) mmswap(m,l); l -= size; goto fin;} + if (l == m) continue; + if ((t = (*cmp)(l,m)) > 0) {eq_r = 0; break;} + if (t < 0) eq_l = 0; + } + for (;;) { + if (l == (r -= size)) + {l -= size; if (l != m) mmswap(m,l); l -= size; goto fin;} + if (r == m) {m = l; break;} + if ((t = (*cmp)(r,m)) < 0) {eq_l = 0; break;} + if (t == 0) break; + } + mmswap(l,r); /* swap left and right */ + } + + loopB: eq_l = 1; eq_r = 1; /* splitting type B */ /* left < median <= right */ + for (;;) { + for (;;) { + if (l == (r -= size)) + {r += size; if (r != m) mmswap(r,m); r += size; goto fin;} + if (r == m) continue; + if ((t = (*cmp)(r,m)) < 0) {eq_l = 0; break;} + if (t > 0) eq_r = 0; + } + for (;;) { + if ((l += size) == r) + {r += size; if (r != m) mmswap(r,m); r += size; goto fin;} + if (l == m) {m = r; break;} + if ((t = (*cmp)(l,m)) > 0) {eq_r = 0; break;} + if (t == 0) break; + } + mmswap(l,r); /* swap left and right */ + } + + fin: + if (eq_l == 0) /* need to sort left side */ + if (eq_r == 0) /* need to sort right side */ + if (l-L < R-r) {PUSH(r,R); R = l;} /* sort left side first */ + else {PUSH(L,l); L = r;} /* sort right side first */ + else R = l; /* need to sort left side only */ + else if (eq_r == 0) L = r; /* need to sort right side only */ + else goto nxt; /* need not to sort both sides */ + } +} @@ -1,2 +1,2 @@ -#define RUBY_VERSION "1.1c5" -#define VERSION_DATE "98/09/08" +#define RUBY_VERSION "1.1c6" +#define VERSION_DATE "98/10/05" |