mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-08 07:32:32 +00:00
moved attrnumber() from readclause.c to ssml.c
This commit is contained in:
@@ -807,22 +807,6 @@ static wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int attrnumber(const wchar_t *pw, int default_value, int type)
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
if ((pw == NULL) || !IsDigit09(*pw))
|
||||
return default_value;
|
||||
|
||||
while (IsDigit09(*pw))
|
||||
value = value*10 + *pw++ - '0';
|
||||
if ((type == 1) && (ucd_tolower(*pw) == 's')) {
|
||||
// time: seconds rather than ms
|
||||
value *= 1000;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
static int attrcopy_utf8(char *buf, const wchar_t *pw, int len)
|
||||
{
|
||||
// Convert attribute string into utf8, write to buf, and return its utf8 length
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
|
||||
int attrcmp(const wchar_t *string1, const char *string2);
|
||||
int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab);
|
||||
int attrnumber(const wchar_t *pw, int default_value, int type);
|
||||
|
||||
int attrcmp(const wchar_t *string1, const char *string2)
|
||||
{
|
||||
@@ -74,3 +75,19 @@ int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab)
|
||||
return mtab[ix].value;
|
||||
}
|
||||
|
||||
int attrnumber(const wchar_t *pw, int default_value, int type)
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
if ((pw == NULL) || !IsDigit09(*pw))
|
||||
return default_value;
|
||||
|
||||
while (IsDigit09(*pw))
|
||||
value = value*10 + *pw++ - '0';
|
||||
if ((type == 1) && (ucd_tolower(*pw) == 's')) {
|
||||
// time: seconds rather than ms
|
||||
value *= 1000;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user