indentation consistency
This commit is contained in:
parent
c851c67888
commit
11d2ece545
61
utf8proc.c
61
utf8proc.c
@ -1,3 +1,4 @@
|
|||||||
|
/* -*- mode: c; c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Public Software Group e. V., Berlin, Germany
|
* Copyright (c) 2009 Public Software Group e. V., Berlin, Germany
|
||||||
*
|
*
|
||||||
@ -87,7 +88,7 @@ DLLEXPORT const int8_t utf8proc_utf8class[256] = {
|
|||||||
#define STRINGIZEx(x) #x
|
#define STRINGIZEx(x) #x
|
||||||
#define STRINGIZE(x) STRINGIZEx(x)
|
#define STRINGIZE(x) STRINGIZEx(x)
|
||||||
DLLEXPORT const char *utf8proc_version(void) {
|
DLLEXPORT const char *utf8proc_version(void) {
|
||||||
return STRINGIZE(UTF8PROC_VERSION_MAJOR) "." STRINGIZE(UTF8PROC_VERSION_MINOR) "." STRINGIZE(UTF8PROC_VERSION_PATCH) "-dev";
|
return STRINGIZE(UTF8PROC_VERSION_MAJOR) "." STRINGIZE(UTF8PROC_VERSION_MINOR) "." STRINGIZE(UTF8PROC_VERSION_PATCH) "-dev";
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT const char *utf8proc_errmsg(ssize_t errcode) {
|
DLLEXPORT const char *utf8proc_errmsg(ssize_t errcode) {
|
||||||
@ -195,54 +196,54 @@ static const utf8proc_property_t *get_property(int32_t uc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT const utf8proc_property_t *utf8proc_get_property(int32_t uc) {
|
DLLEXPORT const utf8proc_property_t *utf8proc_get_property(int32_t uc) {
|
||||||
return uc < 0 || uc >= 0x110000 ? utf8proc_properties : get_property(uc);
|
return uc < 0 || uc >= 0x110000 ? utf8proc_properties : get_property(uc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return whether there is a grapheme break between boundclasses lbc and tbc */
|
/* return whether there is a grapheme break between boundclasses lbc and tbc */
|
||||||
static bool grapheme_break(int lbc, int tbc) {
|
static bool grapheme_break(int lbc, int tbc) {
|
||||||
return
|
return
|
||||||
(lbc == UTF8PROC_BOUNDCLASS_START) ? true :
|
(lbc == UTF8PROC_BOUNDCLASS_START) ? true :
|
||||||
(lbc == UTF8PROC_BOUNDCLASS_CR &&
|
(lbc == UTF8PROC_BOUNDCLASS_CR &&
|
||||||
tbc == UTF8PROC_BOUNDCLASS_LF) ? false :
|
tbc == UTF8PROC_BOUNDCLASS_LF) ? false :
|
||||||
(lbc >= UTF8PROC_BOUNDCLASS_CR && lbc <= UTF8PROC_BOUNDCLASS_CONTROL) ? true :
|
(lbc >= UTF8PROC_BOUNDCLASS_CR && lbc <= UTF8PROC_BOUNDCLASS_CONTROL) ? true :
|
||||||
(tbc >= UTF8PROC_BOUNDCLASS_CR && tbc <= UTF8PROC_BOUNDCLASS_CONTROL) ? true :
|
(tbc >= UTF8PROC_BOUNDCLASS_CR && tbc <= UTF8PROC_BOUNDCLASS_CONTROL) ? true :
|
||||||
(tbc == UTF8PROC_BOUNDCLASS_EXTEND) ? false :
|
(tbc == UTF8PROC_BOUNDCLASS_EXTEND) ? false :
|
||||||
(lbc == UTF8PROC_BOUNDCLASS_L &&
|
(lbc == UTF8PROC_BOUNDCLASS_L &&
|
||||||
(tbc == UTF8PROC_BOUNDCLASS_L ||
|
(tbc == UTF8PROC_BOUNDCLASS_L ||
|
||||||
tbc == UTF8PROC_BOUNDCLASS_V ||
|
tbc == UTF8PROC_BOUNDCLASS_V ||
|
||||||
tbc == UTF8PROC_BOUNDCLASS_LV ||
|
tbc == UTF8PROC_BOUNDCLASS_LV ||
|
||||||
tbc == UTF8PROC_BOUNDCLASS_LVT)) ? false :
|
tbc == UTF8PROC_BOUNDCLASS_LVT)) ? false :
|
||||||
((lbc == UTF8PROC_BOUNDCLASS_LV ||
|
((lbc == UTF8PROC_BOUNDCLASS_LV ||
|
||||||
lbc == UTF8PROC_BOUNDCLASS_V) &&
|
lbc == UTF8PROC_BOUNDCLASS_V) &&
|
||||||
(tbc == UTF8PROC_BOUNDCLASS_V ||
|
(tbc == UTF8PROC_BOUNDCLASS_V ||
|
||||||
tbc == UTF8PROC_BOUNDCLASS_T)) ? false :
|
tbc == UTF8PROC_BOUNDCLASS_T)) ? false :
|
||||||
((lbc == UTF8PROC_BOUNDCLASS_LVT ||
|
((lbc == UTF8PROC_BOUNDCLASS_LVT ||
|
||||||
lbc == UTF8PROC_BOUNDCLASS_T) &&
|
lbc == UTF8PROC_BOUNDCLASS_T) &&
|
||||||
tbc == UTF8PROC_BOUNDCLASS_T) ? false :
|
tbc == UTF8PROC_BOUNDCLASS_T) ? false :
|
||||||
(lbc == UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR &&
|
(lbc == UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR &&
|
||||||
tbc == UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR) ? false :
|
tbc == UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR) ? false :
|
||||||
(tbc != UTF8PROC_BOUNDCLASS_SPACINGMARK);
|
(tbc != UTF8PROC_BOUNDCLASS_SPACINGMARK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return whether there is a grapheme break between codepoints c1 and c2 */
|
/* return whether there is a grapheme break between codepoints c1 and c2 */
|
||||||
DLLEXPORT bool utf8proc_grapheme_break(int32_t c1, int32_t c2) {
|
DLLEXPORT bool utf8proc_grapheme_break(int32_t c1, int32_t c2) {
|
||||||
return grapheme_break(utf8proc_get_property(c1)->boundclass,
|
return grapheme_break(utf8proc_get_property(c1)->boundclass,
|
||||||
utf8proc_get_property(c2)->boundclass);
|
utf8proc_get_property(c2)->boundclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return a character width analogous to wcwidth (except portable and
|
/* return a character width analogous to wcwidth (except portable and
|
||||||
hopefully less buggy than most system wcwidth functions). */
|
hopefully less buggy than most system wcwidth functions). */
|
||||||
DLLEXPORT int utf8proc_charwidth(int32_t c) {
|
DLLEXPORT int utf8proc_charwidth(int32_t c) {
|
||||||
return utf8proc_get_property(c)->charwidth;
|
return utf8proc_get_property(c)->charwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT utf8proc_category_t utf8proc_category(int32_t c) {
|
DLLEXPORT utf8proc_category_t utf8proc_category(int32_t c) {
|
||||||
return utf8proc_get_property(c)->category;
|
return utf8proc_get_property(c)->category;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT const char *utf8proc_category_string(int32_t c) {
|
DLLEXPORT const char *utf8proc_category_string(int32_t c) {
|
||||||
static const char s[][3] = {"Cn","Lu","Ll","Lt","Lm","Lo","Mn","Mc","Me","Nd","Nl","No","Pc","Pd","Ps","Pe","Pi","Pf","Po","Sm","Sc","Sk","So","Zs","Zl","Zp","Cc","Cf","Cs","Co"};
|
static const char s[][3] = {"Cn","Lu","Ll","Lt","Lm","Lo","Mn","Mc","Me","Nd","Nl","No","Pc","Pd","Ps","Pe","Pi","Pf","Po","Sm","Sc","Sk","So","Zs","Zl","Zp","Cc","Cf","Cs","Co"};
|
||||||
return s[utf8proc_category(c)];
|
return s[utf8proc_category(c)];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define utf8proc_decompose_lump(replacement_uc) \
|
#define utf8proc_decompose_lump(replacement_uc) \
|
||||||
|
|||||||
@ -66,7 +66,7 @@
|
|||||||
* runtime version may append a string like "-dev" to the version number
|
* runtime version may append a string like "-dev" to the version number
|
||||||
* for prerelease versions.
|
* for prerelease versions.
|
||||||
*
|
*
|
||||||
* @note The shared-library version number in the Makefile will be different,
|
* @note The shared-library version number in the Makefile may be different,
|
||||||
* being based on ABI compatibility rather than API compatibility.
|
* being based on ABI compatibility rather than API compatibility.
|
||||||
*/
|
*/
|
||||||
/** @{ */
|
/** @{ */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user