Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/regex/regex2.h
Show All 30 Lines | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* @(#)regex2.h 8.4 (Berkeley) 3/20/94 | * @(#)regex2.h 8.4 (Berkeley) 3/20/94 | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
extern int __collate_equiv_value(const wchar_t); | |||||
/* | /* | ||||
* First, the stuff that ends up in the outside-world include file | * First, the stuff that ends up in the outside-world include file | ||||
= typedef off_t regoff_t; | = typedef off_t regoff_t; | ||||
= typedef struct { | = typedef struct { | ||||
= int re_magic; | = int re_magic; | ||||
= size_t re_nsub; // number of parenthesized subexpressions | = size_t re_nsub; // number of parenthesized subexpressions | ||||
= const char *re_endp; // end pointer for REG_PEND | = const char *re_endp; // end pointer for REG_PEND | ||||
= struct re_guts *re_g; // none of your business :-) | = struct re_guts *re_g; // none of your business :-) | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | typedef struct { | ||||
wctype_t *types; | wctype_t *types; | ||||
unsigned int ntypes; | unsigned int ntypes; | ||||
wint_t *wides; | wint_t *wides; | ||||
unsigned int nwides; | unsigned int nwides; | ||||
crange *ranges; | crange *ranges; | ||||
unsigned int nranges; | unsigned int nranges; | ||||
int invert; | int invert; | ||||
int icase; | int icase; | ||||
int cequiv; | |||||
} cset; | } cset; | ||||
static int | static int | ||||
CHIN1(cset *cs, wint_t ch) | CHIN1(cset *cs, wint_t ch) | ||||
{ | { | ||||
unsigned int i; | unsigned int i; | ||||
assert(ch >= 0); | assert(ch >= 0); | ||||
Show All 17 Lines | CHIN1(cset *cs, wint_t ch) | ||||
return (cs->invert); | return (cs->invert); | ||||
} | } | ||||
static __inline int | static __inline int | ||||
CHIN(cset *cs, wint_t ch) | CHIN(cset *cs, wint_t ch) | ||||
{ | { | ||||
assert(ch >= 0); | assert(ch >= 0); | ||||
if (cs->cequiv > 0 && cs->cequiv == __collate_equiv_value(ch)) | |||||
return (!cs->invert); | |||||
if (ch < NC) | if (ch < NC) | ||||
return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^ | return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^ | ||||
cs->invert); | cs->invert); | ||||
else if (cs->icase) | else if (cs->icase) | ||||
return (CHIN1(cs, ch) || CHIN1(cs, towlower(ch)) || | return (CHIN1(cs, ch) || CHIN1(cs, towlower(ch)) || | ||||
CHIN1(cs, towupper(ch))); | CHIN1(cs, towupper(ch))); | ||||
else | else | ||||
return (CHIN1(cs, ch)); | return (CHIN1(cs, ch)); | ||||
Show All 35 Lines |