From 85fe4153751ffd2aa3c8953f728c884e30bb7048 Mon Sep 17 00:00:00 2001 From: jonsd Date: Sat, 19 May 2007 23:59:15 +0000 Subject: [PATCH] [1.25.01] Add data for character set Latin4. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@17 d46cf337-b52f-0410-862d-fd96e6ae7743 --- src/espeakedit.cpp | 77 ---------------------------------------------- src/extras.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++++++ src/synthdata.cpp | 2 +- src/translate.cpp | 17 +++++++++- 4 files changed, 94 insertions(+), 79 deletions(-) diff --git a/src/espeakedit.cpp b/src/espeakedit.cpp index befdad30..05e240b5 100755 --- a/src/espeakedit.cpp +++ b/src/espeakedit.cpp @@ -343,86 +343,9 @@ void MyFrame::OnQuit(wxCommandEvent& event) } } -//#define xcharset -#ifdef xcharset -#include "iconv.h" -void CharsetToUnicode(const char *charset) -{//======================================= -// write a 8bit charset to unicode translation table to file -// charset: eg. "ISO-8859-1" - iconv_t cd; - unsigned char inbuf[4]; - size_t n_inbuf; - unsigned char outbuf[12]; - size_t n_outbuf; - int n; - int ix; - int x, y; - FILE *f; - char *p_inbuf; - char *p_outbuf; - - f = fopen("/home/jsd1/tmp1/unicode1","a"); - - cd = iconv_open("WCHAR_T",charset); - if (cd == (iconv_t) -1) - { - fprintf(stderr,"Error - iconv_open\n"); - return; - } - - fprintf(f,"towlower_tab\n "); - for(ix=0x80; ix<=0x241; ix++) - { - y = 0; - if(iswalpha(ix)) - { - x = towlower(ix); - if(x == ix) - y = 0xff; - else - y = x - ix; - } - if((y == 0xff) || (y < 0)) - fprintf(f,"0xff,"); // ignore the 5 obscure cases where uc > lc - else - { - fprintf(f,"%4d,",y); - } - if((ix&15)==15) - fprintf(f," // %x\n ",ix & ~15); - } - - fprintf(f,"\n%s\n ",charset); - for(ix=0x80; ix<0x100; ix++) - { - inbuf[0] = ix; - inbuf[1] = 0; - inbuf[2] = 0; - outbuf[0] = 0; - outbuf[1] = 0; - n_inbuf = 2; - n_outbuf = sizeof(outbuf); - p_inbuf = (char *)inbuf; - p_outbuf = (char *)outbuf; - - n = iconv(cd, &p_inbuf, &n_inbuf, &p_outbuf, &n_outbuf); - - fprintf(f,"0x%.2x%.2x, ",outbuf[1],outbuf[0]); - if((ix&7)==7) - fprintf(f,"// %.2x\n ",ix & ~7); - } - fclose(f); - - iconv_close(cd); -} -#endif - void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) {//=================================================== -//CharsetToUnicode("ISO-8859-3"); -//CharsetToUnicode("ISCII"); char buf[120]; sprintf(buf,about_string,espeak_Info(NULL)); diff --git a/src/extras.cpp b/src/extras.cpp index e935f897..d4fb247e 100644 --- a/src/extras.cpp +++ b/src/extras.cpp @@ -781,6 +781,81 @@ void SetSpeedTab(void) } // end of SetSpeedTab #endif +//#define xcharset +#ifdef xcharset +#include "iconv.h" +void CharsetToUnicode(const char *charset) +{//======================================= +// write a 8bit charset to unicode translation table to file +// charset: eg. "ISO-8859-1" + iconv_t cd; + unsigned char inbuf[4]; + size_t n_inbuf; + unsigned char outbuf[12]; + size_t n_outbuf; + int n; + int ix; + int x, y; + FILE *f; + char *p_inbuf; + char *p_outbuf; + + f = fopen("/home/jsd1/tmp1/unicode1","a"); + + cd = iconv_open("WCHAR_T",charset); + if (cd == (iconv_t) -1) + { + fprintf(stderr,"Error - iconv_open\n"); + return; + } + + fprintf(f,"towlower_tab\n "); + for(ix=0x80; ix<=0x241; ix++) + { + y = 0; + if(iswalpha(ix)) + { + x = towlower(ix); + if(x == ix) + y = 0xff; + else + y = x - ix; + } + if((y == 0xff) || (y < 0)) + fprintf(f,"0xff,"); // ignore the 5 obscure cases where uc > lc + else + { + fprintf(f,"%4d,",y); + } + if((ix&15)==15) + fprintf(f," // %x\n ",ix & ~15); + } + + fprintf(f,"\n%s\n ",charset); + for(ix=0x80; ix<0x100; ix++) + { + inbuf[0] = ix; + inbuf[1] = 0; + inbuf[2] = 0; + outbuf[0] = 0; + outbuf[1] = 0; + n_inbuf = 2; + n_outbuf = sizeof(outbuf); + p_inbuf = (char *)inbuf; + p_outbuf = (char *)outbuf; + + n = iconv(cd, &p_inbuf, &n_inbuf, &p_outbuf, &n_outbuf); + + fprintf(f,"0x%.2x%.2x, ",outbuf[1],outbuf[0]); + if((ix&7)==7) + fprintf(f,"// %.2x\n ",ix & ~7); + } + fclose(f); + + iconv_close(cd); +} +#endif + char* text[]= @@ -844,6 +919,8 @@ void TestTest(int control) //FindPhonemesUsed(); //return; +//CharsetToUnicode("ISO-8859-4"); +//CharsetToUnicode("ISCII"); return; diff --git a/src/synthdata.cpp b/src/synthdata.cpp index 709b2d90..28b3863f 100755 --- a/src/synthdata.cpp +++ b/src/synthdata.cpp @@ -35,7 +35,7 @@ #include "translate.h" #include "wave.h" -const char *version_string = "1.25 20.May.07"; +const char *version_string = "1.25.01 20.May.07"; const int version_phdata = 0x012501; int option_device_number = -1; diff --git a/src/translate.cpp b/src/translate.cpp index 3965febb..341f05ac 100755 --- a/src/translate.cpp +++ b/src/translate.cpp @@ -152,6 +152,21 @@ static const unsigned short ISO_8859_3[0x60] = { 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, // f8 }; +static const unsigned short ISO_8859_4[0x60] = { + 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, // a0 + 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, // a8 + 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, // b0 + 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, // b8 + 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, // c0 + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, // c8 + 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, // d0 + 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, // d8 + 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, // e0 + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, // e8 + 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, // f0 + 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, // f8 +}; + static const unsigned short ISO_8859_5[0x60] = { 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, // a0 Cyrillic 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, // a8 @@ -247,7 +262,7 @@ const unsigned short *charsets[N_CHARSETS] = { ISO_8859_1, ISO_8859_2, ISO_8859_3, - ISO_8859_1, + ISO_8859_4, ISO_8859_5, ISO_8859_1, ISO_8859_7,