]> git.saurik.com Git - apple/libc.git/blob - regex/FreeBSD/regex2.h.patch
Libc-594.9.5.tar.gz
[apple/libc.git] / regex / FreeBSD / regex2.h.patch
1 --- regex2.h.orig 2005-04-19 14:43:24.000000000 -0700
2 +++ regex2.h 2005-04-19 14:41:08.000000000 -0700
3 @@ -124,16 +124,26 @@
4 int nranges;
5 int invert;
6 int icase;
7 + int *equiv_classes;
8 + int nequiv_classes;
9 } cset;
10
11 +#include "collate.h"
12 +
13 static int
14 -CHIN1(cs, ch)
15 +CHIN1(cs, ch, loc)
16 cset *cs;
17 wint_t ch;
18 +locale_t loc;
19 {
20 int i;
21
22 assert(ch >= 0);
23 + for (i = 0; i < cs->nequiv_classes; i++)
24 + /* sadly, we can only deal with single characters from an
25 + * equivalence class */
26 + if (__collate_equiv_match(cs->equiv_classes[i], NULL, 0, ch, NULL, 0, NULL, NULL, loc) > 0)
27 + return (!cs->invert);
28 if (ch < NC)
29 return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^
30 cs->invert);
31 @@ -144,26 +154,27 @@
32 if (cs->ranges[i].min <= ch && ch <= cs->ranges[i].max)
33 return (!cs->invert);
34 for (i = 0; i < cs->ntypes; i++)
35 - if (iswctype(ch, cs->types[i]))
36 + if (iswctype_l(ch, cs->types[i], loc))
37 return (!cs->invert);
38 return (cs->invert);
39 }
40
41 static __inline int
42 -CHIN(cs, ch)
43 +CHIN(cs, ch, loc)
44 cset *cs;
45 wint_t ch;
46 +locale_t loc;
47 {
48
49 assert(ch >= 0);
50 - if (ch < NC)
51 + if (ch < NC && cs->nequiv_classes == 0)
52 return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^
53 cs->invert);
54 else if (cs->icase)
55 - return (CHIN1(cs, ch) || CHIN1(cs, towlower(ch)) ||
56 - CHIN1(cs, towupper(ch)));
57 + return (CHIN1(cs, ch, loc) || CHIN1(cs, towlower_l(ch, loc), loc) ||
58 + CHIN1(cs, towupper_l(ch, loc), loc));
59 else
60 - return (CHIN1(cs, ch));
61 + return (CHIN1(cs, ch, loc));
62 }
63
64 /*
65 @@ -193,8 +204,9 @@
66 size_t nsub; /* copy of re_nsub */
67 int backrefs; /* does it use back references? */
68 sopno nplus; /* how deep does it nest +s? */
69 + locale_t loc; /* current locale */
70 };
71
72 /* misc utilities */
73 -#define OUT (-2) /* a non-character value */
74 -#define ISWORD(c) (iswalnum((uch)(c)) || (c) == '_')
75 +#define OUT (-130) /* a non-character value */
76 +#define ISWORD(c,l) (iswalnum_l((uch)(c), l) || (c) == '_')