From 7152df6b9b3b95d93607127d853c02e03e42a327 Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 18 Sep 1999 04:48:51 +0000 Subject: [PATCH] 990918-repack git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 ++++- README | 2 +- eval.c | 2 + lib/e2mmap.rb | 2 +- lib/jcode.rb | 2 +- lib/telnet.rb | 96 ++++++++++++++++++++++---------------------- regex.c | 2 +- ruby.1 | 30 +++++++------- sample/goodfriday.rb | 19 +++++++-- version.h | 4 +- win32/win32.c | 11 ++++- 11 files changed, 107 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2ddb650853ca5..1b5fe5f6b9d2c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,16 @@ -Fri Sep 17 01:04:25 1999 Yukihiro Matsumoto +Sat Sep 18 13:45:43 1999 Yukihiro Matsumoto * stable version 1.4.2 released. +Fri Sep 17 23:24:17 1999 Katsuyuki Komatsu + + * eval.c (rb_f_missing): dumped core if no argument given. + +Fri Sep 17 23:21:06 1999 Katsuyuki Komatsu + + * win32/win32.c (myselect): translate WSAEINTR, WSAENOTSOCK into + UNIX errno constants. + Fri Sep 17 00:52:27 1999 Yukihiro Matsumoto * parse.y (arg): assignable() may return 0. diff --git a/README b/README index 2a99cae28bb184..2953cc98daab36 100644 --- a/README +++ b/README @@ -36,7 +36,7 @@ You can get it by anonymous CVS. How to check out is: There is a mailing list to talk about Ruby. To subscribe this list, please send the following phrase - subscribe Your-Last-Name Your-First-Name + subscribe YourFirstName YourFamilyName e.g. subscribe Joseph Smith diff --git a/eval.c b/eval.c index e207b37138533a..8d69936d03b708 100644 --- a/eval.c +++ b/eval.c @@ -3592,6 +3592,8 @@ rb_f_missing(argc, argv, obj) char *file = ruby_sourcefile; int line = ruby_sourceline; + if (argc == 0) rb_raise(rb_eArgError, "no id given"); + id = FIX2INT(argv[0]); argc--; argv++; diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb index e04ed4a5b4b885..2b023601d27308 100644 --- a/lib/e2mmap.rb +++ b/lib/e2mmap.rb @@ -177,7 +177,7 @@ class < @@ -154,6 +154,12 @@ == HISTORY +=== Version 0.40 + +1999/09/17 17:41:41 + +- bug fix: preprocess method + === Version 0.30 1999/09/14 23:09:05 @@ -392,8 +398,8 @@ class Telnet < SimpleDelegator EOL = CR + LF v = $-v $-v = false - VERSION = "0.30" - RELEASE_DATE = "$Date: 1999/09/14 23:09:05 $" + VERSION = "0.40" + RELEASE_DATE = "$Date: 1999/09/17 17:41:41 $" $-v = v def initialize(options) @@ -488,53 +494,47 @@ def preprocess(string) # combine EOL into "\n" str.gsub!(/#{EOL}/no, "\n") unless @options["Binmode"] - # respond to "IAC DO x" - str.gsub!(/([^#{IAC}]?)#{IAC}#{DO}([#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}])/no){ - if OPT_BINARY == $2 - @telnet_option["BINARY"] = true - @sock.write(IAC + WILL + OPT_BINARY) - else - @sock.write(IAC + WONT + $2) - end - $1 - } - - # respond to "IAC DON'T x" with "IAC WON'T x" - str.gsub!(/([^#{IAC}]?)#{IAC}#{DONT}([#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}])/no){ - @sock.write(IAC + WONT + $2) - $1 - } - - # respond to "IAC WILL x" - str.gsub!(/([^#{IAC}]?)#{IAC}#{WILL}([#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}])/no){ - if OPT_ECHO == $2 - @sock.write(IAC + DO + OPT_ECHO) - elsif OPT_SGA == $2 - @telnet_option["SGA"] = true - @sock.write(IAC + DO + OPT_SGA) - end - $1 - } - - # respond to "IAC WON'T x" - str.gsub!(/([^#{IAC}]?)#{IAC}#{WONT}([#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}])/no){ - if OPT_ECHO == $2 - @sock.write(IAC + DONT + OPT_ECHO) - elsif OPT_SGA == $2 - @telnet_option["SGA"] = false - @sock.write(IAC + DONT + OPT_SGA) + str.gsub!(/#{IAC}( + #{IAC}| + #{AYT}| + [#{DO}#{DONT}#{WILL}#{WONT}] + [#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}] + )/xno){ + if IAC == $1 # handle escaped IAC characters + IAC + elsif AYT == $1 # respond to "IAC AYT" (are you there) + @sock.write("nobody here but us pigeons" + EOL) + '' + elsif DO[0] == $1[0] # respond to "IAC DO x" + if OPT_BINARY[0] == $1[1] + @telnet_option["BINARY"] = true + @sock.write(IAC + WILL + OPT_BINARY) + else + @sock.write(IAC + WONT + $1[1..1]) + end + '' + elsif DONT[0] == $1[0] # respond to "IAC DON'T x" with "IAC WON'T x" + @sock.write(IAC + WONT + $1[1..1]) + '' + elsif WILL[0] == $1[0] # respond to "IAC WILL x" + if OPT_ECHO[0] == $1[1] + @sock.write(IAC + DO + OPT_ECHO) + elsif OPT_SGA[0] == $1[1] + @telnet_option["SGA"] = true + @sock.write(IAC + DO + OPT_SGA) + end + '' + elsif WONT[0] == $1[0] # respond to "IAC WON'T x" + if OPT_ECHO[0] == $1[1] + @sock.write(IAC + DONT + OPT_ECHO) + elsif OPT_SGA[0] == $1[1] + @telnet_option["SGA"] = false + @sock.write(IAC + DONT + OPT_SGA) + end + '' end - $1 } - # respond to "IAC AYT" (are you there) - str.gsub!(/([^#{IAC}]?)#{IAC}#{AYT}/no){ - @sock.write("nobody here but us pigeons" + EOL) - $1 - } - - str.gsub!(/#{IAC}#{IAC}/no, IAC) # handle escaped IAC characters - str end # preprocess diff --git a/regex.c b/regex.c index a68489c1df0ae2..ffc7acc5d14462 100644 --- a/regex.c +++ b/regex.c @@ -2186,7 +2186,7 @@ re_compile_pattern(pattern, size, bufp) pending_exact = b; BUFPUSH(0); } - if (had_num_literal && current_mbctype) { + if (had_num_literal || c == 0xff) { BUFPUSH(0xff); (*pending_exact)++; had_num_literal = 0; diff --git a/ruby.1 b/ruby.1 index 53b9b61378e87b..9fa429fbddaa35 100644 --- a/ruby.1 +++ b/ruby.1 @@ -33,14 +33,14 @@ ruby - Interpreted object-oriented scripting language .BI -e "command"\c ] [ \c .BI -F "pattern"\c - ] + ] [ \c .BI -i "[extension]"\c ] [ \c .BI -I "dir"\c ] [ \c .BI -r "library"\c - ] + ] [ \c .BI -S \c ] [ \c @@ -49,19 +49,19 @@ ruby - Interpreted object-oriented scripting language .BI -x "[directory]"\c ] [ \c .BI -X "directory"\c - ] [ \c -.BI -y \c -] + ] [ \c +.BI -y \c +] [ \c .BI -- \c ] [ programfile ] [ argument ] ... - + .SH PREFACE Ruby is an interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward, and extensible. -.PP +.PP If you want a language for easy object-oriented programming, or you don't like the Perl ugliness, or you do like the concept of lisp, but don't like too much parentheses, Ruby may be the language of your @@ -136,7 +136,7 @@ interpreter on-the-fly. .SH COMMAND LINE OPTIONS Ruby interpreter accepts following command-line options (switches). They are quite similar to those of Perl. -.TP +.TP .B -0[octal] specifies the input record separator ($/) as an octal number. If no digit is given, the null character is taken as the separator. Other @@ -149,7 +149,7 @@ turns on auto-split mode when used with -n or -p. In auto-split mode, Ruby executes .nf .ne 1 -\& $F = $_.split +\& $F = $_.split at beginning of each loop. .fi .TP @@ -165,7 +165,7 @@ prints the copyright notice. turns on debug mode. $DEBUG will set true. .TP .B -e command -specifies script from command-line while telling Ruby to not +specifies script from command-line while telling Ruby to not search argv for script filenames. .TP .B -F pattern @@ -206,7 +206,7 @@ causes Ruby to assume the following loop around your script, which makes it iterate over filename arguments somewhat like sed -n or awk. .nf -.ne 3 +.ne 3 \& while gets \& ... \& end @@ -232,7 +232,7 @@ any filename arguments (or before a --). Any switches found there are removed from ARGV and set the corresponding variable in the script. example: .nf -.ne 3 +.ne 3 \& #! /usr/local/bin/ruby -s \& # prints "true" if invoked with `-xyz' switch. \& print "true\en" if $xyz @@ -244,7 +244,7 @@ script, unless if its name begins with a slash. This is used to emulate #! on machines that don't support it, in the following manner: .nf -.ne 2 +.ne 2 \& #! /usr/local/bin/ruby \& # This line makes the next one a comment in ruby \e \& exec /usr/local/bin/ruby -S $0 $* @@ -262,7 +262,7 @@ messages if this variable is true. If this switch is given, and no other switches are present, Ruby quits after printing its version. .TP .B -T[level] -turns on taint checks at the specified level (default 1). +turns on taint checks at the specified level (default 1). .TP .B --version prints the version of Ruby interpreter. @@ -274,7 +274,7 @@ beginning. It set the `$VERBOSE' variable to true. .B -x[directory] tells Ruby that the script is embedded in a message. Leading garbage will be discarded until the first that starts with "#!" and contains -the string, "ruby". Any meaningful switches on that line will applied. +the string, "ruby". Any meaningful switches on that line will applied. The end of script must be specified with either EOF, ^D (control-D), ^Z (control-Z), or reserved word __END__.If the directory name is specified, Ruby will switch to that directory before executing script. diff --git a/sample/goodfriday.rb b/sample/goodfriday.rb index cc541af3f3ae15..f0027ec5ddaeca 100644 --- a/sample/goodfriday.rb +++ b/sample/goodfriday.rb @@ -1,12 +1,25 @@ #! /usr/local/bin/ruby # goodfriday.rb: Written by Tadayoshi Funaba 1998 -# $Id: goodfriday.rb,v 1.3 1999/08/04 14:54:18 tadf Exp $ +# $Id: goodfriday.rb,v 1.1 1998/03/08 09:44:44 tadf Exp $ require 'date2' -require 'holiday' -es = Date.easter(Date.today.year) +def easter(y) + g = (y % 19) + 1 + c = (y / 100) + 1 + x = (3 * c / 4) - 12 + z = ((8 * c + 5) / 25) - 5 + d = (5 * y / 4) - x - 10 + e = (11 * g + 20 + z - x) % 30 + e += 1 if e == 25 and g > 11 or e == 24 + n = 44 - e + n += 30 if n < 21 + n = n + 7 - ((d + n) % 7) + if n <= 31 then [y, 3, n] else [y, 4, n - 31] end +end + +es = Date.new3(*easter(Time.now.year)) [[-9*7, 'Septuagesima Sunday'], [-8*7, 'Sexagesima Sunday'], [-7*7, 'Quinquagesima Sunday (Shrove Sunday)'], diff --git a/version.h b/version.h index 3cf94bf47b3ec7..0d5ed1f1eb6017 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.4.2" -#define RUBY_RELEASE_DATE "1999-09-17" +#define RUBY_RELEASE_DATE "1999-09-18" #define RUBY_VERSION_CODE 142 -#define RUBY_RELEASE_CODE 19990917 +#define RUBY_RELEASE_CODE 19990918 diff --git a/win32/win32.c b/win32/win32.c index fd70242e9e3fc5..beb9545af1683d 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1828,8 +1828,17 @@ myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex, if (!NtSocketsInitialized++) { StartSockets(); } - if ((r = select (nfds, rd, wr, ex, timeout)) == SOCKET_ERROR) + if ((r = select (nfds, rd, wr, ex, timeout)) == SOCKET_ERROR) { errno = WSAGetLastError(); + switch (errno) { + case WSAEINTR: + errno = EINTR; + break; + case WSAENOTSOCK: + errno = EBADF; + break; + } + } return r; }