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,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
|
||||
finite(n)
|
||||
double n;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* public domain rewrite of isinf(3) */
|
||||
|
||||
#ifdef __osf__
|
||||
|
||||
#define _IEEE 1
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* public domain rewrite of isnan(3) */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <float.h>
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* memcmp --- compare memories.
|
||||
*
|
||||
*/
|
||||
/* public domain rewrite of memcmp(3) */
|
||||
|
||||
int
|
||||
memcmp(s1,s2,len)
|
||||
|
|
|
@ -1,24 +1,20 @@
|
|||
/*
|
||||
* memmove --- move memories.
|
||||
*
|
||||
* We supply this routine for those systems that aren't standard yet.
|
||||
*/
|
||||
/* public domain rewrite of memcmp(3) */
|
||||
|
||||
char *
|
||||
memmove (dst, src, n)
|
||||
char *dst, *src;
|
||||
int n;
|
||||
char *dst, *src;
|
||||
int n;
|
||||
{
|
||||
char *ret = dst;
|
||||
char *ret = dst;
|
||||
|
||||
if (src < dst) {
|
||||
src += n;
|
||||
dst += n;
|
||||
while (n--)
|
||||
*--dst = *--src;
|
||||
}
|
||||
else if (dst < src)
|
||||
while (n--)
|
||||
*dst++ = *src++;
|
||||
return ret;
|
||||
if (src < dst) {
|
||||
src += n;
|
||||
dst += n;
|
||||
while (n--)
|
||||
*--dst = *--src;
|
||||
}
|
||||
else if (dst < src)
|
||||
while (n--)
|
||||
*dst++ = *src++;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* os/2 compatibility functions -- follows Ruby's lisence */
|
||||
|
||||
#include "ruby.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
/* public domain rewrite of strcasecmp(3) */
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
int
|
||||
strcasecmp(p1, p2)
|
||||
char *p1, *p2;
|
||||
{
|
||||
for ( ; *p1 && *p2; p1++, p2++) {
|
||||
while (*p1 && *p2) {
|
||||
if (toupper(*p1) != toupper(*p2))
|
||||
return toupper(*p1) - toupper(*p2);
|
||||
p1++;
|
||||
p2++;
|
||||
}
|
||||
return strlen(p1) - strlen(p2);
|
||||
}
|
||||
|
|
|
@ -1,45 +1,30 @@
|
|||
/*
|
||||
* strchr --- search a string for a character
|
||||
*
|
||||
* We supply this routine for those systems that aren't standard yet.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
/* public domain rewrite of strchr(3) and strrchr(3) */
|
||||
|
||||
char *
|
||||
strchr(str, c)
|
||||
register const char *str, c;
|
||||
strchr(s, c)
|
||||
char *s;
|
||||
int c;
|
||||
{
|
||||
if (c == '\0') {
|
||||
/* thanks to Mike Brennan ... */
|
||||
do {
|
||||
if (*str == c)
|
||||
return (char *) str;
|
||||
} while (*str++);
|
||||
} else {
|
||||
for (; *str; str++)
|
||||
if (*str == c)
|
||||
return (char *) str;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
if (c == 0) return s + strlen(s);
|
||||
while (*s) {
|
||||
if (*s == c)
|
||||
return s;
|
||||
s++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* strrchr --- find the last occurrence of a character in a string
|
||||
*
|
||||
* We supply this routine for those systems that aren't standard yet.
|
||||
*/
|
||||
|
||||
char *
|
||||
strrchr(str, c)
|
||||
register const char *str, c;
|
||||
strrchr(s, c)
|
||||
char *s;
|
||||
int c;
|
||||
{
|
||||
register const char *save = NULL;
|
||||
char *save = 0;
|
||||
|
||||
for (; *str; str++)
|
||||
if (*str == c)
|
||||
save = str;
|
||||
|
||||
return (char *) save;
|
||||
while (*s) {
|
||||
if (*s == c)
|
||||
save = s;
|
||||
s++;
|
||||
}
|
||||
return save;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* strerror.c --- Map an integer error number into a printable string.
|
||||
*/
|
||||
/* public domain rewrite of strerror(3) */
|
||||
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
@ -11,9 +9,9 @@ char *
|
|||
strerror(error)
|
||||
int error;
|
||||
{
|
||||
if ((error <= sys_nerr) && (error > 0)) {
|
||||
if (error <= sys_nerr && error > 0) {
|
||||
return sys_errlist[error];
|
||||
}
|
||||
sprintf (msg, "Unknown error (%d)", error);
|
||||
sprintf(msg, "Unknown error (%d)", error);
|
||||
return msg;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* public domain rewrite of strncasecmp(3) */
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
int
|
||||
|
@ -6,13 +8,14 @@ strncasecmp(p1, p2, len)
|
|||
char *p2;
|
||||
int len;
|
||||
{
|
||||
for (; len != 0; len--, p1++, p2++) {
|
||||
while (len != 0) {
|
||||
if (toupper(*p1) != toupper(*p2)) {
|
||||
return toupper(*p1) - toupper(*p2);
|
||||
}
|
||||
if (*p1 == '\0') {
|
||||
return 0;
|
||||
}
|
||||
len--; p1++; p2++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,73 +1,26 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
/* public domain rewrite of strstr(3) */
|
||||
|
||||
char *
|
||||
strstr(string, substring)
|
||||
register char *string; /* String to search. */
|
||||
char *substring; /* Substring to try to find in string. */
|
||||
strstr(haystack, needle)
|
||||
char *haystack, *needle;
|
||||
{
|
||||
register char *a, *b;
|
||||
char *hend;
|
||||
char *a, *b;
|
||||
|
||||
/* First scan quickly through the two strings looking for a
|
||||
* single-character match. When it's found, then compare the
|
||||
* rest of the substring.
|
||||
*/
|
||||
|
||||
b = substring;
|
||||
if (*b == 0) {
|
||||
return string;
|
||||
}
|
||||
for ( ; *string != 0; string += 1) {
|
||||
if (*string != *b) {
|
||||
continue;
|
||||
}
|
||||
a = string;
|
||||
while (1) {
|
||||
if (*b == 0) {
|
||||
return string;
|
||||
}
|
||||
if (*a++ != *b++) {
|
||||
break;
|
||||
if (*needle == 0) return haystack;
|
||||
hend = haystack + strlen(haystack) - strlen(needle) + 1;
|
||||
while (haystack < hend) {
|
||||
if (*haystack == *needle) {
|
||||
a = haystack;
|
||||
b = needle;
|
||||
for (;;) {
|
||||
if (*b == 0) return haystack;
|
||||
if (*a++ != *b++) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
b = substring;
|
||||
haystack++;
|
||||
}
|
||||
return (char *) 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,84 +1,29 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/* public domain rewrite of strtol(3) */
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* strtol --
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
long
|
||||
strtol(nptr, endptr, base)
|
||||
char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
{
|
||||
register char *p;
|
||||
int result;
|
||||
long result;
|
||||
char *p = nptr;
|
||||
|
||||
/*
|
||||
* Skip any leading blanks.
|
||||
*/
|
||||
|
||||
p = string;
|
||||
while (isspace(*p)) {
|
||||
p += 1;
|
||||
p++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for a sign.
|
||||
*/
|
||||
|
||||
if (*p == '-') {
|
||||
p += 1;
|
||||
result = -(strtoul(p, endPtr, base));
|
||||
} else {
|
||||
if (*p == '+') {
|
||||
p += 1;
|
||||
}
|
||||
result = strtoul(p, endPtr, base);
|
||||
p++;
|
||||
result = -strtoul(p, endptr, base);
|
||||
}
|
||||
if ((result == 0) && (endPtr != 0) && (*endPtr == p)) {
|
||||
*endPtr = string;
|
||||
else {
|
||||
if (*p == '+') p++;
|
||||
result = strtoul(p, endptr, base);
|
||||
}
|
||||
if (endptr != 0 && *endptr == p) {
|
||||
*endptr = nptr;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* x68 compatibility functions -- follows Ruby's lisence */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if !HAVE_SELECT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue