зеркало из https://github.com/github/ruby.git
* gc.c (Init_stack): stack region is far smaller than usual if
pthread is used. * marshal.c (w_extended): singleton methods should not be checked when dumping via marshal_dump() or _dump(). [ruby-talk:85909] * file.c (getcwdofdrv): avoid using getcwd() directly, use my_getcwd() instead. * merged NeXT, OpenStep, Rhapsody ports patch from Eric Sunshine <sunshine@sunshineco.com>. [ruby-core:01596] * marshal.c (w_object): LINK check earlier than anything else, i.e. do not dump TYPE_IVAR for already dumped objects. (ruby-bugs PR#1220) * eval.c (rb_eval): call "inherited" only when a new class is generated; not on reopening. * eval.c (eval): prepend error position in evaluating string to * configure.in: revived NextStep, OpenStep, and Rhapsody ports which had become unbuildable; enhanced --enable-fat-binary option so that it accepts a list of desired architectures (rather than assuming a fixed list), or defaults to a platform-appropriate list if user does not provide an explicit list; made the default list of architectures for MAB (fat binary) more comprehensive; now uses -fno-common even when building the interpreter (in addition to using it for extensions), thus allowing the interpreter to be embedded into a plugin module of an external project (in addition to allowing embedding directly into an application); added checks for <netinet/in_systm.h> (needed by `socket' extension) and getcwd(); now ensures that -I/usr/local/include is employed when extensions' extconf.rb scripts invoke have_header() since extension checks on NextStep and OpenStep will fail without it if the desired resource resides in the /usr/local tree; fixed formatting of --help message. * Makefile.in: $(LIBRUBY_A) rule now deletes the archive before invoking $(AR) since `ar' on Apple/NeXT can not "update" MAB archives (see configure's --enable-fat-binary option); added rule for new missing/getcwd.c. * defines.h: fixed endian handling during MAB build (see configure's --enable-fat-binary option) to ensure that all portions of the project see the correct WORDS_BIGENDIAN value (some extension modules were getting the wrong endian setting); added missing constants GETPGRP_VOID, WNOHANG, WUNTRACED, X_OK, and type pid_t for NextStep and OpenStep; removed unnecessary and problematic HAVE_SYS_WAIT_H define in NeXT section. * dir.c: do not allow NAMLEN() macro to trust dirent::d_namlen on NextStep since, on some installations, this value always resolves uselessly to zero. * dln.c: added error reporting to NextStep extension loader since the previous behavior of failing silently was not useful; now ensures that NSLINKMODULE_OPTION_BINDNOW compatibility constant is defined for OpenStep and Rhapsody; no longer includes <mach-o/dyld.h> twice on Rhapsody since this header lacks multiple-include protection, which resulted in "redefinition" compilation errors. * main.c: also create hard reference to objc_msgSend() on NeXT platforms (in addition to Apple platforms). * lib/mkmf.rb: now exports XCFLAGS from configure script to extension makefiles so that extensions can be built MAB (see configure's --enable-fat-binary option); also utilize XCFLAGS in cc_command() (but not cpp_command() because MAB flags are incompatible with direct invocation of `cpp'). * ext/curses/extconf.rb: now additionally checks for presence of these curses functions which are not present on NextStep or Openstep: bkgd(), bkgdset(), color(), curs(), getbkgd(), init(), scrl(), set(), setscrreg(), wattroff(), wattron(), wattrset(), wbkgd(), wbkgdset(), wscrl(), wsetscrreg() * ext/curses/curses.c: added appropriate #ifdef's for additional set of curses functions now checked by extconf.rb; fixed curses_bkgd() and window_bkgd() to correctly return boolean result rather than numeric result; fixed window_getbkgd() to correctly signal an error by returning nil rather than -1. * ext/etc/etc.c: setup_passwd() and setup_group() now check for null pointers before invoking rb_tainted_str_new2() upon fields extracted from `struct passwd' and `struct group' since null pointers in some fields are common on NextStep/OpenStep (especially so for the `pw_comment' field) and rb_tainted_str_new2() throws an exception when it receives a null pointer. * ext/pty/pty.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(). * ext/socket/getaddrinfo.c: cast first argument of getservbyname(), gethostbyaddr(), and gethostbyname() from (const char*) to non-const (char*) for older platforms such as NextStep and OpenStep. * ext/socket/socket.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(); include <netinet/in_systm.h> if present for NextStep and OpenStep; cast first argument of gethostbyaddr() and getservbyname() from (const char*) to non-const (char*) for older platforms. * ext/syslog/syslog.c: include "util.h" for strdup()/ruby_strdup() for platforms such as NextStep and OpenStep which lack strdup(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0125719694
Коммит
6212cfb9c5
111
ChangeLog
111
ChangeLog
|
@ -1,3 +1,8 @@
|
|||
Sat Nov 22 11:28:48 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* gc.c (Init_stack): stack region is far smaller than usual if
|
||||
pthread is used.
|
||||
|
||||
Sat Nov 22 07:30:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
|
||||
|
||||
* lib/test/unit/util/backtracefilter.rb: fixed a bug that occurred
|
||||
|
@ -20,6 +25,11 @@ Fri Nov 21 14:49:42 2003 Minero Aoki <aamine@loveruby.net>
|
|||
|
||||
* ruby.1: wrote about ruby related environment variables.
|
||||
|
||||
Fri Nov 21 12:28:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* marshal.c (w_extended): singleton methods should not be checked
|
||||
when dumping via marshal_dump() or _dump(). [ruby-talk:85909]
|
||||
|
||||
Fri Nov 21 01:40:00 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* configure.in: check <pthread.h>
|
||||
|
@ -154,6 +164,14 @@ Tue Nov 18 14:06:35 2003 Minero Aoki <aamine@loveruby.net>
|
|||
|
||||
* test/fileutils/fileasserts.rb: assert_is_directory -> assert_directory.
|
||||
|
||||
Mon Nov 17 19:38:49 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* file.c (getcwdofdrv): avoid using getcwd() directly, use
|
||||
my_getcwd() instead.
|
||||
|
||||
* merged NeXT, OpenStep, Rhapsody ports patch from Eric Sunshine
|
||||
<sunshine@sunshineco.com>. [ruby-core:01596]
|
||||
|
||||
Mon Nov 17 10:50:27 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/optparse.rb (OptionParser::Completion::complete): allow least
|
||||
|
@ -176,6 +194,13 @@ Sun Nov 16 18:10:57 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|||
|
||||
Sun Nov 16 13:26:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* marshal.c (w_object): LINK check earlier than anything else,
|
||||
i.e. do not dump TYPE_IVAR for already dumped objects.
|
||||
(ruby-bugs PR#1220)
|
||||
|
||||
* eval.c (rb_eval): call "inherited" only when a new class is
|
||||
generated; not on reopening.
|
||||
|
||||
* eval.c (eval): prepend error position in evaluating string to
|
||||
"mesg" attribute string only when it's available and is a
|
||||
string.
|
||||
|
@ -2233,6 +2258,92 @@ Wed Sep 10 22:41:54 2003 Tietew <tietew@tietew.net>
|
|||
* eval.c (win32_get_exception_list): avoid VC7 warning.
|
||||
[ruby-win32:577]
|
||||
|
||||
Thu Oct 9 12:05:46 2003 Eric Sunshine <sunshine@sunshineco.com>
|
||||
|
||||
* configure.in: revived NextStep, OpenStep, and Rhapsody ports which
|
||||
had become unbuildable; enhanced --enable-fat-binary option so that
|
||||
it accepts a list of desired architectures (rather than assuming a
|
||||
fixed list), or defaults to a platform-appropriate list if user does
|
||||
not provide an explicit list; made the default list of architectures
|
||||
for MAB (fat binary) more comprehensive; now uses -fno-common even
|
||||
when building the interpreter (in addition to using it for
|
||||
extensions), thus allowing the interpreter to be embedded into a
|
||||
plugin module of an external project (in addition to allowing
|
||||
embedding directly into an application); added checks for
|
||||
<netinet/in_systm.h> (needed by `socket' extension) and getcwd(); now
|
||||
ensures that -I/usr/local/include is employed when extensions'
|
||||
extconf.rb scripts invoke have_header() since extension checks on
|
||||
NextStep and OpenStep will fail without it if the desired resource
|
||||
resides in the /usr/local tree; fixed formatting of --help message.
|
||||
|
||||
* Makefile.in: $(LIBRUBY_A) rule now deletes the archive before
|
||||
invoking $(AR) since `ar' on Apple/NeXT can not "update" MAB archives
|
||||
(see configure's --enable-fat-binary option); added rule for new
|
||||
missing/getcwd.c.
|
||||
|
||||
* defines.h: fixed endian handling during MAB build (see configure's
|
||||
--enable-fat-binary option) to ensure that all portions of the
|
||||
project see the correct WORDS_BIGENDIAN value (some extension modules
|
||||
were getting the wrong endian setting); added missing constants
|
||||
GETPGRP_VOID, WNOHANG, WUNTRACED, X_OK, and type pid_t for NextStep
|
||||
and OpenStep; removed unnecessary and problematic HAVE_SYS_WAIT_H
|
||||
define in NeXT section.
|
||||
|
||||
* dir.c: do not allow NAMLEN() macro to trust dirent::d_namlen on
|
||||
NextStep since, on some installations, this value always resolves
|
||||
uselessly to zero.
|
||||
|
||||
* dln.c: added error reporting to NextStep extension loader since the
|
||||
previous behavior of failing silently was not useful; now ensures
|
||||
that NSLINKMODULE_OPTION_BINDNOW compatibility constant is defined
|
||||
for OpenStep and Rhapsody; no longer includes <mach-o/dyld.h> twice
|
||||
on Rhapsody since this header lacks multiple-include protection,
|
||||
which resulted in "redefinition" compilation errors.
|
||||
|
||||
* main.c: also create hard reference to objc_msgSend() on NeXT
|
||||
platforms (in addition to Apple platforms).
|
||||
|
||||
* lib/mkmf.rb: now exports XCFLAGS from configure script to extension
|
||||
makefiles so that extensions can be built MAB (see configure's
|
||||
--enable-fat-binary option); also utilize XCFLAGS in cc_command()
|
||||
(but not cpp_command() because MAB flags are incompatible with
|
||||
direct invocation of `cpp').
|
||||
|
||||
* ext/curses/extconf.rb: now additionally checks for presence of these
|
||||
curses functions which are not present on NextStep or Openstep:
|
||||
bkgd(), bkgdset(), color(), curs(), getbkgd(), init(), scrl(), set(),
|
||||
setscrreg(), wattroff(), wattron(), wattrset(), wbkgd(), wbkgdset(),
|
||||
wscrl(), wsetscrreg()
|
||||
|
||||
* ext/curses/curses.c: added appropriate #ifdef's for additional set of
|
||||
curses functions now checked by extconf.rb; fixed curses_bkgd() and
|
||||
window_bkgd() to correctly return boolean result rather than numeric
|
||||
result; fixed window_getbkgd() to correctly signal an error by
|
||||
returning nil rather than -1.
|
||||
|
||||
* ext/etc/etc.c: setup_passwd() and setup_group() now check for null
|
||||
pointers before invoking rb_tainted_str_new2() upon fields extracted
|
||||
from `struct passwd' and `struct group' since null pointers in some
|
||||
fields are common on NextStep/OpenStep (especially so for the
|
||||
`pw_comment' field) and rb_tainted_str_new2() throws an exception
|
||||
when it receives a null pointer.
|
||||
|
||||
* ext/pty/pty.c: include "util.h" for strdup()/ruby_strdup() for
|
||||
platforms such as NextStep and OpenStep which lack strdup().
|
||||
|
||||
* ext/socket/getaddrinfo.c: cast first argument of getservbyname(),
|
||||
gethostbyaddr(), and gethostbyname() from (const char*) to non-const
|
||||
(char*) for older platforms such as NextStep and OpenStep.
|
||||
|
||||
* ext/socket/socket.c: include "util.h" for strdup()/ruby_strdup() for
|
||||
platforms such as NextStep and OpenStep which lack strdup(); include
|
||||
<netinet/in_systm.h> if present for NextStep and OpenStep; cast first
|
||||
argument of gethostbyaddr() and getservbyname() from (const char*) to
|
||||
non-const (char*) for older platforms.
|
||||
|
||||
* ext/syslog/syslog.c: include "util.h" for strdup()/ruby_strdup() for
|
||||
platforms such as NextStep and OpenStep which lack strdup().
|
||||
|
||||
Tue Sep 9 10:39:51 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (struct tag): dst should be VALUE.
|
||||
|
|
|
@ -121,7 +121,11 @@ $(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) $(SETUP) miniruby$(EXEEXT)
|
|||
@rm -f $@
|
||||
$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
|
||||
|
||||
# We must `rm' the library each time this rule is invoked because "updating" a
|
||||
# MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not
|
||||
# supported.
|
||||
$(LIBRUBY_A): $(OBJS) $(DMYEXT)
|
||||
@rm -f $@
|
||||
@AR@ rcu $@ $(OBJS) $(DMYEXT)
|
||||
@-@RANLIB@ $@ 2> /dev/null || true
|
||||
|
||||
|
|
115
configure.in
115
configure.in
|
@ -74,48 +74,57 @@ fi
|
|||
AC_CANONICAL_TARGET
|
||||
|
||||
dnl checks for fat-binary
|
||||
fat_binary=no
|
||||
AC_ARG_ENABLE(fat-binary,
|
||||
[ --enable-fat-binary build a NeXT/Apple Multi Architecture Binary. ],
|
||||
[fat_binary=$enableval])
|
||||
if test "$fat_binary" = yes ; then
|
||||
[ --enable-fat-binary=ARCHS
|
||||
build an Apple/NeXT Multi Architecture Binary (MAB);
|
||||
ARCHS is a comma-delimited list of architectures for
|
||||
which to build; if ARCHS is omitted, then the package
|
||||
will be built for all architectures supported by the
|
||||
platform ("ppc" for MacOS/X and Darwin; "ppc,i386"
|
||||
for Rhapsody; "m68k,i386,sparc" for OpenStep;
|
||||
"m68k,i386,sparc,hppa" for NextStep); if this option
|
||||
is disabled or omitted entirely, then the package
|
||||
will be built only for the target platform],
|
||||
[fat_binary=$enableval], [fat_binary=no])
|
||||
if test "$fat_binary" != no; then
|
||||
|
||||
AC_MSG_CHECKING(target architecture)
|
||||
AC_MSG_CHECKING([target architectures])
|
||||
|
||||
# Respect TARGET_ARCHS setting from environment if available.
|
||||
if test -z "$TARGET_ARCHS"; then
|
||||
# Respect ARCH given to --enable-fat-binary if present.
|
||||
if test "$fat_binary" != yes; then
|
||||
TARGET_ARCHS=`echo "$fat_binary" | tr ',' ' '`
|
||||
else
|
||||
# Choose a default set of architectures based upon platform.
|
||||
case "$target_os" in
|
||||
darwin*)
|
||||
TARGET_ARCHS="ppc"
|
||||
;;
|
||||
rhapsody*)
|
||||
TARGET_ARCHS="ppc i386"
|
||||
;;
|
||||
openstep*)
|
||||
TARGET_ARCHS="m68k i386 sparc"
|
||||
;;
|
||||
nextstep*)
|
||||
TARGET_ARCHS="m68k i386 sparc hppa"
|
||||
;;
|
||||
*)
|
||||
TARGET_ARCHS=`arch`
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([$TARGET_ARCHS])
|
||||
|
||||
case "$target_os" in
|
||||
rhapsody*)
|
||||
echo -n "MacOS X Server: "
|
||||
if test "$TARGET_ARCHS" = "" ; then
|
||||
TARGET_ARCHS="ppc i386"
|
||||
fi
|
||||
;;
|
||||
nextstep*|openstep*)
|
||||
echo -n "NeXTSTEP/OPENSTEP: "
|
||||
if test "$TARGET_ARCHS" = "" ; then
|
||||
if test `/usr/bin/arch` = "m68k" ; then
|
||||
TARGET_ARCHS="m68k i486"
|
||||
else # Black and Native one
|
||||
TARGET_ARCHS="m68k `/usr/bin/arch`"
|
||||
fi
|
||||
fi
|
||||
# to ensure AC_HEADER_SYS_WAIT works
|
||||
AC_DEFINE(_POSIX_SOURCE)
|
||||
;;
|
||||
macos*|darwin*)
|
||||
echo -n "MacOS X (Darwin): "
|
||||
if test "$TARGET_ARCHS" = "" ; then
|
||||
TARGET_ARCHS="ppc i386"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
|
||||
ARCH_FLAG=
|
||||
for archs in $TARGET_ARCHS
|
||||
do
|
||||
ARCH_FLAG="$ARCH_FLAG -arch $archs "
|
||||
echo -n " $archs"
|
||||
ARCH_FLAG="$ARCH_FLAG -arch $archs"
|
||||
done
|
||||
AC_DEFINE(NEXT_FAT_BINARY)
|
||||
echo "."
|
||||
fi
|
||||
|
||||
case $target_cpu in
|
||||
|
@ -350,7 +359,7 @@ AC_HEADER_SYS_WAIT
|
|||
AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h\
|
||||
fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
|
||||
syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \
|
||||
sys/mkdev.h sys/utime.h float.h pthread.h)
|
||||
sys/mkdev.h sys/utime.h netinet/in_systm.h float.h pthread.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_UID_T
|
||||
|
@ -367,7 +376,7 @@ AC_FUNC_MEMCMP
|
|||
AC_FUNC_FSEEKO
|
||||
AC_CHECK_FUNCS(ftello)
|
||||
AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\
|
||||
strchr strstr strtoul crypt flock vsnprintf\
|
||||
strchr strstr strtoul getcwd crypt flock vsnprintf\
|
||||
isinf isnan finite hypot acosh erf)
|
||||
AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync\
|
||||
truncate chsize times utimes fcntl lockf lstat symlink readlink\
|
||||
|
@ -735,9 +744,6 @@ AC_ARG_WITH(dln-a-out,
|
|||
*) with_dln_a_out=no;;
|
||||
esac], [with_dln_a_out=no])
|
||||
|
||||
AC_SUBST(XCFLAGS)dnl
|
||||
AC_SUBST(XLDFLAGS)dnl
|
||||
|
||||
AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf,
|
||||
[AC_TRY_RUN([
|
||||
/* Test for whether ELF binaries are produced */
|
||||
|
@ -801,9 +807,9 @@ if test "$with_dln_a_out" != yes; then
|
|||
AC_MSG_CHECKING(whether OS depend dynamic link works)
|
||||
if test "$GCC" = yes; then
|
||||
case "$target_os" in
|
||||
nextstep*) ;;
|
||||
openstep*) ;;
|
||||
rhapsody*) ;;
|
||||
nextstep*) CCDLFLAGS=-fno-common;;
|
||||
openstep*) CCDLFLAGS=-fno-common;;
|
||||
rhapsody*) CCDLFLAGS=-fno-common;;
|
||||
darwin*) CCDLFLAGS=-fno-common;;
|
||||
human*) ;;
|
||||
bsdi*) ;;
|
||||
|
@ -1094,7 +1100,7 @@ if test "$prefix" = NONE; then
|
|||
prefix=$ac_default_prefix
|
||||
fi
|
||||
|
||||
if test "$fat_binary" = yes ; then
|
||||
if test "$fat_binary" != no ; then
|
||||
XCFLAGS="$ARCH_FLAG"
|
||||
fi
|
||||
|
||||
|
@ -1225,17 +1231,22 @@ case "$target_os" in
|
|||
netbsd*)
|
||||
CFLAGS="$CFLAGS -pipe"
|
||||
;;
|
||||
nextstep*)
|
||||
CFLAGS="$CFLAGS -pipe"
|
||||
;;
|
||||
openstep*)
|
||||
CFLAGS="$CFLAGS -pipe"
|
||||
nextstep*|openstep*)
|
||||
# The -fno-common is needed if we wish to embed the Ruby interpreter
|
||||
# into a plugin module of some project (as opposed to embedding it
|
||||
# within the project's application). The -I/usr/local/include is
|
||||
# needed because CPP as discovered by configure (cc -E -traditional)
|
||||
# fails to consult /usr/local/include by default. This causes
|
||||
# mkmf.rb's have_header() to fail if the desired resource happens to be
|
||||
# installed in the /usr/local tree.
|
||||
CFLAGS="$CFLAGS -pipe -fno-common"
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
||||
;;
|
||||
rhapsody*)
|
||||
CFLAGS="$CFLAGS -pipe -no-precomp"
|
||||
CFLAGS="$CFLAGS -pipe -no-precomp -fno-common"
|
||||
;;
|
||||
darwin*)
|
||||
CFLAGS="$CFLAGS -pipe"
|
||||
CFLAGS="$CFLAGS -pipe -fno-common"
|
||||
;;
|
||||
os2-emx)
|
||||
CFLAGS="$CFLAGS -DOS2 -Zmts"
|
||||
|
@ -1314,6 +1325,8 @@ case "$build_os" in
|
|||
*msdosdjgpp*) FIRSTMAKEFILE=GNUmakefile:djgpp/GNUmakefile.in;;
|
||||
esac
|
||||
|
||||
AC_SUBST(XCFLAGS)dnl
|
||||
AC_SUBST(XLDFLAGS)dnl
|
||||
AC_SUBST(LIBRUBY_LDSHARED)
|
||||
AC_SUBST(LIBRUBY_DLDFLAGS)
|
||||
AC_SUBST(RUBY_INSTALL_NAME)
|
||||
|
@ -1390,7 +1403,7 @@ AC_SUBST(sitedir)dnl
|
|||
configure_args=$ac_configure_args
|
||||
AC_SUBST(configure_args)dnl
|
||||
|
||||
if test "$fat_binary" = yes ; then
|
||||
if test "$fat_binary" != no ; then
|
||||
arch="fat-${target_os}"
|
||||
|
||||
AC_DEFINE_UNQUOTED(RUBY_THIN_ARCHLIB,
|
||||
|
|
22
defines.h
22
defines.h
|
@ -98,15 +98,23 @@ void xfree _((void*));
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NeXT
|
||||
#define DYNAMIC_ENDIAN /* determine endian at runtime */
|
||||
#ifndef __APPLE__
|
||||
#define S_IXUSR _S_IXUSR /* execute/search permission, owner */
|
||||
#endif
|
||||
#ifdef __NeXT__
|
||||
#define S_IXGRP 0000010 /* execute/search permission, group */
|
||||
#define S_IXOTH 0000001 /* execute/search permission, other */
|
||||
|
||||
#define HAVE_SYS_WAIT_H /* configure fails to find this */
|
||||
#ifndef __APPLE__
|
||||
#define S_IXUSR _S_IXUSR /* execute/search permission, owner */
|
||||
#define GETPGRP_VOID 1
|
||||
#define WNOHANG 01
|
||||
#define WUNTRACED 02
|
||||
#define X_OK 1
|
||||
typedef int pid_t;
|
||||
/* Do not trust WORDS_BIGENDIAN from configure since -arch compiler flag may
|
||||
result in a different endian. */
|
||||
#undef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#define WORDS_BIGENDIAN
|
||||
#endif
|
||||
#endif
|
||||
#endif /* NeXT */
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
|
|
7
dir.c
7
dir.c
|
@ -29,7 +29,12 @@
|
|||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
#else
|
||||
# define dirent direct
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
# if !defined __NeXT__
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
# else
|
||||
# /* On some versions of NextStep, d_namlen is always zero, so avoid it. */
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
# endif
|
||||
# if HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
|
|
26
dln.c
26
dln.c
|
@ -1139,12 +1139,15 @@ dln_sym(name)
|
|||
#include <mach-o/rld.h>
|
||||
#else
|
||||
#include <mach-o/dyld.h>
|
||||
#ifndef NSLINKMODULE_OPTION_BINDNOW
|
||||
#define NSLINKMODULE_OPTION_BINDNOW 1
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 && !defined __CYGWIN__
|
||||
#include <windows.h>
|
||||
|
@ -1389,30 +1392,41 @@ dln_load(file)
|
|||
Special Thanks...
|
||||
Yu tomoak-i@is.aist-nara.ac.jp,
|
||||
Mi hisho@tasihara.nest.or.jp,
|
||||
sunshine@sunshineco.com,
|
||||
and... Miss ARAI Akino(^^;)
|
||||
----------------------------------------------------*/
|
||||
#if defined(NeXT) && (NS_TARGET_MAJOR < 4)/* NeXTSTEP rld functions */
|
||||
|
||||
{
|
||||
NXStream* s;
|
||||
unsigned long init_address;
|
||||
char *object_files[2] = {NULL, NULL};
|
||||
|
||||
void (*init_fct)();
|
||||
|
||||
object_files[0] = file;
|
||||
object_files[0] = (char*)file;
|
||||
|
||||
s = NXOpenFile(2,NX_WRITEONLY);
|
||||
|
||||
/* Load object file, if return value ==0 , load failed*/
|
||||
if(rld_load(NULL, NULL, object_files, NULL) == 0) {
|
||||
if(rld_load(s, NULL, object_files, NULL) == 0) {
|
||||
NXFlush(s);
|
||||
NXClose(s);
|
||||
rb_loaderror("Failed to load %.200s", file);
|
||||
}
|
||||
|
||||
/* lookup the initial function */
|
||||
if(rld_lookup(NULL, buf, &init_address) == 0) {
|
||||
if(rld_lookup(s, buf, &init_address) == 0) {
|
||||
NXFlush(s);
|
||||
NXClose(s);
|
||||
rb_loaderror("Failed to lookup Init function %.200s", file);
|
||||
}
|
||||
|
||||
/* Cannot call *init_address directory, so copy this value to
|
||||
funtion pointer */
|
||||
NXFlush(s);
|
||||
NXClose(s);
|
||||
|
||||
/* Cannot call *init_address directory, so copy this value to
|
||||
funtion pointer */
|
||||
init_fct = (void(*)())init_address;
|
||||
(*init_fct)();
|
||||
return (void*)init_address;
|
||||
|
|
11
error.c
11
error.c
|
@ -363,6 +363,13 @@ exc_to_s(exc)
|
|||
return mesg;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
exc_to_str(exc)
|
||||
VALUE exc;
|
||||
{
|
||||
return rb_funcall(exc, rb_intern("to_s"), 0, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
exc_inspect(exc)
|
||||
VALUE exc;
|
||||
|
@ -645,8 +652,8 @@ Init_Exception()
|
|||
rb_define_method(rb_eException, "exception", exc_exception, -1);
|
||||
rb_define_method(rb_eException, "initialize", exc_initialize, -1);
|
||||
rb_define_method(rb_eException, "to_s", exc_to_s, 0);
|
||||
rb_define_method(rb_eException, "to_str", exc_to_s, 0);
|
||||
rb_define_method(rb_eException, "message", exc_to_s, 0);
|
||||
rb_define_method(rb_eException, "to_str", exc_to_str, 0);
|
||||
rb_define_method(rb_eException, "message", exc_to_str, 0);
|
||||
rb_define_method(rb_eException, "inspect", exc_inspect, 0);
|
||||
rb_define_method(rb_eException, "backtrace", exc_backtrace, 0);
|
||||
rb_define_method(rb_eException, "set_backtrace", exc_set_backtrace, 1);
|
||||
|
|
10
eval.c
10
eval.c
|
@ -3589,6 +3589,7 @@ rb_eval(self, n)
|
|||
{
|
||||
VALUE super, klass, tmp, cbase;
|
||||
ID cname;
|
||||
int gen = Qfalse;
|
||||
|
||||
if (NIL_P(ruby_cbase)) {
|
||||
rb_raise(rb_eTypeError, "no outer class/module");
|
||||
|
@ -3625,12 +3626,15 @@ rb_eval(self, n)
|
|||
klass = rb_define_class_id(cname, super);
|
||||
rb_set_class_path(klass, cbase, rb_id2name(cname));
|
||||
rb_const_set(cbase, cname, klass);
|
||||
gen = Qtrue;
|
||||
}
|
||||
if (ruby_wrapper) {
|
||||
rb_extend_object(klass, ruby_wrapper);
|
||||
rb_include_module(klass, ruby_wrapper);
|
||||
}
|
||||
if (super) rb_class_inherited(super, klass);
|
||||
if (super && gen) {
|
||||
rb_class_inherited(super, klass);
|
||||
}
|
||||
result = module_setup(klass, node);
|
||||
}
|
||||
break;
|
||||
|
@ -5596,12 +5600,12 @@ eval(self, src, scope, file, line)
|
|||
if (strcmp(file, "(eval)") == 0) {
|
||||
VALUE mesg, errat;
|
||||
|
||||
errat = get_backtrace(ruby_errinfo);
|
||||
mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg"));
|
||||
if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) {
|
||||
errat = get_backtrace(ruby_errinfo);
|
||||
rb_str_update(mesg, 0, 0, RARRAY(errat)->ptr[0]);
|
||||
RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0];
|
||||
}
|
||||
RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0];
|
||||
}
|
||||
rb_exc_raise(ruby_errinfo);
|
||||
}
|
||||
|
|
|
@ -477,22 +477,34 @@ curses_cols()
|
|||
static VALUE
|
||||
curses_curs_set(VALUE obj, VALUE visibility)
|
||||
{
|
||||
#ifdef HAVE_CURS_SET
|
||||
int n;
|
||||
return (n = curs_set(NUM2INT(visibility)) != ERR) ? INT2FIX(n) : Qnil;
|
||||
#else
|
||||
return Qnil;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
curses_scrl(VALUE obj, VALUE n)
|
||||
{
|
||||
/* may have to raise exception on ERR */
|
||||
#ifdef HAVE_SCRL
|
||||
return (scrl(NUM2INT(n)) == OK) ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
curses_setscrreg(VALUE obj, VALUE top, VALUE bottom)
|
||||
{
|
||||
/* may have to raise exception on ERR */
|
||||
#ifdef HAVE_SETSCRREG
|
||||
return (setscrreg(NUM2INT(top), NUM2INT(bottom)) == OK) ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -519,14 +531,20 @@ curses_attrset(VALUE obj, VALUE attrs)
|
|||
static VALUE
|
||||
curses_bkgdset(VALUE obj, VALUE ch)
|
||||
{
|
||||
#ifdef HAVE_BKGDSET
|
||||
bkgdset(NUM2CHR(ch));
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
curses_bkgd(VALUE obj, VALUE ch)
|
||||
{
|
||||
return CHR2FIX(bkgd(NUM2CHR(ch)));
|
||||
#ifdef HAVE_BKGD
|
||||
return (bkgd(NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -679,6 +697,37 @@ DEFINE_MOUSE_GET_MEMBER(curs_mouse_bstate, bstate)
|
|||
#undef define_curs_mouse_member
|
||||
#endif /* USE_MOUSE */
|
||||
|
||||
static VALUE
|
||||
curses_timeout(VALUE obj, VALUE delay)
|
||||
{
|
||||
#ifdef HAVE_TIMEOUT
|
||||
timeout(NUM2INT(delay));
|
||||
return Qnil;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
curses_def_prog_mode(VALUE obj)
|
||||
{
|
||||
#ifdef HAVE_DEF_PROG_MODE
|
||||
return def_prog_mode() == OK ? Qtrue : Qfalse;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
curses_reset_prog_mode(VALUE obj)
|
||||
{
|
||||
#ifdef HAVE_RESET_PROG_MODE
|
||||
return reset_prog_mode() == OK ? Qtrue : Qfalse;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*-------------------------- class Window --------------------------*/
|
||||
|
||||
/* def self.allocate */
|
||||
|
@ -1125,6 +1174,7 @@ window_idlok(VALUE obj, VALUE bf)
|
|||
static VALUE
|
||||
window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
|
||||
{
|
||||
#ifdef HAVE_WSETSCRREG
|
||||
struct windata *winp;
|
||||
int res;
|
||||
|
||||
|
@ -1132,6 +1182,9 @@ window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
|
|||
res = wsetscrreg(winp->window, NUM2INT(top), NUM2INT(bottom));
|
||||
/* may have to raise exception on ERR */
|
||||
return (res == OK) ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1147,25 +1200,34 @@ window_scroll(VALUE obj)
|
|||
static VALUE
|
||||
window_scrl(VALUE obj, VALUE n)
|
||||
{
|
||||
#ifdef HAVE_WSCRL
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj, winp);
|
||||
/* may have to raise exception on ERR */
|
||||
return (wscrl(winp->window,NUM2INT(n)) == OK) ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
window_attroff(VALUE obj, VALUE attrs)
|
||||
{
|
||||
#ifdef HAVE_WATTROFF
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
return INT2FIX(wattroff(winp->window,NUM2INT(attrs)));
|
||||
#else
|
||||
return Qtrue;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
window_attron(VALUE obj, VALUE attrs)
|
||||
{
|
||||
#ifdef HAVE_WATTRON
|
||||
struct windata *winp;
|
||||
VALUE val;
|
||||
|
||||
|
@ -1179,43 +1241,61 @@ window_attron(VALUE obj, VALUE attrs)
|
|||
else{
|
||||
return val;
|
||||
}
|
||||
#else
|
||||
return Qtrue;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
window_attrset(VALUE obj, VALUE attrs)
|
||||
{
|
||||
#ifdef HAVE_WATTRSET
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
return INT2FIX(wattrset(winp->window,NUM2INT(attrs)));
|
||||
#else
|
||||
return Qtrue;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
window_bkgdset(VALUE obj, VALUE ch)
|
||||
{
|
||||
#ifdef HAVE_WBKGDSET
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
wbkgdset(winp->window, NUM2CHR(ch));
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
window_bkgd(VALUE obj, VALUE ch)
|
||||
{
|
||||
#ifdef HAVE_WBKGD
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
return CHR2FIX(wbkgd(winp->window, NUM2CHR(ch)));
|
||||
return (wbkgd(winp->window, NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
window_getbkgd(VALUE obj)
|
||||
{
|
||||
#ifdef HAVE_WGETBKGD
|
||||
char c;
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
return CHR2FIX(getbkgd(winp->window));
|
||||
return (c = getbkgd(winp->window) != ERR) ? CHR2FIX(c) : Qnil;
|
||||
#else
|
||||
return Qnil;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1232,10 +1312,10 @@ window_resize(VALUE obj, VALUE lin, VALUE col)
|
|||
}
|
||||
|
||||
|
||||
#ifdef HAVE_KEYPAD
|
||||
static VALUE
|
||||
window_keypad(VALUE obj, VALUE val)
|
||||
{
|
||||
#ifdef HAVE_KEYPAD
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
|
@ -1248,8 +1328,37 @@ window_keypad(VALUE obj, VALUE val)
|
|||
return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ?
|
||||
Qtrue : Qfalse;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif /* HAVE_KEYPAD */
|
||||
}
|
||||
|
||||
static VALUE
|
||||
window_nodelay(VALUE obj, VALUE val)
|
||||
{
|
||||
#ifdef HAVE_NODELAY
|
||||
struct windata *winp;
|
||||
GetWINDOW(obj,winp);
|
||||
|
||||
return nodelay(winp->window,RTEST(val) ? TRUE : FALSE) == OK ? Qtrue : Qfalse;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
window_timeout(VALUE obj, VALUE delay)
|
||||
{
|
||||
#ifdef HAVE_WTIMEOUT
|
||||
struct windata *winp;
|
||||
GetWINDOW(obj,winp);
|
||||
|
||||
wtimeout(winp->window,NUM2INT(delay));
|
||||
return Qnil;
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*------------------------- Initialization -------------------------*/
|
||||
void
|
||||
|
@ -1333,6 +1442,10 @@ Init_curses()
|
|||
rb_define_module_function(mCurses, "mousemask", curses_mousemask, 1);
|
||||
#endif /* USE_MOUSE */
|
||||
|
||||
rb_define_module_function(mCurses, "timeout=", curses_timeout, 1);
|
||||
rb_define_module_function(mCurses, "def_prog_mode", curses_def_prog_mode, 0);
|
||||
rb_define_module_function(mCurses, "reset_prog_mode", curses_reset_prog_mode, 0);
|
||||
|
||||
cWindow = rb_define_class_under(mCurses, "Window", rb_cData);
|
||||
rb_define_alloc_func(cWindow, window_s_allocate);
|
||||
rb_define_method(cWindow, "initialize", window_initialize, 4);
|
||||
|
@ -1367,10 +1480,9 @@ Init_curses()
|
|||
rb_define_method(cWindow, "setscrreg", window_setscrreg, 2);
|
||||
rb_define_method(cWindow, "scrl", window_scrl, 1);
|
||||
rb_define_method(cWindow, "resize", window_resize, 2);
|
||||
#ifdef HAVE_KEYPAD
|
||||
rb_define_method(cWindow, "keypad", window_keypad, 1);
|
||||
rb_define_method(cWindow, "keypad=", window_keypad, 1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_COLOR
|
||||
rb_define_method(cWindow, "attroff", window_attroff, 1);
|
||||
rb_define_method(cWindow, "attron", window_attron, 1);
|
||||
|
@ -1380,6 +1492,8 @@ Init_curses()
|
|||
rb_define_method(cWindow, "getbkgd", window_getbkgd, 0);
|
||||
#endif /* USE_COLOR */
|
||||
|
||||
rb_define_method(cWindow, "nodelay=", window_nodelay, 1);
|
||||
rb_define_method(cWindow, "timeout=", window_timeout, 1);
|
||||
|
||||
#define rb_curses_define_const(c) rb_define_const(mCurses,#c,UINT2NUM(c))
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ elsif have_header(*curses=%w"curses.h") and have_library("curses", "initscr")
|
|||
end
|
||||
|
||||
if make
|
||||
for f in %w(isendwin ungetch beep getnstr wgetnstr doupdate flash deleteln wdeleteln keypad keyname init_color wresize resizeterm)
|
||||
for f in %w(beep bkgd bkgdset color curs deleteln doupdate flash getbkgd getnstr init isendwin keyname keypad resizeterm scrl set setscrreg ungetch wattroff wattron wattrset wbkgd wbkgdset wdeleteln wgetnstr wresize wscrl wsetscrreg def_prog_mode reset_prog_mode timeout wtimeout nodelay)
|
||||
have_func(f)
|
||||
end
|
||||
flag = "-D_XOPEN_SOURCE_EXTENDED"
|
||||
|
|
|
@ -49,6 +49,16 @@ etc_getlogin(obj)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
#if defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)
|
||||
static VALUE
|
||||
safe_setup_str(str)
|
||||
const char *str;
|
||||
{
|
||||
if (str == 0) str = "";
|
||||
return rb_tainted_str_new2(str);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETPWENT
|
||||
static VALUE
|
||||
setup_passwd(pwd)
|
||||
|
@ -56,15 +66,15 @@ setup_passwd(pwd)
|
|||
{
|
||||
if (pwd == 0) rb_sys_fail("/etc/passwd");
|
||||
return rb_struct_new(sPasswd,
|
||||
rb_tainted_str_new2(pwd->pw_name),
|
||||
rb_tainted_str_new2(pwd->pw_passwd),
|
||||
safe_setup_str(pwd->pw_name),
|
||||
safe_setup_str(pwd->pw_passwd),
|
||||
INT2FIX(pwd->pw_uid),
|
||||
INT2FIX(pwd->pw_gid),
|
||||
#ifdef HAVE_ST_PW_GECOS
|
||||
rb_tainted_str_new2(pwd->pw_gecos),
|
||||
safe_setup_str(pwd->pw_gecos),
|
||||
#endif
|
||||
rb_tainted_str_new2(pwd->pw_dir),
|
||||
rb_tainted_str_new2(pwd->pw_shell),
|
||||
safe_setup_str(pwd->pw_dir),
|
||||
safe_setup_str(pwd->pw_shell),
|
||||
#ifdef HAVE_ST_PW_CHANGE
|
||||
INT2FIX(pwd->pw_change),
|
||||
#endif
|
||||
|
@ -75,10 +85,10 @@ setup_passwd(pwd)
|
|||
INT2FIX(pwd->pw_age),
|
||||
#endif
|
||||
#ifdef HAVE_ST_PW_CLASS
|
||||
rb_tainted_str_new2(pwd->pw_class),
|
||||
safe_setup_str(pwd->pw_class),
|
||||
#endif
|
||||
#ifdef HAVE_ST_PW_COMMENT
|
||||
rb_tainted_str_new2(pwd->pw_comment),
|
||||
safe_setup_str(pwd->pw_comment),
|
||||
#endif
|
||||
#ifdef HAVE_ST_PW_EXPIRE
|
||||
INT2FIX(pwd->pw_expire),
|
||||
|
@ -220,12 +230,12 @@ setup_group(grp)
|
|||
mem = rb_ary_new();
|
||||
tbl = grp->gr_mem;
|
||||
while (*tbl) {
|
||||
rb_ary_push(mem, rb_tainted_str_new2(*tbl));
|
||||
rb_ary_push(mem, safe_setup_str(*tbl));
|
||||
tbl++;
|
||||
}
|
||||
return rb_struct_new(sGroup,
|
||||
rb_tainted_str_new2(grp->gr_name),
|
||||
rb_tainted_str_new2(grp->gr_passwd),
|
||||
safe_setup_str(grp->gr_name),
|
||||
safe_setup_str(grp->gr_passwd),
|
||||
INT2FIX(grp->gr_gid),
|
||||
mem);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "ruby.h"
|
||||
#include "rubyio.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <signal.h>
|
||||
#ifdef HAVE_SYS_STROPTS_H
|
||||
|
|
|
@ -397,7 +397,7 @@ getaddrinfo(hostname, servname, hints, res)
|
|||
fprintf(stderr, "panic!\n");
|
||||
break;
|
||||
}
|
||||
if ((sp = getservbyname(servname, proto)) == NULL)
|
||||
if ((sp = getservbyname((char*)servname, proto)) == NULL)
|
||||
ERR(EAI_SERVICE);
|
||||
port = sp->s_port;
|
||||
if (pai->ai_socktype == ANY)
|
||||
|
@ -554,7 +554,7 @@ get_name(addr, afd, res, numaddr, pai, port0)
|
|||
#ifdef INET6
|
||||
hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error);
|
||||
#else
|
||||
hp = gethostbyaddr(addr, afd->a_addrlen, AF_INET);
|
||||
hp = gethostbyaddr((char*)addr, afd->a_addrlen, AF_INET);
|
||||
#endif
|
||||
if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
|
||||
GET_AI(cur, afd, hp->h_addr_list[0], port);
|
||||
|
@ -606,7 +606,7 @@ get_addr(hostname, af, res, pai, port0)
|
|||
} else
|
||||
hp = getipnodebyname(hostname, af, AI_ADDRCONFIG, &h_error);
|
||||
#else
|
||||
hp = gethostbyname(hostname);
|
||||
hp = gethostbyname((char*)hostname);
|
||||
h_error = h_errno;
|
||||
#endif
|
||||
if (hp == NULL) {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "ruby.h"
|
||||
#include "rubyio.h"
|
||||
#include "rubysig.h"
|
||||
#include "util.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -31,6 +32,9 @@
|
|||
# include <sys/socket.h>
|
||||
#endif
|
||||
#include <netinet/in.h>
|
||||
#ifdef HAVE_NETINET_IN_SYSTM_H
|
||||
# include <netinet/in_systm.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_TCP_H
|
||||
# include <netinet/tcp.h>
|
||||
#endif
|
||||
|
@ -2016,7 +2020,7 @@ sock_s_gethostbyaddr(argc, argv)
|
|||
t = AF_INET6;
|
||||
}
|
||||
#endif
|
||||
h = gethostbyaddr(RSTRING(addr)->ptr, RSTRING(addr)->len, t);
|
||||
h = gethostbyaddr((char*)RSTRING(addr)->ptr, RSTRING(addr)->len, t);
|
||||
if (h == NULL) {
|
||||
#ifdef HAVE_HSTRERROR
|
||||
extern int h_errno;
|
||||
|
@ -2061,7 +2065,7 @@ sock_s_getservbyaname(argc, argv)
|
|||
else proto = StringValuePtr(protocol);
|
||||
|
||||
StringValue(service);
|
||||
sp = getservbyname(RSTRING(service)->ptr, proto);
|
||||
sp = getservbyname((char*)RSTRING(service)->ptr, proto);
|
||||
if (sp) {
|
||||
port = ntohs(sp->s_port);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
#include "ruby.h"
|
||||
#include "util.h"
|
||||
#include <syslog.h>
|
||||
|
||||
/* Syslog class */
|
||||
|
|
24
file.c
24
file.c
|
@ -1419,14 +1419,12 @@ has_drive_letter(buf)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
getcwdofdrv(drv, buf, len)
|
||||
static char*
|
||||
getcwdofdrv(drv)
|
||||
int drv;
|
||||
char *buf;
|
||||
int len;
|
||||
{
|
||||
char drive[4];
|
||||
char oldcwd[MAXPATHLEN+1];
|
||||
char *drvcwd, *oldcwd;
|
||||
|
||||
drive[0] = drv;
|
||||
drive[1] = ':';
|
||||
|
@ -1436,15 +1434,17 @@ getcwdofdrv(drv, buf, len)
|
|||
of a particular drive is to change chdir() to that drive,
|
||||
so save the old cwd before chdir()
|
||||
*/
|
||||
getcwd(oldcwd, MAXPATHLEN);
|
||||
oldcwd = my_getcwd();
|
||||
if (chdir(drive) == 0) {
|
||||
getcwd(buf, len);
|
||||
drvcwd = my_getcwd();
|
||||
chdir(oldcwd);
|
||||
free(oldcwd);
|
||||
}
|
||||
else {
|
||||
/* perhaps the drive is not exist. we return only drive letter */
|
||||
strncpy(buf, drive, len);
|
||||
drvcwd = strdup(drive);
|
||||
}
|
||||
return drvcwd;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1630,9 +1630,13 @@ file_expand_path(fname, dname, result)
|
|||
}
|
||||
}
|
||||
if (!same) {
|
||||
BUFCHECK(buflen < MAXPATHLEN);
|
||||
getcwdofdrv(*s, buf, MAXPATHLEN);
|
||||
char *dir = getcwdofdrv(*s);
|
||||
|
||||
tainted = 1;
|
||||
dirlen = strlen(dir);
|
||||
BUFCHECK(dirlen > buflen);
|
||||
strcpy(buf, dir);
|
||||
free(dir);
|
||||
}
|
||||
p = chompdirsep(skiproot(buf));
|
||||
s += 2;
|
||||
|
|
3
gc.c
3
gc.c
|
@ -1358,6 +1358,9 @@ Init_stack(addr)
|
|||
if (STACK_LEVEL_MAX > IA64_MAGIC_STACK_LIMIT)
|
||||
STACK_LEVEL_MAX = IA64_MAGIC_STACK_LIMIT;
|
||||
#endif
|
||||
#ifdef _THREAD_SAFE
|
||||
STACK_LEVEL_MAX /= 4;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1036,7 +1036,7 @@ class CGI
|
|||
|
||||
eval <<-END
|
||||
def body.local_path
|
||||
#{body.path.dump}
|
||||
#{(body.class == StringIO)? "" : body.path.dump}
|
||||
end
|
||||
END
|
||||
|
||||
|
|
|
@ -751,7 +751,7 @@ module FileUtils
|
|||
end
|
||||
|
||||
def have_st_ino?
|
||||
/mswin|mingw|bccwin|wince|emx/ !~ RUBY_PLATFORM
|
||||
/djgpp|mswin|mingw|bccwin|wince|emx/ !~ RUBY_PLATFORM
|
||||
end
|
||||
|
||||
def fu_stream_blksize( *streams )
|
||||
|
|
|
@ -215,6 +215,7 @@ def link_command(ldflags, opt="", libpath=$LIBPATH)
|
|||
'INCFLAGS' => $INCFLAGS,
|
||||
'CPPFLAGS' => $CPPFLAGS,
|
||||
'CFLAGS' => "#$CFLAGS",
|
||||
'XCFLAGS' => "#$XCFLAGS",
|
||||
'LDFLAGS' => "#$LDFLAGS #{ldflags}",
|
||||
'LIBPATH' => libpathflag(libpath),
|
||||
'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
|
||||
|
@ -223,7 +224,7 @@ end
|
|||
|
||||
def cc_command(opt="")
|
||||
"$(CC) -c #$INCFLAGS -I#{$hdrdir} " \
|
||||
"#$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C}"
|
||||
"#$CPPFLAGS #$CFLAGS #$XCFLAGS #{opt} #{CONFTEST_C}"
|
||||
end
|
||||
|
||||
def cpp_command(outfile, opt="")
|
||||
|
@ -720,7 +721,7 @@ LIBRUBY_A = #{CONFIG['LIBRUBY_A']}
|
|||
LIBRUBYARG_SHARED = #$LIBRUBYARG_SHARED
|
||||
LIBRUBYARG_STATIC = #$LIBRUBYARG_STATIC
|
||||
|
||||
CFLAGS = #{CONFIG['CCDLFLAGS'] unless $static} #$CFLAGS
|
||||
CFLAGS = #{CONFIG['CCDLFLAGS'] unless $static} #{CONFIG['XCFLAGS']} #$CFLAGS
|
||||
CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) #{$defs.join(" ")} #{$CPPFLAGS}
|
||||
CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
|
||||
DLDFLAGS = #$LDFLAGS #{CONFIG['DLDFLAGS']} #$DLDFLAGS
|
||||
|
@ -943,6 +944,7 @@ def init_mkmf(config = CONFIG)
|
|||
$enable_shared = config['ENABLE_SHARED'] == 'yes'
|
||||
$defs = []
|
||||
$CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).dup
|
||||
$XCFLAGS = config['XCFLAGS'].dup
|
||||
$CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", config["CPPFLAGS"])).dup
|
||||
$LDFLAGS = (with_config("ldflags") || "").dup
|
||||
$INCFLAGS = "-I#{$topdir}"
|
||||
|
|
|
@ -41,7 +41,7 @@ public
|
|||
EncodingConvertMap[['UTF8', 'EUC' ]] = Proc.new { |str| IconvCharset.safe_iconv("euc-jp", "utf-8", str) }
|
||||
EncodingConvertMap[['EUC' , 'UTF8']] = Proc.new { |str| IconvCharset.safe_iconv("utf-8", "euc-jp", str) }
|
||||
EncodingConvertMap[['EUC' , 'SJIS']] = Proc.new { |str| IconvCharset.safe_iconv("shift-jis", "euc-jp", str) }
|
||||
if /(mswin|bccwin|mingw|cygwin)/ =~ RUBY_PLATFORM
|
||||
if /(mswin|bccwin|mingw|cygwin|emx)/ =~ RUBY_PLATFORM
|
||||
EncodingConvertMap[['UTF8', 'SJIS']] = Proc.new { |str| IconvCharset.safe_iconv("cp932", "utf-8", str) }
|
||||
EncodingConvertMap[['SJIS', 'UTF8']] = Proc.new { |str| IconvCharset.safe_iconv("utf-8", "cp932", str) }
|
||||
EncodingConvertMap[['SJIS', 'EUC' ]] = Proc.new { |str| IconvCharset.safe_iconv("euc-jp", "cp932", str) }
|
||||
|
|
2
main.c
2
main.c
|
@ -29,7 +29,7 @@ int _CRT_glob = 0;
|
|||
#endif
|
||||
|
||||
/* to link startup code with ObjC support */
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#if (defined(__APPLE__) || defined(__NeXT__)) && defined(__MACH__)
|
||||
static void objcdummyfunction( void ) { objc_msgSend(); }
|
||||
#endif
|
||||
|
||||
|
|
39
marshal.c
39
marshal.c
|
@ -345,14 +345,15 @@ hash_each(key, value, arg)
|
|||
}
|
||||
|
||||
static void
|
||||
w_extended(klass, arg)
|
||||
w_extended(klass, arg, check)
|
||||
VALUE klass;
|
||||
struct dump_arg *arg;
|
||||
int check;
|
||||
{
|
||||
char *path;
|
||||
|
||||
if (FL_TEST(klass, FL_SINGLETON)) {
|
||||
if (RCLASS(klass)->m_tbl->num_entries ||
|
||||
if (check && RCLASS(klass)->m_tbl->num_entries ||
|
||||
(RCLASS(klass)->iv_tbl && RCLASS(klass)->iv_tbl->num_entries > 1)) {
|
||||
rb_raise(rb_eTypeError, "singleton can't be dumped");
|
||||
}
|
||||
|
@ -367,15 +368,16 @@ w_extended(klass, arg)
|
|||
}
|
||||
|
||||
static void
|
||||
w_class(type, obj, arg)
|
||||
w_class(type, obj, arg, check)
|
||||
int type;
|
||||
VALUE obj;
|
||||
struct dump_arg *arg;
|
||||
int check;
|
||||
{
|
||||
char *path;
|
||||
|
||||
VALUE klass = CLASS_OF(obj);
|
||||
w_extended(klass, arg);
|
||||
w_extended(klass, arg, check);
|
||||
w_byte(type, arg);
|
||||
path = rb_class2name(klass);
|
||||
w_unique(path, arg);
|
||||
|
@ -388,7 +390,7 @@ w_uclass(obj, base_klass, arg)
|
|||
{
|
||||
VALUE klass = CLASS_OF(obj);
|
||||
|
||||
w_extended(klass, arg);
|
||||
w_extended(klass, arg, Qtrue);
|
||||
klass = rb_class_real(klass);
|
||||
if (klass != base_klass) {
|
||||
w_byte(TYPE_UCLASS, arg);
|
||||
|
@ -429,6 +431,7 @@ w_object(obj, arg, limit)
|
|||
{
|
||||
struct dump_call_arg c_arg;
|
||||
st_table *ivtbl = 0;
|
||||
st_data_t num;
|
||||
|
||||
if (limit == 0) {
|
||||
rb_raise(rb_eArgError, "exceed depth limit");
|
||||
|
@ -438,6 +441,12 @@ w_object(obj, arg, limit)
|
|||
c_arg.limit = limit;
|
||||
c_arg.arg = arg;
|
||||
|
||||
if (st_lookup(arg->data, obj, &num)) {
|
||||
w_byte(TYPE_LINK, arg);
|
||||
w_long((long)num, arg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ivtbl = rb_generic_ivar_table(obj)) {
|
||||
w_byte(TYPE_IVAR, arg);
|
||||
}
|
||||
|
@ -468,14 +477,6 @@ w_object(obj, arg, limit)
|
|||
w_symbol(SYM2ID(obj), arg);
|
||||
}
|
||||
else {
|
||||
st_data_t num;
|
||||
|
||||
if (st_lookup(arg->data, obj, &num)) {
|
||||
w_byte(TYPE_LINK, arg);
|
||||
w_long((long)num, arg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (OBJ_TAINTED(obj)) arg->taint = Qtrue;
|
||||
|
||||
st_add_direct(arg->data, obj, arg->data->num_entries);
|
||||
|
@ -483,7 +484,7 @@ w_object(obj, arg, limit)
|
|||
VALUE v;
|
||||
|
||||
v = rb_funcall(obj, s_mdump, 0, 0);
|
||||
w_class(TYPE_USRMARSHAL, obj, arg);
|
||||
w_class(TYPE_USRMARSHAL, obj, arg, Qfalse);
|
||||
w_object(v, arg, limit);
|
||||
if (ivtbl) w_ivar(0, &c_arg);
|
||||
return;
|
||||
|
@ -498,7 +499,7 @@ w_object(obj, arg, limit)
|
|||
if (!ivtbl && (ivtbl = rb_generic_ivar_table(v))) {
|
||||
w_byte(TYPE_IVAR, arg);
|
||||
}
|
||||
w_class(TYPE_USERDEF, obj, arg);
|
||||
w_class(TYPE_USERDEF, obj, arg, Qfalse);
|
||||
w_bytes(RSTRING(v)->ptr, RSTRING(v)->len, arg);
|
||||
if (ivtbl) {
|
||||
w_ivar(ivtbl, &c_arg);
|
||||
|
@ -614,7 +615,7 @@ w_object(obj, arg, limit)
|
|||
break;
|
||||
|
||||
case T_STRUCT:
|
||||
w_class(TYPE_STRUCT, obj, arg);
|
||||
w_class(TYPE_STRUCT, obj, arg, Qtrue);
|
||||
{
|
||||
long len = RSTRUCT(obj)->len;
|
||||
VALUE mem;
|
||||
|
@ -633,7 +634,7 @@ w_object(obj, arg, limit)
|
|||
break;
|
||||
|
||||
case T_OBJECT:
|
||||
w_class(TYPE_OBJECT, obj, arg);
|
||||
w_class(TYPE_OBJECT, obj, arg, Qtrue);
|
||||
w_ivar(ROBJECT(obj)->iv_tbl, &c_arg);
|
||||
break;
|
||||
|
||||
|
@ -641,10 +642,10 @@ w_object(obj, arg, limit)
|
|||
{
|
||||
VALUE v;
|
||||
|
||||
w_class(TYPE_DATA, obj, arg);
|
||||
w_class(TYPE_DATA, obj, arg, Qtrue);
|
||||
if (!rb_respond_to(obj, s_dump_data)) {
|
||||
rb_raise(rb_eTypeError,
|
||||
"class %s needs to have instance method `_dump_data'",
|
||||
"no marshal_dump is defined for class %s",
|
||||
rb_obj_classname(obj));
|
||||
}
|
||||
v = rb_funcall(obj, s_dump_data, 0);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
require 'test/unit/testsuite'
|
||||
require 'test/unit/testcase'
|
||||
require 'test/unit'
|
||||
require 'tempfile'
|
||||
require 'fileutils'
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class TestFile < Test::Unit::TestCase
|
|||
w.close
|
||||
r = File.open(filename, "r")
|
||||
begin
|
||||
if /(mswin|bccwin|mingw)/ =~ RUBY_PLATFORM
|
||||
if /(mswin|bccwin|mingw|emx)/ =~ RUBY_PLATFORM
|
||||
begin
|
||||
File.unlink(filename)
|
||||
assert(false)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# vim:sw=4:ts=4
|
||||
# $Id$
|
||||
#
|
||||
require 'test/unit/testsuite'
|
||||
require 'test/unit/testcase'
|
||||
require 'test/unit'
|
||||
require 'yaml'
|
||||
|
||||
class YAML_Unit_Tests < Test::Unit::TestCase
|
||||
|
|
13
util.c
13
util.c
|
@ -636,14 +636,25 @@ ruby_strdup(str)
|
|||
char *
|
||||
ruby_getcwd()
|
||||
{
|
||||
#ifdef HAVE_GETCWD
|
||||
int size = 200;
|
||||
char *buf = xmalloc(size);
|
||||
|
||||
while (!getcwd(buf, size)) {
|
||||
if (errno != ERANGE) rb_sys_fail(0);
|
||||
if (errno != ERANGE) rb_sys_fail("getcwd");
|
||||
size *= 2;
|
||||
buf = xrealloc(buf, size);
|
||||
}
|
||||
#else
|
||||
# ifndef PATH_MAX
|
||||
# define PATH_MAX 8192
|
||||
# endif
|
||||
char *buf = xmalloc(PATH_MAX+1);
|
||||
|
||||
if (!getwd(buf)) {
|
||||
rb_sys_fail("getwd");
|
||||
}
|
||||
#endif
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -1493,7 +1493,14 @@ mod_av_set(klass, id, val, isconst)
|
|||
|
||||
if (!OBJ_TAINTED(klass) && rb_safe_level() >= 4)
|
||||
rb_raise(rb_eSecurityError, "Insecure: can't set %s", dest);
|
||||
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
|
||||
if (OBJ_FROZEN(klass)) {
|
||||
if (BUILTIN_TYPE(klass) == T_MODULE) {
|
||||
rb_error_frozen("module");
|
||||
}
|
||||
else {
|
||||
rb_error_frozen("class");
|
||||
}
|
||||
}
|
||||
if (!RCLASS(klass)->iv_tbl) {
|
||||
RCLASS(klass)->iv_tbl = st_init_numtable();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче