msvcrt: implement _mbbtype according to MSDN

Dmitry Timoshkov dmitry at codeweavers.com
Mon Feb 5 22:29:37 CST 2007


"Juan Lang" <juan_lang at yahoo.com> wrote:

> /*********************************************************************
> + * _mbbtype(MSVCRT.@)
> + */
> +int CDECL _mbbtype(unsigned char c, int type)
> +{
> +    if (type == 1)
> +    {
> +        if ((c >= 0x20 && c <= 0x7e) || (c >= 0xa1 && c <= 0xdf))
> +            return _MBC_SINGLE;
> +        else if ((c >= 0x40 && c <= 0x7e) || (c >= 0x80 && c <= 0xfc))
> +            return _MBC_TRAIL;
> +        else
> +            return _MBC_ILLEGAL;
> +    }
> +    else
> +    {
> +        if ((c >= 0x20 && c <= 0x7e) || (c >= 0xa1 && c <= 0xdf))
> +            return _MBC_SINGLE;
> +        else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc))
> +            return _MBC_LEAD;
> +        else
> +            return _MBC_ILLEGAL;
> +    }

Since MSVCRT_mbctype array is not currently being initialized, probably using
MSVCRT_current_ctype would be good enough for now.

-- 
Dmitry.



More information about the wine-devel mailing list