diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2018-08-05 18:41:20 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2018-08-05 19:36:09 -0700 |
commit | e5652268a993ad9117f7253553c143d60460eb8f (patch) | |
tree | 82b54b12fa3c5d41fd5e5345f19613b722709495 | |
parent | ba8eb994f86206f69cbf9743a67b9d86ef9b1d8f (diff) | |
download | emacs-e5652268a993ad9117f7253553c143d60460eb8f.tar.gz |
Rename src/regex.c to src/regex-emacs.c.
This is in preparation for using Gnulib regex for etags,
to avoid collisions in include directives.
* src/regex-emacs.c: Rename from src/regex.c.
* src/regex-emacs.h: Rename from src/regex.h. All uses changed.
* test/src/regex-emacs-tests.el: Rename from test/src/regex-tests.el.
-rw-r--r-- | admin/MAINTAINERS | 2 | ||||
-rw-r--r-- | admin/find-gc.el | 2 | ||||
-rw-r--r-- | lib-src/Makefile.in | 6 | ||||
-rw-r--r-- | lib-src/etags.c | 2 | ||||
-rw-r--r-- | lisp/char-fold.el | 2 | ||||
-rw-r--r-- | src/Makefile.in | 2 | ||||
-rw-r--r-- | src/casetab.c | 3 | ||||
-rw-r--r-- | src/conf_post.h | 2 | ||||
-rw-r--r-- | src/deps.mk | 9 | ||||
-rw-r--r-- | src/emacs.c | 8 | ||||
-rw-r--r-- | src/regex-emacs.c (renamed from src/regex.c) | 55 | ||||
-rw-r--r-- | src/regex-emacs.h (renamed from src/regex.h) | 8 | ||||
-rw-r--r-- | src/search.c | 11 | ||||
-rw-r--r-- | src/syntax.c | 11 | ||||
-rw-r--r-- | src/thread.h | 2 | ||||
-rw-r--r-- | test/src/regex-emacs-tests.el (renamed from test/src/regex-tests.el) | 6 |
16 files changed, 69 insertions, 62 deletions
diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS index 1a4157ac53e..10633a8e0e8 100644 --- a/admin/MAINTAINERS +++ b/admin/MAINTAINERS @@ -37,7 +37,7 @@ Kenichi Handa Mule Stefan Monnier - src/regex.c + src/regex-emacs.c src/syntax.c src/keymap.c font-lock/jit-lock/syntax diff --git a/admin/find-gc.el b/admin/find-gc.el index fb564039c7b..e8cc1136501 100644 --- a/admin/find-gc.el +++ b/admin/find-gc.el @@ -57,7 +57,7 @@ Each entry has the form (FUNCTION . FUNCTIONS-IT-CALLS).") "keymap.c" "sysdep.c" "buffer.c" "filelock.c" "insdel.c" "marker.c" "minibuf.c" "fileio.c" "dired.c" "cmds.c" "casefiddle.c" - "indent.c" "search.c" "regex.c" "undo.c" + "indent.c" "search.c" "regex-emacs.c" "undo.c" "alloc.c" "data.c" "doc.c" "editfns.c" "callint.c" "eval.c" "fns.c" "print.c" "lread.c" "syntax.c" "unexcoff.c" diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index fa37d8ed85d..e70b23c4b3f 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -361,13 +361,13 @@ TAGS: etags${EXEEXT} ${tagsfiles} ../lib/libgnu.a: $(config_h) $(MAKE) -C ../lib all -regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h) +regex-emacs.o: $(srcdir)/../src/regex-emacs.c $(srcdir)/../src/regex-emacs.h $(config_h) $(AM_V_CC)$(CC) -c $(CPP_CFLAGS) $< -etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h) +etags_deps = ${srcdir}/etags.c regex-emacs.o $(NTLIB) $(config_h) etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@ -etags_libs = regex.o $(NTLIB) $(LOADLIBES) +etags_libs = regex-emacs.o $(NTLIB) $(LOADLIBES) etags${EXEEXT}: ${etags_deps} $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs) diff --git a/lib-src/etags.c b/lib-src/etags.c index b3b4575e0a6..47d13116db6 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -135,7 +135,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; #endif #include <getopt.h> -#include <regex.h> +#include <regex-emacs.h> /* Define CTAGS to make the program "ctags" compatible with the usual one. Leave it undefined to make the program "etags", which makes emacs-style diff --git a/lisp/char-fold.el b/lisp/char-fold.el index 9c05e364dfd..86bd6038e36 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -214,7 +214,7 @@ from which to start." (when (> spaces 0) (push (char-fold--make-space-string spaces) out)) (let ((regexp (apply #'concat (nreverse out)))) - ;; Limited by `MAX_BUF_SIZE' in `regex.c'. + ;; Limited by `MAX_BUF_SIZE' in `regex-emacs.c'. (if (> (length regexp) 5000) (regexp-quote string) regexp)))) diff --git a/src/Makefile.in b/src/Makefile.in index c3bcc503492..1aae27b2f91 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -391,7 +391,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ emacs.o keyboard.o macros.o keymap.o sysdep.o \ buffer.o filelock.o insdel.o marker.o \ minibuf.o fileio.o dired.o \ - cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \ + cmds.o casetab.o casefiddle.o indent.o search.o regex-emacs.o undo.o \ alloc.o data.o doc.o editfns.o callint.o \ eval.o floatfns.o fns.o font.o print.o lread.o $(MODULES_OBJ) \ syntax.o $(UNEXEC_OBJ) bytecode.o \ diff --git a/src/casetab.c b/src/casetab.c index 8f806a0647c..36f94f43dbc 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -144,7 +144,8 @@ set_case_table (Lisp_Object table, bool standard) set_char_table_extras (table, 2, eqv); } - /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + /* This is so set_image_of_range_1 in regex-emacs.c can find the EQV + table. */ set_char_table_extras (canon, 2, eqv); if (standard) diff --git a/src/conf_post.h b/src/conf_post.h index 080d7b7e688..8d56f0b4905 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -203,7 +203,7 @@ extern void _DebPrint (const char *fmt, ...); #endif #ifdef emacs /* Don't do this for lib-src. */ -/* Tell regex.c to use a type compatible with Emacs. */ +/* Tell regex-emacs.c to use a type compatible with Emacs. */ #define RE_TRANSLATE_TYPE Lisp_Object #define RE_TRANSLATE(TBL, C) char_table_translate (TBL, C) #define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) diff --git a/src/deps.mk b/src/deps.mk index 7b6ae9cd8e0..f202d0e1041 100644 --- a/src/deps.mk +++ b/src/deps.mk @@ -71,7 +71,7 @@ cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \ pre-crt0.o: pre-crt0.c dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h) dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \ - coding.h regex.h systime.h blockinput.h atimer.h composite.h \ + coding.h regex-emacs.h systime.h blockinput.h atimer.h composite.h \ ../lib/filemode.h ../lib/unistd.h globals.h dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \ window.h buffer.h termchar.h termopts.h termhooks.h cm.h \ @@ -169,20 +169,21 @@ process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \ blockinput.h atimer.h coding.h msdos.h nsterm.h composite.h \ keyboard.h lisp.h globals.h $(config_h) character.h xgselect.h sysselect.h \ ../lib/unistd.h gnutls.h -regex.o: regex.c syntax.h buffer.h lisp.h globals.h $(config_h) regex.h \ +regex-emacs.o: regex-emacs.c syntax.h buffer.h lisp.h globals.h \ + $(config_h) regex-emacs.h \ category.h character.h region-cache.o: region-cache.c buffer.h region-cache.h \ lisp.h globals.h $(config_h) scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \ termhooks.h lisp.h globals.h $(config_h) systime.h coding.h composite.h \ window.h -search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \ +search.o: search.c regex-emacs.h commands.h buffer.h region-cache.h syntax.h \ blockinput.h atimer.h systime.h category.h character.h charset.h \ $(INTERVALS_H) lisp.h globals.h $(config_h) sound.o: sound.c dispextern.h syssignal.h lisp.h globals.h $(config_h) \ atimer.h systime.h ../lib/unistd.h msdos.h syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \ - keymap.h regex.h $(INTERVALS_H) lisp.h globals.h $(config_h) + keymap.h regex-emacs.h $(INTERVALS_H) lisp.h globals.h $(config_h) sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \ frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \ diff --git a/src/emacs.c b/src/emacs.c index 130a9f8fc8e..7304bc406eb 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -84,7 +84,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include "composite.h" #include "dispextern.h" #include "ptr-bounds.h" -#include "regex.h" +#include "regex-emacs.h" #include "sheap.h" #include "syntax.h" #include "sysselect.h" @@ -846,9 +846,9 @@ main (int argc, char **argv) { rlim_t lim = rlim.rlim_cur; - /* Approximate the amount regex.c needs per unit of + /* Approximate the amount regex-emacs.c needs per unit of emacs_re_max_failures, then add 33% to cover the size of the - smaller stacks that regex.c successively allocates and + smaller stacks that regex-emacs.c successively allocates and discards on its way to the maximum. */ int min_ratio = 20 * sizeof (char *); int ratio = min_ratio + min_ratio / 3; @@ -887,7 +887,7 @@ main (int argc, char **argv) lim = newlim; } } - /* If the stack is big enough, let regex.c more of it before + /* If the stack is big enough, let regex-emacs.c more of it before falling back to heap allocation. */ emacs_re_safe_alloca = max (min (lim - extra, SIZE_MAX) * (min_ratio / ratio), diff --git a/src/regex.c b/src/regex-emacs.c index 6ee13c4c99d..08fc8c67f1c 100644 --- a/src/regex.c +++ b/src/regex-emacs.c @@ -53,7 +53,8 @@ #include <stdlib.h> #ifdef emacs -/* We need this for `regex.h', and perhaps for the Emacs include files. */ +/* We need this for `regex-emacs.h', and perhaps for the Emacs include + files. */ # include <sys/types.h> #endif @@ -289,7 +290,7 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; #endif /* Get the interface, including the syntax bits. */ -#include "regex.h" +#include "regex-emacs.h" /* isalpha etc. are used for the character classes. */ #include <ctype.h> @@ -1157,7 +1158,7 @@ reg_syntax_t re_syntax_options; different, incompatible syntaxes. The argument SYNTAX is a bit mask comprised of the various bits - defined in regex.h. We return the old syntax. */ + defined in regex-emacs.h. We return the old syntax. */ reg_syntax_t re_set_syntax (reg_syntax_t syntax) @@ -1172,7 +1173,7 @@ WEAK_ALIAS (__re_set_syntax, re_set_syntax) #endif /* This table gives an error message for each of the error codes listed - in regex.h. Obviously the order here has to be same as there. + in regex-emacs.h. Obviously the order here has to be same as there. POSIX doesn't require that we do anything for REG_NOERROR, but why not be nice? */ @@ -1474,28 +1475,28 @@ do { \ char *destination; \ /* Must be int, so when we don't save any registers, the arithmetic \ of 0 + -1 isn't done as unsigned. */ \ - \ + \ DEBUG_STATEMENT (nfailure_points_pushed++); \ DEBUG_PRINT ("\nPUSH_FAILURE_POINT:\n"); \ DEBUG_PRINT (" Before push, next avail: %zd\n", (fail_stack).avail); \ DEBUG_PRINT (" size: %zd\n", (fail_stack).size);\ - \ + \ ENSURE_FAIL_STACK (NUM_NONREG_ITEMS); \ - \ + \ DEBUG_PRINT ("\n"); \ - \ + \ DEBUG_PRINT (" Push frame index: %zd\n", fail_stack.frame); \ PUSH_FAILURE_INT (fail_stack.frame); \ - \ + \ DEBUG_PRINT (" Push string %p: \"", string_place); \ DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, size2);\ DEBUG_PRINT ("\"\n"); \ PUSH_FAILURE_POINTER (string_place); \ - \ + \ DEBUG_PRINT (" Push pattern %p: ", pattern); \ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern, pend); \ PUSH_FAILURE_POINTER (pattern); \ - \ + \ /* Close the frame by moving the frame pointer past it. */ \ fail_stack.frame = fail_stack.avail; \ } while (0) @@ -1822,7 +1823,7 @@ struct range_table_work_area #define SETUP_ASCII_RANGE(work_area, FROM, TO) \ do { \ int C0, C1; \ - \ + \ for (C0 = (FROM); C0 <= (TO); C0++) \ { \ C1 = TRANSLATE (C0); \ @@ -1843,7 +1844,7 @@ struct range_table_work_area do { \ int C0, C1, C2, I; \ int USED = RANGE_TABLE_WORK_USED (work_area); \ - \ + \ for (C0 = (FROM); C0 <= (TO); C0++) \ { \ C1 = RE_CHAR_TO_MULTIBYTE (C0); \ @@ -1882,7 +1883,7 @@ struct range_table_work_area #define SETUP_MULTIBYTE_RANGE(work_area, FROM, TO) \ do { \ int C0, C1, C2, I, USED = RANGE_TABLE_WORK_USED (work_area); \ - \ + \ SET_RANGE_TABLE_WORK_AREA ((work_area), (FROM), (TO)); \ for (C0 = (FROM); C0 <= (TO); C0++) \ { \ @@ -1896,7 +1897,7 @@ struct range_table_work_area { \ int from = RANGE_TABLE_WORK_ELT (work_area, I); \ int to = RANGE_TABLE_WORK_ELT (work_area, I + 1); \ - \ + \ if (C1 >= from - 1 && C1 <= to + 1) \ { \ if (C1 == from - 1) \ @@ -2371,7 +2372,7 @@ static boolean group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum); /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. - Returns one of error codes defined in `regex.h', or zero for success. + Returns one of error codes defined in `regex-emacs.h', or zero for success. If WHITESPACE_REGEXP is given (only #ifdef emacs), it is used instead of a space character in PATTERN. @@ -2714,15 +2715,15 @@ regex_compile (re_char *pattern, size_t size, if (!zero_times_ok && simple) { /* Since simple * loops can be made faster by using - on_failure_keep_string_jump, we turn simple P+ - into PP* if P is simple. */ - unsigned char *p1, *p2; - startoffset = b - laststart; - GET_BUFFER_SPACE (startoffset); - p1 = b; p2 = laststart; - while (p2 < p1) - *b++ = *p2++; - zero_times_ok = 1; + on_failure_keep_string_jump, we turn simple P+ + into PP* if P is simple. */ + unsigned char *p1, *p2; + startoffset = b - laststart; + GET_BUFFER_SPACE (startoffset); + p1 = b; p2 = laststart; + while (p2 < p1) + *b++ = *p2++; + zero_times_ok = 1; } GET_BUFFER_SPACE (6); @@ -6217,7 +6218,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, re_char *string1, FREE_VARIABLES (); - return -1; /* Failure to match. */ + return -1; /* Failure to match. */ } /* Subroutine definitions for re_match_2. */ @@ -6400,7 +6401,7 @@ re_exec (const char *s) routine will report only success or failure, and nothing about the registers. - It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for + It returns 0 if it succeeds, nonzero if it doesn't. (See regex-emacs.h for the return codes and their meanings.) */ reg_errcode_t diff --git a/src/regex.h b/src/regex-emacs.h index 3a2d74d86a1..cb6dd76ed3e 100644 --- a/src/regex.h +++ b/src/regex-emacs.h @@ -160,9 +160,9 @@ typedef unsigned long reg_syntax_t; /* If this bit is set, turn on internal regex debugging. If not set, and debugging was on, turn it off. - This only works if regex.c is compiled -DDEBUG. + This only works if regex-emacs.c is compiled -DDEBUG. We define this bit always, so that all that's needed to turn on - debugging is to recompile regex.c; the calling code can always have + debugging is to recompile regex-emacs.c; the calling code can always have this bit set, and it won't affect anything in the normal case. */ #define RE_DEBUG (RE_NO_NEWLINE_ANCHOR << 1) @@ -317,7 +317,7 @@ extern ptrdiff_t emacs_re_safe_alloca; /* If any error codes are removed, changed, or added, update the - `re_error_msg' table in regex.c. */ + `re_error_msg' table in regex-emacs.c. */ typedef enum { #ifdef _XOPEN_SOURCE @@ -650,5 +650,5 @@ typedef int re_wchar_t; #endif /* not WIDE_CHAR_SUPPORT */ -#endif /* regex.h */ +#endif /* regex-emacs.h */ diff --git a/src/search.c b/src/search.c index ccdb659776d..d4b03220412 100644 --- a/src/search.c +++ b/src/search.c @@ -30,7 +30,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include "blockinput.h" #include "intervals.h" -#include "regex.h" +#include "regex-emacs.h" #define REGEXP_CACHE_SIZE 20 @@ -290,7 +290,8 @@ looking_at_1 (Lisp_Object string, bool posix) if (running_asynch_code) save_search_regs (); - /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + /* This is so set_image_of_range_1 in regex-emacs.c can find the EQV + table. */ set_char_table_extras (BVAR (current_buffer, case_canon_table), 2, BVAR (current_buffer, case_eqv_table)); @@ -410,7 +411,8 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, pos_byte = string_char_to_byte (string, pos); } - /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + /* This is so set_image_of_range_1 in regex-emacs.c can find the EQV + table. */ set_char_table_extras (BVAR (current_buffer, case_canon_table), 2, BVAR (current_buffer, case_eqv_table)); @@ -1062,7 +1064,8 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, lim_byte = CHAR_TO_BYTE (lim); } - /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + /* This is so set_image_of_range_1 in regex-emacs.c can find the EQV + table. */ set_char_table_extras (BVAR (current_buffer, case_canon_table), 2, BVAR (current_buffer, case_eqv_table)); diff --git a/src/syntax.c b/src/syntax.c index c5a4b03955b..2f9fd05ddf4 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -23,7 +23,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include "lisp.h" #include "character.h" #include "buffer.h" -#include "regex.h" +#include "regex-emacs.h" #include "syntax.h" #include "intervals.h" #include "category.h" @@ -267,9 +267,10 @@ SETUP_SYNTAX_TABLE (ptrdiff_t from, ptrdiff_t count) If it is t (which is only used in fast_c_string_match_ignore_case), ignore properties altogether. - This is meant for regex.c to use. For buffers, regex.c passes arguments - to the UPDATE_SYNTAX_TABLE functions which are relative to BEGV. - So if it is a buffer, we set the offset field to BEGV. */ + This is meant for regex-emacs.c to use. For buffers, regex-emacs.c + passes arguments to the UPDATE_SYNTAX_TABLE functions which are + relative to BEGV. So if it is a buffer, we set the offset field to + BEGV. */ void SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, @@ -3729,7 +3730,7 @@ syms_of_syntax (void) staticpro (&gl_state.current_syntax_table); staticpro (&gl_state.old_prop); - /* Defined in regex.c. */ + /* Defined in regex-emacs.c. */ staticpro (&re_match_object); DEFSYM (Qscan_error, "scan-error"); diff --git a/src/thread.h b/src/thread.h index 922eea62178..e1eb40921b4 100644 --- a/src/thread.h +++ b/src/thread.h @@ -19,7 +19,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #ifndef THREAD_H #define THREAD_H -#include "regex.h" +#include "regex-emacs.h" #ifdef WINDOWSNT #include <sys/socket.h> diff --git a/test/src/regex-tests.el b/test/src/regex-emacs-tests.el index 083ed5c4c8c..7a075908a6b 100644 --- a/test/src/regex-tests.el +++ b/test/src/regex-emacs-tests.el @@ -1,4 +1,4 @@ -;;; regex-tests.el --- tests for regex.c functions -*- lexical-binding: t -*- +;;; regex-emacs-tests.el --- tests for regex-emacs.c -*- lexical-binding: t -*- ;; Copyright (C) 2015-2018 Free Software Foundation, Inc. @@ -24,7 +24,7 @@ (defvar regex-tests--resources-dir (concat (concat (file-name-directory (or load-file-name buffer-file-name)) "/regex-resources/")) - "Path to regex-resources directory next to the \"regex-tests.el\" file.") + "Path to regex-resources directory next to the \"regex-emacs-tests.el\" file.") (ert-deftest regex-word-cc-fallback-test () "Test that \"[[:cc:]]*x\" matches \"x\" (bug#24020). @@ -683,4 +683,4 @@ This evaluates the TESTS test cases from glibc." (should-not (string-match "\\`x\\{65535\\}" (make-string 65534 ?x))) (should-error (string-match "\\`x\\{65536\\}" "X") :type 'invalid-regexp)) -;;; regex-tests.el ends here +;;; regex-emacs-tests.el ends here |