diff options
| author | Paul Eggert | 2018-08-05 18:41:20 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-05 19:36:09 -0700 |
| commit | d904cc83f3036db96107a3976cee1a0112547de6 (patch) | |
| tree | 7186eee577f0112462a024368c014819c4055152 /src | |
| parent | e5652268a993ad9117f7253553c143d60460eb8f (diff) | |
| download | emacs-d904cc83f3036db96107a3976cee1a0112547de6.tar.gz emacs-d904cc83f3036db96107a3976cee1a0112547de6.zip | |
Use Gnulib regex for lib-src
Emacs regular expressions forked from everyone else long ago.
This makes it official and should allow simplification later.
etags.c now uses the glibc regex API, falling back on a
Gnulib-supplied substitute lib/regex.c if necessary.
Emacs proper now uses its own regular expression module.
Although this patch may look dauntingly large, most of it
was generated automatically by admin/merge-gnulib
and contains an exact copy of the glibc regex source,
and the by-hand changes do not grow the Emacs source code.
* admin/merge-gnulib (GNULIB_MODULES): Add regex.
(AVOIDED_MODULES): Add btowc, langinfo, lock, mbrtowc, mbsinit,
nl_langinfo, wchar, wcrtomb, wctype-h.
* lib-src/Makefile.in (regex-emacs.o): Remove; Gnulib does it now.
(etags_deps, etags_libs): Remove regex-emacs.o.
* lib-src/etags.c: Go back to including regex.h.
(add_regex): Use unsigned char translation array,
since glibc regex requires that.
* lib/Makefile.in (not_emacs_OBJECTS, for_emacs_OBJECTS): New macros.
(libegnu_a_OBJECTS): Use them, to avoid building e-regex.o.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/regcomp.c, lib/regex.c, lib/regex.h, lib/regex_internal.c:
* lib/regex_internal.h, lib/regexec.c, m4/builtin-expect.m4:
* m4/eealloc.m4, m4/glibc21.m4, m4/mbstate_t.m4, m4/regex.m4:
New files, copied from Gnulib.
* src/regex-emacs.h, src/conf_post.h:
(RE_TRANSLATE_TYPE, RE_TRANSLATE, RE_TRANSLATE_P):
Move from src/conf_post.h to src/regex-emacs.h,
so that they don’t interfere with compiling lib/regex.c.
Diffstat (limited to 'src')
| -rw-r--r-- | src/conf_post.h | 7 | ||||
| -rw-r--r-- | src/regex-emacs.h | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/conf_post.h b/src/conf_post.h index 8d56f0b4905..97582984378 100644 --- a/src/conf_post.h +++ b/src/conf_post.h | |||
| @@ -202,13 +202,6 @@ extern void _DebPrint (const char *fmt, ...); | |||
| 202 | #endif | 202 | #endif |
| 203 | #endif | 203 | #endif |
| 204 | 204 | ||
| 205 | #ifdef emacs /* Don't do this for lib-src. */ | ||
| 206 | /* Tell regex-emacs.c to use a type compatible with Emacs. */ | ||
| 207 | #define RE_TRANSLATE_TYPE Lisp_Object | ||
| 208 | #define RE_TRANSLATE(TBL, C) char_table_translate (TBL, C) | ||
| 209 | #define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) | ||
| 210 | #endif | ||
| 211 | |||
| 212 | /* Tell time_rz.c to use Emacs's getter and setter for TZ. | 205 | /* Tell time_rz.c to use Emacs's getter and setter for TZ. |
| 213 | Only Emacs uses time_rz so this is OK. */ | 206 | Only Emacs uses time_rz so this is OK. */ |
| 214 | #define getenv_TZ emacs_getenv_TZ | 207 | #define getenv_TZ emacs_getenv_TZ |
diff --git a/src/regex-emacs.h b/src/regex-emacs.h index cb6dd76ed3e..9a6214af98c 100644 --- a/src/regex-emacs.h +++ b/src/regex-emacs.h | |||
| @@ -219,7 +219,7 @@ extern ptrdiff_t emacs_re_safe_alloca; | |||
| 219 | ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ | 219 | ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ |
| 220 | & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS)) | 220 | & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS)) |
| 221 | 221 | ||
| 222 | #define RE_SYNTAX_POSIX_AWK \ | 222 | #define RE_SYNTAX_POSIX_AWK \ |
| 223 | (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ | 223 | (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ |
| 224 | | RE_INTERVALS | RE_NO_GNU_OPS) | 224 | | RE_INTERVALS | RE_NO_GNU_OPS) |
| 225 | 225 | ||
| @@ -350,6 +350,11 @@ typedef enum | |||
| 350 | REG_ESIZEBR /* n or m too big in \{n,m\} */ | 350 | REG_ESIZEBR /* n or m too big in \{n,m\} */ |
| 351 | } reg_errcode_t; | 351 | } reg_errcode_t; |
| 352 | 352 | ||
| 353 | /* Use a type compatible with Emacs. */ | ||
| 354 | #define RE_TRANSLATE_TYPE Lisp_Object | ||
| 355 | #define RE_TRANSLATE(TBL, C) char_table_translate (TBL, C) | ||
| 356 | #define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) | ||
| 357 | |||
| 353 | /* This data structure represents a compiled pattern. Before calling | 358 | /* This data structure represents a compiled pattern. Before calling |
| 354 | the pattern compiler, the fields `buffer', `allocated', `fastmap', | 359 | the pattern compiler, the fields `buffer', `allocated', `fastmap', |
| 355 | `translate', and `no_sub' can be set. After the pattern has been | 360 | `translate', and `no_sub' can be set. After the pattern has been |