diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-03-06 08:17:54 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-03-06 08:17:54 +0000 |
commit | a36e0c78c90917c4d5cc78f67b3808913795f264 (patch) | |
tree | 81deaaa0cacb33bd81163aac0a358755c85df2cd /missing | |
parent | 4a7d313e4a263f5c2f2f42dd573fa612f0d0c0a7 (diff) | |
download | ruby-a36e0c78c90917c4d5cc78f67b3808913795f264.tar.gz |
* 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
Diffstat (limited to 'missing')
-rw-r--r-- | missing/dir.h | 65 | ||||
-rw-r--r-- | missing/finite.c | 2 | ||||
-rw-r--r-- | missing/isinf.c | 2 | ||||
-rw-r--r-- | missing/isnan.c | 2 | ||||
-rw-r--r-- | missing/memcmp.c | 5 | ||||
-rw-r--r-- | missing/memmove.c | 32 | ||||
-rw-r--r-- | missing/os2.c | 2 | ||||
-rw-r--r-- | missing/strcasecmp.c | 6 | ||||
-rw-r--r-- | missing/strchr.c | 57 | ||||
-rw-r--r-- | missing/strerror.c | 8 | ||||
-rw-r--r-- | missing/strncasecmp.c | 5 | ||||
-rw-r--r-- | missing/strstr.c | 83 | ||||
-rw-r--r-- | missing/strtol.c | 89 | ||||
-rw-r--r-- | missing/x68.c | 2 |
14 files changed, 93 insertions, 267 deletions
diff --git a/missing/dir.h b/missing/dir.h deleted file mode 100644 index 830239b3ea..0000000000 --- a/missing/dir.h +++ /dev/null @@ -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 */ diff --git a/missing/finite.c b/missing/finite.c index 07fe3263e9..f91035a8cd 100644 --- a/missing/finite.c +++ b/missing/finite.c @@ -1,3 +1,5 @@ +/* public domain rewrite of finite(3) */ + int finite(n) double n; diff --git a/missing/isinf.c b/missing/isinf.c index e0cd6ac1a2..38772ba4f1 100644 --- a/missing/isinf.c +++ b/missing/isinf.c @@ -1,3 +1,5 @@ +/* public domain rewrite of isinf(3) */ + #ifdef __osf__ #define _IEEE 1 diff --git a/missing/isnan.c b/missing/isnan.c index 3c56765807..df424c2e61 100644 --- a/missing/isnan.c +++ b/missing/isnan.c @@ -1,3 +1,5 @@ +/* public domain rewrite of isnan(3) */ + #ifdef _MSC_VER #include <float.h> diff --git a/missing/memcmp.c b/missing/memcmp.c index 762eaf5260..9edc9c13b9 100644 --- a/missing/memcmp.c +++ b/missing/memcmp.c @@ -1,7 +1,4 @@ -/* - * memcmp --- compare memories. - * - */ +/* public domain rewrite of memcmp(3) */ int memcmp(s1,s2,len) diff --git a/missing/memmove.c b/missing/memmove.c index 09e64702b6..7961c5c0e6 100644 --- a/missing/memmove.c +++ b/missing/memmove.c @@ -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; } diff --git a/missing/os2.c b/missing/os2.c index aeb181f648..57798ab54c 100644 --- a/missing/os2.c +++ b/missing/os2.c @@ -1,3 +1,5 @@ +/* os/2 compatibility functions -- follows Ruby's lisence */ + #include "ruby.h" #include <stdio.h> #include <stdlib.h> diff --git a/missing/strcasecmp.c b/missing/strcasecmp.c index ba7bf78ea4..fddb8385be 100644 --- a/missing/strcasecmp.c +++ b/missing/strcasecmp.c @@ -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); } diff --git a/missing/strchr.c b/missing/strchr.c index 50714c9942..82f3cc96b0 100644 --- a/missing/strchr.c +++ b/missing/strchr.c @@ -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; - - for (; *str; str++) - if (*str == c) - save = str; + char *save = 0; - return (char *) save; + while (*s) { + if (*s == c) + save = s; + s++; + } + return save; } diff --git a/missing/strerror.c b/missing/strerror.c index 44013b3892..c1bf6feff8 100644 --- a/missing/strerror.c +++ b/missing/strerror.c @@ -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; } diff --git a/missing/strncasecmp.c b/missing/strncasecmp.c index c136703415..a4cc5828b8 100644 --- a/missing/strncasecmp.c +++ b/missing/strncasecmp.c @@ -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; } diff --git a/missing/strstr.c b/missing/strstr.c index c54349983e..1673518f06 100644 --- a/missing/strstr.c +++ b/missing/strstr.c @@ -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; - - /* First scan quickly through the two strings looking for a - * single-character match. When it's found, then compare the - * rest of the substring. - */ + char *hend; + char *a, *b; - 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; } diff --git a/missing/strtol.c b/missing/strtol.c index 4941f43b91..e94aa54ca0 100644 --- a/missing/strtol.c +++ b/missing/strtol.c @@ -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; - - /* - * Skip any leading blanks. - */ + long result; + char *p = nptr; - 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); + } + else { + if (*p == '+') p++; + result = strtoul(p, endptr, base); } - if ((result == 0) && (endPtr != 0) && (*endPtr == p)) { - *endPtr = string; + if (endptr != 0 && *endptr == p) { + *endptr = nptr; } return result; } diff --git a/missing/x68.c b/missing/x68.c index 9a8f0a2a9c..08bce8778c 100644 --- a/missing/x68.c +++ b/missing/x68.c @@ -1,3 +1,5 @@ +/* x68 compatibility functions -- follows Ruby's lisence */ + #include "config.h" #if !HAVE_SELECT |