| // Do replacement writing 'to' part in buffer | // Do replacement writing 'to' part in buffer | ||||
| while (*pcharto != 0 ) { | while (*pcharto != 0 ) { | ||||
| if(upper_case) { // TODO: should check for capital letter from source | |||||
| if(upper_case) { // TODO: should check for capital letter from source (maybe using word_flags) | |||||
| *ptmpsource = toupper(*pcharto); | *ptmpsource = toupper(*pcharto); | ||||
| upper_case = 0; // capitalize only first character if necessary (will work in most cases) | upper_case = 0; // capitalize only first character if necessary (will work in most cases) | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c, unsigned int next_in, int *insert, int *wordflags) | |||||
| static int TranslateChar(Translator *tr, char *ptr, int prev_in, unsigned int c, unsigned int next_in, int *insert) | |||||
| { | { | ||||
| // To allow language specific examination and replacement of characters | // To allow language specific examination and replacement of characters | ||||
| word_flags |= FLAG_COMMA_AFTER; | word_flags |= FLAG_COMMA_AFTER; | ||||
| } | } | ||||
| // language specific character translations | // language specific character translations | ||||
| c = TranslateChar(tr, &source[source_index], prev_in, c, next_in, &char_inserted, &word_flags); | |||||
| c = TranslateChar(tr, &source[source_index], prev_in, c, next_in, &char_inserted); | |||||
| if (c == 8) | if (c == 8) | ||||
| continue; // ignore this character | continue; // ignore this character | ||||