[RFC PATCH 6/9] msvcrt: Add _wctype table.

Chip Davis cdavis at codeweavers.com
Thu Jan 9 12:32:33 CST 2020


January 9, 2020 12:55 AM, "Jeff Smith" <whydoubt at gmail.com> wrote:

> diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
> index 600c4db008..efb879a89d 100644
> --- a/dlls/msvcrt/wcs.c
> +++ b/dlls/msvcrt/wcs.c
> @@ -40,6 +40,64 @@ static BOOL n_format_enabled = TRUE;
>  #include "printf.h"
>  #undef PRINTF_WIDE
> 
> +/* Some abbreviations to make the following table readable */
> +#define _C_ MSVCRT__CONTROL
> +#define _S_ MSVCRT__SPACE
> +#define _P_ MSVCRT__PUNCT
> +#define _D_ MSVCRT__DIGIT
> +#define _H_ MSVCRT__HEX
> +#define _U_ MSVCRT__UPPER|0x100
> +#define _L_ MSVCRT__LOWER|0x100
> +#define _B_ MSVCRT__BLANK
> +
> +#if _MSVCR_VER==120
> +#define _SUP_ _P_
> +#else
> +#define _SUP_ _P_|_D_
> +#endif
> +
> +#if _MSVCR_VER>=120
> +#define _B120_ 0
> +#else
> +#define _B120_ _B_
> +#endif
> +
> +#if _MSVCR_VER>=140
> +#define _S140_ _S_
> +#define _C140_ _C_
> +#define _L140_ _L_
> +#else
> +#define _S140_ 0
> +#define _C140_ 0
> +#define _L140_ 0
> +#endif
> +
> +WORD MSVCRT__wctype [257] = {
> +    0,
> +    _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _S_|_C_|_B120_, _S_|_C_, _S_|_C_,
> +      _S_|_C_, _S_|_C_, _C_, _C_,
> +    _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_,
> +    _S_|_B_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_,
> +    _D_|_H_, _D_|_H_, _D_|_H_, _D_|_H_, _D_|_H_, _D_|_H_, _D_|_H_, _D_|_H_,
> +    _D_|_H_, _D_|_H_, _P_, _P_, _P_, _P_, _P_, _P_,
> +    _P_, _U_|_H_, _U_|_H_, _U_|_H_, _U_|_H_, _U_|_H_, _U_|_H_, _U_, _U_, _U_,
> +      _U_, _U_, _U_, _U_, _U_, _U_,
> +    _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _P_, _P_, _P_, _P_, _P_,
> +    _P_, _L_|_H_, _L_|_H_, _L_|_H_, _L_|_H_, _L_|_H_, _L_|_H_, _L_, _L_, _L_,
> +      _L_, _L_, _L_, _L_, _L_, _L_,
> +    _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _P_, _P_, _P_, _P_, _C_,
> +    _C_, _C_, _C_, _C_, _C_, _C_|_S140_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_,
> +    _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_, _C_,
> +    _S_|_B120_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_, _P_|_L140_, _P_,
> +      _P_, _P_|_C140_, _P_, _P_,
> +    _P_, _P_, _SUP_, _SUP_, _P_, _P_|_L140_, _P_, _P_, _P_, _SUP_, _P_|_L140_, _P_,
> +      _P_, _P_, _P_, _P_,
> +    _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _U_,
> +    _U_, _U_, _U_, _U_, _U_, _U_, _U_, _P_, _U_, _U_, _U_, _U_, _U_, _U_, _U_, _L_,
> +    _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_,
> +    _L_, _L_, _L_, _L_, _L_, _L_, _L_, _P_, _L_, _L_, _L_, _L_, _L_, _L_, _L_, _L_
> +};

But wait, WEOF in msvcrt is not (wint_t)(-1) but (wint_t)0xffff. Passing WEOF to this array won't do what you think it does. Is this really what native has?

> +
>  #if _MSVCR_VER>=80
>  
>  /*********************************************************************

Chip



More information about the wine-devel mailing list