summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-10-06 03:28:28 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-10-06 03:28:28 +0000
commit75ff8fdb16fa0a733512e61350c9844ea530ad35 (patch)
treea057e60543c77d6e20ea2e91928928df80b2b6d3
parent5d71c8d89c6bd7af934e7a8de5882cda2991711b (diff)
join 1.1c6
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1dev@310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog96
-rw-r--r--MANIFEST3
-rw-r--r--array.c2
-rw-r--r--class.c8
-rw-r--r--configure577
-rw-r--r--configure.in24
-rw-r--r--dln.c10
-rw-r--r--error.c2
-rw-r--r--eval.c245
-rw-r--r--ext/aix_ld.rb2
-rw-r--r--ext/dbm/dbm.c9
-rw-r--r--ext/etc/etc.c5
-rw-r--r--ext/etc/extconf.rb23
-rw-r--r--ext/extmk.rb.in60
-rw-r--r--ext/gtk/MANIFEST1
-rw-r--r--ext/gtk/extconf.rb12
-rw-r--r--ext/gtk/gtk.c616
-rw-r--r--ext/kconv/kconv.c9
-rw-r--r--ext/socket/socket.c86
-rw-r--r--ext/tcltklib/extconf.rb11
-rw-r--r--ext/tcltklib/tcltklib.c4
-rw-r--r--file.c10
-rw-r--r--gc.c62
-rw-r--r--hash.c9
-rw-r--r--inits.c2
-rw-r--r--instruby.rb1
-rw-r--r--intern.h16
-rw-r--r--io.c145
-rw-r--r--lib/find.rb2
-rw-r--r--lib/jcode.rb10
-rw-r--r--lib/mkmf.rb23
-rw-r--r--lib/open3.rb55
-rw-r--r--lib/pstore.rb9
-rw-r--r--lib/shell.rb21
-rw-r--r--lib/telnet.rb40
-rw-r--r--lib/thwait.rb2
-rw-r--r--lib/tk.rb8
-rw-r--r--lib/tkafter.rb1
-rw-r--r--lib/tkcanvas.rb7
-rw-r--r--marshal.c2
-rw-r--r--missing/nt.c4
-rw-r--r--node.h5
-rw-r--r--numeric.c9
-rw-r--r--parse.y119
-rw-r--r--process.c24
-rw-r--r--regex.c121
-rw-r--r--regex.h6
-rw-r--r--ruby.1121
-rw-r--r--ruby.c4
-rw-r--r--ruby.h9
-rw-r--r--rubysig.h2
-rw-r--r--signal.c4
-rw-r--r--string.c106
-rw-r--r--util.c26
-rw-r--r--util.h17
-rw-r--r--variable.c7
-rw-r--r--version.h4
57 files changed, 1809 insertions, 1009 deletions
diff --git a/ChangeLog b/ChangeLog
index b58806c..55e65fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,88 @@
+Mon Oct 5 18:31:53 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c6 released.
+
+Fri Oct 2 14:22:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): `/\s*(--)$/ =~ "- --"' did not match,
+ because of wrong optimize condition.
+
+Thu Oct 1 01:55:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * 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.
+
+Wed Sep 30 14:13:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_start): supports making a subclass of the
+ Thread class.
+
+Tue Sep 29 17:46:01 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_join): join is now an instance method.
+
+Fri Sep 25 12:01:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): `@foo!' should be an error.
+
+Thu Sep 24 14:55:06 1998 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * ext/etc/etc.c (Init_etc): wrong field definition.
+
+Thu Sep 17 17:09:05 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_reopen): was creating FILE* for wrong fd.
+
+Tue Sep 15 05:28:11 1998 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * regex.c (re_compile_pattern): forgot to fixup for the pattern
+ like (?=(A)|(B)).
+
+Tue Sep 15 01:06:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_gets_internal): do not set $_ by default, only
+ gets/readline set the variable.
+
+ * eval.c (rb_f_load): load toplevel class is set to anonymous
+ module if safe_level >= 5, to encapsulate modification.
+
+ * eval.c (rb_f_load): set frame properly.
+
+ * string.c (rb_str_each_line): do not set $_.
+
+Mon Sep 14 14:42:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * 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 <JCA02266@nifty.ne.jp>
+
+ * regex.c (re_search): range value should be maintained.
+
+Thu Sep 10 10:55:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (backref_error): yyerror does not understand formats.
+
+Tue Sep 8 18:05:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c5 released.
+
+Tue Sep 8 10:03:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_each_line): wrong line splitting with newline at
+ top of the string.
+
+ * string.c: non bang methods return copied string.
+
+ * eval.c (f_END): needed to initialize frame->argc;
+
Tue Sep 8 01:42:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* enum.c (Init_Enumerable): Enumerable#reverse removed.
@@ -6,15 +91,11 @@ Tue Sep 8 01:42:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (rb_call0): ditto.
-Thu Sep 3 16:34:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Sep 4 11:27:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* bignum.c (bigadd): proper sign combination.
- * eval.c (dvar_asgn_push): modify calling block to create dvar,
- not insert it next to dummy dvar slot.
-
- * eval.c (eval): save calling block in (thread local) global
- variable. no dummy dvar slot is generated by yield.
+ * regex.c (re_search): wrong return value for \A.
Thu Sep 3 14:08:14 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
@@ -22,6 +103,9 @@ Thu Sep 3 14:08:14 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
Tue Sep 1 10:47:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * regex.c (slow_search): do not compare llen and blen. llen may
+ be longer than blen, if little contains 0xff.
+
* regex.c (mbctab_euc): set 0x8e as multibyte character.
* string.c (str_inspect): mask character for octal output.
diff --git a/MANIFEST b/MANIFEST
index cedd15f..c265be1 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -109,14 +109,15 @@ 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
lib/ping.rb
+lib/profile.rb
lib/pstore.rb
lib/rational.rb
lib/readbytes.rb
-lib/shell.rb
lib/shellwords.rb
lib/singleton.rb
lib/sync.rb
diff --git a/array.c b/array.c
index ce4553b..9c75427 100644
--- a/array.c
+++ b/array.c
@@ -11,6 +11,7 @@
************************************************/
#include "ruby.h"
+#include "util.h"
VALUE rb_cArray;
@@ -44,7 +45,6 @@ static void
rb_ary_modify(ary)
VALUE ary;
{
- rb_secure(5);
if (FL_TEST(ary, ARY_FREEZE|ARY_TMPLOCK)) {
rb_raise(rb_eTypeError, "can't modify frozen array");
}
diff --git a/class.c b/class.c
index 3ad4dba..904387f 100644
--- a/class.c
+++ b/class.c
@@ -153,9 +153,9 @@ VALUE
rb_define_module_id(id)
ID id;
{
- extern st_table *rb_class_tbl;
- VALUE mdl = rb_module_new();
+ VALUE mdl;
+ mdl = rb_module_new();
rb_name_class(mdl, id);
return mdl;
@@ -192,7 +192,7 @@ rb_define_module_under(outer, name)
}
static VALUE
-include_rb_class_new(module, super)
+include_class_new(module, super)
VALUE module, super;
{
NEWOBJ(klass, struct RClass);
@@ -241,7 +241,7 @@ rb_include_module(klass, module)
}
}
RCLASS(klass)->super =
- include_rb_class_new(module, RCLASS(klass)->super);
+ include_class_new(module, RCLASS(klass)->super);
klass = RCLASS(klass)->super;
module = RCLASS(module)->super;
}
diff --git a/configure b/configure
index e23cc9c..d7b6645 100644
--- a/configure
+++ b/configure
@@ -562,7 +562,7 @@ fi
if test $rb_thread = yes; then
cat >> confdefs.h <<\EOF
-#define THREAD 1
+#define USE_THREAD 1
EOF
fi
@@ -1050,8 +1050,68 @@ test -n "$AR" && break
done
test -n "$AR" || AR="ar"
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1065: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ for ac_prog in ginstall installbsd scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ # OSF/1 installbsd also uses dspmsg, but is usable.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1055: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1115: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1081,17 +1141,17 @@ fi
# checks for UNIX variants that set C preprocessor variables
ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:1085: checking for minix/config.h" >&5
+echo "configure:1145: checking for minix/config.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 1090 "configure"
+#line 1150 "configure"
#include "confdefs.h"
#include <minix/config.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1095: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1130,7 +1190,7 @@ fi
echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:1134: checking size of int" >&5
+echo "configure:1194: checking size of int" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1138,7 +1198,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1142 "configure"
+#line 1202 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1149,7 +1209,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int=`cat conftestval`
else
@@ -1169,7 +1229,7 @@ EOF
echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:1173: checking size of long" >&5
+echo "configure:1233: checking size of long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1177,7 +1237,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1181 "configure"
+#line 1241 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1188,7 +1248,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long=`cat conftestval`
else
@@ -1208,7 +1268,7 @@ EOF
echo $ac_n "checking size of void*""... $ac_c" 1>&6
-echo "configure:1212: checking size of void*" >&5
+echo "configure:1272: checking size of void*" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1216,7 +1276,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1220 "configure"
+#line 1280 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1227,7 +1287,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_voidp=`cat conftestval`
else
@@ -1248,19 +1308,19 @@ EOF
echo $ac_n "checking for prototypes""... $ac_c" 1>&6
-echo "configure:1252: checking for prototypes" >&5
+echo "configure:1312: checking for prototypes" >&5
if eval "test \"`echo '$''{'rb_cv_have_prototypes'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1257 "configure"
+#line 1317 "configure"
#include "confdefs.h"
int foo(int x) { return 0; }
int main() {
return foo(10);
; return 0; }
EOF
-if { (eval echo configure:1264: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_have_prototypes=yes
else
@@ -1281,12 +1341,12 @@ EOF
fi
echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6
-echo "configure:1285: checking for variable length prototypes and stdarg.h" >&5
+echo "configure:1345: checking for variable length prototypes and stdarg.h" >&5
if eval "test \"`echo '$''{'rb_cv_stdarg'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1290 "configure"
+#line 1350 "configure"
#include "confdefs.h"
#include <stdarg.h>
@@ -1303,7 +1363,7 @@ int main() {
return foo(10, "", 3.14);
; return 0; }
EOF
-if { (eval echo configure:1307: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1367: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_stdarg=yes
else
@@ -1324,19 +1384,19 @@ EOF
fi
echo $ac_n "checking for gcc attribute noreturn""... $ac_c" 1>&6
-echo "configure:1328: checking for gcc attribute noreturn" >&5
+echo "configure:1388: checking for gcc attribute noreturn" >&5
if eval "test \"`echo '$''{'rb_cv_have_attr_noreturn'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1333 "configure"
+#line 1393 "configure"
#include "confdefs.h"
void exit(int x) __attribute__ ((noreturn));
int main() {
; return 0; }
EOF
-if { (eval echo configure:1340: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1400: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_have_attr_noreturn=yes
else
@@ -1365,7 +1425,7 @@ beos*) ;;
*) LIBS="-lm $LIBS";;
esac
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:1369: checking for crypt in -lcrypt" >&5
+echo "configure:1429: checking for crypt in -lcrypt" >&5
ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1373,7 +1433,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcrypt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1377 "configure"
+#line 1437 "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
@@ -1384,7 +1444,7 @@ int main() {
crypt()
; return 0; }
EOF
-if { (eval echo configure:1388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1448: \"$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
@@ -1412,7 +1472,7 @@ else
fi
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:1416: checking for dlopen in -ldl" >&5
+echo "configure:1476: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1420,7 +1480,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1424 "configure"
+#line 1484 "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
@@ -1431,7 +1491,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:1435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1495: \"$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
@@ -1459,7 +1519,7 @@ else
fi
# Dynamic linking for SunOS/Solaris and SYSV
echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:1463: checking for shl_load in -ldld" >&5
+echo "configure:1523: checking for shl_load in -ldld" >&5
ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1467,7 +1527,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1471 "configure"
+#line 1531 "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
@@ -1478,7 +1538,7 @@ int main() {
shl_load()
; return 0; }
EOF
-if { (eval echo configure:1482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1542: \"$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
@@ -1505,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:1515: 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 1520 "configure"
+#line 1627 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -1524,7 +1631,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:1528: \"$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
@@ -1549,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:1553: 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
@@ -1557,7 +1664,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1561 "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
@@ -1568,7 +1675,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:1572: \"$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
@@ -1590,7 +1697,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:1594: 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
@@ -1598,7 +1705,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1602 "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
@@ -1609,7 +1716,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:1613: \"$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
@@ -1632,12 +1739,12 @@ fi
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1636: 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 1641 "configure"
+#line 1748 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1645,7 +1752,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1649: \"$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*
@@ -1662,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 1666 "configure"
+#line 1773 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1680,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 1684 "configure"
+#line 1791 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1701,7 +1808,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1705 "configure"
+#line 1812 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1712,7 +1819,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1716: \"$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
@@ -1741,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:1745: 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 1750 "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:1755: \"$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*
@@ -1779,12 +1886,12 @@ done
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:1783: 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 1788 "configure"
+#line 1895 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -1813,12 +1920,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1817: 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 1822 "configure"
+#line 1929 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1846,12 +1953,12 @@ EOF
fi
echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:1850: 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 1855 "configure"
+#line 1962 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -1859,7 +1966,7 @@ int main() {
struct stat s; s.st_blksize;
; return 0; }
EOF
-if { (eval echo configure:1863: \"$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
@@ -1881,12 +1988,12 @@ fi
save_LIBOJBS="$LIBOBJS"
echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6
-echo "configure:1885: 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 1890 "configure"
+#line 1997 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -1894,7 +2001,7 @@ int main() {
struct stat s; s.st_blocks;
; return 0; }
EOF
-if { (eval echo configure:1898: \"$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
@@ -1918,12 +2025,12 @@ fi
LIBOBJS="$save_LIBOBJS"
echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
-echo "configure:1922: 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 1927 "configure"
+#line 2034 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -1931,7 +2038,7 @@ int main() {
struct stat s; s.st_rdev;
; return 0; }
EOF
-if { (eval echo configure:1935: \"$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
@@ -1953,7 +2060,7 @@ fi
echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:1957: 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
@@ -1961,7 +2068,7 @@ else
ac_cv_type_getgroups=cross
else
cat > conftest.$ac_ext <<EOF
-#line 1965 "configure"
+#line 2072 "configure"
#include "confdefs.h"
/* Thanks to Mike Rendell for this test. */
@@ -1986,7 +2093,7 @@ main()
}
EOF
-if { (eval echo configure:1990: \"$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
@@ -2000,7 +2107,7 @@ fi
if test $ac_cv_type_getgroups = cross; then
cat > conftest.$ac_ext <<EOF
-#line 2004 "configure"
+#line 2111 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -2024,12 +2131,12 @@ EOF
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2028: 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 2033 "configure"
+#line 2140 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -2046,7 +2153,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:2050: \"$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
@@ -2067,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:2071: 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 2076 "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:2083: \"$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
@@ -2100,12 +2207,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2104: 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 2109 "configure"
+#line 2216 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -2128,7 +2235,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:2132: \"$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
@@ -2160,12 +2267,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2164: 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 2169 "configure"
+#line 2276 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -2190,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:2194: 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 2199 "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. */
@@ -2218,7 +2325,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2222: \"$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
@@ -2245,7 +2352,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2249: 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
@@ -2253,7 +2360,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 2257 "configure"
+#line 2364 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -2272,7 +2379,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:2276: \"$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
@@ -2294,12 +2401,12 @@ EOF
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:2298: 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 2303 "configure"
+#line 2410 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2328,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:2332: 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 2337 "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:2342: \"$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*
@@ -2363,18 +2470,18 @@ else
fi
echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:2367: 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:2373: 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 2378 "configure"
+#line 2485 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vfork(); below. */
@@ -2397,7 +2504,7 @@ vfork();
; return 0; }
EOF
-if { (eval echo configure:2401: \"$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
@@ -2418,7 +2525,7 @@ fi
else
cat > conftest.$ac_ext <<EOF
-#line 2422 "configure"
+#line 2529 "configure"
#include "confdefs.h"
/* Thanks to Paul Eggert for this test. */
#include <stdio.h>
@@ -2513,7 +2620,7 @@ main() {
}
}
EOF
-if { (eval echo configure:2517: \"$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
@@ -2536,7 +2643,7 @@ EOF
fi
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:2540: 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
@@ -2544,7 +2651,7 @@ else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
-#line 2548 "configure"
+#line 2655 "configure"
#include "confdefs.h"
main()
@@ -2554,7 +2661,7 @@ main()
}
EOF
-if { (eval echo configure:2558: \"$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
@@ -2575,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:2579: 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 2584 "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. */
@@ -2603,7 +2710,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2607: \"$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
@@ -2636,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:2640: 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 2645 "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. */
@@ -2664,7 +2771,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2668: \"$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
@@ -2690,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:2694: 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 2699 "configure"
+#line 2806 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -2703,7 +2810,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:2707: \"$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
@@ -2724,12 +2831,12 @@ EOF
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:2728: 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 2733 "configure"
+#line 2840 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
@@ -2737,7 +2844,7 @@ int main() {
struct tm tm; tm.tm_zone;
; return 0; }
EOF
-if { (eval echo configure:2741: \"$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
@@ -2757,12 +2864,12 @@ EOF
else
echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:2761: 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 2766 "configure"
+#line 2873 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
@@ -2772,7 +2879,7 @@ int main() {
atoi(*tzname);
; return 0; }
EOF
-if { (eval echo configure:2776: \"$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
@@ -2794,14 +2901,14 @@ EOF
fi
cat > conftest.$ac_ext <<EOF
-#line 2798 "configure"
+#line 2905 "configure"
#include "confdefs.h"
int main() {
extern int daylight; int i = daylight;
; return 0; }
EOF
-if { (eval echo configure:2805: \"$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
@@ -2821,7 +2928,7 @@ EOF
else
echo $ac_n "checking for BSD signal semantics""... $ac_c" 1>&6
-echo "configure:2825: 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
@@ -2829,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 2833 "configure"
+#line 2940 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2851,7 +2958,7 @@ main()
}
EOF
-if { (eval echo configure:2855: \"$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
@@ -2885,19 +2992,19 @@ EOF
else
echo $ac_n "checking whether getpgrp() has arg""... $ac_c" 1>&6
-echo "configure:2889: 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 2894 "configure"
+#line 3001 "configure"
#include "confdefs.h"
#include <unistd.h>
int main() {
getpgrp(0);
; return 0; }
EOF
-if { (eval echo configure:2901: \"$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
@@ -2918,19 +3025,19 @@ EOF
fi
echo $ac_n "checking whether setpgrp() has args""... $ac_c" 1>&6
-echo "configure:2922: 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 2927 "configure"
+#line 3034 "configure"
#include "confdefs.h"
#include <unistd.h>
int main() {
setpgrp(1, 1);
; return 0; }
EOF
-if { (eval echo configure:2934: \"$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
@@ -2952,14 +3059,14 @@ EOF
fi
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:2956: 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 2963 "configure"
+#line 3070 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -2970,11 +3077,11 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:2974: \"$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 2978 "configure"
+#line 3085 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -2985,7 +3092,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:2989: \"$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
@@ -3005,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 3009 "configure"
+#line 3116 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -3018,7 +3125,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:3022: \"$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
@@ -3042,14 +3149,14 @@ EOF
fi
echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:3046: 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 3053 "configure"
+#line 3160 "configure"
#include "confdefs.h"
#ifdef __CHAR_UNSIGNED__
yes
@@ -3071,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 3075 "configure"
+#line 3182 "configure"
#include "confdefs.h"
/* volatile prevents gcc2 from optimizing the test away on sparcs. */
#if !defined(__STDC__) || __STDC__ != 1
@@ -3081,7 +3188,7 @@ main() {
volatile char c = 255; exit(c < 0);
}
EOF
-if { (eval echo configure:3085: \"$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
@@ -3106,7 +3213,7 @@ fi
echo $ac_n "checking whether right shift preserve sign bit""... $ac_c" 1>&6
-echo "configure:3110: 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
@@ -3114,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 3118 "configure"
+#line 3225 "configure"
#include "confdefs.h"
int
@@ -3126,7 +3233,7 @@ main()
}
EOF
-if { (eval echo configure:3130: \"$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
@@ -3154,19 +3261,19 @@ EOF
fi
echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6
-echo "configure:3158: 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 3163 "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:3170: \"$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
@@ -3176,14 +3283,14 @@ fi
rm -f conftest*
if test "$rb_cv_fcnt" = ""; then
cat > conftest.$ac_ext <<EOF
-#line 3180 "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:3187: \"$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
@@ -3194,14 +3301,14 @@ rm -f conftest*
fi
if test "$rb_cv_fcnt" = ""; then
cat > conftest.$ac_ext <<EOF
-#line 3198 "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:3205: \"$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
@@ -3212,14 +3319,14 @@ rm -f conftest*
fi
if test "$rb_cv_fcnt" = ""; then
cat > conftest.$ac_ext <<EOF
-#line 3216 "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:3223: \"$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
@@ -3242,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:3248: checking struct passwd" >&5
- cat > conftest.$ac_ext <<EOF
-#line 3250 "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 3265 "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 3280 "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 3295 "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 3310 "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 3325 "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 3340 "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"
@@ -3369,7 +3365,7 @@ fi
case "$host_os" in
linux*)
echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6
-echo "configure:3373: 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
@@ -3377,7 +3373,7 @@ else
:
else
cat > conftest.$ac_ext <<EOF
-#line 3381 "configure"
+#line 3377 "configure"
#include "confdefs.h"
/* Test for whether ELF binaries are produced */
@@ -3397,7 +3393,7 @@ main() {
}
EOF
-if { (eval echo configure:3401: \"$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
@@ -3427,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:3431: 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
@@ -3496,6 +3493,7 @@ echo "configure:3431: 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
@@ -3505,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:3509: 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 3515 "configure"
+#line 3513 "configure"
#include "confdefs.h"
#define USE_DLN_A_OUT
@@ -3521,7 +3519,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:3525: \"$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
@@ -3578,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"
@@ -3618,7 +3621,7 @@ fi
case "$host_os" in
human*)
echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6
-echo "configure:3622: 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
@@ -3626,7 +3629,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsignal $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3630 "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
@@ -3637,7 +3640,7 @@ int main() {
_harderr()
; return 0; }
EOF
-if { (eval echo configure:3641: \"$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
@@ -3665,7 +3668,7 @@ else
fi
echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6
-echo "configure:3669: 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
@@ -3673,7 +3676,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lhmem $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3677 "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
@@ -3684,7 +3687,7 @@ int main() {
hmemset()
; return 0; }
EOF
-if { (eval echo configure:3688: \"$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
@@ -3714,12 +3717,12 @@ fi
for ac_func in select
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3718: 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 3723 "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. */
@@ -3742,7 +3745,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3746: \"$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
@@ -3767,7 +3770,7 @@ fi
done
echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6
-echo "configure:3771: 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
@@ -3775,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 3779 "configure"
+#line 3782 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -3787,7 +3790,7 @@ main ()
}
EOF
-if { (eval echo configure:3791: \"$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
@@ -3809,7 +3812,7 @@ EOF
fi
echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6
-echo "configure:3813: 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
@@ -3817,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 3821 "configure"
+#line 3824 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -3830,7 +3833,7 @@ main ()
}
EOF
-if { (eval echo configure:3834: \"$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
@@ -3856,6 +3859,10 @@ EOF
binsuffix=.x
setup=Setup.x68
;;
+ cygwin32*)
+ binsuffix=.exe
+ setup=Setup
+ ;;
*)
binsuffix=
setup=Setup
@@ -4092,6 +4099,7 @@ do
done
ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile ext/extmk.rb" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
@@ -4133,6 +4141,8 @@ s%@CPP@%$CPP%g
s%@YACC@%$YACC%g
s%@RANLIB@%$RANLIB%g
s%@AR@%$AR%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@SET_MAKE@%$SET_MAKE%g
s%@LIBOBJS@%$LIBOBJS%g
s%@ALLOCA@%$ALLOCA%g
@@ -4225,6 +4235,10 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
echo creating "$ac_file"
rm -f "$ac_file"
@@ -4240,6 +4254,7 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*
diff --git a/configure.in b/configure.in
index ab5ef90..6d89c58 100644
--- a/configure.in
+++ b/configure.in
@@ -24,7 +24,7 @@ AC_ARG_ENABLE(thread, [--disable-thread never use user-level thread], [
rb_thread=$enableval
])
if test $rb_thread = yes; then
- AC_DEFINE(THREAD)
+ AC_DEFINE(USE_THREAD)
fi
AC_CANONICAL_HOST
@@ -72,6 +72,7 @@ AC_PROG_YACC
AC_PROG_RANLIB
AC_SUBST(AR)
AC_CHECK_PROGS(AR, ar aal, ar)
+AC_PROG_INSTALL
AC_PROG_MAKE_SET
# checks for UNIX variants that set C preprocessor variables
@@ -133,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
@@ -273,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
@@ -343,6 +333,7 @@ if test "$with_dln_a_out" != yes; then
openstep*) ;;
rhapsody*) ;;
human*) ;;
+ cygwin32*) CCDLFLAGS=-DDLLIMPORT;;
*) CCDLFLAGS=-fpic;;
esac
else
@@ -405,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)
@@ -450,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
@@ -532,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
diff --git a/dln.c b/dln.c
index a52b9c6..dc66b53 100644
--- a/dln.c
+++ b/dln.c
@@ -72,7 +72,7 @@ char *getenv();
int eaccess();
-#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT)
+#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(__CYGWIN32__) && !defined(_AIX)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#endif
@@ -1081,7 +1081,7 @@ dln_sym(name)
#include "dl.h"
#endif
-#ifdef _AIX
+#if defined(_AIX)
#include <ctype.h> /* for isdigit() */
#include <errno.h> /* for global errno */
#include <sys/ldr.h>
@@ -1143,7 +1143,7 @@ dln_strerror()
}
-#ifdef _AIX
+#if defined(_AIX)
static void
aix_loaderror(char *pathname)
{
@@ -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;
}
@@ -1296,7 +1296,7 @@ dln_load(file)
}
#endif /* hpux */
-#ifdef _AIX
+#if defined(_AIX)
#define DLN_DEFINED
{
void (*init_fct)();
diff --git a/error.c b/error.c
index a7f8ac8..bec8feb 100644
--- a/error.c
+++ b/error.c
@@ -239,7 +239,7 @@ VALUE
rb_exc_new(etype, ptr, len)
VALUE etype;
char *ptr;
- unsigned len;
+ int len;
{
VALUE exc = rb_obj_alloc(etype);
diff --git a/eval.c b/eval.c
index c0a69bf..4e6f8d2 100644
--- a/eval.c
+++ b/eval.c
@@ -70,9 +70,9 @@ static int scope_vmode;
#define SCOPE_SET(f) do {scope_vmode=(f);} while(0)
#define SCOPE_TEST(f) (scope_vmode&(f))
-#define CACHE_SIZE 0x200
-#define CACHE_MASK 0x1ff
-#define EXPR1(c,m) ((((int)(c)>>3)^(m))&CACHE_MASK)
+#define CACHE_SIZE 0x800
+#define CACHE_MASK 0x7ff
+#define EXPR1(c,m) ((((long)(c)>>4)^(m))&CACHE_MASK)
struct cache_entry { /* method hash table. */
ID mid; /* method's id */
@@ -97,6 +97,22 @@ rb_clear_cache()
}
}
+static int cache_conflict;
+
+static int
+count_cent()
+{
+ struct cache_entry *ent, *end;
+ int n = 0;
+
+ ent = cache; end = ent + CACHE_SIZE;
+ while (ent < end) {
+ if (ent->mid != 0) n++;
+ ent++;
+ }
+ return n;
+}
+
static void
rb_clear_cache_by_id(id)
ID id;
@@ -122,6 +138,9 @@ rb_add_method(klass, mid, node, noex)
NODE *body;
if (NIL_P(klass)) klass = rb_cObject;
+ if (klass == rb_cObject) {
+ rb_secure(4);
+ }
body = NEW_METHOD(node, noex);
st_insert(RCLASS(klass)->m_tbl, mid, body);
}
@@ -191,6 +210,9 @@ rb_alias(klass, name, def)
NODE *orig, *body;
if (name == def) return;
+ if (klass == rb_cObject) {
+ rb_secure(4);
+ }
orig = search_method(klass, def, &origin);
if (!orig || !orig->nd_body) {
if (TYPE(klass) == T_MODULE) {
@@ -219,6 +241,9 @@ remove_method(klass, mid)
{
NODE *body;
+ if (klass == rb_cObject) {
+ rb_secure(4);
+ }
if (!st_delete(RCLASS(klass)->m_tbl, &mid, &body)) {
rb_raise(rb_eNameError, "method `%s' not defined in %s",
rb_id2name(mid), rb_class2name(klass));
@@ -283,6 +308,9 @@ rb_export_method(klass, name, noex)
NODE *body;
VALUE origin;
+ if (klass == rb_cObject) {
+ rb_secure(4);
+ }
body = search_method(klass, name, &origin);
if (!body && TYPE(klass) == T_MODULE) {
body = search_method(rb_cObject, name, &origin);
@@ -379,10 +407,11 @@ static struct SCOPE *top_scope;
#define PUSH_FRAME() { \
struct FRAME _frame; \
_frame.prev = ruby_frame; \
- _frame.file = ruby_sourcefile; \
- _frame.line = ruby_sourceline; \
+ _frame.file = ruby_sourcefile; \
+ _frame.line = ruby_sourceline; \
_frame.iter = ruby_iter->iter; \
_frame.cbase = ruby_frame->cbase; \
+ _frame.argc = 0; \
ruby_frame = &_frame; \
#define POP_FRAME() ruby_frame = _frame.prev; }
@@ -398,7 +427,7 @@ struct BLOCK {
int iter;
int vmode;
struct RVarmap *d_vars;
-#ifdef THREAD
+#ifdef USE_THREAD
VALUE orig_thread;
#endif
struct BLOCK *prev;
@@ -623,7 +652,7 @@ VALUE ruby_class;
ruby_scope->local_vars = 0;\
ruby_scope->local_tbl = 0;\
if (ruby_scope != top_scope)\
- rb_gc_force_recycle(ruby_scope);\
+ rb_gc_force_recycle((VALUE)ruby_scope);\
}\
else {\
ruby_scope->flag |= SCOPE_NOSTACK;\
@@ -647,10 +676,9 @@ static int safe_level = 0;
/* safe-level:
0 - strings from streams/environment/ARGV are tainted (default)
1 - no dangerous operation by tainted string
- 2 - some process operations prohibited
+ 2 - process/file operations prohibited
3 - all genetated strings are tainted
- 4 - no global variable value modification/no direct output
- 5 - no instance variable value modification
+ 4 - no global variable modification/no direct output
*/
int
@@ -713,7 +741,7 @@ rb_secure(level)
{
if (level <= safe_level) {
rb_raise(rb_eSecurityError, "Insecure operation `%s' for level %d",
- rb_id2name(ruby_frame->last_func), level);
+ rb_id2name(ruby_frame->last_func), safe_level);
}
}
@@ -918,7 +946,7 @@ eval_node(self)
int rb_in_eval;
-#ifdef THREAD
+#ifdef USE_THREAD
static void rb_thread_cleanup _((void));
static void rb_thread_wait_other_threads _((void));
static VALUE rb_thread_current _((void));
@@ -952,12 +980,13 @@ ruby_run()
PUSH_ITER(ITER_NOT);
if ((state = EXEC_TAG()) == 0) {
rb_trap_exit();
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_cleanup();
rb_thread_wait_other_threads();
#endif
exec_end_proc();
rb_gc_call_finalizer_at_exit();
+ fprintf(stderr, "%d/%d(%d)\n", count_cent(), CACHE_SIZE, cache_conflict);
}
else {
ex = state;
@@ -1253,7 +1282,7 @@ rb_mod_alias_method(mod, newname, oldname)
return mod;
}
-#if defined(C_ALLOCA) && defined(THREAD)
+#if defined(C_ALLOCA) && defined(USE_THREAD)
# define TMP_PROTECT NODE *__protect_tmp=0
# define TMP_ALLOC(type,n) \
(__protect_tmp = rb_node_newnode(NODE_ALLOCA, \
@@ -1548,7 +1577,7 @@ call_trace_func(event, file, line, self, id, klass)
trace = trace_func;
trace_func = 0;
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_critical++;
#endif
@@ -1578,7 +1607,7 @@ call_trace_func(event, file, line, self, id, klass)
POP_TAG();
POP_FRAME();
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_critical--;
#endif
if (!trace_func) trace_func = trace;
@@ -1649,7 +1678,7 @@ rb_eval(self, node)
/* nodes for speed-up(top-level loop for -n/-p) */
case NODE_OPT_N:
- while (!NIL_P(rb_f_gets())) {
+ while (!NIL_P(rb_gets())) {
rb_eval(self, node->nd_body);
}
RETURN(Qnil);
@@ -2382,8 +2411,13 @@ rb_eval(self, node)
}
body = search_method(ruby_class, node->nd_mid, &origin);
if (body) {
- if (origin == ruby_class && rb_verbose) {
- rb_warning("discarding old %s", rb_id2name(node->nd_mid));
+ if (origin == ruby_class) {
+ if (safe_level >= 3) {
+ rb_raise(rb_eSecurityError, "re-defining method prohibited");
+ }
+ if (rb_verbose) {
+ rb_warning("discarding old %s", rb_id2name(node->nd_mid));
+ }
}
rb_clear_cache_by_id(node->nd_mid);
}
@@ -2441,9 +2475,13 @@ rb_eval(self, node)
}
klass = rb_singleton_class(recv);
- if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &body)
- && rb_verbose) {
- rb_warning("redefine %s", rb_id2name(node->nd_mid));
+ if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &body)) {
+ if (safe_level >= 3) {
+ rb_raise(rb_eSecurityError, "re-defining method prohibited");
+ }
+ if (rb_verbose) {
+ rb_warning("redefine %s", rb_id2name(node->nd_mid));
+ }
}
rb_clear_cache_by_id(node->nd_mid);
rb_add_method(klass, node->nd_mid, node->nd_defn,
@@ -2462,6 +2500,9 @@ rb_eval(self, node)
if (NIL_P(ruby_class)) {
rb_raise(rb_eTypeError, "no class to undef method");
}
+ if (ruby_class == rb_cObject) {
+ rb_secure(4);
+ }
body = search_method(ruby_class, node->nd_mid, &origin);
if (!body || !body->nd_body) {
char *s0 = " class";
@@ -2757,10 +2798,9 @@ rb_f_exit(argc, argv, obj)
/* not reached */
}
-static VALUE
-rb_f_abort()
+static void
+rb_abort()
{
- rb_secure(2);
if (rb_errinfo) {
error_print();
}
@@ -2768,6 +2808,13 @@ rb_f_abort()
/* not reached */
}
+static VALUE
+rb_f_abort()
+{
+ rb_secure(2);
+ rb_abort();
+}
+
void
rb_iter_break()
{
@@ -2810,6 +2857,9 @@ rb_longjmp(tag, mesg)
call_trace_func("raise", ruby_sourcefile, ruby_sourceline,
ruby_frame->self, ruby_frame->last_func, 0);
}
+ if (!prot_tag) {
+ error_print();
+ }
JUMP_TAG(tag);
}
@@ -3524,8 +3574,8 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
}
b2 = body = body->nd_body;
- PUSH_TAG(PROT_FUNC);
PUSH_VARS();
+ PUSH_TAG(PROT_FUNC);
if ((state = EXEC_TAG()) == 0) {
NODE *node = 0;
@@ -3598,8 +3648,8 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
result = prot_tag->retval;
state = 0;
}
- POP_VARS();
POP_TAG();
+ POP_VARS();
POP_SCOPE();
if (trace_func) {
char *file = ruby_frame->prev->file;
@@ -3659,13 +3709,14 @@ rb_call(klass, recv, mid, argc, argv, scope)
noex = ent->noex;
body = ent->method;
}
- else if ((body = rb_get_method_body(&klass, &id, &noex)) == 0) {
+ else { if (ent->mid) cache_conflict++;
+ if ((body = rb_get_method_body(&klass, &id, &noex)) == 0) {
if (scope == 3) {
rb_raise(rb_eNameError, "super: no superclass method `%s'",
rb_id2name(mid));
}
return rb_undefined(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0);
- }
+ }}
/* receiver specified form for private method */
if ((noex & NOEX_PRIVATE) && scope == 0)
@@ -4053,6 +4104,7 @@ eval_under(under, self, src, file, line)
{
VALUE args[4];
+ Check_SafeStr(src);
args[0] = self;
args[1] = src;
args[2] = (VALUE)file;
@@ -4071,6 +4123,7 @@ static VALUE
yield_under(under, self)
VALUE under, self;
{
+ rb_secure(3);
return exec_under(yield_under_i, under, self);
}
@@ -4187,6 +4240,9 @@ find_file(file)
vpath = rb_ary_join(rb_load_path, rb_str_new2(RUBY_LIB_SEP));
Check_SafeStr(vpath);
path = RSTRING(vpath)->ptr;
+ if (safe_level >= 2) {
+ rb_path_check(path);
+ }
}
else {
path = 0;
@@ -4195,9 +4251,9 @@ find_file(file)
return dln_find_file(file, path);
}
-VALUE
-rb_f_load(obj, fname)
- VALUE obj, fname;
+void
+rb_load(fname, priv)
+ VALUE fname, priv;
{
int state;
char *file;
@@ -4219,24 +4275,43 @@ rb_f_load(obj, fname)
PUSH_VARS();
PUSH_TAG(PROT_NONE);
PUSH_CLASS();
- ruby_class = rb_cObject;
+ if (priv == 0 || NIL_P(priv)) {
+ rb_secure(4); /* should alter global state */
+ ruby_class = rb_cObject;
+ }
+ else {
+ switch (TYPE(priv)) {
+ case T_MODULE:
+ case T_CLASS:
+ break;
+ rb_secure(4); /* should alter global state */
+ ruby_class = priv;
+ default:
+ /* load in anonymous module as toplevel */
+ ruby_class = rb_module_new();
+ break;
+ }
+ }
+ PUSH_FRAME();
+ ruby_frame->last_func = 0;
+ ruby_frame->self = rb_top_self;
+ ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_class,0,0);
PUSH_SCOPE();
- if (top_scope->local_tbl) {
+ if (ruby_class == rb_cObject && top_scope->local_tbl) {
int len = top_scope->local_tbl[0]+1;
ID *tbl = ALLOC_N(ID, len);
VALUE *vars = TMP_ALLOC(VALUE, len);
*vars++ = 0;
MEMCPY(tbl, top_scope->local_tbl, ID, len);
MEMCPY(vars, top_scope->local_vars, ID, len-1);
- ruby_scope->local_tbl = tbl;
- ruby_scope->local_vars = vars;
+ ruby_scope->local_tbl = tbl; /* copy toplevel scope */
+ ruby_scope->local_vars = vars; /* will not alter toplevel variables */
}
/* default visibility is private at loading toplevel */
SCOPE_SET(SCOPE_PRIVATE);
state = EXEC_TAG();
last_func = ruby_frame->last_func;
- ruby_frame->last_func = 0;
if (state == 0) {
rb_in_eval++;
rb_load_file(file);
@@ -4246,10 +4321,12 @@ rb_f_load(obj, fname)
}
}
ruby_frame->last_func = last_func;
- if (ruby_scope->flag == SCOPE_ALLOCA && ruby_scope->local_tbl) {
- free(ruby_scope->local_tbl);
+ if (ruby_scope->flag == SCOPE_ALLOCA && ruby_class == rb_cObject) {
+ if (ruby_scope->local_tbl) /* toplevel was empty */
+ free(ruby_scope->local_tbl);
}
POP_SCOPE();
+ POP_FRAME();
POP_CLASS();
POP_TAG();
POP_VARS();
@@ -4257,7 +4334,17 @@ rb_f_load(obj, fname)
rb_exc_raise(rb_errinfo);
}
if (state) JUMP_TAG(state);
+}
+static VALUE
+rb_f_load(argc, argv)
+ int argc;
+ VALUE *argv;
+{
+ VALUE fname, priv;
+
+ rb_scan_args(argc, argv, "11", &fname, &priv);
+ rb_load(fname, priv);
return Qtrue;
}
@@ -4286,7 +4373,7 @@ rb_provided(feature)
return Qfalse;
}
-#ifdef THREAD
+#ifdef USE_THREAD
static int rb_thread_loading _((char*));
static void rb_thread_loading_done _((void));
#endif
@@ -4317,6 +4404,7 @@ rb_f_require(obj, fname)
char *ext, *file, *feature, *buf; /* OK */
VALUE load;
+ rb_secure(4);
Check_SafeStr(fname);
if (rb_provided(RSTRING(fname)->ptr))
return Qfalse;
@@ -4365,7 +4453,8 @@ rb_f_require(obj, fname)
RSTRING(fname)->ptr);
dyna_load:
-#ifdef THREAD
+ rb_secure(2);
+#ifdef USE_THREAD
if (rb_thread_loading(feature)) return Qfalse;
else {
int state;
@@ -4376,7 +4465,7 @@ rb_f_require(obj, fname)
file = RSTRING(load)->ptr;
dln_load(file);
rb_provide(feature);
-#ifdef THREAD
+#ifdef USE_THREAD
}
POP_TAG();
rb_thread_loading_done();
@@ -4386,16 +4475,16 @@ rb_f_require(obj, fname)
return Qtrue;
rb_load:
-#ifdef THREAD
+#ifdef USE_THREAD
if (rb_thread_loading(feature)) return Qfalse;
else {
int state;
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
#endif
- rb_f_load(obj, fname);
+ rb_load(fname, 0);
rb_provide(feature);
-#ifdef THREAD
+#ifdef USE_THREAD
}
POP_TAG();
rb_thread_loading_done();
@@ -4845,7 +4934,7 @@ Init_load()
rb_features = rb_ary_new();
rb_define_readonly_variable("$\"", &rb_features);
- rb_define_global_function("load", rb_f_load, 1);
+ rb_define_global_function("load", rb_f_load, -1);
rb_define_global_function("require", rb_f_require, 1);
rb_define_global_function("autoload", rb_f_autoload, 2);
}
@@ -4952,7 +5041,7 @@ rb_f_binding(self)
bind = Data_Make_Struct(rb_cBinding,struct BLOCK,blk_mark,blk_free,data);
*data = *ruby_block;
-#ifdef THREAD
+#ifdef USE_THREAD
data->orig_thread = rb_thread_current();
#endif
data->iter = rb_f_iterator_p();
@@ -4995,7 +5084,7 @@ proc_s_new(klass)
proc = Data_Make_Struct(klass, struct BLOCK, blk_mark, blk_free, data);
*data = *ruby_block;
-#ifdef THREAD
+#ifdef USE_THREAD
data->orig_thread = rb_thread_current();
#endif
data->iter = data->prev?Qtrue:Qfalse;
@@ -5042,7 +5131,7 @@ blk_orphan(data)
(data->scope->flag & SCOPE_NOSTACK)) {
return 1;
}
-#ifdef THREAD
+#ifdef USE_THREAD
if (data->orig_thread != rb_thread_current()) {
return 1;
}
@@ -5363,7 +5452,7 @@ Init_Proc()
rb_define_method(rb_mKernel, "method", rb_obj_method, 1);
}
-#ifdef THREAD
+#ifdef USE_THREAD
static VALUE rb_eThreadError;
@@ -5440,7 +5529,7 @@ struct thread {
int safe;
- enum thread_status status;
+ enum thread_status status;
int wait_for;
int fd;
double delay;
@@ -5722,7 +5811,7 @@ rb_thread_deadlock()
th_raise_argv[0] = rb_exc_new2(rb_eFatal, "Thread: deadlock");
th_raise_file = ruby_sourcefile;
th_raise_line = ruby_sourceline;
- rb_f_abort();
+ rb_abort();
}
void
@@ -6049,8 +6138,7 @@ rb_thread_select(max, read, write, except, timeout)
}
static VALUE
-rb_thread_join(dmy, thread)
- VALUE dmy;
+rb_thread_join(thread)
VALUE thread;
{
thread_t th = rb_thread_check(thread);
@@ -6068,6 +6156,15 @@ rb_thread_join(dmy, thread)
}
static VALUE
+rb_thread_s_join(dmy, thread) /* will be removed in 1.2 */
+ VALUE dmy;
+ VALUE thread;
+{
+ rb_warn("Thread.join is obsolete; use Thread#join instead");
+ return rb_thread_join(thread);
+}
+
+static VALUE
rb_thread_current()
{
return curr_thread->thread;
@@ -6219,7 +6316,8 @@ rb_thread_abort_exc_set(thread, val)
}
static thread_t
-rb_thread_alloc()
+rb_thread_alloc(klass)
+ VALUE klass;
{
thread_t th;
@@ -6251,7 +6349,7 @@ rb_thread_alloc()
th->last_match = 0;
th->abort = 0;
- th->thread = Data_Wrap_Struct(rb_cThread, 0, rb_thread_free, th);
+ th->thread = Data_Wrap_Struct(klass, 0, rb_thread_free, th);
if (curr_thread) {
th->prev = curr_thread;
@@ -6290,12 +6388,14 @@ static VALUE rb_thread_raise _((int, VALUE*, VALUE));
#define SCOPE_SHARED FL_USER1
-VALUE
-rb_thread_create(fn, arg)
+static VALUE
+rb_thread_create_0(fn, arg, klass)
VALUE (*fn)();
void *arg;
+ VALUE klass;
{
- thread_t th = rb_thread_alloc();
+ thread_t th = rb_thread_alloc(klass);
+ enum thread_status status;
int state;
#if defined(HAVE_SETITIMER) && !defined(__BOW__)
@@ -6335,8 +6435,9 @@ rb_thread_create(fn, arg)
}
}
POP_TAG();
+ status = th->status;
rb_thread_remove();
- if (state && th->status != THREAD_TO_KILL && !NIL_P(rb_errinfo)) {
+ if (state && status != THREAD_TO_KILL && !NIL_P(rb_errinfo)) {
if (state == TAG_FATAL) {
/* fatal error within this thread, need to stop whole script */
main_thread->rb_errinfo = rb_errinfo;
@@ -6360,6 +6461,14 @@ rb_thread_create(fn, arg)
return 0; /* not reached */
}
+VALUE
+rb_thread_create(fn, arg)
+ VALUE (*fn)();
+ void *arg;
+{
+ return rb_thread_create_0(fn, arg, rb_cThread);
+}
+
int
rb_thread_scope_shared_p()
{
@@ -6376,12 +6485,13 @@ rb_thread_yield(arg, th)
}
static VALUE
-rb_thread_start()
+rb_thread_start(klass)
+ VALUE klass;
{
if (!rb_iterator_p()) {
rb_raise(rb_eThreadError, "must be called as iterator");
}
- return rb_thread_create(rb_thread_yield, 0);
+ return rb_thread_create_0(rb_thread_yield, 0, klass);
}
static VALUE
@@ -6390,7 +6500,7 @@ rb_thread_value(thread)
{
thread_t th = rb_thread_check(thread);
- rb_thread_join(0, thread);
+ rb_thread_join(thread);
if (!NIL_P(th->rb_errinfo)) {
VALUE oldbt = get_backtrace(th->rb_errinfo);
VALUE errat = make_backtrace();
@@ -6582,7 +6692,7 @@ Init_Thread()
rb_define_singleton_method(rb_cThread, "kill", rb_thread_s_kill, 1);
rb_define_singleton_method(rb_cThread, "exit", rb_thread_exit, 0);
rb_define_singleton_method(rb_cThread, "pass", rb_thread_pass, 0);
- rb_define_singleton_method(rb_cThread, "join", rb_thread_join, 1);
+ rb_define_singleton_method(rb_cThread, "join", rb_thread_s_join, 1);
rb_define_singleton_method(rb_cThread, "current", rb_thread_current, 0);
rb_define_singleton_method(rb_cThread, "main", rb_thread_main, 0);
@@ -6597,6 +6707,7 @@ Init_Thread()
rb_define_method(rb_cThread, "exit", rb_thread_kill, 0);
rb_define_method(rb_cThread, "value", rb_thread_value, 0);
rb_define_method(rb_cThread, "status", rb_thread_status, 0);
+ rb_define_method(rb_cThread, "join", rb_thread_join, 0);
rb_define_method(rb_cThread, "alive?", rb_thread_status, 0);
rb_define_method(rb_cThread, "stop?", rb_thread_stop_p, 0);
rb_define_method(rb_cThread, "raise", rb_thread_raise, -1);
@@ -6605,7 +6716,7 @@ Init_Thread()
rb_define_method(rb_cThread, "abort_on_exception=", rb_thread_abort_exc_set, 1);
/* allocate main thread */
- main_thread = rb_thread_alloc();
+ main_thread = rb_thread_alloc(rb_cThread);
}
#endif
@@ -6665,7 +6776,7 @@ rb_f_throw(argc, argv)
tt->dst = t;
break;
}
-#ifdef THREAD
+#ifdef USE_THREAD
if (tt->tag == PROT_THREAD) {
rb_raise(rb_eThreadError, "uncaught throw `%s' in thread 0x%x",
rb_id2name(t),
@@ -6699,7 +6810,7 @@ rb_throw(tag, val)
static void
return_check()
{
-#ifdef THREAD
+#ifdef USE_THREAD
struct tag *tt = prot_tag;
while (tt) {
diff --git a/ext/aix_ld.rb b/ext/aix_ld.rb
index 1058977..42b2087 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/dbm/dbm.c b/ext/dbm/dbm.c
index eb1f5c9..4a3d112 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -21,8 +21,6 @@
VALUE cDBM;
-extern VALUE rb_mEnumerable;
-
struct dbmdata {
int di_size;
DBM *di_dbm;
@@ -48,10 +46,10 @@ free_dbm(dbmp)
}
static VALUE
-fdbm_s_open(argc, argv, class)
+fdbm_s_open(argc, argv, klass)
int argc;
VALUE *argv;
- VALUE class;
+ VALUE klass;
{
VALUE file, vmode;
DBM *dbm;
@@ -83,7 +81,7 @@ fdbm_s_open(argc, argv, class)
rb_sys_fail(RSTRING(file)->ptr);
}
- obj = Data_Make_Struct(class,struct dbmdata,0,free_dbm,dbmp);
+ obj = Data_Make_Struct(klass,struct dbmdata,0,free_dbm,dbmp);
dbmp->di_dbm = dbm;
dbmp->di_size = -1;
rb_obj_call_init(obj);
@@ -546,6 +544,7 @@ fdbm_to_a(obj)
return ary;
}
+void
Init_dbm()
{
cDBM = rb_define_class("DBM", rb_cObject);
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 5315166..e2c8de4 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -239,7 +239,10 @@ Init_etc()
sPasswd = rb_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 a02ff8c..4cf04a3 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 0c32954..e8dc566 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -1,6 +1,7 @@
#! /usr/local/bin/ruby
$".push 'mkmf.rb' #"
+load '../lib/find.rb'
if ARGV[0] == 'static'
$force_static = TRUE
@@ -93,6 +94,24 @@ def try_cpp
xsystem(format(CPP, $CFLAGS))
end
+def install_rb(mfile)
+ path = []
+ dir = []
+ Find.find("lib") do |f|
+ next unless /\.rb$/ =~ f
+ f = f[4..-1]
+ path.push f
+ dir |= File.dirname(f)
+ end
+ for f in dir
+ next if f == "."
+ mfile.printf "\t@test -d $(libdir)/%s || mkdir $(libdir)/%s\n", f, f
+ end
+ for f in path
+ mfile.printf "\t$(INSTALL_DATA) lib/%s $(libdir)/%s\n", f, f
+ end
+end
+
def have_library(lib, func)
if $lib_cache[lib]
if $lib_cache[lib] == "yes"
@@ -263,7 +282,8 @@ RUBY_INSTALL_NAME = `t='$(program_transform_name)'; echo ruby | sed $$t`
prefix = @prefix@
exec_prefix = @exec_prefix@
-libdir = @libdir@/$(RUBY_INSTALL_NAME)/@arch@
+libdir = @libdir@/$(RUBY_INSTALL_NAME)
+archdir = $(libdir)/@arch@
@SET_MAKE@
#### End of system configuration section. ####
@@ -299,24 +319,29 @@ 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 "\
install:
+ @test -d $(libdir) || mkdir $(libdir)
+ @test -d $(archdir) || mkdir $(archdir)
"
if !$static
mfile.printf "\
- @test -d $(libdir) || mkdir $(libdir)
- $(INSTALL) $(TARGET) $(libdir)/$(TARGET)
+ $(INSTALL) $(TARGET) $(archdir)/$(TARGET)
"
end
- for rb in Dir["lib/*.rb"]
- mfile.printf "\t$(INSTALL_DATA) %s @libdir@/$(RUBY_INSTALL_NAME)\n", rb
- end
+ 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)
@@ -327,26 +352,11 @@ $(TARGET): $(OBJS)
$(TARGET): $(OBJS)
ar cru $(TARGET) $(OBJS)
"
- elsif PLATFORM =~ "-nextstep"
+ elsif PLATFORM =~ "-nextstep" || PLATFORM =~ "-openstep" || PLATFORM =~ "-rhapsody"
mfile.printf "\
$(TARGET): $(OBJS)
cc -r $(CFLAGS) -o $(TARGET) $(OBJS)
"
- elsif PLATFORM =~ "-openstep"
- 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)
@@ -486,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/gtk/MANIFEST b/ext/gtk/MANIFEST
index c38e8cd..ec04200 100644
--- a/ext/gtk/MANIFEST
+++ b/ext/gtk/MANIFEST
@@ -1,4 +1,5 @@
MANIFEST
+ENVIRONMENT
extconf.rb
gtk.c
test.rb
diff --git a/ext/gtk/extconf.rb b/ext/gtk/extconf.rb
index 43c90c0..5177af7 100644
--- a/ext/gtk/extconf.rb
+++ b/ext/gtk/extconf.rb
@@ -1,8 +1,15 @@
require "mkmf"
# may need to be changed
-$LDFLAGS=`gtk-config --libs`.chomp!
-$CFLAGS=`gtk-config --cflags`.chomp!
+begin
+ $LDFLAGS, *libs = `gtk-config --libs`.chomp!.split(/(-l.*)/)
+ $libs = libs.join(' ') + ' ' + $libs
+ $CFLAGS=`gtk-config --cflags`.chomp!
+rescue
+ $LDFLAGS = '-L/usr/X11R6/lib -L/usr/local/lib'
+ $CFLAGS = '-I/usr/X11R6/lib -I/usr/local/include'
+ $libs = '-lm -lc'
+end
have_library("X11", "XOpenDisplay")
have_library("Xext", "XShmQueryVersion")
@@ -10,5 +17,6 @@ have_library("Xi", "XOpenDevice")
if have_library("glib", "g_print") and
have_library("gdk", "gdk_init") and
have_library("gtk", "gtk_init")
+ $libs = $libs.split(/\s/).uniq.join(' ')
create_makefile("gtk")
end
diff --git a/ext/gtk/gtk.c b/ext/gtk/gtk.c
index d2a6739..fb7c591 100644
--- a/ext/gtk/gtk.c
+++ b/ext/gtk/gtk.c
@@ -15,7 +15,6 @@
#include <signal.h>
extern VALUE rb_argv, rb_argv0;
-extern VALUE rb_cData;
static VALUE mGtk;
@@ -388,26 +387,18 @@ gdkfnt_load_font(self, name)
font = gdk_font_load(STR2CSTR(name));
return Data_Wrap_Struct(gdkFont, 0, gdk_font_unref, font);
- /* return make_gdkfont(new); */
}
+
static VALUE
gdkfnt_load_fontset(self, name)
VALUE self, name;
{
- GdkFont *new;
+ GdkFont *font;
- new = gdk_fontset_load(STR2CSTR(name));
- return make_gdkfont(new);
-}
-static VALUE
-gdkfnt_new(self, name)
- VALUE self, name;
-{
- char *cname = STR2CSTR(name);
- return (strchr(cname, ',') == NULL)
- ? gdkfnt_load_font(self, name)
- : gdkfnt_load_fontset(self, name);
+ font = gdk_fontset_load(STR2CSTR(name));
+ return Data_Wrap_Struct(gdkFont, 0, gdk_font_unref, font);
}
+
static VALUE
gdkfnt_string_width(self, str)
VALUE self, str;
@@ -417,12 +408,14 @@ gdkfnt_string_width(self, str)
w = gdk_string_width(get_gdkfont(self), STR2CSTR(str));
return INT2NUM(w);
}
+
static VALUE
gdkfnt_ascent(self)
VALUE self;
{
return INT2NUM(get_gdkfont(self)->ascent);
}
+
static VALUE
gdkfnt_descent(self)
VALUE self;
@@ -833,6 +826,7 @@ gdkwin_clear(self)
gdk_window_clear(get_gdkwindow(self));
return self;
}
+
static VALUE
gdkwin_clear_area(self, x,y,w,h)
VALUE self,x,y,w,h;
@@ -841,6 +835,7 @@ gdkwin_clear_area(self, x,y,w,h)
NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h));
return self;
}
+
static VALUE
gdkwin_clear_area_e(self, x,y,w,h)
VALUE self,x,y,w,h;
@@ -869,6 +864,32 @@ gdkwin_set_back_pixmap(self, pixmap, parent_relative)
return self;
}
+static VALUE
+gdkwin_move(self, x,y)
+ VALUE self, x,y;
+{
+ gdk_window_move(get_gdkwindow(self),
+ NUM2INT(x), NUM2INT(y));
+ return self;
+}
+
+static VALUE
+gdkwin_resize(self, w,h)
+ VALUE self, w,h;
+{
+ gdk_window_resize(get_gdkwindow(self),
+ NUM2INT(w), NUM2INT(h));
+ return self;
+}
+
+static VALUE
+gdkwin_move_resize(self, x,y,w,h)
+ VALUE self, x,y,w,h;
+{
+ gdk_window_move_resize(get_gdkwindow(self),
+ NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h));
+ return self;
+}
static VALUE
make_gdkevent(event)
@@ -982,6 +1003,7 @@ gdkgc_set_foreground(self, pix)
gdk_gc_set_foreground(get_gdkgc(self), &c);
return pix;
}
+
static VALUE
gdkgc_set_background(self, pix)
VALUE pix;
@@ -991,6 +1013,7 @@ gdkgc_set_background(self, pix)
gdk_gc_set_background(get_gdkgc(self), &c);
return pix;
}
+
static VALUE
gdkgc_set_clip_mask(self, mask)
VALUE mask;
@@ -998,6 +1021,7 @@ gdkgc_set_clip_mask(self, mask)
gdk_gc_set_clip_mask(get_gdkgc(self), get_gdkbitmap(mask));
return mask;
}
+
static VALUE
gdkgc_set_clip_origin(self, x, y)
VALUE x, y;
@@ -1005,6 +1029,7 @@ gdkgc_set_clip_origin(self, x, y)
gdk_gc_set_clip_origin(get_gdkgc(self), NUM2INT(x), NUM2INT(y));
return self;
}
+
static VALUE
gdkgc_set_clip_rectangle(self, rectangle)
VALUE rectangle;
@@ -1193,6 +1218,7 @@ signal_setup_args(obj, sig, argc, params, args)
GtkArg *params;
VALUE args;
{
+ GtkArg *params1;
int i;
char *signame = rb_id2name(sig);
@@ -1242,9 +1268,30 @@ signal_setup_args(obj, sig, argc, params, args)
}
}
+ params1 = params;
for (i=0; i<argc; i++) {
- rb_ary_push(args, arg_to_value(params));
- params++;
+ rb_ary_push(args, arg_to_value(params1));
+ params1++;
+ }
+}
+
+static void
+signal_sync_args(obj, sig, argc, params, args)
+ VALUE obj;
+ ID sig;
+ int argc;
+ GtkArg *params;
+ VALUE args;
+{
+ int i;
+ char *signame = rb_id2name(sig);
+
+ if (rb_obj_is_kind_of(obj, gWidget)) {
+ if (strcmp(signame, "size_request") == 0) {
+ memcpy(GTK_VALUE_POINTER(params[0]), get_grequisition(rb_ary_pop(args)),
+ sizeof(GtkRequisition));
+ return;
+ }
}
}
@@ -1371,8 +1418,14 @@ signal_callback(widget, data, nparams, params)
else {
rb_ary_unshift(args, self);
result = rb_apply(proc, id_call, args);
+ rb_ary_shift(args);
}
arg_set_value(params+nparams, result);
+
+ for (i=0; i<RARRAY(a)->len; i++) {
+ rb_ary_pop(args);
+ }
+ signal_sync_args(self, id, nparams, params, args);
}
static void
@@ -1424,7 +1477,7 @@ try_get_gobject(self)
}
static VALUE
-grb_obj_equal(self, other)
+gobj_equal(self, other)
VALUE self, other;
{
if (self == other) return Qtrue;
@@ -1466,6 +1519,14 @@ gobj_destroy(self)
}
static VALUE
+gobj_get_flags(self)
+ VALUE self;
+{
+ /* _GtkObject.flags is int32 */
+ return(INT2FIX( GTK_OBJECT_FLAGS(get_gobject(self)) ));
+}
+
+static VALUE
gobj_set_flags(self, flags)
VALUE self, flags;
{
@@ -1497,7 +1558,7 @@ gobj_sig_connect(argc, argv, self)
id = rb_intern(STR2CSTR(sig));
data = rb_ary_new3(3, rb_f_lambda(), INT2NUM(id), args);
add_relative(self, data);
- i = gtk_signal_connect_interp(GTK_OBJECT(get_widget(self)),
+ i = gtk_signal_connect_interp(get_gobject(self),
STR2CSTR(sig),
signal_callback, (gpointer)data,
NULL, 0);
@@ -1535,6 +1596,12 @@ cont_bwidth(self, width)
NUM2INT(width));
return self;
}
+static VALUE
+cont_get_bwidth(self)
+ VALUE self;
+{
+ return INT2NUM(GTK_CONTAINER(get_widget(self))->border_width);
+}
static VALUE
cont_add(self, other)
@@ -1545,6 +1612,14 @@ cont_add(self, other)
}
static VALUE
+cont_remove(self, other)
+ VALUE self, other;
+{
+ gtk_container_remove(GTK_CONTAINER(get_widget(self)), get_widget(other));
+ return self;
+}
+
+static VALUE
cont_disable_resize(self)
VALUE self;
{
@@ -1691,20 +1766,23 @@ static VALUE
misc_get_xalign(self)
VALUE self;
{
- return float_new(GTK_MISC(get_widget(self))->xalign);
+ return rb_float_new(GTK_MISC(get_widget(self))->xalign);
}
+
static VALUE
misc_get_yalign(self)
VALUE self;
{
- return float_new(GTK_MISC(get_widget(self))->yalign);
+ return rb_float_new(GTK_MISC(get_widget(self))->yalign);
}
+
static VALUE
misc_get_xpad(self)
VALUE self;
{
return INT2NUM(GTK_MISC(get_widget(self))->xpad);
}
+
static VALUE
misc_get_ypad(self)
VALUE self;
@@ -1803,6 +1881,22 @@ adj_initialize(self, value, lower, upper, step_inc, page_inc, page_size)
}
static VALUE
+adj_set_value(self, value)
+ VALUE self, value;
+{
+ gtk_adjustment_set_value(GTK_ADJUSTMENT(get_gobject(self)),
+ NUM2DBL(value));
+ return Qnil;
+}
+
+static VALUE
+adj_get_value(self)
+ VALUE self;
+{
+ return rb_float_new(GTK_ADJUSTMENT(get_gobject(self))->value);
+}
+
+static VALUE
widget_show(self)
VALUE self;
{
@@ -1990,29 +2084,12 @@ widget_grab_default(self)
}
static VALUE
-widget_visible(self)
- VALUE self;
-{
- if (GTK_WIDGET_VISIBLE(get_widget(self)))
- return Qtrue;
- return Qfalse;
-}
-
-static VALUE
widget_reparent(self, parent)
VALUE self, parent;
{
gtk_widget_reparent(get_widget(self), get_widget(parent));
return self;
}
-static VALUE
-widget_mapped(self)
- VALUE self;
-{
- if (GTK_WIDGET_MAPPED(get_widget(self)))
- return TRUE;
- return FALSE;
-}
static VALUE
widget_popup(self, x, y)
@@ -2245,42 +2322,99 @@ static VALUE
widget_push_visual(self, visual)
VALUE self, visual;
{
+ GdkVisual v;
gtk_widget_push_visual(get_gdkvisual(visual));
return make_gdkcmap(visual);
}
static VALUE
widget_push_style(self, style)
- VALUE self, style;
+ VALUE self;
{
gtk_widget_push_style(get_gstyle(style));
return Qnil;
}
static VALUE
-widget_pop_cmap(self, cmap)
- VALUE self, cmap;
+widget_pop_cmap(self)
+ VALUE self;
{
gtk_widget_pop_colormap();
return Qnil;
}
static VALUE
-widget_pop_visual(self, visual)
- VALUE self, visual;
+widget_pop_visual(self)
+ VALUE self;
{
gtk_widget_pop_visual();
return Qnil;
}
static VALUE
-widget_pop_style(self, style)
- VALUE self, style;
+widget_pop_style(self)
+ VALUE self;
{
gtk_widget_pop_style();
return Qnil;
}
+/*
+static VALUE
+widget_peek_cmap(self)
+ VALUE self;
+{
+ GdkColormap *cmap;
+
+ cmap = (GdkColormap*)gtk_widget_peek_colormap();
+ return make_gdkcmap(cmap);
+}
+
+static VALUE
+widget_peek_visual(self)
+ VALUE self;
+{
+ GdkVisual *v;
+
+ v = (GdkVisual*)gtk_widget_peek_visual();
+ return make_gdkvisual(v);
+}
+
+static VALUE
+widget_peek_style(self)
+ VALUE self;
+{
+ GtkStyle *style;
+
+ style = (GtkStyle*)gtk_widget_peek_style();
+ return make_gstyle(style);
+}
+*/
+
+#define DEFINE_IS_WIDGET(STATE) \
+static VALUE \
+widget_ ## STATE (self) \
+ VALUE self; \
+{ \
+ return( GTK_WIDGET_ ## STATE (get_widget(self))? Qtrue: Qfalse ); \
+}
+DEFINE_IS_WIDGET(TOPLEVEL)
+DEFINE_IS_WIDGET(NO_WINDOW)
+DEFINE_IS_WIDGET(REALIZED)
+DEFINE_IS_WIDGET(MAPPED)
+DEFINE_IS_WIDGET(VISIBLE)
+DEFINE_IS_WIDGET(DRAWABLE)
+DEFINE_IS_WIDGET(SENSITIVE)
+DEFINE_IS_WIDGET(PARENT_SENSITIVE)
+DEFINE_IS_WIDGET(IS_SENSITIVE)
+DEFINE_IS_WIDGET(CAN_FOCUS)
+DEFINE_IS_WIDGET(HAS_FOCUS)
+DEFINE_IS_WIDGET(CAN_DEFAULT)
+DEFINE_IS_WIDGET(HAS_DEFAULT)
+DEFINE_IS_WIDGET(HAS_GRAB)
+DEFINE_IS_WIDGET(BASIC)
+DEFINE_IS_WIDGET(RC_STYLE)
+
static VALUE
widget_set_default_cmap(self, cmap)
VALUE self, cmap;
@@ -2356,6 +2490,17 @@ widget_get_alloc(self)
{
return make_gallocation(&(get_widget(self)->allocation));
}
+static VALUE
+widget_set_alloc(self, x,y,w,h)
+ VALUE self, x,y,w,h;
+{
+ GtkAllocation *a = &(get_widget(self)->allocation);
+ a->x = NUM2INT(x);
+ a->y = NUM2INT(y);
+ a->width = NUM2INT(w);
+ a->height = NUM2INT(h);
+ return self;
+}
static VALUE
widget_get_requisition(self)
@@ -2804,6 +2949,17 @@ clist_get_row_data(self, row)
}
static VALUE
+clist_get_text(self, row, col)
+ VALUE self, row, col;
+{
+ char* text;
+
+ gtk_clist_get_text(GTK_CLIST(get_widget(self)),
+ NUM2INT(row), NUM2INT(col), &text);
+ return rb_str_new2(text);
+}
+
+static VALUE
clist_select_row(self, row, col)
VALUE self, row, col;
{
@@ -3044,9 +3200,9 @@ static VALUE
label_get(self)
VALUE self;
{
- gchar** str;
- gtk_label_get(GTK_LABEL(get_widget(self)), str);
- return rb_str_new2(*str);
+ gchar *str;
+ gtk_label_get(GTK_LABEL(get_widget(self)), &str);
+ return rb_str_new2(str);
}
static VALUE
@@ -5450,8 +5606,9 @@ static VALUE
range_set_adj(self, adj)
VALUE self, adj;
{
- gtk_range_set_adjustment(GTK_RANGE(get_widget(self)),
- GTK_ADJUSTMENT(get_gobject(adj)));
+ if (! NIL_P(adj))
+ gtk_range_set_adjustment(GTK_RANGE(get_widget(self)),
+ GTK_ADJUSTMENT(get_gobject(adj)));
return self;
}
@@ -5812,19 +5969,20 @@ style_base(self, idx)
return make_gdkcolor(get_gstyle(self)->base[i]);
}
-#define DEFINE_STYLE_SET_COLOR(FUNC, TYPE) \
+#define DEFINE_STYLE_SET_COLOR(func, type) \
static VALUE \
-FUNC(self, idx, r, g, b) \
+func(self, idx, r, g, b) \
VALUE self, idx, r, g, b; \
{ \
GtkStyle *style; \
GdkColor *color; \
int i = NUM2INT(idx); \
\
- if (i < 0 || 5 < i) ArgError("state out of range"); \
+ if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \
style = get_gstyle(self); \
- if (style->fg_gc[0] != NULL) ArgError("you must not change widget style."); \
- color = &(style-> TYPE [i]); \
+ if (style->fg_gc[0] != NULL) \
+ rb_raise(rb_eArgError, "you must not change widget style."); \
+ color = &(style-> type [i]); \
color->red = NUM2INT(r); \
color->green = NUM2INT(g); \
color->blue = NUM2INT(b); \
@@ -5864,7 +6022,8 @@ style_set_font(self, f)
GdkFont *font = get_gdkfont(f);
GtkStyle *style = get_gstyle(self);
- if (style->fg_gc[0] != NULL) ArgError("you must not change widget style.");
+ if (style->fg_gc[0] != NULL)
+ rb_raise(rb_eArgError, "you must not change widget style.");
if (style->font != NULL)
gdk_font_unref(style->font);
@@ -6054,6 +6213,18 @@ style_draw_string(self,) /* 5 */
#endif
static VALUE
+gallocation_new(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
+{
+ GtkAllocation a;
+
+ a.x = NUM2INT(x);
+ a.y = NUM2INT(y);
+ a.width = NUM2INT(w);
+ a.height = NUM2INT(h);
+ return make_gallocation(&a);
+}
+
+static VALUE
gallocation_x(self)
{
return INT2NUM(get_gallocation(self)->x);
@@ -6078,31 +6249,26 @@ gallocation_h(self)
}
static VALUE
-grequisition_w(self)
-{
- return INT2NUM(get_grequisition(self)->width);
-}
-static VALUE
-grequisition_h(self)
+gallocation_to_a(self)
+ VALUE self;
{
- return INT2NUM(get_grequisition(self)->height);
+ GtkAllocation *a;
+
+ a = get_gallocation(self);
+ return rb_ary_new3(4, a->x, a->y, a->width, a->height);
}
-/*
+
static VALUE
-grequisition_set_w(self, w)
- VALUE self, w;
+gallocation_to_s(self)
+ VALUE self;
{
- get_grequisition(self)->width = NUM2INT(w);
- return self;
-}
-static VALUE
-grequisition_set_h(self, h)
- VALUE self, h;
-{
- get_grequisition(self)->height = NUM2INT(h);
- return self;
+ char str[2 +2*3 +5*4 +1]; /* member is guint16. max string size is 5 */
+ GtkAllocation *a;
+
+ a = get_gallocation(self);
+ sprintf(str, "(%5d, %5d, %5d, %5d)", a->x, a->y, a->width, a->height);
+ return rb_str_new2(str);
}
-*/
static VALUE
gtk_m_main(self)
@@ -6309,114 +6475,173 @@ gdkdraw_draw_segs(self, gc, segs)
segments[i].y2 = NUM2INT(RARRAY(RARRAY(segs)->ptr[i])->ptr[3]);
}
gdk_draw_segments(get_gdkdrawable(self), get_gdkgc(gc),
- segments,
- RARRAY(segs)->len);
+ segments, RARRAY(segs)->len);
return self;
}
+static VALUE grequisition_new(self, w, h)
+ VALUE self, w, h;
+{
+ GtkRequisition r;
+
+ r.width = NUM2INT(w);
+ r.height = NUM2INT(h);
+ return make_grequisition(&r);
+}
+
+static VALUE
+grequisition_w(self)
+ VALUE self;
+{
+ return INT2NUM(get_grequisition(self)->width);
+}
+
+static VALUE
+grequisition_h(self)
+ VALUE self;
+{
+ return INT2NUM(get_grequisition(self)->height);
+}
+
+static VALUE
+grequisition_set_w(self, w)
+ VALUE self, w;
+{
+ get_grequisition(self)->width = NUM2INT(w);
+ return self;
+}
+
+static VALUE
+grequisition_set_h(self, h)
+ VALUE self, h;
+{
+ get_grequisition(self)->height = NUM2INT(h);
+ return self;
+}
+
+static VALUE
+grequisition_to_a(self)
+ VALUE self;
+{
+ GtkRequisition *r;
+
+ r = get_grequisition(self);
+ return rb_ary_new3(2, r->width, r->height);
+}
+
+static VALUE
+grequisition_to_s(self)
+ VALUE self;
+{
+ char str[2 +2*1 +5*2 +1]; /* member is guint16. max string size is 5 */
+ GtkRequisition *r;
+
+ r = get_grequisition(self);
+ sprintf(str, "(%5d, %5d)", r->width, r->height);
+ return rb_str_new2(str);
+}
static VALUE
gdkrect_s_new(self, x, y, width, height)
VALUE self, x, y, width, height;
{
- GdkRectangle new;
- new.x = NUM2INT(x);
- new.y = NUM2INT(y);
- new.width = NUM2INT(width);
- new.height = NUM2INT(height);
- return make_gdkrectangle(&new);
+ GdkRectangle new;
+ new.x = NUM2INT(x);
+ new.y = NUM2INT(y);
+ new.width = NUM2INT(width);
+ new.height = NUM2INT(height);
+ return make_gdkrectangle(&new);
}
static VALUE
gdkrect_x(self)
{
- return INT2NUM(get_gdkrectangle(self)->x);
+ return INT2NUM(get_gdkrectangle(self)->x);
}
static VALUE
gdkrect_y(self)
{
- return INT2NUM(get_gdkrectangle(self)->y);
+ return INT2NUM(get_gdkrectangle(self)->y);
}
static VALUE
gdkrect_w(self)
{
- return INT2NUM(get_gdkrectangle(self)->width);
+ return INT2NUM(get_gdkrectangle(self)->width);
}
static VALUE
gdkrect_h(self)
{
- return INT2NUM(get_gdkrectangle(self)->height);
+ return INT2NUM(get_gdkrectangle(self)->height);
}
static VALUE
gdkevent_type(self)
{
- return INT2NUM(get_gdkevent(self)->type);
+ return INT2NUM(get_gdkevent(self)->type);
}
static VALUE
gdkeventexpose_area(self)
{
- return make_gdkrectangle( &(((GdkEventExpose*)get_gdkevent(self))->area) );
+ return make_gdkrectangle(&(((GdkEventExpose*)get_gdkevent(self))->area));
}
static VALUE
gdkeventbutton_x(self)
{
- return INT2NUM(((GdkEventButton*)get_gdkevent(self))->x);
+ return INT2NUM(((GdkEventButton*)get_gdkevent(self))->x);
}
static VALUE
gdkeventbutton_y(self)
{
- return INT2NUM(((GdkEventButton*)get_gdkevent(self))->y);
+ return INT2NUM(((GdkEventButton*)get_gdkevent(self))->y);
}
static VALUE
gdkeventbutton_button(self)
{
- return INT2NUM(((GdkEventButton*)get_gdkevent(self))->button);
+ return INT2NUM(((GdkEventButton*)get_gdkevent(self))->button);
}
static VALUE
gdkeventmotion_window(self)
{
- return make_gdkwindow( ((GdkEventMotion*)get_gdkevent(self))->window);
+ return make_gdkwindow(((GdkEventMotion*)get_gdkevent(self))->window);
}
static VALUE
gdkeventmotion_x(self)
{
- return INT2NUM(((GdkEventMotion*)get_gdkevent(self))->x);
+ return INT2NUM(((GdkEventMotion*)get_gdkevent(self))->x);
}
static VALUE
gdkeventmotion_y(self)
{
- return INT2NUM(((GdkEventMotion*)get_gdkevent(self))->y);
+ return INT2NUM(((GdkEventMotion*)get_gdkevent(self))->y);
}
static VALUE
gdkeventmotion_state(self)
{
- return INT2NUM(((GdkEventMotion*)get_gdkevent(self))->state);
+ return INT2NUM(((GdkEventMotion*)get_gdkevent(self))->state);
}
static VALUE
gdkeventmotion_is_hint(self)
{
- return INT2NUM(((GdkEventMotion*)get_gdkevent(self))->is_hint);
+ return INT2NUM(((GdkEventMotion*)get_gdkevent(self))->is_hint);
}
-
static gint
idle()
{
CHECK_INTS;
-#ifdef THREAD
+#ifdef USE_THREAD
if (!rb_thread_critical) rb_thread_schedule();
#endif
return Qtrue;
@@ -6688,13 +6913,15 @@ Init_gtk()
/* GtkObject */
rb_define_method(gObject, "initialize", gobj_initialize, -1);
+ rb_define_method(gObject, "flags", gobj_get_flags, 0);
+ rb_define_method(gObject, "get_flags", gobj_get_flags, 0);
rb_define_method(gObject, "set_flags", gobj_set_flags, 1);
rb_define_method(gObject, "unset_flags", gobj_unset_flags, 1);
rb_define_method(gObject, "destroy", gobj_destroy, 0);
rb_define_method(gObject, "signal_connect", gobj_sig_connect, -1);
rb_define_method(gObject, "signal_connect_after", gobj_sig_connect_after, -1);
rb_define_method(gObject, "singleton_method_added", gobj_smethod_added, 1);
- rb_define_method(gObject, "==", grb_obj_equal, 1);
+ rb_define_method(gObject, "==", gobj_equal, 1);
rb_define_method(gObject, "inspect", gobj_inspect, 0);
/* Widget */
@@ -6721,8 +6948,6 @@ Init_gtk()
rb_define_method(gWidget, "grab_focus", widget_grab_focus, 0);
rb_define_method(gWidget, "grab_default", widget_grab_default, 0);
rb_define_method(gWidget, "set_state", widget_set_state, 1);
- rb_define_method(gWidget, "visible?", widget_visible, 0);
- rb_define_method(gWidget, "mapped?", widget_mapped, 0);
rb_define_method(gWidget, "reparent", widget_reparent, 1);
rb_define_method(gWidget, "popup", widget_popup, 2);
rb_define_method(gWidget, "intersect", widget_intersect, 2);
@@ -6738,6 +6963,7 @@ Init_gtk()
rb_define_method(gWidget, "set_extension_events", widget_set_eevents, 1);
rb_define_method(gWidget, "unparent", widget_unparent, 0);
rb_define_method(gWidget, "allocation", widget_get_alloc, 0);
+ rb_define_method(gWidget, "set_allocation", widget_set_alloc, 4);
rb_define_method(gWidget, "requisition", widget_get_requisition, 0);
rb_define_method(gWidget, "set_requisition", widget_set_requisition, 2);
rb_define_method(gWidget, "state", widget_state, 0);
@@ -6754,7 +6980,6 @@ Init_gtk()
rb_define_method(gWidget, "child?", widget_is_child, 1);
rb_define_method(gWidget, "window", widget_window, 0);
rb_define_method(gWidget, "shape_combine_mask", widget_shape_combine_mask, 3);
-
rb_define_singleton_method(gWidget, "push_colomap", widget_push_cmap, 1);
rb_define_singleton_method(gWidget, "push_visual", widget_push_visual, 1);
rb_define_singleton_method(gWidget, "push_style", widget_push_style, 1);
@@ -6762,6 +6987,30 @@ Init_gtk()
rb_define_singleton_method(gWidget, "pop_visual", widget_pop_visual, 0);
rb_define_singleton_method(gWidget, "pop_style", widget_pop_style, 0);
+ /* peek_* function is defined in gtkwidget.c but not decralated in gtk/*.h
+ so normally not using it.
+ rb_define_singleton_method(gWidget, "peek_colomap", widget_pop_cmap, 0);
+ rb_define_singleton_method(gWidget, "peek_visual", widget_pop_visual, 0);
+ rb_define_singleton_method(gWidget, "peek_style", widget_pop_style, 0);
+ */
+
+ rb_define_method(gWidget, "toplevel?", widget_TOPLEVEL, 0);
+ rb_define_method(gWidget, "no_window?", widget_NO_WINDOW, 0);
+ rb_define_method(gWidget, "realized?", widget_REALIZED, 0);
+ rb_define_method(gWidget, "mapped?", widget_MAPPED, 0);
+ rb_define_method(gWidget, "visible?", widget_VISIBLE, 0);
+ rb_define_method(gWidget, "drawable?", widget_DRAWABLE, 0);
+ rb_define_method(gWidget, "individual_sensitive?", widget_SENSITIVE, 0);
+ rb_define_method(gWidget, "parent_sensitive?", widget_PARENT_SENSITIVE, 0);
+ rb_define_method(gWidget, "sensitive?", widget_IS_SENSITIVE, 0);
+ rb_define_method(gWidget, "can_focus?", widget_CAN_FOCUS, 0);
+ rb_define_method(gWidget, "has_focus?", widget_HAS_FOCUS, 0);
+ rb_define_method(gWidget, "can_default?", widget_CAN_DEFAULT, 0);
+ rb_define_method(gWidget, "has_default?", widget_HAS_DEFAULT, 0);
+ rb_define_method(gWidget, "has_grab?", widget_HAS_GRAB, 0);
+ rb_define_method(gWidget, "basic?", widget_BASIC, 0);
+ rb_define_method(gWidget, "rc_style?", widget_RC_STYLE, 0);
+
rb_define_singleton_method(gWidget, "set_default_colomap",
widget_set_default_cmap, 1);
rb_define_singleton_method(gWidget, "set_default_visual",
@@ -6789,7 +7038,9 @@ Init_gtk()
/* Container */
rb_define_method(gContainer, "border_width", cont_bwidth, 1);
+ rb_define_method(gContainer, "get_border_width", cont_get_bwidth, 0);
rb_define_method(gContainer, "add", cont_add, 1);
+ rb_define_method(gContainer, "remove", cont_remove, 1);
rb_define_method(gContainer, "disable_resize", cont_disable_resize, 0);
rb_define_method(gContainer, "enable_resize", cont_enable_resize, 0);
rb_define_method(gContainer, "block_resize", cont_block_resize, 0);
@@ -6834,6 +7085,10 @@ Init_gtk()
/* Adjustment */
rb_define_method(gAdjustment, "initialize", adj_initialize, 6);
+ rb_define_method(gAdjustment, "set_value", adj_set_value, 1);
+ rb_define_method(gAdjustment, "get_value", adj_get_value, 0);
+ rb_define_method(gAdjustment, "value=", adj_set_value, 1);
+ rb_define_method(gAdjustment, "value", adj_get_value, 0);
/* Box */
rb_define_method(gBox, "pack_start", box_pack_start, -1);
@@ -6853,6 +7108,7 @@ Init_gtk()
rb_define_method(gTButton, "set_state", tbtn_set_state, 1);
rb_define_method(gTButton, "toggled", tbtn_toggled, 0);
rb_define_method(gTButton, "active", tbtn_active, 0);
+ rb_define_method(gTButton, "active?", tbtn_active, 0);
/* CheckButton */
rb_define_method(gCButton, "initialize", cbtn_initialize, -1);
@@ -6909,6 +7165,7 @@ Init_gtk()
rb_define_method(gCList, "remove", clist_remove, 1);
rb_define_method(gCList, "set_row_data", clist_set_row_data, 2);
rb_define_method(gCList, "get_row_data", clist_get_row_data, 1);
+ rb_define_method(gCList, "get_text", clist_get_text, 2);
rb_define_method(gCList, "select_row", clist_select_row, 2);
rb_define_method(gCList, "unselect_row", clist_unselect_row, 2);
rb_define_method(gCList, "clear", clist_clear, 0);
@@ -7122,6 +7379,8 @@ Init_gtk()
/* Label */
rb_define_method(gLabel, "initialize", label_initialize, 1);
rb_define_method(gLabel, "get", label_get, 0);
+ rb_define_method(gLabel, "jtype", label_get_jtype, 0);
+ rb_define_method(gLabel, "jtype=", label_set_jtype, 1);
rb_define_method(gLabel, "set", label_set, 1);
rb_define_method(gLabel, "jtype", label_get_jtype, 0);
rb_define_method(gLabel, "jtype=", label_set_jtype, 1);
@@ -7323,7 +7582,7 @@ Init_gtk()
rb_define_method(gStyle, "dup", style_copy, 0);
rb_define_method(gStyle, "attach", style_attach, 1);
rb_define_method(gStyle, "detach", style_detach, 0);
- rb_define_method(gStyle, "set_background", style_set_background, 1);
+ rb_define_method(gStyle, "set_background", style_set_background, 2);
rb_define_method(gStyle, "fg", style_fg, 1);
rb_define_method(gStyle, "bg", style_bg, 1);
rb_define_method(gStyle, "light", style_light, 1);
@@ -7364,17 +7623,21 @@ Init_gtk()
rb_define_method(gStyle, "draw_string", style_draw_string, 5);
#endif
+ rb_define_singleton_method(gAllocation, "new", gallocation_new, 4);
rb_define_method(gAllocation, "x", gallocation_x, 0);
rb_define_method(gAllocation, "y", gallocation_y, 0);
rb_define_method(gAllocation, "width", gallocation_w, 0);
rb_define_method(gAllocation, "height", gallocation_h, 0);
+ rb_define_method(gAllocation, "to_a", gallocation_to_a, 0);
+ rb_define_method(gAllocation, "to_s", gallocation_to_s, 0);
+ rb_define_singleton_method(gRequisition, "new", grequisition_new, 2);
rb_define_method(gRequisition, "width", grequisition_w, 0);
rb_define_method(gRequisition, "height", grequisition_h, 0);
- /*
rb_define_method(gRequisition, "width=", grequisition_set_w, 1);
rb_define_method(gRequisition, "height=", grequisition_set_h, 1);
- */
+ rb_define_method(gRequisition, "to_a", grequisition_to_a, 0);
+ rb_define_method(gRequisition, "to_s", grequisition_to_s, 0);
/* Gtk module */
rb_define_module_function(mGtk, "main", gtk_m_main, 0);
@@ -7402,7 +7665,6 @@ Init_gtk()
/* Gdk module */
/* GdkFont */
rb_define_singleton_method(gdkFont, "load_font", gdkfnt_load_font, 1);
- rb_define_singleton_method(gdkFont, "new", gdkfnt_new, 1);
rb_define_singleton_method(gdkFont, "load_fontset", gdkfnt_load_fontset, 1);
rb_define_method(gdkFont, "string_width", gdkfnt_string_width, 1);
rb_define_method(gdkFont, "ascent", gdkfnt_ascent, 0);
@@ -7449,6 +7711,9 @@ Init_gtk()
rb_define_method(gdkWindow, "clear_area_e", gdkwin_clear, 4);
rb_define_method(gdkWindow, "set_background", gdkwin_set_background, 1);
rb_define_method(gdkWindow, "set_back_pixmap", gdkwin_set_back_pixmap, 2);
+ rb_define_method(gdkWindow, "move", gdkwin_move, 2);
+ rb_define_method(gdkWindow, "resize", gdkwin_resize, 2);
+ rb_define_method(gdkWindow, "move_resize", gdkwin_move_resize, 4);
/* GdkGC */
rb_define_singleton_method(gdkGC, "new", gdkgc_s_new, 1);
@@ -7508,15 +7773,18 @@ Init_gtk()
rb_define_const(mGtk, "CAN_DEFAULT", INT2FIX(GTK_CAN_DEFAULT));
rb_define_const(mGtk, "BASIC", INT2FIX(GTK_BASIC));
+ /* GtkStateType */
+ rb_define_const(mGtk, "STATE_NORMAL", INT2FIX(GTK_STATE_NORMAL));
+ rb_define_const(mGtk, "STATE_ACTIVE", INT2FIX(GTK_STATE_ACTIVE));
+ rb_define_const(mGtk, "STATE_PRELIGHT", INT2FIX(GTK_STATE_PRELIGHT));
+ rb_define_const(mGtk, "STATE_SELECTED", INT2FIX(GTK_STATE_SELECTED));
+ rb_define_const(mGtk, "STATE_INSENSITIVE", INT2FIX(GTK_STATE_INSENSITIVE));
+
/* GtkWindowType */
rb_define_const(mGtk, "WINDOW_TOPLEVEL", INT2FIX(GTK_WINDOW_TOPLEVEL));
rb_define_const(mGtk, "WINDOW_DIALOG", INT2FIX(GTK_WINDOW_DIALOG));
rb_define_const(mGtk, "WINDOW_POPUP", INT2FIX(GTK_WINDOW_POPUP));
- rb_define_const(mGtk, "WIN_POS_NONE", INT2FIX(GTK_WIN_POS_NONE));
- rb_define_const(mGtk, "WIN_POS_CENTER", INT2FIX(GTK_WIN_POS_CENTER));
- rb_define_const(mGtk, "WIN_POS_MOUSE", INT2FIX(GTK_WIN_POS_MOUSE));
-
/* GtkDirectionType */
rb_define_const(mGtk, "DIR_TAB_FORWARD", INT2FIX(GTK_DIR_TAB_FORWARD));
rb_define_const(mGtk, "DIR_TAB_BACKWARD", INT2FIX(GTK_DIR_TAB_BACKWARD));
@@ -7525,78 +7793,124 @@ Init_gtk()
rb_define_const(mGtk, "DIR_LEFT", INT2FIX(GTK_DIR_LEFT));
rb_define_const(mGtk, "DIR_RIGHT", INT2FIX(GTK_DIR_RIGHT));
- /* GtkPolicyType */
- rb_define_const(mGtk, "POLICY_ALWAYS", INT2FIX(GTK_POLICY_ALWAYS));
- rb_define_const(mGtk, "POLICY_AUTOMATIC", INT2FIX(GTK_POLICY_AUTOMATIC));
-
- /* GtkJustification */
- rb_define_const(mGtk, "JUSTIFY_LEFT", INT2FIX(GTK_JUSTIFY_LEFT));
- rb_define_const(mGtk, "JUSTIFY_RIGHT", INT2FIX(GTK_JUSTIFY_RIGHT));
- rb_define_const(mGtk, "JUSTIFY_CENTER", INT2FIX(GTK_JUSTIFY_CENTER));
- rb_define_const(mGtk, "JUSTIFY_FILL", INT2FIX(GTK_JUSTIFY_FILL));
-
- /* GtkSelectionMode */
- rb_define_const(mGtk, "SELECTION_SINGLE", INT2FIX(GTK_SELECTION_SINGLE));
- rb_define_const(mGtk, "SELECTION_BROWSE", INT2FIX(GTK_SELECTION_BROWSE));
- rb_define_const(mGtk, "SELECTION_MULTIPLE", INT2FIX(GTK_SELECTION_MULTIPLE));
- rb_define_const(mGtk, "SELECTION_EXTENDED", INT2FIX(GTK_SELECTION_EXTENDED));
- /* GtkPositionType */
- rb_define_const(mGtk, "POS_LEFT", INT2FIX(GTK_POS_LEFT));
- rb_define_const(mGtk, "POS_RIGHT", INT2FIX(GTK_POS_RIGHT));
- rb_define_const(mGtk, "POS_TOP", INT2FIX(GTK_POS_TOP));
- rb_define_const(mGtk, "POS_BOTTOM", INT2FIX(GTK_POS_BOTTOM));
-
/* GtkShadowType */
rb_define_const(mGtk, "SHADOW_NONE", INT2FIX(GTK_SHADOW_NONE));
rb_define_const(mGtk, "SHADOW_IN", INT2FIX(GTK_SHADOW_IN));
rb_define_const(mGtk, "SHADOW_OUT", INT2FIX(GTK_SHADOW_OUT));
rb_define_const(mGtk, "SHADOW_ETCHED_IN", INT2FIX(GTK_SHADOW_ETCHED_IN));
rb_define_const(mGtk, "SHADOW_ETCHED_OUT", INT2FIX(GTK_SHADOW_ETCHED_OUT));
- /* GtkStateType */
- rb_define_const(mGtk, "STATE_NORMAL", INT2FIX(GTK_STATE_NORMAL));
- rb_define_const(mGtk, "STATE_ACTIVE", INT2FIX(GTK_STATE_ACTIVE));
- rb_define_const(mGtk, "STATE_PRELIGHT", INT2FIX(GTK_STATE_PRELIGHT));
- rb_define_const(mGtk, "STATE_SELECTED", INT2FIX(GTK_STATE_SELECTED));
- rb_define_const(mGtk, "STATE_INSENSITIVE", INT2FIX(GTK_STATE_INSENSITIVE));
+
+ /* GtkArrowType */
+ rb_define_const(mGtk, "ARROW_UP", INT2FIX(GTK_ARROW_UP));
+ rb_define_const(mGtk, "ARROW_DOWN", INT2FIX(GTK_ARROW_DOWN));
+ rb_define_const(mGtk, "ARROW_LEFT", INT2FIX(GTK_ARROW_LEFT));
+ rb_define_const(mGtk, "ARROW_RIGHT", INT2FIX(GTK_ARROW_RIGHT));
+
+ /* GtkPackType */
+ rb_define_const(mGtk, "GTK_PACK_START", INT2FIX(GTK_PACK_START));
+ rb_define_const(mGtk, "GTK_PACK_END", INT2FIX(GTK_PACK_END));
+
+ /* GtkPolicyType */
+ rb_define_const(mGtk, "POLICY_ALWAYS", INT2FIX(GTK_POLICY_ALWAYS));
+ rb_define_const(mGtk, "POLICY_AUTOMATIC", INT2FIX(GTK_POLICY_AUTOMATIC));
+
+ /* GtkUpdateType */
+ rb_define_const(mGtk, "UPDATE_CONTINUOUS", INT2FIX(GTK_UPDATE_CONTINUOUS));
+ rb_define_const(mGtk, "UPDATE_DISCONTINUOUS", INT2FIX(GTK_UPDATE_DISCONTINUOUS));
+ rb_define_const(mGtk, "UPDATE_DELAYED", INT2FIX(GTK_UPDATE_DELAYED));
+
/* GtkAttachOptions */
rb_define_const(mGtk, "EXPAND", INT2FIX(GTK_EXPAND));
rb_define_const(mGtk, "SHRINK", INT2FIX(GTK_SHRINK));
rb_define_const(mGtk, "FILL", INT2FIX(GTK_FILL));
+
+ /* GtkSignalRunOptions */
+ rb_define_const(mGtk, "RUN_FIRST", INT2FIX(GTK_RUN_FIRST));
+ rb_define_const(mGtk, "RUN_LAST", INT2FIX(GTK_RUN_LAST));
+ rb_define_const(mGtk, "RUN_BOTH", INT2FIX(GTK_RUN_BOTH));
+ rb_define_const(mGtk, "RUN_MASK", INT2FIX(GTK_RUN_MASK));
+ rb_define_const(mGtk, "RUN_NO_RECURSE", INT2FIX(GTK_RUN_NO_RECURSE));
+
+ /* GtkWindowPosition */
+ rb_define_const(mGtk, "WIN_POS_NONE", INT2FIX(GTK_WIN_POS_NONE));
+ rb_define_const(mGtk, "WIN_POS_CENTER", INT2FIX(GTK_WIN_POS_CENTER));
+ rb_define_const(mGtk, "WIN_POS_MOUSE", INT2FIX(GTK_WIN_POS_MOUSE));
+
/* GtkSubmenuDirection */
rb_define_const(mGtk, "DIRECTION_LEFT", INT2FIX(GTK_DIRECTION_LEFT));
rb_define_const(mGtk, "DIRECTION_RIGHT", INT2FIX(GTK_DIRECTION_RIGHT));
+
/* GtkSubmenuPlacement */
rb_define_const(mGtk, "TOP_BOTTOM", INT2FIX(GTK_TOP_BOTTOM));
rb_define_const(mGtk, "LEFT_RIGHT", INT2FIX(GTK_LEFT_RIGHT));
+
+ /* GtkMenuFactoryType */
+ rb_define_const(mGtk, "MENU_FACTORY_MENU", INT2FIX(GTK_MENU_FACTORY_MENU));
+ rb_define_const(mGtk, "MENU_FACTORY_MENU_BAR", INT2FIX(GTK_MENU_FACTORY_MENU_BAR));
+ rb_define_const(mGtk, "MENU_FACTORY_OPTION_MENU", INT2FIX(GTK_MENU_FACTORY_OPTION_MENU));
+
/* GtkMetricType */
rb_define_const(mGtk, "PIXELS", INT2FIX(GTK_PIXELS));
rb_define_const(mGtk, "INCHES", INT2FIX(GTK_INCHES));
rb_define_const(mGtk, "CENTIMETERS", INT2FIX(GTK_CENTIMETERS));
- /* GtkArrowType */
- rb_define_const(mGtk, "ARROW_UP", INT2FIX(GTK_ARROW_UP));
- rb_define_const(mGtk, "ARROW_DOWN", INT2FIX(GTK_ARROW_DOWN));
- rb_define_const(mGtk, "ARROW_LEFT", INT2FIX(GTK_ARROW_LEFT));
- rb_define_const(mGtk, "ARROW_RIGHT", INT2FIX(GTK_ARROW_RIGHT));
+ /* GtkScrollType */
+ rb_define_const(mGtk, "SCROLL_NONE", INT2FIX(GTK_SCROLL_NONE));
+ rb_define_const(mGtk, "SCROLL_STEP_BACKWARD", INT2FIX(GTK_SCROLL_STEP_BACKWARD));
+ rb_define_const(mGtk, "SCROLL_STEP_FORWARD", INT2FIX(GTK_SCROLL_STEP_FORWARD));
+ rb_define_const(mGtk, "SCROLL_PAGE_BACKWARD", INT2FIX(GTK_SCROLL_PAGE_BACKWARD));
+ rb_define_const(mGtk, "SCROLL_PAGE_FORWARD", INT2FIX(GTK_SCROLL_PAGE_FORWARD));
+ rb_define_const(mGtk, "SCROLL_JUMP", INT2FIX(GTK_SCROLL_JUMP));
+
+ /* GtkTroughType */
+ rb_define_const(mGtk, "TROUGH_NONE", INT2FIX(GTK_TROUGH_NONE));
+ rb_define_const(mGtk, "TROUGH_START", INT2FIX(GTK_TROUGH_START));
+ rb_define_const(mGtk, "TROUGH_END", INT2FIX(GTK_TROUGH_END));
+ rb_define_const(mGtk, "TROUGH_JUMP", INT2FIX(GTK_TROUGH_JUMP));
+
+ /* GtkPositionType */
+ rb_define_const(mGtk, "POS_LEFT", INT2FIX(GTK_POS_LEFT));
+ rb_define_const(mGtk, "POS_RIGHT", INT2FIX(GTK_POS_RIGHT));
+ rb_define_const(mGtk, "POS_TOP", INT2FIX(GTK_POS_TOP));
+ rb_define_const(mGtk, "POS_BOTTOM", INT2FIX(GTK_POS_BOTTOM));
/* GtkPreviewType */
rb_define_const(mGtk, "PREVIEW_COLOR", INT2FIX(GTK_PREVIEW_COLOR));
rb_define_const(mGtk, "PREVIEW_GRAYSCALE", INT2FIX(GTK_PREVIEW_GRAYSCALE));
- rb_define_const(mGtk, "BUTTONBOX_DEFAULT", INT2FIX(GTK_BUTTONBOX_DEFAULT));
- rb_define_const(mGtk, "BUTTONBOX_SPREAD", INT2FIX(GTK_BUTTONBOX_SPREAD));
- rb_define_const(mGtk, "BUTTONBOX_EDGE", INT2FIX(GTK_BUTTONBOX_EDGE));
- rb_define_const(mGtk, "BUTTONBOX_START", INT2FIX(GTK_BUTTONBOX_START));
- rb_define_const(mGtk, "BUTTONBOX_END", INT2FIX(GTK_BUTTONBOX_END));
+ /* GtkJustification */
+ rb_define_const(mGtk, "JUSTIFY_LEFT", INT2FIX(GTK_JUSTIFY_LEFT));
+ rb_define_const(mGtk, "JUSTIFY_RIGHT", INT2FIX(GTK_JUSTIFY_RIGHT));
+ rb_define_const(mGtk, "JUSTIFY_CENTER", INT2FIX(GTK_JUSTIFY_CENTER));
+ rb_define_const(mGtk, "JUSTIFY_FILL", INT2FIX(GTK_JUSTIFY_FILL));
+
+ /* GtkSelectionMode */
+ rb_define_const(mGtk, "SELECTION_SINGLE", INT2FIX(GTK_SELECTION_SINGLE));
+ rb_define_const(mGtk, "SELECTION_BROWSE", INT2FIX(GTK_SELECTION_BROWSE));
+ rb_define_const(mGtk, "SELECTION_MULTIPLE", INT2FIX(GTK_SELECTION_MULTIPLE));
+ rb_define_const(mGtk, "SELECTION_EXTENDED", INT2FIX(GTK_SELECTION_EXTENDED));
+
+ /* GtkOrientation */
+ rb_define_const(mGtk, "ORIENTATION_HORIZONTAL", INT2FIX(GTK_ORIENTATION_HORIZONTAL));
+ rb_define_const(mGtk, "ORIENTATION_VERTICAL", INT2FIX(GTK_ORIENTATION_VERTICAL));
/* GtkToolbarStyle */
rb_define_const(mGtk, "TOOLBAR_ICONS", INT2FIX(GTK_TOOLBAR_ICONS));
rb_define_const(mGtk, "TOOLBAR_TEXT", INT2FIX(GTK_TOOLBAR_TEXT));
rb_define_const(mGtk, "TOOLBAR_BOTH", INT2FIX(GTK_TOOLBAR_BOTH));
- /* GtkOrientation */
- rb_define_const(mGtk, "ORIENTATION_HORIZONTAL", INT2FIX(GTK_ORIENTATION_HORIZONTAL));
- rb_define_const(mGtk, "ORIENTATION_VERTICAL", INT2FIX(GTK_ORIENTATION_VERTICAL));
+ /* GtkVisibility */
+ rb_define_const(mGtk, "VISIBILITY_NONE", INT2FIX(GTK_VISIBILITY_NONE));
+ rb_define_const(mGtk, "VISIBILITY_PARTIAL", INT2FIX(GTK_VISIBILITY_PARTIAL));
+ rb_define_const(mGtk, "VISIBILITY_FULL", INT2FIX(GTK_VISIBILITY_FULL));
+
+
+ /* GtkButtonBox */
+ rb_define_const(mGtk, "BUTTONBOX_DEFAULT", INT2FIX(GTK_BUTTONBOX_DEFAULT));
+ rb_define_const(mGtk, "BUTTONBOX_SPREAD", INT2FIX(GTK_BUTTONBOX_SPREAD));
+ rb_define_const(mGtk, "BUTTONBOX_EDGE", INT2FIX(GTK_BUTTONBOX_EDGE));
+ rb_define_const(mGtk, "BUTTONBOX_START", INT2FIX(GTK_BUTTONBOX_START));
+ rb_define_const(mGtk, "BUTTONBOX_END", INT2FIX(GTK_BUTTONBOX_END));
/* GdkMiscMode */
rb_define_const(mGdk, "FUNCTION_COPY", INT2FIX(GDK_COPY));
diff --git a/ext/kconv/kconv.c b/ext/kconv/kconv.c
index d9bb2b4..a334982 100644
--- a/ext/kconv/kconv.c
+++ b/ext/kconv/kconv.c
@@ -1891,10 +1891,15 @@ static VALUE
kconv_guess(obj, src)
VALUE obj, src;
{
- unsigned char *p = RSTRING(src)->ptr;
- unsigned char *pend = p + RSTRING(src)->len;
+ unsigned char *p;
+ unsigned char *pend;
int sequence_counter = 0;
+ Check_Type(src, T_STRING);
+
+ p = RSTRING(src)->ptr;
+ pend = p + RSTRING(src)->len;
+
#define INCR do {\
p++;\
if (p==pend) return INT2FIX(_UNKNOWN);\
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index f3cfafb..9dbd51f 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -30,7 +30,7 @@ extern int rb_thread_select(int, fd_set*, fd_set*, fd_set*, struct timeval*); /*
# include <GUSI.h>
#endif
-#if defined(THREAD) && defined(HAVE_FCNTL)
+#if defined(USE_THREAD) && defined(HAVE_FCNTL)
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
@@ -72,9 +72,12 @@ static void
sock_finalize(fptr)
OpenFile *fptr;
{
- SOCKET s = fileno(fptr->f);
+ SOCKET s;
+
+ if (!fptr->f) return;
+ s = fileno(fptr->f);
free(fptr->f);
- free(fptr->f2);
+ if (fptr->f2) free(fptr->f2);
closesocket(s);
}
#endif
@@ -130,6 +133,55 @@ bsock_shutdown(argc, argv, sock)
}
static VALUE
+bsock_close_read(sock)
+ VALUE sock;
+{
+ OpenFile *fptr;
+
+ rb_secure(4);
+ GetOpenFile(sock, fptr);
+ if (fptr->f2 == 0) {
+ return rb_io_close(sock);
+ }
+ if (shutdown(fileno(fptr->f), 0) == -1)
+ rb_sys_fail(0);
+ fptr->mode &= ~FMODE_READABLE;
+#ifdef NT
+ free(fptr->f);
+#else
+ fclose(fptr->f);
+#endif
+ fptr->f = fptr->f2;
+ fptr->f2 = 0;
+
+ return Qnil;
+}
+
+static VALUE
+bsock_close_write(sock)
+ VALUE sock;
+{
+ OpenFile *fptr;
+
+ rb_secure(4);
+ GetOpenFile(sock, fptr);
+ if (fptr->f2 == 0) {
+ return rb_io_close(sock);
+ }
+ if (shutdown(fileno(fptr->f), 1) == -1)
+ rb_sys_fail(0);
+ fptr->mode &= ~FMODE_WRITABLE;
+#ifdef NT
+ free(fptr->f2);
+#else
+ fclose(fptr->f2);
+#endif
+ fptr->f2 = 0;
+
+ return Qnil;
+}
+
+static VALUE
bsock_setsockopt(sock, lev, optname, val)
VALUE sock, lev, optname, val;
{
@@ -235,10 +287,10 @@ bsock_send(argc, argv, sock)
rb_scan_args(argc, argv, "21", &msg, &flags, &to);
GetOpenFile(sock, fptr);
- f = fptr->f2?fptr->f2:fptr->f;
+ f = GetWriteFile(fptr);
fd = fileno(f);
retry:
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_fd_writable(fd);
#endif
m = rb_str2cstr(msg, &mlen);
@@ -257,7 +309,7 @@ bsock_send(argc, argv, sock)
#if EAGAIN != EWOULDBLOCK
case EAGAIN:
#endif
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_schedule();
#endif
goto retry;
@@ -303,7 +355,7 @@ s_recv(sock, argc, argv, from)
GetOpenFile(sock, fptr);
fd = fileno(fptr->f);
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_wait_fd(fd);
#endif
TRAP_BEG;
@@ -319,7 +371,7 @@ s_recv(sock, argc, argv, from)
#if EAGAIN != EWOULDBLOCK
case EAGAIN:
#endif
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_schedule();
#endif
goto retry;
@@ -449,7 +501,7 @@ setipaddr(name, addr)
}
}
-#if defined(THREAD) && defined(HAVE_FCNTL)
+#if defined(USE_THREAD) && defined(HAVE_FCNTL)
static int
thread_connect(fd, sockaddr, len, type)
int fd;
@@ -607,7 +659,7 @@ open_inet(class, h, serv, type)
syscall = "bind(2)";
}
else {
-#if defined(THREAD) && defined(HAVE_FCNTL)
+#if defined(USE_THREAD) && defined(HAVE_FCNTL)
status = thread_connect(fd, (struct sockaddr*)&sockaddr,
sizeof(sockaddr), type);
#else
@@ -726,7 +778,7 @@ s_accept(class, fd, sockaddr, len)
int fd2;
retry:
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_wait_fd(fd);
#endif
TRAP_BEG;
@@ -739,7 +791,7 @@ s_accept(class, fd, sockaddr, len)
#if EAGAIN != EWOULDBLOCK
case EAGAIN:
#endif
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_schedule();
#endif
goto retry;
@@ -927,7 +979,7 @@ udp_connect(sock, host, port)
#if EAGAIN != EWOULDBLOCK
case EAGAIN:
#endif
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_schedule();
#endif
goto retry;
@@ -974,7 +1026,7 @@ udp_send(argc, argv, sock)
udp_addrsetup(host, port, &addr);
GetOpenFile(sock, fptr);
- f = fptr->f2?fptr->f2:fptr->f;
+ f = GetWriteFile(fptr);
m = rb_str2cstr(mesg, &mlen);
retry:
n = sendto(fileno(f), m, mlen, NUM2INT(flags),
@@ -986,7 +1038,7 @@ udp_send(argc, argv, sock)
#if EAGAIN != EWOULDBLOCK
case EAGAIN:
#endif
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_schedule();
#endif
goto retry;
@@ -1239,7 +1291,7 @@ sock_connect(sock, addr)
#if EAGAIN != EWOULDBLOCK
case EAGAIN:
#endif
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_schedule();
#endif
goto retry;
@@ -1469,6 +1521,8 @@ Init_socket()
rb_cBasicSocket = rb_define_class("BasicSocket", rb_cIO);
rb_undef_method(CLASS_OF(rb_cBasicSocket), "new");
rb_undef_method(CLASS_OF(rb_cBasicSocket), "open");
+ rb_define_method(rb_cBasicSocket, "close_read", bsock_close_read, 0);
+ rb_define_method(rb_cBasicSocket, "close_write", bsock_close_write, 0);
rb_define_method(rb_cBasicSocket, "shutdown", bsock_shutdown, -1);
rb_define_method(rb_cBasicSocket, "setsockopt", bsock_setsockopt, 3);
rb_define_method(rb_cBasicSocket, "getsockopt", bsock_getsockopt, 2);
diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb
index 55cdc49..14c8e45 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/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index b3ff66e..625fe61 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -55,7 +55,7 @@ void _timer_for_tcl (ClientData clientData)
timer->flag = 0;
CHECK_INTS;
-#ifdef THREAD
+#ifdef USE_THREAD
if (!rb_thread_critical) rb_thread_schedule();
#endif
@@ -82,7 +82,7 @@ lib_mainloop(VALUE self)
}
DUMP1("stop Tk_Mainloop");
-#ifdef THREAD
+#ifdef USE_THREAD
if (timer->flag) {
Tk_DeleteTimerHandler(timer->token);
}
diff --git a/file.c b/file.c
index 72dd022..1d81f52 100644
--- a/file.c
+++ b/file.c
@@ -115,6 +115,7 @@ rb_file_reopen(argc, argv, file)
char *mode;
OpenFile *fptr;
+ rb_secure(2);
if (rb_scan_args(argc, argv, "11", &fname, &nmode) == 1) {
if (TYPE(fname) == T_FILE) { /* fname must be IO */
return rb_io_reopen(file, fname);
@@ -234,9 +235,10 @@ rb_stat(file, st)
VALUE file;
struct stat *st;
{
- OpenFile *fptr;
-
if (TYPE(file) == T_FILE) {
+ OpenFile *fptr;
+
+ rb_secure(2);
GetOpenFile(file, fptr);
return fstat(fileno(fptr->f), st);
}
@@ -296,6 +298,7 @@ rb_file_lstat(obj)
OpenFile *fptr;
struct stat st;
+ rb_secure(2);
GetOpenFile(obj, fptr);
if (lstat(fptr->path, &st) == -1) {
rb_sys_fail(fptr->path);
@@ -1106,6 +1109,7 @@ rb_file_s_umask(argc, argv)
#else
int omask = 0;
+ rb_secure(2);
if (argc == 0) {
omask = umask(0);
umask(omask);
@@ -1382,7 +1386,7 @@ rb_file_truncate(obj, len)
# define LOCK_UN 8
# endif
-#if defined(THREAD) && defined(EWOULDBLOCK)
+#if defined(USE_THREAD) && defined(EWOULDBLOCK)
static int
rb_thread_flock(fd, op)
int fd, op;
diff --git a/gc.c b/gc.c
index ad5969c..48f83d3 100644
--- a/gc.c
+++ b/gc.c
@@ -10,6 +10,7 @@
************************************************/
+#define RUBY_NO_INLINE
#include "ruby.h"
#include "rubysig.h"
#include "st.h"
@@ -302,8 +303,8 @@ looks_pointerp(ptr)
static void
mark_locations_array(x, n)
- VALUE *x;
- long n;
+ register VALUE *x;
+ register long n;
{
while (n--) {
if (looks_pointerp(*x)) {
@@ -399,6 +400,9 @@ rb_gc_mark(ptr)
case NODE_FOR:
case NODE_ITER:
case NODE_CREF:
+ case NODE_WHEN:
+ case NODE_MASGN:
+ case NODE_RESBODY:
rb_gc_mark(obj->as.node.u2.node);
/* fall through */
case NODE_BLOCK: /* 1,3 */
@@ -409,7 +413,10 @@ rb_gc_mark(ptr)
case NODE_DREGX:
case NODE_DREGX_ONCE:
case NODE_FBODY:
+ case NODE_ENSURE:
case NODE_CALL:
+ case NODE_DEFS:
+ case NODE_OP_ASGN1:
#ifdef C_ALLOCA
case NODE_ALLOCA:
#endif
@@ -417,23 +424,41 @@ rb_gc_mark(ptr)
/* fall through */
case NODE_SUPER: /* 3 */
case NODE_FCALL:
+ case NODE_DEFN:
case NODE_NEWLINE:
obj = RANY(obj->as.node.u3.node);
goto Top;
case NODE_WHILE: /* 1,2 */
case NODE_UNTIL:
+ case NODE_AND:
+ case NODE_OR:
+ case NODE_CASE:
+ case NODE_RESCUE:
+ case NODE_ARGS:
+ case NODE_DOT2:
+ case NODE_DOT3:
+ case NODE_FLIP2:
+ case NODE_FLIP3:
case NODE_MATCH2:
case NODE_MATCH3:
+ case NODE_SCLASS:
rb_gc_mark(obj->as.node.u1.node);
/* fall through */
case NODE_METHOD: /* 2 */
+ case NODE_MODULE:
case NODE_NOT:
case NODE_GASGN:
case NODE_LASGN:
case NODE_DASGN:
+ case NODE_DASGN_PUSH:
case NODE_IASGN:
case NODE_CASGN:
+ case NODE_OP_ASGN_OR:
+ case NODE_OP_ASGN_AND:
+ case NODE_COLON3:
+ case NODE_OPT_N:
+ case NODE_BLOCK_PASS:
obj = RANY(obj->as.node.u2.node);
goto Top;
@@ -443,15 +468,20 @@ rb_gc_mark(ptr)
case NODE_XSTR:
case NODE_DEFINED:
case NODE_MATCH:
+ case NODE_RETURN:
+ case NODE_YIELD:
+ case NODE_COLON2:
obj = RANY(obj->as.node.u1.node);
goto Top;
case NODE_SCOPE: /* 2,3 */
+ case NODE_CLASS:
rb_gc_mark(obj->as.node.u3.node);
obj = RANY(obj->as.node.u2.node);
goto Top;
case NODE_ZARRAY: /* - */
+ case NODE_ZSUPER:
case NODE_CFUNC:
case NODE_VCALL:
case NODE_GVAR:
@@ -463,9 +493,17 @@ rb_gc_mark(ptr)
case NODE_BACK_REF:
case NODE_ALIAS:
case NODE_VALIAS:
+ case NODE_BREAK:
+ case NODE_NEXT:
+ case NODE_REDO:
+ case NODE_RETRY:
case NODE_UNDEF:
case NODE_SELF:
case NODE_NIL:
+ case NODE_TRUE:
+ case NODE_FALSE:
+ case NODE_ATTRSET:
+ case NODE_BLOCK_ARG:
case NODE_POSTEXE:
break;
@@ -487,11 +525,6 @@ rb_gc_mark(ptr)
rb_gc_mark(obj->as.basic.klass);
switch (obj->as.basic.flags & T_MASK) {
case T_ICLASS:
- rb_gc_mark(obj->as.klass.super);
- mark_tbl(obj->as.klass.iv_tbl);
- mark_tbl(obj->as.klass.m_tbl);
- break;
-
case T_CLASS:
case T_MODULE:
rb_gc_mark(obj->as.klass.super);
@@ -691,12 +724,9 @@ obj_free(obj)
if ((long)RANY(obj)->as.data.dfree == -1) {
free(DATA_PTR(obj));
}
- if (RANY(obj)->as.data.dfree) {
+ else if (RANY(obj)->as.data.dfree) {
(*RANY(obj)->as.data.dfree)(DATA_PTR(obj));
}
- else {
- free(DATA_PTR(obj));
- }
}
break;
case T_MATCH:
@@ -753,13 +783,7 @@ void
rb_gc_mark_frame(frame)
struct FRAME *frame;
{
- int n = frame->argc;
- VALUE *tbl = frame->argv;
-
- while (n--) {
- rb_gc_mark_maybe(*tbl);
- tbl++;
- }
+ mark_locations_array(frame->argv, frame->argc);
rb_gc_mark(frame->cbase);
}
@@ -835,7 +859,7 @@ rb_gc()
(VALUE*)((char*)&stack_end + 2));
#endif
-#ifdef THREAD
+#ifdef USE_THREAD
rb_gc_mark_threads();
#endif
diff --git a/hash.c b/hash.c
index a5b8f5f..e049776 100644
--- a/hash.c
+++ b/hash.c
@@ -28,7 +28,6 @@ static void
rb_hash_modify(hash)
VALUE hash;
{
- rb_secure(5);
if (FL_TEST(hash, HASH_FREEZE)) {
rb_raise(rb_eTypeError, "can't modify frozen hash");
}
@@ -899,8 +898,8 @@ path_check_1(path)
}
}
-static void
-path_check(path)
+void
+rb_path_check(path)
char *path;
{
char *p = path;
@@ -934,7 +933,7 @@ int
rb_env_path_tainted()
{
if (path_tainted < 0) {
- path_check(getenv("PATH"));
+ rb_path_check(getenv("PATH"));
}
return path_tainted;
}
@@ -967,7 +966,7 @@ rb_f_setenv(obj, name, value)
return Qtrue;
}
- path_check(RSTRING(name)->ptr);
+ rb_path_check(RSTRING(name)->ptr);
}
return Qtrue;
}
diff --git a/inits.c b/inits.c
index 6486de2..3708edc 100644
--- a/inits.c
+++ b/inits.c
@@ -54,7 +54,7 @@ rb_call_inits()
Init_eval();
Init_String();
Init_Exception();
-#ifdef THREAD
+#ifdef USE_THREAD
Init_Thread();
#endif
Init_Numeric();
diff --git a/instruby.rb b/instruby.rb
index d632442..7dee03a 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
diff --git a/intern.h b/intern.h
index 5f6386b..1192c27 100644
--- a/intern.h
+++ b/intern.h
@@ -80,7 +80,7 @@ VALUE rb_singleton_class _((VALUE));
VALUE rb_enum_length _((VALUE));
/* error.c */
extern int ruby_nerrs;
-VALUE rb_exc_new _((VALUE, char*, unsigned int));
+VALUE rb_exc_new _((VALUE, char*, int));
VALUE rb_exc_new2 _((VALUE, char*));
VALUE rb_exc_new3 _((VALUE, VALUE));
void rb_loaderror __((char*, ...)) NORETURN;
@@ -108,7 +108,7 @@ VALUE rb_apply _((VALUE, ID, VALUE));
VALUE rb_funcall2 _((VALUE, ID, int, VALUE*));
void rb_backtrace _((void));
ID rb_frame_last_func _((void));
-VALUE rb_f_load _((VALUE, VALUE));
+void rb_load _((VALUE, VALUE));
void rb_provide _((char*));
VALUE rb_f_require _((VALUE, VALUE));
void rb_obj_call_init _((VALUE));
@@ -137,15 +137,16 @@ void rb_global_variable _((VALUE*));
void rb_gc_mark_locations _((VALUE*, VALUE*));
void rb_gc_mark_maybe();
void rb_gc_mark();
-void rb_gc_force_recycle();
+void rb_gc_force_recycle _((VALUE));
void rb_gc _((void));
void rb_gc_call_finalizer_at_exit _((void));
/* hash.c */
-VALUE rb_hash_freeze _((VALUE));
VALUE rb_hash _((VALUE));
VALUE rb_hash_new _((void));
+VALUE rb_hash_freeze _((VALUE));
VALUE rb_hash_aref _((VALUE, VALUE));
VALUE rb_hash_aset _((VALUE, VALUE, VALUE));
+void rb_path_check _((char *));
int rb_env_path_tainted _((void));
/* io.c */
extern VALUE rb_fs;
@@ -154,7 +155,6 @@ extern VALUE rb_rs;
extern VALUE rb_default_rs;
extern VALUE rb_output_rs;
VALUE rb_io_write _((VALUE, VALUE));
-VALUE rb_io_gets_method _((int, VALUE*, VALUE));
VALUE rb_io_gets _((VALUE));
VALUE rb_io_getc _((VALUE));
VALUE rb_io_ungetc _((VALUE, VALUE));
@@ -162,7 +162,7 @@ VALUE rb_io_close _((VALUE));
VALUE rb_io_binmode _((VALUE));
int rb_io_mode_flags _((char*));
VALUE rb_io_reopen _((VALUE, VALUE));
-VALUE rb_f_gets _((void));
+VALUE rb_gets _((void));
void rb_str_setter _((VALUE, ID, VALUE*));
/* numeric.c */
void rb_num_zerodiv _((void));
@@ -239,7 +239,7 @@ void rb_trap_exec _((void));
/* sprintf.c */
VALUE rb_f_sprintf _((int, VALUE*));
/* string.c */
-VALUE rb_str_new _((char*, unsigned int));
+VALUE rb_str_new _((char*, int));
VALUE rb_str_new2 _((char*));
VALUE rb_str_new3 _((VALUE));
VALUE rb_str_new4 _((VALUE));
@@ -255,7 +255,7 @@ VALUE rb_str_dup_frozen _((VALUE));
VALUE rb_str_taint _((VALUE));
VALUE rb_str_tainted _((VALUE));
VALUE rb_str_resize _((VALUE, int));
-VALUE rb_str_cat _((VALUE, char*, unsigned int));
+VALUE rb_str_cat _((VALUE, char*, int));
VALUE rb_str_concat _((VALUE, VALUE));
int rb_str_hash _((VALUE));
int rb_str_cmp _((VALUE, VALUE));
diff --git a/io.c b/io.c
index 7794c67..3c9e857 100644
--- a/io.c
+++ b/io.c
@@ -104,7 +104,7 @@ extern int ReadDataPending();
# define READ_DATA_PENDING(fp) ReadDataPending(fp)
#endif
-#ifndef THREAD
+#ifndef USE_THREAD
# define READ_CHECK(fp) 0
#else
# define READ_CHECK(fp) do {\
@@ -165,7 +165,6 @@ rb_io_write(io, str)
rb_secure(4);
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
-
f = GetWriteFile(fptr);
#ifdef __human68k__
@@ -436,8 +435,8 @@ rb_io_read(argc, argv, io)
return rb_str_taint(str);
}
-VALUE
-rb_io_gets_method(argc, argv, io)
+static VALUE
+rb_io_gets_internal(argc, argv, io)
int argc;
VALUE *argv;
VALUE io;
@@ -571,7 +570,6 @@ rb_io_gets_method(argc, argv, io)
lineno = INT2FIX(fptr->lineno);
rb_str_taint(str);
}
- rb_lastline_set(str);
return str;
}
@@ -630,12 +628,25 @@ rb_io_gets(io)
lineno = INT2FIX(fptr->lineno);
rb_str_taint(str);
}
- rb_lastline_set(str);
return str;
}
static VALUE
+rb_io_gets_method(argc, argv, io)
+ int argc;
+ VALUE *argv;
+ VALUE io;
+{
+ VALUE str = rb_io_gets_internal(argc, argv, io);
+
+ if (!NIL_P(str)) {
+ rb_lastline_set(str);
+ }
+ return str;
+}
+
+static VALUE
rb_io_lineno(io)
VALUE io;
{
@@ -690,7 +701,7 @@ rb_io_readlines(argc, argv, io)
VALUE line, ary;
ary = rb_ary_new();
- while (!NIL_P(line = rb_io_gets_method(argc, argv, io))) {
+ while (!NIL_P(line = rb_io_gets_internal(argc, argv, io))) {
rb_ary_push(ary, line);
}
return ary;
@@ -704,7 +715,7 @@ rb_io_each_line(argc, argv, io)
{
VALUE str;
- while (!NIL_P(str = rb_io_gets_method(argc, argv, io))) {
+ while (!NIL_P(str = rb_io_gets_internal(argc, argv, io))) {
rb_yield(str);
}
return Qnil;
@@ -845,7 +856,6 @@ rb_io_close(io)
{
OpenFile *fptr;
- rb_secure(4);
GetOpenFile(io, fptr);
rb_io_fptr_close(fptr);
@@ -853,6 +863,15 @@ rb_io_close(io)
}
static VALUE
+rb_io_close_method(io)
+ VALUE io;
+{
+ rb_secure(4);
+ rb_io_close(io);
+ return Qnil;
+}
+
+static VALUE
rb_io_closed(io)
VALUE io;
{
@@ -862,6 +881,51 @@ rb_io_closed(io)
return (fptr->f || fptr->f2)?Qfalse:Qtrue;
}
+VALUE
+rb_io_close_read(io)
+ VALUE io;
+{
+ OpenFile *fptr;
+ FILE *save;
+
+ rb_secure(4);
+ GetOpenFile(io, fptr);
+ if (fptr->f2 == 0 && (fptr->mode & FMODE_WRITABLE)) {
+ rb_raise(rb_eIOError, "closing non-duplex IO for reading");
+ }
+ if (fptr->f2 == 0) {
+ return rb_io_close(io);
+ }
+ fclose(fptr->f);
+ fptr->mode &= ~FMODE_READABLE;
+ fptr->f = fptr->f2;
+ fptr->f2 = 0;
+
+ return Qnil;
+}
+
+static VALUE
+rb_io_close_write(io)
+ VALUE io;
+{
+ OpenFile *fptr;
+ FILE *save = 0;
+
+ rb_secure(4);
+ GetOpenFile(io, fptr);
+ if (fptr->f2 == 0 && (fptr->mode & FMODE_READABLE)) {
+ rb_raise(rb_eIOError, "closing non-duplex IO for writing");
+ }
+ if (fptr->f2 == 0) {
+ return rb_io_close(io);
+ }
+ fclose(fptr->f2);
+ fptr->f2 = 0;
+ fptr->mode &= ~FMODE_WRITABLE;
+
+ return Qnil;
+}
+
static VALUE
rb_io_syswrite(io, str)
VALUE io, str;
@@ -878,7 +942,7 @@ rb_io_syswrite(io, str)
rb_io_check_writable(fptr);
f = GetWriteFile(fptr);
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_fd_writable(fileno(f));
#endif
n = write(fileno(f), RSTRING(str)->ptr, RSTRING(str)->len);
@@ -902,7 +966,7 @@ rb_io_sysread(io, len)
str = rb_str_new(0, ilen);
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_wait_fd(fileno(fptr->f));
#endif
TRAP_BEG;
@@ -1086,10 +1150,10 @@ pipe_finalize(fptr)
if (fptr->f2 != NULL) {
pclose(fptr->f2);
}
+ fptr->f = fptr->f2 = NULL;
#else
fptr_finalize(fptr);
#endif
- fptr->f = fptr->f2 = NULL;
pipe_del_fptr(fptr);
}
#endif
@@ -1181,7 +1245,7 @@ pipe_open(pname, mode)
case -1: /* fork failed */
if (errno == EAGAIN) {
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_sleep(1);
#else
sleep(1);
@@ -1346,12 +1410,15 @@ rb_io_reopen(io, nfile)
mode = rb_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);
}
@@ -1359,7 +1426,8 @@ rb_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 {
@@ -1525,7 +1593,6 @@ rb_io_putc(io, ch)
rb_secure(4);
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
-
f = GetWriteFile(fptr);
if (fputc(c, f) == EOF || ferror(f))
@@ -1800,7 +1867,7 @@ next_argv()
}
static VALUE
-rb_f_gets_method(argc, argv)
+rb_f_gets_internal(argc, argv)
int argc;
VALUE *argv;
{
@@ -1808,7 +1875,7 @@ rb_f_gets_method(argc, argv)
retry:
if (!next_argv()) return Qnil;
- line = rb_io_gets_method(argc, argv, file);
+ line = rb_io_gets_internal(argc, argv, file);
if (NIL_P(line) && next_p != -1) {
rb_io_close(file);
next_p = 1;
@@ -1820,8 +1887,19 @@ rb_f_gets_method(argc, argv)
return line;
}
+static VALUE
+rb_f_gets(argc, argv)
+ int argc;
+ VALUE *argv;
+{
+ VALUE line = rb_f_gets_internal(argc, argv);
+
+ if (!NIL_P(line)) rb_lastline_set(line);
+ return line;
+}
+
VALUE
-rb_f_gets()
+rb_gets()
{
VALUE line;
@@ -1833,8 +1911,11 @@ rb_f_gets()
next_p = 1;
goto retry;
}
- gets_lineno++;
- lineno = INT2FIX(gets_lineno);
+ if (!NIL_P(line)) {
+ rb_lastline_set(line);
+ gets_lineno++;
+ lineno = INT2FIX(gets_lineno);
+ }
return line;
}
@@ -1844,7 +1925,7 @@ rb_f_readline(argc, argv)
int argc;
VALUE *argv;
{
- VALUE line = rb_f_gets_method(argc, argv);
+ VALUE line = rb_f_gets(argc, argv);
if (NIL_P(line)) {
rb_eof_error();
@@ -1935,7 +2016,7 @@ rb_f_readlines(argc, argv)
VALUE line, ary;
ary = rb_ary_new();
- while (!NIL_P(line = rb_f_gets_method(argc, argv))) {
+ while (!NIL_P(line = rb_f_gets_internal(argc, argv))) {
rb_ary_push(ary, line);
}
@@ -2065,7 +2146,7 @@ rb_f_select(argc, argv, obj)
max++;
-#ifdef THREAD
+#ifdef USE_THREAD
n = rb_thread_select(max, rp, wp, ep, tp);
if (n < 0) {
rb_sys_fail(0);
@@ -2372,7 +2453,7 @@ rb_io_foreach_line(arg)
{
VALUE str;
- while (!NIL_P(str = rb_io_gets_method(arg->argc, &arg->sep, arg->io))) {
+ while (!NIL_P(str = rb_io_gets_internal(arg->argc, &arg->sep, arg->io))) {
rb_yield(str);
}
return Qnil;
@@ -2402,7 +2483,7 @@ rb_io_readline_line(arg)
VALUE line, ary;
ary = rb_ary_new();
- while (!NIL_P(line = rb_io_gets_method(arg->argc, &arg->sep, arg->io))) {
+ while (!NIL_P(line = rb_io_gets_internal(arg->argc, &arg->sep, arg->io))) {
rb_ary_push(ary, line);
}
@@ -2507,7 +2588,7 @@ arg_each_line(argc, argv)
{
VALUE str;
- while (RTEST(str = rb_f_gets_method(argc, argv))) {
+ while (RTEST(str = rb_f_gets_internal(argc, argv))) {
rb_yield(str);
}
return Qnil;
@@ -2596,7 +2677,7 @@ Init_IO()
rb_define_global_function("print", rb_f_print, -1);
rb_define_global_function("putc", rb_f_putc, 1);
rb_define_global_function("puts", rb_f_puts, -1);
- rb_define_global_function("gets", rb_f_gets_method, -1);
+ rb_define_global_function("gets", rb_f_gets, -1);
rb_define_global_function("readline", rb_f_readline, -1);
rb_define_global_function("tell", rb_f_tell, 0);
rb_define_global_function("seek", rb_f_seek, 2);
@@ -2684,8 +2765,10 @@ Init_IO()
rb_define_method(rb_cIO, "eof", rb_io_eof, 0);
rb_define_method(rb_cIO, "eof?", rb_io_eof, 0);
- rb_define_method(rb_cIO, "close", rb_io_close, 0);
+ rb_define_method(rb_cIO, "close", rb_io_close_method, 0);
rb_define_method(rb_cIO, "closed?", rb_io_closed, 0);
+ rb_define_method(rb_cIO, "close_read", rb_io_close_read, 0);
+ rb_define_method(rb_cIO, "close_write", rb_io_close_write, 0);
rb_define_method(rb_cIO, "isatty", rb_io_isatty, 0);
rb_define_method(rb_cIO, "tty?", rb_io_isatty, 0);
@@ -2723,7 +2806,7 @@ Init_IO()
rb_define_singleton_method(argf, "read", arg_read, -1);
rb_define_singleton_method(argf, "readlines", rb_f_readlines, -1);
rb_define_singleton_method(argf, "to_a", rb_f_readlines, -1);
- rb_define_singleton_method(argf, "gets", rb_f_gets_method, -1);
+ rb_define_singleton_method(argf, "gets", rb_f_gets, -1);
rb_define_singleton_method(argf, "readline", rb_f_readline, -1);
rb_define_singleton_method(argf, "getc", arg_getc, 0);
rb_define_singleton_method(argf, "readchar", arg_readchar, 0);
diff --git a/lib/find.rb b/lib/find.rb
index 7a6dbce..3f1b82d 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/jcode.rb b/lib/jcode.rb
index 6d71518..50b7bee 100644
--- a/lib/jcode.rb
+++ b/lib/jcode.rb
@@ -104,7 +104,7 @@ class String
end
def tr(from, to)
- self.dup.tr!(from, to)
+ (str = self.dup).tr!(from, to) or str
end
def delete!(del)
@@ -127,7 +127,7 @@ class String
end
def delete(del)
- self.dup.delete!(del)
+ (str = self.dup).delete!(del) or str
end
def squeeze!(del=nil)
@@ -155,7 +155,7 @@ class String
end
def squeeze(del=nil)
- self.dup.squeeze!(del)
+ (str = self.dup).squeeze!(del) or str
end
def tr_s!(from, to)
@@ -188,7 +188,7 @@ class String
end
def tr_s(from, to)
- self.dup.tr_s!(from,to)
+ (str = self.dup).tr_s!(from,to) or str
end
alias original_chop! chop!
@@ -202,7 +202,7 @@ class String
end
def chop
- self.dup.chop!
+ (str = self.dup).chop! or str
end
end
$VERBOSE = $vsave
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index e89ac7d..0aa9d98 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -2,6 +2,7 @@
# invoke like: ruby -r mkmf extconf.rb
require 'rbconfig'
+require 'find'
include Config
@@ -83,6 +84,24 @@ def try_cpp
xsystem(format(CPP, $CFLAGS))
end
+def install_rb(mfile)
+ path = []
+ dir = []
+ Find.find("lib") do |f|
+ next unless /\.rb$/ =~ f
+ f = f[4..-1]
+ path.push f
+ dir |= File.dirname(f)
+ end
+ for f in dir
+ next if f == "."
+ mfile.printf "\t@test -d $(libdir)/%s || mkdir $(libdir)/%s\n", f, f
+ end
+ for f in path
+ mfile.printf "\t$(INSTALL_DATA) lib/%s $(libdir)/%s\n", f, f
+ end
+end
+
def have_library(lib, func)
printf "checking for %s() in -l%s... ", func, lib
STDOUT.flush
@@ -299,9 +318,7 @@ $(libdir)/$(TARGET): $(TARGET)
@test -d $(libdir) || mkdir $(libdir)
$(INSTALL) $(TARGET) $(libdir)/$(TARGET)
EOMF
- for rb in Dir["lib/*.rb"]
- mfile.printf "\t$(INSTALL_DATA) %s %s\n", rb, $libdir
- end
+ install_rb(mfile)
mfile.printf "\n"
if CONFIG["DLEXT"] != "o"
diff --git a/lib/open3.rb b/lib/open3.rb
new file mode 100644
index 0000000..e8ba278
--- /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/pstore.rb b/lib/pstore.rb
index 743b1da..f075dbc 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -121,10 +121,13 @@ if __FILE__ == $0
db.transaction do
p db.roots
ary = db["root"] = [1,2,3,4]
- ary[0] = [1,1.5]
+ ary[1] = [1,1.5]
end
- db.transaction do
- p db["root"]
+ 1000.times do
+ db.transaction do
+ db["root"][0] += 1
+ p db["root"][0]
+ end
end
end
diff --git a/lib/shell.rb b/lib/shell.rb
index 3d8dda0..4fdac0a 100644
--- a/lib/shell.rb
+++ b/lib/shell.rb
@@ -159,7 +159,7 @@ class Shell
@dir_stack.push @cwd
chdir pop
else
- Shell.fail DirStackEmpty
+ Shell.Fail DirStackEmpty
end
end
end
@@ -169,7 +169,7 @@ class Shell
if pop = @dir_stack.pop
@cwd = pop
else
- Shell.fail DirStackEmpty
+ Shell.Fail DirStackEmpty
end
end
alias popd popdir
@@ -350,10 +350,10 @@ class Shell
if sh.exists?(path)
return path
else
- Shell.fail CommandNotFound, command
+ Shell.Fail CommandNotFound, command
end
when FALSE
- Shell.fail CommandNotFound, command
+ Shell.Fail CommandNotFound, command
end
for p in @system_path
@@ -364,7 +364,8 @@ class Shell
end
end
@system_commands[command] = FALSE
- Shell.fail CommandNotFound, command
+# Shell.fail CommandNotFound, command
+ raise CommandNotFound, command
end
#
@@ -380,7 +381,7 @@ class Shell
eval d
rescue
print "Can't define self.#{command} path: #{path}\n" if debug? or verbose?
- Shell.fail CanNotDefine, comamnd, path
+ Shell.Fail CanNotDefine, comamnd, path
end
if debug?
print d
@@ -402,7 +403,7 @@ class Shell
eval d
rescue
print "Can't define #{command} path: #{path}\n" if debug? or verbose?
- Shell.fail CanNotDefine, comamnd, path
+ Shell.Fail CanNotDefine, comamnd, path
end
if debug?
print d
@@ -474,7 +475,7 @@ class Shell
@input = src
self
else
- Filter.fail CanNotMethodApply, "<", to.type
+ Filter.Fail CanNotMethodApply, "<", to.type
end
end
@@ -490,7 +491,7 @@ class Shell
when IO
each(){|l| to << l}
else
- Filter.fail CanNotMethodApply, ">", to.type
+ Filter.Fail CanNotMethodApply, ">", to.type
end
self
end
@@ -507,7 +508,7 @@ class Shell
when IO
each(){|l| to << l}
else
- Filter.fail CanNotMethodApply, ">>", to.type
+ Filter.Fail CanNotMethodApply, ">>", to.type
end
self
end
diff --git a/lib/telnet.rb b/lib/telnet.rb
index 9c99e02..e5a8aa6 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 <wakou@fsinet.or.jp>
#
+# 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
diff --git a/lib/thwait.rb b/lib/thwait.rb
index d3b3299..958163e 100644
--- a/lib/thwait.rb
+++ b/lib/thwait.rb
@@ -99,7 +99,7 @@ class ThreadsWait
@threads.concat threads
for th in threads
Thread.start do
- th = Thread.join(th)
+ th = th.join
@wait_queue.push th
end
end
diff --git a/lib/tk.rb b/lib/tk.rb
index 7a5d85f..2fa2548 100644
--- a/lib/tk.rb
+++ b/lib/tk.rb
@@ -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
@@ -1581,7 +1581,11 @@ class TkObject
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 23fc87d..be2e50f 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 c4a7478..bc85604 100644
--- a/lib/tkcanvas.rb
+++ b/lib/tkcanvas.rb
@@ -733,14 +733,11 @@ class TkImage<TkObject
Tk_IMGTBL[@id] = nil if @id
tk_call('image', 'delete', @path)
end
- def height
- number(tk_call('image', 'height', @path))
- end
def itemtype
tk_call('image', 'type', @path)
end
def width
- number(tk_call('image', 'height', @path))
+ number(tk_call('image', 'width', @path))
end
def TkImage.names
@@ -823,7 +820,7 @@ class TkPhotoImage<TkImage
term
end
}.flatten
-
+
tk_send 'write', file, *args
end
end
diff --git a/marshal.c b/marshal.c
index 815fba5..4f49aa7 100644
--- a/marshal.c
+++ b/marshal.c
@@ -391,6 +391,8 @@ dump_ensure(arg)
return 0;
}
+static st_table *cache[2];
+
static VALUE
marshal_dump(argc, argv)
int argc;
diff --git a/missing/nt.c b/missing/nt.c
index 703556c..56a8e62 100644
--- a/missing/nt.c
+++ b/missing/nt.c
@@ -184,8 +184,8 @@ NtInitialize(int *argc, char ***argv) {
tzset();
- // Initialize Winsock
- StartSockets();
+ // Initialize Winsock
+ StartSockets();
}
diff --git a/node.h b/node.h
index 3c4db29..cfd325c 100644
--- a/node.h
+++ b/node.h
@@ -66,8 +66,6 @@ enum node_type {
NODE_CVAR,
NODE_NTH_REF,
NODE_BACK_REF,
- NODE_MATCH_REF,
- NODE_LASTLINE,
NODE_MATCH,
NODE_MATCH2,
NODE_MATCH3,
@@ -104,7 +102,6 @@ enum node_type {
NODE_TRUE,
NODE_FALSE,
NODE_DEFINED,
- NODE_TAG,
NODE_NEWLINE,
NODE_POSTEXE,
#ifdef C_ALLOCA
@@ -242,7 +239,7 @@ typedef struct RNode {
#define NEW_RESCUE(b,res) rb_node_newnode(NODE_RESCUE,b,res,0)
#define NEW_RESBODY(a,ex,n) rb_node_newnode(NODE_RESBODY,n,ex,a)
#define NEW_ENSURE(b,en) rb_node_newnode(NODE_ENSURE,b,0,en)
-#define NEW_RET(s) rb_node_newnode(NODE_RETURN,s,0,0)
+#define NEW_RETURN(s) rb_node_newnode(NODE_RETURN,s,0,0)
#define NEW_YIELD(a) rb_node_newnode(NODE_YIELD,a,0,0)
#define NEW_LIST(a) NEW_ARRAY(a)
#define NEW_ARRAY(a) rb_node_newnode(NODE_ARRAY,a,1,0)
diff --git a/numeric.c b/numeric.c
index c88558b..d1921f3 100644
--- a/numeric.c
+++ b/numeric.c
@@ -87,6 +87,14 @@ rb_num_coerce_bin(x, y)
}
static VALUE
+num_clone(x)
+ VALUE x;
+{
+ /* Numerics are immutable values, which need not to copy */
+ return x;
+}
+
+static VALUE
num_uplus(num)
VALUE num;
{
@@ -1354,6 +1362,7 @@ Init_Numeric()
rb_include_module(rb_cNumeric, rb_mComparable);
rb_define_method(rb_cNumeric, "coerce", num_coerce, 1);
+ rb_define_method(rb_cNumeric, "clone", num_clone, 0);
rb_define_method(rb_cNumeric, "+@", num_uplus, 0);
rb_define_method(rb_cNumeric, "-@", num_uminus, 0);
diff --git a/parse.y b/parse.y
index 3bbb935..4d494b4 100644
--- a/parse.y
+++ b/parse.y
@@ -97,8 +97,8 @@ static struct RVarmap *dyna_push();
static void dyna_pop();
static int dyna_in_block();
-#define crerb_f_push() NEW_CREF()
-static void crerb_f_pop();
+#define cref_push() NEW_CREF()
+static void cref_pop();
static NODE *cur_cref;
static void top_local_init();
@@ -170,9 +170,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
@@ -372,7 +372,7 @@ expr : mlhs '=' mrhs
value_expr($2);
if (!cur_mid && !in_single)
yyerror("return appeared outside of method");
- $$ = NEW_RET($2);
+ $$ = NEW_RETURN($2);
}
| kYIELD ret_args
{
@@ -426,13 +426,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);
}
@@ -458,21 +458,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);
}
@@ -956,19 +957,19 @@ primary : literal
if (!cur_mid && !in_single)
yyerror("return appeared outside of method");
value_expr($3);
- $$ = NEW_RET($3);
+ $$ = NEW_RETURN($3);
}
| kRETURN '(' ')'
{
if (!cur_mid && !in_single)
yyerror("return appeared outside of method");
- $$ = NEW_RET(0);
+ $$ = NEW_RETURN(0);
}
| kRETURN
{
if (!cur_mid && !in_single)
yyerror("return appeared outside of method");
- $$ = NEW_RET(0);
+ $$ = NEW_RETURN(0);
}
| kYIELD '(' ret_args ')'
{
@@ -1082,7 +1083,7 @@ primary : literal
yyerror("class definition in method body");
class_nest++;
- crerb_f_push();
+ cref_push();
local_push();
}
compstmt
@@ -1091,13 +1092,13 @@ primary : literal
$$ = NEW_CLASS($2, $5, $3);
fixpos($$, $3);
local_pop();
- crerb_f_pop();
+ cref_pop();
class_nest--;
}
| kCLASS tLSHFT expr term
{
class_nest++;
- crerb_f_push();
+ cref_push();
local_push();
}
compstmt
@@ -1106,7 +1107,7 @@ primary : literal
$$ = NEW_SCLASS($3, $6);
fixpos($$, $3);
local_pop();
- crerb_f_pop();
+ cref_pop();
class_nest--;
}
| kMODULE cname
@@ -1114,7 +1115,7 @@ primary : literal
if (cur_mid || in_single)
yyerror("module definition in method body");
class_nest++;
- crerb_f_push();
+ cref_push();
local_push();
}
compstmt
@@ -1123,7 +1124,7 @@ primary : literal
$$ = NEW_MODULE($2, $4);
fixpos($$, $4);
local_pop();
- crerb_f_pop();
+ cref_pop();
class_nest--;
}
| kDEF fname
@@ -3004,7 +3005,7 @@ retry:
}
c = nextc();
}
- if (c == '!' || c == '?') {
+ if ((c == '!' || c == '?') && is_identchar(tok()[0])) {
tokadd(c);
}
else {
@@ -3038,23 +3039,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;
}
@@ -3062,6 +3046,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();
@@ -3544,10 +3545,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, rb_id_attrset(id), NEW_LIST(val));
}
static void
@@ -3556,10 +3554,10 @@ rb_backref_error(node)
{
switch (nd_type(node)) {
case NODE_NTH_REF:
- yyerror("Can't set variable $%d", node->nd_nth);
+ rb_compile_error("Can't set variable $%d", node->nd_nth);
break;
case NODE_BACK_REF:
- yyerror("Can't set variable $%c", node->nd_nth);
+ rb_compile_error("Can't set variable $%c", node->nd_nth);
break;
}
}
@@ -3721,7 +3719,7 @@ logop(type, left, right)
NODE *left, *right;
{
value_expr(left);
- return rb_node_newnode(type, cond(left), cond(right));
+ return rb_node_newnode(type, cond(left), cond(right), 0);
}
static NODE *
@@ -3925,7 +3923,7 @@ dyna_in_block()
}
static void
-crerb_f_pop()
+cref_pop()
{
cur_cref = cur_cref->nd_next;
}
@@ -4030,8 +4028,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;
@@ -4044,18 +4041,13 @@ rb_intern(name)
/* operator */
int i;
- id = 0;
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;
- break;
+ goto id_regist;
}
}
- if (id == 0) {
- rb_raise(rb_eNameError, "Unknown operator `%s'", name);
- }
- break;
}
last = strlen(name)-1;
@@ -4065,18 +4057,19 @@ rb_intern(name)
strncpy(buf, name, last);
buf[last] = '\0';
- id = rb_intern(buf);
- id &= ~ID_SCOPE_MASK;
- id |= ID_ATTRSET;
+ id = rb_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;
}
+ 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);
diff --git a/process.c b/process.c
index 59e6c8b..d9229a4 100644
--- a/process.c
+++ b/process.c
@@ -79,7 +79,7 @@ rb_waitpid(pid, flags, st)
{
int result;
#ifndef NO_WAITPID
-#if defined(THREAD)
+#if defined(USE_THREAD)
int oflags = flags;
if (!rb_thread_alone()) { /* there're other threads to run */
flags |= WNOHANG;
@@ -94,14 +94,14 @@ rb_waitpid(pid, flags, st)
#endif
if (result < 0) {
if (errno == EINTR) {
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_schedule();
#endif
goto retry;
}
return -1;
}
-#ifdef THREAD
+#ifdef USE_THREAD
if (result == 0) {
if (oflags & WNOHANG) return 0;
rb_thread_schedule();
@@ -124,7 +124,7 @@ rb_waitpid(pid, flags, st)
result = wait(st);
if (result < 0) {
if (errno == EINTR) {
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_schedule();
#endif
continue;
@@ -137,7 +137,7 @@ rb_waitpid(pid, flags, st)
if (!pid_tbl)
pid_tbl = st_init_numtable();
st_insert(pid_tbl, pid, st);
-#ifdef THREAD
+#ifdef USE_THREAD
if (!thread_alone()) rb_thread_schedule();
#endif
}
@@ -181,7 +181,7 @@ rb_f_wait()
while ((pid = wait(&state)) < 0) {
if (errno == EINTR) {
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_schedule();
#endif
continue;
@@ -212,7 +212,7 @@ rb_f_waitpid(obj, vpid, vflags)
char *strtok();
-#if defined(THREAD) && defined(HAVE_SETITIMER)
+#if defined(USE_THREAD) && defined(HAVE_SETITIMER)
static void
before_exec()
{
@@ -725,7 +725,7 @@ rb_f_system(argc, argv)
case -1:
if (errno == EAGAIN) {
-#ifdef THREAD
+#ifdef USE_THREAD
rb_thread_sleep(1);
#else
sleep(1);
@@ -754,7 +754,7 @@ rb_f_sleep(argc, argv)
int beg, end;
beg = time(0);
-#ifdef THREAD
+#ifdef USE_THREAD
if (argc == 0) {
rb_thread_sleep_forever();
}
@@ -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);
diff --git a/regex.c b/regex.c
index ae64b11..279297a 100644
--- a/regex.c
+++ b/regex.c
@@ -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;
}
}
}
@@ -2239,7 +2239,6 @@ slow_match(little, lend, big, bend, translate)
if (c == 0xff)
c = *little++;
if (!trans_eq(*big++, c, translate)) break;
- little++;
}
if (little == lend) return 1;
return 0;
@@ -2330,11 +2329,9 @@ bm_search(little, llen, big, blen, skip, translate)
unsigned char *big;
int blen;
int *skip;
- char *translate;
+ unsigned char *translate;
{
- int next[256];
int i, j, k;
- unsigned char c;
i = llen-1;
if (translate) {
@@ -2738,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;
}
}
@@ -2827,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;
}
@@ -3023,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;
@@ -3752,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;
diff --git a/regex.h b/regex.h
index f04171c..bf5f967 100644
--- a/regex.h
+++ b/regex.h
@@ -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;
diff --git a/ruby.1 b/ruby.1
index c013afd..77af61d 100644
--- a/ruby.1
+++ b/ruby.1
@@ -1,45 +1,10 @@
-.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.co.jp>.
-.\"
-.\"This source is distributed under the conditions blow:
-.\"
-.\" 1. You may make and give away verbatim copies of the source form of
-.\" the software without restriction, provided that you do not modify
-.\" the original distribution files.
-.\"
-.\" If you want to distribute the modified version in any way, contact
-.\" the author.
-.\"
-.\" 2. You may distribute the software in object code or executable
-.\" form, provided that you distribute it with instructions on where
-.\" to get the software.
-.\"
-.\" 3. You may modify the software in any way, provided that you do not
-.\" distribute the modified version.
-.\"
-.\" 4. You may modify and include the part of the software into any other
-.\" software (possibly commercial). But some files in the distribution
-.\" are not written by the author, so that they are not under this terms.
-.\" They are gc.c(partly),utils.c(partly), regex.[ch],fnmatch.[ch],
-.\" glob.c, st.[ch] and somme files under the ./missing directory. See
-.\" each files for the copying condition.
-.\"
-.\" 5. The scripts and library files supplied as input to or produced as
-.\" output from the software do not automatically fall under the
-.\" copyright of the software, but belong to whomever generated them,
-.\" and may be sold commercially, and may be aggregated with this
-.\" software.
-.\"
-.\" 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE.
.\"
.\" $Id$
.\"
.na
.TH RUBY 1 "ruby 1.1" "22/Jun/98" "Ruby Programmers Reference Guide"
.SH NAME
-ruby - Interpreted scripting language
+ruby - interpreted object-oriented scripting language
.SH SYNOPSIS
.B ruby \c
[ \c
@@ -101,22 +66,22 @@ straight-forward, and extensible.
.PP
If you want a language for easy object-oriented programming, or you
don't like the PERL ugliness, or you do like the concept of lisp, but
-don't like too much parentheses, ruby may be the language of the
+don't like too much parentheses, Ruby may be the language of the
choice.
.SH DESCRIPTION
Ruby's features are as follows:
.TP
.B "\(bu Interpretive"
Ruby is the interpreted language, so you don't have to
-recompile to execute the program written in ruby.
+recompile to execute the program written in Ruby.
.TP
.B "\(bu Variables have no type (dynamic typing)"
-Variables in ruby can contain data of any type. You don't have
+Variables in Ruby can contain data of any type. You don't have
to worry about variable typing. Consequently, it has weaker
compile time check.
.TP
.B "\(bu No declaration needed"
-You can use variables in your ruby programs without any
+You can use variables in your Ruby programs without any
declarations. Variable name itself denotes its scope (local,
global, instance, etc.)
.TP
@@ -133,7 +98,7 @@ Ruby is the pure object-oriented language from the beginning.
Even basic data like integers are treated uniformly as objects.
.TP
.B "\(bu Class, inheritance, methods"
-Of course, as a O-O language, ruby has basic features like
+Of course, as a O-O language, Ruby has basic features like
classes, inheritance, methods, etc.
.TP
.B "\(bu Singleton methods"
@@ -145,21 +110,21 @@ system using singleton methods (if you want to).
.TP
.B "\(bu Mix-in by modules"
Ruby does not have the multiple inheritance intentionally. IMO,
-It is the source of confusion. Instead, ruby has modules to
+It is the source of confusion. Instead, Ruby has modules to
share the implementation across the inheritance tree. It is
-often called "Mix-in."
+often called as "Mix-in."
.TP
.B "\(bu Iterators"
Ruby has iterators for loop abstraction.
.TP
.B "\(bu Closures"
-In ruby, you can objectify the procedure.
+In Ruby, you can objectify the procedure.
.TP
.B "\(bu Text processing and regular expression"
Ruby has bunch of text processing features like in perl.
.TP
.B "\(bu Bignums"
-With bu ilt-in bignums, you can calculate factorial(400), for
+With built-in bignums, you can calculate factorial(400), for
example.
.TP
.B "\(bu Exception handling"
@@ -177,15 +142,15 @@ most of UNIXes.
Ruby interpreter accepts following command-line options (switches).
Basically they are quite similar to those of Perl.
.TP
-.B -0digit
-specifies the input record separator ($/) as an octal number.
+.B -0\fIdigit
+specifies the input record separator (\fB$/\fR) as an octal number.
If no digits given, the null character is the separator. Other
-switches may follow the digits. -00 turns ruby into paragraph
-mode. -0777 makes ruby read whole file at once as a single
+switches may follow the digits. \fB-00\fR turns ruby into paragraph
+mode. \fB-0777\fR makes ruby read whole file at once as a single
string, since there is no legal character with that value.
.TP
.B -a
-turns on auto-split mode when used with -n or -p. In auto-split
+turns on auto-split mode when used with \fB-n\fR or \fB-p\fR. In auto-split
mode, ruby executes
.nf
.ne 1
@@ -198,21 +163,21 @@ causes ruby to check the syntax of the script and exit without
executing. If there is no syntax error, ruby will print "Syntax
OK" to the standard output.
.TP
-.B -Kc
+.B -K\fIc
specifies KANJI (Japanese character) code-set.
.TP
.B
-d --debug
-turns on debug mode. $DEBUG will set TRUE.
+turns on debug mode. \fB$DEBUG\fR will set TRUE.
.TP
-.B -e script
-specifies script from command-line. if -e switch specified,
+.B -e \fIscript
+specifies script from command-line. if \fB-e\fR switch specified,
ruby will not look for a script filename in the arguments.
.TP
-.B -F regexp
-specifies input field separator ($;).
+.B -F \fIregexp
+specifies input field separator (\fB$;\fR).
.TP
-.B -i extension
+.B -i \fIextension
specifies in-place-edit mode. The extension, if specified, is
added to old filename to make a backup copy.
example:
@@ -228,19 +193,19 @@ example:
\& matz
.fi
.TP
-.B -I directory
+.B -I \fIdirectory
used to tell ruby where to load the library scripts. Directory
-path will be added to the load-path variable ($:').
+path will be added to the load-path variable (\fB$:\fR).
.TP
.B -l
enables automatic line-ending processing, which means firstly
-set $\ to the value of $/, and secondly chops every line read
-using chop!.
+set \fB$\\\fR to the value of \fB$/\fR, and secondly chops every line read
+using \fBchop!\fR.
.TP
.B -n
causes ruby to assume the following loop around your script,
which makes it iterate over filename arguments somewhat like
-sed -n or awk.
+sed \fB-n\fR or awk.
.nf
.ne 3
\& while gets
@@ -249,8 +214,8 @@ sed -n or awk.
.fi
.TP
.B -p
-acts mostly same as -n switch, but print the value of variable
-$_ at the each end of the loop.
+acts mostly same as \fB-n\fR switch, but print the value of variable
+\fB$_\fR at the each end of the loop.
example:
.nf
.ne 2
@@ -258,13 +223,13 @@ example:
\& MATZ
.fi
.TP
-.B -r filename
-causes ruby to load the file using [4]require. It is useful
-with switches -n or -p.
+.B -r \fIfilename
+causes ruby to load the file using require. It is useful
+with switches -n or \fB-p\fR.
.TP
.B -s
enables some switch parsing for switches after script name but
-before any filename arguments (or before a --). Any switches
+before any filename arguments (or before a \fB--\fR). Any switches
found there is removed from ARGV and set the corresponding
variable in the script.
example:
@@ -278,7 +243,7 @@ example:
.B -S
makes ruby uses the PATH environment variable to search for
script, unless if its name begins with a slash. This is used to
-emulate #! on machines that don't support it, in the following
+emulate \fB#!\fR on machines that don't support it, in the following
manner:
.nf
.ne 2
@@ -287,17 +252,17 @@ manner:
\& exec /usr/local/bin/ruby -S $0 $*
.fi
On some systems $0 does not always contain the full pathname,
-so you need -S switch to tell ruby to search for the script if
+so you need \fB-S\fR switch to tell ruby to search for the script if
necessary.
-To handle embedded spaces or such, A better construct than $*
-would be ${1+"$@"}, but it does not work if the script is being
+To handle embedded spaces or such, A better construct than \fB$*\fR
+would be \fB${1+"$@"}\fR, but it does not work if the script is being
interpreted by csh.
.TP
.B -v --verbose
enables verbose mode. Ruby will prints its version at the
-beginning, and set the variable `$VERBOSE' to TRUE. Some
+beginning, and set the variable \fB$VERBOSE\fR to TRUE. Some
methods prints extra messages if this variable is TRUE. If this
-switch is given, and no other switches present, ruby quits
+switch is given, and no other arguments present, ruby quits
after printing its version.
.TP
.B --version
@@ -305,18 +270,18 @@ prints the version of ruby executable.
.TP
.B -w
enables verbose mode without printing version message at the
-beginning. It set the variable `$VERBOSE' to TRUE.
+beginning. It set the variable \fB$VERBOSE\fR to TRUE.
.TP
-.B -x[directory]
+.B -x\fR[\fIdirectory\fR]
tells ruby that the script is embedded in a message. Leading
-garbage will be discarded until the first that starts with "#!"
+garbage will be discarded until the first that starts with "\fB#!\fR"
and contains string "ruby". Any meaningful switches on that
line will applied. The end of script must be specified with
either EOF, ^D (control-D), ^Z (control-Z), or reserved word
__END__.If the directory name is specified, ruby will switch to
that directory before executing script.
.TP
-.B -X directory
+.B -X \fIdirectory
causes ruby to switch to the directory.
.TP
.B -y --yydebug
diff --git a/ruby.c b/ruby.c
index 9dbc93e..f510e0b 100644
--- a/ruby.c
+++ b/ruby.c
@@ -48,7 +48,7 @@ static int version, copyright;
VALUE rb_debug = Qfalse;
VALUE rb_verbose = Qfalse;
-int tainting = Qfalse;
+int rb_tainting = Qfalse;
static int sflag = Qfalse;
char *ruby_inplace_mode = Qfalse;
@@ -309,7 +309,7 @@ proc_options(argcp, argvp)
if (numlen == 0) v = 1;
}
rb_set_safe_level(v);
- tainting = Qtrue;
+ rb_tainting = Qtrue;
}
break;
diff --git a/ruby.h b/ruby.h
index 083552b..15d0e1c 100644
--- a/ruby.h
+++ b/ruby.h
@@ -380,9 +380,8 @@ void rb_define_const _((VALUE,char*,VALUE));
void rb_define_global_const _((char*,VALUE));
void rb_define_method _((VALUE,char*,VALUE(*)(),int));
-void rb_define_function _((VALUE,char*,VALUE(*)(),int));
void rb_define_module_function _((VALUE,char*,VALUE(*)(),int));
-void rb_define_global_function _((char *, VALUE (*)(), int));
+void rb_define_global_function _((char*,VALUE(*)(),int));
void rb_undef_method _((VALUE,char*));
void rb_define_alias _((VALUE,char*,char*));
@@ -524,13 +523,7 @@ rb_special_const_p(VALUE obj)
extern __inline__ int
rb_test_false_or_nil(VALUE v)
{
-#ifdef MACRUBY_PUBLIC_INTERFACE
- return (v != Qnil) && (v != RubyFALSE);
- return (v != Qnil) && (v != RubyFALSE);
-#else
- return (v != Qnil) && (v != Qfalse);
return (v != Qnil) && (v != Qfalse);
-#endif
}
#else
VALUE rb_class_of _((VALUE));
diff --git a/rubysig.h b/rubysig.h
index 03af721..6c6ce57 100644
--- a/rubysig.h
+++ b/rubysig.h
@@ -22,7 +22,7 @@ extern int rb_prohibit_interrupt;
extern int rb_trap_pending;
void rb_trap_restore_mask _((void));
-#ifdef THREAD
+#ifdef USE_THREAD
extern int rb_thread_critical;
void rb_thread_schedule _((void));
#if defined(HAVE_SETITIMER) && !defined(__BOW__)
diff --git a/signal.c b/signal.c
index 6bcae82..ab3e791 100644
--- a/signal.c
+++ b/signal.c
@@ -286,7 +286,7 @@ posix_signal(signum, handler)
}
#endif
-#ifdef THREAD
+#ifdef USE_THREAD
# define rb_interrupt rb_thread_interrupt
# define rb_trap_eval rb_thread_trap_eval
#endif
@@ -445,7 +445,7 @@ trap(arg)
if (sig < 0 || sig > NSIG) {
rb_raise(rb_eArgError, "Invalid signal no %d", sig);
}
-#if defined(THREAD) && defined(HAVE_SETITIMER) && !defined(__BOW__)
+#if defined(USE_THREAD) && defined(HAVE_SETITIMER) && !defined(__BOW__)
if (sig == SIGVTALRM) {
rb_raise(rb_eArgError, "SIGVTALRM reserved for Thread; cannot set handler");
}
diff --git a/string.c b/string.c
index e8b3764..1b4d2e3 100644
--- a/string.c
+++ b/string.c
@@ -33,7 +33,7 @@ extern VALUE rb_rs;
VALUE
rb_str_new(ptr, len)
char *ptr;
- unsigned len;
+ int len;
{
NEWOBJ(str, struct RString);
OBJSETUP(str, rb_cString, T_STRING);
@@ -346,9 +346,6 @@ rb_str_modify(str)
{
char *ptr;
- if (rb_safe_level() >= 5) {
- rb_raise(rb_eSecurityError, "cannot change string status");
- }
if (FL_TEST(str, STR_FREEZE))
rb_raise(rb_eTypeError, "can't modify frozen string");
if (!RSTRING(str)->orig || FL_TEST(str, STR_NO_ORIG)) return;
@@ -430,7 +427,7 @@ VALUE
rb_str_cat(str, ptr, len)
VALUE str;
char *ptr;
- unsigned len;
+ int len;
{
if (len > 0) {
rb_str_modify(str);
@@ -1063,7 +1060,7 @@ rb_str_sub(argc, argv, str)
VALUE *argv;
VALUE str;
{
- VALUE val = rb_str_sub_bang(argc, argv, rb_str_dup(str));
+ VALUE val = rb_str_sub_bang(argc, argv, str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -1167,7 +1164,7 @@ rb_str_gsub(argc, argv, str)
VALUE *argv;
VALUE str;
{
- VALUE val = rb_str_gsub_bang(argc, argv, rb_str_dup(str));
+ VALUE val = rb_str_gsub_bang(argc, argv, str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -1214,13 +1211,11 @@ rb_f_sub(argc, argv)
{
VALUE line, v;
- line = uscore_get();
+ line = rb_str_dup(uscore_get());
v = rb_str_sub_bang(argc, argv, line);
- if (!NIL_P(v)) {
- rb_lastline_set(v);
- return v;
- }
- return line;
+ if (NIL_P(v)) return line;
+ rb_lastline_set(v);
+ return v;
}
static VALUE
@@ -1238,13 +1233,11 @@ rb_f_gsub(argc, argv)
{
VALUE line, v;
- line = uscore_get();
+ line = rb_str_dup(uscore_get());
v = rb_str_gsub_bang(argc, argv, line);
- if (!NIL_P(v)) {
- rb_lastline_set(v);
- return v;
- }
- return line;
+ if (NIL_P(v)) return line;
+ rb_lastline_set(v);
+ return v;
}
static VALUE
@@ -1366,15 +1359,10 @@ rb_str_inspect(str)
CHECK(1);
*b++ = c;
}
- else if (c == '"') {
- CHECK(2);
- *b++ = '\\';
- *b++ = '"';
- }
- else if (c == '\\') {
+ else if (c == '"' || c == '\''|| c == '\\') {
CHECK(2);
*b++ = '\\';
- *b++ = '\\';
+ *b++ = c;
}
else if (ISPRINT(c)) {
CHECK(1);
@@ -1440,7 +1428,7 @@ rb_str_dump(str)
while (p < pend) {
char c = *p++;
switch (c) {
- case '"': case '\'':
+ case '"': case '\'': case '\\':
case '\n': case '\r':
case '\t': case '\f':
case '\013': case '\007': case '\033':
@@ -1466,7 +1454,7 @@ rb_str_dump(str)
while (p < pend) {
char c = *p++;
- if (c == '"' || c == '\\') {
+ if (c == '"' || c == '\'' || c == '\\') {
*q++ = '\\';
*q++ = c;
}
@@ -1489,7 +1477,7 @@ rb_str_dump(str)
*q++ = '\\';
*q++ = 'f';
}
- else if (c == '\13') {
+ else if (c == '\013') {
*q++ = '\\';
*q++ = 'v';
}
@@ -1497,7 +1485,7 @@ rb_str_dump(str)
*q++ = '\\';
*q++ = 'a';
}
- else if (c == 033) {
+ else if (c == '\033') {
*q++ = '\\';
*q++ = 'e';
}
@@ -1540,7 +1528,7 @@ static VALUE
rb_str_upcase(str)
VALUE str;
{
- VALUE val = rb_str_upcase_bang(rb_str_dup(str));
+ VALUE val = rb_str_upcase_bang(str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -1574,7 +1562,7 @@ static VALUE
rb_str_downcase(str)
VALUE str;
{
- VALUE val = rb_str_downcase_bang(rb_str_dup(str));
+ VALUE val = rb_str_downcase_bang(str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -1610,7 +1598,7 @@ static VALUE
rb_str_capitalize(str)
VALUE str;
{
- VALUE val = rb_str_capitalize_bang(rb_str_dup(str));
+ VALUE val = rb_str_capitalize_bang(str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -1648,7 +1636,7 @@ static VALUE
rb_str_swapcase(str)
VALUE str;
{
- VALUE val = rb_str_swapcase_bang(rb_str_dup(str));
+ VALUE val = rb_str_swapcase_bang(str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -1803,7 +1791,7 @@ static VALUE
rb_str_tr(str, src, repl)
VALUE str, src, repl;
{
- VALUE val = tr_trans(rb_str_dup(str), src, repl, 0);
+ VALUE val = tr_trans(str = rb_str_dup(str), src, repl, 0);
if (NIL_P(val)) return str;
return val;
@@ -1866,7 +1854,7 @@ static VALUE
rb_str_delete(str1, str2)
VALUE str1, str2;
{
- VALUE val = rb_str_delete_bang(rb_str_dup(str1), str2);
+ VALUE val = rb_str_delete_bang(str1 = rb_str_dup(str1), str2);
if (NIL_P(val)) return str1;
return val;
@@ -1930,7 +1918,7 @@ rb_str_squeeze(argc, argv, str)
VALUE *argv;
VALUE str;
{
- VALUE val = rb_str_squeeze_bang(argc, argv, rb_str_dup(str));
+ VALUE val = rb_str_squeeze_bang(argc, argv, str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -1947,7 +1935,7 @@ static VALUE
rb_str_tr_s(str, src, repl)
VALUE str, src, repl;
{
- VALUE val = tr_trans(rb_str_dup(str), src, repl, 1);
+ VALUE val = tr_trans(str = rb_str_dup(str), src, repl, 1);
if (NIL_P(val)) return str;
return val;
@@ -2141,25 +2129,22 @@ rb_str_each_line(argc, argv, str)
for (s = p, p += rslen; p < pend; p++) {
if (rslen == 0 && *p == '\n') {
- if (*(p+1) != '\n') continue;
+ if (p[1] != '\n') continue;
while (*p == '\n') p++;
- p--;
}
- if (*p == newline &&
+ if (p[-1] == newline &&
(rslen <= 1 ||
- memcmp(RSTRING(rs)->ptr, p-rslen+1, rslen) == 0)) {
- line = rb_str_new(s, p - s + 1);
- rb_lastline_set(line);
+ memcmp(RSTRING(rs)->ptr, p-rslen, rslen) == 0)) {
+ line = rb_str_new(s, p - s);
rb_yield(line);
if (RSTRING(str)->ptr != ptr || RSTRING(str)->len != len)
rb_raise(rb_eArgError, "string modified");
- s = p + 1;
+ s = p;
}
}
if (s != pend) {
line = rb_str_new(s, p - s);
- rb_lastline_set(line);
rb_yield(line);
}
@@ -2201,7 +2186,7 @@ static VALUE
rb_str_chop(str)
VALUE str;
{
- VALUE val = rb_str_chop_bang(rb_str_dup(str));
+ VALUE val = rb_str_chop_bang(str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -2217,12 +2202,12 @@ rb_f_chop_bang(str)
static VALUE
rb_f_chop()
{
- VALUE str = uscore_get();
+ VALUE str = rb_str_dup(uscore_get());
+ VALUE val = rb_str_chop_bang(str);
- str = rb_str_chop_bang(rb_str_dup(str));
- if (NIL_P(str)) return uscore_get();
- rb_lastline_set(str);
- return str;
+ if (NIL_P(str)) return str;
+ rb_lastline_set(val);
+ return val;
}
static VALUE
@@ -2274,7 +2259,7 @@ rb_str_chomp(argc, argv, str)
VALUE *argv;
VALUE str;
{
- VALUE val = rb_str_chomp_bang(argc, argv, rb_str_dup(str));
+ VALUE val = rb_str_chomp_bang(argc, argv, str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -2293,9 +2278,10 @@ rb_f_chomp(argc, argv)
int argc;
VALUE *argv;
{
- VALUE val = rb_str_chomp_bang(argc, argv, rb_str_dup(uscore_get()));
+ VALUE str = rb_str_dup(uscore_get());
+ VALUE val = rb_str_chomp_bang(argc, argv, str);
- if (NIL_P(val)) return uscore_get();
+ if (NIL_P(val)) return str;
rb_lastline_set(val);
return val;
}
@@ -2340,7 +2326,8 @@ static VALUE
rb_str_strip(str)
VALUE str;
{
- VALUE val = rb_str_strip_bang(rb_str_dup(str));
+
+ VALUE val = rb_str_strip_bang(str = rb_str_dup(str));
if (NIL_P(val)) return str;
return val;
@@ -2358,8 +2345,11 @@ scan_once(str, pat, start)
if (rb_reg_search(pat, str, *start, 0) >= 0) {
match = rb_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);
diff --git a/util.c b/util.c
index 54afc53..1336e0c 100644
--- a/util.c
+++ b/util.c
@@ -232,7 +232,9 @@ static char suffix2[] = ".~~~";
#define strEQ(s1,s2) (strcmp(s1,s2) == 0)
void
-add_suffix(VALUE str, char *suffix)
+add_suffix(str, suffix)
+ VALUE str;
+ char *suffix;
{
int baselen;
int extlen = strlen(suffix);
@@ -560,7 +562,7 @@ static int mmkind, mmsize, high, low;
#define C ((int*)c)
#define D ((int*)d)
-static void mmprepare( void *base, int size )
+static void mmprepare(base, size) void *base; int size;
{
#ifdef DEBUG
if (sizeof(int) != 4) die("sizeof(int) != 4");
@@ -577,7 +579,7 @@ static void mmprepare( void *base, int size )
low = (size & 0x0C );
}
-static void mmswap( register char *a, register char *b )
+static void mmswap(a, b) register char *a, *b;
{
register int s;
if (a == b) return;
@@ -600,7 +602,7 @@ static void mmswap( register char *a, register char *b )
}
}
-static void mmswapblock( register char *a, register char *b, int size )
+static void mmswapblock(a, b, size) register char *a, *b; int size;
{
register int s;
if (mmkind >= 0) {
@@ -622,7 +624,7 @@ static void mmswapblock( register char *a, register char *b, int size )
}
}
-static void mmrot3( register char *a, register char *b, register char *c )
+static void mmrot3(a, b, c) register char *a, *b, *c;
{
register int s;
if (mmkind >= 0) {
@@ -661,14 +663,14 @@ typedef struct { char *LL, *RR; } stack_node; /* Stack structure for L,l,R,r */
((*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)();
+void ruby_qsort (base, nel, size, cmp) void* base; int nel; int size; int (*cmp)();
{
- register char *l, *r, *m; /*l,r: m:*/
- register int t, eq_l, eq_r; /*eq_l:*/
- char *L = base; /* */
- char *R = base + size * (nel - 1); /* */
- int chklim = 63; /*()*/
- stack_node stack[32], *top = stack; /* 32 */
+ 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 );
diff --git a/util.h b/util.h
index 9697c17..756daee 100644
--- a/util.h
+++ b/util.h
@@ -12,16 +12,27 @@
#ifndef UTIL_H
#define UTIL_H
+#ifndef _
+# ifdef __STDC__
+# define _(args) args
+# else
+# define _(args) ()
+# endif
+#endif
+
#define scan_oct ruby_scan_oct
-unsigned long scan_oct();
+unsigned long scan_oct _((char*, int, int*));
#define scan_hex ruby_scan_hex
-unsigned long scan_hex();
+unsigned long scan_hex _((char*, int, int*));
#if defined(MSDOS) || defined(__CYGWIN32__) || defined(NT)
#define add_suffix ruby_add_suffix
void add_suffix();
#endif
-char *ruby_mktemp();
+char *ruby_mktemp _((void));
+
+void ruby_qsort _((void*, int, int, int (*)()));
+#define qsort(b,n,s,c) ruby_qsort(b,n,s,c)
#endif /* UTIL_H */
diff --git a/variable.c b/variable.c
index 3cebfb4..14b5cf4 100644
--- a/variable.c
+++ b/variable.c
@@ -722,9 +722,6 @@ rb_ivar_set(obj, id, val)
ID id;
VALUE val;
{
- if (rb_safe_level() >= 5) {
- rb_raise(rb_eSecurityError, "cannot change object status");
- }
switch (TYPE(obj)) {
case T_OBJECT:
case T_CLASS:
@@ -1037,6 +1034,10 @@ rb_define_const(klass, name, val)
VALUE val;
{
ID id = rb_intern(name);
+
+ if (klass == rb_cObject) {
+ rb_secure(4);
+ }
if (!rb_is_const_id(id)) {
rb_raise(rb_eNameError, "wrong constant name %s", name);
}
diff --git a/version.h b/version.h
index 011c6c4..8f49f67 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
-#define RUBY_VERSION "1.1c4"
-#define VERSION_DATE "98/09/03"
+#define RUBY_VERSION "1.1d0"
+#define VERSION_DATE "98/09/08"