comparison src/regex.c @ 2201:8e39301eac59

[xemacs-hg @ 2004-08-04 19:45:16 by james] Fix previous "fix".
author james
date Wed, 04 Aug 2004 19:45:17 +0000
parents 35540b6052a9
children 04bc9d2f42c7
comparison
equal deleted inserted replaced
2200:35540b6052a9 2201:8e39301eac59
116 #define itext_ichar_len(ptr) 1 116 #define itext_ichar_len(ptr) 1
117 #define itext_ichar_len_fmt(ptr, fmt) 1 117 #define itext_ichar_len_fmt(ptr, fmt) 1
118 118
119 #include <string.h> 119 #include <string.h>
120 120
121 /* Define the syntax stuff for \<, \>, etc. */
122
123 /* This must be nonzero for the wordchar and notwordchar pattern
124 commands in re_match_2. */
125 #ifndef Sword
126 #define Sword 1
127 #endif
128
129 #ifdef SYNTAX_TABLE
130
131 extern char *re_syntax_table;
132
133 #else /* not SYNTAX_TABLE */
134
135 /* How many characters in the character set. */
136 #define CHAR_SET_SIZE 256
137
138 static char re_syntax_table[CHAR_SET_SIZE];
139
140 static void
141 init_syntax_once (void)
142 {
143 static int done = 0;
144
145 if (!done)
146 {
147 const char *word_syntax_chars =
148 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
149
150 memset (re_syntax_table, 0, sizeof (re_syntax_table));
151
152 while (*word_syntax_chars)
153 re_syntax_table[(unsigned int) (*word_syntax_chars++)] = Sword;
154
155 done = 1;
156 }
157 }
158
159 #endif /* SYNTAX_TABLE */
160
161 #define SYNTAX(ignored, c) re_syntax_table[c]
162 #undef SYNTAX_FROM_CACHE
163 #define SYNTAX_FROM_CACHE SYNTAX
164
165 #define RE_TRANSLATE_1(c) translate[(unsigned char) (c)]
166 #define TRANSLATE_P(tr) tr
167
168 #endif /* emacs */
169
121 /* This is for other GNU distributions with internationalized messages. */ 170 /* This is for other GNU distributions with internationalized messages. */
122 #if defined (I18N3) && (defined (HAVE_LIBINTL_H) || defined (_LIBC)) 171 #if defined (I18N3) && (defined (HAVE_LIBINTL_H) || defined (_LIBC))
123 # include <libintl.h> 172 # include <libintl.h>
124 #else 173 #else
125 # define gettext(msgid) (msgid) 174 # define gettext(msgid) (msgid)
126 #endif 175 #endif
127
128 /* Define the syntax stuff for \<, \>, etc. */
129
130 /* This must be nonzero for the wordchar and notwordchar pattern
131 commands in re_match_2. */
132 #ifndef Sword
133 #define Sword 1
134 #endif
135
136 #ifdef SYNTAX_TABLE
137
138 extern char *re_syntax_table;
139
140 #else /* not SYNTAX_TABLE */
141
142 /* How many characters in the character set. */
143 #define CHAR_SET_SIZE 256
144
145 static char re_syntax_table[CHAR_SET_SIZE];
146
147 static void
148 init_syntax_once (void)
149 {
150 static int done = 0;
151
152 if (!done)
153 {
154 const char *word_syntax_chars =
155 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
156
157 memset (re_syntax_table, 0, sizeof (re_syntax_table));
158
159 while (*word_syntax_chars)
160 re_syntax_table[(unsigned int) (*word_syntax_chars++)] = Sword;
161
162 done = 1;
163 }
164 }
165
166 #endif /* SYNTAX_TABLE */
167
168 #define SYNTAX(ignored, c) re_syntax_table[c]
169 #undef SYNTAX_FROM_CACHE
170 #define SYNTAX_FROM_CACHE SYNTAX
171
172 #define RE_TRANSLATE_1(c) translate[(unsigned char) (c)]
173 #define TRANSLATE_P(tr) tr
174
175 #endif /* emacs */
176 176
177 /* Under XEmacs, this is needed because we don't define it elsewhere. */ 177 /* Under XEmacs, this is needed because we don't define it elsewhere. */
178 #ifdef SWITCH_ENUM_BUG 178 #ifdef SWITCH_ENUM_BUG
179 #define SWITCH_ENUM_CAST(x) ((int)(x)) 179 #define SWITCH_ENUM_CAST(x) ((int)(x))
180 #else 180 #else