Exemple #1
0
static int
match_range_longchar(longchar * a, longchar * b, longchar * c, int ignore)
{
#ifdef USE_M17N
    if (a->type != b->type || a->type != c->type)
	return 0;
    if (a->type == RE_TYPE_WCHAR_T) {
	if (a->wch.ccs != c->wch.ccs || c->wch.ccs != b->wch.ccs)
	    return 0;
#ifdef USE_UNICODE
	if (ignore) {
	    wc_uint32 uc = wc_any_to_ucs(c->wch);

	    if (wc_is_ucs_alpha(uc)) {
	    	wc_uint32 ua = wc_any_to_ucs(a->wch);
	    	wc_uint32 ub = wc_any_to_ucs(b->wch);
		wc_uint32 upper = wc_ucs_toupper(uc);
		wc_uint32 lower = wc_ucs_tolower(uc);
		wc_uint32 title = wc_ucs_totitle(uc);

		return ((ua <= upper && upper <= ub) ||
			(ua <= lower && lower <= ub) ||
			(ua <= title && title <= ub));
	    }
	}
#endif
	return (a->wch.code <= c->wch.code && c->wch.code <= b->wch.code);
    }
#endif
    if (ignore && IS_ALPHA(c->ch))
	return ((a->ch <= TOLOWER(c->ch) && TOLOWER(c->ch) <= b->ch) ||
		(a->ch <= TOUPPER(c->ch) && TOUPPER(c->ch) <= b->ch));
    else
	return (a->ch <= c->ch && c->ch <= b->ch);
}
Exemple #2
0
wc_bool
wc_is_ucs_alnum(wc_uint32 ucs)
{
    return (wc_is_ucs_alpha(ucs) || wc_is_ucs_digit(ucs));
}