ReactOS 0.4.16-dev-122-g325d74c
ctype.c File Reference
#include <string.h>
#include <ctype.h>
#include <precomp.h>
Include dependency graph for ctype.c:

Go to the source code of this file.

Macros

#define __MINGW_IMPORT
 
#define upalpha   ('A' - 'a')
 

Functions

const unsigned short ** __p__pwctype (void)
 
const unsigned short *__cdecl __pwctype_func (void)
 
int __cdecl _isctype_l (int c, int type, _locale_t locale)
 
int __cdecl _isctype (int c, int ctypeFlags)
 
int __cdecl _isleadbyte_l (int c, _locale_t locale)
 
int __cdecl isalpha (int c)
 
int __cdecl isalnum (int c)
 
int __cdecl iswalnum (wint_t c)
 
int __cdecl __isascii (int c)
 
int __cdecl iswascii (wint_t c)
 
int __cdecl iscntrl (int c)
 
int __cdecl __iscsym (int c)
 
int __cdecl __iscsymf (int c)
 
int __cdecl isdigit (int c)
 
int __cdecl isgraph (int c)
 
int __cdecl islower (int c)
 
int __cdecl isprint (int c)
 
int __cdecl ispunct (int c)
 
int __cdecl isspace (int c)
 
int __cdecl isupper (int c)
 
int __cdecl isxdigit (int c)
 
int __cdecl iswalpha (wint_t c)
 
int __cdecl iswcntrl (wint_t c)
 
int __cdecl iswdigit (wint_t c)
 
int __cdecl iswgraph (wint_t c)
 
int __cdecl iswprint (wint_t c)
 
int __cdecl iswpunct (wint_t c)
 
int __cdecl iswlower (wint_t c)
 
int __cdecl iswupper (wint_t c)
 
int __cdecl iswspace (wint_t c)
 
int __cdecl iswxdigit (wint_t c)
 
int __cdecl __toascii (int c)
 
int __cdecl _tolower (int c)
 
int __cdecl _toupper (int c)
 
int __cdecl tolower (int c)
 
int __cdecl toupper (int c)
 
wint_t __cdecl towlower (wint_t c)
 
wint_t __cdecl towupper (wint_t c)
 

Variables

const unsigned short _ctype []
 
const unsigned short _wctype []
 
const unsigned short_pctype = _ctype + 1
 
const unsigned short_pwctype = _wctype + 1
 
const unsigned short wine_wctype_table []
 

Macro Definition Documentation

◆ __MINGW_IMPORT

#define __MINGW_IMPORT

Definition at line 3 of file ctype.c.

◆ upalpha

#define upalpha   ('A' - 'a')

Definition at line 33 of file ctype.c.

Function Documentation

◆ __isascii()

int __cdecl __isascii ( int  c)

Definition at line 655 of file ctype.c.

656{
657 return ((unsigned char)c <= 0x7f);
658}
const GLubyte * c
Definition: glext.h:8905

◆ __iscsym()

int __cdecl __iscsym ( int  c)

Definition at line 679 of file ctype.c.

680{
681 return (c < 127 && (isalnum(c) || (c == '_')));
682}
int __cdecl isalnum(int c)
Definition: ctype.c:639

◆ __iscsymf()

int __cdecl __iscsymf ( int  c)

Definition at line 687 of file ctype.c.

688{
689 return (c < 127 && (isalpha(c) || (c == '_')));
690}
#define isalpha(c)
Definition: acclib.h:74

◆ __p__pwctype()

const unsigned short ** __p__pwctype ( void  )

Definition at line 564 of file ctype.c.

565{
566 return &_pwctype;
567}
const unsigned short * _pwctype
Definition: ctype.c:557

Referenced by Test__wctype().

◆ __pwctype_func()

const unsigned short *__cdecl __pwctype_func ( void  )

Definition at line 569 of file ctype.c.

570{
571 return _pwctype;
572}

◆ __toascii()

int __cdecl __toascii ( int  c)

Definition at line 843 of file ctype.c.

844{
845 return((unsigned int)(c) & 0x7f);
846}

◆ _isctype()

int __cdecl _isctype ( int  c,
int  ctypeFlags 
)

Definition at line 613 of file ctype.c.

614{
615 return _isctype_l(c, ctypeFlags, NULL);
616}
int __cdecl _isctype_l(int c, int type, _locale_t locale)
Definition: ctype.c:583
#define NULL
Definition: types.h:112

Referenced by _tolower(), _toupper(), isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), tolower(), and toupper().

◆ _isctype_l()

int __cdecl _isctype_l ( int  c,
int  type,
_locale_t  locale 
)

Definition at line 583 of file ctype.c.

584{
586
587 if(!locale)
589 else
590 locinfo = ((MSVCRT__locale_t)locale)->locinfo;
591
592 if (c >= -1 && c <= 255)
593 return locinfo->pctype[c] & type;
594
595 if (locinfo->mb_cur_max != 1 && c > 0)
596 {
597 /* FIXME: Is there a faster way to do this? */
598 WORD typeInfo;
599 char convert[3], *pconv = convert;
600
601 if (locinfo->pctype[(UINT)c >> 8] & _LEADBYTE)
602 *pconv++ = (UINT)c >> 8;
603 *pconv++ = c & 0xff;
604 *pconv = 0;
605
606 if (GetStringTypeExA(locinfo->lc_handle[LC_CTYPE],
607 CT_CTYPE1, convert, convert[1] ? 2 : 1, &typeInfo))
608 return typeInfo & type;
609 }
610 return 0;
611}
Definition: _locale.h:75
BOOL WINAPI GetStringTypeExA(LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
Definition: locale.c:3255
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define _LEADBYTE
Definition: ctype.h:75
#define LC_CTYPE
Definition: locale.h:19
#define c
Definition: ke_i.h:80
struct MSVCRT_localeinfo_struct * MSVCRT__locale_t
int convert
Definition: msacm.c:1374
unsigned int UINT
Definition: ndis.h:50
else locinfo
Definition: scanf.h:159
#define get_locinfo()
Definition: winesup.h:25
#define CT_CTYPE1
Definition: winnls.h:237

Referenced by _isctype(), and _isleadbyte_l().

◆ _isleadbyte_l()

int __cdecl _isleadbyte_l ( int  c,
_locale_t  locale 
)

Definition at line 621 of file ctype.c.

622{
623 return _isctype_l( c, _LEADBYTE, locale );
624}

◆ _tolower()

int __cdecl _tolower ( int  c)

Definition at line 851 of file ctype.c.

852{
853 if (_isctype (c, _UPPER))
854 return (c - upalpha);
855 return(c);
856}
#define upalpha
Definition: ctype.c:33
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613
#define _UPPER
Definition: ctype.h:65

◆ _toupper()

int __cdecl _toupper ( int  c)

Definition at line 861 of file ctype.c.

862{
863 if (_isctype (c, _LOWER))
864 return (c + upalpha);
865 return(c);
866}
#define _LOWER
Definition: ctype.h:66

◆ isalnum()

int __cdecl isalnum ( int  c)

Definition at line 639 of file ctype.c.

640{
641 return(_isctype(c, _ALPHA | _DIGIT));
642}
#define _ALPHA
Definition: ctype.h:76
#define _DIGIT
Definition: ctype.h:67

Referenced by __iscsym().

◆ isalpha()

int __cdecl isalpha ( int  c)

Definition at line 631 of file ctype.c.

632{
633 return(_isctype(c, _ALPHA));
634}

◆ iscntrl()

int __cdecl iscntrl ( int  c)

Definition at line 671 of file ctype.c.

672{
673 return(_isctype(c, _CONTROL));
674}
#define _CONTROL
Definition: ctype.h:71

◆ isdigit()

int __cdecl isdigit ( int  c)

Definition at line 695 of file ctype.c.

696{
697 return(_isctype(c, _DIGIT));
698}

◆ isgraph()

int __cdecl isgraph ( int  c)

Definition at line 703 of file ctype.c.

704{
705 return (_isctype (c, _PUNCT | _ALPHA | _DIGIT));
706}
#define _PUNCT
Definition: ctype.h:70

◆ islower()

int __cdecl islower ( int  c)

Definition at line 711 of file ctype.c.

712{
713 return (_isctype (c, _LOWER));
714}

◆ isprint()

int __cdecl isprint ( int  c)

Definition at line 719 of file ctype.c.

720{
721 return (_isctype (c, _BLANK | _PUNCT | _ALPHA | _DIGIT));
722}
#define _BLANK
Definition: ctype.h:72

◆ ispunct()

int __cdecl ispunct ( int  c)

Definition at line 727 of file ctype.c.

728{
729 return (_isctype (c, _PUNCT));
730}

◆ isspace()

int __cdecl isspace ( int  c)

Definition at line 735 of file ctype.c.

736{
737 return (_isctype (c, _SPACE));
738}
#define _SPACE
Definition: ctype.h:68

◆ isupper()

int __cdecl isupper ( int  c)

Definition at line 743 of file ctype.c.

744{
745 return (_isctype (c, _UPPER));
746}

◆ iswalnum()

int __cdecl iswalnum ( wint_t  c)

Definition at line 647 of file ctype.c.

648{
649 return iswctype(c, _ALPHA | _DIGIT);
650}
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:100

◆ iswalpha()

int __cdecl iswalpha ( wint_t  c)

Definition at line 760 of file ctype.c.

761{
762 return (iswctype (c, _ALPHA));
763}

◆ iswascii()

int __cdecl iswascii ( wint_t  c)

Definition at line 663 of file ctype.c.

664{
665 return __isascii(c);
666}
#define __isascii(_Char)
Definition: ctype.h:656

◆ iswcntrl()

int __cdecl iswcntrl ( wint_t  c)

Definition at line 768 of file ctype.c.

769{
770 return iswctype(c, _CONTROL);
771}

◆ iswdigit()

int __cdecl iswdigit ( wint_t  c)

Definition at line 776 of file ctype.c.

777{
778 return (iswctype (c, _DIGIT));
779}

◆ iswgraph()

int __cdecl iswgraph ( wint_t  c)

Definition at line 784 of file ctype.c.

785{
786 return iswctype(c,_PUNCT | _ALPHA | _DIGIT);
787}

◆ iswlower()

int __cdecl iswlower ( wint_t  c)

Definition at line 809 of file ctype.c.

810{
811 return (iswctype (c, _LOWER));
812}

◆ iswprint()

int __cdecl iswprint ( wint_t  c)

Definition at line 792 of file ctype.c.

793{
794 return iswctype((unsigned short)c,_BLANK | _PUNCT | _ALPHA | _DIGIT);
795}

◆ iswpunct()

int __cdecl iswpunct ( wint_t  c)

Definition at line 801 of file ctype.c.

802{
803 return iswctype(c, _PUNCT);
804}

◆ iswspace()

int __cdecl iswspace ( wint_t  c)

Definition at line 826 of file ctype.c.

827{
828 return (iswctype (c, _SPACE));
829}

◆ iswupper()

int __cdecl iswupper ( wint_t  c)

Definition at line 817 of file ctype.c.

818{
819 return iswctype(c, _UPPER);
820}

◆ iswxdigit()

int __cdecl iswxdigit ( wint_t  c)

Definition at line 834 of file ctype.c.

835{
836 return (iswctype (c, _HEX));
837}
#define _HEX
Definition: ctype.h:73

◆ isxdigit()

int __cdecl isxdigit ( int  c)

Definition at line 751 of file ctype.c.

752{
753 return (_isctype (c, _HEX));
754}

◆ tolower()

◆ toupper()

int __cdecl toupper ( int  c)

Definition at line 881 of file ctype.c.

882{
883 if (_isctype (c, _LOWER))
884 return (c + upalpha);
885 return(c);
886}

Referenced by _getdiskfree(), _ILCreateDrive(), _Locale_toupper(), _main(), _mbbtoupper(), _mbsicmp(), _mbsicoll(), _mbsupr(), _memicmp(), _stricmp(), _strnicmp(), _strupr(), AcpiNsBuildInternalName(), AcpiNsRepair_HID(), AcpiUtStrupr(), Addhost(), change_section_attribs(), Close(), ConvertPathCase(), DliHook(), DosIfCharYesNo(), DosToUpper(), DosToUpperStrN(), DosToUpperStrZ(), EtfspCompareNames(), ExceptionFilter(), FD31_WMInitDialog(), file_cvt(), find_str(), Format(), getbyte(), GetExpandedNameA(), getVKNum(), InteractiveConsole(), FileTypeManager::is_exe_file(), iso9660_file_length(), KdbSymInit(), Link(), main(), MCICDA_Open(), mmioStringToFOURCCA(), NPAddConnection3(), Open(), parseArguments(), PathMatchSingleMaskA(), PeLdrpCompareDllName(), PrintDriveLetter(), ProcessCmdLine(), Protect(), put_resource_id(), read_rcfile(), regdump(), RepairIntroPage(), Save(), SdbMakeIndexKeyFromString(), ServeOneClient(), ShimLib_StrAEqualsWNC(), StrCmpPath(), SymMatchFileName(), test_GetDrive(), test_GetVolumeInformationA(), test_PathNameA(), test_query_dos_deviceA(), test_RtlIsNameLegalDOS8Dot3(), to_upper(), toupper_str(), UpgradeRepairPage(), VfdBroadcastLink(), VfdGetLocalLink(), VfdSetGlobalLink(), VfdSetLocalLink(), WelcomePage(), wtstrcasecmp(), XCOPY_DoCopy(), XCOPY_ParseCommandLine(), XCOPY_ProcessDestParm(), xkeymap_read(), xmlAddEncodingAlias(), xmlFindCharEncodingHandler(), xmlGetEncodingAlias(), xmlNewCharEncodingHandler(), and xmlParseCharEncoding().

◆ towlower()

wint_t __cdecl towlower ( wint_t  c)

Definition at line 891 of file ctype.c.

892{
893 if (iswctype (c, _UPPER))
894 return (c - upalpha);
895 return(c);
896}

◆ towupper()

wint_t __cdecl towupper ( wint_t  c)

Definition at line 901 of file ctype.c.

902{
903 if (iswctype (c, _LOWER))
904 return (c + upalpha);
905 return(c);
906}

Variable Documentation

◆ _ctype

const unsigned short _ctype[]

Definition at line 36 of file ctype.c.

Referenced by MSVCRT__create_locale(), and Test__ctype().

◆ _pctype

const unsigned short* _pctype = _ctype + 1

Definition at line 556 of file ctype.c.

◆ _pwctype

const unsigned short* _pwctype = _wctype + 1

Definition at line 557 of file ctype.c.

Referenced by __p__pwctype(), and __pwctype_func().

◆ _wctype

const unsigned short _wctype[]

Definition at line 296 of file ctype.c.

◆ wine_wctype_table

const unsigned short wine_wctype_table[]
extern

Definition at line 6 of file wctype.c.

Referenced by get_char_typeW().