PERFORCE change 76799 for review
Marcel Moolenaar
marcel at FreeBSD.org
Tue May 10 16:37:12 PDT 2005
http://perforce.freebsd.org/chv.cgi?CH=76799
Change 76799 by marcel at marcel_nfs on 2005/05/10 23:36:16
IFC @76798
Affected files ...
.. //depot/projects/tty/UPDATING#16 integrate
.. //depot/projects/tty/gnu/lib/libregex/FREEBSD-upgrade#3 integrate
.. //depot/projects/tty/gnu/lib/libregex/Makefile#5 integrate
.. //depot/projects/tty/gnu/lib/libregex/config.h#1 branch
.. //depot/projects/tty/gnu/lib/libregex/posix/regex.h#3 integrate
.. //depot/projects/tty/gnu/lib/libregex/regcomp.c#1 branch
.. //depot/projects/tty/gnu/lib/libregex/regex.c#5 integrate
.. //depot/projects/tty/gnu/lib/libregex/regex_internal.c#1 branch
.. //depot/projects/tty/gnu/lib/libregex/regex_internal.h#1 branch
.. //depot/projects/tty/gnu/lib/libregex/regexec.c#1 branch
.. //depot/projects/tty/share/man/man4/Makefile#16 integrate
.. //depot/projects/tty/share/man/man4/man4.i386/acpi_asus.4#4 integrate
.. //depot/projects/tty/share/man/man4/mn.4#1 branch
.. //depot/projects/tty/share/misc/bsd-family-tree#10 integrate
.. //depot/projects/tty/sys/boot/pc98/boot2/io.c#5 integrate
.. //depot/projects/tty/sys/conf/files.pc98#16 integrate
.. //depot/projects/tty/sys/dev/acpi_support/acpi_asus.c#3 integrate
.. //depot/projects/tty/sys/dev/acpica/Osd/OsdSchedule.c#7 integrate
.. //depot/projects/tty/sys/dev/acpica/acpi.c#13 integrate
.. //depot/projects/tty/sys/dev/acpica/acpivar.h#13 integrate
.. //depot/projects/tty/sys/dev/ct/ct_isa.c#6 integrate
.. //depot/projects/tty/sys/dev/syscons/syscons.h#4 integrate
.. //depot/projects/tty/sys/dev/wl/if_wl.c#9 integrate
.. //depot/projects/tty/sys/dev/wl/if_wl_i82586.h#1 branch
.. //depot/projects/tty/sys/i386/i386/nexus.c#9 integrate
.. //depot/projects/tty/sys/i386/i386/vm_machdep.c#13 integrate
.. //depot/projects/tty/sys/i386/isa/atpic.c#6 integrate
.. //depot/projects/tty/sys/i386/isa/ic/if_wl_i82586.h#3 delete
.. //depot/projects/tty/sys/i386/isa/lptreg.h#2 delete
.. //depot/projects/tty/sys/i386/isa/npx.c#10 integrate
.. //depot/projects/tty/sys/i386/isa/prof_machdep.c#5 integrate
.. //depot/projects/tty/sys/i386/isa/spkr.c#9 integrate
.. //depot/projects/tty/sys/ia64/include/bus.h#10 integrate
.. //depot/projects/tty/sys/modules/acpi/acpi/Makefile#4 integrate
.. //depot/projects/tty/sys/modules/fdc/Makefile#4 integrate
.. //depot/projects/tty/sys/modules/pmc/Makefile#2 integrate
.. //depot/projects/tty/sys/modules/sio/Makefile#3 integrate
.. //depot/projects/tty/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#9 integrate
.. //depot/projects/tty/sys/netgraph/ng_nat.c#2 integrate
.. //depot/projects/tty/sys/nfsclient/nfs_socket.c#14 integrate
.. //depot/projects/tty/sys/pc98/cbus/30line.h#1 branch
.. //depot/projects/tty/sys/pc98/cbus/cbus.h#1 branch
.. //depot/projects/tty/sys/pc98/cbus/cbus_dma.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/clock.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/fdc.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/fdc_cbus.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/fdcreg.h#1 branch
.. //depot/projects/tty/sys/pc98/cbus/fdcvar.h#1 branch
.. //depot/projects/tty/sys/pc98/cbus/gdc.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/nmi.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/olpt.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/olptreg.h#1 branch
.. //depot/projects/tty/sys/pc98/cbus/pckbd.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/pmc.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/ppc.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/ppcreg.h#1 branch
.. //depot/projects/tty/sys/pc98/cbus/sc_machdep.h#1 branch
.. //depot/projects/tty/sys/pc98/cbus/scgdcrndr.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/scterm-sck.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/scvtb.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/sio.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/sio_cbus.c#1 branch
.. //depot/projects/tty/sys/pc98/cbus/syscons_cbus.c#1 branch
.. //depot/projects/tty/sys/pc98/i386/busio.s#4 delete
.. //depot/projects/tty/sys/pc98/i386/busiosubr.c#4 delete
.. //depot/projects/tty/sys/pc98/i386/machdep.c#14 delete
.. //depot/projects/tty/sys/pc98/pc98/30line.h#3 delete
.. //depot/projects/tty/sys/pc98/pc98/busio.s#1 branch
.. //depot/projects/tty/sys/pc98/pc98/busiosubr.c#1 branch
.. //depot/projects/tty/sys/pc98/pc98/clock.c#11 delete
.. //depot/projects/tty/sys/pc98/pc98/fd.c#10 delete
.. //depot/projects/tty/sys/pc98/pc98/fdc_cbus.c#2 delete
.. //depot/projects/tty/sys/pc98/pc98/fdcvar.h#2 delete
.. //depot/projects/tty/sys/pc98/pc98/fdreg.h#3 delete
.. //depot/projects/tty/sys/pc98/pc98/isa_dma.c#5 delete
.. //depot/projects/tty/sys/pc98/pc98/machdep.c#1 branch
.. //depot/projects/tty/sys/pc98/pc98/nmi.c#3 delete
.. //depot/projects/tty/sys/pc98/pc98/olpt.c#8 delete
.. //depot/projects/tty/sys/pc98/pc98/pc98.h#5 delete
.. //depot/projects/tty/sys/pc98/pc98/pc98_machdep.c#4 integrate
.. //depot/projects/tty/sys/pc98/pc98/pc98gdc.c#11 delete
.. //depot/projects/tty/sys/pc98/pc98/pc98kbd.c#6 delete
.. //depot/projects/tty/sys/pc98/pc98/pmc.c#3 delete
.. //depot/projects/tty/sys/pc98/pc98/ppc.c#7 delete
.. //depot/projects/tty/sys/pc98/pc98/ppcreg.h#2 delete
.. //depot/projects/tty/sys/pc98/pc98/sc_machdep.h#2 delete
.. //depot/projects/tty/sys/pc98/pc98/scgdcrndr.c#3 delete
.. //depot/projects/tty/sys/pc98/pc98/scterm-sck.c#4 delete
.. //depot/projects/tty/sys/pc98/pc98/scvtbpc98.c#3 delete
.. //depot/projects/tty/sys/pc98/pc98/sio.c#15 delete
.. //depot/projects/tty/sys/pc98/pc98/sio_cbus.c#4 delete
.. //depot/projects/tty/sys/pc98/pc98/syscons_pc98.c#4 delete
.. //depot/projects/tty/sys/pccard/pccard_nbk.c#6 integrate
.. //depot/projects/tty/usr.bin/make/GNode.h#2 integrate
.. //depot/projects/tty/usr.bin/make/Makefile#6 integrate
.. //depot/projects/tty/usr.bin/make/arch.c#4 integrate
.. //depot/projects/tty/usr.bin/make/compat.c#6 delete
.. //depot/projects/tty/usr.bin/make/compat.h#2 delete
.. //depot/projects/tty/usr.bin/make/for.c#6 integrate
.. //depot/projects/tty/usr.bin/make/globals.h#3 integrate
.. //depot/projects/tty/usr.bin/make/job.c#6 integrate
.. //depot/projects/tty/usr.bin/make/job.h#5 integrate
.. //depot/projects/tty/usr.bin/make/main.c#11 integrate
.. //depot/projects/tty/usr.bin/make/make.c#4 integrate
.. //depot/projects/tty/usr.bin/make/make.h#6 integrate
.. //depot/projects/tty/usr.bin/make/nonints.h#7 delete
.. //depot/projects/tty/usr.bin/make/parse.c#8 integrate
.. //depot/projects/tty/usr.bin/make/parse.h#2 integrate
.. //depot/projects/tty/usr.bin/make/suff.c#5 integrate
.. //depot/projects/tty/usr.bin/make/targ.c#4 integrate
.. //depot/projects/tty/usr.bin/make/var.c#8 integrate
.. //depot/projects/tty/usr.bin/make/var.h#5 integrate
.. //depot/projects/tty/usr.bin/make/var_modify.c#4 delete
.. //depot/projects/tty/usr.bin/sed/main.c#6 integrate
.. //depot/projects/tty/usr.bin/sed/sed.1#7 integrate
Differences ...
==== //depot/projects/tty/UPDATING#16 (text+ko) ====
@@ -203,7 +203,6 @@
make kernel KERNCONF=YOUR_KERNEL_HERE
[1]
<reboot in single user> [3]
- src/etc/rc.d/preseedrandom [10]
mergemaster -p [5]
make installworld
mergemaster [4]
@@ -336,4 +335,4 @@
Contact Warner Losh if you have any questions about your use of
this document.
-$FreeBSD: src/UPDATING,v 1.402 2005/05/03 17:43:13 mlaier Exp $
+$FreeBSD: src/UPDATING,v 1.403 2005/05/09 16:44:22 imp Exp $
==== //depot/projects/tty/gnu/lib/libregex/FREEBSD-upgrade#3 (text+ko) ====
@@ -1,12 +1,18 @@
-$FreeBSD: src/gnu/lib/libregex/FREEBSD-upgrade,v 1.2 2004/07/06 00:10:40 ache Exp $
+$FreeBSD: src/gnu/lib/libregex/FREEBSD-upgrade,v 1.3 2005/05/10 12:04:01 tjr Exp $
-GNU regex (from grep):
+GNU regex (from glibc):
-originals can be found at:
-http://download.fedora.redhat.com/pub/fedora/linux/core/2/SRPMS/grep-2.5.1-26.src.rpm
-
Imported by:
-cvs import \
- -m "Import of GNU regex from GNU grep 2.5.1 (trimmed)." \
- src/gnu/lib/libregex FSF from_grep_v2_5_1
+cvs -z 9 -d :pserver:anoncvs at sources.redhat.com:/cvs/glibc login
+# enter "anoncvs" as the password
+cvs -z 9 -d :pserver:anoncvs at sources.redhat.com:/cvs/glibc \
+ co -r fedora-glibc-2_3_4-21 libc/posix libc/include
+mkdir regex regex/posix
+cd libc/posix
+cp regcomp.c regex.c regex_internal.c regex_internal.h regexec.c $OLDPWD/regex/
+cp regex.h $OLDPWD/regex/posix/
+cd -
+cp libc/include/regex.h regex/
+cd regex
+cvs import src/gnu/lib/libregex FSF fedora-glibc-2_3_4-21
==== //depot/projects/tty/gnu/lib/libregex/Makefile#5 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/gnu/lib/libregex/Makefile,v 1.30 2004/09/19 12:15:25 ru Exp $
+# $FreeBSD: src/gnu/lib/libregex/Makefile,v 1.31 2005/05/10 11:37:37 tjr Exp $
SUBDIR= doc
@@ -14,7 +14,7 @@
PXINCS= posix/regex.h
PXINCSDIR= ${INCSDIR}/posix
-CFLAGS+=-D_REGEX_RE_COMP -DSTDC_HEADERS
+CFLAGS+=-DHAVE_CONFIG_H -I${.CURDIR}
CLEANFILES= regex.h.patched gnuregex.c
regex.h.patched: regex.h
==== //depot/projects/tty/gnu/lib/libregex/posix/regex.h#3 (text+ko) ====
@@ -1,28 +1,29 @@
/* Definitions for data structures and routines for the regular
- expression library, version 0.12.
- Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library. Its master source is NOT part of
- the C library, however. The master source lives in /gd/gnu/lib.
+ expression library.
+ Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003
+ 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.
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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.
+ Lesser 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. */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#ifndef _REGEX_H
#define _REGEX_H 1
+#include <sys/types.h>
+
/* Allow the use in C++ code. */
#ifdef __cplusplus
extern "C" {
@@ -165,6 +166,23 @@
treated as 'a\{1'. */
#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
+/* If this bit is set, then ignore case when matching.
+ If not set, then case is significant. */
+#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
+
+/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
+ for ^, because it is difficult to scan the regex backwards to find
+ whether ^ should be special. */
+#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
+
+/* If this bit is set, then \{ cannot be first in an bre or
+ immediately after an alternation or begin-group operator. */
+#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
+
+/* If this bit is set, then no_sub will be set to 1 during
+ re_compile_pattern. */
+#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
+
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
stored in the pattern buffer, so changing this does not affect
@@ -186,7 +204,8 @@
#define RE_SYNTAX_GNU_AWK \
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
- & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS))
+ & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \
+ | RE_CONTEXT_INVALID_OPS ))
#define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
@@ -218,7 +237,7 @@
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
#define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
+ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
@@ -283,6 +302,10 @@
/* Like REG_NOTBOL, except for the end-of-line. */
#define REG_NOTEOL (1 << 1)
+/* Use PMATCH[0] to delimit the start and end of the search in the
+ buffer. */
+#define REG_STARTEND (1 << 2)
+
/* If any error codes are removed, changed, or added, update the
`re_error_msg' table in regex.c. */
@@ -298,7 +321,7 @@
/* POSIX regcomp return error codes. (In the order listed in the
standard.) */
REG_BADPAT, /* Invalid pattern. */
- REG_ECOLLATE, /* Not implemented. */
+ REG_ECOLLATE, /* Inalid collating element. */
REG_ECTYPE, /* Invalid character class name. */
REG_EESCAPE, /* Trailing backslash. */
REG_ESUBREG, /* Invalid back reference. */
@@ -530,10 +553,14 @@
# endif
# endif
#endif
-/* For now unconditionally define __restrict_arr to expand to nothing.
- Ideally we would have a test for the compiler which allows defining
- it to restrict. */
-#define __restrict_arr
+/* gcc 3.1 and up support the [restrict] syntax. */
+#ifndef __restrict_arr
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+# define __restrict_arr __restrict
+# else
+# define __restrict_arr
+# endif
+#endif
/* POSIX compatibility. */
extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
==== //depot/projects/tty/gnu/lib/libregex/regex.c#5 (text+ko) ====
@@ -1,86 +1,52 @@
-/* $FreeBSD: src/gnu/lib/libregex/regex.c,v 1.14 2004/07/04 02:46:55 tjr Exp $ */
-/* Extended regular expression matching and search library,
- version 0.12.
- (Implements POSIX draft P1003.2/D11.2, except for some of the
- internationalization features.)
- Copyright (C) 1993-1999, 2000, 2001 Free Software Foundation, Inc.
+/* $FreeBSD: src/gnu/lib/libregex/regex.c,v 1.15 2005/05/10 10:52:30 tjr Exp $ */
+/* Extended regular expression matching and search library.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Isamu Hasegawa <isamu at yamato.ibm.com>.
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.
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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.
+ Lesser 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. */
-
-/* AIX requires this to be the first thing in the file. */
-#if defined _AIX && !defined REGEX_MALLOC
- #pragma alloca
-#endif
-
-#undef _GNU_SOURCE
-#define _GNU_SOURCE
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; 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>
+#include "config.h"
#endif
-#ifndef PARAMS
-# if defined __GNUC__ || (defined __STDC__ && __STDC__)
-# define PARAMS(args) args
-# else
-# define PARAMS(args) ()
-# endif /* GCC. */
-#endif /* Not PARAMS. */
-
-#if defined STDC_HEADERS && !defined emacs
-# include <stddef.h>
+#ifdef _AIX
+#pragma alloca
#else
-/* We need this for `regex.h', and perhaps for the Emacs include files. */
-# include <sys/types.h>
+# ifndef allocax /* predefined by HP cc +Olibcalls */
+# ifdef __GNUC__
+# define alloca(size) __builtin_alloca (size)
+# else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef __hpux
+ void *alloca ();
+# else
+# if !defined __OS2__ && !defined WIN32
+ char *alloca ();
+# else
+# include <malloc.h> /* OS/2 defines alloca in here */
+# endif
+# endif
+# endif
+# endif
+# endif
#endif
-#define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
-
-/* For platform which support the ISO C amendement 1 functionality we
- support user defined character classes. */
-#if defined _LIBC || WIDE_CHAR_SUPPORT
-/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
-# include <wchar.h>
-# include <wctype.h>
-#endif
-
-/* This is for multi byte string support. */
-#ifdef MBS_SUPPORT
-# define CHAR_TYPE wchar_t
-# define US_CHAR_TYPE wchar_t/* unsigned character type */
-# define COMPILED_BUFFER_VAR wc_buffer
-# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
-# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_TYPE)+1)
-# define PUT_CHAR(c) \
- do { \
- if (MB_CUR_MAX == 1) \
- putchar (c); \
- else \
- printf ("%C", (wint_t) c); /* Should we use wide stream?? */ \
- } while (0)
-# define TRUE 1
-# define FALSE 0
-#else
-# define CHAR_TYPE char
-# define US_CHAR_TYPE unsigned char /* unsigned character type */
-# define COMPILED_BUFFER_VAR bufp->buffer
-# define OFFSET_ADDRESS_SIZE 2
-# define PUT_CHAR(c) putchar (c)
-#endif /* MBS_SUPPORT */
-
#ifdef _LIBC
/* We have to keep the namespace clean. */
# define regfree(preg) __regfree (preg)
@@ -103,7792 +69,30 @@
__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
-# define btowc __btowc
-
-/* We are also using some library internals. */
-# include <locale/localeinfo.h>
-# include <locale/elem-hash.h>
-# include <langinfo.h>
-# include <locale/coll-lookup.h>
+# include "../locale/localeinfo.h"
#endif
-/* This is for other GNU distributions with internationalized messages. */
-#if HAVE_LIBINTL_H || defined _LIBC
-# include <libintl.h>
-# ifdef _LIBC
-# undef gettext
-# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
-# endif
-#else
-# define gettext(msgid) (msgid)
-#endif
+/* POSIX says that <sys/types.h> must be included (by the caller) before
+ <regex.h>. */
+#include <sys/types.h>
-#ifndef gettext_noop
-/* This define is so xgettext can find the internationalizable
- strings. */
-# define gettext_noop(String) String
-#endif
-
-/* The `emacs' switch turns on certain matching commands
- that make sense only in Emacs. */
-#ifdef emacs
-
-# include "lisp.h"
-# include "buffer.h"
-# include "syntax.h"
-
-#else /* not emacs */
-
-/* If we are not linking with Emacs proper,
- we can't use the relocating allocator
- even if config.h says that we can. */
-# undef REL_ALLOC
-
-# if defined STDC_HEADERS || defined _LIBC
-# include <stdlib.h>
-# else
-char *malloc ();
-char *realloc ();
-# endif
-
-/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
- If nothing else has been done, use the method below. */
-# ifdef INHIBIT_STRING_HEADER
-# if !(defined HAVE_BZERO && defined HAVE_BCOPY)
-# if !defined bzero && !defined bcopy
-# undef INHIBIT_STRING_HEADER
-# endif
-# endif
-# endif
+/* On some systems, limits.h sets RE_DUP_MAX to a lower value than
+ GNU regex allows. Include it before <regex.h>, which correctly
+ #undefs RE_DUP_MAX and sets it to the right value. */
+#include <limits.h>
-/* This is the normal way of making sure we have a bcopy and a bzero.
- This is used in most programs--a few other programs avoid this
- by defining INHIBIT_STRING_HEADER. */
-# ifndef INHIBIT_STRING_HEADER
-# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
-# include <string.h>
-# ifndef bzero
-# ifndef _LIBC
-# define bzero(s, n) (memset (s, '\0', n), (s))
-# else
-# define bzero(s, n) __bzero (s, n)
-# endif
-# endif
-# else
-# include <strings.h>
-# ifndef memcmp
-# define memcmp(s1, s2, n) bcmp (s1, s2, n)
-# endif
-# ifndef memcpy
-# define memcpy(d, s, n) (bcopy (s, d, n), (d))
-# endif
-# endif
-# endif
-
-/* Define the syntax stuff for \<, \>, etc. */
-
-/* This must be nonzero for the wordchar and notwordchar pattern
- commands in re_match_2. */
-# ifndef Sword
-# define Sword 1
-# endif
-
-# ifdef SWITCH_ENUM_BUG
-# define SWITCH_ENUM_CAST(x) ((int)(x))
-# else
-# define SWITCH_ENUM_CAST(x) (x)
-# endif
-
-#endif /* not emacs */
-
-#if defined _LIBC || HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
-#ifndef MB_LEN_MAX
-# define MB_LEN_MAX 1
-#endif
-
-/* Get the interface, including the syntax bits. */
#include <regex.h>
+#include "regex_internal.h"
-/* isalpha etc. are used for the character classes. */
-#include <ctype.h>
+#include "regex_internal.c"
+#include "regcomp.c"
+#include "regexec.c"
-/* Jim Meyering writes:
-
- "... Some ctype macros are valid only for character codes that
- isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
- using /bin/cc or gcc but without giving an ansi option). So, all
- ctype uses should be through macros like ISPRINT... If
- STDC_HEADERS is defined, then autoconf has verified that the ctype
- macros don't need to be guarded with references to isascii. ...
- Defining isascii to 1 should let any compiler worth its salt
- eliminate the && through constant folding."
- Solaris defines some of these symbols so we must undefine them first. */
-
-#undef ISASCII
-#if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
-# define ISASCII(c) 1
-#else
-# define ISASCII(c) isascii(c)
-#endif
-
-#ifdef isblank
-# define ISBLANK(c) (ISASCII (c) && isblank (c))
-#else
-# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-#endif
-#ifdef isgraph
-# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
-#else
-# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
-#endif
-
-#undef ISPRINT
-#define ISPRINT(c) (ISASCII (c) && isprint (c))
-#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
-#define ISALNUM(c) (ISASCII (c) && isalnum (c))
-#define ISALPHA(c) (ISASCII (c) && isalpha (c))
-#define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
-#define ISLOWER(c) (ISASCII (c) && islower (c))
-#define ISPUNCT(c) (ISASCII (c) && ispunct (c))
-#define ISSPACE(c) (ISASCII (c) && isspace (c))
-#define ISUPPER(c) (ISASCII (c) && isupper (c))
-#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
-
-#ifdef _tolower
-# define TOLOWER(c) _tolower(c)
-#else
-# define TOLOWER(c) tolower(c)
-#endif
-
-#ifndef NULL
-# define NULL (void *)0
-#endif
-
-/* We remove any previous definition of `SIGN_EXTEND_CHAR',
- since ours (we hope) works properly with all combinations of
- machines, compilers, `char' and `unsigned char' argument types.
- (Per Bothner suggested the basic approach.) */
-#undef SIGN_EXTEND_CHAR
-#if __STDC__
-# define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-#else /* not __STDC__ */
-/* As in Harbison and Steele. */
-# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
-#endif
-
-#ifndef emacs
-/* How many characters in the character set. */
-# define CHAR_SET_SIZE 256
-
-# ifdef SYNTAX_TABLE
-
-extern char *re_syntax_table;
-
-# else /* not SYNTAX_TABLE */
-
-static char re_syntax_table[CHAR_SET_SIZE];
-
-static void init_syntax_once PARAMS ((void));
-
-static void
-init_syntax_once ()
-{
- register int c;
- static int done = 0;
-
- if (done)
- return;
- bzero (re_syntax_table, sizeof re_syntax_table);
-
- for (c = 0; c < CHAR_SET_SIZE; ++c)
- if (ISALNUM (c))
- re_syntax_table[c] = Sword;
-
- re_syntax_table['_'] = Sword;
-
- done = 1;
-}
-
-# endif /* not SYNTAX_TABLE */
-
-# define SYNTAX(c) re_syntax_table[(unsigned char) (c)]
-
-#endif /* emacs */
-
-/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
- use `alloca' instead of `malloc'. This is because using malloc in
- re_search* or re_match* could cause memory leaks when C-g is used in
- Emacs; also, malloc is slower and causes storage fragmentation. On
- the other hand, malloc is more portable, and easier to debug.
-
- Because we sometimes use alloca, some routines have to be macros,
- not functions -- `alloca'-allocated space disappears at the end of the
- function it is called in. */
-
-#ifdef REGEX_MALLOC
-
-# define REGEX_ALLOCATE malloc
-# define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
-# define REGEX_FREE free
-
-#else /* not REGEX_MALLOC */
-
-/* Emacs already defines alloca, sometimes. */
-# ifndef alloca
-
-/* Make alloca work the best possible way. */
-# ifdef __GNUC__
-# define alloca __builtin_alloca
-# else /* not __GNUC__ */
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# endif /* HAVE_ALLOCA_H */
-# endif /* not __GNUC__ */
-
-# endif /* not alloca */
-
-# define REGEX_ALLOCATE alloca
-
-/* Assumes a `char *destination' variable. */
-# define REGEX_REALLOCATE(source, osize, nsize) \
- (destination = (char *) alloca (nsize), \
- memcpy (destination, source, osize))
-
-/* No need to do anything to free, after alloca. */
-# define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
-
-#endif /* not REGEX_MALLOC */
-
-/* Define how to allocate the failure stack. */
-
-#if defined REL_ALLOC && defined REGEX_MALLOC
-
-# define REGEX_ALLOCATE_STACK(size) \
- r_alloc (&failure_stack_ptr, (size))
-# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
- r_re_alloc (&failure_stack_ptr, (nsize))
-# define REGEX_FREE_STACK(ptr) \
- r_alloc_free (&failure_stack_ptr)
-
-#else /* not using relocating allocator */
-
-# ifdef REGEX_MALLOC
-
-# define REGEX_ALLOCATE_STACK malloc
-# define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
-# define REGEX_FREE_STACK free
-
-# else /* not REGEX_MALLOC */
-
-# define REGEX_ALLOCATE_STACK alloca
-
-# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
- REGEX_REALLOCATE (source, osize, nsize)
-/* No need to explicitly free anything. */
-# define REGEX_FREE_STACK(arg)
-
-# endif /* not REGEX_MALLOC */
-#endif /* not using relocating allocator */
-
-
-/* True if `size1' is non-NULL and PTR is pointing anywhere inside
- `string1' or just past its end. This works if PTR is NULL, which is
- a good thing. */
-#define FIRST_STRING_P(ptr) \
- (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
-
-/* (Re)Allocate N items of type T using malloc, or fail. */
-#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
-#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
-#define RETALLOC_IF(addr, n, t) \
- if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
-#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
-
-#define BYTEWIDTH 8 /* In bits. */
-
-#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-
-#undef MAX
-#undef MIN
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-typedef char boolean;
-#define false 0
-#define true 1
-
-static int re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
- const char *string1, int size1,
- const char *string2, int size2,
- int pos,
- struct re_registers *regs,
- int stop));
-
-/* These are the command codes that appear in compiled regular
- expressions. Some opcodes are followed by argument bytes. A
- command code can specify any interpretation whatsoever for its
- arguments. Zero bytes may appear in the compiled regular expression. */
-
-typedef enum
-{
- no_op = 0,
-
- /* Succeed right away--no more backtracking. */
- succeed,
-
- /* Followed by one byte giving n, then by n literal bytes. */
- exactn,
-
-#ifdef MBS_SUPPORT
- /* Same as exactn, but contains binary data. */
- exactn_bin,
-#endif
-
- /* Matches any (more or less) character. */
- anychar,
-
- /* Matches any one char belonging to specified set. First
- following byte is number of bitmap bytes. Then come bytes
- for a bitmap saying which chars are in. Bits in each byte
- are ordered low-bit-first. A character is in the set if its
- bit is 1. A character too large to have a bit in the map is
- automatically not in the set. */
- /* ifdef MBS_SUPPORT, following element is length of character
- classes, length of collating symbols, length of equivalence
- classes, length of character ranges, and length of characters.
- Next, character class element, collating symbols elements,
- equivalence class elements, range elements, and character
- elements follow.
- See regex_compile function. */
- charset,
-
- /* Same parameters as charset, but match any character that is
- not one of those specified. */
- charset_not,
-
- /* Start remembering the text that is matched, for storing in a
- register. Followed by one byte with the register number, in
- the range 0 to one less than the pattern buffer's re_nsub
- field. Then followed by one byte with the number of groups
- inner to this one. (This last has to be part of the
- start_memory only because we need it in the on_failure_jump
- of re_match_2.) */
- start_memory,
-
- /* Stop remembering the text that is matched and store it in a
- memory register. Followed by one byte with the register
- number, in the range 0 to one less than `re_nsub' in the
- pattern buffer, and one byte with the number of inner groups,
- just like `start_memory'. (We need the number of inner
- groups here because we don't have any easy way of finding the
- corresponding start_memory when we're at a stop_memory.) */
- stop_memory,
-
- /* Match a duplicate of something remembered. Followed by one
- byte containing the register number. */
- duplicate,
-
- /* Fail unless at beginning of line. */
- begline,
-
- /* Fail unless at end of line. */
- endline,
-
- /* Succeeds if at beginning of buffer (if emacs) or at beginning
- of string to be matched (if not). */
- begbuf,
-
- /* Analogously, for end of buffer/string. */
- endbuf,
-
- /* Followed by two byte relative address to which to jump. */
- jump,
-
- /* Same as jump, but marks the end of an alternative. */
- jump_past_alt,
-
- /* Followed by two-byte relative address of place to resume at
- in case of failure. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- on_failure_jump,
-
- /* Like on_failure_jump, but pushes a placeholder instead of the
- current string position when executed. */
- on_failure_keep_string_jump,
-
- /* Throw away latest failure point and then jump to following
- two-byte relative address. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- pop_failure_jump,
-
- /* Change to pop_failure_jump if know won't have to backtrack to
- match; otherwise change to jump. This is used to jump
- back to the beginning of a repeat. If what follows this jump
- clearly won't match what the repeat does, such that we can be
- sure that there is no use backtracking out of repetitions
- already matched, then we change it to a pop_failure_jump.
- Followed by two-byte address. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- maybe_pop_jump,
-
- /* Jump to following two-byte address, and push a dummy failure
- point. This failure point will be thrown away if an attempt
- is made to use it for a failure. A `+' construct makes this
- before the first repeat. Also used as an intermediary kind
- of jump when compiling an alternative. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- dummy_failure_jump,
-
- /* Push a dummy failure point and continue. Used at the end of
- alternatives. */
- push_dummy_failure,
-
- /* Followed by two-byte relative address and two-byte number n.
- After matching N times, jump to the address upon failure. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- succeed_n,
-
- /* Followed by two-byte relative address, and two-byte number n.
- Jump to the address N times, then fail. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- jump_n,
-
- /* Set the following two-byte relative address to the
- subsequent two-byte number. The address *includes* the two
- bytes of number. */
- /* ifdef MBS_SUPPORT, the size of address is 1. */
- set_number_at,
-
- wordchar, /* Matches any word-constituent character. */
- notwordchar, /* Matches any char that is not a word-constituent. */
-
- wordbeg, /* Succeeds if at word beginning. */
- wordend, /* Succeeds if at word end. */
-
- wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
-
-#ifdef emacs
- ,before_dot, /* Succeeds if before point. */
- at_dot, /* Succeeds if at point. */
- after_dot, /* Succeeds if after point. */
-
- /* Matches any character whose syntax is specified. Followed by
- a byte which contains a syntax code, e.g., Sword. */
- syntaxspec,
-
- /* Matches any character whose syntax is not that specified. */
- notsyntaxspec
-#endif /* emacs */
-} re_opcode_t;
-
-/* Common operations on the compiled pattern. */
-
-/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
-
-#ifdef MBS_SUPPORT
-# define STORE_NUMBER(destination, number) \
- do { \
- *(destination) = (US_CHAR_TYPE)(number); \
- } while (0)
-#else
-# define STORE_NUMBER(destination, number) \
- do { \
- (destination)[0] = (number) & 0377; \
- (destination)[1] = (number) >> 8; \
- } while (0)
-#endif /* MBS_SUPPORT */
-
-/* Same as STORE_NUMBER, except increment DESTINATION to
- the byte after where the number is stored. Therefore, DESTINATION
- must be an lvalue. */
-/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
-
-#define STORE_NUMBER_AND_INCR(destination, number) \
- do { \
- STORE_NUMBER (destination, number); \
- (destination) += OFFSET_ADDRESS_SIZE; \
- } while (0)
-
-/* Put into DESTINATION a number stored in two contiguous bytes starting
- at SOURCE. */
-/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
-
-#ifdef MBS_SUPPORT
-# define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source); \
- } while (0)
-#else
-# define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source) & 0377; \
- (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
- } while (0)
-#endif
-
-#ifdef DEBUG
-static void extract_number _RE_ARGS ((int *dest, US_CHAR_TYPE *source));
-static void
-extract_number (dest, source)
- int *dest;
- US_CHAR_TYPE *source;
-{
-#ifdef MBS_SUPPORT
- *dest = *source;
-#else
- int temp = SIGN_EXTEND_CHAR (*(source + 1));
- *dest = *source & 0377;
- *dest += temp << 8;
-#endif
-}
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list