link-grammar-5.8.0/link-grammar/utilities.h
/**
 * Return true if the initial upper-case letters of the
 * two input strings match. Comparison stops when
 * both strings descend to lowercase.
 */
Return true if the initial upper-case letters of the
two input strings match. Comparison stops when
both strings descend to lowercase.
Return true if the initial upper - case letters of the two input strings match . Comparison stops when both strings descend to lowercase .
static inline bool utf8_upper_match(const char * s, const char * t,
                                    locale_t dict_locale)
{
	mbstate_t mbs, mbt;
	wchar_t ws, wt;
	int ns, nt;
	memset(&mbs, 0, sizeof(mbs));
	memset(&mbt, 0, sizeof(mbt));
	ns = mbrtowc(&ws, s, MB_CUR_MAX, &mbs);
	nt = mbrtowc(&wt, t, MB_CUR_MAX, &mbt);
	if (ns < 0 || nt < 0) return false;  
	while (iswupper_l(ws, dict_locale) || iswupper_l(wt, dict_locale))
	{
		if (ws != wt) return false;
		s += ns;
		t += nt;
		ns = mbrtowc(&ws, s, MB_CUR_MAX, &mbs);
		nt = mbrtowc(&wt, t, MB_CUR_MAX, &mbt);
		if (ns < 0 || nt < 0) return false;  
	}
	return true;
}
static inline bool utf8_upper_match ( const char * s , const char * t , locale_t dict_locale ) { mbstate_t mbs , mbt ; wchar_t ws , wt ; int ns , nt ; memset ( & mbs , 0 , sizeof ( mbs ) ) ; memset ( & mbt , 0 , sizeof ( mbt ) ) ; ns = mbrtowc ( & ws , s , MB_CUR_MAX , & mbs ) ; nt = mbrtowc ( & wt , t , MB_CUR_MAX , & mbt ) ; if ( ns < 0 || nt < 0 ) return false ; while ( iswupper_l ( ws , dict_locale ) || iswupper_l ( wt , dict_locale ) ) { if ( ws != wt ) return false ; s += ns ; t += nt ; ns = mbrtowc ( & ws , s , MB_CUR_MAX , & mbs ) ; nt = mbrtowc ( & wt , t , MB_CUR_MAX , & mbt ) ; if ( ns < 0 || nt < 0 ) return false ; } return true ; }
Return true if the initial upper-case letters of the
 two input strings match.
Return true if the initial upper - case letters of the two input strings match .
/* invalid mb sequence */ /* invalid mb sequence */