mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (primary): rescue and ensure clauses should be allowed
to appear in singleton method body. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4a7d313e4a
commit
a36e0c78c9
20 changed files with 171 additions and 314 deletions
|
@ -1,7 +1,14 @@
|
||||||
|
Tue Mar 6 10:50:29 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (primary): rescue and ensure clauses should be allowed
|
||||||
|
to appear in singleton method body.
|
||||||
|
|
||||||
Mon Mar 5 17:25:13 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Mar 5 17:25:13 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (proc_eq): compare Procs using blocktag equality.
|
* eval.c (proc_eq): compare Procs using blocktag equality.
|
||||||
|
|
||||||
|
* eval.c (proc_to_s): stringify according to block tag address.
|
||||||
|
|
||||||
Mon Mar 5 17:19:56 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
Mon Mar 5 17:19:56 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* win32/win32.c (gettimeofday): use GetLocalTime() instead of ftime()
|
* win32/win32.c (gettimeofday): use GetLocalTime() instead of ftime()
|
||||||
|
|
1
MANIFEST
1
MANIFEST
|
@ -163,7 +163,6 @@ misc/rubydb2x.el
|
||||||
misc/rubydb3x.el
|
misc/rubydb3x.el
|
||||||
missing/alloca.c
|
missing/alloca.c
|
||||||
missing/crypt.c
|
missing/crypt.c
|
||||||
missing/dir.h
|
|
||||||
missing/dup2.c
|
missing/dup2.c
|
||||||
missing/file.h
|
missing/file.h
|
||||||
missing/finite.c
|
missing/finite.c
|
||||||
|
|
1
ToDo
1
ToDo
|
@ -44,6 +44,7 @@ Hacking Interpreter
|
||||||
* warn for inconsistent local variable usage (lv m and method m at the same time).
|
* warn for inconsistent local variable usage (lv m and method m at the same time).
|
||||||
* MicroRuby
|
* MicroRuby
|
||||||
* Built-in Interactive Ruby.
|
* Built-in Interactive Ruby.
|
||||||
|
* trap every method invocation, which can be enabled by e.g. trap_call :method.
|
||||||
|
|
||||||
Standard Libraries
|
Standard Libraries
|
||||||
|
|
||||||
|
|
50
eval.c
50
eval.c
|
@ -1457,19 +1457,15 @@ ev_const_get(cref, id)
|
||||||
}
|
}
|
||||||
cbase = cbase->nd_next;
|
cbase = cbase->nd_next;
|
||||||
}
|
}
|
||||||
#if 1
|
|
||||||
return rb_const_get(ruby_class, id);
|
|
||||||
#else
|
|
||||||
return rb_const_get(cref->nd_clss, id);
|
return rb_const_get(cref->nd_clss, id);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
ev_const_set(cref, id, val)
|
ev_const_set(cref, id, val)
|
||||||
NODE *cref;
|
NODE *cref;
|
||||||
ID id;
|
ID id;
|
||||||
VALUE val;
|
VALUE val;
|
||||||
{
|
{
|
||||||
NODE *cbase = cref;
|
NODE *cbase = cref;
|
||||||
|
|
||||||
while (cbase && cbase->nd_clss != rb_cObject) {
|
while (cbase && cbase->nd_clss != rb_cObject) {
|
||||||
|
@ -1483,11 +1479,11 @@ ev_const_get(cref, id)
|
||||||
}
|
}
|
||||||
rb_const_assign(cbase->nd_clss, id, val);
|
rb_const_assign(cbase->nd_clss, id, val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_mod_nesting()
|
rb_mod_nesting()
|
||||||
{
|
{
|
||||||
NODE *cbase = RNODE(ruby_frame->cbase);
|
NODE *cbase = RNODE(ruby_frame->cbase);
|
||||||
VALUE ary = rb_ary_new();
|
VALUE ary = rb_ary_new();
|
||||||
|
|
||||||
|
@ -1496,11 +1492,11 @@ ev_const_get(cref, id)
|
||||||
cbase = cbase->nd_next;
|
cbase = cbase->nd_next;
|
||||||
}
|
}
|
||||||
return ary;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_mod_s_constants()
|
rb_mod_s_constants()
|
||||||
{
|
{
|
||||||
NODE *cbase = RNODE(ruby_frame->cbase);
|
NODE *cbase = RNODE(ruby_frame->cbase);
|
||||||
VALUE ary = rb_ary_new();
|
VALUE ary = rb_ary_new();
|
||||||
|
|
||||||
|
@ -6362,6 +6358,23 @@ proc_eq(self, other)
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
proc_to_s(self, other)
|
||||||
|
VALUE self, other;
|
||||||
|
{
|
||||||
|
struct BLOCK *data;
|
||||||
|
char *cname = rb_class2name(CLASS_OF(self));
|
||||||
|
VALUE str;
|
||||||
|
|
||||||
|
Data_Get_Struct(self, struct BLOCK, data);
|
||||||
|
str = rb_str_new(0, strlen(cname)+6+16+1); /* 6:tags 16:addr 1:eos */
|
||||||
|
sprintf(RSTRING(str)->ptr, "#<%s:0x%lx>", cname, data->tag);
|
||||||
|
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
||||||
|
if (OBJ_TAINTED(self)) OBJ_TAINT(str);
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
block_pass(self, node)
|
block_pass(self, node)
|
||||||
VALUE self;
|
VALUE self;
|
||||||
|
@ -6780,6 +6793,7 @@ Init_Proc()
|
||||||
rb_define_method(rb_cProc, "arity", proc_arity, 0);
|
rb_define_method(rb_cProc, "arity", proc_arity, 0);
|
||||||
rb_define_method(rb_cProc, "[]", proc_call, -2);
|
rb_define_method(rb_cProc, "[]", proc_call, -2);
|
||||||
rb_define_method(rb_cProc, "==", proc_eq, 1);
|
rb_define_method(rb_cProc, "==", proc_eq, 1);
|
||||||
|
rb_define_method(rb_cProc, "to_s", proc_to_s, 0);
|
||||||
rb_define_global_function("proc", rb_f_lambda, 0);
|
rb_define_global_function("proc", rb_f_lambda, 0);
|
||||||
rb_define_global_function("lambda", rb_f_lambda, 0);
|
rb_define_global_function("lambda", rb_f_lambda, 0);
|
||||||
rb_define_global_function("binding", rb_f_binding, 0);
|
rb_define_global_function("binding", rb_f_binding, 0);
|
||||||
|
@ -7181,15 +7195,15 @@ void
|
||||||
rb_thread_fd_close(fd)
|
rb_thread_fd_close(fd)
|
||||||
int fd;
|
int fd;
|
||||||
{
|
{
|
||||||
rb_thread_t th, curr = curr_thread;
|
rb_thread_t th;
|
||||||
|
|
||||||
FOREACH_THREAD_FROM(curr, th) {
|
FOREACH_THREAD(th) {
|
||||||
if ((th->wait_for & WAIT_FD) && fd == th->fd) {
|
if ((th->wait_for & WAIT_FD) && fd == th->fd) {
|
||||||
VALUE exc = rb_exc_new2(rb_eIOError, "stream closed");
|
VALUE exc = rb_exc_new2(rb_eIOError, "stream closed");
|
||||||
rb_thread_raise(1, &exc, th);
|
rb_thread_raise(1, &exc, th);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_FOREACH_FROM(curr, th);
|
END_FOREACH(th);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
/* $RCSfile: dir.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:22:10 $
|
|
||||||
*
|
|
||||||
* (C) Copyright 1987, 1990 Diomidis Spinellis.
|
|
||||||
*
|
|
||||||
* You may distribute under the terms of either the GNU General Public
|
|
||||||
* License or the Artistic License, as specified in the README file.
|
|
||||||
*
|
|
||||||
* $Log: dir.h,v $
|
|
||||||
* Revision 4.0.1.1 91/06/07 11:22:10 lwall
|
|
||||||
* patch4: new copyright notice
|
|
||||||
*
|
|
||||||
* Revision 4.0 91/03/20 01:34:20 lwall
|
|
||||||
* 4.0 baseline.
|
|
||||||
*
|
|
||||||
* Revision 3.0.1.1 90/03/27 16:07:08 lwall
|
|
||||||
* patch16: MSDOS support
|
|
||||||
*
|
|
||||||
* Revision 1.1 90/03/18 20:32:29 dds
|
|
||||||
* Initial revision
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* defines the type returned by the directory(3) functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __DIR_INCLUDED
|
|
||||||
#define __DIR_INCLUDED
|
|
||||||
|
|
||||||
#if !defined __MINGW32__
|
|
||||||
/*Directory entry size */
|
|
||||||
#ifdef DIRSIZ
|
|
||||||
#undef DIRSIZ
|
|
||||||
#endif
|
|
||||||
#define DIRSIZ(rp) (sizeof(struct direct))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Structure of a directory entry
|
|
||||||
*/
|
|
||||||
struct direct {
|
|
||||||
ino_t d_ino; /* inode number (not used by MS-DOS) */
|
|
||||||
int d_namlen; /* Name length */
|
|
||||||
char d_name[256]; /* file name */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _dir_struc { /* Structure used by dir operations */
|
|
||||||
char *start; /* Starting position */
|
|
||||||
char *curr; /* Current position */
|
|
||||||
long size; /* Size of string table */
|
|
||||||
long nfiles; /* number if filenames in table */
|
|
||||||
struct direct dirstr; /* Directory structure to return */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _dir_struc DIR; /* Type returned by dir operations */
|
|
||||||
|
|
||||||
DIR *cdecl opendir(char *filename);
|
|
||||||
struct direct *readdir(DIR *dirp);
|
|
||||||
long telldir(DIR *dirp);
|
|
||||||
void seekdir(DIR *dirp,long loc);
|
|
||||||
void rewinddir(DIR *dirp);
|
|
||||||
void closedir(DIR *dirp);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif /* __DIR_INCLUDED */
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* public domain rewrite of finite(3) */
|
||||||
|
|
||||||
int
|
int
|
||||||
finite(n)
|
finite(n)
|
||||||
double n;
|
double n;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* public domain rewrite of isinf(3) */
|
||||||
|
|
||||||
#ifdef __osf__
|
#ifdef __osf__
|
||||||
|
|
||||||
#define _IEEE 1
|
#define _IEEE 1
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* public domain rewrite of isnan(3) */
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
/*
|
/* public domain rewrite of memcmp(3) */
|
||||||
* memcmp --- compare memories.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
int
|
||||||
memcmp(s1,s2,len)
|
memcmp(s1,s2,len)
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
/*
|
/* public domain rewrite of memcmp(3) */
|
||||||
* memmove --- move memories.
|
|
||||||
*
|
|
||||||
* We supply this routine for those systems that aren't standard yet.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
memmove (dst, src, n)
|
memmove (dst, src, n)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* os/2 compatibility functions -- follows Ruby's lisence */
|
||||||
|
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
|
/* public domain rewrite of strcasecmp(3) */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
strcasecmp(p1, p2)
|
strcasecmp(p1, p2)
|
||||||
char *p1, *p2;
|
char *p1, *p2;
|
||||||
{
|
{
|
||||||
for ( ; *p1 && *p2; p1++, p2++) {
|
while (*p1 && *p2) {
|
||||||
if (toupper(*p1) != toupper(*p2))
|
if (toupper(*p1) != toupper(*p2))
|
||||||
return toupper(*p1) - toupper(*p2);
|
return toupper(*p1) - toupper(*p2);
|
||||||
|
p1++;
|
||||||
|
p2++;
|
||||||
}
|
}
|
||||||
return strlen(p1) - strlen(p2);
|
return strlen(p1) - strlen(p2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +1,30 @@
|
||||||
/*
|
/* public domain rewrite of strchr(3) and strrchr(3) */
|
||||||
* strchr --- search a string for a character
|
|
||||||
*
|
|
||||||
* We supply this routine for those systems that aren't standard yet.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strchr(str, c)
|
strchr(s, c)
|
||||||
register const char *str, c;
|
char *s;
|
||||||
|
int c;
|
||||||
{
|
{
|
||||||
if (c == '\0') {
|
if (c == 0) return s + strlen(s);
|
||||||
/* thanks to Mike Brennan ... */
|
while (*s) {
|
||||||
do {
|
if (*s == c)
|
||||||
if (*str == c)
|
return s;
|
||||||
return (char *) str;
|
s++;
|
||||||
} while (*str++);
|
|
||||||
} else {
|
|
||||||
for (; *str; str++)
|
|
||||||
if (*str == c)
|
|
||||||
return (char *) str;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* strrchr --- find the last occurrence of a character in a string
|
|
||||||
*
|
|
||||||
* We supply this routine for those systems that aren't standard yet.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strrchr(str, c)
|
strrchr(s, c)
|
||||||
register const char *str, c;
|
char *s;
|
||||||
|
int c;
|
||||||
{
|
{
|
||||||
register const char *save = NULL;
|
char *save = 0;
|
||||||
|
|
||||||
for (; *str; str++)
|
while (*s) {
|
||||||
if (*str == c)
|
if (*s == c)
|
||||||
save = str;
|
save = s;
|
||||||
|
s++;
|
||||||
return (char *) save;
|
}
|
||||||
|
return save;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
/*
|
/* public domain rewrite of strerror(3) */
|
||||||
* strerror.c --- Map an integer error number into a printable string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int sys_nerr;
|
extern int sys_nerr;
|
||||||
extern char *sys_errlist[];
|
extern char *sys_errlist[];
|
||||||
|
@ -11,9 +9,9 @@ char *
|
||||||
strerror(error)
|
strerror(error)
|
||||||
int error;
|
int error;
|
||||||
{
|
{
|
||||||
if ((error <= sys_nerr) && (error > 0)) {
|
if (error <= sys_nerr && error > 0) {
|
||||||
return sys_errlist[error];
|
return sys_errlist[error];
|
||||||
}
|
}
|
||||||
sprintf (msg, "Unknown error (%d)", error);
|
sprintf(msg, "Unknown error (%d)", error);
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* public domain rewrite of strncasecmp(3) */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -6,13 +8,14 @@ strncasecmp(p1, p2, len)
|
||||||
char *p2;
|
char *p2;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
for (; len != 0; len--, p1++, p2++) {
|
while (len != 0) {
|
||||||
if (toupper(*p1) != toupper(*p2)) {
|
if (toupper(*p1) != toupper(*p2)) {
|
||||||
return toupper(*p1) - toupper(*p2);
|
return toupper(*p1) - toupper(*p2);
|
||||||
}
|
}
|
||||||
if (*p1 == '\0') {
|
if (*p1 == '\0') {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
len--; p1++; p2++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,73 +1,26 @@
|
||||||
/*
|
/* public domain rewrite of strstr(3) */
|
||||||
* strstr.c --
|
|
||||||
*
|
|
||||||
* Source code for the "strstr" library routine.
|
|
||||||
*
|
|
||||||
* Copyright 1988-1991 Regents of the University of California
|
|
||||||
* Permission to use, copy, modify, and distribute this
|
|
||||||
* software and its documentation for any purpose and without
|
|
||||||
* fee is hereby granted, provided that the above copyright
|
|
||||||
* notice appears in all copies. The University of California
|
|
||||||
* makes no representations about the suitability of this
|
|
||||||
* software for any purpose. It is provided "as is" without
|
|
||||||
* express or implied warranty.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static char rcsid[] = "$Header$ SPRITE (Berkeley)";
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
/*
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* strstr --
|
|
||||||
*
|
|
||||||
* Locate the first instance of a substring in a string.
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* If string contains substring, the return value is the
|
|
||||||
* location of the first matching instance of substring
|
|
||||||
* in string. If string doesn't contain substring, the
|
|
||||||
* return value is 0. Matching is done on an exact
|
|
||||||
* character-for-character basis with no wildcards or special
|
|
||||||
* characters.
|
|
||||||
*
|
|
||||||
* Side effects:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strstr(string, substring)
|
strstr(haystack, needle)
|
||||||
register char *string; /* String to search. */
|
char *haystack, *needle;
|
||||||
char *substring; /* Substring to try to find in string. */
|
|
||||||
{
|
{
|
||||||
register char *a, *b;
|
char *hend;
|
||||||
|
char *a, *b;
|
||||||
|
|
||||||
/* First scan quickly through the two strings looking for a
|
if (*needle == 0) return haystack;
|
||||||
* single-character match. When it's found, then compare the
|
hend = haystack + strlen(haystack) - strlen(needle) + 1;
|
||||||
* rest of the substring.
|
while (haystack < hend) {
|
||||||
*/
|
if (*haystack == *needle) {
|
||||||
|
a = haystack;
|
||||||
b = substring;
|
b = needle;
|
||||||
if (*b == 0) {
|
for (;;) {
|
||||||
return string;
|
if (*b == 0) return haystack;
|
||||||
}
|
|
||||||
for ( ; *string != 0; string += 1) {
|
|
||||||
if (*string != *b) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
a = string;
|
|
||||||
while (1) {
|
|
||||||
if (*b == 0) {
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
if (*a++ != *b++) {
|
if (*a++ != *b++) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b = substring;
|
|
||||||
}
|
}
|
||||||
return (char *) 0;
|
haystack++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,84 +1,29 @@
|
||||||
/*
|
/* public domain rewrite of strtol(3) */
|
||||||
* strtol.c --
|
|
||||||
*
|
|
||||||
* Source code for the "strtol" library procedure.
|
|
||||||
*
|
|
||||||
* Copyright 1988 Regents of the University of California
|
|
||||||
* Permission to use, copy, modify, and distribute this
|
|
||||||
* software and its documentation for any purpose and without
|
|
||||||
* fee is hereby granted, provided that the above copyright
|
|
||||||
* notice appear in all copies. The University of California
|
|
||||||
* makes no representations about the suitability of this
|
|
||||||
* software for any purpose. It is provided "as is" without
|
|
||||||
* express or implied warranty.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
long
|
||||||
/*
|
strtol(nptr, endptr, base)
|
||||||
*----------------------------------------------------------------------
|
char *nptr;
|
||||||
*
|
char **endptr;
|
||||||
* strtol --
|
int base;
|
||||||
*
|
|
||||||
* Convert an ASCII string into an integer.
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* The return value is the integer equivalent of string. If endPtr
|
|
||||||
* is non-NULL, then *endPtr is filled in with the character
|
|
||||||
* after the last one that was part of the integer. If string
|
|
||||||
* doesn't contain a valid integer value, then zero is returned
|
|
||||||
* and *endPtr is set to string.
|
|
||||||
*
|
|
||||||
* Side effects:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
*----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
long int
|
|
||||||
strtol(string, endPtr, base)
|
|
||||||
char *string; /* String of ASCII digits, possibly
|
|
||||||
* preceded by white space. For bases
|
|
||||||
* greater than 10, either lower- or
|
|
||||||
* upper-case digits may be used.
|
|
||||||
*/
|
|
||||||
char **endPtr; /* Where to store address of terminating
|
|
||||||
* character, or NULL. */
|
|
||||||
int base; /* Base for conversion. Must be less
|
|
||||||
* than 37. If 0, then the base is chosen
|
|
||||||
* from the leading characters of string:
|
|
||||||
* "0x" means hex, "0" means octal, anything
|
|
||||||
* else means decimal.
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
register char *p;
|
long result;
|
||||||
int result;
|
char *p = nptr;
|
||||||
|
|
||||||
/*
|
|
||||||
* Skip any leading blanks.
|
|
||||||
*/
|
|
||||||
|
|
||||||
p = string;
|
|
||||||
while (isspace(*p)) {
|
while (isspace(*p)) {
|
||||||
p += 1;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Check for a sign.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (*p == '-') {
|
if (*p == '-') {
|
||||||
p += 1;
|
p++;
|
||||||
result = -(strtoul(p, endPtr, base));
|
result = -strtoul(p, endptr, base);
|
||||||
} else {
|
|
||||||
if (*p == '+') {
|
|
||||||
p += 1;
|
|
||||||
}
|
}
|
||||||
result = strtoul(p, endPtr, base);
|
else {
|
||||||
|
if (*p == '+') p++;
|
||||||
|
result = strtoul(p, endptr, base);
|
||||||
}
|
}
|
||||||
if ((result == 0) && (endPtr != 0) && (*endPtr == p)) {
|
if (endptr != 0 && *endptr == p) {
|
||||||
*endPtr = string;
|
*endptr = nptr;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* x68 compatibility functions -- follows Ruby's lisence */
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#if !HAVE_SELECT
|
#if !HAVE_SELECT
|
||||||
|
|
10
parse.y
10
parse.y
|
@ -1353,8 +1353,18 @@ primary : literal
|
||||||
}
|
}
|
||||||
f_arglist
|
f_arglist
|
||||||
compstmt
|
compstmt
|
||||||
|
rescue
|
||||||
|
opt_else
|
||||||
|
ensure
|
||||||
kEND
|
kEND
|
||||||
{
|
{
|
||||||
|
if ($9) $8 = NEW_RESCUE($8, $9, $10);
|
||||||
|
else if ($10) {
|
||||||
|
rb_warn("else without rescue is useless");
|
||||||
|
$8 = block_append($8, $10);
|
||||||
|
}
|
||||||
|
if ($11) $8 = NEW_ENSURE($8, $11);
|
||||||
|
|
||||||
$$ = NEW_DEFS($2, $5, $7, $8);
|
$$ = NEW_DEFS($2, $5, $7, $8);
|
||||||
fixpos($$, $2);
|
fixpos($$, $2);
|
||||||
local_pop();
|
local_pop();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.7.0"
|
#define RUBY_VERSION "1.7.0"
|
||||||
#define RUBY_RELEASE_DATE "2001-03-05"
|
#define RUBY_RELEASE_DATE "2001-03-06"
|
||||||
#define RUBY_VERSION_CODE 170
|
#define RUBY_VERSION_CODE 170
|
||||||
#define RUBY_RELEASE_CODE 20010305
|
#define RUBY_RELEASE_CODE 20010306
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue