| 1262 | |
| 1263 | |
| 1264 | int xlate_string(const char *string, darray *phone) |
| 1265 | { |
| 1266 | int nph = 0; |
| 1267 | const char *s = string; |
| 1268 | char ch; |
| 1269 | |
| 1270 | while (isspace(ch = *s)) |
| 1271 | s++; |
| 1272 | |
| 1273 | while ((ch = *s)) |
| 1274 | { |
| 1275 | const char *word = s; |
| 1276 | |
| 1277 | if (isalpha(ch)) |
| 1278 | { |
| 1279 | while (isalpha(ch = *s) || ((ch == '\'' || ch == '-' || ch == '.') && isalpha(s[1]))) |
| 1280 | { |
| 1281 | s++; |
| 1282 | } |
| 1283 | |
| 1284 | if (!ch || isspace(ch) || ispunct(ch) || (isdigit(ch) && !suspect_word(word, (int)(s - word)))) |
| 1285 | { |
| 1286 | nph += xlate_word(word, (int)(s - word), phone); |
| 1287 | } |
| 1288 | else |
| 1289 | { |
| 1290 | while ((ch = *s) && !isspace(ch) && !ispunct(ch)) |
| 1291 | { |
| 1292 | s++; |
| 1293 | } |
| 1294 | |
| 1295 | nph += spell_out(word, (int)(s - word), phone); |
| 1296 | } |
| 1297 | } |
| 1298 | else |
| 1299 | { |
| 1300 | if (isdigit(ch) || (ch == '-' && isdigit(s[1]))) |
| 1301 | { |
| 1302 | int sign = (ch == '-') ? -1 : 1; |
| 1303 | int value = 0; |
| 1304 | |
| 1305 | if (sign < 0) |
| 1306 | { |
| 1307 | ch = *++s; |
| 1308 | } |
| 1309 | |
| 1310 | while (isdigit(ch = *s)) |
| 1311 | { |
| 1312 | value = value * 10 + ch - '0'; |
| 1313 | s++; |
| 1314 | } |
| 1315 | |
| 1316 | if (ch == '.' && isdigit(s[1])) |
| 1317 | { |
| 1318 | word = ++s; |
| 1319 | nph += xlate_cardinal(value * sign, phone); |
| 1320 | nph += xlate_string("point", phone); |
| 1321 |
no test coverage detected