aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Meyering1992-12-12 02:55:16 +0000
committerJim Meyering1992-12-12 02:55:16 +0000
commitc6b4078874633d5403b27c82d1a09a2f887cedf9 (patch)
treed42461bd1caacd722e0507c22881c2e2a6477111 /src
parent82a4c0084e4d08db954cb88a20b7f4fbeba1816b (diff)
downloademacs-c6b4078874633d5403b27c82d1a09a2f887cedf9.tar.gz
emacs-c6b4078874633d5403b27c82d1a09a2f887cedf9.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/regex.c57
1 files changed, 38 insertions, 19 deletions
diff --git a/src/regex.c b/src/regex.c
index a5594be55ed..a0e4e8950e5 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -124,15 +124,34 @@ init_syntax_once ()
124/* Get the interface, including the syntax bits. */ 124/* Get the interface, including the syntax bits. */
125#include "regex.h" 125#include "regex.h"
126 126
127
128/* isalpha etc. are used for the character classes. */ 127/* isalpha etc. are used for the character classes. */
129#include <ctype.h> 128#include <ctype.h>
130#ifndef isgraph 129
131#define isgraph(c) (isprint (c) && !isspace (c)) 130#ifndef isascii
131#define isascii(c) 1
132#endif 132#endif
133#ifndef isblank 133
134#define isblank(c) ((c) == ' ' || (c) == '\t') 134#ifdef isblank
135#define ISBLANK(c) (isascii (c) && isblank (c))
136#else
137#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
135#endif 138#endif
139#ifdef isgraph
140#define ISGRAPH(c) (isascii (c) && isgraph (c))
141#else
142#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c))
143#endif
144
145#define ISPRINT(c) (isascii (c) && isprint (c))
146#define ISDIGIT(c) (isascii (c) && isdigit (c))
147#define ISALNUM(c) (isascii (c) && isalnum (c))
148#define ISALPHA(c) (isascii (c) && isalpha (c))
149#define ISCNTRL(c) (isascii (c) && iscntrl (c))
150#define ISLOWER(c) (isascii (c) && islower (c))
151#define ISPUNCT(c) (isascii (c) && ispunct (c))
152#define ISSPACE(c) (isascii (c) && isspace (c))
153#define ISUPPER(c) (isascii (c) && isupper (c))
154#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
136 155
137#ifndef NULL 156#ifndef NULL
138#define NULL 0 157#define NULL 0
@@ -999,7 +1018,7 @@ typedef struct
999 { if (p != pend) \ 1018 { if (p != pend) \
1000 { \ 1019 { \
1001 PATFETCH (c); \ 1020 PATFETCH (c); \
1002 while (isdigit (c)) \ 1021 while (ISDIGIT (c)) \
1003 { \ 1022 { \
1004 if (num < 0) \ 1023 if (num < 0) \
1005 num = 0; \ 1024 num = 0; \
@@ -1464,18 +1483,18 @@ regex_compile (pattern, size, syntax, bufp)
1464 1483
1465 for (ch = 0; ch < 1 << BYTEWIDTH; ch++) 1484 for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
1466 { 1485 {
1467 if ( (is_alnum && isalnum (ch)) 1486 if ( (is_alnum && ISALNUM (ch))
1468 || (is_alpha && isalpha (ch)) 1487 || (is_alpha && ISALPHA (ch))
1469 || (is_blank && isblank (ch)) 1488 || (is_blank && ISBLANK (ch))
1470 || (is_cntrl && iscntrl (ch)) 1489 || (is_cntrl && ISCNTRL (ch))
1471 || (is_digit && isdigit (ch)) 1490 || (is_digit && ISDIGIT (ch))
1472 || (is_graph && isgraph (ch)) 1491 || (is_graph && ISGRAPH (ch))
1473 || (is_lower && islower (ch)) 1492 || (is_lower && ISLOWER (ch))
1474 || (is_print && isprint (ch)) 1493 || (is_print && ISPRINT (ch))
1475 || (is_punct && ispunct (ch)) 1494 || (is_punct && ISPUNCT (ch))
1476 || (is_space && isspace (ch)) 1495 || (is_space && ISSPACE (ch))
1477 || (is_upper && isupper (ch)) 1496 || (is_upper && ISUPPER (ch))
1478 || (is_xdigit && isxdigit (ch))) 1497 || (is_xdigit && ISXDIGIT (ch)))
1479 SET_LIST_BIT (ch); 1498 SET_LIST_BIT (ch);
1480 } 1499 }
1481 had_char_class = true; 1500 had_char_class = true;
@@ -4740,7 +4759,7 @@ regcomp (preg, pattern, cflags)
4740 4759
4741 /* Map uppercase characters to corresponding lowercase ones. */ 4760 /* Map uppercase characters to corresponding lowercase ones. */
4742 for (i = 0; i < CHAR_SET_SIZE; i++) 4761 for (i = 0; i < CHAR_SET_SIZE; i++)
4743 preg->translate[i] = isupper (i) ? tolower (i) : i; 4762 preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
4744 } 4763 }
4745 else 4764 else
4746 preg->translate = NULL; 4765 preg->translate = NULL;