e635b30956
* mingwex/gdtoa: New directory. * mingwex/gdtoa/(arithchk.c, dmisc.c, dtoa.c, g__fmt.c, g_dfmt.c, g_ffmt.c, g_xfmt.c, gd_arith.h, gd_qnan.h, gdtoa.c, gdtoa.h, gdtoaimp.h, gethex.c, gmisc.c, hd_init.c, hexnan.c, misc.c, qnan.c, README, smisc.c, strtodg.c, strtodnrp.c, strtof.c, strtopx.c, sum.c, ulp.c): New files. * mingwex/(strtof.c, strtold.c, ldtoa.c): Remove files. * mingwex/math/(cephes-emath.c, cephes-emath.h): Remove files. * mingwex/mb_wc_common.h (get_cp_from_locale); Rename to get_codepage(). * mingwex/(btowc.c, wctob.c, mbrtowc.c, wcrtomb.c): Adjust call to get_codepage(). * mingwex/wcstold.c: Avoid using strtold internals. * mingwex/wcstof.c: Rewrite. * mingwex/Makefile.in (GDTOA_DISTFILES): Add to distribution. (GDTOA_OBJS): Add to library. (DISTFILES): Remove strtof.c strtold.c ldtoa.c cephes-emath.c cephes-emath.h. (STDLIB_OBJS): Remove. (STDLIB_STUB_OBJS): Remove strtof.o wcstof,o. (Q8_OBJS): Add wcstof.o wcstold.o. * include/stdlib.h (strtof): Remove inline definition. (wcstof): Likewise. * include/wchar.h (wcstof): Remove inline definition.
22 lines
499 B
C
Executable File
22 lines
499 B
C
Executable File
#include "mb_wc_common.h"
|
|
#include <wchar.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#define WIN32_LEAN_AND_MEAN
|
|
#include <windows.h>
|
|
|
|
/* Return just the first byte after translating to multibyte. */
|
|
int wctob (wint_t wc )
|
|
{
|
|
wchar_t w = wc;
|
|
char c;
|
|
int invalid_char = 0;
|
|
if (!WideCharToMultiByte (get_codepage(),
|
|
0 /* Is this correct flag? */,
|
|
&w, 1, &c, 1, NULL, &invalid_char)
|
|
|| invalid_char)
|
|
return EOF;
|
|
return (int) c;
|
|
}
|