reactos/include/crt/ctype.h

261 lines
9.9 KiB
C
Raw Normal View History

/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _INC_CTYPE
#define _INC_CTYPE
#include <crtdefs.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WEOF
#define WEOF (wint_t)(0xFFFF)
#endif
#ifndef _CRT_CTYPEDATA_DEFINED
# define _CRT_CTYPEDATA_DEFINED
# ifndef _CTYPE_DISABLE_MACROS
# ifndef __PCTYPE_FUNC
# ifdef _DLL
# define __PCTYPE_FUNC __pctype_func()
# else
# define __PCTYPE_FUNC _pctype
# endif
# endif /* !__PCTYPE_FUNC */
_CRTIMP const unsigned short * __cdecl __pctype_func(void);
# ifndef _M_CEE_PURE
_CRTDATA(extern const unsigned short *_pctype);
# else
# define _pctype (__pctype_func())
# endif /* !_M_CEE_PURE */
# endif /* !_CTYPE_DISABLE_MACROS */
#endif /* !_CRT_CTYPEDATA_DEFINED */
#ifndef _CRT_WCTYPEDATA_DEFINED
#define _CRT_WCTYPEDATA_DEFINED
# ifndef _CTYPE_DISABLE_MACROS
_CRTDATA(extern const unsigned short _wctype[]);
_CRTIMP const wctype_t * __cdecl __pwctype_func(void);
# ifndef _M_CEE_PURE
_CRTDATA(extern const wctype_t *_pwctype);
# else
# define _pwctype (__pwctype_func())
# endif /* !_M_CEE_PURE */
# endif /* !_CTYPE_DISABLE_MACROS */
#endif /* !_CRT_WCTYPEDATA_DEFINED */
/* CRT stuff */
#if 1
extern const unsigned char __newclmap[];
extern const unsigned char __newcumap[];
extern pthreadlocinfo __ptlocinfo;
extern pthreadmbcinfo __ptmbcinfo;
extern int __globallocalestatus;
extern int __locale_changed;
extern struct threadlocaleinfostruct __initiallocinfo;
extern _locale_tstruct __initiallocalestructinfo;
pthreadlocinfo __cdecl __updatetlocinfo(void);
pthreadmbcinfo __cdecl __updatetmbcinfo(void);
#endif
#define _UPPER 0x1
#define _LOWER 0x2
#define _DIGIT 0x4
#define _SPACE 0x8
#define _PUNCT 0x10
#define _CONTROL 0x20
#define _BLANK 0x40
#define _HEX 0x80
#define _LEADBYTE 0x8000
#define _ALPHA (0x0100|_UPPER|_LOWER)
#ifndef _CTYPE_DEFINED
#define _CTYPE_DEFINED
_CRTIMP int __cdecl _isctype(int _C,int _Type);
_CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale);
_CRTIMP int __cdecl isalpha(int _C);
_CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl isupper(int _C);
_CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl islower(int _C);
_CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl isdigit(int _C);
_CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl isxdigit(int _C);
_CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl isspace(int _C);
_CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl ispunct(int _C);
_CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl isalnum(int _C);
_CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl isprint(int _C);
_CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl isgraph(int _C);
_CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl iscntrl(int _C);
_CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl toupper(int _C);
_CRTIMP int __cdecl tolower(int _C);
_CRTIMP int __cdecl _tolower(int _C);
_CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl _toupper(int _C);
_CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale);
_CRTIMP int __cdecl __isascii(int _C);
_CRTIMP int __cdecl __toascii(int _C);
_CRTIMP int __cdecl __iscsymf(int _C);
_CRTIMP int __cdecl __iscsym(int _C);
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES)
_CRTIMP int __cdecl isblank(int _C);
#endif
#endif /* !_CTYPE_DEFINED */
#ifndef _WCTYPE_DEFINED
#define _WCTYPE_DEFINED
_CRTIMP int __cdecl iswalpha(wint_t _C);
_CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswupper(wint_t _C);
_CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswlower(wint_t _C);
_CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswdigit(wint_t _C);
_CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswxdigit(wint_t _C);
_CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswspace(wint_t _C);
_CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswpunct(wint_t _C);
_CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswalnum(wint_t _C);
_CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswprint(wint_t _C);
_CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswgraph(wint_t _C);
_CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswcntrl(wint_t _C);
_CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswascii(wint_t _C);
_CRTIMP int __cdecl isleadbyte(int _C);
_CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale);
_CRTIMP wint_t __cdecl towupper(wint_t _C);
_CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale);
_CRTIMP wint_t __cdecl towlower(wint_t _C);
_CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl iswctype(wint_t _C,wctype_t _Type);
_CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale);
_CRTIMP int __cdecl __iswcsymf(wint_t _C);
_CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl __iswcsym(wint_t _C);
_CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl is_wctype(wint_t _C,wctype_t _Type);
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES)
_CRTIMP int __cdecl iswblank(wint_t _C);
#endif
#endif
#ifndef _CTYPE_DISABLE_MACROS
#ifndef MB_CUR_MAX
#define MB_CUR_MAX ___mb_cur_max_func()
#ifndef __mb_cur_max
#ifdef _MSVCRT_
extern int __mb_cur_max;
#else
#define __mb_cur_max (*_imp____mb_cur_max)
extern int *_imp____mb_cur_max;
#endif
#endif
#ifdef _MSVCRT_
#define ___mb_cur_max_func() (__mb_cur_max)
#else
#define ___mb_cur_max_func() (*_imp____mb_cur_max)
#endif
KJK::Hyperion is proud to present "dllimport purity", another landmark commit that you should really build only after a "clean" Disclaimer: in an uncharacteristic and daring move, I actually built, installed and booted this revision modified tools/rbuild/backend/mingw/mingw.cpp modified tools/rbuild/backend/mingw/modulehandler.cpp modified tools/rbuild/module.cpp modified tools/rbuild/project.dtd modified tools/rbuild/rbuild.h modified include/crt/_mingw.h New module attribute iscrt for marking modules that implement a C runtime library New module attribute crt for compiling and linking modules to a specific C runtime library. Can be "ntdll" (for ntdll.dll) "msvcrt" (msvcrt.dll), "crt" (statically-linked runtime), "libcntpr" (libcntpr.lib), "dll" (one of the <library> entries specifies a CRT DLL) or "static". Defaults to "msvcrt" for Win32 modules, to "static" for CRT modules themselves, and to "dll" for drivers Define _DLL for code that compiles against a dynamically-linked CRT Define __MINGW_IMPORT and _CRTIMP according to whether _DLL is defined. We finally use __declspec(dllimport) somewhere, anywhere (SDK headers still don't use it) Bonus fix: actually use compiler-specific command line flags when compiling files modified lib/3rdparty/adns/adns.rbuild modified lib/3rdparty/libxml2/libxml2.rbuild modified lib/3rdparty/mingw/mingw.rbuild And for the downside: static libraries that will be linked to a module that links to the CRT dynamically have to be compiled for a dynamically-linked CRT, as well. Say it out aloud. modified base/applications/wordpad/wordpad.rbuild modified base/setup/usetup/usetup.rbuild modified dll/3rdparty/dxtn/dxtn.rbuild modified dll/3rdparty/freetype/freetype.rbuild modified dll/3rdparty/mesa32/mesa32.rbuild modified dll/cpl/desk/desk.rbuild modified dll/cpl/input/input.rbuild modified dll/cpl/intl/intl.rbuild modified dll/cpl/joy/joy.rbuild modified dll/cpl/main/main.rbuild modified dll/cpl/mmsys/mmsys.rbuild modified dll/cpl/odbccp32/odbccp32.rbuild modified dll/cpl/powercfg/powercfg.rbuild modified dll/cpl/sysdm/sysdm.rbuild modified dll/cpl/telephon/telephon.rbuild modified dll/cpl/timedate/timedate.rbuild modified dll/cpl/usrmgr/usrmgr.rbuild modified dll/directx/ddraw/ddraw.rbuild modified dll/directx/dsound/dsound.rbuild modified dll/directx/wine/wined3d/wined3d.rbuild modified dll/nls/idndl_redist/idndl_redist.rbuild modified dll/nls/normaliz_redist/normaliz_redist.rbuild modified dll/shellext/deskadp/deskadp.rbuild modified dll/shellext/deskmon/deskmon.rbuild modified dll/shellext/fontext/fontext.rbuild modified dll/win32/dhcpcsvc/dhcpcsvc.rbuild modified dll/win32/dnsapi/dnsapi.rbuild modified dll/win32/glu32/glu32.rbuild modified dll/win32/icmp/icmp.rbuild modified dll/win32/winmm/midimap/midimap.rbuild modified drivers/video/displays/framebuf/framebuf.rbuild modified drivers/video/displays/framebufacc/framebufacc.rbuild modified drivers/video/displays/vga/vgaddi.rbuild modified subsystems/win32/csrss/csrss.rbuild modified subsystems/win32/csrss/win32csr/win32csr.rbuild modified subsystems/win32/win32k/win32k.rbuild Don't specify msvcrt explicitely as a <library> if it's going to be linked implicitely as the CRT <library>libcntpr</library> -> crt="libcntpr" Remove miscellaneous unused <library> entries modified dll/win32/crtdll/crtdll.rbuild modified dll/win32/msvcrt20/msvcrt20.rbuild modified dll/win32/msvcrt40/msvcrt40.rbuild modified dll/win32/msvcrt/msvcrt.rbuild Mark CRT DLLs as CRT modules modified dll/win32/user32/windows/font.c modified include/reactos/wine/unicode.h Don't redefine or redeclare CRT functions modified dll/win32/ws2_32/include/ws2_32.h Arch, you idiot, it's defined in <stdlib.h> modified include/crt/ctype.h modified include/crt/wctype.h Don't import ctype routines that were already defined as inlines modified include/crt/stdio.h modified include/reactos/wine/config.h Avoid linking to libmingwex.a if possible modified base/applications/taskmgr/taskmgr.rbuild modified tools/nci/nci.mak modified tools/nci/ncitool.c modified dll/ntdll/ntdll.rbuild Mark ntdll module as a CRT New "ntsys" module to import just Nt/Zw from ntdll.dll. Avoids accidentally linking to ntdll.dll's CRT when importing system calls modified include/psdk/winternl.h Nope, it doesn't. modified base/applications/network/net/help.c modified base/applications/network/net/main.c Replace printf with puts, or GCC will do it on its own and link to the dllimport thunk for puts modified base/applications/network/ping/ping.c Removed broken, unnecessary workaround modified base/shell/cmd/cmd.rbuild Simplify cmd module This commit dediHAPPY BIRTHDAY STEFAN GINSBERG <3 <3 <3 svn path=/trunk/; revision=37187
2008-11-04 18:16:58 +00:00
#endif
#define __chvalidchk(a,b) (__PCTYPE_FUNC[(a)] & (b))
#define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[_Char] & (_Flag))
#define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale))
#define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale)
#define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale)
#define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale)
#define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale)
#define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale)
#define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale)
#define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale)
#define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale)
#define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale)
#define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale)
#define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale)
#define _tolower(_Char) ((_Char)-'A'+'a')
#define _toupper(_Char) ((_Char)-'a'+'A')
#define __isascii(_Char) ((unsigned)(_Char) < 0x80)
#define __toascii(_Char) ((_Char) & 0x7f)
#ifndef _WCTYPE_INLINE_DEFINED
#define _WCTYPE_INLINE_DEFINED
#undef _CRT_WCTYPE_NOINLINE
#ifndef __cplusplus
#define iswalpha(_c) (iswctype(_c,_ALPHA))
#define iswupper(_c) (iswctype(_c,_UPPER))
#define iswlower(_c) (iswctype(_c,_LOWER))
#define iswdigit(_c) (iswctype(_c,_DIGIT))
#define iswxdigit(_c) (iswctype(_c,_HEX))
#define iswspace(_c) (iswctype(_c,_SPACE))
#define iswpunct(_c) (iswctype(_c,_PUNCT))
#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT))
#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT))
#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT))
#define iswcntrl(_c) (iswctype(_c,_CONTROL))
#define iswascii(_c) ((unsigned)(_c) < 0x80)
#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p))
#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p))
#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p))
#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p))
#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p))
#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p))
#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p))
#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p))
#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p))
#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p))
#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p))
#endif
#endif
#define __iscsymf(_c) (isalpha(_c) || ((_c)=='_'))
#define __iscsym(_c) (isalnum(_c) || ((_c)=='_'))
#define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_'))
#define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_'))
#define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_'))
#define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_'))
#define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_'))
#define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_'))
#endif
#ifndef NO_OLDNAMES
#ifndef _CTYPE_DEFINED
_CRTIMP _CRT_NONSTDC_DEPRECATE(__isascii) _CRTIMP int __cdecl isascii(int _C);
_CRTIMP _CRT_NONSTDC_DEPRECATE(__toascii) _CRTIMP int __cdecl toascii(int _C);
_CRTIMP _CRT_NONSTDC_DEPRECATE(__iscsymf) _CRTIMP int __cdecl iscsymf(int _C);
_CRTIMP _CRT_NONSTDC_DEPRECATE(__iscsym) _CRTIMP int __cdecl iscsym(int _C);
#else
#define isascii __isascii
#define toascii __toascii
#define iscsymf __iscsymf
#define iscsym __iscsym
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* !_INC_CTYPE */