| if ((*bufix == 0) || (end_clause == 0) || (tr->langopts.param[LOPT_ANNOUNCE_PUNCT] & 2)) { | if ((*bufix == 0) || (end_clause == 0) || (tr->langopts.param[LOPT_ANNOUNCE_PUNCT] & 2)) { | ||||
| punct_count = 1; | punct_count = 1; | ||||
| while ((c2 == c1) && (c1 != '<')) { // don't eat extra '<', it can miss XML tags | |||||
| while (!Eof() && (c2 == c1) && (c1 != '<')) { // don't eat extra '<', it can miss XML tags | |||||
| punct_count++; | punct_count++; | ||||
| c2 = GetC(); | c2 = GetC(); | ||||
| } | } | ||||
| // an embedded command. If it's a voice change, end the clause | // an embedded command. If it's a voice change, end the clause | ||||
| if (c2 == 'V') { | if (c2 == 'V') { | ||||
| buf[ix++] = 0; // end the clause at this point | buf[ix++] = 0; // end the clause at this point | ||||
| while (!iswspace(c1 = GetC()) && !Eof() && (ix < (n_buf-1))) | |||||
| while (!Eof() && !iswspace(c1 = GetC()) && (ix < (n_buf-1))) | |||||
| buf[ix++] = c1; // add voice name to end of buffer, after the text | buf[ix++] = c1; // add voice name to end of buffer, after the text | ||||
| buf[ix++] = 0; | buf[ix++] = 0; | ||||
| return CLAUSE_VOICE; | return CLAUSE_VOICE; | ||||
| strcpy(&buf[ix], " "); | strcpy(&buf[ix], " "); | ||||
| ix += 3; | ix += 3; | ||||
| if ((c2 = GetC()) == '0') | |||||
| if (!Eof() && (c2 = GetC()) == '0') | |||||
| option_punctuation = 0; | option_punctuation = 0; | ||||
| else { | else { | ||||
| option_punctuation = 1; | option_punctuation = 1; | ||||
| if (c2 != '1') { | if (c2 != '1') { | ||||
| // a list of punctuation characters to be spoken, terminated by space | // a list of punctuation characters to be spoken, terminated by space | ||||
| j = 0; | j = 0; | ||||
| while (!iswspace(c2) && !Eof()) { | |||||
| while (!Eof() && !iswspace(c2)) { | |||||
| option_punctlist[j++] = c2; | option_punctlist[j++] = c2; | ||||
| c2 = GetC(); | c2 = GetC(); | ||||
| buf[ix++] = ' '; | buf[ix++] = ' '; | ||||
| } | } | ||||
| if ((c1 == '.') && (c2 == '.')) { | if ((c1 == '.') && (c2 == '.')) { | ||||
| while ((c_next = GetC()) == '.') { | |||||
| while (!Eof() && (c_next = GetC()) == '.') { | |||||
| // 3 or more dots, replace by elipsis | // 3 or more dots, replace by elipsis | ||||
| c1 = 0x2026; | c1 = 0x2026; | ||||
| c2 = ' '; | c2 = ' '; | ||||
| // Handling of sequences of ? and ! like ??!?, !!??!, ?!! etc | // Handling of sequences of ? and ! like ??!?, !!??!, ?!! etc | ||||
| // Use only first char as determinant | // Use only first char as determinant | ||||
| if(punct_data & (CLAUSE_QUESTION | CLAUSE_EXCLAMATION)) { | if(punct_data & (CLAUSE_QUESTION | CLAUSE_EXCLAMATION)) { | ||||
| while(clause_type_from_codepoint(c2) & (CLAUSE_QUESTION | CLAUSE_EXCLAMATION)) { | |||||
| while(!Eof() && clause_type_from_codepoint(c2) & (CLAUSE_QUESTION | CLAUSE_EXCLAMATION)) { | |||||
| c_next = GetC(); | c_next = GetC(); | ||||
| c2 = c_next; | c2 = c_next; | ||||
| } | } |