From c80829a5fdda1811ab513933342f18a21aa23c86 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sat, 11 Feb 2017 08:39:29 +0000 Subject: [PATCH] Remove the NEED_WCHAR_FUNCTIONS code for wchar/wctype compatibility. --- src/libespeak-ng/readclause.c | 136 ---------------------------------- 1 file changed, 136 deletions(-) diff --git a/src/libespeak-ng/readclause.c b/src/libespeak-ng/readclause.c index 9ad2a7d2..9c57637e 100644 --- a/src/libespeak-ng/readclause.c +++ b/src/libespeak-ng/readclause.c @@ -289,142 +289,6 @@ static const short wchar_toupper[] = { 0, 0 }; -#ifdef NEED_WCHAR_FUNCTIONS - -// use ctype.h functions for Latin1 (character < 0x100) -int iswalpha(int c) -{ - if (c < 0x80) - return isalpha(c); - if ((c > 0x3040) && (c <= 0xa700)) - return 1; // japanese, chinese characters - if (c > MAX_WALPHA) - return 0; - return walpha_tab[c-0x80]; -} - -int iswdigit(int c) -{ - if (c < 0x80) - return isdigit(c); - return 0; -} - -int iswalnum(int c) -{ - if (iswdigit(c)) - return 1; - return iswalpha(c); -} - -int towlower(int c) -{ - int x; - int ix; - - if (c < 0x80) - return tolower(c); - - if ((c > MAX_WALPHA) || ((x = walpha_tab[c-0x80]) >= 0xfe)) - return c; - - if (x == 0xfd) { - // special cases, lookup translation table - for (ix = 0; wchar_tolower[ix] != 0; ix += 2) { - if (wchar_tolower[ix] == c) - return wchar_tolower[ix+1]; - } - } - return c + x; // convert to lower case -} - -int towupper(int c) -{ - int ix; - // check whether a previous character code is the upper-case equivalent of this character - if (towlower(c-32) == c) - return c-32; // yes, use it - if (towlower(c-1) == c) - return c-1; - for (ix = 0; wchar_toupper[ix] != 0; ix += 2) { - if (wchar_toupper[ix] == c) - return wchar_toupper[ix+1]; - } - return c; // no -} - -int iswupper(int c) -{ - int x; - if (c < 0x80) - return isupper(c); - if (((c > MAX_WALPHA) || (x = walpha_tab[c-0x80]) == 0) || (x == 0xff)) - return 0; - return 1; -} - -int iswlower(int c) -{ - if (c < 0x80) - return islower(c); - if ((c > MAX_WALPHA) || (walpha_tab[c-0x80] != 0xff)) - return 0; - return 1; -} - -int iswspace(int c) -{ - if (c < 0x80) - return isspace(c); - if (c == 0xa0) - return 1; - return 0; -} - -int iswpunct(int c) -{ - if (c < 0x100) - return ispunct(c); - return 0; -} - -const wchar_t *wcschr(const wchar_t *str, int c) -{ - while (*str != 0) { - if (*str == c) - return str; - str++; - } - return NULL; -} - -#ifndef WINCE -// wcslen() is provided by WINCE, but not the other wchar functions -const int wcslen(const wchar_t *str) -{ - int ix = 0; - - while (*str != 0) - ix++; - return ix; -} -#endif - -float wcstod(const wchar_t *str, wchar_t **tailptr) -{ - int ix; - char buf[80]; - while (isspace(*str)) str++; - for (ix = 0; ix < 80; ix++) { - buf[ix] = str[ix]; - if (isspace(buf[ix])) - break; - } - *tailptr = (wchar_t *)&str[ix]; - return atof(buf); -} -#endif - // use internal data for iswalpha up to U+024F // iswalpha() on Windows is unreliable (U+AA, U+BA). int iswalpha2(int c)