Resend: implement _ismbcalpha, _ismbcalnum

Greg Turner gmturner007 at ameritech.net
Tue Nov 12 22:55:39 CST 2002


On Tuesday 12 November 2002 10:42 pm, Dmitry Timoshkov wrote:
> "Greg Turner" <gmturner007 at ameritech.net> wrote:
> > But... since I seem to be volunteering to implement the function, I
> > guess I should do it right...
>
> try something like this (completely not tested):
>
> int _ismbcalpha(unsigned int ch)
> {
>     char mbch[2];
>     WCHAR chW;
>     WORD ctype;
>
>     mbch[0] = ch & 0xff;
>     mbch[1] = (ch >> 8) & 0xff;
>     MultiByteToWideChar(CP_ACP, 0, mbch, 2, &chW, 1);
>     GetStringTypeW(CT_CTYPE1, &chW, 1, &ctype);
>     return (ctype & C1_ALPHA) != 0;
> }
>
> I'm not sure whether mbch[0] and mbch[1] should be actually swapped,
> in the case if multibyte character was passed in.

OK, I'll figure out the byte-ordering thing for 'ya.  Thanks again,

-- 
gmt

"War is an ugly thing, but not the ugliest of things;
the decayed and degraded state of moral and patriotic
feeling which thinks that nothing is worth war is much
worse. A man who has nothing for which he is willing
to fight; nothing he cares about more than his own
personal safety; is a miserable creature who has no
chance of being free, unless made and kept so by the
exertions of better persons than himself."

-- John Stuart Mill




More information about the wine-devel mailing list