Mercurial > emacs
comparison src/search.c @ 13237:1aa239b8d03c
(compile_pattern_1, compile_pattern, search_buffer):
Case tables are char-tables now.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 18 Oct 1995 23:30:32 +0000 |
parents | 34d269b30df1 |
children | bc92156aa523 |
comparison
equal
deleted
inserted
replaced
13236:c9af99bb26d4 | 13237:1aa239b8d03c |
---|---|
107 | 107 |
108 static void | 108 static void |
109 compile_pattern_1 (cp, pattern, translate, regp, posix) | 109 compile_pattern_1 (cp, pattern, translate, regp, posix) |
110 struct regexp_cache *cp; | 110 struct regexp_cache *cp; |
111 Lisp_Object pattern; | 111 Lisp_Object pattern; |
112 char *translate; | 112 Lisp_Object *translate; |
113 struct re_registers *regp; | 113 struct re_registers *regp; |
114 int posix; | 114 int posix; |
115 { | 115 { |
116 CONST char *val; | 116 CONST char *val; |
117 reg_syntax_t old; | 117 reg_syntax_t old; |
145 | 145 |
146 struct re_pattern_buffer * | 146 struct re_pattern_buffer * |
147 compile_pattern (pattern, regp, translate, posix) | 147 compile_pattern (pattern, regp, translate, posix) |
148 Lisp_Object pattern; | 148 Lisp_Object pattern; |
149 struct re_registers *regp; | 149 struct re_registers *regp; |
150 char *translate; | 150 Lisp_Object *translate; |
151 int posix; | 151 int posix; |
152 { | 152 { |
153 struct regexp_cache *cp, **cpp; | 153 struct regexp_cache *cp, **cpp; |
154 | 154 |
155 for (cpp = &searchbuf_head; ; cpp = &cp->next) | 155 for (cpp = &searchbuf_head; ; cpp = &cp->next) |
833 lim = BEGV; | 833 lim = BEGV; |
834 } | 834 } |
835 | 835 |
836 np = search_buffer (string, point, lim, n, RE, | 836 np = search_buffer (string, point, lim, n, RE, |
837 (!NILP (current_buffer->case_fold_search) | 837 (!NILP (current_buffer->case_fold_search) |
838 ? XSTRING (current_buffer->case_canon_table)->data : 0), | 838 ? XCHAR_TABLE (current_buffer->case_canon_table)->contents |
839 : 0), | |
839 (!NILP (current_buffer->case_fold_search) | 840 (!NILP (current_buffer->case_fold_search) |
840 ? XSTRING (current_buffer->case_eqv_table)->data : 0), | 841 ? XCHAR_TABLE (current_buffer->case_eqv_table)->contents |
842 : 0), | |
841 posix); | 843 posix); |
842 if (np <= 0) | 844 if (np <= 0) |
843 { | 845 { |
844 if (NILP (noerror)) | 846 if (NILP (noerror)) |
845 return signal_failure (string); | 847 return signal_failure (string); |
916 Lisp_Object string; | 918 Lisp_Object string; |
917 int pos; | 919 int pos; |
918 int lim; | 920 int lim; |
919 int n; | 921 int n; |
920 int RE; | 922 int RE; |
921 register unsigned char *trt; | 923 Lisp_Object *trt; |
922 register unsigned char *inverse_trt; | 924 Lisp_Object *inverse_trt; |
923 int posix; | 925 int posix; |
924 { | 926 { |
925 int len = XSTRING (string)->size; | 927 int len = XSTRING (string)->size; |
926 unsigned char *base_pat = XSTRING (string)->data; | 928 unsigned char *base_pat = XSTRING (string)->data; |
927 register int *BM_tab; | 929 register int *BM_tab; |
950 | 952 |
951 if (RE && !trivial_regexp_p (string)) | 953 if (RE && !trivial_regexp_p (string)) |
952 { | 954 { |
953 struct re_pattern_buffer *bufp; | 955 struct re_pattern_buffer *bufp; |
954 | 956 |
955 bufp = compile_pattern (string, &search_regs, (char *) trt, posix); | 957 bufp = compile_pattern (string, &search_regs, trt, posix); |
956 | 958 |
957 immediate_quit = 1; /* Quit immediately if user types ^G, | 959 immediate_quit = 1; /* Quit immediately if user types ^G, |
958 because letting this function finish | 960 because letting this function finish |
959 can take too long. */ | 961 can take too long. */ |
960 QUIT; /* Do a pending quit right away, | 962 QUIT; /* Do a pending quit right away, |
1120 if (i == infinity) | 1122 if (i == infinity) |
1121 stride_for_teases = BM_tab[j]; | 1123 stride_for_teases = BM_tab[j]; |
1122 BM_tab[j] = dirlen - i; | 1124 BM_tab[j] = dirlen - i; |
1123 /* A translation table is accompanied by its inverse -- see */ | 1125 /* A translation table is accompanied by its inverse -- see */ |
1124 /* comment following downcase_table for details */ | 1126 /* comment following downcase_table for details */ |
1125 while ((j = inverse_trt[j]) != k) | 1127 while ((j = (unsigned char) inverse_trt[j]) != k) |
1126 BM_tab[j] = dirlen - i; | 1128 BM_tab[j] = dirlen - i; |
1127 } | 1129 } |
1128 else | 1130 else |
1129 { | 1131 { |
1130 if (i == infinity) | 1132 if (i == infinity) |