| return 1; | return 1; | ||||
| } | } | ||||
| static const char * FindReplacementChars( | |||||
| Translator *tr, | |||||
| const char **pfrom, | |||||
| unsigned int c, | |||||
| unsigned int nextc, | |||||
| bool *ignore_next | |||||
| ) { | |||||
| static const char *FindReplacementChars(Translator *tr, const char **pfrom, unsigned int c, unsigned int nextc, int *ignore_next_n) | |||||
| { | |||||
| unsigned int uc = 0; | unsigned int uc = 0; | ||||
| const char *from = *pfrom; | const char *from = *pfrom; | ||||
| while (*(unsigned int *)from != 0) { | while (*(unsigned int *)from != 0) { | ||||
| from += utf8_in((int *)&uc, from); | from += utf8_in((int *)&uc, from); | ||||
| if (c == uc) { | if (c == uc) { | ||||
| if (*from == 0) return from + 1; | if (*from == 0) return from + 1; | ||||
| from += utf8_in((int *)&uc, from); | from += utf8_in((int *)&uc, from); | ||||
| if (*from == 0 && uc == (unsigned int)towlower2(nextc, tr)) { | if (*from == 0 && uc == (unsigned int)towlower2(nextc, tr)) { | ||||
| *ignore_next = true; | |||||
| *ignore_next_n = 1; | |||||
| return from + 1; | return from + 1; | ||||
| } | } | ||||
| } | } | ||||
| { | { | ||||
| unsigned int new_c, c2 = ' ', c_lower; | unsigned int new_c, c2 = ' ', c_lower; | ||||
| int upper_case = 0; | int upper_case = 0; | ||||
| static bool ignore_next = false; | |||||
| if (ignore_next) { | |||||
| ignore_next = false; | |||||
| static int ignore_next_n = 0; | |||||
| if (ignore_next_n > 0) { | |||||
| ignore_next_n--; | |||||
| return 8; | return 8; | ||||
| } | } | ||||
| if (c == 0) return 0; | if (c == 0) return 0; | ||||
| const char *from = (const char *)tr->langopts.replace_chars; | const char *from = (const char *)tr->langopts.replace_chars; | ||||
| upper_case = 1; | upper_case = 1; | ||||
| } | } | ||||
| const char *to = FindReplacementChars(tr, &from, c_lower, next_in, &ignore_next); | |||||
| const char *to = FindReplacementChars(tr, &from, c_lower, next_in, &ignore_next_n); | |||||
| if (to == NULL) | if (to == NULL) | ||||
| return c; // no substitution | return c; // no substitution | ||||