link-grammar-5.8.0/link-grammar/utilities.h
/** Returns length of UTF8 character.
 * Current algo is based on the first character only.
 * If pointer is not pointing at first char, or not a valid value, returns -1.
 * Returns 0 for NULL.
 */
Returns length of UTF8 character.
Current algo is based on the first character only.
If pointer is not pointing at first char, or not a valid value, returns -1.
Returns 0 for NULL.
Returns length of UTF8 character . Current algo is based on the first character only . If pointer is not pointing at first char or not a valid value returns - 1 . Returns 0 for NULL .
static inline int utf8_charlen(const char *xc)
{
	unsigned char c;
	c = (unsigned char) *xc;
	if (c == 0) return 0;
	if (c < 0x80) return 1;
	if ((c >= 0xc2) && (c < 0xe0)) return 2; 
	if ((c >= 0xe0) && (c < 0xf0)) return 3; 
	if ((c >= 0xf0) && (c <= 0xf4)) return 4; 
	return -1; 
}
static inline int utf8_charlen ( const char * xc ) { unsigned char c ; c = ( unsigned char ) * xc ; if ( c == 0 ) return 0 ; if ( c < 0x80 ) return 1 ; if ( ( c >= 0xc2 ) && ( c < 0xe0 ) ) return 2 ; if ( ( c >= 0xe0 ) && ( c < 0xf0 ) ) return 3 ; if ( ( c >= 0xf0 ) && ( c <= 0xf4 ) ) return 4 ; return -1 ; }
Returns length of UTF8 character.
Returns length of UTF8 character .
/* First byte of a code point U +0080 - U +07FF */ /* First byte of a code point U +0800 - U +FFFF */ /* First byte of a code point U +10000 - U +10FFFF */ /* Fallthrough -- not the first byte of a code-point. */