* lib/memchr.c, lib/stpcpy.c, lib/strndup.c, lib/strnlen.c:

New, from fileutils 4.0.37.
* configure.in: Require Autoconf 2.49c.  I took some time before
making this decision.  This is the only way out for portability
issues in Bison, it would mean way too much duplicate effort to
import in Bison features implemented in 2.49c since 2.13.
AC_REPLACE_FUNCS and AC_CHECK_DECLS the functions above.
This commit is contained in:
Akim Demaille
2001-02-08 14:32:10 +00:00
parent 0d8f3c8a7a
commit 18569462db
23 changed files with 5993 additions and 2848 deletions

View File

@@ -1,3 +1,13 @@
2001-02-08 Akim Demaille <akim@epita.fr>
* lib/memchr.c, lib/stpcpy.c, lib/strndup.c, lib/strnlen.c:
New, from fileutils 4.0.37.
* configure.in: Require Autoconf 2.49c. I took some time before
making this decision. This is the only way out for portability
issues in Bison, it would mean way too much duplicate effort to
import in Bison features implemented in 2.49c since 2.13.
AC_REPLACE_FUNCS and AC_CHECK_DECLS the functions above.
2001-02-02 Akim Demaille <akim@epita.fr>
* lib/malloc.c, lib/realloc.c: New, from the fileutils 4.0.37.

View File

@@ -1,211 +1,236 @@
/* config.hin. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define if you have alloca, as a function or macro. */
/* Define if using `alloca.c'. */
#undef C_ALLOCA
/* Define to 1 if NLS is requested. */
#undef ENABLE_NLS
/* Define if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you have a working `mmap' system call. */
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define as 1 if you have `catgets' and don't want to use GNU gettext. */
#undef HAVE_CATGETS
/* Define if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define if backslash-a works in C strings. */
#undef HAVE_C_BACKSLASH_A
/* Define if you have the `dcgettext' function. */
#undef HAVE_DCGETTEXT
/* Define to 1 if you have the declaration of `memchr', and to 0 if you don't.
*/
#undef HAVE_DECL_MEMCHR
/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
*/
#undef HAVE_DECL_STPCPY
/* Define to 1 if you have the declaration of `strndup', and to 0 if you
don't. */
#undef HAVE_DECL_STRNDUP
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
don't. */
#undef HAVE_DECL_STRNLEN
/* Define if the malloc check has been performed. */
#undef HAVE_DONE_WORKING_MALLOC_CHECK
/* Define if the realloc check has been performed. */
#undef HAVE_DONE_WORKING_REALLOC_CHECK
/* Define if you have the `doprnt' function. */
#undef HAVE_DOPRNT
/* Define if you have the `getcwd' function. */
#undef HAVE_GETCWD
/* Define if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
/* Define to 1 if you have gettext and don't want to use GNU gettext. */
#undef HAVE_GETTEXT
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the `isascii' function. */
#undef HAVE_ISASCII
/* Define if you have the `iswprint' function. */
#undef HAVE_ISWPRINT
/* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define if you have the `i' library (-li). */
#undef HAVE_LIBI
/* Define if you have the `intl' library (-lintl). */
#undef HAVE_LIBINTL
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the `mbrtowc' function. */
#undef HAVE_MBRTOWC
/* Define if you have the `memchr' function. */
#undef HAVE_MEMCHR
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the `mkstemp' function. */
#undef HAVE_MKSTEMP
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define if you have the `munmap' function. */
#undef HAVE_MUNMAP
/* Define if on MINIX. */
#undef _MINIX
/* Define if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define if you have the `putenv' function. */
#undef HAVE_PUTENV
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `stpcpy' function. */
#undef HAVE_STPCPY
/* Define if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
/* Define if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define if you have the `strerror_r' function. */
#undef HAVE_STRERROR_R
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the `strndup' function. */
#undef HAVE_STRNDUP
/* Define if you have the `strnlen' function. */
#undef HAVE_STRNLEN
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the `vprintf' function. */
#undef HAVE_VPRINTF
/* Define if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define if you have the `__argz_count' function. */
#undef HAVE___ARGZ_COUNT
/* Define if you have the `__argz_next' function. */
#undef HAVE___ARGZ_NEXT
/* Define if you have the `__argz_stringify' function. */
#undef HAVE___ARGZ_STRINGIFY
/* Name of package */
#undef PACKAGE
/* Define if compiler has function prototypes */
#undef PROTOTYPES
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
/* Define if you have the __argz_next function. */
#undef HAVE___ARGZ_NEXT
/* Define if you have the __argz_stringify function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define if you have the dcgettext function. */
#undef HAVE_DCGETTEXT
/* Define if you have the doprnt function. */
#undef HAVE_DOPRNT
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the isascii function. */
#undef HAVE_ISASCII
/* Define if you have the iswprint function. */
#undef HAVE_ISWPRINT
/* Define if you have the mbrtowc function. */
#undef HAVE_MBRTOWC
/* Define if you have the mkstemp function. */
#undef HAVE_MKSTEMP
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the setenv function. */
#undef HAVE_SETENV
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the strerror_r function. */
#undef HAVE_STRERROR_R
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define if you have the i library (-li). */
#undef HAVE_LIBI
/* Define if you have the intl library (-lintl). */
#undef HAVE_LIBINTL
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
/* Define to 1 for GNU C library extensions. */
#undef _GNU_SOURCE
/* Define if compiler has function prototypes */
#undef PROTOTYPES
/* Define if on MINIX. */
#undef _MINIX
/* Define if the malloc check has been performed. */
#undef HAVE_DONE_WORKING_MALLOC_CHECK
/* Define if the system does not provide POSIX.1 features except with this
defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
#undef inline
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define if the realloc check has been performed. */
#undef HAVE_DONE_WORKING_REALLOC_CHECK
/* Define to a type if <wchar.h> does not define. */
#undef mbstate_t
/* Define to `long' if <sys/types.h> does not define. */
#undef off_t
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc
/* Define if backslash-a works in C strings. */
#undef HAVE_C_BACKSLASH_A
/* Define to a type if <wchar.h> does not define. */
#undef mbstate_t
/* Define if compiler has function prototypes */
#undef PROTOTYPES
/* Define to 1 if you have the `stpcpy' function. */
#undef HAVE_STPCPY
/* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define to 1 if NLS is requested. */
#undef ENABLE_NLS
/* Define to 1 if you have gettext and don't want to use GNU gettext. */
#undef HAVE_GETTEXT
/* Define as 1 if you have `catgets' and don't want to use GNU gettext. */
#undef HAVE_CATGETS
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t

7950
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.13)
AC_PREREQ(2.49c)
AC_INIT(src/reduce.c)
AM_INIT_AUTOMAKE(bison, 1.28a)
AM_CONFIG_HEADER(config.h:config.hin)
@@ -64,6 +64,8 @@ AM_C_PROTOTYPES
# Checks for library functions.
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(mkstemp setlocale)
AC_CHECK_DECLS([stpcpy, strndup, strnlen, memchr])
AC_REPLACE_FUNCS(stpcpy strndup strnlen memchr)
jm_FUNC_MALLOC
jm_FUNC_REALLOC
jm_PREREQ_QUOTEARG

View File

@@ -6,6 +6,11 @@ noinst_LIBRARIES = libbison.a
INCLUDES = -I.. -I$(srcdir) -I../intl
# Heck, we are still using an old version of Automake which does not
# understand LIBOBJ additions using $objext...
EXTRA_DIST = malloc.c realloc.c
libbison_a_SOURCES = \
error.c error.h \
getopt.h getopt.c getopt1.c \

View File

@@ -98,6 +98,11 @@ noinst_LIBRARIES = libbison.a
INCLUDES = -I.. -I$(srcdir) -I../intl
# Heck, we are still using an old version of Automake which does not
# understand LIBOBJ additions using $objext...
EXTRA_DIST = malloc.c realloc.c
libbison_a_SOURCES = error.c error.h getopt.h getopt.c getopt1.c obstack.h obstack.c quote.h quote.c quotearg.h quotearg.c xalloc.h xmalloc.c xstrdup.c
@@ -121,7 +126,8 @@ CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in alloca.c ansi2knr.1 ansi2knr.c
DIST_COMMON = Makefile.am Makefile.in alloca.c ansi2knr.1 ansi2knr.c \
memchr.c stpcpy.c strndup.c strnlen.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -129,7 +135,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/alloca.P .deps/error.P .deps/getopt.P .deps/getopt1.P \
.deps/obstack.P .deps/quote.P .deps/quotearg.P .deps/xmalloc.P \
.deps/memchr.P .deps/obstack.P .deps/quote.P .deps/quotearg.P \
.deps/stpcpy.P .deps/strndup.P .deps/strnlen.P .deps/xmalloc.P \
.deps/xstrdup.P
SOURCES = $(libbison_a_SOURCES)
OBJECTS = $(libbison_a_OBJECTS)
@@ -204,18 +211,27 @@ getopt_.c: getopt.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt_.c
getopt1_.c: getopt1.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt1_.c
memchr_.c: memchr.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memchr.c; then echo $(srcdir)/memchr.c; else echo memchr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memchr_.c
obstack_.c: obstack.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > obstack_.c
quote_.c: quote.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quote.c; then echo $(srcdir)/quote.c; else echo quote.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > quote_.c
quotearg_.c: quotearg.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > quotearg_.c
stpcpy_.c: stpcpy.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > stpcpy_.c
strndup_.c: strndup.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strndup_.c
strnlen_.c: strnlen.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strnlen.c; then echo $(srcdir)/strnlen.c; else echo strnlen.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strnlen_.c
xmalloc_.c: xmalloc.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xmalloc.c; then echo $(srcdir)/xmalloc.c; else echo xmalloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xmalloc_.c
xstrdup_.c: xstrdup.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrdup.c; then echo $(srcdir)/xstrdup.c; else echo xstrdup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrdup_.c
alloca_.o error_.o getopt_.o getopt1_.o obstack_.o quote_.o quotearg_.o \
xmalloc_.o xstrdup_.o : $(ANSI2KNR)
alloca_.o error_.o getopt_.o getopt1_.o memchr_.o obstack_.o quote_.o \
quotearg_.o stpcpy_.o strndup_.o strnlen_.o xmalloc_.o xstrdup_.o : \
$(ANSI2KNR)
tags: TAGS

216
lib/memchr.c Normal file
View File

@@ -0,0 +1,216 @@
/* Copyright (C) 1991,93,96,97,99,2000 Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
with help from Dan Sahlin (dan@sics.se) and
commentary by Jim Blandy (jimb@ai.mit.edu);
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
and implemented by Roland McGrath (roland@ai.mit.edu).
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#undef __ptr_t
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
# define __ptr_t void *
#else /* Not C++ or ANSI C. */
# define __ptr_t char *
#endif /* C++ or ANSI C. */
#if defined _LIBC
# include <string.h>
# include <memcopy.h>
#else
# define reg_char char
#endif
#if HAVE_STDLIB_H || defined _LIBC
# include <stdlib.h>
#endif
#if HAVE_LIMITS_H || defined _LIBC
# include <limits.h>
#endif
#define LONG_MAX_32_BITS 2147483647
#ifndef LONG_MAX
# define LONG_MAX LONG_MAX_32_BITS
#endif
#include <sys/types.h>
#if HAVE_BP_SYM_H || defined _LIBC
# include <bp-sym.h>
#else
# define BP_SYM(sym) sym
#endif
#undef memchr
#undef __memchr
/* Search no more than N bytes of S for C. */
__ptr_t
__memchr (s, c_in, n)
const __ptr_t s;
int c_in;
size_t n;
{
const unsigned char *char_ptr;
const unsigned long int *longword_ptr;
unsigned long int longword, magic_bits, charmask;
unsigned reg_char c;
c = (unsigned char) c_in;
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
for (char_ptr = (const unsigned char *) s;
n > 0 && ((unsigned long int) char_ptr
& (sizeof (longword) - 1)) != 0;
--n, ++char_ptr)
if (*char_ptr == c)
return (__ptr_t) char_ptr;
/* All these elucidatory comments refer to 4-byte longwords,
but the theory applies equally well to 8-byte longwords. */
longword_ptr = (unsigned long int *) char_ptr;
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
the "holes." Note that there is a hole just to the left of
each byte, with an extra at the end:
bits: 01111110 11111110 11111110 11111111
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
if (sizeof (longword) != 4 && sizeof (longword) != 8)
abort ();
#if LONG_MAX <= LONG_MAX_32_BITS
magic_bits = 0x7efefeff;
#else
magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
#endif
/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
charmask |= charmask << 16;
#if LONG_MAX > LONG_MAX_32_BITS
charmask |= charmask << 32;
#endif
/* Instead of the traditional loop which tests each character,
we will test a longword at a time. The tricky part is testing
if *any of the four* bytes in the longword in question are zero. */
while (n >= sizeof (longword))
{
/* We tentatively exit the loop if adding MAGIC_BITS to
LONGWORD fails to change any of the hole bits of LONGWORD.
1) Is this safe? Will it catch all the zero bytes?
Suppose there is a byte with all zeros. Any carry bits
propagating from its left will fall into the hole at its
least significant bit and stop. Since there will be no
carry from its most significant bit, the LSB of the
byte to the left will be unchanged, and the zero will be
detected.
2) Is this worthwhile? Will it ignore everything except
zero bytes? Suppose every byte of LONGWORD has a bit set
somewhere. There will be a carry into bit 8. If bit 8
is set, this will carry into bit 16. If bit 8 is clear,
one of bits 9-15 must be set, so there will be a carry
into bit 16. Similarly, there will be a carry into bit
24. If one of bits 24-30 is set, there will be a carry
into bit 31, so all of the hole bits will be changed.
The one misfire occurs when bits 24-30 are clear and bit
31 is set; in this case, the hole at bit 31 is not
changed. If we had access to the processor carry flag,
we could close this loophole by putting the fourth hole
at bit 32!
So it ignores everything except 128's, when they're aligned
properly.
3) But wait! Aren't we looking for C, not zero?
Good point. So what we do is XOR LONGWORD with a longword,
each of whose bytes is C. This turns each byte that is C
into a zero. */
longword = *longword_ptr++ ^ charmask;
/* Add MAGIC_BITS to LONGWORD. */
if ((((longword + magic_bits)
/* Set those bits that were unchanged by the addition. */
^ ~longword)
/* Look at only the hole bits. If any of the hole bits
are unchanged, most likely one of the bytes was a
zero. */
& ~magic_bits) != 0)
{
/* Which of the bytes was C? If none of them were, it was
a misfire; continue the search. */
const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
if (cp[0] == c)
return (__ptr_t) cp;
if (cp[1] == c)
return (__ptr_t) &cp[1];
if (cp[2] == c)
return (__ptr_t) &cp[2];
if (cp[3] == c)
return (__ptr_t) &cp[3];
#if LONG_MAX > 2147483647
if (cp[4] == c)
return (__ptr_t) &cp[4];
if (cp[5] == c)
return (__ptr_t) &cp[5];
if (cp[6] == c)
return (__ptr_t) &cp[6];
if (cp[7] == c)
return (__ptr_t) &cp[7];
#endif
}
n -= sizeof (longword);
}
char_ptr = (const unsigned char *) longword_ptr;
while (n-- > 0)
{
if (*char_ptr == c)
return (__ptr_t) char_ptr;
else
++char_ptr;
}
return 0;
}
#ifdef weak_alias
weak_alias (__memchr, BP_SYM (memchr))
#endif

50
lib/stpcpy.c Normal file
View File

@@ -0,0 +1,50 @@
/* stpcpy.c -- copy a string and return pointer to end of new string
Copyright (C) 1992, 1995, 1997, 1998 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h>
#undef __stpcpy
#undef stpcpy
#ifndef weak_alias
# define __stpcpy stpcpy
#endif
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
char *
__stpcpy (char *dest, const char *src)
{
register char *d = dest;
register const char *s = src;
do
*d++ = *s;
while (*s++ != '\0');
return d - 1;
}
#ifdef weak_alias
weak_alias (__stpcpy, stpcpy)
#endif

62
lib/strndup.c Normal file
View File

@@ -0,0 +1,62 @@
/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <sys/types.h>
#if defined _LIBC || defined STDC_HEADERS
# include <stdlib.h>
# include <string.h>
#else
char *malloc ();
#endif
#ifndef HAVE_DECL_STRNLEN
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_STRNLEN
size_t strnlen ();
#endif
#undef __strndup
#undef strndup
#ifndef weak_alias
# define __strndup strndup
#endif
char *
__strndup (const char *s, size_t n)
{
size_t len = strnlen (s, n);
char *new = malloc (len + 1);
if (new == NULL)
return NULL;
new[len] = '\0';
return (char *) memcpy (new, s, len);
}
#ifdef weak_alias
weak_alias (__strndup, strndup)
#endif

58
lib/strnlen.c Normal file
View File

@@ -0,0 +1,58 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#else
# include <strings.h>
#endif
#ifndef HAVE_DECL_MEMCHR
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_MEMCHR
char *memchr ();
#endif
#undef __strnlen
#undef strnlen
#ifndef weak_alias
# define __strnlen strnlen
#endif
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
size_t
__strnlen (const char *string, size_t maxlen)
{
const char *end = memchr (string, '\0', maxlen);
return end ? end - string : maxlen;
}
#ifdef weak_alias
weak_alias (__strnlen, strnlen)
#endif

BIN
po/de.gmo

Binary file not shown.

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.25\n"
"POT-Creation-Date: 2001-02-01 17:25+0100\n"
"POT-Creation-Date: 2001-02-08 15:32+0100\n"
"PO-Revision-Date: 1996-10-10 17:54 MET DST\n"
"Last-Translator: Ulrich Drepper <drepper@gnu.ai.mit.edu>\n"
"Language-Team: German <de@li.org>\n"
@@ -735,7 +735,9 @@ msgstr "%s: die Option
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: die Option »--%s« erlaubt kein Argument\n"
#: lib/obstack.c:477
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/obstack.c:477 lib/xmalloc.c:66
#, fuzzy
msgid "memory exhausted"
msgstr "%s: Hauptspeicher erschöpft\n"
@@ -762,12 +764,9 @@ msgstr ""
msgid "'"
msgstr ""
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/xmalloc.c:66
#, fuzzy
msgid "Memory exhausted"
msgstr "%s: Hauptspeicher erschöpft\n"
#~ msgid "Memory exhausted"
#~ msgstr "%s: Hauptspeicher erschöpft\n"
#~ msgid "$%s is invalid"
#~ msgstr "$%s ist unzulässig"

View File

@@ -30,7 +30,7 @@
msgid ""
msgstr ""
"Project-Id-Version: GNU bison 1.25\n"
"POT-Creation-Date: 2001-02-01 17:25+0100\n"
"POT-Creation-Date: 2001-02-08 15:32+0100\n"
"PO-Revision-Date: 1998-09-21 10:19+0200\n"
"Last-Translator: Nicolás García-Pedrajas <ngarcia-pedrajas@acm.org>\n"
"Language-Team: Spanish <es@li.org>\n"
@@ -863,7 +863,9 @@ msgstr "%s: la opci
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: la opción `--%s' no admite ningún argumento\n"
#: lib/obstack.c:477
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/obstack.c:477 lib/xmalloc.c:66
#, fuzzy
msgid "memory exhausted"
msgstr "%s: memoria agotada\n"
@@ -890,12 +892,9 @@ msgstr ""
msgid "'"
msgstr ""
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/xmalloc.c:66
#, fuzzy
msgid "Memory exhausted"
msgstr "%s: memoria agotada\n"
#~ msgid "Memory exhausted"
#~ msgstr "%s: memoria agotada\n"
#~ msgid "$%s is invalid"
#~ msgstr "$%s no es válida"

BIN
po/et.gmo

Binary file not shown.

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.25\n"
"POT-Creation-Date: 2001-02-01 17:25+0100\n"
"POT-Creation-Date: 2001-02-08 15:32+0100\n"
"PO-Revision-Date: 2000-04-11 22:19+02:00\n"
"Last-Translator: Toomas Soome <tsoome@ut.ee>\n"
"Language-Team: Estonian <et@li.org>\n"
@@ -754,7 +754,9 @@ msgstr "%s: v
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: võti `-W %s' ei luba argumenti\n"
#: lib/obstack.c:477
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/obstack.c:477 lib/xmalloc.c:66
#, fuzzy
msgid "memory exhausted"
msgstr "%s: mälu on otsas\n"
@@ -781,12 +783,9 @@ msgstr ""
msgid "'"
msgstr ""
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/xmalloc.c:66
#, fuzzy
msgid "Memory exhausted"
msgstr "%s: mälu on otsas\n"
#~ msgid "Memory exhausted"
#~ msgstr "%s: mälu on otsas\n"
#~ msgid "$%s is invalid"
#~ msgstr "$%s on vigane"

BIN
po/fr.gmo

Binary file not shown.

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.25\n"
"POT-Creation-Date: 2001-02-01 17:25+0100\n"
"POT-Creation-Date: 2001-02-08 15:32+0100\n"
"PO-Revision-Date: 1996-03-19 20:05 EST\n"
"Last-Translator: Dominique Boucher <boucherd@IRO.UMontreal.CA>\n"
"Language-Team: French <fr@li.org>\n"
@@ -739,7 +739,9 @@ msgstr "%s: l'option %s est ambig
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: l'option --%s n'admet pas de paramètre\n"
#: lib/obstack.c:477
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/obstack.c:477 lib/xmalloc.c:66
#, fuzzy
msgid "memory exhausted"
msgstr "%s: mémoire épuisée\n"
@@ -766,12 +768,9 @@ msgstr ""
msgid "'"
msgstr ""
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/xmalloc.c:66
#, fuzzy
msgid "Memory exhausted"
msgstr "%s: mémoire épuisée\n"
#~ msgid "Memory exhausted"
#~ msgstr "%s: mémoire épuisée\n"
#~ msgid "$%s is invalid"
#~ msgstr "$%s n'est pas valide"

BIN
po/ja.gmo

Binary file not shown.

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: GNU bison 1.28\n"
"POT-Creation-Date: 2001-02-01 17:25+0100\n"
"POT-Creation-Date: 2001-02-08 15:32+0100\n"
"PO-Revision-Date: 1999-09-28 21:10+0900\n"
"Last-Translator: Daisuke Yamashita <yamad@mb.infoweb.ne.jp>\n"
"Language-Team: Japanese <ja@li.org>\n"
@@ -737,7 +737,9 @@ msgstr "%s:
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: オプション `-W %s' は引数を許しません\n"
#: lib/obstack.c:477
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/obstack.c:477 lib/xmalloc.c:66
#, fuzzy
msgid "memory exhausted"
msgstr "%s: メモリを使い果たしました\n"
@@ -764,12 +766,9 @@ msgstr ""
msgid "'"
msgstr ""
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/xmalloc.c:66
#, fuzzy
msgid "Memory exhausted"
msgstr "%s: メモリを使い果たしました\n"
#~ msgid "Memory exhausted"
#~ msgstr "%s: メモリを使い果たしました\n"
#~ msgid "$%s is invalid"
#~ msgstr "$%s は無効です"

BIN
po/nl.gmo

Binary file not shown.

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.25\n"
"POT-Creation-Date: 2001-02-01 17:25+0100\n"
"POT-Creation-Date: 2001-02-08 15:32+0100\n"
"PO-Revision-Date: 1996-08-27 15:34 MET DST\n"
"Last-Translator: Erick Branderhorst <branderh@debian.org>\n"
"Language-Team: Dutch <nl@li.org>\n"
@@ -738,7 +738,9 @@ msgstr "%s: optie `%s' is niet eenduidig\n"
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: optie `--%s' staat geen argument toe\n"
#: lib/obstack.c:477
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/obstack.c:477 lib/xmalloc.c:66
#, fuzzy
msgid "memory exhausted"
msgstr "%s: geen geheugen meer beschikbaar\n"
@@ -765,12 +767,9 @@ msgstr ""
msgid "'"
msgstr ""
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/xmalloc.c:66
#, fuzzy
msgid "Memory exhausted"
msgstr "%s: geen geheugen meer beschikbaar\n"
#~ msgid "Memory exhausted"
#~ msgstr "%s: geen geheugen meer beschikbaar\n"
#~ msgid "$%s is invalid"
#~ msgstr "$%s is onjuist"

BIN
po/ru.gmo

Binary file not shown.

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.28a\n"
"POT-Creation-Date: 2001-02-01 17:25+0100\n"
"POT-Creation-Date: 2001-02-08 15:32+0100\n"
"PO-Revision-Date: 2000-04-12 13:16+04:00\n"
"Last-Translator: Dmitry S. Sivachenko <dima@Chg.RU>\n"
"Language-Team: Russian <ru@li.org>\n"
@@ -755,7 +755,9 @@ msgstr "%s:
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: ËÌÀÞ `-W %s' ÄÏÌÖÅÎ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ ÂÅÚ ÁÒÇÕÍÅÎÔÁ\n"
#: lib/obstack.c:477
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/obstack.c:477 lib/xmalloc.c:66
#, fuzzy
msgid "memory exhausted"
msgstr "%s: ÐÁÍÑÔØ ÉÓÞÅÒÐÁÎÁ\n"
@@ -782,12 +784,9 @@ msgstr ""
msgid "'"
msgstr ""
#. If XALLOC_FAIL_FUNC is NULL, or does return, display this message
#. before exiting when memory is exhausted. Goes through gettext.
#: lib/xmalloc.c:66
#, fuzzy
msgid "Memory exhausted"
msgstr "%s: ÐÁÍÑÔØ ÉÓÞÅÒÐÁÎÁ\n"
#~ msgid "Memory exhausted"
#~ msgstr "%s: ÐÁÍÑÔØ ÉÓÞÅÒÐÁÎÁ\n"
#~ msgid "$%s is invalid"
#~ msgstr "ÎÅ×ÅÒÎÙÊ ÚÎÁË $%s"