Example #1
0
int ucd_isspace(codepoint_t c)
{
	switch (ucd_lookup_category(c))
	{
	case UCD_CATEGORY_Zl:
	case UCD_CATEGORY_Zp:
		return 1;
	case UCD_CATEGORY_Zs:
		switch (c) /* Exclude characters with the <noBreak> DispositionType */
		{
		case 0x00A0: /* U+00A0 : NO-BREAK SPACE */
		case 0x2007: /* U+2007 : FIGURE SPACE */
		case 0x202F: /* U+202F : NARROW NO-BREAK SPACE */
			return 0;
		}
		return 1;
	case UCD_CATEGORY_Cc:
		switch (c) /* Include control characters marked as White_Space */
		{
		case 0x09: /* U+0009 : CHARACTER TABULATION */
		case 0x0A: /* U+000A : LINE FEED */
		case 0x0B: /* U+000B : LINE TABULATION */
		case 0x0C: /* U+000C : FORM FEED */
		case 0x0D: /* U+000D : CARRIAGE RETURN */
		case 0x85: /* U+0085 : NEXT LINE */
			return 1;
		}
	default:
		return 0;
	}
}
Example #2
0
int ucd_isprint(codepoint_t c)
{
	switch (ucd_lookup_category(c))
	{
	case UCD_CATEGORY_Cc:
	case UCD_CATEGORY_Cf:
	case UCD_CATEGORY_Cn:
	case UCD_CATEGORY_Co:
	case UCD_CATEGORY_Cs:
	case UCD_CATEGORY_Ii:
		return 0;
	default:
		return 1;
	}
}
Example #3
0
int ucd_isupper(codepoint_t c)
{
	ucd_category cat = ucd_lookup_category(c);
	switch (cat)
	{
	case UCD_CATEGORY_Lu:
		return 1;
	case UCD_CATEGORY_Lt:
		return ucd_tolower(c) != c;
	case UCD_CATEGORY_Nl:
	case UCD_CATEGORY_So:
		return (ucd_properties(c, cat) & UCD_PROPERTY_OTHER_UPPERCASE) == UCD_PROPERTY_OTHER_UPPERCASE;
	default:
		return 0;
	}
}
Example #4
0
int ucd_ispunct(codepoint_t c)
{
	switch (ucd_lookup_category(c))
	{
	case UCD_CATEGORY_Pc:
	case UCD_CATEGORY_Pd:
	case UCD_CATEGORY_Pe:
	case UCD_CATEGORY_Pf:
	case UCD_CATEGORY_Pi:
	case UCD_CATEGORY_Po:
	case UCD_CATEGORY_Ps:
		return 1;
	default:
		return 0;
	}
}
Example #5
0
int ucd_isblank(codepoint_t c)
{
	switch (ucd_lookup_category(c))
	{
	case UCD_CATEGORY_Zs:
		switch (c) /* Exclude characters with the <noBreak> DispositionType */
		{
		case 0x00A0: /* U+00A0 : NO-BREAK SPACE */
		case 0x2007: /* U+2007 : FIGURE SPACE */
		case 0x202F: /* U+202F : NARROW NO-BREAK SPACE */
			return 0;
		}
		return 1;
	case UCD_CATEGORY_Cc:
		return c == 0x09; /* U+0009 : CHARACTER TABULATION */
	default:
		return 0;
	}
}
Example #6
0
int ucd_isalpha(codepoint_t c)
{
	ucd_category cat = ucd_lookup_category(c);
	switch (cat)
	{
	case UCD_CATEGORY_Lu:
	case UCD_CATEGORY_Ll:
	case UCD_CATEGORY_Lt:
	case UCD_CATEGORY_Lm:
	case UCD_CATEGORY_Lo:
	case UCD_CATEGORY_Nl:
		return 1;
	case UCD_CATEGORY_Mn:
	case UCD_CATEGORY_Mc:
	case UCD_CATEGORY_So:
		return (ucd_properties(c, cat) & UCD_PROPERTY_OTHER_ALPHABETIC) == UCD_PROPERTY_OTHER_ALPHABETIC;
	default:
		return 0;
	}
}
Example #7
0
int ucd_iscntrl(codepoint_t c)
{
	return ucd_lookup_category(c) == UCD_CATEGORY_Cc;
}