ReactOS  0.4.14-dev-554-g2f8d847
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

Referenced by iswascii().

◆ __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
const GLubyte * c
Definition: glext.h:8905

◆ __iscsymf()

int __cdecl __iscsymf ( int  c)

Definition at line 687 of file ctype.c.

688 {
689  return (c < 127 && (isalpha(c) || (c == '_')));
690 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl isalpha(int c)
Definition: ctype.c:631

◆ __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

◆ __pwctype_func()

const unsigned short* __cdecl __pwctype_func ( void  )

Definition at line 569 of file ctype.c.

570 {
571  return _pwctype;
572 }
const unsigned short * _pwctype
Definition: ctype.c:557

◆ __toascii()

int __cdecl __toascii ( int  c)

Definition at line 843 of file ctype.c.

844 {
845  return((unsigned int)(c) & 0x7f);
846 }
const GLubyte * c
Definition: glext.h:8905

◆ _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 }
smooth NULL
Definition: ftsmooth.c:416
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype_l(int c, int type, _locale_t locale)
Definition: ctype.c:583

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)
588  locinfo = get_locinfo();
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 }
#define LC_CTYPE
Definition: locale.h:27
struct MSVCRT_localeinfo_struct * MSVCRT__locale_t
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: _locale.h:75
#define get_locinfo()
Definition: winesup.h:25
#define _LEADBYTE
Definition: ctype.h:75
int convert
Definition: msacm.c:1374
const GLubyte * c
Definition: glext.h:8905
unsigned short WORD
Definition: ntddk_ex.h:93
#define CT_CTYPE1
Definition: winnls.h:234
BOOL WINAPI GetStringTypeExA(LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
Definition: lang.c:1860
else locinfo
Definition: scanf.h:159
unsigned int UINT
Definition: ndis.h:50
#define c
Definition: ke_i.h:80

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 }
Definition: _locale.h:75
#define _LEADBYTE
Definition: ctype.h:75
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype_l(int c, int type, _locale_t locale)
Definition: ctype.c:583

◆ _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 _UPPER
Definition: ctype.h:65
#define upalpha
Definition: ctype.c:33
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613

◆ _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 upalpha
Definition: ctype.c:33
const GLubyte * c
Definition: glext.h:8905
#define _LOWER
Definition: ctype.h:66
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613

◆ isalnum()

int __cdecl isalnum ( int  c)

Definition at line 639 of file ctype.c.

640 {
641  return(_isctype(c, _ALPHA | _DIGIT));
642 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613
#define _DIGIT
Definition: ctype.h:67
#define _ALPHA
Definition: ctype.h:76

Referenced by __iscsym().

◆ isalpha()

int __cdecl isalpha ( int  c)

Definition at line 631 of file ctype.c.

632 {
633  return(_isctype(c, _ALPHA));
634 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613
#define _ALPHA
Definition: ctype.h:76

Referenced by __iscsymf().

◆ 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
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613

◆ isdigit()

int __cdecl isdigit ( int  c)

Definition at line 695 of file ctype.c.

696 {
697  return(_isctype(c, _DIGIT));
698 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613
#define _DIGIT
Definition: ctype.h:67

◆ isgraph()

int __cdecl isgraph ( int  c)

Definition at line 703 of file ctype.c.

704 {
705  return (_isctype (c, _PUNCT | _ALPHA | _DIGIT));
706 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613
#define _DIGIT
Definition: ctype.h:67
#define _ALPHA
Definition: ctype.h:76
#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 }
const GLubyte * c
Definition: glext.h:8905
#define _LOWER
Definition: ctype.h:66
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613

◆ 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
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613
#define _DIGIT
Definition: ctype.h:67
#define _ALPHA
Definition: ctype.h:76
#define _PUNCT
Definition: ctype.h:70

◆ ispunct()

int __cdecl ispunct ( int  c)

Definition at line 727 of file ctype.c.

728 {
729  return (_isctype (c, _PUNCT));
730 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613
#define _PUNCT
Definition: ctype.h:70

◆ 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
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613

◆ isupper()

int __cdecl isupper ( int  c)

Definition at line 743 of file ctype.c.

744 {
745  return (_isctype (c, _UPPER));
746 }
#define _UPPER
Definition: ctype.h:65
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613

◆ iswalnum()

int __cdecl iswalnum ( wint_t  c)

Definition at line 647 of file ctype.c.

648 {
649  return iswctype(c, _ALPHA | _DIGIT);
650 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97
#define _DIGIT
Definition: ctype.h:67
#define _ALPHA
Definition: ctype.h:76

◆ iswalpha()

int __cdecl iswalpha ( wint_t  c)

Definition at line 760 of file ctype.c.

761 {
762  return (iswctype (c, _ALPHA));
763 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97
#define _ALPHA
Definition: ctype.h:76

◆ iswascii()

int __cdecl iswascii ( wint_t  c)

Definition at line 663 of file ctype.c.

664 {
665  return __isascii(c);
666 }
int __cdecl __isascii(int c)
Definition: ctype.c:655
const GLubyte * c
Definition: glext.h:8905

◆ iswcntrl()

int __cdecl iswcntrl ( wint_t  c)

Definition at line 768 of file ctype.c.

769 {
770  return iswctype(c, _CONTROL);
771 }
#define _CONTROL
Definition: ctype.h:71
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97

◆ iswdigit()

int __cdecl iswdigit ( wint_t  c)

Definition at line 776 of file ctype.c.

777 {
778  return (iswctype (c, _DIGIT));
779 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97
#define _DIGIT
Definition: ctype.h:67

◆ iswgraph()

int __cdecl iswgraph ( wint_t  c)

Definition at line 784 of file ctype.c.

785 {
786  return iswctype(c,_PUNCT | _ALPHA | _DIGIT);
787 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97
#define _DIGIT
Definition: ctype.h:67
#define _ALPHA
Definition: ctype.h:76
#define _PUNCT
Definition: ctype.h:70

◆ iswlower()

int __cdecl iswlower ( wint_t  c)

Definition at line 809 of file ctype.c.

810 {
811  return (iswctype (c, _LOWER));
812 }
const GLubyte * c
Definition: glext.h:8905
#define _LOWER
Definition: ctype.h:66
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97

◆ 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 }
#define _BLANK
Definition: ctype.h:72
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97
#define _DIGIT
Definition: ctype.h:67
#define _ALPHA
Definition: ctype.h:76
#define _PUNCT
Definition: ctype.h:70

◆ iswpunct()

int __cdecl iswpunct ( wint_t  c)

Definition at line 801 of file ctype.c.

802 {
803  return iswctype(c, _PUNCT);
804 }
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97
#define _PUNCT
Definition: ctype.h:70

◆ iswspace()

int __cdecl iswspace ( wint_t  c)

Definition at line 826 of file ctype.c.

827 {
828  return (iswctype (c, _SPACE));
829 }
#define _SPACE
Definition: ctype.h:68
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97

◆ iswupper()

int __cdecl iswupper ( wint_t  c)

Definition at line 817 of file ctype.c.

818 {
819  return iswctype(c, _UPPER);
820 }
#define _UPPER
Definition: ctype.h:65
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97

◆ 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
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97

◆ isxdigit()

int __cdecl isxdigit ( int  c)

Definition at line 751 of file ctype.c.

752 {
753  return (_isctype (c, _HEX));
754 }
#define _HEX
Definition: ctype.h:73
const GLubyte * c
Definition: glext.h:8905
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613

◆ 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 }
#define upalpha
Definition: ctype.c:33
const GLubyte * c
Definition: glext.h:8905
#define _LOWER
Definition: ctype.h:66
int __cdecl _isctype(int c, int ctypeFlags)
Definition: ctype.c:613

Referenced by _getdiskfree(), _Locale_toupper(), _main(), _mbbtoupper(), _mbsicmp(), _mbsicoll(), _mbsupr(), _memicmp(), _stricmp(), _strnicmp(), _strupr(), AcpiNsBuildInternalName(), AcpiNsRepair_HID(), AcpiUtStrupr(), Addhost(), check_for_punctuation(), 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(), KdbInitialize(), Link(), main(), make_number(), MCICDA_Open(), mmioStringToFOURCCA(), normalize_dirname(), 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(), uppercase(), 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 }
#define _UPPER
Definition: ctype.h:65
#define upalpha
Definition: ctype.c:33
const GLubyte * c
Definition: glext.h:8905
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97

◆ 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 }
#define upalpha
Definition: ctype.c:33
const GLubyte * c
Definition: glext.h:8905
#define _LOWER
Definition: ctype.h:66
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97

Variable Documentation

◆ _ctype

const unsigned short _ctype[]

Definition at line 36 of file ctype.c.

Referenced by MSVCRT__create_locale().

◆ _pctype

const unsigned short* _pctype = _ctype + 1

Definition at line 556 of file ctype.c.

Referenced by setlocale().

◆ _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[]

Definition at line 6 of file wctype.c.

Referenced by get_char_typeW().