aboutsummaryrefslogtreecommitdiff
path: root/editors/xemacs21-mule
diff options
context:
space:
mode:
authorSergey Matveychuk <sem@FreeBSD.org>2005-01-08 16:13:55 +0000
committerSergey Matveychuk <sem@FreeBSD.org>2005-01-08 16:13:55 +0000
commitd00e92b2aad071f09db59c505c3b5fdf4ffb4da3 (patch)
treeb035a6ad3be89558db979658c9a5a5c6ed53e102 /editors/xemacs21-mule
parent2e29c4f5d222e75b4e14ec1a3836f86773149d2e (diff)
downloadports-d00e92b2aad071f09db59c505c3b5fdf4ffb4da3.tar.gz
ports-d00e92b2aad071f09db59c505c3b5fdf4ffb4da3.zip
Notes
Diffstat (limited to 'editors/xemacs21-mule')
-rw-r--r--editors/xemacs21-mule/Makefile98
-rw-r--r--editors/xemacs21-mule/files/patch-regex.c450
-rw-r--r--editors/xemacs21-mule/files/patch-regex.h37
3 files changed, 517 insertions, 68 deletions
diff --git a/editors/xemacs21-mule/Makefile b/editors/xemacs21-mule/Makefile
index da0f6dc86551..2a5fbf9c749e 100644
--- a/editors/xemacs21-mule/Makefile
+++ b/editors/xemacs21-mule/Makefile
@@ -7,11 +7,21 @@
PORTNAME= xemacs-mule
PORTVERSION= ${XEMACS_VER}
-.if defined(WNN6)
-.endif
+PORTREVISION= 1
CATEGORIES+= editors
MASTER_SITES= ${MASTER_SITE_XEMACS}
MASTER_SITE_SUBDIR= xemacs-${XEMACS_REL}
+.if defined(CANNA) && defined(FREEWNN)
+PKGNAMESUFFIX+= -canna+freewnn
+.elif defined(CANNA) && defined(WNN6)
+PKGNAMESUFFIX+= -canna+wnn6
+.elif defined(FREEWNN)
+PKGNAMESUFFIX+= -freewnn
+.elif defined(WNN6)
+PKGNAMESUFFIX+= -wnn6
+.elif defined(CANNA)
+PKGNAMESUFFIX+= -canna
+.endif
DISTNAME= xemacs-${XEMACS_VER}
DISTFILES= ${DISTNAME}-src${EXTRACT_SUFX} \
${DISTNAME}-elc${EXTRACT_SUFX} ${DISTNAME}-info${EXTRACT_SUFX}
@@ -20,26 +30,19 @@ DIST_SUBDIR= xemacs
MAINTAINER?= anrays@gmail.com
COMMENT?= XEmacs(stable version) text editor with mule(Only the executables)
-USE_GNOME= #
-
-.include <bsd.port.pre.mk>
-
-BUILD_DEPENDS= ${LOCALBASE}/lib/xemacs/mule-packages/pkginfo/MANIFEST.skk:${PORTSDIR}/editors/xemacs-mule-packages
-RUN_DEPENDS= ${LOCALBASE}/lib/xemacs/xemacs-packages/etc/enriched.doc:${PORTSDIR}/editors/xemacs-packages \
- ${LOCALBASE}/lib/xemacs/mule-packages/pkginfo/MANIFEST.skk:${PORTSDIR}/editors/xemacs-mule-packages
+BUILD_DEPENDS= ${LOCALBASE}/lib/xemacs/mule-packages/pkginfo/MANIFEST.mule-base:${PORTSDIR}/editors/xemacs-mule-packages
+RUN_DEPENDS= ${LOCALBASE}/lib/xemacs/mule-packages/pkginfo/MANIFEST.mule-base:${PORTSDIR}/editors/xemacs-mule-packages
.if defined(PKGNAMEPREFIX)
RUN_DEPENDS+= ${LOCALBASE}/lib/xemacs-${XEMACS_VER}/lisp/x-win-xfree86.elc:${PORTSDIR}/editors/xemacs21-mule
.endif
LIB_DEPENDS= jpeg.9:${PORTSDIR}/graphics/jpeg \
png.5:${PORTSDIR}/graphics/png \
tiff.4:${PORTSDIR}/graphics/tiff \
- compface.1:${PORTSDIR}/mail/faces \
- ${LIB_INPUT_METHOD}
+ compface.1:${PORTSDIR}/mail/faces
-XEMACS_MAJOR_VER?= 21
-XEMACS_REL= ${XEMACS_MAJOR_VER}.4
-XEMACS_VER= ${XEMACS_MAJOR_VER}.4.16
-XEMACS_ARCH= ${CONFIGURE_TARGET}
+XEMACS_REL= 21.4
+XEMACS_VER= ${XEMACS_REL}.16
+XEMACS_ARCH= ${CONFIGURE_TARGET}
USE_GETTEXT= yes
USE_XLIB= yes
@@ -67,10 +70,8 @@ CONFIGURE_ARGS= --with-x11 \
--with-clash-detection \
--with-database=berkdb \
${WITH_XIM} \
- ${WITH_ATHENA} \
- ${WITH_MENUBARS} ${WITH_SCROLLBARS} ${WITH_DIALOGS} ${WITH_WIDGETS} \
- ${WITH_OFFIX} ${WITH_GTK} \
- ${WITH_INPUT_METHOD}
+ ${WITH_MENUBARS} ${WITH_SCROLLBARS} \
+ ${WITH_DIALOGS} ${WITH_WIDGETS}
MAKE_ARGS= prefix=${PREFIX}
ALL_TARGET= all dist
.if defined(PKGNAMEPREFIX)
@@ -85,18 +86,26 @@ MAN1= xemacs.1
MAN1= ctags.1 etags.1 gnuattach.1 gnuclient.1 gnudoit.1 \
gnuserv.1 xemacs.1
.endif
+
+.if defined(WITH_GTK)
+CONFIGURE_ARGS+=--with-gtk
+USE_GNOME+= gtk12
+.endif
+
PKGDIR= ${.CURDIR}/../../editors/xemacs21-mule
PLIST_SUB= XEMACS_VER=${XEMACS_VER} XEMACS_ARCH=${XEMACS_ARCH}
+.include <bsd.port.pre.mk>
+
# Undump and malloc do not behave on amd64 at the moment
.if ${ARCH} == "amd64"
-CONFIGURE_ARGS+= --with-system-malloc --pdump
+CONFIGURE_ARGS+=--with-system-malloc --pdump
.endif
pre-fetch:
-.if !defined(WANT_GTK)
- @${ECHO_MSG} "If you want to use GTK, please set the environment variable WANT_GTK and recompile."
+.if !defined(WITH_GTK)
+ @${ECHO_MSG} "If you want to use GTK, please set the environment variable WITH_GTK and recompile."
.endif
.if !defined(WITHOUT_MOTIF)
.if !defined(MOTIF_STATIC)
@@ -115,55 +124,50 @@ WITH_DIALOGS= --with-dialogs=athena
WITH_DIALOGS= --with-dialogs=motif
.endif
-.if defined(WANT_GTK)
-WITH_GTK= --with-gtk=yes
-USE_GNOME+= gtk12
-.endif
-
.if defined(PACKAGE_BUILDING)
-WITH_OFFIX?= --with-offix=no
+CONFIGURE_ARGS+=--with-offix=no
.endif
-WITH_ATHENA?= --with-athena=xaw
WITH_MENUBARS?= --with-menubars=lucid
WITH_SCROLLBARS?=--with-scrollbars=motif
WITH_WIDGETS?= --with-widgets=motif
.endif
WITH_XIM?= --with-xim=xlib
-WITH_ATHENA?= --with-athena=xaw
WITH_MENUBARS?= --with-menubars=athena
WITH_SCROLLBARS?=--with-scrollbars=athena
WITH_DIALOGS?= --with-dialogs=athena
WITH_WIDGETS?= --with-widgets=athena
+.if defined(WITH_XAW3D)
+CONFIGURE_ARGS+=--with-athena=3d
+.else
+CONFIGURE_ARGS+=--with-athena=xaw
+.endif
+
BINNAMEEXT= -mule
.if defined(CANNA) && defined(FREEWNN)
-PKGNAMESUFFIX= -canna+freewnn
-WITH_INPUT_METHOD= --with-canna --with-wnn --with-wnn6=no
-LIB_INPUT_METHOD= canna.1:${PORTSDIR}/japanese/Canna \
+CONFIGURE_ARGS+= --with-canna --with-wnn --with-wnn6=no
+LIB_DEPENDS+= canna.1:${PORTSDIR}/japanese/Canna \
wnn.0:${PORTSDIR}/japanese/FreeWnn-lib
.elif defined(CANNA) && defined(WNN6)
-PKGNAMESUFFIX= -canna+wnn6
SITE_INCLUDES= ${LOCALBASE}/include/wnn6
-WITH_INPUT_METHOD= --with-canna --with-wnn6
-LIB_INPUT_METHOD= canna.1:${PORTSDIR}/japanese/Canna \
+CONFIGURE_ARGS+= --with-canna --with-wnn6
+LIB_DEPENDS+= canna.1:${PORTSDIR}/japanese/Canna \
wnn6.2:${PORTSDIR}/japanese/Wnn6-lib
.elif defined(FREEWNN)
-PKGNAMESUFFIX= -freewnn
-WITH_INPUT_METHOD= --with-wnn --with-canna=no --with-wnn6=no
-LIB_INPUT_METHOD= wnn.0:${PORTSDIR}/japanese/FreeWnn-lib
+CONFIGURE_ARGS+= --with-wnn --with-canna=no --with-wnn6=no
+LIB_DEPENDS+= wnn.0:${PORTSDIR}/japanese/FreeWnn-lib
.elif defined(WNN6)
-PKGNAMESUFFIX= -wnn6
SITE_INCLUDES= ${LOCALBASE}/include/wnn6
-WITH_INPUT_METHOD= --with-wnn6 --with-canna=no
-LIB_INPUT_METHOD= wnn6.2:${PORTSDIR}/japanese/Wnn6-lib
+CONFIGURE_ARGS+= --with-wnn6 --with-canna=no
+LIB_DEPENDS+= wnn6.2:${PORTSDIR}/japanese/Wnn6-lib
.elif defined(CANNA)
-PKGNAMESUFFIX= -canna
-WITH_INPUT_METHOD= --with-canna --with-wnn=no --with-wnn6=no
-LIB_INPUT_METHOD= canna.1:${PORTSDIR}/japanese/Canna
+CONFIGURE_ARGS+= --with-canna --with-wnn=no --with-wnn6=no
+LIB_DEPENDS+= canna.1:${PORTSDIR}/japanese/Canna
+.else
+CONFIGURE_ARGS+= --with-canna=no --with-wnn=no --with-wnn6=no
.endif
SITE_INCLUDES+= ${LOCALBASE}/include
SITE_LIBRARIES+= ${LOCALBASE}/lib
-WITH_INPUT_METHOD?= --with-canna=no --with-wnn=no --with-wnn6=no
# fix .so references in a few man pages
pre-configure::
@@ -186,7 +190,7 @@ post-install::
${MKDIR} ${PREFIX}/lib/xemacs/site-lisp
${CHMOD} 755 ${PREFIX}/lib/xemacs/site-lisp
${RM} -f ${PREFIX}/bin/send-pr
-.if defined(WANT_GTK)
+.if defined(WITH_GTK)
@${ECHO_MSG} "Please be aware that GTK support is buggy. Do not report bugs to"
@${ECHO_MSG} "the maintainer."
@${ECHO_MSG} "Please also be aware that the package's name was automagically changed"
diff --git a/editors/xemacs21-mule/files/patch-regex.c b/editors/xemacs21-mule/files/patch-regex.c
index 6a4e854c5955..2c85b2b1f0dd 100644
--- a/editors/xemacs21-mule/files/patch-regex.c
+++ b/editors/xemacs21-mule/files/patch-regex.c
@@ -1,33 +1,441 @@
-Index: regex.c
+Index: src/regex.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/regex.c,v
retrieving revision 1.25.2.10
-retrieving revision 1.25.2.9
-diff -u -r1.25.2.10 -r1.25.2.9
+retrieving revision 1.25.2.8
+diff -u -r1.25.2.10 -r1.25.2.8
--- src/regex.c 2004/10/08 00:40:33 1.25.2.10
-+++ src/regex.c 2004/09/23 03:03:43 1.25.2.9
-@@ -4766,20 +4766,16 @@
++++ src/regex.c 2004/03/15 03:34:59 1.25.2.8
+@@ -418,7 +418,7 @@
- /* Go through the first `min (num_regs, regs->num_regs)'
- registers, since that is all we initialized. */
+ /* Start remembering the text that is matched, for storing in a
+ register. Followed by one byte with the register number, in
+- the range 1 to the pattern buffer's re_ngroups
++ 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
+@@ -427,7 +427,7 @@
+
+ /* 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 1 to `re_ngroups' in the
++ 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
+@@ -974,7 +974,6 @@
+ }
+
+ printf ("re_nsub: %ld\t", (long)bufp->re_nsub);
+- printf ("re_ngroups: %ld\t", (long)bufp->re_ngroups);
+ printf ("regs_alloc: %d\t", bufp->regs_allocated);
+ printf ("can_be_null: %d\t", bufp->can_be_null);
+ printf ("newline_anchor: %d\n", bufp->newline_anchor);
+@@ -984,20 +983,6 @@
+ printf ("syntax: %d\n", bufp->syntax);
+ /* Perhaps we should print the translate table? */
+ /* and maybe the category table? */
+-
+- if (bufp->external_to_internal_register)
+- {
+- int i;
+-
+- printf ("external_to_internal_register:\n");
+- for (i = 0; i <= bufp->re_nsub; i++)
+- {
+- if (i > 0)
+- printf (", ");
+- printf ("%d -> %d", i, bufp->external_to_internal_register[i]);
+- }
+- printf ("\n");
+- }
+ }
+
+
+@@ -1708,7 +1693,6 @@
+ ignore the excess. */
+ typedef unsigned regnum_t;
+
+-#define INIT_REG_TRANSLATE_SIZE 5
+
+ /* Macros for the compile stack. */
+
+@@ -1892,9 +1876,7 @@
+ `syntax' is set to SYNTAX;
+ `used' is set to the length of the compiled pattern;
+ `fastmap_accurate' is zero;
+- `re_ngroups' is the number of groups/subexpressions (including shy
+- groups) in PATTERN;
+- `re_nsub' is the number of non-shy groups in PATTERN;
++ `re_nsub' is the number of subexpressions in PATTERN;
+ `not_bol' and `not_eol' are zero;
+
+ The `fastmap' and `newline_anchor' fields are neither
+@@ -1992,23 +1974,6 @@
+
+ /* Always count groups, whether or not bufp->no_sub is set. */
+ bufp->re_nsub = 0;
+- bufp->re_ngroups = 0;
+-
+- if (bufp->external_to_internal_register == 0)
+- {
+- bufp->external_to_internal_register_size = INIT_REG_TRANSLATE_SIZE;
+- RETALLOC (bufp->external_to_internal_register,
+- bufp->external_to_internal_register_size,
+- int);
+- }
+-
+- {
+- int i;
+-
+- bufp->external_to_internal_register[0] = 0;
+- for (i = 1; i < bufp->external_to_internal_register_size; i++)
+- bufp->external_to_internal_register[i] = (int) 0xDEADBEEF;
+- }
+
+ #if !defined (emacs) && !defined (SYNTAX_TABLE)
+ /* Initialize the syntax table. */
+@@ -2591,7 +2556,6 @@
+ handle_open:
+ {
+ regnum_t r;
+- int shy = 0;
+
+ if (!(syntax & RE_NO_SHY_GROUPS)
+ && p != pend
+@@ -2602,7 +2566,7 @@
+ switch (c)
+ {
+ case ':': /* shy groups */
+- shy = 1;
++ r = MAX_REGNUM + 1;
+ break;
+
+ /* All others are reserved for future constructs. */
+@@ -2610,32 +2574,11 @@
+ FREE_STACK_RETURN (REG_BADPAT);
+ }
+ }
+-
+- r = ++regnum;
+- bufp->re_ngroups++;
+- if (!shy)
+- {
+- bufp->re_nsub++;
+- while (bufp->external_to_internal_register_size <=
+- bufp->re_nsub)
+- {
+- int i;
+- int old_size =
+- bufp->external_to_internal_register_size;
+- bufp->external_to_internal_register_size += 5;
+- RETALLOC (bufp->external_to_internal_register,
+- bufp->external_to_internal_register_size,
+- int);
+- /* debugging */
+- for (i = old_size;
+- i < bufp->external_to_internal_register_size; i++)
+- bufp->external_to_internal_register[i] =
+- (int) 0xDEADBEEF;
+- }
+-
+- bufp->external_to_internal_register[bufp->re_nsub] =
+- bufp->re_ngroups;
+- }
++ else
++ {
++ bufp->re_nsub++;
++ r = ++regnum;
++ }
+
+ if (COMPILE_STACK_FULL)
+ {
+@@ -2659,10 +2602,7 @@
+ /* We will eventually replace the 0 with the number of
+ groups inner to this one. But do not push a
+ start_memory for groups beyond the last one we can
+- represent in the compiled pattern.
+- #### bad bad bad. this will fail in lots of ways, if we
+- ever have to backtrack for these groups.
+- */
++ represent in the compiled pattern. */
+ if (r <= MAX_REGNUM)
+ {
+ COMPILE_STACK_TOP.inner_group_offset
+@@ -3052,23 +2992,18 @@
+ case '1': case '2': case '3': case '4': case '5':
+ case '6': case '7': case '8': case '9':
+ {
+- int reg;
++ regnum_t reg;
+ if (syntax & RE_NO_BK_REFS)
+ goto normal_char;
+
+ reg = c - '0';
+
+- if (reg > bufp->re_nsub)
++ if (reg > regnum)
+ FREE_STACK_RETURN (REG_ESUBREG);
+
+- {
+- int regint = bufp->external_to_internal_register[reg];
+- /* Can't back reference to a subexpression if inside it. */
+- if (group_in_compile_stack (compile_stack, regint))
+- {
+- goto normal_char;
+- }
+- }
++ /* Can't back reference to a subexpression if inside of it. */
++ if (group_in_compile_stack (compile_stack, reg))
++ goto normal_char;
+
+ laststart = buf_end;
+ BUF_PUSH_2 (duplicate, reg);
+@@ -3186,7 +3121,7 @@
+ isn't necessary unless we're trying to avoid calling alloca in
+ the search and match routines. */
+ {
+- int num_regs = bufp->re_ngroups + 1;
++ int num_regs = bufp->re_nsub + 1;
+
+ /* Since DOUBLE_FAIL_STACK refuses to double only if the current size
+ is strictly greater than re_max_failures, the largest possible stack
+@@ -4449,7 +4384,7 @@
+ /* We fill all the registers internally, independent of what we
+ return, for use in backreferences. The number here includes
+ an element for register zero. */
+- int num_regs = bufp->re_ngroups + 1;
++ int num_regs = bufp->re_nsub + 1;
+
+ /* The currently active registers. */
+ int lowest_active_reg = NO_LOWEST_ACTIVE_REG;
+@@ -4535,7 +4470,7 @@
+ there are groups, we include space for register 0 (the whole
+ pattern), even though we never use it, since it simplifies the
+ array indexing. We should fix this. */
+- if (bufp->re_ngroups)
++ if (bufp->re_nsub)
+ {
+ regstart = REGEX_TALLOC (num_regs, re_char *);
+ regend = REGEX_TALLOC (num_regs, re_char *);
+@@ -4711,87 +4646,80 @@
+ DEBUG_PRINT1 ("Accepting match.\n");
+
+ /* If caller wants register contents data back, do it. */
+- {
+- int num_nonshy_regs = bufp->re_nsub + 1;
+- if (regs && !bufp->no_sub)
+- {
+- /* Have the register data arrays been allocated? */
+- if (bufp->regs_allocated == REGS_UNALLOCATED)
+- { /* No. So allocate them with malloc. We need one
+- extra element beyond `num_regs' for the `-1' marker
+- GNU code uses. */
+- regs->num_regs = MAX (RE_NREGS, num_nonshy_regs + 1);
+- regs->start = TALLOC (regs->num_regs, regoff_t);
+- regs->end = TALLOC (regs->num_regs, regoff_t);
+- if (regs->start == NULL || regs->end == NULL)
+- {
+- FREE_VARIABLES ();
+- return -2;
+- }
+- bufp->regs_allocated = REGS_REALLOCATE;
+- }
+- else if (bufp->regs_allocated == REGS_REALLOCATE)
+- { /* Yes. If we need more elements than were already
+- allocated, reallocate them. If we need fewer, just
+- leave it alone. */
+- if (regs->num_regs < num_nonshy_regs + 1)
+- {
+- regs->num_regs = num_nonshy_regs + 1;
+- RETALLOC (regs->start, regs->num_regs, regoff_t);
+- RETALLOC (regs->end, regs->num_regs, regoff_t);
+- if (regs->start == NULL || regs->end == NULL)
+- {
+- FREE_VARIABLES ();
+- return -2;
+- }
+- }
+- }
+- else
+- {
+- /* The braces fend off a "empty body in an else-statement"
+- warning under GCC when assert expands to nothing. */
+- assert (bufp->regs_allocated == REGS_FIXED);
+- }
+-
+- /* Convert the pointer data in `regstart' and `regend' to
+- indices. Register zero has to be set differently,
+- since we haven't kept track of any info for it. */
+- if (regs->num_regs > 0)
+- {
+- regs->start[0] = pos;
+- regs->end[0] = (MATCHING_IN_FIRST_STRING
+- ? ((regoff_t) (d - string1))
+- : ((regoff_t) (d - string2 + size1)));
+- }
++ if (regs && !bufp->no_sub)
++ {
++ /* Have the register data arrays been allocated? */
++ if (bufp->regs_allocated == REGS_UNALLOCATED)
++ { /* No. So allocate them with malloc. We need one
++ extra element beyond `num_regs' for the `-1' marker
++ GNU code uses. */
++ regs->num_regs = MAX (RE_NREGS, num_regs + 1);
++ regs->start = TALLOC (regs->num_regs, regoff_t);
++ regs->end = TALLOC (regs->num_regs, regoff_t);
++ if (regs->start == NULL || regs->end == NULL)
++ {
++ FREE_VARIABLES ();
++ return -2;
++ }
++ bufp->regs_allocated = REGS_REALLOCATE;
++ }
++ else if (bufp->regs_allocated == REGS_REALLOCATE)
++ { /* Yes. If we need more elements than were already
++ allocated, reallocate them. If we need fewer, just
++ leave it alone. */
++ if (regs->num_regs < num_regs + 1)
++ {
++ regs->num_regs = num_regs + 1;
++ RETALLOC (regs->start, regs->num_regs, regoff_t);
++ RETALLOC (regs->end, regs->num_regs, regoff_t);
++ if (regs->start == NULL || regs->end == NULL)
++ {
++ FREE_VARIABLES ();
++ return -2;
++ }
++ }
++ }
++ else
++ {
++ /* These braces fend off a "empty body in an else-statement"
++ warning under GCC when assert expands to nothing. */
++ assert (bufp->regs_allocated == REGS_FIXED);
++ }
+
+- /* Go through the first `min (num_regs, regs->num_regs)'
+- registers, since that is all we initialized. */
- for (mcnt = 1;
- mcnt < MIN (num_nonshy_regs, regs->num_regs);
- mcnt++)
-+ for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
- {
+- {
- int ireg = bufp->external_to_internal_register[mcnt];
--
++ /* Convert the pointer data in `regstart' and `regend' to
++ indices. Register zero has to be set differently,
++ since we haven't kept track of any info for it. */
++ if (regs->num_regs > 0)
++ {
++ regs->start[0] = pos;
++ regs->end[0] = (MATCHING_IN_FIRST_STRING
++ ? ((regoff_t) (d - string1))
++ : ((regoff_t) (d - string2 + size1)));
++ }
+
- if (REG_UNSET (regstart[ireg]) || REG_UNSET (regend[ireg]))
-+ if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
- regs->start[mcnt] = regs->end[mcnt] = -1;
- else
- {
- regs->start[mcnt]
+- regs->start[mcnt] = regs->end[mcnt] = -1;
+- else
+- {
+- regs->start[mcnt]
- = (regoff_t) POINTER_TO_OFFSET (regstart[ireg]);
-+ = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]);
- regs->end[mcnt]
+- regs->end[mcnt]
- = (regoff_t) POINTER_TO_OFFSET (regend[ireg]);
-+ = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]);
- }
- }
- } /* regs && !bufp->no_sub */
+- }
+- }
+- } /* regs && !bufp->no_sub */
+- }
++ /* Go through the first `min (num_regs, regs->num_regs)'
++ registers, since that is all we initialized. */
++ for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
++ {
++ if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
++ regs->start[mcnt] = regs->end[mcnt] = -1;
++ else
++ {
++ regs->start[mcnt]
++ = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]);
++ regs->end[mcnt]
++ = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]);
++ }
++ }
++ } /* regs && !bufp->no_sub */
+
+ /* If we have regs and the regs structure has more elements than
+- were in the pattern, set the extra elements to -1. If we
++ were in the pattern, set the extra elements to -1. If we
+ (re)allocated the registers, this is the case, because we
+ always allocate enough to have at least one -1 at the end.
+
+ We do this even when no_sub is set because some applications
+- (XEmacs) reuse register structures which may contain stale
++ (XEmacs) reuse register structures which may contain stale
+ information, and permit attempts to access those registers.
+
+ It would be possible to require the caller to do this, but we'd
+@@ -4801,20 +4729,20 @@
+ for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++)
+ regs->start[mcnt] = regs->end[mcnt] = -1;
+
+- DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
+- nfailure_points_pushed, nfailure_points_popped,
+- nfailure_points_pushed - nfailure_points_popped);
+- DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
++ DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
++ nfailure_points_pushed, nfailure_points_popped,
++ nfailure_points_pushed - nfailure_points_popped);
++ DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
+
+- mcnt = d - pos - (MATCHING_IN_FIRST_STRING
++ mcnt = d - pos - (MATCHING_IN_FIRST_STRING
+ ? string1
+ : string2 - size1);
+
+- DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
++ DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
+
+- FREE_VARIABLES ();
+- return mcnt;
+- }
++ FREE_VARIABLES ();
++ return mcnt;
++ }
+
+ /* Otherwise match next pattern command. */
+ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
+@@ -5143,15 +5071,11 @@
+
+
+ /* \<digit> has been turned into a `duplicate' command which is
+- followed by the numeric value of <digit> as the register number.
+- (Already passed through external-to-internal-register mapping,
+- so it refers to the actual group number, not the non-shy-only
+- numbering used in the external world.) */
++ followed by the numeric value of <digit> as the register number. */
+ case duplicate:
+ {
+ REGISTER re_char *d2, *dend2;
+- /* Get which register to match against. */
+- int regno = *p++;
++ int regno = *p++; /* Get which register to match against. */
+ DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
+
+ /* Can't back reference a group which we've never matched. */
+@@ -6329,8 +6253,6 @@
+ `newline_anchor' to REG_NEWLINE being set in CFLAGS;
+ `fastmap' and `fastmap_accurate' to zero;
+ `re_nsub' to the number of subexpressions in PATTERN.
+- (non-shy of course. POSIX probably doesn't know about
+- shy ones, and in any case they should be invisible.)
+
+ PATTERN is the address of the pattern string.
+
+@@ -6373,7 +6295,7 @@
+
+ if (cflags & REG_ICASE)
+ {
+- int i;
++ unsigned i;
+
+ preg->translate = (char *) malloc (CHAR_SET_SIZE);
+ if (preg->translate == NULL)
diff --git a/editors/xemacs21-mule/files/patch-regex.h b/editors/xemacs21-mule/files/patch-regex.h
new file mode 100644
index 000000000000..946fe4fc882b
--- /dev/null
+++ b/editors/xemacs21-mule/files/patch-regex.h
@@ -0,0 +1,37 @@
+Index: src/regex.h
+===================================================================
+RCS file: /pack/xemacscvs/XEmacs/xemacs/src/regex.h,v
+retrieving revision 1.7.2.2
+retrieving revision 1.7.2.1
+diff -u -r1.7.2.2 -r1.7.2.1
+--- src/regex.h 2004/09/23 03:03:47 1.7.2.2
++++ src/regex.h 2001/04/16 09:24:54 1.7.2.1
+@@ -358,14 +358,9 @@
+ when it is matched. */
+ RE_TRANSLATE_TYPE translate;
+
+- /* Number of returnable groups found by the compiler. (This does
+- not count shy groups.) */
++ /* Number of subexpressions found by the compiler. */
+ Element_count re_nsub;
+
+- /* Total number of groups found by the compiler. (Including
+- shy ones.) */
+- Element_count re_ngroups;
+-
+ /* Zero if this pattern cannot match the empty string, one else.
+ Well, in truth it's used only in `re_search_2', to see
+ whether or not we should use the fastmap, so we don't set
+@@ -399,12 +394,6 @@
+
+ /* If true, an anchor at a newline matches. */
+ unsigned newline_anchor : 1;
+-
+- /* Mapping between back references and groups (may not be
+- equivalent with shy groups). */
+- int *external_to_internal_register;
+-
+- int external_to_internal_register_size;
+
+ /* [[[end pattern_buffer]]] */
+ };