mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-13 17:23:44 +00:00
Add ctype-style APIs that are compatible with wctype.h.
This commit is contained in:
+116
@@ -0,0 +1,116 @@
|
||||
/* ctype-style APIs.
|
||||
*
|
||||
* Copyright (C) 2012 Reece H. Dunn
|
||||
*
|
||||
* This file is part of ucd-tools.
|
||||
*
|
||||
* ucd-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* ucd-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// NOTE: This file is automatically generated from the UnicodeData.txt file in
|
||||
// the Unicode Character database by the ucd-tools/tools/categories.py script.
|
||||
|
||||
#include "ucd/ucd.h"
|
||||
|
||||
int ucd::isalnum(codepoint_t c)
|
||||
{
|
||||
switch (lookup_category(c))
|
||||
{
|
||||
case Ll: case Lm: case Lo: case Lt: case Lu:
|
||||
case Nd: case Nl: case No:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ucd::isalpha(codepoint_t c)
|
||||
{
|
||||
switch (lookup_category(c))
|
||||
{
|
||||
case Ll: case Lm: case Lo: case Lt: case Lu:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ucd::iscntrl(codepoint_t c)
|
||||
{
|
||||
switch (lookup_category(c))
|
||||
{
|
||||
case Cc: case Zc:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ucd::isdigit(codepoint_t c)
|
||||
{
|
||||
switch (lookup_category(c))
|
||||
{
|
||||
case Nd: case Nl: case No:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ucd::isgraph(codepoint_t c)
|
||||
{
|
||||
switch (lookup_category(c))
|
||||
{
|
||||
case Cc: case Cf: case Ci: case Cn: case Co: case Cs:
|
||||
case Zc: case Zl: case Zp: case Zs:
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ucd::islower(codepoint_t c)
|
||||
{
|
||||
return lookup_category(c) == Ll;
|
||||
}
|
||||
|
||||
int ucd::isprint(codepoint_t c)
|
||||
{
|
||||
switch (lookup_category(c))
|
||||
{
|
||||
case Cc: case Cf: case Ci: case Cn: case Co: case Cs:
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ucd::ispunct(codepoint_t c)
|
||||
{
|
||||
switch (lookup_category(c))
|
||||
{
|
||||
case Pc: case Pd: case Pe: case Pf: case Pi: case Po: case Ps:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ucd::isspace(codepoint_t c)
|
||||
{
|
||||
switch (lookup_category(c))
|
||||
{
|
||||
case Zc: case Zl: case Zp: case Zs:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ucd::isupper(codepoint_t c)
|
||||
{
|
||||
return lookup_category(c) == Lu;
|
||||
}
|
||||
Reference in New Issue
Block a user