mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
[1.46.10]
Add --version command-line option. Allow hexadecimal numbers for UTF-8 bytes in rules in *_rules files. wave_pulse.cpp, ensure wave_close is not called again while waiting. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@278 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+35
-1
@@ -879,6 +879,18 @@ static int group3_ix;
|
||||
|
||||
|
||||
|
||||
int isHexDigit(int c)
|
||||
{
|
||||
if((c >= '0') && (c <= '9'))
|
||||
return(c - '0');
|
||||
if((c >= 'a') && (c <= 'f'))
|
||||
return(c - 'a' + 10);
|
||||
if((c >= 'A') && (c <= 'F'))
|
||||
return(c - 'A' + 10);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
static void copy_rule_string(char *string, int &state)
|
||||
{//===================================================
|
||||
// state 0: conditional, 1=pre, 2=match, 3=post, 4=phonemes
|
||||
@@ -889,9 +901,11 @@ static void copy_rule_string(char *string, int &state)
|
||||
int ix;
|
||||
int len;
|
||||
char c;
|
||||
int c2, c3;
|
||||
int sxflags;
|
||||
int value;
|
||||
int literal;
|
||||
int hexdigit_input = 0;
|
||||
MNEM_TAB *mr;
|
||||
|
||||
if(string[0] == 0) return;
|
||||
@@ -911,18 +925,38 @@ static void copy_rule_string(char *string, int &state)
|
||||
{
|
||||
literal = 0;
|
||||
c = *p++;
|
||||
if((c == '0') && (p[0] == 'x') && (isHexDigit(p[1]) >= 0) && (isHexDigit(p[2]) >= 0))
|
||||
{
|
||||
hexdigit_input = 1;
|
||||
c = p[1];
|
||||
p+= 2;
|
||||
}
|
||||
if(c == '\\')
|
||||
{
|
||||
c = *p++; // treat next character literally
|
||||
//#ifdef deleted
|
||||
if((c >= '0') && (c <= '3') && (p[0] >= '0') && (p[0] <= '7') && (p[1] >= '0') && (p[1] <= '7'))
|
||||
{
|
||||
// character code given by 3 digit octal value;
|
||||
c = (c-'0')*64 + (p[0]-'0')*8 + (p[1]-'0');
|
||||
p += 2;
|
||||
}
|
||||
//endif
|
||||
literal = 1;
|
||||
}
|
||||
|
||||
if(hexdigit_input)
|
||||
{
|
||||
if(((c2 = isHexDigit(c)) >= 0) && ((c3 = isHexDigit(p[0])) >= 0))
|
||||
{
|
||||
c = c2 * 16 + c3;
|
||||
literal = 1;
|
||||
p++;
|
||||
}
|
||||
else
|
||||
{
|
||||
hexdigit_input = 0;
|
||||
}
|
||||
}
|
||||
if((state==1) || (state==3))
|
||||
{
|
||||
// replace special characters (note: 'E' is reserved for a replaced silent 'e')
|
||||
|
||||
Reference in New Issue
Block a user