mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Split libc/wctype/wctype.cpp into multiple files.
This commit is contained in:
parent
ba8557075c
commit
d39437966d
17 changed files with 478 additions and 84 deletions
|
@ -228,6 +228,21 @@ wchar/wmemcmp.o \
|
|||
wchar/wmemcpy.o \
|
||||
wchar/wmemmove.o \
|
||||
wchar/wmemset.o \
|
||||
wctype/iswalnum.o \
|
||||
wctype/iswalpha.o \
|
||||
wctype/iswblank.o \
|
||||
wctype/iswcntrl.o \
|
||||
wctype/iswctype.o \
|
||||
wctype/iswdigit.o \
|
||||
wctype/iswgraph.o \
|
||||
wctype/iswlower.o \
|
||||
wctype/iswprint.o \
|
||||
wctype/iswpunct.o \
|
||||
wctype/iswspace.o \
|
||||
wctype/iswupper.o \
|
||||
wctype/iswxdigit.o \
|
||||
wctype/towlower.o \
|
||||
wctype/towupper.o \
|
||||
wctype/wctype.o \
|
||||
|
||||
HOSTEDOBJS=\
|
||||
|
|
30
libc/wctype/iswalnum.cpp
Normal file
30
libc/wctype/iswalnum.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswalnum.cpp
|
||||
Returns whether the wide character is alphabetical or a digit.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswalnum(wint_t c)
|
||||
{
|
||||
return iswalpha(c) || iswdigit(c);
|
||||
}
|
30
libc/wctype/iswalpha.cpp
Normal file
30
libc/wctype/iswalpha.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswalpha.cpp
|
||||
Returns whether the wide character is alphabetical.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswalpha(wint_t c)
|
||||
{
|
||||
return iswupper(c) || iswlower(c);
|
||||
}
|
30
libc/wctype/iswblank.cpp
Normal file
30
libc/wctype/iswblank.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswblank.cpp
|
||||
Returns whether the wide character is blank.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswblank(wint_t c)
|
||||
{
|
||||
return c == L' ' || c == L'\t';
|
||||
}
|
30
libc/wctype/iswcntrl.cpp
Normal file
30
libc/wctype/iswcntrl.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswcntrl.cpp
|
||||
Returns whether the wide character is a control character.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswcntrl(wint_t c)
|
||||
{
|
||||
return 0 <= c && c < 32;
|
||||
}
|
30
libc/wctype/iswctype.cpp
Normal file
30
libc/wctype/iswctype.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswctype.cpp
|
||||
Returns whether the wide character belongs to the character class.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswctype(wint_t c, wctype_t wct)
|
||||
{
|
||||
return wct(c);
|
||||
}
|
30
libc/wctype/iswdigit.cpp
Normal file
30
libc/wctype/iswdigit.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswdigit.cpp
|
||||
Returns whether the wide character is a digit.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswdigit(wint_t c)
|
||||
{
|
||||
return L'0' <= c && c <= L'9';
|
||||
}
|
30
libc/wctype/iswgraph.cpp
Normal file
30
libc/wctype/iswgraph.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswgraph.cpp
|
||||
Returns whether the wide character is graphical.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswgraph(wint_t c)
|
||||
{
|
||||
return L'!' <= c && c <= L'~';
|
||||
}
|
30
libc/wctype/iswlower.cpp
Normal file
30
libc/wctype/iswlower.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswlower.cpp
|
||||
Returns whether the wide character is lower-case.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswlower(wint_t c)
|
||||
{
|
||||
return L'a' <= c && c <= L'z';
|
||||
}
|
30
libc/wctype/iswprint.cpp
Normal file
30
libc/wctype/iswprint.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswprint.cpp
|
||||
Returns whether the wide character is printable.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswprint(wint_t c)
|
||||
{
|
||||
return iswgraph(c) || c == L' ';
|
||||
}
|
30
libc/wctype/iswpunct.cpp
Normal file
30
libc/wctype/iswpunct.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswpunct.cpp
|
||||
Returns whether the wide character is punctuational.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswpunct(wint_t c)
|
||||
{
|
||||
return iswprint(c) && c != L' ' && !iswalnum(c);
|
||||
}
|
31
libc/wctype/iswspace.cpp
Normal file
31
libc/wctype/iswspace.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswspace.cpp
|
||||
Returns whether the wide character is white-space.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswspace(wint_t c)
|
||||
{
|
||||
return c == L'\t' || c == L'\n' || c == L'\v' ||
|
||||
c == L'\f' || c == L'\r' || c == L' ';
|
||||
}
|
30
libc/wctype/iswupper.cpp
Normal file
30
libc/wctype/iswupper.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswupper.cpp
|
||||
Returns whether the wide character is upper-case.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswupper(wint_t c)
|
||||
{
|
||||
return L'A' <= c && c <= L'Z';
|
||||
}
|
36
libc/wctype/iswxdigit.cpp
Normal file
36
libc/wctype/iswxdigit.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/iswxdigit.cpp
|
||||
Returns whether the wide character is a hexadecimal digit.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" int iswxdigit(wint_t c)
|
||||
{
|
||||
if ( iswdigit(c) )
|
||||
return 1;
|
||||
if ( L'a' <= c && c <= L'f' )
|
||||
return 1;
|
||||
if ( L'A' <= c && c <= L'F' )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
32
libc/wctype/towlower.cpp
Normal file
32
libc/wctype/towlower.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2014.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/towlower.cpp
|
||||
Converts the wide character to lower-case if it is upper-case.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" wint_t towlower(wint_t c)
|
||||
{
|
||||
if ( L'A' <= c && c <= L'Z' )
|
||||
return L'a' + c - L'A';
|
||||
return c;
|
||||
}
|
32
libc/wctype/towupper.cpp
Normal file
32
libc/wctype/towupper.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2014.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library 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 Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/towupper.cpp
|
||||
Converts the wide character to upper-case if it is lower-case.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
extern "C" wint_t towupper(wint_t c)
|
||||
{
|
||||
if ( L'a' <= c && c <= L'z' )
|
||||
return L'A' + c - L'a';
|
||||
return c;
|
||||
}
|
|
@ -18,95 +18,13 @@
|
|||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wctype/wctype.cpp
|
||||
Character types.
|
||||
Returns the character class description with the given name.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <wctype.h>
|
||||
|
||||
// TODO: Support other locales than ASCII.
|
||||
|
||||
extern "C" int iswalnum(wint_t c)
|
||||
{
|
||||
return iswalpha(c) || iswdigit(c);
|
||||
}
|
||||
|
||||
extern "C" int iswalpha(wint_t c)
|
||||
{
|
||||
return iswupper(c) || iswlower(c);
|
||||
}
|
||||
|
||||
extern "C" int iswblank(wint_t c)
|
||||
{
|
||||
return c == L' ' || c == L'\t';
|
||||
}
|
||||
|
||||
extern "C" int iswcntrl(wint_t c)
|
||||
{
|
||||
return 0 <= c && c < 32;
|
||||
}
|
||||
|
||||
extern "C" int iswdigit(wint_t c)
|
||||
{
|
||||
return L'0' <= c && c <= L'9';
|
||||
}
|
||||
|
||||
extern "C" int iswgraph(wint_t c)
|
||||
{
|
||||
return L'!' <= c && c <= L'~';
|
||||
}
|
||||
|
||||
extern "C" int iswlower(wint_t c)
|
||||
{
|
||||
return L'a' <= c && c <= L'z';
|
||||
}
|
||||
|
||||
extern "C" int iswprint(wint_t c)
|
||||
{
|
||||
return iswgraph(c) || c == L' ';
|
||||
}
|
||||
|
||||
extern "C" int iswpunct(wint_t c)
|
||||
{
|
||||
return iswprint(c) && c != L' ' && !iswalnum(c);
|
||||
}
|
||||
|
||||
extern "C" int iswspace(wint_t c)
|
||||
{
|
||||
return c == L'\t' || c == L'\n' || c == L'\v' || c == L'\f' || c == L'\r' || c == L' ';
|
||||
}
|
||||
|
||||
extern "C" int iswupper(wint_t c)
|
||||
{
|
||||
return L'A' <= c && c <= L'Z';
|
||||
}
|
||||
|
||||
extern "C" int iswxdigit(wint_t c)
|
||||
{
|
||||
if ( iswdigit(c) ) { return 1; }
|
||||
if ( L'a' <= c && c <= L'f' ) { return 1; }
|
||||
if ( L'A' <= c && c <= L'F' ) { return 1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" wint_t towlower(wint_t c)
|
||||
{
|
||||
if ( L'A' <= c && c <= L'Z' ) { return L'a' + c - L'A'; }
|
||||
return c;
|
||||
}
|
||||
|
||||
extern "C" wint_t towupper(wint_t c)
|
||||
{
|
||||
if ( L'a' <= c && c <= L'z' ) { return L'A' + c - L'a'; }
|
||||
return c;
|
||||
}
|
||||
|
||||
extern "C" int iswctype(wint_t c, wctype_t wct)
|
||||
{
|
||||
return wct(c);
|
||||
}
|
||||
|
||||
extern "C" wctype_t wctype(const char *name)
|
||||
{
|
||||
if ( !strcmp(name, "alnum") ) return (wctype_t) iswalnum;
|
||||
|
@ -121,5 +39,5 @@ extern "C" wctype_t wctype(const char *name)
|
|||
if ( !strcmp(name, "space") ) return (wctype_t) iswspace;
|
||||
if ( !strcmp(name, "upper") ) return (wctype_t) iswupper;
|
||||
if ( !strcmp(name, "xdigit") ) return (wctype_t) iswxdigit;
|
||||
return (wctype_t) 0;
|
||||
return (wctype_t) NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue