mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 13:38:47 +00:00
code cleanup: new function ReadNumbers()
ReadNumbers8) parses an unknown number of numbers from language files. Used mostly for setting flags. Used mostly for setting flags.
This commit is contained in:
@@ -476,6 +476,26 @@ static int Read8Numbers(char *data_in, int *data)
|
||||
&data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], &data[7]);
|
||||
}
|
||||
|
||||
static void ReadNumbers(char *p, int *flags, int maxValue, MNEM_TAB *keyword_tab, int key) {
|
||||
// read a list of numbers from string p
|
||||
// store them as flags in *flags
|
||||
// the meaning of the numbers is bit ordinals, not integer values
|
||||
// give an error if number > maxValue is read
|
||||
int n;
|
||||
while (*p != 0) {
|
||||
while (isspace(*p)) p++;
|
||||
if ((n = atoi(p)) > 0) {
|
||||
p++;
|
||||
if (n < maxValue) {
|
||||
*flags |= (1 << n);
|
||||
} else {
|
||||
fprintf(stderr, "%s: Bad option number %d\n", LookupMnemName(keyword_tab, key), n);
|
||||
}
|
||||
}
|
||||
while (isalnum(*p)) p++;
|
||||
}
|
||||
}
|
||||
|
||||
static int CheckTranslator(Translator *tr, MNEM_TAB *keyword_tab, int key)
|
||||
{
|
||||
// Return 0 if translator is set.
|
||||
|
||||
Reference in New Issue
Block a user