mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
2000-02-08
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
25be6ce9b5
commit
320e99d8dd
33 changed files with 1157 additions and 516 deletions
63
ChangeLog
63
ChangeLog
|
@ -1,6 +1,67 @@
|
||||||
|
Tue Feb 8 02:07:33 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* regex.c (re_search): optimize for \G at top.
|
||||||
|
|
||||||
|
* regex.c (re_compile_pattern): \G introduced.
|
||||||
|
|
||||||
|
* regex.c (re_match): ditto.
|
||||||
|
|
||||||
|
* string.c (str_sub_bang): old behavior restored: bang method
|
||||||
|
returns nil if string not changed.
|
||||||
|
|
||||||
|
* regex.c (re_compile_pattern): support independent subexpression
|
||||||
|
`(?>pattern)'.
|
||||||
|
|
||||||
|
* regex.c (re_match): ditto.
|
||||||
|
|
||||||
|
Mon Feb 7 15:51:08 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* regex.c (re_match): now understands interrupts under Ruby.
|
||||||
|
|
||||||
|
Mon Feb 7 07:51:52 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* array.c (rb_ary_uniq_bang): always return an Array.
|
||||||
|
|
||||||
|
* array.c (rb_ary_compact_bang): ditto.
|
||||||
|
|
||||||
|
* array.c (rb_ary_flatten_bang): ditto.
|
||||||
|
|
||||||
|
* hash.c (rb_hash_reject): returns a Hash, not an Array.
|
||||||
|
|
||||||
|
* hash.c (env_reject): ditto.
|
||||||
|
|
||||||
|
Fri Feb 4 10:20:25 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* string.c (scan_once): scan now leaves information about the last
|
||||||
|
successful pattern match in $&.
|
||||||
|
|
||||||
|
* io.c (rb_io_close): should not check closed IO.
|
||||||
|
|
||||||
|
Fri Feb 4 05:44:01 2000 Kentaro Inagaki <inagaki@tg.rim.or.jp>
|
||||||
|
|
||||||
|
* ext/socket/socket.c (s_recv): TRAP_BEG after retry entry.
|
||||||
|
|
||||||
|
Wed Feb 2 22:33:45 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||||
|
|
||||||
|
* eval.c (rb_thread_start): receives argument from outside, like
|
||||||
|
`Thread::start(1,2,3){|a,b,c| ... }'.
|
||||||
|
|
||||||
|
Wed Feb 2 22:14:40 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* re.c (rb_reg_regsub): should check regs->num_regs.
|
||||||
|
|
||||||
|
* re.c (rb_reg_search): remove matchcache, use static struct
|
||||||
|
re_register instead.
|
||||||
|
|
||||||
|
* re.c (match_getter): avoid cloning match data.
|
||||||
|
|
||||||
|
Wed Feb 2 17:12:15 2000 Dave Thomas <Dave@Thomases.com>
|
||||||
|
|
||||||
|
* samples/eval.rb: Rescue new ScriptError exception
|
||||||
|
|
||||||
Wed Feb 2 02:06:07 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Wed Feb 2 02:06:07 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* string.c (str_gsub_bang): gsub! now leaves information about
|
* string.c (str_gsub_bang): gsub! now leaves information about the
|
||||||
last successful pattern match in $&.
|
last successful pattern match in $&.
|
||||||
|
|
||||||
Mon Jan 31 15:24:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Mon Jan 31 15:24:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
1
MANIFEST
1
MANIFEST
|
@ -125,6 +125,7 @@ lib/matrix.rb
|
||||||
lib/mkmf.rb
|
lib/mkmf.rb
|
||||||
lib/monitor.rb
|
lib/monitor.rb
|
||||||
lib/mutex_m.rb
|
lib/mutex_m.rb
|
||||||
|
lib/net/http.rb
|
||||||
lib/net/pop.rb
|
lib/net/pop.rb
|
||||||
lib/net/session.rb
|
lib/net/session.rb
|
||||||
lib/net/smtp.rb
|
lib/net/smtp.rb
|
||||||
|
|
4
ToDo
4
ToDo
|
@ -52,9 +52,13 @@ Standard Libraries
|
||||||
- SyntaxError, NameError, LoadError and NotImplementError are subclasses of
|
- SyntaxError, NameError, LoadError and NotImplementError are subclasses of
|
||||||
ScriptError<Exception, not StandardError.
|
ScriptError<Exception, not StandardError.
|
||||||
- String's bang methods return string always
|
- String's bang methods return string always
|
||||||
|
- Thread::start gives arguments, not a thread object to the block
|
||||||
|
- regexp: (?>..)
|
||||||
|
* regexp: \G
|
||||||
* Struct::new([name,]member,...) ??
|
* Struct::new([name,]member,...) ??
|
||||||
* String#scanf(?)
|
* String#scanf(?)
|
||||||
* Object#fmt(?)
|
* Object#fmt(?)
|
||||||
|
* Integer#{bin,oct,hex,heX}
|
||||||
* Time::strptime
|
* Time::strptime
|
||||||
* Integer[num], Float[num]; Fixnum[num]?
|
* Integer[num], Float[num]; Fixnum[num]?
|
||||||
* method to retrieve non-number trailer for to_i/to_f.
|
* method to retrieve non-number trailer for to_i/to_f.
|
||||||
|
|
304
config.guess
vendored
304
config.guess
vendored
|
@ -1,6 +1,7 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Attempt to guess a canonical system name.
|
# Attempt to guess a canonical system name.
|
||||||
# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
|
||||||
|
# Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
|
|
||||||
# Written by Per Bothner <bothner@cygnus.com>.
|
# Written by Per Bothner <bothner@cygnus.com>.
|
||||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||||
|
# Please send patches to the Autoconf mailing list <autoconf@gnu.org>.
|
||||||
#
|
#
|
||||||
# This script attempts to guess a canonical system name similar to
|
# This script attempts to guess a canonical system name similar to
|
||||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||||
|
@ -35,6 +37,19 @@
|
||||||
# (but try to keep the structure clean).
|
# (but try to keep the structure clean).
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Use $HOST_CC if defined. $CC may point to a cross-compiler
|
||||||
|
if test x"$CC_FOR_BUILD" = x; then
|
||||||
|
if test x"$HOST_CC" != x; then
|
||||||
|
CC_FOR_BUILD="$HOST_CC"
|
||||||
|
else
|
||||||
|
if test x"$CC" != x; then
|
||||||
|
CC_FOR_BUILD="$CC"
|
||||||
|
else
|
||||||
|
CC_FOR_BUILD=cc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Modified for Human68k by K.Okabe 1997.07.09
|
# Modified for Human68k by K.Okabe 1997.07.09
|
||||||
# Last change: 1997.07.09
|
# Last change: 1997.07.09
|
||||||
|
|
||||||
|
@ -57,7 +72,8 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||||
|
|
||||||
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
dummy=dummy-$$
|
||||||
|
trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
|
||||||
|
|
||||||
# Note: order is significant - the case branches are not exclusive.
|
# Note: order is significant - the case branches are not exclusive.
|
||||||
|
|
||||||
|
@ -73,7 +89,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
# A Tn.n version is a released field test version.
|
# A Tn.n version is a released field test version.
|
||||||
# A Xn.n version is an unreleased experimental baselevel.
|
# A Xn.n version is an unreleased experimental baselevel.
|
||||||
# 1.2 uses "1.2" for uname -r.
|
# 1.2 uses "1.2" for uname -r.
|
||||||
cat <<EOF >dummy.s
|
cat <<EOF >$dummy.s
|
||||||
.globl main
|
.globl main
|
||||||
.ent main
|
.ent main
|
||||||
main:
|
main:
|
||||||
|
@ -90,9 +106,9 @@ main:
|
||||||
ret \$31,(\$26),1
|
ret \$31,(\$26),1
|
||||||
.end main
|
.end main
|
||||||
EOF
|
EOF
|
||||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
|
||||||
if test "$?" = 0 ; then
|
if test "$?" = 0 ; then
|
||||||
./dummy
|
./$dummy
|
||||||
case "$?" in
|
case "$?" in
|
||||||
7)
|
7)
|
||||||
UNAME_MACHINE="alpha"
|
UNAME_MACHINE="alpha"
|
||||||
|
@ -111,8 +127,14 @@ EOF
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
rm -f dummy.s dummy
|
rm -f $dummy.s $dummy
|
||||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
|
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
|
exit 0 ;;
|
||||||
|
Alpha\ *:Windows_NT*:*)
|
||||||
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
|
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||||
|
# of the specific Alpha model?
|
||||||
|
echo alpha-pc-interix
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
21064:Windows_NT:50:3)
|
21064:Windows_NT:50:3)
|
||||||
echo alpha-dec-winnt3.5
|
echo alpha-dec-winnt3.5
|
||||||
|
@ -156,7 +178,7 @@ EOF
|
||||||
SR2?01:HI-UX/MPP:*:*)
|
SR2?01:HI-UX/MPP:*:*)
|
||||||
echo hppa1.1-hitachi-hiuxmpp
|
echo hppa1.1-hitachi-hiuxmpp
|
||||||
exit 0;;
|
exit 0;;
|
||||||
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
|
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
|
||||||
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
|
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
|
||||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||||
echo pyramid-pyramid-sysv3
|
echo pyramid-pyramid-sysv3
|
||||||
|
@ -164,7 +186,7 @@ EOF
|
||||||
echo pyramid-pyramid-bsd
|
echo pyramid-pyramid-bsd
|
||||||
fi
|
fi
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
NILE:*:*:dcosx)
|
NILE*:*:*:dcosx)
|
||||||
echo pyramid-pyramid-svr4
|
echo pyramid-pyramid-svr4
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
sun4H:SunOS:5.*:*)
|
sun4H:SunOS:5.*:*)
|
||||||
|
@ -215,6 +237,32 @@ EOF
|
||||||
atari*:OpenBSD:*:*)
|
atari*:OpenBSD:*:*)
|
||||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
# The situation for MiNT is a little confusing. The machine name
|
||||||
|
# can be virtually everything (everything which is not
|
||||||
|
# "atarist" or "atariste" at least should have a processor
|
||||||
|
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
|
||||||
|
# to the lowercase version "mint" (or "freemint"). Finally
|
||||||
|
# the system name "TOS" denotes a system which is actually not
|
||||||
|
# MiNT. But MiNT is downward compatible to TOS, so this should
|
||||||
|
# be no problem.
|
||||||
|
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
||||||
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
||||||
|
echo m68k-milan-mint${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
||||||
|
echo m68k-hades-mint${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||||
|
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
sun3*:NetBSD:*:*)
|
sun3*:NetBSD:*:*)
|
||||||
echo m68k-sun-netbsd${UNAME_RELEASE}
|
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
@ -248,12 +296,16 @@ EOF
|
||||||
VAX*:ULTRIX*:*:*)
|
VAX*:ULTRIX*:*:*)
|
||||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
2020:CLIX:*:*)
|
2020:CLIX:*:* | 2430:CLIX:*:*)
|
||||||
echo clipper-intergraph-clix${UNAME_RELEASE}
|
echo clipper-intergraph-clix${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||||
sed 's/^ //' << EOF >dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
int main (argc, argv) int argc; char **argv; {
|
#ifdef __cplusplus
|
||||||
|
int main (int argc, char *argv[]) {
|
||||||
|
#else
|
||||||
|
int main (argc, argv) int argc; char *argv[]; {
|
||||||
|
#endif
|
||||||
#if defined (host_mips) && defined (MIPSEB)
|
#if defined (host_mips) && defined (MIPSEB)
|
||||||
#if defined (SYSTYPE_SYSV)
|
#if defined (SYSTYPE_SYSV)
|
||||||
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
|
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
|
||||||
|
@ -268,10 +320,10 @@ EOF
|
||||||
exit (-1);
|
exit (-1);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
${CC-cc} dummy.c -o dummy \
|
$CC_FOR_BUILD $dummy.c -o $dummy \
|
||||||
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||||
&& rm dummy.c dummy && exit 0
|
&& rm $dummy.c $dummy && exit 0
|
||||||
rm -f dummy.c dummy
|
rm -f $dummy.c $dummy
|
||||||
echo mips-mips-riscos${UNAME_RELEASE}
|
echo mips-mips-riscos${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
Night_Hawk:Power_UNIX:*:*)
|
Night_Hawk:Power_UNIX:*:*)
|
||||||
|
@ -323,7 +375,7 @@ EOF
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:AIX:2:3)
|
*:AIX:2:3)
|
||||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||||
sed 's/^ //' << EOF >dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
#include <sys/systemcfg.h>
|
#include <sys/systemcfg.h>
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -334,8 +386,8 @@ EOF
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
|
||||||
rm -f dummy.c dummy
|
rm -f $dummy.c $dummy
|
||||||
echo rs6000-ibm-aix3.2.5
|
echo rs6000-ibm-aix3.2.5
|
||||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||||
echo rs6000-ibm-aix3.2.4
|
echo rs6000-ibm-aix3.2.4
|
||||||
|
@ -382,25 +434,25 @@ EOF
|
||||||
case "${UNAME_MACHINE}" in
|
case "${UNAME_MACHINE}" in
|
||||||
9000/31? ) HP_ARCH=m68000 ;;
|
9000/31? ) HP_ARCH=m68000 ;;
|
||||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||||
9000/[678]?? )
|
9000/[678][0-9][0-9])
|
||||||
sed 's/^ //' << EOF >dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
long bits = sysconf(_SC_KERNEL_BITS);
|
long bits = sysconf(_SC_KERNEL_BITS);
|
||||||
#endif
|
#endif
|
||||||
long cpu = sysconf (_SC_CPU_VERSION);
|
long cpu = sysconf (_SC_CPU_VERSION);
|
||||||
|
|
||||||
switch (cpu)
|
switch (cpu)
|
||||||
{
|
{
|
||||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||||
case CPU_PA_RISC2_0:
|
case CPU_PA_RISC2_0:
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
switch (bits)
|
switch (bits)
|
||||||
{
|
{
|
||||||
case 64: puts ("hppa2.0w"); break;
|
case 64: puts ("hppa2.0w"); break;
|
||||||
case 32: puts ("hppa2.0n"); break;
|
case 32: puts ("hppa2.0n"); break;
|
||||||
|
@ -408,20 +460,20 @@ EOF
|
||||||
} break;
|
} break;
|
||||||
#else /* !defined(_SC_KERNEL_BITS) */
|
#else /* !defined(_SC_KERNEL_BITS) */
|
||||||
puts ("hppa2.0"); break;
|
puts ("hppa2.0"); break;
|
||||||
#endif
|
#endif
|
||||||
default: puts ("hppa1.0"); break;
|
default: puts ("hppa1.0"); break;
|
||||||
}
|
}
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
(${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy`
|
($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
|
||||||
rm -f dummy.c dummy
|
rm -f $dummy.c $dummy
|
||||||
esac
|
esac
|
||||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
3050*:HI-UX:*:*)
|
3050*:HI-UX:*:*)
|
||||||
sed 's/^ //' << EOF >dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
|
@ -446,8 +498,8 @@ EOF
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
|
||||||
rm -f dummy.c dummy
|
rm -f $dummy.c $dummy
|
||||||
echo unknown-hitachi-hiuxwe2
|
echo unknown-hitachi-hiuxwe2
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||||
|
@ -456,6 +508,9 @@ EOF
|
||||||
9000/8??:4.3bsd:*:*)
|
9000/8??:4.3bsd:*:*)
|
||||||
echo hppa1.0-hp-bsd
|
echo hppa1.0-hp-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
*9??*:MPE/iX:*:*)
|
||||||
|
echo hppa1.0-hp-mpeix
|
||||||
|
exit 0 ;;
|
||||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||||
echo hppa1.1-hp-osf
|
echo hppa1.1-hp-osf
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
@ -472,6 +527,9 @@ EOF
|
||||||
parisc*:Lites*:*:*)
|
parisc*:Lites*:*:*)
|
||||||
echo hppa1.1-hp-lites
|
echo hppa1.1-hp-lites
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
hppa*:OpenBSD:*:*)
|
||||||
|
echo hppa-unknown-openbsd
|
||||||
|
exit 0 ;;
|
||||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||||
echo c1-convex-bsd
|
echo c1-convex-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
@ -504,11 +562,14 @@ EOF
|
||||||
CRAY*TS:*:*:*)
|
CRAY*TS:*:*:*)
|
||||||
echo t90-cray-unicos${UNAME_RELEASE}
|
echo t90-cray-unicos${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
CRAY*T3E:*:*:*)
|
||||||
|
echo t3e-cray-unicosmk${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
CRAY-2:*:*:*)
|
CRAY-2:*:*:*)
|
||||||
echo cray2-cray-unicos
|
echo cray2-cray-unicos
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
F300:UNIX_System_V:*:*)
|
F300:UNIX_System_V:*:*)
|
||||||
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||||
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
@ -521,16 +582,22 @@ EOF
|
||||||
hp300:OpenBSD:*:*)
|
hp300:OpenBSD:*:*)
|
||||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
sparc*:BSD/OS:*:*)
|
|
||||||
echo sparc-unknown-bsdi${UNAME_RELEASE}
|
|
||||||
exit 0 ;;
|
|
||||||
i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
|
i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
sparc*:BSD/OS:*:*)
|
||||||
|
echo sparc-unknown-bsdi${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
*:BSD/OS:*:*)
|
*:BSD/OS:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:FreeBSD:*:*)
|
*:FreeBSD:*:*)
|
||||||
|
if test -x /usr/bin/objformat; then
|
||||||
|
if test "elf" = "`/usr/bin/objformat`"; then
|
||||||
|
echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:NetBSD:*:*)
|
*:NetBSD:*:*)
|
||||||
|
@ -548,6 +615,15 @@ EOF
|
||||||
i*:MINGW*:*)
|
i*:MINGW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-mingw32
|
echo ${UNAME_MACHINE}-pc-mingw32
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||||
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
|
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||||
|
# UNAME_MACHINE based on the output of uname instead of i386?
|
||||||
|
echo i386-pc-interix
|
||||||
|
exit 0 ;;
|
||||||
|
i*:UWIN*:*)
|
||||||
|
echo ${UNAME_MACHINE}-pc-uwin
|
||||||
|
exit 0 ;;
|
||||||
p*:CYGWIN*:*)
|
p*:CYGWIN*:*)
|
||||||
echo powerpcle-unknown-cygwin
|
echo powerpcle-unknown-cygwin
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
@ -561,12 +637,14 @@ EOF
|
||||||
# uname on the ARM produces all sorts of strangeness, and we need to
|
# uname on the ARM produces all sorts of strangeness, and we need to
|
||||||
# filter it out.
|
# filter it out.
|
||||||
case "$UNAME_MACHINE" in
|
case "$UNAME_MACHINE" in
|
||||||
|
armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
|
||||||
arm* | sa110*) UNAME_MACHINE="arm" ;;
|
arm* | sa110*) UNAME_MACHINE="arm" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# The BFD linker knows what the default object file format is, so
|
# The BFD linker knows what the default object file format is, so
|
||||||
# first see if it will tell us.
|
# first see if it will tell us. cd to the root directory to prevent
|
||||||
ld_help_string=`ld --help 2>&1`
|
# problems with other programs or directories called `ld' in the path.
|
||||||
|
ld_help_string=`cd /; ld --help 2>&1`
|
||||||
ld_supported_emulations=`echo $ld_help_string \
|
ld_supported_emulations=`echo $ld_help_string \
|
||||||
| sed -ne '/supported emulations:/!d
|
| sed -ne '/supported emulations:/!d
|
||||||
s/[ ][ ]*/ /g
|
s/[ ][ ]*/ /g
|
||||||
|
@ -577,12 +655,42 @@ EOF
|
||||||
i?86linux) echo "${UNAME_MACHINE}-pc-linux-aout" ; exit 0 ;;
|
i?86linux) echo "${UNAME_MACHINE}-pc-linux-aout" ; exit 0 ;;
|
||||||
i?86coff) echo "${UNAME_MACHINE}-pc-linux-coff" ; exit 0 ;;
|
i?86coff) echo "${UNAME_MACHINE}-pc-linux-coff" ; exit 0 ;;
|
||||||
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-aout" ; exit 0 ;;
|
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-aout" ; exit 0 ;;
|
||||||
|
armlinux) echo "${UNAME_MACHINE}-unknown-linux-aout" ; exit 0 ;;
|
||||||
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-aout" ; exit 0 ;;
|
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-aout" ; exit 0 ;;
|
||||||
elf32ppc) echo "powerpc-unknown-linux" ; exit 0 ;;
|
elf32ppc)
|
||||||
|
# Determine Lib Version
|
||||||
|
cat >$dummy.c <<EOF
|
||||||
|
#include <features.h>
|
||||||
|
#if defined(__GLIBC__)
|
||||||
|
extern char __libc_version[];
|
||||||
|
extern char __libc_release[];
|
||||||
|
#endif
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
{
|
||||||
|
#if defined(__GLIBC__)
|
||||||
|
printf("%s %s\n", __libc_version, __libc_release);
|
||||||
|
#else
|
||||||
|
printf("unkown\n");
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
LIBC=""
|
||||||
|
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
|
||||||
|
if test "$?" = 0 ; then
|
||||||
|
./$dummy | grep 1\.99 > /dev/null
|
||||||
|
if test "$?" = 0 ; then
|
||||||
|
LIBC="libc1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -f $dummy.c $dummy
|
||||||
|
echo powerpc-unknown-linux-${LIBC} ; exit 0 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test "${UNAME_MACHINE}" = "alpha" ; then
|
if test "${UNAME_MACHINE}" = "alpha" ; then
|
||||||
sed 's/^ //' <<EOF >dummy.s
|
sed 's/^ //' <<EOF >$dummy.s
|
||||||
.globl main
|
.globl main
|
||||||
.ent main
|
.ent main
|
||||||
main:
|
main:
|
||||||
|
@ -600,9 +708,9 @@ EOF
|
||||||
.end main
|
.end main
|
||||||
EOF
|
EOF
|
||||||
LIBC=""
|
LIBC=""
|
||||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
|
||||||
if test "$?" = 0 ; then
|
if test "$?" = 0 ; then
|
||||||
./dummy
|
./$dummy
|
||||||
case "$?" in
|
case "$?" in
|
||||||
7)
|
7)
|
||||||
UNAME_MACHINE="alpha"
|
UNAME_MACHINE="alpha"
|
||||||
|
@ -621,20 +729,21 @@ EOF
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
objdump --private-headers dummy | \
|
objdump --private-headers $dummy | \
|
||||||
grep ld.so.1 > /dev/null
|
grep ld.so.1 > /dev/null
|
||||||
if test "$?" = 0 ; then
|
if test "$?" = 0 ; then
|
||||||
LIBC="-libc1"
|
LIBC="-libc1"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f dummy.s dummy
|
rm -f $dummy.s $dummy
|
||||||
echo ${UNAME_MACHINE}-unknown-linux${LIBC} ; exit 0
|
echo ${UNAME_MACHINE}-unknown-linux{LIBC} ; exit 0
|
||||||
elif test "${UNAME_MACHINE}" = "mips" ; then
|
elif test "${UNAME_MACHINE}" = "mips" ; then
|
||||||
cat >dummy.c <<EOF
|
cat >$dummy.c <<EOF
|
||||||
main(argc, argv)
|
#ifdef __cplusplus
|
||||||
int argc;
|
int main (int argc, char *argv[]) {
|
||||||
char *argv[];
|
#else
|
||||||
{
|
int main (argc, argv) int argc; char *argv[]; {
|
||||||
|
#endif
|
||||||
#ifdef __MIPSEB__
|
#ifdef __MIPSEB__
|
||||||
printf ("%s-unknown-linux\n", argv[1]);
|
printf ("%s-unknown-linux\n", argv[1]);
|
||||||
#endif
|
#endif
|
||||||
|
@ -644,9 +753,17 @@ main(argc, argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
|
||||||
rm -f dummy.c dummy
|
rm -f $dummy.c $dummy
|
||||||
else
|
else
|
||||||
|
# Either a pre-BFD a.out linker (linux-oldld)
|
||||||
|
# or one that does not give us useful --help.
|
||||||
|
# GCC wants to distinguish between linux-oldld and linux-aout.
|
||||||
|
# If ld does not provide *any* "supported emulations:"
|
||||||
|
# that means it is oldld.
|
||||||
|
echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
|
||||||
|
test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-oldld" && exit 0
|
||||||
|
|
||||||
case "${UNAME_MACHINE}" in
|
case "${UNAME_MACHINE}" in
|
||||||
i?86)
|
i?86)
|
||||||
VENDOR=pc;
|
VENDOR=pc;
|
||||||
|
@ -655,8 +772,32 @@ EOF
|
||||||
VENDOR=unknown;
|
VENDOR=unknown;
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
echo ${UNAME_MACHINE}-${VENDOR}-linux
|
# Determine whether the default compiler is a.out or elf
|
||||||
exit 0
|
cat >$dummy.c <<EOF
|
||||||
|
#include <features.h>
|
||||||
|
#ifdef __cplusplus
|
||||||
|
int main (int argc, char *argv[]) {
|
||||||
|
#else
|
||||||
|
int main (argc, argv) int argc; char *argv[]; {
|
||||||
|
#endif
|
||||||
|
#ifdef __ELF__
|
||||||
|
# ifdef __GLIBC__
|
||||||
|
# if __GLIBC__ >= 2
|
||||||
|
printf ("%s-${VENDOR}-linux\n", argv[1]);
|
||||||
|
# else
|
||||||
|
printf ("%s-${VENDOR}-linux-libc1\n", argv[1]);
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
printf ("%s-${VENDOR}-linux-libc1\n", argv[1]);
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
printf ("%s-${VENDOR}-linux-aout\n", argv[1]);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
|
||||||
|
rm -f $dummy.c $dummy
|
||||||
fi ;;
|
fi ;;
|
||||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||||
# are messed up and put the nodename in both sysname and nodename.
|
# are messed up and put the nodename in both sysname and nodename.
|
||||||
|
@ -678,6 +819,14 @@ EOF
|
||||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||||
fi
|
fi
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
i?86:*:5:7*)
|
||||||
|
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||||
|
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||||
|
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586
|
||||||
|
(/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686
|
||||||
|
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585
|
||||||
|
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
i?86:*:3.2:*)
|
i?86:*:3.2:*)
|
||||||
if test -f /usr/options/cb.name; then
|
if test -f /usr/options/cb.name; then
|
||||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||||
|
@ -687,6 +836,10 @@ EOF
|
||||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||||
&& UNAME_MACHINE=i586
|
&& UNAME_MACHINE=i586
|
||||||
|
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
|
||||||
|
&& UNAME_MACHINE=i686
|
||||||
|
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
|
||||||
|
&& UNAME_MACHINE=i686
|
||||||
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
||||||
else
|
else
|
||||||
echo ${UNAME_MACHINE}-pc-sysv32
|
echo ${UNAME_MACHINE}-pc-sysv32
|
||||||
|
@ -740,7 +893,7 @@ EOF
|
||||||
mc68030:UNIX_System_V:4.*:*)
|
mc68030:UNIX_System_V:4.*:*)
|
||||||
echo m68k-atari-sysv4
|
echo m68k-atari-sysv4
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
i?86:LynxOS:2.*:*)
|
i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
|
||||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
TSUNAMI:LynxOS:2.*:*)
|
TSUNAMI:LynxOS:2.*:*)
|
||||||
|
@ -752,6 +905,9 @@ EOF
|
||||||
SM[BE]S:UNIX_SV:*:*)
|
SM[BE]S:UNIX_SV:*:*)
|
||||||
echo mips-dde-sysv${UNAME_RELEASE}
|
echo mips-dde-sysv${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
RM*:ReliantUNIX-*:*:*)
|
||||||
|
echo mips-sni-sysv4
|
||||||
|
exit 0 ;;
|
||||||
RM*:SINIX-*:*:*)
|
RM*:SINIX-*:*:*)
|
||||||
echo mips-sni-sysv4
|
echo mips-sni-sysv4
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
@ -782,7 +938,7 @@ EOF
|
||||||
news*:NEWS-OS:*:6*)
|
news*:NEWS-OS:*:6*)
|
||||||
echo mips-sony-newsos6
|
echo mips-sony-newsos6
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
|
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||||
if [ -d /usr/nec ]; then
|
if [ -d /usr/nec ]; then
|
||||||
echo mips-nec-sysv`echo ${UNAME_RELEASE} | sed -n 's/\([.0-9]*\).*/\1/p'`
|
echo mips-nec-sysv`echo ${UNAME_RELEASE} | sed -n 's/\([.0-9]*\).*/\1/p'`
|
||||||
else
|
else
|
||||||
|
@ -801,27 +957,24 @@ EOF
|
||||||
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
||||||
echo i586-pc-beos
|
echo i586-pc-beos
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
SX-4:SUPER-UX:*:*)
|
||||||
*:Rhapsody:*:*)
|
echo sx4-nec-superux${UNAME_RELEASE}
|
||||||
arch=`/usr/bin/arch`
|
exit 0 ;;
|
||||||
case "$arch" in
|
SX-5:SUPER-UX:*:*)
|
||||||
ppc)
|
echo sx5-nec-superux${UNAME_RELEASE}
|
||||||
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
exit 0 ;;
|
||||||
;;
|
Power*:Rhapsody:*:*)
|
||||||
i[3456]86)
|
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
||||||
echo i386-apple-rhapsody${UNAME_RELEASE}
|
exit 0 ;;
|
||||||
;;
|
*:Rhapsody:*:*)
|
||||||
*)
|
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
|
||||||
echo $arch-apple-rhapsody${UNAME_RELEASE}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||||
|
|
||||||
cat >dummy.c <<EOF
|
cat >$dummy.c <<EOF
|
||||||
#ifdef _SEQUENT_
|
#ifdef _SEQUENT_
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/utsname.h>
|
# include <sys/utsname.h>
|
||||||
|
@ -863,7 +1016,6 @@ main ()
|
||||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||||
else
|
else
|
||||||
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
|
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
|
||||||
|
|
||||||
exit (0);
|
exit (0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -923,8 +1075,8 @@ main ()
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
|
||||||
rm -f dummy.c dummy
|
rm -f $dummy.c $dummy
|
||||||
|
|
||||||
# Apollos put the system type in the environment.
|
# Apollos put the system type in the environment.
|
||||||
|
|
||||||
|
|
312
config.sub
vendored
312
config.sub
vendored
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Configuration validation subroutine script, version 1.1.
|
# Configuration validation subroutine script, version 1.1.
|
||||||
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
|
# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc.
|
||||||
# This file is (in principle) common to ALL GNU software.
|
# This file is (in principle) common to ALL GNU software.
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
# The presence of a machine in this file suggests that SOME GNU software
|
||||||
# can handle that machine. It does not imply ALL GNU software can.
|
# can handle that machine. It does not imply ALL GNU software can.
|
||||||
|
@ -98,11 +98,21 @@ case $os in
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
|
-sim | -cisco | -oki | -wec | -winbond)
|
||||||
|
os=
|
||||||
|
basic_machine=$1
|
||||||
|
;;
|
||||||
|
-scout)
|
||||||
|
;;
|
||||||
|
-wrs)
|
||||||
|
os=vxworks
|
||||||
|
basic_machine=$1
|
||||||
|
;;
|
||||||
-hiux*)
|
-hiux*)
|
||||||
os=-hiuxwe2
|
os=-hiuxwe2
|
||||||
;;
|
;;
|
||||||
-sco5)
|
-sco5)
|
||||||
os=sco3.2v5
|
os=-sco3.2v5
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-sco4)
|
-sco4)
|
||||||
|
@ -121,6 +131,9 @@ case $os in
|
||||||
os=-sco3.2v2
|
os=-sco3.2v2
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
|
-udk*)
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||||
|
;;
|
||||||
-isc)
|
-isc)
|
||||||
os=-isc2.2
|
os=-isc2.2
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||||
|
@ -151,14 +164,21 @@ case $basic_machine in
|
||||||
# Some are omitted here because they have special meanings below.
|
# Some are omitted here because they have special meanings below.
|
||||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||||
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
|
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
|
||||||
| 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w \
|
| 580 | i960 | h8300 \
|
||||||
| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
|
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
|
||||||
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
|
| alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
|
||||||
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
|
| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
|
||||||
| mipstx39 | mipstx39el \
|
| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
|
||||||
| sparc | sparclet | sparclite | sparc64 | v850)
|
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
|
||||||
|
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
|
||||||
|
| mips64vr5000 | miprs64vr5000el \
|
||||||
|
| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
|
||||||
|
| thumb | d10v)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
|
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65)
|
||||||
|
;;
|
||||||
|
|
||||||
# We use `pc' rather than `unknown'
|
# We use `pc' rather than `unknown'
|
||||||
# because (1) that's what they normally are, and
|
# because (1) that's what they normally are, and
|
||||||
# (2) the word "unknown" tends to confuse beginning users.
|
# (2) the word "unknown" tends to confuse beginning users.
|
||||||
|
@ -177,24 +197,41 @@ case $basic_machine in
|
||||||
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||||
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
|
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
|
||||||
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0* | hppa2.0w-* \
|
| xmp-* | ymp-* \
|
||||||
| alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
|
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
|
||||||
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
|
| alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
|
||||||
|
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
|
||||||
|
| clipper-* | orion-* \
|
||||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||||
| sparc64-* | mips64-* | mipsel-* \
|
| sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
|
||||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||||
|
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
|
||||||
| mipstx39-* | mipstx39el-* \
|
| mipstx39-* | mipstx39el-* \
|
||||||
| f301-*)
|
| f301-* | armv*-* | t3e-* \
|
||||||
|
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
|
||||||
|
| thumb-* | v850-* | d30v-* | tic30-* | c30-* )
|
||||||
;;
|
;;
|
||||||
# Recognize the various machine names and aliases which stand
|
# Recognize the various machine names and aliases which stand
|
||||||
# for a CPU type and a company and sometimes even an OS.
|
# for a CPU type and a company and sometimes even an OS.
|
||||||
|
386bsd)
|
||||||
|
basic_machine=i386-unknown
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||||
basic_machine=m68000-att
|
basic_machine=m68000-att
|
||||||
;;
|
;;
|
||||||
3b*)
|
3b*)
|
||||||
basic_machine=we32k-att
|
basic_machine=we32k-att
|
||||||
;;
|
;;
|
||||||
|
a29khif)
|
||||||
|
basic_machine=a29k-amd
|
||||||
|
os=-udi
|
||||||
|
;;
|
||||||
|
adobe68k)
|
||||||
|
basic_machine=m68010-adobe
|
||||||
|
os=-scout
|
||||||
|
;;
|
||||||
alliant | fx80)
|
alliant | fx80)
|
||||||
basic_machine=fx80-alliant
|
basic_machine=fx80-alliant
|
||||||
;;
|
;;
|
||||||
|
@ -224,6 +261,10 @@ case $basic_machine in
|
||||||
basic_machine=m68k-apollo
|
basic_machine=m68k-apollo
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
apollo68bsd)
|
||||||
|
basic_machine=m68k-apollo
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
aux)
|
aux)
|
||||||
basic_machine=m68k-apple
|
basic_machine=m68k-apple
|
||||||
os=-aux
|
os=-aux
|
||||||
|
@ -300,6 +341,10 @@ case $basic_machine in
|
||||||
encore | umax | mmax)
|
encore | umax | mmax)
|
||||||
basic_machine=ns32k-encore
|
basic_machine=ns32k-encore
|
||||||
;;
|
;;
|
||||||
|
es1800 | OSE68k | ose68k | ose | OSE)
|
||||||
|
basic_machine=m68k-ericsson
|
||||||
|
os=-ose
|
||||||
|
;;
|
||||||
fx2800)
|
fx2800)
|
||||||
basic_machine=i860-alliant
|
basic_machine=i860-alliant
|
||||||
;;
|
;;
|
||||||
|
@ -318,6 +363,14 @@ case $basic_machine in
|
||||||
basic_machine=h8300-hitachi
|
basic_machine=h8300-hitachi
|
||||||
os=-hms
|
os=-hms
|
||||||
;;
|
;;
|
||||||
|
h8300xray)
|
||||||
|
basic_machine=h8300-hitachi
|
||||||
|
os=-xray
|
||||||
|
;;
|
||||||
|
h8500hms)
|
||||||
|
basic_machine=h8500-hitachi
|
||||||
|
os=-hms
|
||||||
|
;;
|
||||||
harris)
|
harris)
|
||||||
basic_machine=m88k-harris
|
basic_machine=m88k-harris
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
|
@ -333,13 +386,30 @@ case $basic_machine in
|
||||||
basic_machine=m68k-hp
|
basic_machine=m68k-hp
|
||||||
os=-hpux
|
os=-hpux
|
||||||
;;
|
;;
|
||||||
|
hp3k9[0-9][0-9] | hp9[0-9][0-9])
|
||||||
|
basic_machine=hppa1.0-hp
|
||||||
|
;;
|
||||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||||
basic_machine=m68000-hp
|
basic_machine=m68000-hp
|
||||||
;;
|
;;
|
||||||
hp9k3[2-9][0-9])
|
hp9k3[2-9][0-9])
|
||||||
basic_machine=m68k-hp
|
basic_machine=m68k-hp
|
||||||
;;
|
;;
|
||||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
hp9k6[0-9][0-9] | hp6[0-9][0-9])
|
||||||
|
basic_machine=hppa1.0-hp
|
||||||
|
;;
|
||||||
|
hp9k7[0-79][0-9] | hp7[0-79][0-9])
|
||||||
|
basic_machine=hppa1.1-hp
|
||||||
|
;;
|
||||||
|
hp9k78[0-9] | hp78[0-9])
|
||||||
|
# FIXME: really hppa2.0-hp
|
||||||
|
basic_machine=hppa1.1-hp
|
||||||
|
;;
|
||||||
|
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
|
||||||
|
# FIXME: really hppa2.0-hp
|
||||||
|
basic_machine=hppa1.1-hp
|
||||||
|
;;
|
||||||
|
hp9k8[0-9][13679] | hp8[0-9][13679])
|
||||||
basic_machine=hppa1.1-hp
|
basic_machine=hppa1.1-hp
|
||||||
;;
|
;;
|
||||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||||
|
@ -348,6 +418,14 @@ case $basic_machine in
|
||||||
hppa-next)
|
hppa-next)
|
||||||
os=-nextstep3
|
os=-nextstep3
|
||||||
;;
|
;;
|
||||||
|
hppaosf)
|
||||||
|
basic_machine=hppa1.1-hp
|
||||||
|
os=-osf
|
||||||
|
;;
|
||||||
|
hppro)
|
||||||
|
basic_machine=hppa1.1-hp
|
||||||
|
os=-proelf
|
||||||
|
;;
|
||||||
i370-ibm* | ibm*)
|
i370-ibm* | ibm*)
|
||||||
basic_machine=i370-ibm
|
basic_machine=i370-ibm
|
||||||
os=-mvs
|
os=-mvs
|
||||||
|
@ -369,6 +447,22 @@ case $basic_machine in
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||||
os=-solaris2
|
os=-solaris2
|
||||||
;;
|
;;
|
||||||
|
i386mach)
|
||||||
|
basic_machine=i386-mach
|
||||||
|
os=-mach
|
||||||
|
;;
|
||||||
|
i386-vsta | vsta)
|
||||||
|
basic_machine=i386-unknown
|
||||||
|
os=-vsta
|
||||||
|
;;
|
||||||
|
i386-go32 | go32)
|
||||||
|
basic_machine=i386-unknown
|
||||||
|
os=-go32
|
||||||
|
;;
|
||||||
|
i386-mingw32 | mingw32)
|
||||||
|
basic_machine=i386-unknown
|
||||||
|
os=-mingw32
|
||||||
|
;;
|
||||||
iris | iris4d)
|
iris | iris4d)
|
||||||
basic_machine=mips-sgi
|
basic_machine=mips-sgi
|
||||||
case $os in
|
case $os in
|
||||||
|
@ -397,6 +491,10 @@ case $basic_machine in
|
||||||
miniframe)
|
miniframe)
|
||||||
basic_machine=m68000-convergent
|
basic_machine=m68000-convergent
|
||||||
;;
|
;;
|
||||||
|
*mint | *MiNT)
|
||||||
|
basic_machine=m68k-atari
|
||||||
|
os=-mint
|
||||||
|
;;
|
||||||
mipsel*-linux*)
|
mipsel*-linux*)
|
||||||
basic_machine=mipsel-unknown
|
basic_machine=mipsel-unknown
|
||||||
os=-linux
|
os=-linux
|
||||||
|
@ -411,10 +509,26 @@ case $basic_machine in
|
||||||
mips3*)
|
mips3*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||||
;;
|
;;
|
||||||
|
monitor)
|
||||||
|
basic_machine=m68k-rom68k
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
msdos)
|
||||||
|
basic_machine=i386-unknown
|
||||||
|
os=-msdos
|
||||||
|
;;
|
||||||
ncr3000)
|
ncr3000)
|
||||||
basic_machine=i486-ncr
|
basic_machine=i486-ncr
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
|
netbsd386)
|
||||||
|
basic_machine=i386-unknown
|
||||||
|
os=-netbsd
|
||||||
|
;;
|
||||||
|
netwinder)
|
||||||
|
basic_machine=armv4l-corel
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
news | news700 | news800 | news900)
|
news | news700 | news800 | news900)
|
||||||
basic_machine=m68k-sony
|
basic_machine=m68k-sony
|
||||||
os=-newsos
|
os=-newsos
|
||||||
|
@ -427,6 +541,10 @@ case $basic_machine in
|
||||||
basic_machine=mips-sony
|
basic_machine=mips-sony
|
||||||
os=-newsos
|
os=-newsos
|
||||||
;;
|
;;
|
||||||
|
necv70)
|
||||||
|
basic_machine=v70-nec
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
next | m*-next )
|
next | m*-next )
|
||||||
basic_machine=m68k-next
|
basic_machine=m68k-next
|
||||||
case $os in
|
case $os in
|
||||||
|
@ -452,9 +570,25 @@ case $basic_machine in
|
||||||
basic_machine=i960-intel
|
basic_machine=i960-intel
|
||||||
os=-nindy
|
os=-nindy
|
||||||
;;
|
;;
|
||||||
|
mon960)
|
||||||
|
basic_machine=i960-intel
|
||||||
|
os=-mon960
|
||||||
|
;;
|
||||||
np1)
|
np1)
|
||||||
basic_machine=np1-gould
|
basic_machine=np1-gould
|
||||||
;;
|
;;
|
||||||
|
op50n-* | op60c-*)
|
||||||
|
basic_machine=hppa1.1-oki
|
||||||
|
os=-proelf
|
||||||
|
;;
|
||||||
|
OSE68000 | ose68000)
|
||||||
|
basic_machine=m68000-ericsson
|
||||||
|
os=-ose
|
||||||
|
;;
|
||||||
|
os68k)
|
||||||
|
basic_machine=m68k-none
|
||||||
|
os=-os68k
|
||||||
|
;;
|
||||||
pa-hitachi)
|
pa-hitachi)
|
||||||
basic_machine=hppa1.1-hitachi
|
basic_machine=hppa1.1-hitachi
|
||||||
os=-hiuxwe2
|
os=-hiuxwe2
|
||||||
|
@ -472,19 +606,19 @@ case $basic_machine in
|
||||||
pc532 | pc532-*)
|
pc532 | pc532-*)
|
||||||
basic_machine=ns32k-pc532
|
basic_machine=ns32k-pc532
|
||||||
;;
|
;;
|
||||||
pentium | p5 | k5 | nexen)
|
pentium | p5 | k5 | k6 | nexen)
|
||||||
basic_machine=i586-pc
|
basic_machine=i586-pc
|
||||||
;;
|
;;
|
||||||
pentiumpro | p6 | k6 | 6x86)
|
pentiumpro | p6 | 6x86)
|
||||||
basic_machine=i686-pc
|
basic_machine=i686-pc
|
||||||
;;
|
;;
|
||||||
pentiumii | pentium2)
|
pentiumii | pentium2)
|
||||||
basic_machine=i786-pc
|
basic_machine=i786-pc
|
||||||
;;
|
;;
|
||||||
pentium-* | p5-* | k5-* | nexen-*)
|
pentium-* | p5-* | k5-* | k6-* | nexen-*)
|
||||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
pentiumpro-* | p6-* | k6-* | 6x86-*)
|
pentiumpro-* | p6-* | 6x86-*)
|
||||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
pentiumii-* | pentium2-*)
|
pentiumii-* | pentium2-*)
|
||||||
|
@ -508,12 +642,20 @@ case $basic_machine in
|
||||||
ps2)
|
ps2)
|
||||||
basic_machine=i386-ibm
|
basic_machine=i386-ibm
|
||||||
;;
|
;;
|
||||||
|
rom68k)
|
||||||
|
basic_machine=m68k-rom68k
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
rm[46]00)
|
rm[46]00)
|
||||||
basic_machine=mips-siemens
|
basic_machine=mips-siemens
|
||||||
;;
|
;;
|
||||||
rtpc | rtpc-*)
|
rtpc | rtpc-*)
|
||||||
basic_machine=romp-ibm
|
basic_machine=romp-ibm
|
||||||
;;
|
;;
|
||||||
|
sa29200)
|
||||||
|
basic_machine=a29k-amd
|
||||||
|
os=-udi
|
||||||
|
;;
|
||||||
sequent)
|
sequent)
|
||||||
basic_machine=i386-sequent
|
basic_machine=i386-sequent
|
||||||
;;
|
;;
|
||||||
|
@ -521,6 +663,10 @@ case $basic_machine in
|
||||||
basic_machine=sh-hitachi
|
basic_machine=sh-hitachi
|
||||||
os=-hms
|
os=-hms
|
||||||
;;
|
;;
|
||||||
|
sparclite-wrs)
|
||||||
|
basic_machine=sparclite-wrs
|
||||||
|
os=-vxworks
|
||||||
|
;;
|
||||||
sps7)
|
sps7)
|
||||||
basic_machine=m68k-bull
|
basic_machine=m68k-bull
|
||||||
os=-sysv2
|
os=-sysv2
|
||||||
|
@ -528,6 +674,13 @@ case $basic_machine in
|
||||||
spur)
|
spur)
|
||||||
basic_machine=spur-unknown
|
basic_machine=spur-unknown
|
||||||
;;
|
;;
|
||||||
|
st2000)
|
||||||
|
basic_machine=m68k-tandem
|
||||||
|
;;
|
||||||
|
stratus)
|
||||||
|
basic_machine=i860-stratus
|
||||||
|
os=-sysv4
|
||||||
|
;;
|
||||||
sun2)
|
sun2)
|
||||||
basic_machine=m68000-sun
|
basic_machine=m68000-sun
|
||||||
;;
|
;;
|
||||||
|
@ -572,6 +725,10 @@ case $basic_machine in
|
||||||
basic_machine=i386-sequent
|
basic_machine=i386-sequent
|
||||||
os=-dynix
|
os=-dynix
|
||||||
;;
|
;;
|
||||||
|
t3e)
|
||||||
|
basic_machine=t3e-cray
|
||||||
|
os=-unicos
|
||||||
|
;;
|
||||||
tx39)
|
tx39)
|
||||||
basic_machine=mipstx39-unknown
|
basic_machine=mipstx39-unknown
|
||||||
;;
|
;;
|
||||||
|
@ -589,6 +746,10 @@ case $basic_machine in
|
||||||
basic_machine=a29k-nyu
|
basic_machine=a29k-nyu
|
||||||
os=-sym1
|
os=-sym1
|
||||||
;;
|
;;
|
||||||
|
v810 | necv810)
|
||||||
|
basic_machine=v810-nec
|
||||||
|
os=-none
|
||||||
|
;;
|
||||||
vaxv)
|
vaxv)
|
||||||
basic_machine=vax-dec
|
basic_machine=vax-dec
|
||||||
os=-sysv
|
os=-sysv
|
||||||
|
@ -612,6 +773,14 @@ case $basic_machine in
|
||||||
basic_machine=a29k-wrs
|
basic_machine=a29k-wrs
|
||||||
os=-vxworks
|
os=-vxworks
|
||||||
;;
|
;;
|
||||||
|
w65*)
|
||||||
|
basic_machine=w65-wdc
|
||||||
|
os=-none
|
||||||
|
;;
|
||||||
|
w89k-*)
|
||||||
|
basic_machine=hppa1.1-winbond
|
||||||
|
os=-proelf
|
||||||
|
;;
|
||||||
xmp)
|
xmp)
|
||||||
basic_machine=xmp-cray
|
basic_machine=xmp-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
|
@ -619,6 +788,10 @@ case $basic_machine in
|
||||||
xps | xps100)
|
xps | xps100)
|
||||||
basic_machine=xps100-honeywell
|
basic_machine=xps100-honeywell
|
||||||
;;
|
;;
|
||||||
|
z8k-*-coff)
|
||||||
|
basic_machine=z8k-unknown
|
||||||
|
os=-sim
|
||||||
|
;;
|
||||||
none)
|
none)
|
||||||
basic_machine=none-none
|
basic_machine=none-none
|
||||||
os=-none
|
os=-none
|
||||||
|
@ -626,6 +799,15 @@ case $basic_machine in
|
||||||
|
|
||||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||||
# some cases the only manufacturer, in others, it is the most popular.
|
# some cases the only manufacturer, in others, it is the most popular.
|
||||||
|
w89k)
|
||||||
|
basic_machine=hppa1.1-winbond
|
||||||
|
;;
|
||||||
|
op50n)
|
||||||
|
basic_machine=hppa1.1-oki
|
||||||
|
;;
|
||||||
|
op60c)
|
||||||
|
basic_machine=hppa1.1-oki
|
||||||
|
;;
|
||||||
mips)
|
mips)
|
||||||
if [ x$os = x-linux ]; then
|
if [ x$os = x-linux ]; then
|
||||||
basic_machine=mips-unknown
|
basic_machine=mips-unknown
|
||||||
|
@ -648,7 +830,7 @@ case $basic_machine in
|
||||||
we32k)
|
we32k)
|
||||||
basic_machine=we32k-att
|
basic_machine=we32k-att
|
||||||
;;
|
;;
|
||||||
sparc)
|
sparc | sparcv9)
|
||||||
basic_machine=sparc-sun
|
basic_machine=sparc-sun
|
||||||
;;
|
;;
|
||||||
cydra)
|
cydra)
|
||||||
|
@ -660,6 +842,16 @@ case $basic_machine in
|
||||||
orion105)
|
orion105)
|
||||||
basic_machine=clipper-highlevel
|
basic_machine=clipper-highlevel
|
||||||
;;
|
;;
|
||||||
|
mac | mpw | mac-mpw)
|
||||||
|
basic_machine=m68k-apple
|
||||||
|
;;
|
||||||
|
pmac | pmac-mpw)
|
||||||
|
basic_machine=powerpc-apple
|
||||||
|
;;
|
||||||
|
c4x*)
|
||||||
|
basic_machine=c4x-none
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -674,10 +866,6 @@ case $basic_machine in
|
||||||
*-commodore*)
|
*-commodore*)
|
||||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||||
;;
|
;;
|
||||||
human)
|
|
||||||
basic_machine=m68k-sharp
|
|
||||||
os=-human
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -705,8 +893,6 @@ case $os in
|
||||||
-gnu/linux*)
|
-gnu/linux*)
|
||||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||||
;;
|
;;
|
||||||
-os2_emx)
|
|
||||||
;;
|
|
||||||
# First accept the basic system types.
|
# First accept the basic system types.
|
||||||
# The portable systems comes first.
|
# The portable systems comes first.
|
||||||
# Each alternative MUST END IN A *, to match a version number.
|
# Each alternative MUST END IN A *, to match a version number.
|
||||||
|
@ -719,13 +905,21 @@ case $os in
|
||||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -linux* | -uxpv* | -beos* | -rhapsody* )
|
| -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||||
|
| -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
|
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||||
|
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||||
|
| -macos* | -mpw* | -magic* | -mon960* | -lnews*)
|
||||||
|
;;
|
||||||
|
-mac*)
|
||||||
|
os=`echo $os | sed -e 's|mac|macos|'`
|
||||||
|
;;
|
||||||
-sunos5*)
|
-sunos5*)
|
||||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||||
;;
|
;;
|
||||||
|
@ -747,6 +941,9 @@ case $os in
|
||||||
-acis*)
|
-acis*)
|
||||||
os=-aos
|
os=-aos
|
||||||
;;
|
;;
|
||||||
|
-386bsd)
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
-ctix* | -uts*)
|
-ctix* | -uts*)
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
@ -778,9 +975,18 @@ case $os in
|
||||||
# This must come after -sysvr4.
|
# This must come after -sysvr4.
|
||||||
-sysv*)
|
-sysv*)
|
||||||
;;
|
;;
|
||||||
|
-ose*)
|
||||||
|
os=-ose
|
||||||
|
;;
|
||||||
|
-es1800*)
|
||||||
|
os=-ose
|
||||||
|
;;
|
||||||
-xenix)
|
-xenix)
|
||||||
os=-xenix
|
os=-xenix
|
||||||
;;
|
;;
|
||||||
|
-*mint | -*MiNT)
|
||||||
|
os=-mint
|
||||||
|
;;
|
||||||
-uxpds)
|
-uxpds)
|
||||||
os=-uxpds
|
os=-uxpds
|
||||||
;;
|
;;
|
||||||
|
@ -814,6 +1020,9 @@ case $basic_machine in
|
||||||
*-acorn)
|
*-acorn)
|
||||||
os=-riscix1.2
|
os=-riscix1.2
|
||||||
;;
|
;;
|
||||||
|
arm*-corel)
|
||||||
|
os=-linux
|
||||||
|
;;
|
||||||
arm*-semi)
|
arm*-semi)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
|
@ -835,6 +1044,15 @@ case $basic_machine in
|
||||||
# default.
|
# default.
|
||||||
# os=-sunos4
|
# os=-sunos4
|
||||||
;;
|
;;
|
||||||
|
m68*-cisco)
|
||||||
|
os=-aout
|
||||||
|
;;
|
||||||
|
mips*-cisco)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
|
mips*-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
*-tti) # must be before sparc entry or we get the wrong os.
|
*-tti) # must be before sparc entry or we get the wrong os.
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
|
@ -847,6 +1065,15 @@ case $basic_machine in
|
||||||
*-ibm)
|
*-ibm)
|
||||||
os=-aix
|
os=-aix
|
||||||
;;
|
;;
|
||||||
|
*-wec)
|
||||||
|
os=-proelf
|
||||||
|
;;
|
||||||
|
*-winbond)
|
||||||
|
os=-proelf
|
||||||
|
;;
|
||||||
|
*-oki)
|
||||||
|
os=-proelf
|
||||||
|
;;
|
||||||
*-hp)
|
*-hp)
|
||||||
os=-hpux
|
os=-hpux
|
||||||
;;
|
;;
|
||||||
|
@ -910,6 +1137,18 @@ case $basic_machine in
|
||||||
f301-fujitsu)
|
f301-fujitsu)
|
||||||
os=-uxpv
|
os=-uxpv
|
||||||
;;
|
;;
|
||||||
|
*-rom68k)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
*-*bug)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
*-apple)
|
||||||
|
os=-macos
|
||||||
|
;;
|
||||||
|
*-atari*)
|
||||||
|
os=-mint
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
os=-none
|
os=-none
|
||||||
;;
|
;;
|
||||||
|
@ -931,9 +1170,15 @@ case $basic_machine in
|
||||||
-aix*)
|
-aix*)
|
||||||
vendor=ibm
|
vendor=ibm
|
||||||
;;
|
;;
|
||||||
|
-beos*)
|
||||||
|
vendor=be
|
||||||
|
;;
|
||||||
-hpux*)
|
-hpux*)
|
||||||
vendor=hp
|
vendor=hp
|
||||||
;;
|
;;
|
||||||
|
-mpeix*)
|
||||||
|
vendor=hp
|
||||||
|
;;
|
||||||
-hiux*)
|
-hiux*)
|
||||||
vendor=hitachi
|
vendor=hitachi
|
||||||
;;
|
;;
|
||||||
|
@ -961,6 +1206,15 @@ case $basic_machine in
|
||||||
-aux*)
|
-aux*)
|
||||||
vendor=apple
|
vendor=apple
|
||||||
;;
|
;;
|
||||||
|
-hms*)
|
||||||
|
vendor=hitachi
|
||||||
|
;;
|
||||||
|
-mpw* | -macos*)
|
||||||
|
vendor=apple
|
||||||
|
;;
|
||||||
|
-*mint | -*MiNT)
|
||||||
|
vendor=atari
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||||
;;
|
;;
|
||||||
|
|
10
configure.in
10
configure.in
|
@ -158,6 +158,9 @@ rhapsody*) ;;
|
||||||
human*) ac_cv_func_getpgrp_void=yes;;
|
human*) ac_cv_func_getpgrp_void=yes;;
|
||||||
beos*) ;;
|
beos*) ;;
|
||||||
cygwin*) ;;
|
cygwin*) ;;
|
||||||
|
os2_emx*) LIBS="-lm $LIBS"
|
||||||
|
ac_cv_lib_xpg4_setlocale=no
|
||||||
|
ac_cv_lib_dir_opendir=no;;
|
||||||
*) LIBS="-lm $LIBS";;
|
*) LIBS="-lm $LIBS";;
|
||||||
esac
|
esac
|
||||||
AC_CHECK_LIB(crypt, crypt)
|
AC_CHECK_LIB(crypt, crypt)
|
||||||
|
@ -487,6 +490,7 @@ if test "$with_dln_a_out" != yes; then
|
||||||
aix*) LDSHARED='/usr/ccs/bin/ld'
|
aix*) LDSHARED='/usr/ccs/bin/ld'
|
||||||
XLDFLAGS='-Wl,-bE:ruby.imp'
|
XLDFLAGS='-Wl,-bE:ruby.imp'
|
||||||
DLDFLAGS='-eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
|
DLDFLAGS='-eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc'
|
||||||
|
LDFLAGS="-brtl"
|
||||||
rb_cv_dlopen=yes ;;
|
rb_cv_dlopen=yes ;;
|
||||||
|
|
||||||
human*) DLDFLAGS=''
|
human*) DLDFLAGS=''
|
||||||
|
@ -553,8 +557,8 @@ else
|
||||||
AC_DEFINE(DLEXT, ".bundle");;
|
AC_DEFINE(DLEXT, ".bundle");;
|
||||||
cygwin*) DLEXT=dll
|
cygwin*) DLEXT=dll
|
||||||
AC_DEFINE(DLEXT, ".dll");;
|
AC_DEFINE(DLEXT, ".dll");;
|
||||||
os2_emx) DLEXT=o
|
os2_emx*) DLEXT=dll
|
||||||
AC_DEFINE(DLEXT, ".so");;
|
AC_DEFINE(DLEXT, ".dll");;
|
||||||
*) DLEXT=so
|
*) DLEXT=so
|
||||||
AC_DEFINE(DLEXT, ".so");;
|
AC_DEFINE(DLEXT, ".so");;
|
||||||
esac
|
esac
|
||||||
|
@ -638,7 +642,7 @@ rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no
|
||||||
;;
|
;;
|
||||||
dnl OS/2 environment w/ Autoconf 2.1x for EMX
|
dnl OS/2 environment w/ Autoconf 2.1x for EMX
|
||||||
os2_emx)
|
os2_emx)
|
||||||
LIBOBJS="$LIBOBJS os2.o"
|
LIBOBJS="$LIBOBJS os2.$OBJEXT"
|
||||||
setup=Setup.emx
|
setup=Setup.emx
|
||||||
;;
|
;;
|
||||||
cygwin*)
|
cygwin*)
|
||||||
|
|
16
eval.c
16
eval.c
|
@ -7266,21 +7266,21 @@ rb_thread_scope_shared_p()
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_yield(arg, th)
|
rb_thread_yield(arg, th)
|
||||||
int arg;
|
VALUE arg;
|
||||||
thread_t th;
|
thread_t th;
|
||||||
{
|
{
|
||||||
scope_dup(ruby_block->scope);
|
scope_dup(ruby_block->scope);
|
||||||
return rb_yield_0(th->thread, 0, 0, Qfalse);
|
return rb_yield_0(arg, 0, 0, Qfalse);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_start(klass)
|
rb_thread_start(klass, args)
|
||||||
VALUE klass;
|
VALUE klass, args;
|
||||||
{
|
{
|
||||||
if (!rb_iterator_p()) {
|
if (!rb_iterator_p()) {
|
||||||
rb_raise(rb_eThreadError, "must be called as iterator");
|
rb_raise(rb_eThreadError, "must be called as iterator");
|
||||||
}
|
}
|
||||||
return rb_thread_create_0(rb_thread_yield, 0, klass);
|
return rb_thread_create_0(rb_thread_yield, args, klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -7708,9 +7708,9 @@ Init_Thread()
|
||||||
rb_eThreadError = rb_define_class("ThreadError", rb_eStandardError);
|
rb_eThreadError = rb_define_class("ThreadError", rb_eStandardError);
|
||||||
rb_cThread = rb_define_class("Thread", rb_cObject);
|
rb_cThread = rb_define_class("Thread", rb_cObject);
|
||||||
|
|
||||||
rb_define_singleton_method(rb_cThread, "new", rb_thread_start, 0);
|
rb_define_singleton_method(rb_cThread, "new", rb_thread_start, -2);
|
||||||
rb_define_singleton_method(rb_cThread, "start", rb_thread_start, 0);
|
rb_define_singleton_method(rb_cThread, "start", rb_thread_start, -2);
|
||||||
rb_define_singleton_method(rb_cThread, "fork", rb_thread_start, 0);
|
rb_define_singleton_method(rb_cThread, "fork", rb_thread_start, -2);
|
||||||
|
|
||||||
rb_define_singleton_method(rb_cThread, "stop", rb_thread_stop, 0);
|
rb_define_singleton_method(rb_cThread, "stop", rb_thread_stop, 0);
|
||||||
rb_define_singleton_method(rb_cThread, "kill", rb_thread_s_kill, 1);
|
rb_define_singleton_method(rb_cThread, "kill", rb_thread_s_kill, 1);
|
||||||
|
|
|
@ -464,6 +464,7 @@ $(DLLIB): $(OBJS)
|
||||||
dfile = open("#{$srcdir}/depend", "r")
|
dfile = open("#{$srcdir}/depend", "r")
|
||||||
mfile.printf "###\n"
|
mfile.printf "###\n"
|
||||||
while line = dfile.gets()
|
while line = dfile.gets()
|
||||||
|
line.gsub!(/\.o/, ".#{$OBJEXT}")
|
||||||
mfile.printf "%s", line.gsub('\$\(hdrdir\)/config.h', '$(topdir)/config.h')
|
mfile.printf "%s", line.gsub('\$\(hdrdir\)/config.h', '$(topdir)/config.h')
|
||||||
end
|
end
|
||||||
dfile.close
|
dfile.close
|
||||||
|
@ -500,7 +501,7 @@ def extmake(target)
|
||||||
$objs = nil
|
$objs = nil
|
||||||
$local_flags = ""
|
$local_flags = ""
|
||||||
case RUBY_PLATFORM
|
case RUBY_PLATFORM
|
||||||
when /cygwin|beos|openstep|nextstep|rhapsody/
|
when /cygwin|beos|openstep|nextstep|rhapsody|i386-os2_emx/
|
||||||
$libs = ""
|
$libs = ""
|
||||||
when /mswin32/
|
when /mswin32/
|
||||||
$LIBEXT = "lib"
|
$LIBEXT = "lib"
|
||||||
|
|
|
@ -282,7 +282,9 @@ establishShell(shellname, info)
|
||||||
dup2(slave,2);
|
dup2(slave,2);
|
||||||
close(slave);
|
close(slave);
|
||||||
|
|
||||||
|
#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID) || defined(HAVE_SETRESUID)
|
||||||
seteuid(getuid());
|
seteuid(getuid());
|
||||||
|
#endif
|
||||||
|
|
||||||
argc = 0;
|
argc = 0;
|
||||||
for (i = 0; shellname[i];) {
|
for (i = 0; shellname[i];) {
|
||||||
|
|
|
@ -2,8 +2,9 @@ require "mkmf"
|
||||||
|
|
||||||
dir_config("readline")
|
dir_config("readline")
|
||||||
have_library("user32", nil) if /cygwin/ === PLATFORM
|
have_library("user32", nil) if /cygwin/ === PLATFORM
|
||||||
have_library("termcap", "tgetnum")
|
have_library("termcap", "tgetnum") or
|
||||||
have_library("curses", "tgetnum")
|
have_library("curses", "tgetnum") or
|
||||||
|
have_library("ncurses", "tgetnum")
|
||||||
if have_header("readline/readline.h") and
|
if have_header("readline/readline.h") and
|
||||||
have_header("readline/history.h") and
|
have_header("readline/history.h") and
|
||||||
have_library("readline", "readline")
|
have_library("readline", "readline")
|
||||||
|
|
|
@ -130,12 +130,6 @@ static struct afd {
|
||||||
#define PTON_MAX 4
|
#define PTON_MAX 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef INET6
|
|
||||||
#ifndef NT
|
|
||||||
extern int h_errno;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int get_name __P((const char *, struct afd *,
|
static int get_name __P((const char *, struct afd *,
|
||||||
struct addrinfo **, char *, struct addrinfo *,
|
struct addrinfo **, char *, struct addrinfo *,
|
||||||
int));
|
int));
|
||||||
|
|
|
@ -64,12 +64,6 @@
|
||||||
#include "addrinfo.h"
|
#include "addrinfo.h"
|
||||||
#include "sockport.h"
|
#include "sockport.h"
|
||||||
|
|
||||||
#ifndef INET6
|
|
||||||
#ifndef NT
|
|
||||||
extern int h_errno;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SUCCESS 0
|
#define SUCCESS 0
|
||||||
#define ANY 0
|
#define ANY 0
|
||||||
#define YES 1
|
#define YES 1
|
||||||
|
|
|
@ -399,8 +399,8 @@ s_recv(sock, argc, argv, from)
|
||||||
str = rb_str_new(0, NUM2INT(len));
|
str = rb_str_new(0, NUM2INT(len));
|
||||||
|
|
||||||
rb_thread_wait_fd(fd);
|
rb_thread_wait_fd(fd);
|
||||||
TRAP_BEG;
|
|
||||||
retry:
|
retry:
|
||||||
|
TRAP_BEG;
|
||||||
RSTRING(str)->len = recvfrom(fd, RSTRING(str)->ptr, RSTRING(str)->len, flags,
|
RSTRING(str)->len = recvfrom(fd, RSTRING(str)->ptr, RSTRING(str)->len, flags,
|
||||||
(struct sockaddr*)buf, &alen);
|
(struct sockaddr*)buf, &alen);
|
||||||
TRAP_END;
|
TRAP_END;
|
||||||
|
|
44
gc.c
44
gc.c
|
@ -50,7 +50,6 @@ static unsigned long malloc_memories = 0;
|
||||||
static unsigned long alloc_objects = 0;
|
static unsigned long alloc_objects = 0;
|
||||||
|
|
||||||
static int malloc_called = 0;
|
static int malloc_called = 0;
|
||||||
static int free_called = 0;
|
|
||||||
static int second_mem_error = 0;
|
static int second_mem_error = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -133,12 +132,11 @@ xrealloc(ptr, size)
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
xfree(x)
|
xfree(x)
|
||||||
void *x;
|
void *x;
|
||||||
{
|
{
|
||||||
free_called++;
|
if (x) free(x);
|
||||||
free(x);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -203,17 +201,47 @@ static struct gc_list {
|
||||||
} *Global_List = 0;
|
} *Global_List = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_global_variable(var)
|
rb_gc_register_address(addr)
|
||||||
VALUE *var;
|
VALUE *addr;
|
||||||
{
|
{
|
||||||
struct gc_list *tmp;
|
struct gc_list *tmp;
|
||||||
|
|
||||||
tmp = ALLOC(struct gc_list);
|
tmp = ALLOC(struct gc_list);
|
||||||
tmp->next = Global_List;
|
tmp->next = Global_List;
|
||||||
tmp->varptr = var;
|
tmp->varptr = addr;
|
||||||
Global_List = tmp;
|
Global_List = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rb_gc_unregister_address(addr)
|
||||||
|
VALUE *addr;
|
||||||
|
{
|
||||||
|
struct gc_list *tmp = Global_List;
|
||||||
|
|
||||||
|
if (tmp->varptr == addr) {
|
||||||
|
Global_List = tmp->next;
|
||||||
|
free(tmp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while (tmp->next) {
|
||||||
|
if (tmp->next->varptr == addr) {
|
||||||
|
struct gc_list *t = tmp->next;
|
||||||
|
|
||||||
|
tmp->next = tmp->next->next;
|
||||||
|
free(t);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rb_global_variable(var)
|
||||||
|
VALUE *var;
|
||||||
|
{
|
||||||
|
rb_gc_register_address(var);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct RVALUE {
|
typedef struct RVALUE {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
|
@ -1219,6 +1247,8 @@ Init_GC()
|
||||||
rb_define_module_function(rb_mObSpace, "call_finalizer", call_final, 1);
|
rb_define_module_function(rb_mObSpace, "call_finalizer", call_final, 1);
|
||||||
rb_define_module_function(rb_mObSpace, "_id2ref", id2ref, 1);
|
rb_define_module_function(rb_mObSpace, "_id2ref", id2ref, 1);
|
||||||
|
|
||||||
|
rb_gc_register_address(&rb_mObSpace);
|
||||||
rb_global_variable(&finalizers);
|
rb_global_variable(&finalizers);
|
||||||
|
rb_gc_unregister_address(&rb_mObSpace);
|
||||||
finalizers = rb_ary_new();
|
finalizers = rb_ary_new();
|
||||||
}
|
}
|
||||||
|
|
18
hash.c
18
hash.c
|
@ -476,6 +476,13 @@ rb_hash_delete_if(hash)
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
rb_hash_reject(hash)
|
||||||
|
VALUE hash;
|
||||||
|
{
|
||||||
|
return rb_hash_delete_if(rb_hash_dup(hash));
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
clear_i(key, value, dummy)
|
clear_i(key, value, dummy)
|
||||||
VALUE key, value, dummy;
|
VALUE key, value, dummy;
|
||||||
|
@ -1210,6 +1217,12 @@ env_delete_if()
|
||||||
return envtbl;
|
return envtbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
env_reject()
|
||||||
|
{
|
||||||
|
return rb_hash_delete_if(env_to_hash());
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
env_to_s()
|
env_to_s()
|
||||||
{
|
{
|
||||||
|
@ -1331,8 +1344,7 @@ env_indexes(argc, argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
env_to_hash(obj)
|
env_to_hash()
|
||||||
VALUE obj;
|
|
||||||
{
|
{
|
||||||
char **env;
|
char **env;
|
||||||
VALUE hash = rb_hash_new();
|
VALUE hash = rb_hash_new();
|
||||||
|
@ -1397,6 +1409,7 @@ Init_Hash()
|
||||||
rb_define_method(rb_cHash,"delete", rb_hash_delete, 1);
|
rb_define_method(rb_cHash,"delete", rb_hash_delete, 1);
|
||||||
rb_define_method(rb_cHash,"delete_if", rb_hash_delete_if, 0);
|
rb_define_method(rb_cHash,"delete_if", rb_hash_delete_if, 0);
|
||||||
rb_define_method(rb_cHash,"reject!", rb_hash_delete_if, 0);
|
rb_define_method(rb_cHash,"reject!", rb_hash_delete_if, 0);
|
||||||
|
rb_define_method(rb_cHash,"reject", rb_hash_reject, 0);
|
||||||
rb_define_method(rb_cHash,"clear", rb_hash_clear, 0);
|
rb_define_method(rb_cHash,"clear", rb_hash_clear, 0);
|
||||||
rb_define_method(rb_cHash,"invert", rb_hash_invert, 0);
|
rb_define_method(rb_cHash,"invert", rb_hash_invert, 0);
|
||||||
rb_define_method(rb_cHash,"update", rb_hash_update, 1);
|
rb_define_method(rb_cHash,"update", rb_hash_update, 1);
|
||||||
|
@ -1423,6 +1436,7 @@ Init_Hash()
|
||||||
rb_define_singleton_method(envtbl,"delete", env_delete_m, 1);
|
rb_define_singleton_method(envtbl,"delete", env_delete_m, 1);
|
||||||
rb_define_singleton_method(envtbl,"delete_if", env_delete_if, 0);
|
rb_define_singleton_method(envtbl,"delete_if", env_delete_if, 0);
|
||||||
rb_define_singleton_method(envtbl,"reject!", env_delete_if, 0);
|
rb_define_singleton_method(envtbl,"reject!", env_delete_if, 0);
|
||||||
|
rb_define_singleton_method(envtbl,"reject", env_reject, 0);
|
||||||
rb_define_singleton_method(envtbl,"to_s", env_to_s, 0);
|
rb_define_singleton_method(envtbl,"to_s", env_to_s, 0);
|
||||||
rb_define_singleton_method(envtbl,"rehash", env_none, 0);
|
rb_define_singleton_method(envtbl,"rehash", env_none, 0);
|
||||||
rb_define_singleton_method(envtbl,"to_a", env_to_a, 0);
|
rb_define_singleton_method(envtbl,"to_a", env_to_a, 0);
|
||||||
|
|
5
intern.h
5
intern.h
|
@ -154,7 +154,6 @@ VALUE rb_file_s_expand_path _((int, VALUE *));
|
||||||
void rb_file_const _((const char*, VALUE));
|
void rb_file_const _((const char*, VALUE));
|
||||||
char *rb_find_file _((char*));
|
char *rb_find_file _((char*));
|
||||||
/* gc.c */
|
/* gc.c */
|
||||||
void rb_global_variable _((VALUE*));
|
|
||||||
void rb_gc_mark_locations _((VALUE*, VALUE*));
|
void rb_gc_mark_locations _((VALUE*, VALUE*));
|
||||||
void rb_mark_tbl _((struct st_table*));
|
void rb_mark_tbl _((struct st_table*));
|
||||||
void rb_mark_hash _((struct st_table*));
|
void rb_mark_hash _((struct st_table*));
|
||||||
|
@ -248,10 +247,8 @@ VALUE rb_reg_new _((const char*, long, int));
|
||||||
VALUE rb_reg_match _((VALUE, VALUE));
|
VALUE rb_reg_match _((VALUE, VALUE));
|
||||||
VALUE rb_reg_match2 _((VALUE));
|
VALUE rb_reg_match2 _((VALUE));
|
||||||
int rb_reg_options _((VALUE));
|
int rb_reg_options _((VALUE));
|
||||||
const char* rb_get_kcode _((void));
|
|
||||||
void rb_set_kcode _((const char*));
|
void rb_set_kcode _((const char*));
|
||||||
int rb_ignorecase_p _((void));
|
const char* rb_get_kcode _((void));
|
||||||
void rb_match_busy _((VALUE, int));
|
|
||||||
/* ruby.c */
|
/* ruby.c */
|
||||||
EXTERN VALUE rb_argv;
|
EXTERN VALUE rb_argv;
|
||||||
EXTERN VALUE rb_argv0;
|
EXTERN VALUE rb_argv0;
|
||||||
|
|
4
io.c
4
io.c
|
@ -963,7 +963,7 @@ rb_io_close(io)
|
||||||
{
|
{
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
|
|
||||||
GetOpenFile(io, fptr);
|
fptr = RFILE(io)->fptr;
|
||||||
rb_io_fptr_close(fptr);
|
rb_io_fptr_close(fptr);
|
||||||
if (fptr->pid) {
|
if (fptr->pid) {
|
||||||
rb_syswait(fptr->pid);
|
rb_syswait(fptr->pid);
|
||||||
|
@ -2393,7 +2393,7 @@ rb_f_gets_internal(argc, argv)
|
||||||
if (TYPE(current_file) != T_FILE) {
|
if (TYPE(current_file) != T_FILE) {
|
||||||
line = rb_funcall3(current_file, rb_intern("gets"), argc, argv);
|
line = rb_funcall3(current_file, rb_intern("gets"), argc, argv);
|
||||||
}
|
}
|
||||||
if (argc == 0 && rb_rs == rb_default_rs) {
|
else if (argc == 0 && rb_rs == rb_default_rs) {
|
||||||
line = rb_io_gets(current_file);
|
line = rb_io_gets(current_file);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -97,7 +97,7 @@ class DEBUGGER__
|
||||||
begin
|
begin
|
||||||
val = eval(str, binding)
|
val = eval(str, binding)
|
||||||
val
|
val
|
||||||
rescue
|
rescue StandardError, ScriptError
|
||||||
at = eval("caller(0)", binding)
|
at = eval("caller(0)", binding)
|
||||||
stdout.printf "%s:%s\n", at.shift, $!.to_s.sub(/\(eval\):1:(in `.*?':)?/, '') #`
|
stdout.printf "%s:%s\n", at.shift, $!.to_s.sub(/\(eval\):1:(in `.*?':)?/, '') #`
|
||||||
for i in at
|
for i in at
|
||||||
|
|
|
@ -161,7 +161,7 @@ class String
|
||||||
def tr_s!(from, to)
|
def tr_s!(from, to)
|
||||||
return self.delete!(from) if to.length == 0
|
return self.delete!(from) if to.length == 0
|
||||||
|
|
||||||
pattern = SqueezePatternCache[from] ||= /([#{bsquote(from)}])\1+"/
|
pattern = SqueezePatternCache[from] ||= /([#{bsquote(from)}])\1+"/ #"
|
||||||
if from[0] == ?^
|
if from[0] == ?^
|
||||||
last = /.$/.match(to)[0]
|
last = /.$/.match(to)[0]
|
||||||
self.gsub!(pattern, last)
|
self.gsub!(pattern, last)
|
||||||
|
|
|
@ -2,43 +2,46 @@
|
||||||
# original is shellwords.pl
|
# original is shellwords.pl
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# require 'shellwords.rb'
|
# require 'shellwords'
|
||||||
# words = Shellwords.shellwords(line)
|
# words = Shellwords.shellwords(line)
|
||||||
#
|
#
|
||||||
# or
|
# or
|
||||||
#
|
#
|
||||||
|
# require 'shellwords'
|
||||||
# include Shellwords
|
# include Shellwords
|
||||||
# words = shellwords(line)
|
# words = shellwords(line)
|
||||||
|
|
||||||
module Shellwords
|
module Shellwords
|
||||||
def shellwords(line)
|
def shellwords(line)
|
||||||
return '' unless line
|
unless line.kind_of?(String)
|
||||||
line.sub! /^\s+/, ''
|
raise ArgumentError, "Argument must be String class object."
|
||||||
|
end
|
||||||
|
line.sub!(/^\s+/, '')
|
||||||
words = []
|
words = []
|
||||||
while line != ''
|
while line != ''
|
||||||
field = ''
|
field = ''
|
||||||
while true
|
while true
|
||||||
if line.sub! /^"(([^"\\]|\\.)*)"/, '' then #"
|
if line.sub!(/^"(([^"\\]|\\.)*)"/, '') then #"
|
||||||
snippet = $1
|
snippet = $1
|
||||||
snippet.gsub! /\\(.)/, '\1'
|
snippet.gsub!(/\\(.)/, '\1')
|
||||||
elsif line =~ /^"/ then #"
|
elsif line =~ /^"/ then #"
|
||||||
raise ArgError, "Unmatched double quote: #{line}"
|
raise ArgumentError, "Unmatched double quote: #{line}"
|
||||||
elsif line.sub! /^'(([^'\\]|\\.)*)'/, '' then #'
|
elsif line.sub!(/^'(([^'\\]|\\.)*)'/, '') then #'
|
||||||
snippet = $1
|
snippet = $1
|
||||||
snippet.gsub! /\\(.)/, '\1'
|
snippet.gsub!(/\\(.)/, '\1')
|
||||||
elsif line =~ /^'/ then #'
|
elsif line =~ /^'/ then #'
|
||||||
raise ArgError, "Unmatched single quote: #{line}"
|
raise ArgumentError, "Unmatched single quote: #{line}"
|
||||||
elsif line.sub! /^\\(.)/, '' then
|
elsif line.sub!(/^\\(.)/, '') then
|
||||||
snippet = $1
|
snippet = $1
|
||||||
elsif line.sub! /^([^\s\\'"]+)/, '' then #'
|
elsif line.sub!(/^([^\s\\'"]+)/, '') then #'
|
||||||
snippet = $1
|
snippet = $1
|
||||||
else
|
else
|
||||||
line.sub! /^\s+/, ''
|
line.sub!(/^\s+/, '')
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
field += snippet
|
field.concat(snippet)
|
||||||
end
|
end
|
||||||
words += field
|
words.push(field)
|
||||||
end
|
end
|
||||||
words
|
words
|
||||||
end
|
end
|
||||||
|
|
233
lib/telnet.rb
233
lib/telnet.rb
|
@ -1,11 +1,11 @@
|
||||||
=begin
|
=begin
|
||||||
$Date: 1999/10/04 22:51:26 $
|
$Date: 2000/01/24 17:02:57 $
|
||||||
|
|
||||||
== SIMPLE TELNET CLIANT LIBRARY
|
== SIMPLE TELNET CLIENT LIBRARY
|
||||||
|
|
||||||
telnet.rb
|
telnet.rb
|
||||||
|
|
||||||
Version 1.00
|
Version 1.20
|
||||||
|
|
||||||
Wakou Aoyama <wakou@fsinet.or.jp>
|
Wakou Aoyama <wakou@fsinet.or.jp>
|
||||||
|
|
||||||
|
@ -155,6 +155,22 @@ of cource, set sync=true or flush is necessary.
|
||||||
|
|
||||||
== HISTORY
|
== HISTORY
|
||||||
|
|
||||||
|
=== Version 1.20
|
||||||
|
|
||||||
|
2000/01/24 17:02:57
|
||||||
|
|
||||||
|
- respond to "IAC WILL x" with "IAC DONT x"
|
||||||
|
- respond to "IAC WONT x" with "IAC DONT x"
|
||||||
|
- better dumplog format
|
||||||
|
thanks to WATANABE Hirofumi <Hirofumi.Watanabe@jp.sony.com>
|
||||||
|
|
||||||
|
=== Version 1.10
|
||||||
|
|
||||||
|
2000/01/18 17:47:31
|
||||||
|
|
||||||
|
- bug fix: write method
|
||||||
|
- respond to "IAC WILL BINARY" with "IAC DO BINARY"
|
||||||
|
|
||||||
=== Version 1.00
|
=== Version 1.00
|
||||||
|
|
||||||
1999/10/04 22:51:26
|
1999/10/04 22:51:26
|
||||||
|
@ -338,74 +354,73 @@ if ommit password, then not require password prompt.
|
||||||
|
|
||||||
require "socket"
|
require "socket"
|
||||||
require "delegate"
|
require "delegate"
|
||||||
require "thread"
|
|
||||||
require "timeout"
|
require "timeout"
|
||||||
|
|
||||||
class Telnet < SimpleDelegator
|
class Telnet < SimpleDelegator
|
||||||
|
|
||||||
IAC = 255.chr # "\377" # interpret as command:
|
IAC = 255.chr # "\377" # "\xff" # interpret as command:
|
||||||
DONT = 254.chr # "\376" # you are not to use option
|
DONT = 254.chr # "\376" # "\xfe" # you are not to use option
|
||||||
DO = 253.chr # "\375" # please, you use option
|
DO = 253.chr # "\375" # "\xfd" # please, you use option
|
||||||
WONT = 252.chr # "\374" # I won't use option
|
WONT = 252.chr # "\374" # "\xfc" # I won't use option
|
||||||
WILL = 251.chr # "\373" # I will use option
|
WILL = 251.chr # "\373" # "\xfb" # I will use option
|
||||||
SB = 250.chr # "\372" # interpret as subnegotiation
|
SB = 250.chr # "\372" # "\xfa" # interpret as subnegotiation
|
||||||
GA = 249.chr # "\371" # you may reverse the line
|
GA = 249.chr # "\371" # "\xf9" # you may reverse the line
|
||||||
EL = 248.chr # "\370" # erase the current line
|
EL = 248.chr # "\370" # "\xf8" # erase the current line
|
||||||
EC = 247.chr # "\367" # erase the current character
|
EC = 247.chr # "\367" # "\xf7" # erase the current character
|
||||||
AYT = 246.chr # "\366" # are you there
|
AYT = 246.chr # "\366" # "\xf6" # are you there
|
||||||
AO = 245.chr # "\365" # abort output--but let prog finish
|
AO = 245.chr # "\365" # "\xf5" # abort output--but let prog finish
|
||||||
IP = 244.chr # "\364" # interrupt process--permanently
|
IP = 244.chr # "\364" # "\xf4" # interrupt process--permanently
|
||||||
BREAK = 243.chr # "\363" # break
|
BREAK = 243.chr # "\363" # "\xf3" # break
|
||||||
DM = 242.chr # "\362" # data mark--for connect. cleaning
|
DM = 242.chr # "\362" # "\xf2" # data mark--for connect. cleaning
|
||||||
NOP = 241.chr # "\361" # nop
|
NOP = 241.chr # "\361" # "\xf1" # nop
|
||||||
SE = 240.chr # "\360" # end sub negotiation
|
SE = 240.chr # "\360" # "\xf0" # end sub negotiation
|
||||||
EOR = 239.chr # "\357" # end of record (transparent mode)
|
EOR = 239.chr # "\357" # "\xef" # end of record (transparent mode)
|
||||||
ABORT = 238.chr # "\356" # Abort process
|
ABORT = 238.chr # "\356" # "\xee" # Abort process
|
||||||
SUSP = 237.chr # "\355" # Suspend process
|
SUSP = 237.chr # "\355" # "\xed" # Suspend process
|
||||||
EOF = 236.chr # "\354" # End of file
|
EOF = 236.chr # "\354" # "\xec" # End of file
|
||||||
SYNCH = 242.chr # "\362" # for telfunc calls
|
SYNCH = 242.chr # "\362" # "\xf2" # for telfunc calls
|
||||||
|
|
||||||
OPT_BINARY = 0.chr # "\000" # Binary Transmission
|
OPT_BINARY = 0.chr # "\000" # "\x00" # Binary Transmission
|
||||||
OPT_ECHO = 1.chr # "\001" # Echo
|
OPT_ECHO = 1.chr # "\001" # "\x01" # Echo
|
||||||
OPT_RCP = 2.chr # "\002" # Reconnection
|
OPT_RCP = 2.chr # "\002" # "\x02" # Reconnection
|
||||||
OPT_SGA = 3.chr # "\003" # Suppress Go Ahead
|
OPT_SGA = 3.chr # "\003" # "\x03" # Suppress Go Ahead
|
||||||
OPT_NAMS = 4.chr # "\004" # Approx Message Size Negotiation
|
OPT_NAMS = 4.chr # "\004" # "\x04" # Approx Message Size Negotiation
|
||||||
OPT_STATUS = 5.chr # "\005" # Status
|
OPT_STATUS = 5.chr # "\005" # "\x05" # Status
|
||||||
OPT_TM = 6.chr # "\006" # Timing Mark
|
OPT_TM = 6.chr # "\006" # "\x06" # Timing Mark
|
||||||
OPT_RCTE = 7.chr # "\a" # Remote Controlled Trans and Echo
|
OPT_RCTE = 7.chr # "\a" # "\x07" # Remote Controlled Trans and Echo
|
||||||
OPT_NAOL = 8.chr # "\010" # Output Line Width
|
OPT_NAOL = 8.chr # "\010" # "\x08" # Output Line Width
|
||||||
OPT_NAOP = 9.chr # "\t" # Output Page Size
|
OPT_NAOP = 9.chr # "\t" # "\x09" # Output Page Size
|
||||||
OPT_NAOCRD = 10.chr # "\n" # Output Carriage-Return Disposition
|
OPT_NAOCRD = 10.chr # "\n" # "\x0a" # Output Carriage-Return Disposition
|
||||||
OPT_NAOHTS = 11.chr # "\v" # Output Horizontal Tab Stops
|
OPT_NAOHTS = 11.chr # "\v" # "\x0b" # Output Horizontal Tab Stops
|
||||||
OPT_NAOHTD = 12.chr # "\f" # Output Horizontal Tab Disposition
|
OPT_NAOHTD = 12.chr # "\f" # "\x0c" # Output Horizontal Tab Disposition
|
||||||
OPT_NAOFFD = 13.chr # "\r" # Output Formfeed Disposition
|
OPT_NAOFFD = 13.chr # "\r" # "\x0d" # Output Formfeed Disposition
|
||||||
OPT_NAOVTS = 14.chr # "\016" # Output Vertical Tabstops
|
OPT_NAOVTS = 14.chr # "\016" # "\x0e" # Output Vertical Tabstops
|
||||||
OPT_NAOVTD = 15.chr # "\017" # Output Vertical Tab Disposition
|
OPT_NAOVTD = 15.chr # "\017" # "\x0f" # Output Vertical Tab Disposition
|
||||||
OPT_NAOLFD = 16.chr # "\020" # Output Linefeed Disposition
|
OPT_NAOLFD = 16.chr # "\020" # "\x10" # Output Linefeed Disposition
|
||||||
OPT_XASCII = 17.chr # "\021" # Extended ASCII
|
OPT_XASCII = 17.chr # "\021" # "\x11" # Extended ASCII
|
||||||
OPT_LOGOUT = 18.chr # "\022" # Logout
|
OPT_LOGOUT = 18.chr # "\022" # "\x12" # Logout
|
||||||
OPT_BM = 19.chr # "\023" # Byte Macro
|
OPT_BM = 19.chr # "\023" # "\x13" # Byte Macro
|
||||||
OPT_DET = 20.chr # "\024" # Data Entry Terminal
|
OPT_DET = 20.chr # "\024" # "\x14" # Data Entry Terminal
|
||||||
OPT_SUPDUP = 21.chr # "\025" # SUPDUP
|
OPT_SUPDUP = 21.chr # "\025" # "\x15" # SUPDUP
|
||||||
OPT_SUPDUPOUTPUT = 22.chr # "\026" # SUPDUP Output
|
OPT_SUPDUPOUTPUT = 22.chr # "\026" # "\x16" # SUPDUP Output
|
||||||
OPT_SNDLOC = 23.chr # "\027" # Send Location
|
OPT_SNDLOC = 23.chr # "\027" # "\x17" # Send Location
|
||||||
OPT_TTYPE = 24.chr # "\030" # Terminal Type
|
OPT_TTYPE = 24.chr # "\030" # "\x18" # Terminal Type
|
||||||
OPT_EOR = 25.chr # "\031" # End of Record
|
OPT_EOR = 25.chr # "\031" # "\x19" # End of Record
|
||||||
OPT_TUID = 26.chr # "\032" # TACACS User Identification
|
OPT_TUID = 26.chr # "\032" # "\x1a" # TACACS User Identification
|
||||||
OPT_OUTMRK = 27.chr # "\e" # Output Marking
|
OPT_OUTMRK = 27.chr # "\e" # "\x1b" # Output Marking
|
||||||
OPT_TTYLOC = 28.chr # "\034" # Terminal Location Number
|
OPT_TTYLOC = 28.chr # "\034" # "\x1c" # Terminal Location Number
|
||||||
OPT_3270REGIME = 29.chr # "\035" # Telnet 3270 Regime
|
OPT_3270REGIME = 29.chr # "\035" # "\x1d" # Telnet 3270 Regime
|
||||||
OPT_X3PAD = 30.chr # "\036" # X.3 PAD
|
OPT_X3PAD = 30.chr # "\036" # "\x1e" # X.3 PAD
|
||||||
OPT_NAWS = 31.chr # "\037" # Negotiate About Window Size
|
OPT_NAWS = 31.chr # "\037" # "\x1f" # Negotiate About Window Size
|
||||||
OPT_TSPEED = 32.chr # " " # Terminal Speed
|
OPT_TSPEED = 32.chr # " " # "\x20" # Terminal Speed
|
||||||
OPT_LFLOW = 33.chr # "!" # Remote Flow Control
|
OPT_LFLOW = 33.chr # "!" # "\x21" # Remote Flow Control
|
||||||
OPT_LINEMODE = 34.chr # "\"" # Linemode
|
OPT_LINEMODE = 34.chr # "\"" # "\x22" # Linemode
|
||||||
OPT_XDISPLOC = 35.chr # "#" # X Display Location
|
OPT_XDISPLOC = 35.chr # "#" # "\x23" # X Display Location
|
||||||
OPT_OLD_ENVIRON = 36.chr # "$" # Environment Option
|
OPT_OLD_ENVIRON = 36.chr # "$" # "\x24" # Environment Option
|
||||||
OPT_AUTHENTICATION = 37.chr # "%" # Authentication Option
|
OPT_AUTHENTICATION = 37.chr # "%" # "\x25" # Authentication Option
|
||||||
OPT_ENCRYPT = 38.chr # "&" # Encryption Option
|
OPT_ENCRYPT = 38.chr # "&" # "\x26" # Encryption Option
|
||||||
OPT_NEW_ENVIRON = 39.chr # "'" # New Environment Option
|
OPT_NEW_ENVIRON = 39.chr # "'" # "\x27" # New Environment Option
|
||||||
OPT_EXOPL = 255.chr # "\377" # Extended-Options-List
|
OPT_EXOPL = 255.chr # "\377" # "\xff" # Extended-Options-List
|
||||||
|
|
||||||
NULL = "\000"
|
NULL = "\000"
|
||||||
CR = "\015"
|
CR = "\015"
|
||||||
|
@ -413,35 +428,56 @@ class Telnet < SimpleDelegator
|
||||||
EOL = CR + LF
|
EOL = CR + LF
|
||||||
v = $-v
|
v = $-v
|
||||||
$-v = false
|
$-v = false
|
||||||
VERSION = "1.00"
|
VERSION = "1.20"
|
||||||
RELEASE_DATE = "$Date: 1999/10/04 22:51:26 $"
|
RELEASE_DATE = "$Date: 2000/01/24 17:02:57 $"
|
||||||
$-v = v
|
$-v = v
|
||||||
|
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
@options = options
|
@options = options
|
||||||
@options["Binmode"] = false unless @options.key?("Binmode")
|
@options["Binmode"] = false unless @options.has_key?("Binmode")
|
||||||
@options["Host"] = "localhost" unless @options.key?("Host")
|
@options["Host"] = "localhost" unless @options.has_key?("Host")
|
||||||
@options["Port"] = 23 unless @options.key?("Port")
|
@options["Port"] = 23 unless @options.has_key?("Port")
|
||||||
@options["Prompt"] = /[$%#>] \z/n unless @options.key?("Prompt")
|
@options["Prompt"] = /[$%#>] \z/n unless @options.has_key?("Prompt")
|
||||||
@options["Telnetmode"] = true unless @options.key?("Telnetmode")
|
@options["Telnetmode"] = true unless @options.has_key?("Telnetmode")
|
||||||
@options["Timeout"] = 10 unless @options.key?("Timeout")
|
@options["Timeout"] = 10 unless @options.has_key?("Timeout")
|
||||||
@options["Waittime"] = 0 unless @options.key?("Waittime")
|
@options["Waittime"] = 0 unless @options.has_key?("Waittime")
|
||||||
|
|
||||||
@telnet_option = { "SGA" => false, "BINARY" => false }
|
@telnet_option = { "SGA" => false, "BINARY" => false }
|
||||||
|
|
||||||
if @options.key?("Output_log")
|
if @options.has_key?("Output_log")
|
||||||
@log = File.open(@options["Output_log"], 'a+')
|
@log = File.open(@options["Output_log"], 'a+')
|
||||||
@log.sync = true
|
@log.sync = true
|
||||||
@log.binmode
|
@log.binmode
|
||||||
end
|
end
|
||||||
|
|
||||||
if @options.key?("Dump_log")
|
if @options.has_key?("Dump_log")
|
||||||
@dumplog = File.open(@options["Dump_log"], 'a+')
|
@dumplog = File.open(@options["Dump_log"], 'a+')
|
||||||
@dumplog.sync = true
|
@dumplog.sync = true
|
||||||
@dumplog.binmode
|
@dumplog.binmode
|
||||||
|
def @dumplog.log_dump(dir, x)
|
||||||
|
len = x.length
|
||||||
|
addr = 0
|
||||||
|
offset = 0
|
||||||
|
while 0 < len
|
||||||
|
if len < 16
|
||||||
|
line = x[offset, len]
|
||||||
|
else
|
||||||
|
line = x[offset, 16]
|
||||||
|
end
|
||||||
|
hexvals = line.unpack('H*')[0]
|
||||||
|
hexvals.concat ' ' * (32 - hexvals.length)
|
||||||
|
hexvals = format "%s %s %s %s " * 4, *hexvals.unpack('a2' * 16)
|
||||||
|
line.gsub! /[\000-\037\177-\377]/n, '.'
|
||||||
|
printf "%s 0x%5.5x: %s%s\n", dir, addr, hexvals, line
|
||||||
|
addr += 16
|
||||||
|
offset += 16
|
||||||
|
len -= 16
|
||||||
|
end
|
||||||
|
print "\n"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @options.key?("Proxy")
|
if @options.has_key?("Proxy")
|
||||||
if @options["Proxy"].kind_of?(Telnet)
|
if @options["Proxy"].kind_of?(Telnet)
|
||||||
@sock = @options["Proxy"].sock
|
@sock = @options["Proxy"].sock
|
||||||
elsif @options["Proxy"].kind_of?(TCPsocket)
|
elsif @options["Proxy"].kind_of?(TCPsocket)
|
||||||
|
@ -452,8 +488,8 @@ $-v = v
|
||||||
else
|
else
|
||||||
message = "Trying " + @options["Host"] + "...\n"
|
message = "Trying " + @options["Host"] + "...\n"
|
||||||
yield(message) if iterator?
|
yield(message) if iterator?
|
||||||
@log.write(message) if @options.key?("Output_log")
|
@log.write(message) if @options.has_key?("Output_log")
|
||||||
@dumplog.write(message) if @options.key?("Dump_log")
|
@dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if @options["Timeout"] == false
|
if @options["Timeout"] == false
|
||||||
|
@ -466,8 +502,8 @@ $-v = v
|
||||||
rescue TimeoutError
|
rescue TimeoutError
|
||||||
raise TimeoutError, "timed-out; opening of the host"
|
raise TimeoutError, "timed-out; opening of the host"
|
||||||
rescue
|
rescue
|
||||||
@log.write($!.to_s + "\n") if @options.key?("Output_log")
|
@log.write($!.to_s + "\n") if @options.has_key?("Output_log")
|
||||||
@dumplog.write($!.to_s + "\n") if @options.key?("Dump_log")
|
@dumplog.log_dump('#', $!.to_s + "\n") if @options.has_key?("Dump_log")
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
@sock.sync = true
|
@sock.sync = true
|
||||||
|
@ -475,8 +511,8 @@ $-v = v
|
||||||
|
|
||||||
message = "Connected to " + @options["Host"] + ".\n"
|
message = "Connected to " + @options["Host"] + ".\n"
|
||||||
yield(message) if iterator?
|
yield(message) if iterator?
|
||||||
@log.write(message) if @options.key?("Output_log")
|
@log.write(message) if @options.has_key?("Output_log")
|
||||||
@dumplog.write(message) if @options.key?("Dump_log")
|
@dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
|
||||||
end
|
end
|
||||||
|
|
||||||
super(@sock)
|
super(@sock)
|
||||||
|
@ -532,11 +568,15 @@ $-v = v
|
||||||
self.write(IAC + WONT + $1[1..1])
|
self.write(IAC + WONT + $1[1..1])
|
||||||
''
|
''
|
||||||
elsif WILL[0] == $1[0] # respond to "IAC WILL x"
|
elsif WILL[0] == $1[0] # respond to "IAC WILL x"
|
||||||
if OPT_ECHO[0] == $1[1]
|
if OPT_BINARY[0] == $1[1]
|
||||||
|
self.write(IAC + DO + OPT_BINARY)
|
||||||
|
elsif OPT_ECHO[0] == $1[1]
|
||||||
self.write(IAC + DO + OPT_ECHO)
|
self.write(IAC + DO + OPT_ECHO)
|
||||||
elsif OPT_SGA[0] == $1[1]
|
elsif OPT_SGA[0] == $1[1]
|
||||||
@telnet_option["SGA"] = true
|
@telnet_option["SGA"] = true
|
||||||
self.write(IAC + DO + OPT_SGA)
|
self.write(IAC + DO + OPT_SGA)
|
||||||
|
else
|
||||||
|
self.write(IAC + DONT + $1[1..1])
|
||||||
end
|
end
|
||||||
''
|
''
|
||||||
elsif WONT[0] == $1[0] # respond to "IAC WON'T x"
|
elsif WONT[0] == $1[0] # respond to "IAC WON'T x"
|
||||||
|
@ -545,6 +585,8 @@ $-v = v
|
||||||
elsif OPT_SGA[0] == $1[1]
|
elsif OPT_SGA[0] == $1[1]
|
||||||
@telnet_option["SGA"] = false
|
@telnet_option["SGA"] = false
|
||||||
self.write(IAC + DONT + OPT_SGA)
|
self.write(IAC + DONT + OPT_SGA)
|
||||||
|
else
|
||||||
|
self.write(IAC + DONT + $1[1..1])
|
||||||
end
|
end
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
|
@ -560,15 +602,15 @@ $-v = v
|
||||||
waittime = @options["Waittime"]
|
waittime = @options["Waittime"]
|
||||||
|
|
||||||
if options.kind_of?(Hash)
|
if options.kind_of?(Hash)
|
||||||
prompt = if options.key?("Match")
|
prompt = if options.has_key?("Match")
|
||||||
options["Match"]
|
options["Match"]
|
||||||
elsif options.key?("Prompt")
|
elsif options.has_key?("Prompt")
|
||||||
options["Prompt"]
|
options["Prompt"]
|
||||||
elsif options.key?("String")
|
elsif options.has_key?("String")
|
||||||
Regexp.new( Regexp.quote(options["String"]) )
|
Regexp.new( Regexp.quote(options["String"]) )
|
||||||
end
|
end
|
||||||
time_out = options["Timeout"] if options.key?("Timeout")
|
time_out = options["Timeout"] if options.has_key?("Timeout")
|
||||||
waittime = options["Waittime"] if options.key?("Waittime")
|
waittime = options["Waittime"] if options.has_key?("Waittime")
|
||||||
else
|
else
|
||||||
prompt = options
|
prompt = options
|
||||||
end
|
end
|
||||||
|
@ -586,7 +628,7 @@ $-v = v
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
c = @sock.sysread(1024 * 1024)
|
c = @sock.sysread(1024 * 1024)
|
||||||
@dumplog.print(c) if @options.key?("Dump_log")
|
@dumplog.log_dump('<', c) if @options.has_key?("Dump_log")
|
||||||
if @options["Telnetmode"]
|
if @options["Telnetmode"]
|
||||||
if Integer(c.rindex(/#{IAC}#{SE}/no)) <
|
if Integer(c.rindex(/#{IAC}#{SE}/no)) <
|
||||||
Integer(c.rindex(/#{IAC}#{SB}/no))
|
Integer(c.rindex(/#{IAC}#{SB}/no))
|
||||||
|
@ -600,7 +642,7 @@ $-v = v
|
||||||
rest = ''
|
rest = ''
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@log.print(buf) if @options.key?("Output_log")
|
@log.print(buf) if @options.has_key?("Output_log")
|
||||||
line.concat(buf)
|
line.concat(buf)
|
||||||
yield buf if iterator?
|
yield buf if iterator?
|
||||||
rescue EOFError # End of file reached
|
rescue EOFError # End of file reached
|
||||||
|
@ -618,7 +660,8 @@ $-v = v
|
||||||
length = string.length
|
length = string.length
|
||||||
while 0 < length
|
while 0 < length
|
||||||
IO::select(nil, [@sock])
|
IO::select(nil, [@sock])
|
||||||
length -= @sock.syswrite(string)
|
@dumplog.log_dump('>', string[-length..-1]) if @options.has_key?("Dump_log")
|
||||||
|
length -= @sock.syswrite(string[-length..-1])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -649,8 +692,8 @@ $-v = v
|
||||||
|
|
||||||
if options.kind_of?(Hash)
|
if options.kind_of?(Hash)
|
||||||
string = options["String"]
|
string = options["String"]
|
||||||
match = options["Match"] if options.key?("Match")
|
match = options["Match"] if options.has_key?("Match")
|
||||||
time_out = options["Timeout"] if options.key?("Timeout")
|
time_out = options["Timeout"] if options.has_key?("Timeout")
|
||||||
else
|
else
|
||||||
string = options
|
string = options
|
||||||
end
|
end
|
||||||
|
|
|
@ -689,7 +689,7 @@ An end of a defun is found by moving forward from the beginning of one."
|
||||||
'("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
|
'("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
|
||||||
2 font-lock-type-face)
|
2 font-lock-type-face)
|
||||||
;; functions
|
;; functions
|
||||||
'("^\\s *def\\s *\\([^( ]+\\)"
|
'("^\\s *def\\s +\\([^( ]+\\)"
|
||||||
1 font-lock-function-name-face)
|
1 font-lock-function-name-face)
|
||||||
;; symbols
|
;; symbols
|
||||||
'("\\(^\\|[^:]\\)\\(:\\(\\w\\|_\\)+\\??\\)\\b"
|
'("\\(^\\|[^:]\\)\\(:\\(\\w\\|_\\)+\\??\\)\\b"
|
||||||
|
|
4
parse.y
4
parse.y
|
@ -1120,7 +1120,7 @@ primary : literal
|
||||||
$$ = NEW_UNLESS(cond($2), $4, $5);
|
$$ = NEW_UNLESS(cond($2), $4, $5);
|
||||||
fixpos($$, $2);
|
fixpos($$, $2);
|
||||||
}
|
}
|
||||||
| kWHILE {cond_nest++;} expr do {cond_nest--;}
|
| kWHILE {cond_nest++;} expr do { cond_nest--; }
|
||||||
compstmt
|
compstmt
|
||||||
kEND
|
kEND
|
||||||
{
|
{
|
||||||
|
@ -1128,7 +1128,7 @@ primary : literal
|
||||||
$$ = NEW_WHILE(cond($3), $6, 1);
|
$$ = NEW_WHILE(cond($3), $6, 1);
|
||||||
fixpos($$, $3);
|
fixpos($$, $3);
|
||||||
}
|
}
|
||||||
| kUNTIL {cond_nest++;} expr do {cond_nest--;}
|
| kUNTIL {cond_nest++;} expr do { cond_nest--; }
|
||||||
compstmt
|
compstmt
|
||||||
kEND
|
kEND
|
||||||
{
|
{
|
||||||
|
|
4
random.c
4
random.c
|
@ -77,7 +77,7 @@ void srand48 _((long));
|
||||||
#endif /* not HAVE_DRAND48 */
|
#endif /* not HAVE_DRAND48 */
|
||||||
|
|
||||||
static int first = 1;
|
static int first = 1;
|
||||||
#if !defined HAVE_DRAND48 && defined HAVE_RANDOM
|
#ifdef HAVE_RANDOM
|
||||||
static char state[256];
|
static char state[256];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ rand_init(seed)
|
||||||
int old;
|
int old;
|
||||||
static unsigned int saved_seed;
|
static unsigned int saved_seed;
|
||||||
|
|
||||||
#if !defined HAVE_DRAND48 && defined HAVE_RANDOM
|
#ifdef HAVE_RANDOM
|
||||||
if (first == 1) {
|
if (first == 1) {
|
||||||
initstate(1, state, sizeof state);
|
initstate(1, state, sizeof state);
|
||||||
}
|
}
|
||||||
|
|
56
re.c
56
re.c
|
@ -183,7 +183,7 @@ kcode_reset_option()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rb_mbclen2(c, re)
|
rb_reg_mbclen2(c, re)
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
VALUE re;
|
VALUE re;
|
||||||
{
|
{
|
||||||
|
@ -455,21 +455,14 @@ match_end(match, n)
|
||||||
#define MATCH_BUSY FL_USER2
|
#define MATCH_BUSY FL_USER2
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_match_busy(match, busy)
|
rb_match_busy(match)
|
||||||
VALUE match;
|
VALUE match;
|
||||||
int busy;
|
|
||||||
{
|
{
|
||||||
if (busy) {
|
FL_SET(match, MATCH_BUSY);
|
||||||
FL_SET(match, MATCH_BUSY);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
FL_UNSET(match, MATCH_BUSY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ruby_ignorecase;
|
int ruby_ignorecase;
|
||||||
static int may_need_recompile;
|
static int may_need_recompile;
|
||||||
static VALUE matchcache;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_reg_prepare_re(reg)
|
rb_reg_prepare_re(reg)
|
||||||
|
@ -540,7 +533,7 @@ rb_reg_search(reg, str, pos, reverse)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
VALUE match;
|
VALUE match;
|
||||||
struct re_registers *regs = 0;
|
static struct re_registers regs;
|
||||||
int range;
|
int range;
|
||||||
|
|
||||||
if (pos > RSTRING(str)->len) return -1;
|
if (pos > RSTRING(str)->len) return -1;
|
||||||
|
@ -553,23 +546,6 @@ rb_reg_search(reg, str, pos, reverse)
|
||||||
else if (reg_kcode != curr_kcode)
|
else if (reg_kcode != curr_kcode)
|
||||||
kcode_reset_option();
|
kcode_reset_option();
|
||||||
|
|
||||||
if (rb_thread_scope_shared_p()) {
|
|
||||||
match = Qnil;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
match = rb_backref_get();
|
|
||||||
}
|
|
||||||
if (NIL_P(match) || FL_TEST(match, MATCH_BUSY)) {
|
|
||||||
if (matchcache) {
|
|
||||||
match = matchcache;
|
|
||||||
matchcache = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
match = match_alloc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
regs = RMATCH(match)->regs;
|
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
range = -pos;
|
range = -pos;
|
||||||
}
|
}
|
||||||
|
@ -577,7 +553,7 @@ rb_reg_search(reg, str, pos, reverse)
|
||||||
range = RSTRING(str)->len - pos;
|
range = RSTRING(str)->len - pos;
|
||||||
}
|
}
|
||||||
result = re_search(RREGEXP(reg)->ptr,RSTRING(str)->ptr,RSTRING(str)->len,
|
result = re_search(RREGEXP(reg)->ptr,RSTRING(str)->ptr,RSTRING(str)->len,
|
||||||
pos, range, regs);
|
pos, range, ®s);
|
||||||
|
|
||||||
if (FL_TEST(reg, KCODE_FIXED))
|
if (FL_TEST(reg, KCODE_FIXED))
|
||||||
kcode_reset_option();
|
kcode_reset_option();
|
||||||
|
@ -586,15 +562,24 @@ rb_reg_search(reg, str, pos, reverse)
|
||||||
rb_reg_raise(RREGEXP(reg)->str, RREGEXP(reg)->len,
|
rb_reg_raise(RREGEXP(reg)->str, RREGEXP(reg)->len,
|
||||||
"Stack overfow in regexp matcher", reg);
|
"Stack overfow in regexp matcher", reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
FL_UNSET(match, FL_TAINT);
|
|
||||||
matchcache = match;
|
|
||||||
rb_backref_set(Qnil);
|
rb_backref_set(Qnil);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rb_thread_scope_shared_p()) {
|
||||||
|
match = Qnil;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RMATCH(match)->str = rb_str_new4(str);
|
match = rb_backref_get();
|
||||||
rb_backref_set(match);
|
|
||||||
}
|
}
|
||||||
|
if (NIL_P(match) || FL_TEST(match, MATCH_BUSY)) {
|
||||||
|
match = match_alloc();
|
||||||
|
}
|
||||||
|
re_copy_registers(RMATCH(match)->regs, ®s);
|
||||||
|
RMATCH(match)->str = rb_str_new4(str);
|
||||||
|
rb_backref_set(match);
|
||||||
|
|
||||||
OBJ_INFECT(match, reg);
|
OBJ_INFECT(match, reg);
|
||||||
OBJ_INFECT(match, str);
|
OBJ_INFECT(match, str);
|
||||||
|
@ -1150,6 +1135,7 @@ rb_reg_regsub(str, src, regs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (no >= 0) {
|
if (no >= 0) {
|
||||||
|
if (no >= regs->num_regs) continue;
|
||||||
if (BEG(no) == -1) continue;
|
if (BEG(no) == -1) continue;
|
||||||
rb_str_cat(val, RSTRING(src)->ptr+BEG(no), END(no)-BEG(no));
|
rb_str_cat(val, RSTRING(src)->ptr+BEG(no), END(no)-BEG(no));
|
||||||
}
|
}
|
||||||
|
@ -1247,7 +1233,8 @@ match_getter()
|
||||||
VALUE match = rb_backref_get();
|
VALUE match = rb_backref_get();
|
||||||
|
|
||||||
if (NIL_P(match)) return Qnil;
|
if (NIL_P(match)) return Qnil;
|
||||||
return match_clone(match);
|
rb_match_busy(match);
|
||||||
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1310,7 +1297,6 @@ Init_Regexp()
|
||||||
rb_define_const(rb_cRegexp, "POSIXLINE", INT2FIX(RE_OPTION_POSIXLINE));
|
rb_define_const(rb_cRegexp, "POSIXLINE", INT2FIX(RE_OPTION_POSIXLINE));
|
||||||
|
|
||||||
rb_global_variable(®_cache);
|
rb_global_variable(®_cache);
|
||||||
rb_global_variable(&matchcache);
|
|
||||||
|
|
||||||
rb_cMatch = rb_define_class("MatchingData", rb_cObject);
|
rb_cMatch = rb_define_class("MatchingData", rb_cObject);
|
||||||
rb_undef_method(CLASS_OF(rb_cMatch), "new");
|
rb_undef_method(CLASS_OF(rb_cMatch), "new");
|
||||||
|
|
5
re.h
5
re.h
|
@ -35,9 +35,10 @@ VALUE rb_reg_regsub _((VALUE, VALUE, struct re_registers *));
|
||||||
int rb_reg_adjust_startpos _((VALUE, VALUE, int, int));
|
int rb_reg_adjust_startpos _((VALUE, VALUE, int, int));
|
||||||
|
|
||||||
int rb_kcode _((void));
|
int rb_kcode _((void));
|
||||||
|
void rb_match_busy _((VALUE));
|
||||||
|
|
||||||
extern int ruby_ignorecase;
|
extern int ruby_ignorecase;
|
||||||
|
|
||||||
int rb_mbclen2 _((unsigned char, VALUE));
|
int rb_reg_mbclen2 _((unsigned char, VALUE));
|
||||||
#define mbclen2(c,re) rb_mbclen2((c),(re))
|
#define mbclen2(c,re) rb_reg_mbclen2((c),(re))
|
||||||
#endif
|
#endif
|
||||||
|
|
93
regex.c
93
regex.c
|
@ -24,6 +24,11 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#ifdef RUBY_PLATFORM
|
#ifdef RUBY_PLATFORM
|
||||||
# define RUBY
|
# define RUBY
|
||||||
|
extern int rb_prohibit_interrupt;
|
||||||
|
extern int rb_trap_pending;
|
||||||
|
# define CHECK_INTS if (!rb_prohibit_interrupt) {\
|
||||||
|
if (rb_trap_pending) rb_trap_exec();\
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We write fatal error messages on standard error. */
|
/* We write fatal error messages on standard error. */
|
||||||
|
@ -59,13 +64,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef xmalloc
|
#ifndef xmalloc
|
||||||
void *xmalloc _((unsigned long));
|
void *xmalloc _((size_t));
|
||||||
void *xcalloc _((unsigned long,unsigned long));
|
void *xcalloc _((size_t,size_t));
|
||||||
void *xrealloc _((void*,unsigned long));
|
void *xrealloc _((void*,size_t));
|
||||||
void free _((void*));
|
void free _((void*));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* #define NO_ALLOCA */ /* try it out for now */
|
#define NO_ALLOCA */ /* try it out for now */
|
||||||
#ifndef NO_ALLOCA
|
#ifndef NO_ALLOCA
|
||||||
/* Make alloca work the best possible way. */
|
/* Make alloca work the best possible way. */
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
@ -109,13 +114,13 @@ char *alloca();
|
||||||
|
|
||||||
#define RE_ALLOCATE xmalloc
|
#define RE_ALLOCATE xmalloc
|
||||||
|
|
||||||
#define FREE_VAR(var) do { if (var) free(var); var = NULL; } while(0)
|
|
||||||
#define FREE_VARIABLES()
|
#define FREE_VARIABLES()
|
||||||
|
|
||||||
#define FREE_AND_RETURN_VOID(stackb) do { free(stackb); return; } while(0)
|
#define FREE_AND_RETURN_VOID(stackb) do { free(stackb); return; } while(0)
|
||||||
#define FREE_AND_RETURN(stackb,val) do { free(stackb); return(val); } while(0)
|
#define FREE_AND_RETURN(stackb,val) do { free(stackb); return(val); } while(0)
|
||||||
#define DOUBLE_STACK(stackx,stackb,len,type) \
|
#define DOUBLE_STACK(stackx,stackb,len,type) do { \
|
||||||
(type*)xrealloc(stackb, 2 * len * sizeof(type))
|
stackx = (type*)xrealloc(stackb, 2 * len * sizeof(type)); \
|
||||||
|
} while (0)
|
||||||
#endif /* NO_ALLOCA */
|
#endif /* NO_ALLOCA */
|
||||||
|
|
||||||
#define RE_TALLOC(n,t) ((t*)RE_ALLOCATE((n)*sizeof(t)))
|
#define RE_TALLOC(n,t) ((t*)RE_ALLOCATE((n)*sizeof(t)))
|
||||||
|
@ -125,7 +130,7 @@ char *alloca();
|
||||||
#define EXPAND_FAIL_STACK(stackx,stackb,len) \
|
#define EXPAND_FAIL_STACK(stackx,stackb,len) \
|
||||||
do { \
|
do { \
|
||||||
/* Roughly double the size of the stack. */ \
|
/* Roughly double the size of the stack. */ \
|
||||||
stackx = DOUBLE_STACK(stackx,stackb,len,unsigned char*); \
|
DOUBLE_STACK(stackx,stackb,len,unsigned char*); \
|
||||||
/* Rearrange the pointers. */ \
|
/* Rearrange the pointers. */ \
|
||||||
stackp = stackx + (stackp - stackb); \
|
stackp = stackx + (stackp - stackb); \
|
||||||
stackb = stackx; \
|
stackb = stackx; \
|
||||||
|
@ -273,6 +278,7 @@ enum regexpcode
|
||||||
of string to be matched (if not). */
|
of string to be matched (if not). */
|
||||||
endbuf, /* Analogously, for end of buffer/string. */
|
endbuf, /* Analogously, for end of buffer/string. */
|
||||||
endbuf2, /* End of buffer/string, or newline just before it. */
|
endbuf2, /* End of buffer/string, or newline just before it. */
|
||||||
|
begpos, /* Matches where last scan//gsub left off. */
|
||||||
jump, /* Followed by two bytes giving relative address to jump to. */
|
jump, /* Followed by two bytes giving relative address to jump to. */
|
||||||
jump_past_alt,/* Same as jump, but marks the end of an alternative. */
|
jump_past_alt,/* Same as jump, but marks the end of an alternative. */
|
||||||
on_failure_jump, /* Followed by two bytes giving relative address of
|
on_failure_jump, /* Followed by two bytes giving relative address of
|
||||||
|
@ -337,6 +343,7 @@ enum regexpcode
|
||||||
start_nowidth, /* Save string point to the stack. */
|
start_nowidth, /* Save string point to the stack. */
|
||||||
stop_nowidth, /* Restore string place at the point start_nowidth. */
|
stop_nowidth, /* Restore string place at the point start_nowidth. */
|
||||||
pop_and_fail, /* Fail after popping nowidth entry from stack. */
|
pop_and_fail, /* Fail after popping nowidth entry from stack. */
|
||||||
|
stop_backtrack, /* Restore backtrack stack at the point start_nowidth. */
|
||||||
duplicate, /* Match a duplicate of something remembered.
|
duplicate, /* Match a duplicate of something remembered.
|
||||||
Followed by one byte containing the index of the memory
|
Followed by one byte containing the index of the memory
|
||||||
register. */
|
register. */
|
||||||
|
@ -354,7 +361,7 @@ enum regexpcode
|
||||||
so it is not a hard limit. */
|
so it is not a hard limit. */
|
||||||
|
|
||||||
#ifndef NFAILURES
|
#ifndef NFAILURES
|
||||||
#define NFAILURES 80
|
#define NFAILURES 160
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
|
/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
|
||||||
|
@ -767,6 +774,11 @@ print_partial_compiled_pattern(start, end)
|
||||||
printf("/pop_and_fail");
|
printf("/pop_and_fail");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case stop_backtrack:
|
||||||
|
printf("/stop_backtrack//");
|
||||||
|
p += 2;
|
||||||
|
break;
|
||||||
|
|
||||||
case duplicate:
|
case duplicate:
|
||||||
printf("/duplicate/%d", *p++);
|
printf("/duplicate/%d", *p++);
|
||||||
break;
|
break;
|
||||||
|
@ -921,6 +933,10 @@ print_partial_compiled_pattern(start, end)
|
||||||
printf("/endbuf2");
|
printf("/endbuf2");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case begpos:
|
||||||
|
printf("/begpos");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("?%d", *(p-1));
|
printf("?%d", *(p-1));
|
||||||
}
|
}
|
||||||
|
@ -993,6 +1009,7 @@ calculate_must_string(start, end)
|
||||||
case begbuf:
|
case begbuf:
|
||||||
case endbuf:
|
case endbuf:
|
||||||
case endbuf2:
|
case endbuf2:
|
||||||
|
case begpos:
|
||||||
case push_dummy_failure:
|
case push_dummy_failure:
|
||||||
case start_paren:
|
case start_paren:
|
||||||
case stop_paren:
|
case stop_paren:
|
||||||
|
@ -1030,6 +1047,7 @@ calculate_must_string(start, end)
|
||||||
|
|
||||||
case start_nowidth:
|
case start_nowidth:
|
||||||
case stop_nowidth:
|
case stop_nowidth:
|
||||||
|
case stop_backtrack:
|
||||||
case finalize_jump:
|
case finalize_jump:
|
||||||
case maybe_finalize_jump:
|
case maybe_finalize_jump:
|
||||||
case finalize_push:
|
case finalize_push:
|
||||||
|
@ -1650,6 +1668,7 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
case ':':
|
case ':':
|
||||||
case '=':
|
case '=':
|
||||||
case '!':
|
case '!':
|
||||||
|
case '>':
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1665,7 +1684,7 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
int *stackx;
|
int *stackx;
|
||||||
unsigned int len = stacke - stackb;
|
unsigned int len = stacke - stackb;
|
||||||
|
|
||||||
stackx = DOUBLE_STACK(stackx,stackb,len,int);
|
DOUBLE_STACK(stackx,stackb,len,int);
|
||||||
/* Rearrange the pointers. */
|
/* Rearrange the pointers. */
|
||||||
stackp = stackx + (stackp - stackb);
|
stackp = stackx + (stackp - stackb);
|
||||||
stackb = stackx;
|
stackb = stackx;
|
||||||
|
@ -1691,11 +1710,12 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
|
|
||||||
case '=':
|
case '=':
|
||||||
case '!':
|
case '!':
|
||||||
|
case '>':
|
||||||
BUFPUSH(start_nowidth);
|
BUFPUSH(start_nowidth);
|
||||||
*stackp++ = b - bufp->buffer;
|
*stackp++ = b - bufp->buffer;
|
||||||
BUFPUSH(0); /* temporary value */
|
BUFPUSH(0); /* temporary value */
|
||||||
BUFPUSH(0);
|
BUFPUSH(0);
|
||||||
if (c == '=') break;
|
if (c != '!') break;
|
||||||
|
|
||||||
BUFPUSH(on_failure_jump);
|
BUFPUSH(on_failure_jump);
|
||||||
*stackp++ = b - bufp->buffer;
|
*stackp++ = b - bufp->buffer;
|
||||||
|
@ -1766,6 +1786,15 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
stackp--;
|
stackp--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '>':
|
||||||
|
BUFPUSH(stop_backtrack);
|
||||||
|
/* tell stack-pos place to start_nowidth */
|
||||||
|
STORE_NUMBER(bufp->buffer+stackp[-1], b - bufp->buffer - stackp[-1] - 2);
|
||||||
|
BUFPUSH(0); /* space to hold stack pos */
|
||||||
|
BUFPUSH(0);
|
||||||
|
stackp--;
|
||||||
|
break;
|
||||||
|
|
||||||
case ':':
|
case ':':
|
||||||
BUFPUSH(stop_paren);
|
BUFPUSH(stop_paren);
|
||||||
break;
|
break;
|
||||||
|
@ -2089,6 +2118,10 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
BUFPUSH(endbuf);
|
BUFPUSH(endbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'G':
|
||||||
|
BUFPUSH(begpos);
|
||||||
|
break;
|
||||||
|
|
||||||
/* hex */
|
/* hex */
|
||||||
case 'x':
|
case 'x':
|
||||||
had_mbchar = 0;
|
had_mbchar = 0;
|
||||||
|
@ -2702,6 +2735,7 @@ re_compile_fastmap(bufp)
|
||||||
case try_next:
|
case try_next:
|
||||||
case start_nowidth:
|
case start_nowidth:
|
||||||
case stop_nowidth:
|
case stop_nowidth:
|
||||||
|
case stop_backtrack:
|
||||||
p += 2;
|
p += 2;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -3003,11 +3037,12 @@ re_search(bufp, string, size, startpos, range, regs)
|
||||||
case begbuf:
|
case begbuf:
|
||||||
begbuf_match:
|
begbuf_match:
|
||||||
if (range > 0) {
|
if (range > 0) {
|
||||||
if (startpos > 0)
|
if (startpos > 0) return -1;
|
||||||
return -1;
|
else {
|
||||||
else if (re_match(bufp, string, size, 0, regs) >= 0)
|
val = re_match(bufp, string, size, 0, regs);
|
||||||
return 0;
|
if (val >= 0) return 0;
|
||||||
return -1;
|
return val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3015,6 +3050,11 @@ re_search(bufp, string, size, startpos, range, regs)
|
||||||
anchor = 1;
|
anchor = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case begpos:
|
||||||
|
val = re_match(bufp, string, size, startpos, regs);
|
||||||
|
if (val >= 0) return startpos;
|
||||||
|
return val;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3106,10 +3146,8 @@ re_search(bufp, string, size, startpos, range, regs)
|
||||||
if (startpos > size) return -1;
|
if (startpos > size) return -1;
|
||||||
if (anchor && size > 0 && startpos == size) return -1;
|
if (anchor && size > 0 && startpos == size) return -1;
|
||||||
val = re_match(bufp, string, size, startpos, regs);
|
val = re_match(bufp, string, size, startpos, regs);
|
||||||
if (val >= 0)
|
if (val >= 0) return startpos;
|
||||||
return startpos;
|
if (val == -2) return -2;
|
||||||
if (val == -2)
|
|
||||||
return -2;
|
|
||||||
|
|
||||||
#ifndef NO_ALLOCA
|
#ifndef NO_ALLOCA
|
||||||
#ifdef C_ALLOCA
|
#ifdef C_ALLOCA
|
||||||
|
@ -3617,6 +3655,12 @@ re_match(bufp, string_arg, size, pos, regs)
|
||||||
POP_FAILURE_POINT();
|
POP_FAILURE_POINT();
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case stop_backtrack:
|
||||||
|
EXTRACT_NUMBER_AND_INCR(mcnt, p);
|
||||||
|
stackp = stackb + mcnt;
|
||||||
|
POP_FAILURE_POINT();
|
||||||
|
continue;
|
||||||
|
|
||||||
case pop_and_fail:
|
case pop_and_fail:
|
||||||
EXTRACT_NUMBER(mcnt, p+1);
|
EXTRACT_NUMBER(mcnt, p+1);
|
||||||
stackp = stackb + mcnt;
|
stackp = stackb + mcnt;
|
||||||
|
@ -3747,6 +3791,12 @@ re_match(bufp, string_arg, size, pos, regs)
|
||||||
/* A smart repeat is similar but loops back to the on_failure_jump
|
/* A smart repeat is similar but loops back to the on_failure_jump
|
||||||
so that each repetition makes another failure point. */
|
so that each repetition makes another failure point. */
|
||||||
|
|
||||||
|
/* Match at the starting position. */
|
||||||
|
case begpos:
|
||||||
|
if (d - string == pos)
|
||||||
|
break;
|
||||||
|
goto fail;
|
||||||
|
|
||||||
case on_failure_jump:
|
case on_failure_jump:
|
||||||
on_failure:
|
on_failure:
|
||||||
EXTRACT_NUMBER_AND_INCR(mcnt, p);
|
EXTRACT_NUMBER_AND_INCR(mcnt, p);
|
||||||
|
@ -4089,6 +4139,9 @@ re_match(bufp, string_arg, size, pos, regs)
|
||||||
SET_REGS_MATCHED;
|
SET_REGS_MATCHED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef RUBY
|
||||||
|
CHECK_INTS;
|
||||||
|
#endif
|
||||||
continue; /* Successfully executed one pattern command; keep going. */
|
continue; /* Successfully executed one pattern command; keep going. */
|
||||||
|
|
||||||
/* Jump here if any matching operation fails. */
|
/* Jump here if any matching operation fails. */
|
||||||
|
|
4
ruby.h
4
ruby.h
|
@ -400,6 +400,10 @@ void rb_undef_method _((VALUE,const char*));
|
||||||
void rb_define_alias _((VALUE,const char*,const char*));
|
void rb_define_alias _((VALUE,const char*,const char*));
|
||||||
void rb_define_attr _((VALUE,const char*,int,int));
|
void rb_define_attr _((VALUE,const char*,int,int));
|
||||||
|
|
||||||
|
void rb_global_variable _((VALUE*));
|
||||||
|
void rb_gc_register_address _((VALUE*));
|
||||||
|
void rb_gc_unregister_address _((VALUE*));
|
||||||
|
|
||||||
ID rb_intern _((const char*));
|
ID rb_intern _((const char*));
|
||||||
char *rb_id2name _((ID));
|
char *rb_id2name _((ID));
|
||||||
ID rb_to_id _((VALUE));
|
ID rb_to_id _((VALUE));
|
||||||
|
|
|
@ -31,7 +31,7 @@ while TRUE
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
print eval(line).inspect, "\n"
|
print eval(line).inspect, "\n"
|
||||||
rescue
|
rescue ScriptError, StandardError
|
||||||
$! = 'exception raised' unless $!
|
$! = 'exception raised' unless $!
|
||||||
print "ERR: ", $!, "\n"
|
print "ERR: ", $!, "\n"
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ while gets()
|
||||||
else
|
else
|
||||||
type = ""
|
type = ""
|
||||||
end
|
end
|
||||||
while arg.sub!(/(\** *[\w\d_]+)(,|$)/, "")
|
while arg.sub!(/(\** *[\w\d_]+)(,|$)/, "") && $~
|
||||||
args.push type + " " + $1.strip
|
args.push type + " " + $1.strip
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
92
string.c
92
string.c
|
@ -1030,20 +1030,19 @@ rb_str_sub_bang(argc, argv, str)
|
||||||
|
|
||||||
pat = get_pat(argv[0]);
|
pat = get_pat(argv[0]);
|
||||||
if (rb_reg_search(pat, str, 0, 0) >= 0) {
|
if (rb_reg_search(pat, str, 0, 0) >= 0) {
|
||||||
rb_str_modify(str);
|
|
||||||
match = rb_backref_get();
|
match = rb_backref_get();
|
||||||
regs = RMATCH(match)->regs;
|
regs = RMATCH(match)->regs;
|
||||||
|
|
||||||
if (iter) {
|
if (iter) {
|
||||||
rb_match_busy(match, Qtrue);
|
rb_match_busy(match);
|
||||||
repl = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
|
repl = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
|
||||||
rb_match_busy(match, Qfalse);
|
|
||||||
rb_backref_set(match);
|
rb_backref_set(match);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
repl = rb_reg_regsub(repl, str, regs);
|
repl = rb_reg_regsub(repl, str, regs);
|
||||||
}
|
}
|
||||||
plen = END(0) - BEG(0);
|
plen = END(0) - BEG(0);
|
||||||
|
rb_str_modify(str);
|
||||||
if (RSTRING(repl)->len > plen) {
|
if (RSTRING(repl)->len > plen) {
|
||||||
REALLOC_N(RSTRING(str)->ptr, char,
|
REALLOC_N(RSTRING(str)->ptr, char,
|
||||||
RSTRING(str)->len + RSTRING(repl)->len - plen + 1);
|
RSTRING(str)->len + RSTRING(repl)->len - plen + 1);
|
||||||
|
@ -1057,8 +1056,9 @@ rb_str_sub_bang(argc, argv, str)
|
||||||
RSTRING(repl)->ptr, RSTRING(repl)->len);
|
RSTRING(repl)->ptr, RSTRING(repl)->len);
|
||||||
RSTRING(str)->len += RSTRING(repl)->len - plen;
|
RSTRING(str)->len += RSTRING(repl)->len - plen;
|
||||||
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
return str;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1100,7 +1100,7 @@ rb_str_gsub_bang(argc, argv, str)
|
||||||
pat = get_pat(argv[0]);
|
pat = get_pat(argv[0]);
|
||||||
offset=0; n=0;
|
offset=0; n=0;
|
||||||
beg = rb_reg_search(pat, str, 0, 0);
|
beg = rb_reg_search(pat, str, 0, 0);
|
||||||
if (beg < 0) return str; /* no match, no substitution */
|
if (beg < 0) return Qnil; /* no match, no substitution */
|
||||||
|
|
||||||
blen = RSTRING(str)->len + 30; /* len + margin */
|
blen = RSTRING(str)->len + 30; /* len + margin */
|
||||||
buf = ALLOC_N(char, blen);
|
buf = ALLOC_N(char, blen);
|
||||||
|
@ -1110,9 +1110,9 @@ rb_str_gsub_bang(argc, argv, str)
|
||||||
while (beg >= 0) {
|
while (beg >= 0) {
|
||||||
n++;
|
n++;
|
||||||
match = rb_backref_get();
|
match = rb_backref_get();
|
||||||
rb_match_busy(match, Qtrue);
|
|
||||||
regs = RMATCH(match)->regs;
|
regs = RMATCH(match)->regs;
|
||||||
if (iter) {
|
if (iter) {
|
||||||
|
rb_match_busy(match);
|
||||||
val = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
|
val = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
|
||||||
rb_backref_set(match);
|
rb_backref_set(match);
|
||||||
}
|
}
|
||||||
|
@ -1160,7 +1160,6 @@ rb_str_gsub_bang(argc, argv, str)
|
||||||
memcpy(bp, cp, RSTRING(str)->len - offset);
|
memcpy(bp, cp, RSTRING(str)->len - offset);
|
||||||
bp += RSTRING(str)->len - offset;
|
bp += RSTRING(str)->len - offset;
|
||||||
}
|
}
|
||||||
rb_match_busy(match, Qfalse);
|
|
||||||
rb_backref_set(match);
|
rb_backref_set(match);
|
||||||
rb_str_modify(str);
|
rb_str_modify(str);
|
||||||
free(RSTRING(str)->ptr);
|
free(RSTRING(str)->ptr);
|
||||||
|
@ -1518,6 +1517,7 @@ rb_str_upcase_bang(str)
|
||||||
VALUE str;
|
VALUE str;
|
||||||
{
|
{
|
||||||
char *s, *send;
|
char *s, *send;
|
||||||
|
int modify = 0;
|
||||||
|
|
||||||
rb_str_modify(str);
|
rb_str_modify(str);
|
||||||
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
|
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
|
||||||
|
@ -1527,10 +1527,13 @@ rb_str_upcase_bang(str)
|
||||||
}
|
}
|
||||||
else if (islower(*s)) {
|
else if (islower(*s)) {
|
||||||
*s = toupper(*s);
|
*s = toupper(*s);
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
return str;
|
|
||||||
|
if (modify) return str;
|
||||||
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1547,6 +1550,7 @@ rb_str_downcase_bang(str)
|
||||||
VALUE str;
|
VALUE str;
|
||||||
{
|
{
|
||||||
char *s, *send;
|
char *s, *send;
|
||||||
|
int modify = 0;
|
||||||
|
|
||||||
rb_str_modify(str);
|
rb_str_modify(str);
|
||||||
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
|
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
|
||||||
|
@ -1556,10 +1560,13 @@ rb_str_downcase_bang(str)
|
||||||
}
|
}
|
||||||
else if (ISUPPER(*s)) {
|
else if (ISUPPER(*s)) {
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
return str;
|
|
||||||
|
if (modify) return str;
|
||||||
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1576,11 +1583,13 @@ rb_str_capitalize_bang(str)
|
||||||
VALUE str;
|
VALUE str;
|
||||||
{
|
{
|
||||||
char *s, *send;
|
char *s, *send;
|
||||||
|
int modify = 0;
|
||||||
|
|
||||||
rb_str_modify(str);
|
rb_str_modify(str);
|
||||||
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
|
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
|
||||||
if (ISLOWER(*s)) {
|
if (ISLOWER(*s)) {
|
||||||
*s = toupper(*s);
|
*s = toupper(*s);
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
while (++s < send) {
|
while (++s < send) {
|
||||||
if (ismbchar(*s)) {
|
if (ismbchar(*s)) {
|
||||||
|
@ -1588,9 +1597,11 @@ rb_str_capitalize_bang(str)
|
||||||
}
|
}
|
||||||
else if (ISUPPER(*s)) {
|
else if (ISUPPER(*s)) {
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return str;
|
if (modify) return str;
|
||||||
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1607,6 +1618,7 @@ rb_str_swapcase_bang(str)
|
||||||
VALUE str;
|
VALUE str;
|
||||||
{
|
{
|
||||||
char *s, *send;
|
char *s, *send;
|
||||||
|
int modify = 0;
|
||||||
|
|
||||||
rb_str_modify(str);
|
rb_str_modify(str);
|
||||||
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
|
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
|
||||||
|
@ -1616,14 +1628,17 @@ rb_str_swapcase_bang(str)
|
||||||
}
|
}
|
||||||
else if (ISUPPER(*s)) {
|
else if (ISUPPER(*s)) {
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
else if (ISLOWER(*s)) {
|
else if (ISLOWER(*s)) {
|
||||||
*s = toupper(*s);
|
*s = toupper(*s);
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
if (modify) return str;
|
||||||
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1675,7 +1690,7 @@ trnext(t)
|
||||||
|
|
||||||
static VALUE rb_str_delete_bang _((int,VALUE*,VALUE));
|
static VALUE rb_str_delete_bang _((int,VALUE*,VALUE));
|
||||||
|
|
||||||
static void
|
static VALUE
|
||||||
tr_trans(str, src, repl, sflag)
|
tr_trans(str, src, repl, sflag)
|
||||||
VALUE str, src, repl;
|
VALUE str, src, repl;
|
||||||
int sflag;
|
int sflag;
|
||||||
|
@ -1683,7 +1698,7 @@ tr_trans(str, src, repl, sflag)
|
||||||
struct tr trsrc, trrepl;
|
struct tr trsrc, trrepl;
|
||||||
int cflag = 0;
|
int cflag = 0;
|
||||||
int trans[256];
|
int trans[256];
|
||||||
int i, c;
|
int i, c, modify = 0;
|
||||||
char *s, *send;
|
char *s, *send;
|
||||||
|
|
||||||
rb_str_modify(str);
|
rb_str_modify(str);
|
||||||
|
@ -1695,8 +1710,7 @@ tr_trans(str, src, repl, sflag)
|
||||||
}
|
}
|
||||||
if (TYPE(repl) != T_STRING) repl = rb_str_to_str(repl);
|
if (TYPE(repl) != T_STRING) repl = rb_str_to_str(repl);
|
||||||
if (RSTRING(repl)->len == 0) {
|
if (RSTRING(repl)->len == 0) {
|
||||||
rb_str_delete_bang(1, &src, str);
|
return rb_str_delete_bang(1, &src, str);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
trrepl.p = RSTRING(repl)->ptr;
|
trrepl.p = RSTRING(repl)->ptr;
|
||||||
trrepl.pend = trrepl.p + RSTRING(repl)->len;
|
trrepl.pend = trrepl.p + RSTRING(repl)->len;
|
||||||
|
@ -1743,6 +1757,7 @@ tr_trans(str, src, repl, sflag)
|
||||||
if (last == c) continue;
|
if (last == c) continue;
|
||||||
last = c;
|
last = c;
|
||||||
*t++ = c & 0xff;
|
*t++ = c & 0xff;
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
last = -1;
|
last = -1;
|
||||||
|
@ -1751,6 +1766,7 @@ tr_trans(str, src, repl, sflag)
|
||||||
}
|
}
|
||||||
if (RSTRING(str)->len > (t - RSTRING(str)->ptr)) {
|
if (RSTRING(str)->len > (t - RSTRING(str)->ptr)) {
|
||||||
RSTRING(str)->len = (t - RSTRING(str)->ptr);
|
RSTRING(str)->len = (t - RSTRING(str)->ptr);
|
||||||
|
modify = 1;
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1758,18 +1774,21 @@ tr_trans(str, src, repl, sflag)
|
||||||
while (s < send) {
|
while (s < send) {
|
||||||
if ((c = trans[*s & 0xff]) >= 0) {
|
if ((c = trans[*s & 0xff]) >= 0) {
|
||||||
*s = c & 0xff;
|
*s = c & 0xff;
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modify) return str;
|
||||||
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_str_tr_bang(str, src, repl)
|
rb_str_tr_bang(str, src, repl)
|
||||||
VALUE str, src, repl;
|
VALUE str, src, repl;
|
||||||
{
|
{
|
||||||
tr_trans(str, src, repl, 0);
|
return tr_trans(str, src, repl, 0);
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1823,6 +1842,7 @@ rb_str_delete_bang(argc, argv, str)
|
||||||
{
|
{
|
||||||
char *s, *send, *t;
|
char *s, *send, *t;
|
||||||
char squeez[256];
|
char squeez[256];
|
||||||
|
int modify = 0;
|
||||||
int init = 1;
|
int init = 1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1839,14 +1859,17 @@ rb_str_delete_bang(argc, argv, str)
|
||||||
s = t = RSTRING(str)->ptr;
|
s = t = RSTRING(str)->ptr;
|
||||||
send = s + RSTRING(str)->len;
|
send = s + RSTRING(str)->len;
|
||||||
while (s < send) {
|
while (s < send) {
|
||||||
if (!squeez[*s & 0xff])
|
if (squeez[*s & 0xff])
|
||||||
|
modify = 1;
|
||||||
|
else
|
||||||
*t++ = *s;
|
*t++ = *s;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
RSTRING(str)->len = t - RSTRING(str)->ptr;
|
RSTRING(str)->len = t - RSTRING(str)->ptr;
|
||||||
|
|
||||||
return str;
|
if (modify) return str;
|
||||||
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1868,7 +1891,7 @@ rb_str_squeeze_bang(argc, argv, str)
|
||||||
{
|
{
|
||||||
char squeez[256];
|
char squeez[256];
|
||||||
char *s, *send, *t;
|
char *s, *send, *t;
|
||||||
int c, save;
|
int c, save, modify = 0;
|
||||||
int init = 1;
|
int init = 1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1889,6 +1912,7 @@ rb_str_squeeze_bang(argc, argv, str)
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_str_modify(str);
|
rb_str_modify(str);
|
||||||
|
|
||||||
s = t = RSTRING(str)->ptr;
|
s = t = RSTRING(str)->ptr;
|
||||||
send = s + RSTRING(str)->len;
|
send = s + RSTRING(str)->len;
|
||||||
save = -1;
|
save = -1;
|
||||||
|
@ -1901,9 +1925,11 @@ rb_str_squeeze_bang(argc, argv, str)
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
if (t - RSTRING(str)->ptr != RSTRING(str)->len) {
|
if (t - RSTRING(str)->ptr != RSTRING(str)->len) {
|
||||||
RSTRING(str)->len = t - RSTRING(str)->ptr;
|
RSTRING(str)->len = t - RSTRING(str)->ptr;
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
if (modify) return str;
|
||||||
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1921,8 +1947,7 @@ static VALUE
|
||||||
rb_str_tr_s_bang(str, src, repl)
|
rb_str_tr_s_bang(str, src, repl)
|
||||||
VALUE str, src, repl;
|
VALUE str, src, repl;
|
||||||
{
|
{
|
||||||
tr_trans(str, src, repl, 1);
|
return tr_trans(str, src, repl, 1);
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -2212,8 +2237,9 @@ rb_str_chop_bang(str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
return str;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -2280,8 +2306,9 @@ rb_str_chomp_bang(argc, argv, str)
|
||||||
memcmp(RSTRING(rs)->ptr, p+len-rslen, rslen) == 0)) {
|
memcmp(RSTRING(rs)->ptr, p+len-rslen, rslen) == 0)) {
|
||||||
RSTRING(str)->len -= rslen;
|
RSTRING(str)->len -= rslen;
|
||||||
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
return str;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -2308,7 +2335,7 @@ rb_f_chomp(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
VALUE *argv;
|
VALUE *argv;
|
||||||
{
|
{
|
||||||
VALUE str = rb_str_dup(uscore_get());;
|
VALUE str = rb_str_dup(uscore_get());
|
||||||
|
|
||||||
rb_str_chomp_bang(argc, argv, str);
|
rb_str_chomp_bang(argc, argv, str);
|
||||||
rb_lastline_set(str);
|
rb_lastline_set(str);
|
||||||
|
@ -2344,6 +2371,10 @@ rb_str_strip_bang(str)
|
||||||
else if (t < e) {
|
else if (t < e) {
|
||||||
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2396,20 +2427,27 @@ rb_str_scan(str, pat)
|
||||||
{
|
{
|
||||||
VALUE result;
|
VALUE result;
|
||||||
long start = 0;
|
long start = 0;
|
||||||
|
VALUE match = Qnil;
|
||||||
|
|
||||||
pat = get_pat(pat);
|
pat = get_pat(pat);
|
||||||
if (!rb_iterator_p()) {
|
if (!rb_iterator_p()) {
|
||||||
VALUE ary = rb_ary_new();
|
VALUE ary = rb_ary_new();
|
||||||
|
|
||||||
while (!NIL_P(result = scan_once(str, pat, &start))) {
|
while (!NIL_P(result = scan_once(str, pat, &start))) {
|
||||||
|
match = rb_backref_get();
|
||||||
rb_ary_push(ary, result);
|
rb_ary_push(ary, result);
|
||||||
}
|
}
|
||||||
|
rb_backref_set(match);
|
||||||
return ary;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!NIL_P(result = scan_once(str, pat, &start))) {
|
while (!NIL_P(result = scan_once(str, pat, &start))) {
|
||||||
|
match = rb_backref_get();
|
||||||
|
rb_match_busy(match);
|
||||||
rb_yield(result);
|
rb_yield(result);
|
||||||
|
rb_backref_set(match);
|
||||||
}
|
}
|
||||||
|
rb_backref_set(match);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.5.2"
|
#define RUBY_VERSION "1.5.2"
|
||||||
#define RUBY_RELEASE_DATE "2000-02-02"
|
#define RUBY_RELEASE_DATE "2000-02-08"
|
||||||
#define RUBY_VERSION_CODE 152
|
#define RUBY_VERSION_CODE 152
|
||||||
#define RUBY_RELEASE_CODE 20000202
|
#define RUBY_RELEASE_CODE 20000208
|
||||||
|
|
Loading…
Add table
Reference in a new issue