From 4226453c62566c807ef457f2262acb2a1b92fe71 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Sat, 28 Nov 2009 17:24:24 +0100 Subject: [PATCH] Reformat --- src/icu_I18N.c | 130 +++++++++++++------------------------ test/tst_icu_I18N.c | 177 ++++++++++++++++++--------------------------------- 2 files changed, 106 insertions(+), 201 deletions(-) diff --git a/src/icu_I18N.c b/src/icu_I18N.c index 85b035b..a486087 100644 --- a/src/icu_I18N.c +++ b/src/icu_I18N.c @@ -30,12 +30,9 @@ #include /* some more string fcns*/ #include /* char names */ - - #include - -int icu_check_status (UErrorCode status) +int icu_check_status(UErrorCode status) { if (U_FAILURE(status)) { @@ -43,11 +40,8 @@ int icu_check_status (UErrorCode status) return 0; } return 1; - } - - struct icu_buf_utf16 * icu_buf_utf16_create(size_t capacity) { struct icu_buf_utf16 * buf16 @@ -57,7 +51,8 @@ struct icu_buf_utf16 * icu_buf_utf16_create(size_t capacity) buf16->utf16_len = 0; buf16->utf16_cap = 0; - if (capacity > 0){ + if (capacity > 0) + { buf16->utf16 = (UChar *) xmalloc(sizeof(UChar) * capacity); buf16->utf16[0] = (UChar) 0; buf16->utf16_cap = capacity; @@ -67,7 +62,8 @@ struct icu_buf_utf16 * icu_buf_utf16_create(size_t capacity) struct icu_buf_utf16 * icu_buf_utf16_clear(struct icu_buf_utf16 * buf16) { - if (buf16){ + if (buf16) + { if (buf16->utf16) buf16->utf16[0] = (UChar) 0; buf16->utf16_len = 0; @@ -81,7 +77,8 @@ struct icu_buf_utf16 * icu_buf_utf16_resize(struct icu_buf_utf16 * buf16, if (!buf16) return 0; - if (capacity > 0){ + if (capacity > 0) + { if (0 == buf16->utf16) buf16->utf16 = (UChar *) xmalloc(sizeof(UChar) * capacity); else @@ -91,7 +88,8 @@ struct icu_buf_utf16 * icu_buf_utf16_resize(struct icu_buf_utf16 * buf16, icu_buf_utf16_clear(buf16); buf16->utf16_cap = capacity; } - else { + else + { xfree(buf16->utf16); buf16->utf16 = 0; buf16->utf16_len = 0; @@ -105,8 +103,7 @@ struct icu_buf_utf16 * icu_buf_utf16_resize(struct icu_buf_utf16 * buf16, struct icu_buf_utf16 * icu_buf_utf16_copy(struct icu_buf_utf16 * dest16, struct icu_buf_utf16 * src16) { - if(!dest16 || !src16 - || dest16 == src16) + if (!dest16 || !src16 || dest16 == src16) return 0; if (dest16->utf16_cap < src16->utf16_len) @@ -118,7 +115,6 @@ struct icu_buf_utf16 * icu_buf_utf16_copy(struct icu_buf_utf16 * dest16, return dest16; } - void icu_buf_utf16_destroy(struct icu_buf_utf16 * buf16) { if (buf16) @@ -126,8 +122,6 @@ void icu_buf_utf16_destroy(struct icu_buf_utf16 * buf16) xfree(buf16); } - - struct icu_buf_utf8 * icu_buf_utf8_create(size_t capacity) { struct icu_buf_utf8 * buf8 @@ -137,7 +131,8 @@ struct icu_buf_utf8 * icu_buf_utf8_create(size_t capacity) buf8->utf8_len = 0; buf8->utf8_cap = 0; - if (capacity > 0){ + if (capacity > 0) + { buf8->utf8 = (uint8_t *) xmalloc(sizeof(uint8_t) * capacity); buf8->utf8[0] = (uint8_t) 0; buf8->utf8_cap = capacity; @@ -145,10 +140,10 @@ struct icu_buf_utf8 * icu_buf_utf8_create(size_t capacity) return buf8; } - struct icu_buf_utf8 * icu_buf_utf8_clear(struct icu_buf_utf8 * buf8) { - if (buf8){ + if (buf8) + { if (buf8->utf8) buf8->utf8[0] = (uint8_t) 0; buf8->utf8_len = 0; @@ -156,7 +151,6 @@ struct icu_buf_utf8 * icu_buf_utf8_clear(struct icu_buf_utf8 * buf8) return buf8; } - struct icu_buf_utf8 * icu_buf_utf8_resize(struct icu_buf_utf8 * buf8, size_t capacity) { @@ -182,7 +176,6 @@ struct icu_buf_utf8 * icu_buf_utf8_resize(struct icu_buf_utf8 * buf8, return buf8; } - const char *icu_buf_utf8_to_cstr(struct icu_buf_utf8 *src8) { if (!src8 || src8->utf8_len == 0) @@ -196,7 +189,6 @@ const char *icu_buf_utf8_to_cstr(struct icu_buf_utf8 *src8) return (const char *) src8->utf8; } - void icu_buf_utf8_destroy(struct icu_buf_utf8 * buf8) { if (buf8) @@ -204,7 +196,6 @@ void icu_buf_utf8_destroy(struct icu_buf_utf8 * buf8) xfree(buf8); } - UErrorCode icu_utf16_from_utf8_cstr(struct icu_buf_utf16 * dest16, const char * src8cstr, UErrorCode * status) @@ -238,9 +229,6 @@ UErrorCode icu_utf16_from_utf8_cstr(struct icu_buf_utf16 * dest16, return *status; } - - - UErrorCode icu_utf16_to_utf8(struct icu_buf_utf8 * dest8, struct icu_buf_utf16 * src16, UErrorCode * status) @@ -259,7 +247,6 @@ UErrorCode icu_utf16_to_utf8(struct icu_buf_utf8 * dest8, u_strToUTF8((char *) dest8->utf8, dest8->utf8_cap, &utf8_len, src16->utf16, src16->utf16_len, status); - } if (U_SUCCESS(*status) @@ -279,7 +266,8 @@ struct icu_casemap * icu_casemap_create(char action, UErrorCode *status) = (struct icu_casemap *) xmalloc(sizeof(struct icu_casemap)); casemap->action = action; - switch(casemap->action) { + switch(casemap->action) + { case 'l': case 'L': case 'u': @@ -293,7 +281,6 @@ struct icu_casemap * icu_casemap_create(char action, UErrorCode *status) icu_casemap_destroy(casemap); return 0; } - return casemap; } @@ -302,7 +289,6 @@ void icu_casemap_destroy(struct icu_casemap * casemap) xfree(casemap); } - int icu_casemap_casemap(struct icu_casemap * casemap, struct icu_buf_utf16 * dest16, struct icu_buf_utf16 * src16, @@ -316,7 +302,6 @@ int icu_casemap_casemap(struct icu_casemap * casemap, casemap->action, status); } - int icu_utf16_casemap(struct icu_buf_utf16 * dest16, struct icu_buf_utf16 * src16, const char *locale, char action, @@ -324,16 +309,16 @@ int icu_utf16_casemap(struct icu_buf_utf16 * dest16, { int32_t dest16_len = 0; - - if (!src16->utf16_len){ /* guarding for empty source string */ + if (!src16->utf16_len) + { /* guarding for empty source string */ if (dest16->utf16) dest16->utf16[0] = (UChar) 0; dest16->utf16_len = 0; return U_ZERO_ERROR; } - - switch(action) { + switch(action) + { case 'l': case 'L': dest16_len = u_strToLower(dest16->utf16, dest16->utf16_cap, @@ -367,11 +352,11 @@ int icu_utf16_casemap(struct icu_buf_utf16 * dest16, /* check for buffer overflow, resize and retry */ if (*status == U_BUFFER_OVERFLOW_ERROR && dest16 != src16 /* do not resize if in-place conversion */ - ){ + ) + { icu_buf_utf16_resize(dest16, dest16_len * 2); *status = U_ZERO_ERROR; - switch(action) { case 'l': case 'L': @@ -407,7 +392,8 @@ int icu_utf16_casemap(struct icu_buf_utf16 * dest16, if (U_SUCCESS(*status) && dest16_len <= dest16->utf16_cap) dest16->utf16_len = dest16_len; - else { + else + { if (dest16->utf16) dest16->utf16[0] = (UChar) 0; dest16->utf16_len = 0; @@ -416,21 +402,19 @@ int icu_utf16_casemap(struct icu_buf_utf16 * dest16, return *status; } - - void icu_sortkey8_from_utf16(UCollator *coll, struct icu_buf_utf8 * dest8, struct icu_buf_utf16 * src16, UErrorCode * status) { - int32_t sortkey_len = 0; sortkey_len = ucol_getSortKey(coll, src16->utf16, src16->utf16_len, dest8->utf8, dest8->utf8_cap); /* check for buffer overflow, resize and retry */ - if (sortkey_len > dest8->utf8_cap) { + if (sortkey_len > dest8->utf8_cap) + { icu_buf_utf8_resize(dest8, sortkey_len * 2); sortkey_len = ucol_getSortKey(coll, src16->utf16, src16->utf16_len, dest8->utf8, dest8->utf8_cap); @@ -459,8 +443,8 @@ struct icu_tokenizer * icu_tokenizer_create(const char *locale, char action, tokenizer->token_start = 0; tokenizer->token_end = 0; - - switch(tokenizer->action) { + switch(tokenizer->action) + { case 'l': case 'L': tokenizer->bi = ubrk_open(UBRK_LINE, locale, 0, 0, status); @@ -512,7 +496,6 @@ int icu_tokenizer_attach(struct icu_tokenizer * tokenizer, if (!tokenizer || !tokenizer->bi || !src16) return 0; - tokenizer->buf16 = src16; tokenizer->token_count = 0; tokenizer->token_id = 0; @@ -520,8 +503,7 @@ int icu_tokenizer_attach(struct icu_tokenizer * tokenizer, tokenizer->token_end = 0; ubrk_setText(tokenizer->bi, src16->utf16, src16->utf16_len, status); - - + if (U_FAILURE(*status)) return 0; @@ -535,12 +517,10 @@ int32_t icu_tokenizer_next_token(struct icu_tokenizer * tokenizer, int32_t tkn_start = 0; int32_t tkn_end = 0; int32_t tkn_len = 0; - if (!tokenizer || !tokenizer->bi || !tokenizer->buf16 || !tokenizer->buf16->utf16_len) return 0; - /* never change tokenizer->buf16 and keep always invariant 0 <= tokenizer->token_start @@ -575,8 +555,7 @@ int32_t icu_tokenizer_next_token(struct icu_tokenizer * tokenizer, tokenizer->token_id = 0; } tokenizer->token_start = tkn_start; - tokenizer->token_end = tkn_end; - + tokenizer->token_end = tkn_end; /* copying into token buffer if it exists */ if (tkn16){ @@ -592,7 +571,6 @@ int32_t icu_tokenizer_next_token(struct icu_tokenizer * tokenizer, return tkn_len; } - int32_t icu_tokenizer_token_id(struct icu_tokenizer * tokenizer) { return tokenizer->token_id; @@ -618,8 +596,6 @@ int32_t icu_tokenizer_token_count(struct icu_tokenizer * tokenizer) return tokenizer->token_count; } - - struct icu_transform * icu_transform_create(const char *id, char action, const char *rules, UErrorCode *status) @@ -675,28 +651,27 @@ struct icu_transform * icu_transform_create(const char *id, char action, return 0; } - -void icu_transform_destroy(struct icu_transform * transform){ - if (transform) { +void icu_transform_destroy(struct icu_transform * transform) +{ + if (transform) + { if (transform->trans) utrans_close(transform->trans); xfree(transform); } } - - int icu_transform_trans(struct icu_transform * transform, struct icu_buf_utf16 * dest16, struct icu_buf_utf16 * src16, UErrorCode *status) { if (!transform || !transform->trans - || !src16 - || !dest16) + || !src16 || !dest16) return 0; - if (!src16->utf16_len){ /* guarding for empty source string */ + if (!src16->utf16_len) + { /* guarding for empty source string */ icu_buf_utf16_clear(dest16); return 0; } @@ -704,7 +679,6 @@ int icu_transform_trans(struct icu_transform * transform, if (!icu_buf_utf16_copy(dest16, src16)) return 0; - utrans_transUChars (transform->trans, dest16->utf16, &(dest16->utf16_len), dest16->utf16_cap, @@ -716,9 +690,6 @@ int icu_transform_trans(struct icu_transform * transform, return dest16->utf16_len; } - - - struct icu_chain_step * icu_chain_step_create(struct icu_chain * chain, enum icu_chain_step_type type, const uint8_t * rule, @@ -737,7 +708,8 @@ struct icu_chain_step * icu_chain_step_create(struct icu_chain * chain, step->buf16 = buf16; /* create auxilary objects */ - switch(step->type) { + switch(step->type) + { case ICU_chain_step_type_display: break; case ICU_chain_step_type_casemap: @@ -760,19 +732,19 @@ struct icu_chain_step * icu_chain_step_create(struct icu_chain * chain, default: break; } - return step; } -void icu_chain_step_destroy(struct icu_chain_step * step){ - +void icu_chain_step_destroy(struct icu_chain_step * step) +{ if (!step) return; icu_chain_step_destroy(step->previous); - switch(step->type) { + switch(step->type) + { case ICU_chain_step_type_display: break; case ICU_chain_step_type_casemap: @@ -795,7 +767,6 @@ void icu_chain_step_destroy(struct icu_chain_step * step){ } - struct icu_chain * icu_chain_create(const char *locale, int sort, UErrorCode * status) { @@ -848,8 +819,6 @@ void icu_chain_destroy(struct icu_chain * chain) } } - - struct icu_chain * icu_chain_xml_config(const xmlNode *xml_node, int sort, UErrorCode * status) @@ -930,8 +899,6 @@ struct icu_chain * icu_chain_xml_config(const xmlNode *xml_node, return chain; } - - struct icu_chain_step * icu_chain_insert_step(struct icu_chain * chain, enum icu_chain_step_type type, const uint8_t * rule, @@ -952,7 +919,6 @@ struct icu_chain_step * icu_chain_insert_step(struct icu_chain * chain, else return 0; - /* create utf16 destination buffers as needed, or */ switch(type) { @@ -1082,8 +1048,7 @@ int icu_chain_step_next_token(struct icu_chain * chain, } -int icu_chain_assign_cstr(struct icu_chain * chain, - const char * src8cstr, +int icu_chain_assign_cstr(struct icu_chain * chain, const char * src8cstr, UErrorCode *status) { struct icu_chain_step * stp = 0; @@ -1116,10 +1081,7 @@ int icu_chain_assign_cstr(struct icu_chain * chain, return 1; } - - -int icu_chain_next_token(struct icu_chain * chain, - UErrorCode *status) +int icu_chain_next_token(struct icu_chain * chain, UErrorCode *status) { int got_token = 0; @@ -1160,7 +1122,6 @@ int icu_chain_next_token(struct icu_chain * chain, icu_sortkey8_from_utf16(chain->coll, chain->sort8, chain->steps->buf16, status); - return chain->token_count; } } @@ -1176,7 +1137,6 @@ int icu_chain_token_number(struct icu_chain * chain) return chain->token_count; } - const char * icu_chain_token_display(struct icu_chain * chain) { if (chain->display8) diff --git a/test/tst_icu_I18N.c b/test/tst_icu_I18N.c index ef3cdc5..bbdc993 100644 --- a/test/tst_icu_I18N.c +++ b/test/tst_icu_I18N.c @@ -23,9 +23,6 @@ #include #include -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ - - #define MAX_KEY_SIZE 256 struct icu_termmap { @@ -34,7 +31,6 @@ struct icu_termmap }; - int icu_termmap_cmp(const void *vp1, const void *vp2) { struct icu_termmap *itmp1 = *(struct icu_termmap **) vp1; @@ -45,9 +41,7 @@ int icu_termmap_cmp(const void *vp1, const void *vp2) cmp = strcmp((const char *)itmp1->sort_key, (const char *)itmp2->sort_key); return cmp; -}; - - +} int test_icu_casemap(const char * locale, char action, @@ -73,9 +67,7 @@ int test_icu_casemap(const char * locale, char action, /* converting to UTF8 */ icu_utf16_to_utf8(dest8, dest16, &status); - - /* determine success */ if (dest8->utf8 && (dest8->utf8_len == strlen(chk8cstr)) @@ -98,18 +90,12 @@ int test_icu_casemap(const char * locale, char action, icu_buf_utf8_destroy(dest8); icu_buf_utf16_destroy(src16); icu_buf_utf16_destroy(dest16); - - + return success; } - - -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ - void test_icu_I18N_casemap(int argc, char **argv) { - /* Locale 'en' */ /* successful tests */ @@ -129,7 +115,6 @@ void test_icu_I18N_casemap(int argc, char **argv) "A ReD fOx hunTS sQUirriLs", "A Red Fox Hunts Squirrils")); - /* Locale 'da' */ /* success expected */ @@ -170,9 +155,6 @@ void test_icu_I18N_casemap(int argc, char **argv) } - -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ - int test_icu_sortmap(const char * locale, int src_list_len, const char ** src_list, const char ** chk_list) { @@ -194,39 +176,39 @@ int test_icu_sortmap(const char * locale, int src_list_len, return 0; /* assigning display terms and sort keys using buf 8 and buf16 */ - for( i = 0; i < src_list_len; i++) - { + for (i = 0; i < src_list_len; i++) + { - list[i] = (struct icu_termmap *) malloc(sizeof(struct icu_termmap)); + list[i] = (struct icu_termmap *) malloc(sizeof(struct icu_termmap)); - /* copy display term */ - strcpy(list[i]->disp_term, src_list[i]); + /* copy display term */ + strcpy(list[i]->disp_term, src_list[i]); - /* transforming to UTF16 */ - icu_utf16_from_utf8_cstr(buf16, list[i]->disp_term, &status); - icu_check_status(status); + /* transforming to UTF16 */ + icu_utf16_from_utf8_cstr(buf16, list[i]->disp_term, &status); + icu_check_status(status); - /* computing sortkeys */ - icu_sortkey8_from_utf16(coll, buf8, buf16, &status); - icu_check_status(status); + /* computing sortkeys */ + icu_sortkey8_from_utf16(coll, buf8, buf16, &status); + icu_check_status(status); - /* assigning sortkeys */ - memcpy(list[i]->sort_key, buf8->utf8, buf8->utf8_len); - } - + /* assigning sortkeys */ + memcpy(list[i]->sort_key, buf8->utf8, buf8->utf8_len); + } /* do the sorting */ - qsort(list, src_list_len, - sizeof(struct icu_termmap *), icu_termmap_cmp); + qsort(list, src_list_len, sizeof(struct icu_termmap *), icu_termmap_cmp); /* checking correct sorting */ - for (i = 0; i < src_list_len; i++){ + for (i = 0; i < src_list_len; i++) + { if (0 != strcmp(list[i]->disp_term, chk_list[i])){ success = 0; } } - if(!success){ + if (!success) + { printf("\nERROR\n"); printf("Input str: '%s' : ", locale); for (i = 0; i < src_list_len; i++) { @@ -245,12 +227,9 @@ int test_icu_sortmap(const char * locale, int src_list_len, printf("\n"); } - - - for( i = 0; i < src_list_len; i++) + for (i = 0; i < src_list_len; i++) free(list[i]); - - + ucol_close(coll); icu_buf_utf8_destroy(buf8); @@ -259,12 +238,8 @@ int test_icu_sortmap(const char * locale, int src_list_len, return success; } - -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ - void test_icu_I18N_sortmap(int argc, char **argv) { - /* successful tests */ size_t en_1_len = 6; const char * en_1_src[6] = {"z", "K", "a", "A", "Z", "k"}; @@ -295,15 +270,9 @@ void test_icu_I18N_sortmap(int argc, char **argv) } - -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ - - - - int test_icu_normalizer(const char * rules8cstr, - const char * src8cstr, - const char * chk8cstr) + const char * src8cstr, + const char * chk8cstr) { int success = 0; @@ -329,7 +298,8 @@ int test_icu_normalizer(const char * rules8cstr, if(!strcmp((const char *) dest8->utf8, (const char *) chk8cstr)) success = 1; - else { + else + { success = 0; printf("Normalization\n"); printf("Rules: '%s'\n", rules8cstr); @@ -337,7 +307,6 @@ int test_icu_normalizer(const char * rules8cstr, printf("Normalized: '%s'\n", dest8->utf8); printf("Expected: '%s'\n", chk8cstr); } - icu_transform_destroy(transform); icu_buf_utf16_destroy(src16); @@ -345,14 +314,10 @@ int test_icu_normalizer(const char * rules8cstr, icu_buf_utf8_destroy(dest8); return success; -}; - - -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ +} void test_icu_I18N_normalizer(int argc, char **argv) { - YAZ_CHECK(test_icu_normalizer("[:Punctuation:] Any-Remove", "Don't shoot!", "Dont shoot")); @@ -378,18 +343,13 @@ void test_icu_I18N_normalizer(int argc, char **argv) " word4you? ", "word4you")); - YAZ_CHECK(test_icu_normalizer("NFD; [:Nonspacing Mark:] Remove; NFC", "à côté de l'alcôve ovoïde", "a cote de l'alcove ovoide")); - } - -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ - int test_icu_tokenizer(const char * locale, char action, - const char * src8cstr, int count) + const char * src8cstr, int count) { int success = 1; @@ -437,13 +397,8 @@ int test_icu_tokenizer(const char * locale, char action, return success; } - -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ - void test_icu_I18N_tokenizer(int argc, char **argv) { - - const char * en_str = "O Romeo, Romeo! wherefore art thou Romeo?"; @@ -452,8 +407,6 @@ void test_icu_I18N_tokenizer(int argc, char **argv) YAZ_CHECK(test_icu_tokenizer("en", 'w', en_str, 16)); YAZ_CHECK(test_icu_tokenizer("en", 'c', en_str, 41)); - - { const char * da_str = "Blåbærtærte. Denne kage stammer fra Finland. " @@ -464,10 +417,8 @@ void test_icu_I18N_tokenizer(int argc, char **argv) YAZ_CHECK(test_icu_tokenizer("da", 'w', da_str, 37)); YAZ_CHECK(test_icu_tokenizer("da", 'c', da_str, 110)); } - } - void test_icu_I18N_chain(int argc, char **argv) { const char * en_str @@ -476,7 +427,6 @@ void test_icu_I18N_chain(int argc, char **argv) UErrorCode status = U_ZERO_ERROR; struct icu_chain * chain = 0; - const char * xml_str = "" "" "" @@ -497,12 +447,13 @@ void test_icu_I18N_chain(int argc, char **argv) YAZ_CHECK(icu_chain_assign_cstr(chain, en_str, &status)); - while (icu_chain_next_token(chain, &status)){ + while (icu_chain_next_token(chain, &status)) + { ; /* printf("%d '%s' '%s'\n", - icu_chain_token_number(chain), - icu_chain_token_norm(chain), - icu_chain_token_display(chain)); */ + icu_chain_token_number(chain), + icu_chain_token_norm(chain), + icu_chain_token_display(chain)); */ } YAZ_CHECK_EQ(icu_chain_token_number(chain), 7); @@ -510,12 +461,13 @@ void test_icu_I18N_chain(int argc, char **argv) YAZ_CHECK(icu_chain_assign_cstr(chain, "what is this?", &status)); - while (icu_chain_next_token(chain, &status)){ + while (icu_chain_next_token(chain, &status)) + { ; /* printf("%d '%s' '%s'\n", - icu_chain_token_number(chain), - icu_chain_token_norm(chain), - icu_chain_token_display(chain)); */ + icu_chain_token_number(chain), + icu_chain_token_norm(chain), + icu_chain_token_display(chain)); */ } @@ -556,13 +508,13 @@ void test_bug_1140(void) chain, "O Romeo, Romeo! wherefore art thou\t Romeo?", &status)); - while (icu_chain_next_token(chain, &status)){ + while (icu_chain_next_token(chain, &status)) + { ; /* printf("%d '%s' '%s'\n", - icu_chain_token_number(chain), - icu_chain_token_norm(chain), - icu_chain_token_display(chain)); */ - + icu_chain_token_number(chain), + icu_chain_token_norm(chain), + icu_chain_token_display(chain)); */ } @@ -570,12 +522,13 @@ void test_bug_1140(void) YAZ_CHECK(icu_chain_assign_cstr(chain, "what is this?", &status)); - while (icu_chain_next_token(chain, &status)){ - ; - /* printf("%d '%s' '%s'\n", - icu_chain_token_number(chain), - icu_chain_token_norm(chain), - icu_chain_token_display(chain)); */ + while (icu_chain_next_token(chain, &status)) + { + ; + /* printf("%d '%s' '%s'\n", + icu_chain_token_number(chain), + icu_chain_token_norm(chain), + icu_chain_token_display(chain)); */ } /* we expect 'what' 'is' 'this', i.e. 3 tokens */ @@ -585,7 +538,6 @@ void test_bug_1140(void) } - void test_chain_empty_token(void) { UErrorCode status = U_ZERO_ERROR; @@ -609,12 +561,13 @@ void test_chain_empty_token(void) chain, "a string with 15 tokenss and 8 displays", &status)); - while (icu_chain_next_token(chain, &status)){ + while (icu_chain_next_token(chain, &status)) + { ; /* printf("%d '%s' '%s'\n", - icu_chain_token_number(chain), - icu_chain_token_norm(chain), - icu_chain_token_display(chain)); */ + icu_chain_token_number(chain), + icu_chain_token_norm(chain), + icu_chain_token_display(chain)); */ } YAZ_CHECK_EQ(icu_chain_token_number(chain), 15); @@ -646,12 +599,13 @@ void test_chain_empty_chain(void) chain, src8, &status)); - while (icu_chain_next_token(chain, &status)){ + while (icu_chain_next_token(chain, &status)) + { ; /* printf("%d '%s' '%s'\n", - icu_chain_token_number(chain), - icu_chain_token_norm(chain), - icu_chain_token_display(chain)); */ + icu_chain_token_number(chain), + icu_chain_token_norm(chain), + icu_chain_token_display(chain)); */ } YAZ_CHECK_EQ(icu_chain_token_number(chain), 1); @@ -659,17 +613,13 @@ void test_chain_empty_chain(void) dest8 = (char *) icu_chain_token_norm(chain); YAZ_CHECK_EQ(strcmp(src8, dest8), 0); - icu_chain_destroy(chain); } #endif /* YAZ_HAVE_ICU */ -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ - int main(int argc, char **argv) { - YAZ_CHECK_INIT(argc, argv); YAZ_CHECK_LOG(); @@ -695,11 +645,6 @@ int main(int argc, char **argv) YAZ_CHECK_TERM; } - -/* DO NOT EDIT THIS FILE IF YOUR EDITOR DOES NOT SUPPORT UTF-8 */ - - - /* * Local variables: * c-basic-offset: 4 -- 1.7.10.4