--- mstools/h/wchar.h 2018/08/09 18:21:08 1.1.1.2 +++ mstools/h/wchar.h 2018/08/09 18:23:03 1.1.1.3 @@ -1,7 +1,7 @@ /*** *wchar.h - declarations for wide character functions * -* Copyright (c) 1992, Microsoft Corporation. All rights reserved. +* Copyright (c) 1992-1993, Microsoft Corporation. All rights reserved. * *Purpose: * This file contains the types, macros and function declarations for @@ -34,15 +34,6 @@ extern "C" { #define _CRTAPI1 __cdecl #define _CRTAPI2 __cdecl -#elif ( _MSC_VER == 600 ) - -/* - * Definitions for old MS C6-386 compiler - */ -#define _CRTAPI1 _cdecl -#define _CRTAPI2 _cdecl -#define _M_IX86 300 - #else /* @@ -59,7 +50,6 @@ typedef unsigned int size_t; #define _SIZE_T_DEFINED #endif - #ifndef _WCHAR_T_DEFINED typedef unsigned short wchar_t; #define _WCHAR_T_DEFINED @@ -72,7 +62,14 @@ typedef wchar_t wctype_t; #endif #ifndef _VA_LIST_DEFINED -typedef char * va_list; +#if defined(_ALPHA_) +typedef struct { + char *a0; /* pointer to first homed integer argument */ + int offset; /* byte offset of next parameter */ +} va_list; +#else +typedef char * va_list; +#endif #define _VA_LIST_DEFINED #endif @@ -95,8 +92,6 @@ typedef struct _iobuf FILE; #define _FILE_DEFINED #endif -/* UNDONE: define struct tm */ - /* define NULL pointer value */ #ifndef NULL @@ -107,39 +102,29 @@ typedef struct _iobuf FILE; #endif #endif -/* function prototypes */ - -#ifndef _WCTYPE_DEFINED - /* * This declaration allows the user access to the ctype look-up * array _ctype defined in ctype.obj by simply including ctype.h */ -#ifndef _NEWCTYPETABLE +#ifdef _DLL -#ifdef _DLL -extern unsigned char * _ctype; -#else -extern unsigned char _ctype[]; -#endif +extern unsigned short * _ctype; -extern unsigned char *_pctype; -extern unsigned char *_pwctype; +#define _pctype (*_pctype_dll) +extern unsigned short **_pctype_dll; -#else +#define _pwctype (*_pwctype_dll) +extern unsigned short **_pwctype_dll; + +#else /* _DLL */ -#ifdef _DLL -extern unsigned short * _ctype; -#else -extern unsigned short _ctype[]; -#endif +extern unsigned short _ctype[]; extern unsigned short *_pctype; extern wctype_t *_pwctype; -#endif - +#endif /* _DLL */ /* set bit masks for the possible character types */ @@ -153,9 +138,16 @@ extern wctype_t *_pwctype; #define _BLANK 0x40 /* space char */ #define _HEX 0x80 /* hexadecimal digit */ +#define _LEADBYTE 0x8000 /* multibyte leadbyte */ +#define _ALPHA (0x0100|_UPPER|_LOWER) /* alphabetic character */ + +/* function prototypes */ + +#ifndef _WCTYPE_DEFINED /* character classification function prototypes */ +/* also defined in ctype.h */ int _CRTAPI1 iswalpha(wint_t); int _CRTAPI1 iswupper(wint_t); @@ -169,35 +161,47 @@ int _CRTAPI1 iswprint(wint_t); int _CRTAPI1 iswgraph(wint_t); int _CRTAPI1 iswcntrl(wint_t); int _CRTAPI1 iswascii(wint_t); +int _CRTAPI1 isleadbyte(int); wchar_t _CRTAPI1 towupper(wchar_t); wchar_t _CRTAPI1 towlower(wchar_t); -/* UNDONE: add wctype_t set_wctype(const char* property); */ -int _CRTAPI1 is_wctype(wint_t, wctype_t); +int _CRTAPI1 iswctype(wint_t, wctype_t); -#define isleadbyte(_c) (0) -/* #define is_wctype(_c,_t) ((_c) < 256 ? _pwctype[_c] & _t : 0 ) */ +int _CRTAPI1 _isctype(int, int); #define _WCTYPE_DEFINED #endif -#define iswalpha(_c) ((_c) < 256 ? _pwctype[_c] &_ALPHA:is_wctype(_c,_ALPHA)) -#define iswupper(_c) ((_c) < 256 ? _pwctype[_c] &_UPPER:is_wctype(_c,_UPPER)) -#define iswlower(_c) ((_c) < 256 ? _pwctype[_c] &_LOWER:is_wctype(_c,_LOWER)) -#define iswdigit(_c) ((_c) < 256 ? _pwctype[_c] &_DIGIT:is_wctype(_c,_DIGIT)) -#define iswxdigit(_c) ((_c) < 256 ? _pwctype[_c] &_HEX:is_wctype(_c,_HEX)) -#define iswspace(_c) ((_c) < 256 ? _pwctype[_c] &_SPACE:is_wctype(_c,_SPACE)) -#define iswpunct(_c) ((_c) < 256 ? _pwctype[_c] &_PUNCT:is_wctype(_c,_PUNCT)) -#define iswalnum(_c) ((_c) < 256 ? _pwctype[_c] &(_ALPHA|_DIGIT):is_wctype(_c,_ALPHA|_DIGIT)) -#define iswprint(_c) ((_c) < 256 ? _pwctype[_c] &(_BLANK|_PUNCT|_ALPHA|_DIGIT):is_wctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) -#define iswgraph(_c) ((_c) < 256 ? _pwctype[_c] &(_PUNCT|_ALPHA|_DIGIT):is_wctype(_c,_PUNCT|_ALPHA|_DIGIT)) -#define iswcntrl(_c) ((_c) < 256 ? _pwctype[_c] &_CONTROL:is_wctype(_c,_CONTROL)) +#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 ) +/* note: MS-specific routine, may evaluate its arguments more than once */ +#define isleadbyte(_c) ((_c) < 256 ? _pctype[_c] & _LEADBYTE : 0) #ifndef _WSTDIO_DEFINED + +wint_t _CRTAPI1 fgetwc(FILE *); +wint_t _CRTAPI1 _fgetwchar(void); +wint_t _CRTAPI1 fputwc(wint_t, FILE *); +wint_t _CRTAPI1 _fputwchar(wint_t); +wint_t _CRTAPI1 getwc(FILE *); +wint_t _CRTAPI1 getwchar(void); +wint_t _CRTAPI1 putwc(wint_t, FILE *); +wint_t _CRTAPI1 putwchar(wint_t); +wint_t _CRTAPI1 ungetwc(wint_t, FILE *); + int _CRTAPI2 fwprintf(FILE *, const wchar_t *, ...); int _CRTAPI2 wprintf(const wchar_t *, ...); int _CRTAPI2 _snwprintf(wchar_t *, size_t, const wchar_t *, ...); @@ -209,6 +213,13 @@ int _CRTAPI1 vswprintf(wchar_t *, const int _CRTAPI2 fwscanf(FILE *, const wchar_t *, ...); int _CRTAPI2 swscanf(const wchar_t *, const wchar_t *, ...); int _CRTAPI2 wscanf(const wchar_t *, ...); + +#define getwchar() fgetwc(stdin) +#define putwchar(_c) fputwc((_c),stdout) +#define getwc(_stm) fgetwc(_stm) +#define putwc(_c,_stm) fputwc(_c,_stm) + + #define _WSTDIO_DEFINED #endif @@ -272,8 +283,8 @@ int _CRTAPI1 _wcsicoll(const wchar_t *, #ifndef _WTIME_DEFINED -/* UNDONE: add wcsftime, etc. */ -/* #define _WTIME_DEFINED */ +size_t _CRTAPI1 wcsftime(wchar_t *, size_t, const char *, const struct tm *); +#define _WTIME_DEFINED #endif