mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 21:40:12 +00:00
Update.
* Versions.def: Add GLIBC_2.2 for libc. * iconv/gconv.h: Make header suitable for inclusion in public header by protecting all names with __. * iconv/gconv.c: Adapt for symbol name changes. * iconv/gconv.h: Likewise. * iconv/gconv_builtin.c: Likewise. * iconv/gconv_close.c: Likewise. * iconv/gconv_db.c: Likewise. * iconv/gconv_dl.c: Likewise. * iconv/gconv_int.h: Likewise. * iconv/gconv_open.c: Likewise. * iconv/gconv_simple.c: Likewise. * iconv/iconv.c: Likewise. * iconv/iconv_close.c: Likewise. * iconv/iconv_open.c: Likewise. * iconv/loop.c: Likewise. * iconv/skeleton.c: Likewise. * iconvdata/8bit-gap.c: Likewise. * iconvdata/8bit-generic.c: Likewise. * iconvdata/ansi_x3.110.c: Likewise. * iconvdata/big5.c: Likewise. * iconvdata/cns11643.h: Likewise. * iconvdata/cns11643l1.h: Likewise. * iconvdata/euc-cn.c: Likewise. * iconvdata/euc-jp.c: Likewise. * iconvdata/euc-kr.c: Likewise. * iconvdata/euc-tw.c: Likewise. * iconvdata/gb2312.h: Likewise. * iconvdata/iso-2022-jp.c: Likewise. * iconvdata/iso-2022-kr.c: Likewise. * iconvdata/iso646.c: Likewise. * iconvdata/iso8859-1.c: Likewise. * iconvdata/iso_6937-2.c: Likewise. * iconvdata/iso_6937.c: Likewise. * iconvdata/jis0201.h: Likewise. * iconvdata/jis0208.h: Likewise. * iconvdata/jis0212.h: Likewise. * iconvdata/johab.c: Likewise. * iconvdata/ksc5601.h: Likewise. * iconvdata/sjis.c: Likewise. * iconvdata/t.61.c: Likewise. * iconvdata/uhc.c: Likewise. * stdlib/mblen.c: Likewise. * stdlib/mbtowc.c: Likewise. * stdlib/wctomb.c: Likewise. * wcsmbs/btowc.c: Likewise. * wcsmbs/mbrtowc.c: Likewise. * wcsmbs/mbsnrtowcs.c: Likewise. * wcsmbs/mbsrtowcs.c: Likewise. * wcsmbs/wchar.h: Likewise. * wcsmbs/wcrtomb.c: Likewise. * wcsmbs/wcsmbsload.c: Likewise. * wcsmbs/wcsmbsload.h: Likewise. * wcsmbs/wcsnrtombs.c: Likewise. * wcsmbs/wcsrtombs.c: Likewise. * wcsmbs/wctob.c: Likewise. * include/limits.h (MB_LEN_MAX): Increase to 16. * sysdeps/generic/_G_config.h: Define _G_fpos_t as struct. Define _G_iconv_t. * sysdeps/unix/sysv/linux/_G_config.h: Likewise. * include/wchar.h: Change mbstate_t to __mbstate_t. * libio/Makefile (routines): Add wfiledoalloc, oldiofgetpos, oldiofgetpos64, oldiofsetpos, oldiofsetpos64, fputwc, fputwc_u, getwc, getwc_u, getwchar, getwchar_u, iofgetws, iofgetws_u, iofputws, iofputws_u, iogetwline, iowpadn, ioungetwc, putwc, putwc_u, putchar, putchar_u, swprintf, vwprintf, wprintf, wscanf, fwscanf, vwscanf, vswprintf, iovswscanf, swscanf, wgenops, wstrops, wfileops, and iofwide. (tests): Add tst_swprintf, tst_wprintf, tst_swscanf, and tst_wscanf. * libio/Versions: Add _IO_fgetpos, _IO_fgetpos64, _IO_fsetpos, _IO_fsetpos64, fgetpos, fgetpos64, fgetwc, fgetwc_unlocked, fgetws, fgetws_unlocked, fputwc, fputwc_unlocked, fputws, fputws_unlocked, fsetpos, fsetpos64, fwide, fwprintf, fwscanf, getwc, getwc_unlocked, getwchar, getwchar_unlocked, putwc, putwc_unlocked, putwchar, putwchar_unlocked, swprintf, swscanf, ungetwc, vfwprintf, vswprintf, vwprintf, vfwscanf, vswscanf, vwscanf, wprintf, and wscanf to GLIBC_2.2 for libc. * libio/libio.h: Define codecvt struct. Define _IO_wide_data. Extend _IO_file contain pointer to codecvt, widedata and mode. (_IO_getwc_unlocked): New macro. (_IO_putwc_unlocked): New macro. (_IO_fwide): New macro. * libio/libioP.h: Add new prototypes and adjust existing declarations. * libio/fileops.c (_IO_new_file_close_it): Reset normal or widedata buffers based on mode. (new_do_write): Set _IO_write_end to _IO_buf_end if stream is wide oriented. (_IO_new_file_overflow): Don't depend only on _IO_CURRENTLY_PUTTING flag to be enough to signal unallocated buffer. For wide oriented stream don't make it linebuffered. Don't use _IO_do_flush, use _IO_new_do_write directly. (_IO_new_file_seekoff): Change return value type to _IO_off64_t. (_IO_file_seek): Likewise. * libio/genops.c (_IO_least_marker): Make global. (__underflow): Orient stream if not already done. (__uflow): Likewise. (_IO_default_seekpos): Change to type _IO_off64_t. (_IO_default_seekoff): Likewise. (_IO_default_seek): Likewise. (_IO_no_init): New function. Similar to _IO_init but allows to orient in initialization. * libio/iolibio.h: Add prototype for _IO_vswprintf. Change _IO_pos_BAD to use _IO_off64_t. * libio/ftello.c: Use _IO_off_t. For now abort when use with wide char stream. * libio/ftello64.c: Likewise. * libio/ioftell.c: Likewise. * libio/iofopncook.c: Likewise. * libio/ioseekoff.c: Likewise. * libio/ioseekpos.c: Likewise. * libio/oldfileops.c: Likewise. * libio/iofgetpos.c: Store state of conversion if necessary. * libio/iofgetpos64.c: Likewise. * libio/iofsetpos.c: Restore conversion state if necessary. * libio/iofsetpos64.c: Likewise. * libio/iofdopen.c: Initialize so that stream can be wide oriented. * libio/iofopen.c: Likewise. * libio/iofopen64.c: Likewise. * libio/iopopen.c: Likewise. * libio/iovdprintf.c: Likewise. * libio/iovsprintf.c: Likewise. * libio/iovsscanf.c: Likewise. * libio/memstream.c: Likewise. * libio/obprintf.c: Likewise. * libio/iofputs.c: Orient stream if not already happened. * libio/iofputs_u.c: Likewise. * libio/iofwrite.c: Likewise. * libio/iofwrite_u.c: Likewise. * libio/ioputs.c: Likewise. * libio/iosetbuffer.c: Handle not yet oriented stream. * libio/iosetvbuf.c: Likewise. * libio/oldstdfiles.c: Adjust FILEBUF_LITERAL call. * libio/stdfiles.c: Likewise. * libio/strops.c (_IO_str_overflow): Correctly free buffer after failed allocation. (_IO_str_seekoff): Use _IO_off64_t. * libio/vasprintf.c: Pre-orient stream. * libio/vsnprintf.c: Likewise. * libio/fputwc.c: New file. * libio/fputwc_u.c: New file. * libio/fwprintf.c: New file. * libio/fwscanf.c: New file. * libio/getwc.c: New file. * libio/getwc_u.c: New file. * libio/getwchar.c: New file. * libio/getwchar_u.c: New file. * libio/iofgetws.c: New file. * libio/iofgetws_u.c: New file. * libio/iofputws.c: New file. * libio/iofputws_u.c: New file. * libio/iofwide.c: New file. * libio/iogetwline.c: New file. * libio/ioungetwc.c: New file. * libio/iovswscanf.c: New file. * libio/iowpadn.c: New file. * libio/oldiofgetpos.c: New file. * libio/oldiofgetpos64.c: New file. * libio/oldiofsetpos.c: New file. * libio/oldiofsetpos64.c: New file. * libio/putwc.c: New file. * libio/putwc_u.c: New file. * libio/putwchar.c: New file. * libio/putwchar_u.c: New file. * libio/swprintf.c: New file. * libio/swscanf.c: New file. * libio/tst_swprintf.c: New file. * libio/tst_swscanf.c: New file. * libio/tst_wprintf.c: New file. * libio/tst_wscanf.c: New file. * libio/tst_wscanf.input: New file. * libio/vswprintf.c: New file. * libio/vwprintf.c: New file. * libio/vwscanf.c: New file. * libio/wfiledoalloc.c: New file. * libio/wfileops.c: New file. * libio/wgenops.c: New file. * libio/wprintf.c: New file. * libio/wscanf.c: New file. * libio/wstrops.c: New file. * stdio-common/Makefile (routines): Add _itowa, itowa-digits, vfwprintf, and vfwscanf. * stdio-common/_itoa.c (base_table): Rename to _IO_base_table and make global. * stdio-common/_itowa.c: New file. * stdio-common/_itowa.h: New file. * stdio-common/itoa-digits.c: Minimal optimization. * stdio-common/itowa-digits.c: New file. * stdio-common/printf-parse.h: Allow use in wide character context. * stdio-common/printf-prs.c: Define ISASCII and MBRLEN. * stdio-common/printf.h (printf_info): Add wide bit. * stdio-common/printf_fp.c: Determine from wide bit whether stream is wide oriented or not. * stdio-common/printf_size.c: Likewise. * sysdeps/generic/printf_fphex.c: Likewise. * stdlib/strfmon.c: Call __printf_fp with wide bit cleared. * stdio-common/vfprintf.c: Rewrite to allow use in wide character context. * stdio-common/vfscand.c: Likewise. * stdio-common/vfwprintf.c: New file. * stdio-common/vfwscanf.c: New file. * time/Makefile (routines): Add wcsftime. (tests): Add tst_wcsftime. * time/Versions: Add wcsftime to GLIBC_2.2 for libc. * time/strftime.c: Make usable as wcsftime. * time/wcsftime.c: New file. * time/tst_wcsftime.c: New file. * wcsmbs/Makefile (routines): Add wmempcpy and wcschrnul. * wcsmbs/Versions: Add wmempcpy and wcschrnul to GLIBC_2.2 for libc. * wcsmbs/wcschrnul.c: New file. * wcsmbs/wmemcpy.c: New file. * wcsmbs/wmemcpy.c: Rename to __wmemcpy and make wmemcpy weak alias. * wcsmbs/wmemmove.c: Likewise for wmemmove. * manual/stdio.texi: Document is_char and wide element if printf_info. * manual/time.texi: Document wcsftime. * include/wchar.h: Add prototypes for __wmemcpy, __wmempcpy, __wmemmove, __wcschrnul, and __vfwscanf. * locale/langinfo.h: Add new LC_TIME entries for wchar_t data. * locale/C-time.c: Adapt for above change. * locale/categories.def: Likewise. * locale/localeinfo.h: Likewise. * localedata/Makefile: Don't run tests for now.
This commit is contained in:
parent
bc938d3de9
commit
d64b6ad075
232
ChangeLog
232
ChangeLog
@ -1,5 +1,237 @@
|
||||
1999-06-16 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* Versions.def: Add GLIBC_2.2 for libc.
|
||||
|
||||
* iconv/gconv.h: Make header suitable for inclusion in public header
|
||||
by protecting all names with __.
|
||||
* iconv/gconv.c: Adapt for symbol name changes.
|
||||
* iconv/gconv.h: Likewise.
|
||||
* iconv/gconv_builtin.c: Likewise.
|
||||
* iconv/gconv_close.c: Likewise.
|
||||
* iconv/gconv_db.c: Likewise.
|
||||
* iconv/gconv_dl.c: Likewise.
|
||||
* iconv/gconv_int.h: Likewise.
|
||||
* iconv/gconv_open.c: Likewise.
|
||||
* iconv/gconv_simple.c: Likewise.
|
||||
* iconv/iconv.c: Likewise.
|
||||
* iconv/iconv_close.c: Likewise.
|
||||
* iconv/iconv_open.c: Likewise.
|
||||
* iconv/loop.c: Likewise.
|
||||
* iconv/skeleton.c: Likewise.
|
||||
* iconvdata/8bit-gap.c: Likewise.
|
||||
* iconvdata/8bit-generic.c: Likewise.
|
||||
* iconvdata/ansi_x3.110.c: Likewise.
|
||||
* iconvdata/big5.c: Likewise.
|
||||
* iconvdata/cns11643.h: Likewise.
|
||||
* iconvdata/cns11643l1.h: Likewise.
|
||||
* iconvdata/euc-cn.c: Likewise.
|
||||
* iconvdata/euc-jp.c: Likewise.
|
||||
* iconvdata/euc-kr.c: Likewise.
|
||||
* iconvdata/euc-tw.c: Likewise.
|
||||
* iconvdata/gb2312.h: Likewise.
|
||||
* iconvdata/iso-2022-jp.c: Likewise.
|
||||
* iconvdata/iso-2022-kr.c: Likewise.
|
||||
* iconvdata/iso646.c: Likewise.
|
||||
* iconvdata/iso8859-1.c: Likewise.
|
||||
* iconvdata/iso_6937-2.c: Likewise.
|
||||
* iconvdata/iso_6937.c: Likewise.
|
||||
* iconvdata/jis0201.h: Likewise.
|
||||
* iconvdata/jis0208.h: Likewise.
|
||||
* iconvdata/jis0212.h: Likewise.
|
||||
* iconvdata/johab.c: Likewise.
|
||||
* iconvdata/ksc5601.h: Likewise.
|
||||
* iconvdata/sjis.c: Likewise.
|
||||
* iconvdata/t.61.c: Likewise.
|
||||
* iconvdata/uhc.c: Likewise.
|
||||
* stdlib/mblen.c: Likewise.
|
||||
* stdlib/mbtowc.c: Likewise.
|
||||
* stdlib/wctomb.c: Likewise.
|
||||
* wcsmbs/btowc.c: Likewise.
|
||||
* wcsmbs/mbrtowc.c: Likewise.
|
||||
* wcsmbs/mbsnrtowcs.c: Likewise.
|
||||
* wcsmbs/mbsrtowcs.c: Likewise.
|
||||
* wcsmbs/wchar.h: Likewise.
|
||||
* wcsmbs/wcrtomb.c: Likewise.
|
||||
* wcsmbs/wcsmbsload.c: Likewise.
|
||||
* wcsmbs/wcsmbsload.h: Likewise.
|
||||
* wcsmbs/wcsnrtombs.c: Likewise.
|
||||
* wcsmbs/wcsrtombs.c: Likewise.
|
||||
* wcsmbs/wctob.c: Likewise.
|
||||
|
||||
* include/limits.h (MB_LEN_MAX): Increase to 16.
|
||||
|
||||
* sysdeps/generic/_G_config.h: Define _G_fpos_t as struct. Define
|
||||
_G_iconv_t.
|
||||
* sysdeps/unix/sysv/linux/_G_config.h: Likewise.
|
||||
* include/wchar.h: Change mbstate_t to __mbstate_t.
|
||||
|
||||
* libio/Makefile (routines): Add wfiledoalloc, oldiofgetpos,
|
||||
oldiofgetpos64, oldiofsetpos, oldiofsetpos64, fputwc, fputwc_u,
|
||||
getwc, getwc_u, getwchar, getwchar_u, iofgetws, iofgetws_u,
|
||||
iofputws, iofputws_u, iogetwline, iowpadn, ioungetwc, putwc, putwc_u,
|
||||
putchar, putchar_u, swprintf, vwprintf, wprintf, wscanf, fwscanf,
|
||||
vwscanf, vswprintf, iovswscanf, swscanf, wgenops, wstrops, wfileops,
|
||||
and iofwide.
|
||||
(tests): Add tst_swprintf, tst_wprintf, tst_swscanf, and tst_wscanf.
|
||||
* libio/Versions: Add _IO_fgetpos, _IO_fgetpos64, _IO_fsetpos,
|
||||
_IO_fsetpos64, fgetpos, fgetpos64, fgetwc, fgetwc_unlocked, fgetws,
|
||||
fgetws_unlocked, fputwc, fputwc_unlocked, fputws, fputws_unlocked,
|
||||
fsetpos, fsetpos64, fwide, fwprintf, fwscanf, getwc, getwc_unlocked,
|
||||
getwchar, getwchar_unlocked, putwc, putwc_unlocked, putwchar,
|
||||
putwchar_unlocked, swprintf, swscanf, ungetwc, vfwprintf, vswprintf,
|
||||
vwprintf, vfwscanf, vswscanf, vwscanf, wprintf, and wscanf to
|
||||
GLIBC_2.2 for libc.
|
||||
* libio/libio.h: Define codecvt struct. Define _IO_wide_data.
|
||||
Extend _IO_file contain pointer to codecvt, widedata and mode.
|
||||
(_IO_getwc_unlocked): New macro.
|
||||
(_IO_putwc_unlocked): New macro.
|
||||
(_IO_fwide): New macro.
|
||||
* libio/libioP.h: Add new prototypes and adjust existing declarations.
|
||||
* libio/fileops.c (_IO_new_file_close_it): Reset normal or widedata
|
||||
buffers based on mode.
|
||||
(new_do_write): Set _IO_write_end to _IO_buf_end if stream is wide
|
||||
oriented.
|
||||
(_IO_new_file_overflow): Don't depend only on _IO_CURRENTLY_PUTTING
|
||||
flag to be enough to signal unallocated buffer. For wide oriented
|
||||
stream don't make it linebuffered. Don't use _IO_do_flush, use
|
||||
_IO_new_do_write directly.
|
||||
(_IO_new_file_seekoff): Change return value type to _IO_off64_t.
|
||||
(_IO_file_seek): Likewise.
|
||||
* libio/genops.c (_IO_least_marker): Make global.
|
||||
(__underflow): Orient stream if not already done.
|
||||
(__uflow): Likewise.
|
||||
(_IO_default_seekpos): Change to type _IO_off64_t.
|
||||
(_IO_default_seekoff): Likewise.
|
||||
(_IO_default_seek): Likewise.
|
||||
(_IO_no_init): New function. Similar to _IO_init but allows to orient
|
||||
in initialization.
|
||||
* libio/iolibio.h: Add prototype for _IO_vswprintf. Change _IO_pos_BAD
|
||||
to use _IO_off64_t.
|
||||
* libio/ftello.c: Use _IO_off_t. For now abort when use with wide
|
||||
char stream.
|
||||
* libio/ftello64.c: Likewise.
|
||||
* libio/ioftell.c: Likewise.
|
||||
* libio/iofopncook.c: Likewise.
|
||||
* libio/ioseekoff.c: Likewise.
|
||||
* libio/ioseekpos.c: Likewise.
|
||||
* libio/oldfileops.c: Likewise.
|
||||
* libio/iofgetpos.c: Store state of conversion if necessary.
|
||||
* libio/iofgetpos64.c: Likewise.
|
||||
* libio/iofsetpos.c: Restore conversion state if necessary.
|
||||
* libio/iofsetpos64.c: Likewise.
|
||||
* libio/iofdopen.c: Initialize so that stream can be wide oriented.
|
||||
* libio/iofopen.c: Likewise.
|
||||
* libio/iofopen64.c: Likewise.
|
||||
* libio/iopopen.c: Likewise.
|
||||
* libio/iovdprintf.c: Likewise.
|
||||
* libio/iovsprintf.c: Likewise.
|
||||
* libio/iovsscanf.c: Likewise.
|
||||
* libio/memstream.c: Likewise.
|
||||
* libio/obprintf.c: Likewise.
|
||||
* libio/iofputs.c: Orient stream if not already happened.
|
||||
* libio/iofputs_u.c: Likewise.
|
||||
* libio/iofwrite.c: Likewise.
|
||||
* libio/iofwrite_u.c: Likewise.
|
||||
* libio/ioputs.c: Likewise.
|
||||
* libio/iosetbuffer.c: Handle not yet oriented stream.
|
||||
* libio/iosetvbuf.c: Likewise.
|
||||
* libio/oldstdfiles.c: Adjust FILEBUF_LITERAL call.
|
||||
* libio/stdfiles.c: Likewise.
|
||||
* libio/strops.c (_IO_str_overflow): Correctly free buffer after
|
||||
failed allocation.
|
||||
(_IO_str_seekoff): Use _IO_off64_t.
|
||||
* libio/vasprintf.c: Pre-orient stream.
|
||||
* libio/vsnprintf.c: Likewise.
|
||||
* libio/fputwc.c: New file.
|
||||
* libio/fputwc_u.c: New file.
|
||||
* libio/fwprintf.c: New file.
|
||||
* libio/fwscanf.c: New file.
|
||||
* libio/getwc.c: New file.
|
||||
* libio/getwc_u.c: New file.
|
||||
* libio/getwchar.c: New file.
|
||||
* libio/getwchar_u.c: New file.
|
||||
* libio/iofgetws.c: New file.
|
||||
* libio/iofgetws_u.c: New file.
|
||||
* libio/iofputws.c: New file.
|
||||
* libio/iofputws_u.c: New file.
|
||||
* libio/iofwide.c: New file.
|
||||
* libio/iogetwline.c: New file.
|
||||
* libio/ioungetwc.c: New file.
|
||||
* libio/iovswscanf.c: New file.
|
||||
* libio/iowpadn.c: New file.
|
||||
* libio/oldiofgetpos.c: New file.
|
||||
* libio/oldiofgetpos64.c: New file.
|
||||
* libio/oldiofsetpos.c: New file.
|
||||
* libio/oldiofsetpos64.c: New file.
|
||||
* libio/putwc.c: New file.
|
||||
* libio/putwc_u.c: New file.
|
||||
* libio/putwchar.c: New file.
|
||||
* libio/putwchar_u.c: New file.
|
||||
* libio/swprintf.c: New file.
|
||||
* libio/swscanf.c: New file.
|
||||
* libio/tst_swprintf.c: New file.
|
||||
* libio/tst_swscanf.c: New file.
|
||||
* libio/tst_wprintf.c: New file.
|
||||
* libio/tst_wscanf.c: New file.
|
||||
* libio/tst_wscanf.input: New file.
|
||||
* libio/vswprintf.c: New file.
|
||||
* libio/vwprintf.c: New file.
|
||||
* libio/vwscanf.c: New file.
|
||||
* libio/wfiledoalloc.c: New file.
|
||||
* libio/wfileops.c: New file.
|
||||
* libio/wgenops.c: New file.
|
||||
* libio/wprintf.c: New file.
|
||||
* libio/wscanf.c: New file.
|
||||
* libio/wstrops.c: New file.
|
||||
* stdio-common/Makefile (routines): Add _itowa, itowa-digits,
|
||||
vfwprintf, and vfwscanf.
|
||||
* stdio-common/_itoa.c (base_table): Rename to _IO_base_table and
|
||||
make global.
|
||||
* stdio-common/_itowa.c: New file.
|
||||
* stdio-common/_itowa.h: New file.
|
||||
* stdio-common/itoa-digits.c: Minimal optimization.
|
||||
* stdio-common/itowa-digits.c: New file.
|
||||
* stdio-common/printf-parse.h: Allow use in wide character context.
|
||||
* stdio-common/printf-prs.c: Define ISASCII and MBRLEN.
|
||||
* stdio-common/printf.h (printf_info): Add wide bit.
|
||||
* stdio-common/printf_fp.c: Determine from wide bit whether stream
|
||||
is wide oriented or not.
|
||||
* stdio-common/printf_size.c: Likewise.
|
||||
* sysdeps/generic/printf_fphex.c: Likewise.
|
||||
* stdlib/strfmon.c: Call __printf_fp with wide bit cleared.
|
||||
* stdio-common/vfprintf.c: Rewrite to allow use in wide character
|
||||
context.
|
||||
* stdio-common/vfscand.c: Likewise.
|
||||
* stdio-common/vfwprintf.c: New file.
|
||||
* stdio-common/vfwscanf.c: New file.
|
||||
|
||||
* time/Makefile (routines): Add wcsftime.
|
||||
(tests): Add tst_wcsftime.
|
||||
* time/Versions: Add wcsftime to GLIBC_2.2 for libc.
|
||||
* time/strftime.c: Make usable as wcsftime.
|
||||
* time/wcsftime.c: New file.
|
||||
* time/tst_wcsftime.c: New file.
|
||||
|
||||
* wcsmbs/Makefile (routines): Add wmempcpy and wcschrnul.
|
||||
* wcsmbs/Versions: Add wmempcpy and wcschrnul to GLIBC_2.2 for libc.
|
||||
* wcsmbs/wcschrnul.c: New file.
|
||||
* wcsmbs/wmemcpy.c: New file.
|
||||
* wcsmbs/wmemcpy.c: Rename to __wmemcpy and make wmemcpy weak alias.
|
||||
* wcsmbs/wmemmove.c: Likewise for wmemmove.
|
||||
|
||||
* manual/stdio.texi: Document is_char and wide element if printf_info.
|
||||
|
||||
* manual/time.texi: Document wcsftime.
|
||||
|
||||
* include/wchar.h: Add prototypes for __wmemcpy, __wmempcpy,
|
||||
__wmemmove, __wcschrnul, and __vfwscanf.
|
||||
|
||||
* locale/langinfo.h: Add new LC_TIME entries for wchar_t data.
|
||||
* locale/C-time.c: Adapt for above change.
|
||||
* locale/categories.def: Likewise.
|
||||
* locale/localeinfo.h: Likewise.
|
||||
* localedata/Makefile: Don't run tests for now.
|
||||
|
||||
* manual/errno.texi: Fix typos.
|
||||
* manual/memory.texi: Likewise.
|
||||
* manual/ctype.texi: Likewise.
|
||||
|
@ -5,6 +5,7 @@ libc {
|
||||
GLIBC_2.0
|
||||
GLIBC_2.1 GLIBC_2.0
|
||||
GLIBC_2.1.1 GLIBC_2.1
|
||||
GLIBC_2.2 GLIBC_2.1.1
|
||||
}
|
||||
libcrypt {
|
||||
GLIBC_2.0
|
||||
|
@ -27,43 +27,45 @@
|
||||
|
||||
int
|
||||
internal_function
|
||||
__gconv (gconv_t cd, const unsigned char **inbuf, const unsigned char *inbufend,
|
||||
unsigned char **outbuf, unsigned char *outbufend, size_t *converted)
|
||||
__gconv (__gconv_t cd, const unsigned char **inbuf,
|
||||
const unsigned char *inbufend, unsigned char **outbuf,
|
||||
unsigned char *outbufend, size_t *converted)
|
||||
{
|
||||
size_t last_step = cd->nsteps - 1;
|
||||
size_t last_step = cd->__nsteps - 1;
|
||||
int result;
|
||||
|
||||
if (cd == (gconv_t) -1L)
|
||||
return GCONV_ILLEGAL_DESCRIPTOR;
|
||||
if (cd == (__gconv_t) -1L)
|
||||
return __GCONV_ILLEGAL_DESCRIPTOR;
|
||||
|
||||
assert (converted != NULL);
|
||||
*converted = 0;
|
||||
|
||||
if (inbuf == NULL || *inbuf == NULL)
|
||||
/* We just flush. */
|
||||
result = _CALL_DL_FCT (cd->steps->fct,
|
||||
(cd->steps, cd->data, NULL, NULL, converted, 1));
|
||||
result = _CALL_DL_FCT (cd->__steps->__fct,
|
||||
(cd->__steps, cd->__data, NULL, NULL,
|
||||
converted, 1));
|
||||
else
|
||||
{
|
||||
const unsigned char *last_start;
|
||||
|
||||
assert (outbuf != NULL && *outbuf != NULL);
|
||||
cd->data[last_step].outbuf = *outbuf;
|
||||
cd->data[last_step].outbufend = outbufend;
|
||||
cd->__data[last_step].__outbuf = *outbuf;
|
||||
cd->__data[last_step].__outbufend = outbufend;
|
||||
|
||||
do
|
||||
{
|
||||
last_start = *inbuf;
|
||||
result = _CALL_DL_FCT (cd->steps->fct,
|
||||
(cd->steps, cd->data, inbuf, inbufend,
|
||||
result = _CALL_DL_FCT (cd->__steps->__fct,
|
||||
(cd->__steps, cd->__data, inbuf, inbufend,
|
||||
converted, 0));
|
||||
}
|
||||
while (result == GCONV_EMPTY_INPUT && last_start != *inbuf
|
||||
&& *inbuf + cd->steps->min_needed_from <= inbufend);
|
||||
while (result == __GCONV_EMPTY_INPUT && last_start != *inbuf
|
||||
&& *inbuf + cd->__steps->__min_needed_from <= inbufend);
|
||||
}
|
||||
|
||||
if (outbuf != NULL && *outbuf != NULL)
|
||||
*outbuf = cd->data[last_step].outbuf;
|
||||
*outbuf = cd->__data[last_step].__outbuf;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -24,106 +24,108 @@
|
||||
#define _GCONV_H 1
|
||||
|
||||
#include <features.h>
|
||||
#define __need_mbstate_t
|
||||
#include <wchar.h>
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
/* ISO 10646 value used to signal invalid value. */
|
||||
#define UNKNOWN_10646_CHAR ((wchar_t) 0xfffd)
|
||||
#define __UNKNOWN_10646_CHAR ((wchar_t) 0xfffd)
|
||||
|
||||
/* Error codes for gconv functions. */
|
||||
enum
|
||||
{
|
||||
GCONV_OK = 0,
|
||||
GCONV_NOCONV,
|
||||
GCONV_NODB,
|
||||
GCONV_NOMEM,
|
||||
__GCONV_OK = 0,
|
||||
__GCONV_NOCONV,
|
||||
__GCONV_NODB,
|
||||
__GCONV_NOMEM,
|
||||
|
||||
GCONV_EMPTY_INPUT,
|
||||
GCONV_FULL_OUTPUT,
|
||||
GCONV_ILLEGAL_INPUT,
|
||||
GCONV_INCOMPLETE_INPUT,
|
||||
__GCONV_EMPTY_INPUT,
|
||||
__GCONV_FULL_OUTPUT,
|
||||
__GCONV_ILLEGAL_INPUT,
|
||||
__GCONV_INCOMPLETE_INPUT,
|
||||
|
||||
GCONV_ILLEGAL_DESCRIPTOR,
|
||||
GCONV_INTERNAL_ERROR
|
||||
__GCONV_ILLEGAL_DESCRIPTOR,
|
||||
__GCONV_INTERNAL_ERROR
|
||||
};
|
||||
|
||||
|
||||
/* Forward declarations. */
|
||||
struct gconv_step;
|
||||
struct gconv_step_data;
|
||||
struct gconv_loaded_object;
|
||||
struct __gconv_step;
|
||||
struct __gconv_step_data;
|
||||
struct __gconv_loaded_object;
|
||||
|
||||
|
||||
/* Type of a conversion function. */
|
||||
typedef int (*gconv_fct) __PMT ((struct gconv_step *,
|
||||
struct gconv_step_data *,
|
||||
typedef int (*__gconv_fct) __PMT ((struct __gconv_step *,
|
||||
struct __gconv_step_data *,
|
||||
__const unsigned char **,
|
||||
__const unsigned char *, size_t *, int));
|
||||
|
||||
/* Constructor and destructor for local data for conversion step. */
|
||||
typedef int (*gconv_init_fct) __PMT ((struct gconv_step *));
|
||||
typedef void (*gconv_end_fct) __PMT ((struct gconv_step *));
|
||||
typedef int (*__gconv_init_fct) __PMT ((struct __gconv_step *));
|
||||
typedef void (*__gconv_end_fct) __PMT ((struct __gconv_step *));
|
||||
|
||||
|
||||
/* Description of a conversion step. */
|
||||
struct gconv_step
|
||||
struct __gconv_step
|
||||
{
|
||||
struct gconv_loaded_object *shlib_handle;
|
||||
__const char *modname;
|
||||
struct __gconv_loaded_object *__shlib_handle;
|
||||
__const char *__modname;
|
||||
|
||||
int counter;
|
||||
int __counter;
|
||||
|
||||
__const char *from_name;
|
||||
__const char *to_name;
|
||||
__const char *__from_name;
|
||||
__const char *__to_name;
|
||||
|
||||
gconv_fct fct;
|
||||
gconv_init_fct init_fct;
|
||||
gconv_end_fct end_fct;
|
||||
__gconv_fct __fct;
|
||||
__gconv_init_fct __init_fct;
|
||||
__gconv_end_fct __end_fct;
|
||||
|
||||
/* Information about the number of bytes needed or produced in this
|
||||
step. This helps optimizing the buffer sizes. */
|
||||
int min_needed_from;
|
||||
int max_needed_from;
|
||||
int min_needed_to;
|
||||
int max_needed_to;
|
||||
int __min_needed_from;
|
||||
int __max_needed_from;
|
||||
int __min_needed_to;
|
||||
int __max_needed_to;
|
||||
|
||||
/* Flag whether this is a stateful encoding or not. */
|
||||
int stateful;
|
||||
int __stateful;
|
||||
|
||||
void *data; /* Pointer to step-local data. */
|
||||
void *__data; /* Pointer to step-local data. */
|
||||
};
|
||||
|
||||
/* Additional data for steps in use of conversion descriptor. This is
|
||||
allocated by the `init' function. */
|
||||
struct gconv_step_data
|
||||
struct __gconv_step_data
|
||||
{
|
||||
unsigned char *outbuf; /* Output buffer for this step. */
|
||||
unsigned char *outbufend; /* Address of first byte after the output buffer.*/
|
||||
unsigned char *__outbuf; /* Output buffer for this step. */
|
||||
unsigned char *__outbufend; /* Address of first byte after the output
|
||||
buffer.*/
|
||||
|
||||
/* Is this the last module in the chain. */
|
||||
int is_last;
|
||||
int __is_last;
|
||||
|
||||
/* Counter for number of invocations of the module function for this
|
||||
descriptor. */
|
||||
int invocation_counter;
|
||||
int __invocation_counter;
|
||||
|
||||
/* Flag whether this is an internal use of the module (in the mb*towc*
|
||||
and wc*tomb* functions) or regular with iconv(3). */
|
||||
int internal_use;
|
||||
int __internal_use;
|
||||
|
||||
mbstate_t *statep;
|
||||
mbstate_t __state; /* This element should not be used directly by
|
||||
__mbstate_t *__statep;
|
||||
__mbstate_t __state; /* This element should not be used directly by
|
||||
any module; always use STATEP! */
|
||||
};
|
||||
|
||||
|
||||
/* Combine conversion step description with data. */
|
||||
typedef struct gconv_info
|
||||
typedef struct __gconv_info
|
||||
{
|
||||
size_t nsteps;
|
||||
struct gconv_step *steps;
|
||||
struct gconv_step_data data[0];
|
||||
} *gconv_t;
|
||||
size_t __nsteps;
|
||||
struct __gconv_step *__steps;
|
||||
struct __gconv_step_data __data[0];
|
||||
} *__gconv_t;
|
||||
|
||||
#endif /* gconv.h */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Table for builtin transformation mapping.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -29,9 +29,9 @@
|
||||
static struct builtin_map
|
||||
{
|
||||
const char *name;
|
||||
gconv_fct fct;
|
||||
gconv_init_fct init;
|
||||
gconv_end_fct end;
|
||||
__gconv_fct fct;
|
||||
__gconv_init_fct init;
|
||||
__gconv_end_fct end;
|
||||
|
||||
int min_needed_from;
|
||||
int max_needed_from;
|
||||
@ -43,15 +43,15 @@ static struct builtin_map
|
||||
#define BUILTIN_TRANSFORMATION(From, ConstPfx, ConstLen, To, Cost, Name, \
|
||||
Fct, Init, End, MinF, MaxF, MinT, MaxT) \
|
||||
{ \
|
||||
name: Name, \
|
||||
fct: Fct, \
|
||||
init: Init, \
|
||||
end: End, \
|
||||
.name = Name, \
|
||||
.fct = Fct, \
|
||||
.init = Init, \
|
||||
.end = End, \
|
||||
\
|
||||
min_needed_from: MinF, \
|
||||
max_needed_from: MaxF, \
|
||||
min_needed_to: MinT, \
|
||||
max_needed_to: MaxT \
|
||||
.min_needed_from = MinF, \
|
||||
.max_needed_from = MaxF, \
|
||||
.min_needed_to = MinT, \
|
||||
.max_needed_to = MaxT \
|
||||
},
|
||||
#define BUILTIN_ALIAS(From, To)
|
||||
|
||||
@ -61,7 +61,7 @@ static struct builtin_map
|
||||
|
||||
void
|
||||
internal_function
|
||||
__gconv_get_builtin_trans (const char *name, struct gconv_step *step)
|
||||
__gconv_get_builtin_trans (const char *name, struct __gconv_step *step)
|
||||
{
|
||||
size_t cnt;
|
||||
|
||||
@ -71,17 +71,17 @@ __gconv_get_builtin_trans (const char *name, struct gconv_step *step)
|
||||
|
||||
assert (cnt < sizeof (map) / sizeof (map[0]));
|
||||
|
||||
step->fct = map[cnt].fct;
|
||||
step->init_fct = map[cnt].init;
|
||||
step->end_fct = map[cnt].end;
|
||||
step->counter = INT_MAX;
|
||||
step->shlib_handle = NULL;
|
||||
step->__fct = map[cnt].fct;
|
||||
step->__init_fct = map[cnt].init;
|
||||
step->__end_fct = map[cnt].end;
|
||||
step->__counter = INT_MAX;
|
||||
step->__shlib_handle = NULL;
|
||||
|
||||
step->min_needed_from = map[cnt].min_needed_from;
|
||||
step->max_needed_from = map[cnt].max_needed_from;
|
||||
step->min_needed_to = map[cnt].min_needed_to;
|
||||
step->max_needed_to = map[cnt].max_needed_to;
|
||||
step->__min_needed_from = map[cnt].min_needed_from;
|
||||
step->__max_needed_from = map[cnt].max_needed_from;
|
||||
step->__min_needed_to = map[cnt].min_needed_to;
|
||||
step->__max_needed_to = map[cnt].max_needed_to;
|
||||
|
||||
/* None of the builtin converters handles stateful encoding. */
|
||||
step->stateful = 0;
|
||||
step->__stateful = 0;
|
||||
}
|
||||
|
@ -25,23 +25,23 @@
|
||||
|
||||
int
|
||||
internal_function
|
||||
__gconv_close (gconv_t cd)
|
||||
__gconv_close (__gconv_t cd)
|
||||
{
|
||||
struct gconv_step *srunp;
|
||||
struct gconv_step_data *drunp;
|
||||
struct __gconv_step *srunp;
|
||||
struct __gconv_step_data *drunp;
|
||||
size_t nsteps;
|
||||
|
||||
/* Free all resources by calling destructor functions and release
|
||||
the implementations. */
|
||||
srunp = cd->steps;
|
||||
nsteps = cd->nsteps;
|
||||
drunp = cd->data;
|
||||
srunp = cd->__steps;
|
||||
nsteps = cd->__nsteps;
|
||||
drunp = cd->__data;
|
||||
do
|
||||
{
|
||||
if (!drunp->is_last && drunp->outbuf != NULL)
|
||||
free (drunp->outbuf);
|
||||
if (!drunp->__is_last && drunp->__outbuf != NULL)
|
||||
free (drunp->__outbuf);
|
||||
}
|
||||
while (!(drunp++)->is_last);
|
||||
while (!(drunp++)->__is_last);
|
||||
|
||||
/* Free the data allocated for the descriptor. */
|
||||
free (cd);
|
||||
|
110
iconv/gconv_db.c
110
iconv/gconv_db.c
@ -82,7 +82,7 @@ struct known_derivation
|
||||
{
|
||||
const char *from;
|
||||
const char *to;
|
||||
struct gconv_step *steps;
|
||||
struct __gconv_step *steps;
|
||||
size_t nsteps;
|
||||
};
|
||||
|
||||
@ -107,7 +107,7 @@ static void *known_derivations;
|
||||
static int
|
||||
internal_function
|
||||
derivation_lookup (const char *fromset, const char *toset,
|
||||
struct gconv_step **handle, size_t *nsteps)
|
||||
struct __gconv_step **handle, size_t *nsteps)
|
||||
{
|
||||
struct known_derivation key = { fromset, toset, NULL, 0 };
|
||||
struct known_derivation **result;
|
||||
@ -115,21 +115,21 @@ derivation_lookup (const char *fromset, const char *toset,
|
||||
result = __tfind (&key, &known_derivations, derivation_compare);
|
||||
|
||||
if (result == NULL)
|
||||
return GCONV_NOCONV;
|
||||
return __GCONV_NOCONV;
|
||||
|
||||
*handle = (*result)->steps;
|
||||
*nsteps = (*result)->nsteps;
|
||||
|
||||
/* Please note that we return GCONV_OK even if the last search for
|
||||
this transformation was unsuccessful. */
|
||||
return GCONV_OK;
|
||||
return __GCONV_OK;
|
||||
}
|
||||
|
||||
/* Add new derivation to list of known ones. */
|
||||
static void
|
||||
internal_function
|
||||
add_derivation (const char *fromset, const char *toset,
|
||||
struct gconv_step *handle, size_t nsteps)
|
||||
struct __gconv_step *handle, size_t nsteps)
|
||||
{
|
||||
struct known_derivation *new_deriv;
|
||||
size_t fromset_len = strlen (fromset) + 1;
|
||||
@ -163,14 +163,14 @@ free_derivation (void *p)
|
||||
size_t cnt;
|
||||
|
||||
for (cnt = 0; cnt < deriv->nsteps; ++cnt)
|
||||
if (deriv->steps[cnt].end_fct)
|
||||
_CALL_DL_FCT (deriv->steps[cnt].end_fct, (&deriv->steps[cnt]));
|
||||
if (deriv->steps[cnt].__end_fct)
|
||||
_CALL_DL_FCT (deriv->steps[cnt].__end_fct, (&deriv->steps[cnt]));
|
||||
|
||||
/* Free the name strings. */
|
||||
free ((char *) deriv->steps[0].from_name);
|
||||
free ((char *) deriv->steps[deriv->nsteps - 1].to_name);
|
||||
free ((char *) deriv->steps[0].__from_name);
|
||||
free ((char *) deriv->steps[deriv->nsteps - 1].__to_name);
|
||||
|
||||
free ((struct gconv_step *) deriv->steps);
|
||||
free ((struct __gconv_step *) deriv->steps);
|
||||
free (deriv);
|
||||
}
|
||||
|
||||
@ -178,40 +178,40 @@ free_derivation (void *p)
|
||||
static int
|
||||
internal_function
|
||||
gen_steps (struct derivation_step *best, const char *toset,
|
||||
const char *fromset, struct gconv_step **handle, size_t *nsteps)
|
||||
const char *fromset, struct __gconv_step **handle, size_t *nsteps)
|
||||
{
|
||||
size_t step_cnt = 0;
|
||||
struct gconv_step *result;
|
||||
struct __gconv_step *result;
|
||||
struct derivation_step *current;
|
||||
int status = GCONV_NOMEM;
|
||||
int status = __GCONV_NOMEM;
|
||||
|
||||
/* First determine number of steps. */
|
||||
for (current = best; current->last != NULL; current = current->last)
|
||||
++step_cnt;
|
||||
|
||||
result = (struct gconv_step *) malloc (sizeof (struct gconv_step)
|
||||
result = (struct __gconv_step *) malloc (sizeof (struct __gconv_step)
|
||||
* step_cnt);
|
||||
if (result != NULL)
|
||||
{
|
||||
int failed = 0;
|
||||
|
||||
status = GCONV_OK;
|
||||
status = __GCONV_OK;
|
||||
*nsteps = step_cnt;
|
||||
current = best;
|
||||
while (step_cnt-- > 0)
|
||||
{
|
||||
result[step_cnt].from_name = (step_cnt == 0
|
||||
result[step_cnt].__from_name = (step_cnt == 0
|
||||
? __strdup (fromset)
|
||||
: current->last->result_set);
|
||||
result[step_cnt].to_name = (step_cnt + 1 == *nsteps
|
||||
result[step_cnt].__to_name = (step_cnt + 1 == *nsteps
|
||||
? __strdup (current->result_set)
|
||||
: result[step_cnt + 1].from_name);
|
||||
: result[step_cnt + 1].__from_name);
|
||||
|
||||
#ifndef STATIC_GCONV
|
||||
if (current->code->module_name[0] == '/')
|
||||
{
|
||||
/* Load the module, return handle for it. */
|
||||
struct gconv_loaded_object *shlib_handle =
|
||||
struct __gconv_loaded_object *shlib_handle =
|
||||
__gconv_find_shlib (current->code->module_name);
|
||||
|
||||
if (shlib_handle == NULL)
|
||||
@ -220,12 +220,12 @@ gen_steps (struct derivation_step *best, const char *toset,
|
||||
break;
|
||||
}
|
||||
|
||||
result[step_cnt].shlib_handle = shlib_handle;
|
||||
result[step_cnt].modname = shlib_handle->name;
|
||||
result[step_cnt].counter = 0;
|
||||
result[step_cnt].fct = shlib_handle->fct;
|
||||
result[step_cnt].init_fct = shlib_handle->init_fct;
|
||||
result[step_cnt].end_fct = shlib_handle->end_fct;
|
||||
result[step_cnt].__shlib_handle = shlib_handle;
|
||||
result[step_cnt].__modname = shlib_handle->name;
|
||||
result[step_cnt].__counter = 0;
|
||||
result[step_cnt].__fct = shlib_handle->fct;
|
||||
result[step_cnt].__init_fct = shlib_handle->init_fct;
|
||||
result[step_cnt].__end_fct = shlib_handle->end_fct;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -234,12 +234,12 @@ gen_steps (struct derivation_step *best, const char *toset,
|
||||
&result[step_cnt]);
|
||||
|
||||
/* Call the init function. */
|
||||
if (result[step_cnt].init_fct != NULL)
|
||||
if (result[step_cnt].__init_fct != NULL)
|
||||
{
|
||||
status = _CALL_DL_FCT (result[step_cnt].init_fct,
|
||||
status = _CALL_DL_FCT (result[step_cnt].__init_fct,
|
||||
(&result[step_cnt]));
|
||||
|
||||
if (status != GCONV_OK)
|
||||
if (status != __GCONV_OK)
|
||||
{
|
||||
failed = 1;
|
||||
/* Make sure we unload this modules. */
|
||||
@ -256,17 +256,17 @@ gen_steps (struct derivation_step *best, const char *toset,
|
||||
/* Something went wrong while initializing the modules. */
|
||||
while (++step_cnt < *nsteps)
|
||||
{
|
||||
if (result[step_cnt].end_fct != NULL)
|
||||
_CALL_DL_FCT (result[step_cnt].end_fct, (&result[step_cnt]));
|
||||
if (result[step_cnt].__end_fct != NULL)
|
||||
_CALL_DL_FCT (result[step_cnt].__end_fct, (&result[step_cnt]));
|
||||
#ifndef STATIC_GCONV
|
||||
__gconv_release_shlib (result[step_cnt].shlib_handle);
|
||||
__gconv_release_shlib (result[step_cnt].__shlib_handle);
|
||||
#endif
|
||||
}
|
||||
free (result);
|
||||
*nsteps = 0;
|
||||
*handle = NULL;
|
||||
if (status == GCONV_OK)
|
||||
status = GCONV_NOCONV;
|
||||
if (status == __GCONV_OK)
|
||||
status = __GCONV_NOCONV;
|
||||
}
|
||||
else
|
||||
*handle = result;
|
||||
@ -287,7 +287,7 @@ static int
|
||||
internal_function
|
||||
find_derivation (const char *toset, const char *toset_expand,
|
||||
const char *fromset, const char *fromset_expand,
|
||||
struct gconv_step **handle, size_t *nsteps)
|
||||
struct __gconv_step **handle, size_t *nsteps)
|
||||
{
|
||||
__libc_lock_define_initialized (static, lock)
|
||||
struct derivation_step *first, *current, **lastp, *solution = NULL;
|
||||
@ -297,7 +297,7 @@ find_derivation (const char *toset, const char *toset_expand,
|
||||
|
||||
result = derivation_lookup (fromset_expand ?: fromset, toset_expand ?: toset,
|
||||
handle, nsteps);
|
||||
if (result == GCONV_OK)
|
||||
if (result == __GCONV_OK)
|
||||
return result;
|
||||
|
||||
__libc_lock_lock (lock);
|
||||
@ -307,7 +307,7 @@ find_derivation (const char *toset, const char *toset_expand,
|
||||
find it but at the same time another thread looked for this derivation. */
|
||||
result = derivation_lookup (fromset_expand ?: fromset, toset_expand ?: toset,
|
||||
handle, nsteps);
|
||||
if (result == GCONV_OK)
|
||||
if (result == __GCONV_OK)
|
||||
{
|
||||
__libc_lock_unlock (lock);
|
||||
return result;
|
||||
@ -613,7 +613,7 @@ find_derivation (const char *toset, const char *toset_expand,
|
||||
int
|
||||
internal_function
|
||||
__gconv_find_transform (const char *toset, const char *fromset,
|
||||
struct gconv_step **handle, size_t *nsteps)
|
||||
struct __gconv_step **handle, size_t *nsteps)
|
||||
{
|
||||
__libc_once_define (static, once);
|
||||
const char *fromset_expand = NULL;
|
||||
@ -630,7 +630,7 @@ __gconv_find_transform (const char *toset, const char *fromset,
|
||||
if (__gconv_modules_db == NULL)
|
||||
{
|
||||
__libc_lock_unlock (lock);
|
||||
return GCONV_NOCONV;
|
||||
return __GCONV_NOCONV;
|
||||
}
|
||||
|
||||
/* See whether the names are aliases. */
|
||||
@ -653,23 +653,23 @@ __gconv_find_transform (const char *toset, const char *fromset,
|
||||
|
||||
#ifndef STATIC_GCONV
|
||||
/* Increment the user counter. */
|
||||
if (result == GCONV_OK)
|
||||
if (result == __GCONV_OK)
|
||||
{
|
||||
size_t cnt = *nsteps;
|
||||
struct gconv_step *steps = *handle;
|
||||
struct __gconv_step *steps = *handle;
|
||||
|
||||
while (cnt > 0)
|
||||
if (steps[--cnt].counter++ == 0)
|
||||
if (steps[--cnt].__counter++ == 0)
|
||||
{
|
||||
steps[cnt].shlib_handle =
|
||||
__gconv_find_shlib (steps[cnt].modname);
|
||||
if (steps[cnt].shlib_handle == NULL)
|
||||
steps[cnt].__shlib_handle =
|
||||
__gconv_find_shlib (steps[cnt].__modname);
|
||||
if (steps[cnt].__shlib_handle == NULL)
|
||||
{
|
||||
/* Oops, this is the second time we use this module (after
|
||||
unloading) and this time loading failed!? */
|
||||
while (++cnt < *nsteps)
|
||||
__gconv_release_shlib (steps[cnt].shlib_handle);
|
||||
result = GCONV_NOCONV;
|
||||
__gconv_release_shlib (steps[cnt].__shlib_handle);
|
||||
result = __GCONV_NOCONV;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -682,8 +682,8 @@ __gconv_find_transform (const char *toset, const char *fromset,
|
||||
/* The following code is necessary since `find_derivation' will return
|
||||
GCONV_OK even when no derivation was found but the same request
|
||||
was processed before. I.e., negative results will also be cached. */
|
||||
return (result == GCONV_OK
|
||||
? (*handle == NULL ? GCONV_NOCONV : GCONV_OK)
|
||||
return (result == __GCONV_OK
|
||||
? (*handle == NULL ? __GCONV_NOCONV : __GCONV_OK)
|
||||
: result);
|
||||
}
|
||||
|
||||
@ -691,22 +691,22 @@ __gconv_find_transform (const char *toset, const char *fromset,
|
||||
/* Release the entries of the modules list. */
|
||||
int
|
||||
internal_function
|
||||
__gconv_close_transform (struct gconv_step *steps, size_t nsteps)
|
||||
__gconv_close_transform (struct __gconv_step *steps, size_t nsteps)
|
||||
{
|
||||
int result = GCONV_OK;
|
||||
int result = __GCONV_OK;
|
||||
|
||||
#ifndef STATIC_GCONV
|
||||
/* Acquire the lock. */
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
while (nsteps-- > 0)
|
||||
if (steps[nsteps].shlib_handle != NULL
|
||||
&& --steps[nsteps].counter == 0)
|
||||
if (steps[nsteps].__shlib_handle != NULL
|
||||
&& --steps[nsteps].__counter == 0)
|
||||
{
|
||||
result = __gconv_release_shlib (steps[nsteps].shlib_handle);
|
||||
if (result != GCONV_OK)
|
||||
result = __gconv_release_shlib (steps[nsteps].__shlib_handle);
|
||||
if (result != __GCONV_OK)
|
||||
break;
|
||||
steps[nsteps].shlib_handle = NULL;
|
||||
steps[nsteps].__shlib_handle = NULL;
|
||||
}
|
||||
|
||||
/* Release the lock. */
|
||||
|
@ -50,10 +50,10 @@ static void *loaded;
|
||||
static int
|
||||
known_compare (const void *p1, const void *p2)
|
||||
{
|
||||
const struct gconv_loaded_object *s1 =
|
||||
(const struct gconv_loaded_object *) p1;
|
||||
const struct gconv_loaded_object *s2 =
|
||||
(const struct gconv_loaded_object *) p2;
|
||||
const struct __gconv_loaded_object *s1 =
|
||||
(const struct __gconv_loaded_object *) p1;
|
||||
const struct __gconv_loaded_object *s2 =
|
||||
(const struct __gconv_loaded_object *) p2;
|
||||
|
||||
return (intptr_t) s1->handle - (intptr_t) s2->handle;
|
||||
}
|
||||
@ -62,7 +62,7 @@ known_compare (const void *p1, const void *p2)
|
||||
static void
|
||||
do_open (void *a)
|
||||
{
|
||||
struct gconv_loaded_object *args = (struct gconv_loaded_object *) a;
|
||||
struct __gconv_loaded_object *args = (struct __gconv_loaded_object *) a;
|
||||
/* Open and relocate the shared object. */
|
||||
args->handle = _dl_open (args->name, RTLD_LAZY, NULL);
|
||||
}
|
||||
@ -124,11 +124,11 @@ __gconv_find_func (void *handle, const char *name)
|
||||
|
||||
/* Open the gconv database if necessary. A non-negative return value
|
||||
means success. */
|
||||
struct gconv_loaded_object *
|
||||
struct __gconv_loaded_object *
|
||||
internal_function
|
||||
__gconv_find_shlib (const char *name)
|
||||
{
|
||||
struct gconv_loaded_object *found;
|
||||
struct __gconv_loaded_object *found;
|
||||
void *keyp;
|
||||
|
||||
/* Search the tree of shared objects previously requested. Data in
|
||||
@ -144,7 +144,7 @@ __gconv_find_shlib (const char *name)
|
||||
if (keyp == NULL)
|
||||
{
|
||||
/* This name was not known before. */
|
||||
found = malloc (sizeof (struct gconv_loaded_object));
|
||||
found = malloc (sizeof (struct __gconv_loaded_object));
|
||||
if (found != NULL)
|
||||
{
|
||||
/* Point the tree node at this new structure. */
|
||||
@ -161,7 +161,7 @@ __gconv_find_shlib (const char *name)
|
||||
}
|
||||
}
|
||||
else
|
||||
found = *(struct gconv_loaded_object **) keyp;
|
||||
found = *(struct __gconv_loaded_object **) keyp;
|
||||
|
||||
/* Try to load the shared object if the usage count is 0. This
|
||||
implies that if the shared object is not loadable, the handle is
|
||||
@ -206,12 +206,12 @@ __gconv_find_shlib (const char *name)
|
||||
/* This is very ugly but the tsearch functions provide no way to pass
|
||||
information to the walker function. So we use a global variable.
|
||||
It is MT safe since we use a lock. */
|
||||
static struct gconv_loaded_object *release_handle;
|
||||
static struct __gconv_loaded_object *release_handle;
|
||||
|
||||
static void
|
||||
do_release_shlib (const void *nodep, VISIT value, int level)
|
||||
{
|
||||
struct gconv_loaded_object *obj = *(struct gconv_loaded_object **) nodep;
|
||||
struct __gconv_loaded_object *obj = *(struct __gconv_loaded_object **) nodep;
|
||||
|
||||
if (value != preorder && value != leaf)
|
||||
return;
|
||||
@ -238,7 +238,7 @@ do_release_shlib (const void *nodep, VISIT value, int level)
|
||||
/* Notify system that a shared object is not longer needed. */
|
||||
int
|
||||
internal_function
|
||||
__gconv_release_shlib (struct gconv_loaded_object *handle)
|
||||
__gconv_release_shlib (struct __gconv_loaded_object *handle)
|
||||
{
|
||||
/* Urgh, this is ugly but we have no other possibility. */
|
||||
release_handle = handle;
|
||||
@ -248,7 +248,7 @@ __gconv_release_shlib (struct gconv_loaded_object *handle)
|
||||
if necessary. */
|
||||
__twalk (loaded, do_release_shlib);
|
||||
|
||||
return GCONV_OK;
|
||||
return __GCONV_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +256,7 @@ __gconv_release_shlib (struct gconv_loaded_object *handle)
|
||||
static void
|
||||
do_release_all (void *nodep)
|
||||
{
|
||||
struct gconv_loaded_object *obj = (struct gconv_loaded_object *) nodep;
|
||||
struct __gconv_loaded_object *obj = (struct __gconv_loaded_object *) nodep;
|
||||
|
||||
/* Unload the shared object. We don't use the trick to
|
||||
catch errors since in the case an error is signalled
|
||||
|
@ -41,7 +41,7 @@ struct gconv_alias
|
||||
/* Structure describing one loaded shared object. This normally are
|
||||
objects to perform conversation but as a special case the db shared
|
||||
object is also handled. */
|
||||
struct gconv_loaded_object
|
||||
struct __gconv_loaded_object
|
||||
{
|
||||
/* Name of the object. */
|
||||
const char *name;
|
||||
@ -54,9 +54,9 @@ struct gconv_loaded_object
|
||||
struct link_map *handle;
|
||||
|
||||
/* Pointer to the functions the module defines. */
|
||||
gconv_fct fct;
|
||||
gconv_init_fct init_fct;
|
||||
gconv_end_fct end_fct;
|
||||
__gconv_fct fct;
|
||||
__gconv_init_fct init_fct;
|
||||
__gconv_end_fct end_fct;
|
||||
};
|
||||
|
||||
|
||||
@ -95,18 +95,18 @@ extern struct gconv_module *__gconv_modules_db;
|
||||
|
||||
/* Return in *HANDLE decriptor for transformation from FROMSET to TOSET. */
|
||||
extern int __gconv_open (const char *__toset, const char *__fromset,
|
||||
gconv_t *__handle)
|
||||
__gconv_t *__handle)
|
||||
internal_function;
|
||||
|
||||
/* Free resources associated with transformation descriptor CD. */
|
||||
extern int __gconv_close (gconv_t cd)
|
||||
extern int __gconv_close (__gconv_t cd)
|
||||
internal_function;
|
||||
|
||||
/* Transform at most *INBYTESLEFT bytes from buffer starting at *INBUF
|
||||
according to rules described by CD and place up to *OUTBYTESLEFT
|
||||
bytes in buffer starting at *OUTBUF. Return number of written
|
||||
characters in *CONVERTED if this pointer is not null. */
|
||||
extern int __gconv (gconv_t __cd, const unsigned char **__inbuf,
|
||||
extern int __gconv (__gconv_t __cd, const unsigned char **__inbuf,
|
||||
const unsigned char *inbufend, unsigned char **__outbuf,
|
||||
unsigned char *outbufend, size_t *converted)
|
||||
internal_function;
|
||||
@ -114,7 +114,7 @@ extern int __gconv (gconv_t __cd, const unsigned char **__inbuf,
|
||||
/* Return in *HANDLE a pointer to an array with *NSTEPS elements describing
|
||||
the single steps necessary for transformation from FROMSET to TOSET. */
|
||||
extern int __gconv_find_transform (const char *__toset, const char *__fromset,
|
||||
struct gconv_step **__handle,
|
||||
struct __gconv_step **__handle,
|
||||
size_t *__nsteps)
|
||||
internal_function;
|
||||
|
||||
@ -126,13 +126,13 @@ extern int __gconv_alias_compare (const void *__p1, const void *__p2);
|
||||
|
||||
/* Clear reference to transformation step implementations which might
|
||||
cause the code to be unloaded. */
|
||||
extern int __gconv_close_transform (struct gconv_step *__steps,
|
||||
extern int __gconv_close_transform (struct __gconv_step *__steps,
|
||||
size_t __nsteps)
|
||||
internal_function;
|
||||
|
||||
/* Load shared object named by NAME. If already loaded increment reference
|
||||
count. */
|
||||
extern struct gconv_loaded_object *__gconv_find_shlib (const char *__name)
|
||||
extern struct __gconv_loaded_object *__gconv_find_shlib (const char *__name)
|
||||
internal_function;
|
||||
|
||||
/* Find function named NAME in shared object referenced by HANDLE. */
|
||||
@ -141,12 +141,12 @@ void *__gconv_find_func (void *handle, const char *name)
|
||||
|
||||
/* Release shared object. If no further reference is available unload
|
||||
the object. */
|
||||
extern int __gconv_release_shlib (struct gconv_loaded_object *__handle)
|
||||
extern int __gconv_release_shlib (struct __gconv_loaded_object *__handle)
|
||||
internal_function;
|
||||
|
||||
/* Fill STEP with information about builtin module with NAME. */
|
||||
extern void __gconv_get_builtin_trans (const char *__name,
|
||||
struct gconv_step *__step)
|
||||
struct __gconv_step *__step)
|
||||
internal_function;
|
||||
|
||||
|
||||
@ -154,7 +154,8 @@ extern void __gconv_get_builtin_trans (const char *__name,
|
||||
/* Builtin transformations. */
|
||||
#ifdef _LIBC
|
||||
# define __BUILTIN_TRANS(Name) \
|
||||
extern int Name (struct gconv_step *__step, struct gconv_step_data *__data, \
|
||||
extern int Name (struct __gconv_step *__step, \
|
||||
struct __gconv_step_data *__data, \
|
||||
const unsigned char **__inbuf, \
|
||||
const unsigned char *__inbufend, size_t *__written, \
|
||||
int __do_flush)
|
||||
|
@ -26,31 +26,32 @@
|
||||
|
||||
int
|
||||
internal_function
|
||||
__gconv_open (const char *toset, const char *fromset, gconv_t *handle)
|
||||
__gconv_open (const char *toset, const char *fromset, __gconv_t *handle)
|
||||
{
|
||||
struct gconv_step *steps;
|
||||
struct __gconv_step *steps;
|
||||
size_t nsteps;
|
||||
gconv_t result = NULL;
|
||||
__gconv_t result = NULL;
|
||||
size_t cnt = 0;
|
||||
int res;
|
||||
|
||||
res = __gconv_find_transform (toset, fromset, &steps, &nsteps);
|
||||
if (res == GCONV_OK)
|
||||
if (res == __GCONV_OK)
|
||||
{
|
||||
/* Allocate room for handle. */
|
||||
result = (gconv_t) malloc (sizeof (struct gconv_info)
|
||||
+ nsteps * sizeof (struct gconv_step_data));
|
||||
result = (__gconv_t) malloc (sizeof (struct __gconv_info)
|
||||
+ (nsteps
|
||||
* sizeof (struct __gconv_step_data)));
|
||||
if (result == NULL)
|
||||
res = GCONV_NOMEM;
|
||||
res = __GCONV_NOMEM;
|
||||
else
|
||||
{
|
||||
/* Remember the list of steps. */
|
||||
result->steps = steps;
|
||||
result->nsteps = nsteps;
|
||||
result->__steps = steps;
|
||||
result->__nsteps = nsteps;
|
||||
|
||||
/* Clear the array for the step data. */
|
||||
memset (result->data, '\0',
|
||||
nsteps * sizeof (struct gconv_step_data));
|
||||
memset (result->__data, '\0',
|
||||
nsteps * sizeof (struct __gconv_step_data));
|
||||
|
||||
/* Call all initialization functions for the transformation
|
||||
step implemenations. */
|
||||
@ -58,37 +59,37 @@ __gconv_open (const char *toset, const char *fromset, gconv_t *handle)
|
||||
{
|
||||
/* If this is the last step we must not allocate an
|
||||
output buffer. */
|
||||
result->data[cnt].is_last = cnt == nsteps - 1;
|
||||
result->__data[cnt].__is_last = cnt == nsteps - 1;
|
||||
|
||||
/* Reset the counter. */
|
||||
result->data[cnt].invocation_counter = 0;
|
||||
result->__data[cnt].__invocation_counter = 0;
|
||||
|
||||
/* It's a regular use. */
|
||||
result->data[cnt].internal_use = 0;
|
||||
result->__data[cnt].__internal_use = 0;
|
||||
|
||||
/* We use the `mbstate_t' member in DATA. */
|
||||
result->data[cnt].statep = &result->data[cnt].__state;
|
||||
result->__data[cnt].__statep = &result->__data[cnt].__state;
|
||||
|
||||
/* Allocate the buffer. */
|
||||
if (!result->data[cnt].is_last)
|
||||
if (!result->__data[cnt].__is_last)
|
||||
{
|
||||
size_t size = (GCONV_NCHAR_GOAL
|
||||
* steps[cnt].max_needed_to);
|
||||
* steps[cnt].__max_needed_to);
|
||||
|
||||
result->data[cnt].outbuf = (char *) malloc (size);
|
||||
if (result->data[cnt].outbuf == NULL)
|
||||
result->__data[cnt].__outbuf = (char *) malloc (size);
|
||||
if (result->__data[cnt].__outbuf == NULL)
|
||||
{
|
||||
res = GCONV_NOMEM;
|
||||
res = __GCONV_NOMEM;
|
||||
break;
|
||||
}
|
||||
result->data[cnt].outbufend = (result->data[cnt].outbuf
|
||||
+ size);
|
||||
result->__data[cnt].__outbufend =
|
||||
result->__data[cnt].__outbuf + size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (res != GCONV_OK)
|
||||
if (res != __GCONV_OK)
|
||||
{
|
||||
/* Something went wrong. Free all the resources. */
|
||||
int serrno = errno;
|
||||
@ -96,7 +97,7 @@ __gconv_open (const char *toset, const char *fromset, gconv_t *handle)
|
||||
if (result != NULL)
|
||||
{
|
||||
while (cnt-- > 0)
|
||||
free (result->data[cnt].outbuf);
|
||||
free (result->__data[cnt].__outbuf);
|
||||
|
||||
free (result);
|
||||
result = NULL;
|
||||
|
@ -90,11 +90,11 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
|
||||
/* Determine the status. */
|
||||
if (*outptrp == outend)
|
||||
result = GCONV_FULL_OUTPUT;
|
||||
result = __GCONV_FULL_OUTPUT;
|
||||
else if (*inptrp == inend)
|
||||
result = GCONV_EMPTY_INPUT;
|
||||
result = __GCONV_EMPTY_INPUT;
|
||||
else
|
||||
result = GCONV_INCOMPLETE_INPUT;
|
||||
result = __GCONV_INCOMPLETE_INPUT;
|
||||
|
||||
if (converted != NULL)
|
||||
converted += n_convert;
|
||||
@ -123,7 +123,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
if (*inptr > '\x7f') \
|
||||
{ \
|
||||
/* This is no correct ANSI_X3.4-1968 character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -152,7 +152,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
if (*((uint32_t *) inptr) > 0x7f) \
|
||||
{ \
|
||||
/* This is no correct ANSI_X3.4-1968 character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -200,7 +200,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
if (outptr + step >= outend) \
|
||||
{ \
|
||||
/* Too long. */ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -287,14 +287,14 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
else \
|
||||
{ \
|
||||
/* This is an illegal encoding. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
if (NEED_LENGTH_TEST && inptr + cnt > inend) \
|
||||
{ \
|
||||
/* We don't have enough input. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -306,7 +306,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
if ((byte & 0xc0) != 0x80) \
|
||||
{ \
|
||||
/* This is an illegal encoding. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -366,7 +366,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
{ \
|
||||
if (*((uint32_t *) inptr) >= 0x10000) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
/* Please note that we use the `uint32_t' from-pointer as an `uint16_t' \
|
||||
@ -379,7 +379,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
{ \
|
||||
if (*((uint32_t *) inptr) >= 0x10000) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
*((uint16_t *) outptr)++ = *((uint32_t *) inptr)++; \
|
||||
@ -432,7 +432,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
{ \
|
||||
if (*((uint32_t *) inptr) >= 0x10000) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
*((uint16_t *) outptr)++ = *((uint32_t *) inptr)++; \
|
||||
@ -442,7 +442,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
{ \
|
||||
if (*((uint32_t *) inptr) >= 0x10000) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
*((uint16_t *) outptr)++ = bswap_16 (((uint16_t *) inptr)[1]); \
|
||||
@ -475,7 +475,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
{ \
|
||||
if (*((uint32_t *) inptr) >= 0x110000) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -483,7 +483,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
if (NEED_LENGTH_TEST && outptr + 4 > outend) \
|
||||
{ \
|
||||
/* Overflow in the output buffer. */ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -506,7 +506,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
{ \
|
||||
if (*((uint32_t *) inptr) >= 0x110000) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -514,7 +514,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
if (NEED_LENGTH_TEST && outptr + 4 > outend) \
|
||||
{ \
|
||||
/* Overflow in the output buffer. */ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -565,7 +565,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
{ \
|
||||
/* We don't have enough input for another complete input \
|
||||
character. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -573,7 +573,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
if (u2 < 0xdc00 || u2 >= 0xdfff) \
|
||||
{ \
|
||||
/* This is no valid second word for a surrogate. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -602,7 +602,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
{ \
|
||||
/* We don't have enough input for another complete input \
|
||||
character. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -610,7 +610,7 @@ internal_ucs4_loop (const unsigned char **inptrp, const unsigned char *inend,
|
||||
if (u2 < 0xdc00 || u2 >= 0xdfff) \
|
||||
{ \
|
||||
/* This is no valid second word for a surrogate. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -31,7 +31,7 @@ size_t
|
||||
iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
|
||||
size_t *outbytesleft)
|
||||
{
|
||||
gconv_t gcd = (gconv_t) cd;
|
||||
__gconv_t gcd = (__gconv_t) cd;
|
||||
char *outstart = outbuf ? *outbuf : NULL;
|
||||
size_t converted;
|
||||
int result;
|
||||
@ -59,28 +59,28 @@ iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case GCONV_ILLEGAL_DESCRIPTOR:
|
||||
case __GCONV_ILLEGAL_DESCRIPTOR:
|
||||
__set_errno (EBADF);
|
||||
converted = (size_t) -1L;
|
||||
break;
|
||||
|
||||
case GCONV_ILLEGAL_INPUT:
|
||||
case __GCONV_ILLEGAL_INPUT:
|
||||
__set_errno (EILSEQ);
|
||||
converted = (size_t) -1L;
|
||||
break;
|
||||
|
||||
case GCONV_FULL_OUTPUT:
|
||||
case __GCONV_FULL_OUTPUT:
|
||||
__set_errno (E2BIG);
|
||||
converted = (size_t) -1L;
|
||||
break;
|
||||
|
||||
case GCONV_INCOMPLETE_INPUT:
|
||||
case __GCONV_INCOMPLETE_INPUT:
|
||||
__set_errno (EINVAL);
|
||||
converted = (size_t) -1L;
|
||||
break;
|
||||
|
||||
case GCONV_EMPTY_INPUT:
|
||||
case GCONV_OK:
|
||||
case __GCONV_EMPTY_INPUT:
|
||||
case __GCONV_OK:
|
||||
/* Nothing. */
|
||||
break;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Release any resource associated with given conversion descriptor.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -33,5 +33,5 @@ iconv_close (iconv_t cd)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return __gconv_close ((gconv_t) cd) ? -1 : 0;
|
||||
return __gconv_close ((__gconv_t) cd) ? -1 : 0;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ iconv_open (const char *tocode, const char *fromcode)
|
||||
char *fromcode_conv;
|
||||
size_t tocode_len;
|
||||
size_t fromcode_len;
|
||||
gconv_t cd;
|
||||
__gconv_t cd;
|
||||
int res;
|
||||
|
||||
/* Normalize the name. We remove all characters beside alpha-numeric,
|
||||
@ -87,10 +87,10 @@ iconv_open (const char *tocode, const char *fromcode)
|
||||
|
||||
res = __gconv_open (tocode, fromcode, &cd);
|
||||
|
||||
if (res != GCONV_OK)
|
||||
if (res != __GCONV_OK)
|
||||
{
|
||||
/* We must set the error number according to the specs. */
|
||||
if (res == GCONV_NOCONV || res == GCONV_NODB)
|
||||
if (res == __GCONV_NOCONV || res == __GCONV_NODB)
|
||||
__set_errno (EINVAL);
|
||||
|
||||
return (iconv_t) -1;
|
||||
|
19
iconv/loop.c
19
iconv/loop.c
@ -1,5 +1,5 @@
|
||||
/* Conversion loop frame work.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
*/
|
||||
|
||||
#include <gconv.h>
|
||||
#include <wchar.h>
|
||||
#include <sys/param.h> /* For MIN. */
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
@ -124,7 +125,7 @@ LOOPFCT (const unsigned char **inptrp, const unsigned char *inend,
|
||||
unsigned char **outptrp, unsigned char *outend, mbstate_t *state,
|
||||
void *data, size_t *converted EXTRA_LOOP_DECLS)
|
||||
{
|
||||
int result = GCONV_OK;
|
||||
int result = __GCONV_OK;
|
||||
const unsigned char *inptr = *inptrp;
|
||||
unsigned char *outptr = *outptrp;
|
||||
#ifndef COUNT_CONVERTED
|
||||
@ -157,7 +158,7 @@ LOOPFCT (const unsigned char **inptrp, const unsigned char *inend,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (result == GCONV_OK)
|
||||
if (result == __GCONV_OK)
|
||||
{
|
||||
#if MIN_NEEDED_INPUT == MAX_NEEDED_INPUT \
|
||||
&& MIN_NEEDED_OUTPUT == MAX_NEEDED_OUTPUT
|
||||
@ -166,16 +167,16 @@ LOOPFCT (const unsigned char **inptrp, const unsigned char *inend,
|
||||
to be determined is the status. */
|
||||
if (inptr == inend)
|
||||
/* No more input. */
|
||||
result = GCONV_EMPTY_INPUT;
|
||||
result = __GCONV_EMPTY_INPUT;
|
||||
else if ((MIN_NEEDED_OUTPUT != 1 && outptr + MIN_NEEDED_OUTPUT > outend)
|
||||
|| (MIN_NEEDED_OUTPUT == 1 && outptr >= outend))
|
||||
/* Overflow in the output buffer. */
|
||||
result = GCONV_FULL_OUTPUT;
|
||||
result = __GCONV_FULL_OUTPUT;
|
||||
else
|
||||
/* We have something left in the input buffer. */
|
||||
result = GCONV_INCOMPLETE_INPUT;
|
||||
result = __GCONV_INCOMPLETE_INPUT;
|
||||
#else
|
||||
result = GCONV_EMPTY_INPUT;
|
||||
result = __GCONV_EMPTY_INPUT;
|
||||
|
||||
# undef NEED_LENGTH_TEST
|
||||
# define NEED_LENGTH_TEST 1
|
||||
@ -188,14 +189,14 @@ LOOPFCT (const unsigned char **inptrp, const unsigned char *inend,
|
||||
|| (MIN_NEEDED_OUTPUT == 1 && outptr >= outend))
|
||||
{
|
||||
/* Overflow in the output buffer. */
|
||||
result = GCONV_FULL_OUTPUT;
|
||||
result = __GCONV_FULL_OUTPUT;
|
||||
break;
|
||||
}
|
||||
if (MIN_NEEDED_INPUT > 1 && inptr + MIN_NEEDED_INPUT > inend)
|
||||
{
|
||||
/* We don't have enough input for another complete input
|
||||
character. */
|
||||
result = GCONV_INCOMPLETE_INPUT;
|
||||
result = __GCONV_INCOMPLETE_INPUT;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ static int from_object;
|
||||
static int to_object;
|
||||
|
||||
# ifndef FROM_DIRECTION
|
||||
# define FROM_DIRECTION (step->data == &from_object)
|
||||
# define FROM_DIRECTION (step->__data == &from_object)
|
||||
# endif
|
||||
#else
|
||||
# ifndef FROM_DIRECTION
|
||||
@ -140,37 +140,37 @@ static int to_object;
|
||||
# endif
|
||||
|
||||
int
|
||||
gconv_init (struct gconv_step *step)
|
||||
gconv_init (struct __gconv_step *step)
|
||||
{
|
||||
/* Determine which direction. */
|
||||
if (strcmp (step->from_name, CHARSET_NAME) == 0)
|
||||
if (strcmp (step->__from_name, CHARSET_NAME) == 0)
|
||||
{
|
||||
step->data = &from_object;
|
||||
step->__data = &from_object;
|
||||
|
||||
step->min_needed_from = MIN_NEEDED_FROM;
|
||||
step->max_needed_from = MAX_NEEDED_FROM;
|
||||
step->min_needed_to = MIN_NEEDED_TO;
|
||||
step->max_needed_to = MAX_NEEDED_TO;
|
||||
step->__min_needed_from = MIN_NEEDED_FROM;
|
||||
step->__max_needed_from = MAX_NEEDED_FROM;
|
||||
step->__min_needed_to = MIN_NEEDED_TO;
|
||||
step->__max_needed_to = MAX_NEEDED_TO;
|
||||
}
|
||||
else if (strcmp (step->to_name, CHARSET_NAME) == 0)
|
||||
else if (strcmp (step->__to_name, CHARSET_NAME) == 0)
|
||||
{
|
||||
step->data = &to_object;
|
||||
step->__data = &to_object;
|
||||
|
||||
step->min_needed_from = MIN_NEEDED_TO;
|
||||
step->max_needed_from = MAX_NEEDED_TO;
|
||||
step->min_needed_to = MIN_NEEDED_FROM;
|
||||
step->max_needed_to = MAX_NEEDED_FROM;
|
||||
step->__min_needed_from = MIN_NEEDED_TO;
|
||||
step->__max_needed_from = MAX_NEEDED_TO;
|
||||
step->__min_needed_to = MIN_NEEDED_FROM;
|
||||
step->__max_needed_to = MAX_NEEDED_FROM;
|
||||
}
|
||||
else
|
||||
return GCONV_NOCONV;
|
||||
return __GCONV_NOCONV;
|
||||
|
||||
#ifdef RESET_STATE
|
||||
step->stateful = 1;
|
||||
step->__stateful = 1;
|
||||
#else
|
||||
step->stateful = 0;
|
||||
step->__stateful = 0;
|
||||
#endif
|
||||
|
||||
return GCONV_OK;
|
||||
return __GCONV_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -195,13 +195,13 @@ gconv_init (struct gconv_step *step)
|
||||
#endif
|
||||
|
||||
int
|
||||
FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
|
||||
const unsigned char **inbuf, const unsigned char *inbufend,
|
||||
size_t *written, int do_flush)
|
||||
{
|
||||
struct gconv_step *next_step = step + 1;
|
||||
struct gconv_step_data *next_data = data + 1;
|
||||
gconv_fct fct = next_step->fct;
|
||||
struct __gconv_step *next_step = step + 1;
|
||||
struct __gconv_step_data *next_data = data + 1;
|
||||
__gconv_fct fct = next_step->__fct;
|
||||
int status;
|
||||
|
||||
/* If the function is called with no input this means we have to reset
|
||||
@ -209,7 +209,7 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
dropped. */
|
||||
if (do_flush)
|
||||
{
|
||||
status = GCONV_OK;
|
||||
status = __GCONV_OK;
|
||||
|
||||
#ifdef EMIT_SHIFT_TO_INIT
|
||||
/* Emit the escape sequence to reset the state. */
|
||||
@ -217,7 +217,7 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
#endif
|
||||
/* Call the steps down the chain if there are any but only if we
|
||||
successfully emitted the escape sequence. */
|
||||
if (status == GCONV_OK && ! data->is_last)
|
||||
if (status == __GCONV_OK && ! data->__is_last)
|
||||
status = DL_CALL_FCT (fct, (next_step, next_data, NULL, NULL,
|
||||
written, 1));
|
||||
}
|
||||
@ -225,8 +225,8 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
{
|
||||
/* We preserve the initial values of the pointer variables. */
|
||||
const unsigned char *inptr = *inbuf;
|
||||
unsigned char *outbuf = data->outbuf;
|
||||
unsigned char *outend = data->outbufend;
|
||||
unsigned char *outbuf = data->__outbuf;
|
||||
unsigned char *outend = data->__outbufend;
|
||||
unsigned char *outstart;
|
||||
|
||||
/* This variable is used to count the number of characters we
|
||||
@ -251,20 +251,20 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
if (FROM_DIRECTION)
|
||||
/* Run the conversion loop. */
|
||||
status = FROM_LOOP (inbuf, inbufend, &outbuf, outend,
|
||||
data->statep, step->data, &converted
|
||||
data->__statep, step->__data, &converted
|
||||
EXTRA_LOOP_ARGS);
|
||||
else
|
||||
/* Run the conversion loop. */
|
||||
status = TO_LOOP (inbuf, inbufend, &outbuf, outend,
|
||||
data->statep, step->data, &converted
|
||||
data->__statep, step->__data, &converted
|
||||
EXTRA_LOOP_ARGS);
|
||||
|
||||
/* If this is the last step leave the loop, there is nothing
|
||||
we can do. */
|
||||
if (data->is_last)
|
||||
if (data->__is_last)
|
||||
{
|
||||
/* Store information about how many bytes are available. */
|
||||
data->outbuf = outbuf;
|
||||
data->__outbuf = outbuf;
|
||||
|
||||
/* Remember how many characters we converted. */
|
||||
*written += converted;
|
||||
@ -275,13 +275,13 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
/* Write out all output which was produced. */
|
||||
if (outbuf > outstart)
|
||||
{
|
||||
const unsigned char *outerr = data->outbuf;
|
||||
const unsigned char *outerr = data->__outbuf;
|
||||
int result;
|
||||
|
||||
result = DL_CALL_FCT (fct, (next_step, next_data, &outerr,
|
||||
outbuf, written, 0));
|
||||
|
||||
if (result != GCONV_EMPTY_INPUT)
|
||||
if (result != __GCONV_EMPTY_INPUT)
|
||||
{
|
||||
if (outerr != outbuf)
|
||||
{
|
||||
@ -307,7 +307,7 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
(const unsigned char *) inbufend,
|
||||
(unsigned char **) &outbuf,
|
||||
(unsigned char *) outerr,
|
||||
data->statep, step->data,
|
||||
data->__statep, step->__data,
|
||||
&converted EXTRA_LOOP_ARGS);
|
||||
else
|
||||
/* Run the conversion loop. */
|
||||
@ -315,13 +315,13 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
(const unsigned char *) inbufend,
|
||||
(unsigned char **) &outbuf,
|
||||
(unsigned char *) outerr,
|
||||
data->statep, step->data,
|
||||
data->__statep, step->__data,
|
||||
&converted EXTRA_LOOP_ARGS);
|
||||
|
||||
/* We must run out of output buffer space in this
|
||||
rerun. */
|
||||
assert (outbuf == outerr);
|
||||
assert (nstatus == GCONV_FULL_OUTPUT);
|
||||
assert (nstatus == __GCONV_FULL_OUTPUT);
|
||||
#endif /* reset input buffer */
|
||||
}
|
||||
|
||||
@ -331,18 +331,18 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
else
|
||||
/* All the output is consumed, we can make another run
|
||||
if everything was ok. */
|
||||
if (status == GCONV_FULL_OUTPUT)
|
||||
status = GCONV_OK;
|
||||
if (status == __GCONV_FULL_OUTPUT)
|
||||
status = __GCONV_OK;
|
||||
}
|
||||
}
|
||||
while (status == GCONV_OK);
|
||||
while (status == __GCONV_OK);
|
||||
|
||||
#ifdef END_LOOP
|
||||
END_LOOP
|
||||
#endif
|
||||
|
||||
/* We finished one use of this step. */
|
||||
++data->invocation_counter;
|
||||
++data->__invocation_counter;
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Generic conversion to and from 8bit charsets,
|
||||
converting from UCS using gaps.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -51,7 +51,7 @@ struct gap
|
||||
if (HAS_HOLES && ch == L'\0' && *inptr != '\0') \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -74,7 +74,7 @@ struct gap
|
||||
if (ch >= 0xffff) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
while (ch > rp->end) \
|
||||
@ -82,7 +82,7 @@ struct gap
|
||||
if (ch < rp->start) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -90,7 +90,7 @@ struct gap
|
||||
if (ch != 0 && res == '\0') \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generic conversion to and from 8bit charsets.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
if (HAS_HOLES && ch == L'\0' && *inptr != '\0') \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -59,7 +59,7 @@
|
||||
|| (ch != 0 && from_ucs4[ch] == '\0')) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generic conversion to and from ANSI_X3.110-1983.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -409,7 +409,7 @@ static const char from_ucs4[][2] =
|
||||
if (NEED_LENGTH_TEST && inptr + 1 >= inend) \
|
||||
{ \
|
||||
/* The second character is not available. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -418,7 +418,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch2 < 0x20 || ch2 >= 0x80) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -435,7 +435,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch == 0 && *inptr != '\0') \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -477,7 +477,7 @@ static const char from_ucs4[][2] =
|
||||
if (tmp[0] == '\0') \
|
||||
{ \
|
||||
/* Illegal characters. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
tmp[1] = '\0'; \
|
||||
@ -518,7 +518,7 @@ static const char from_ucs4[][2] =
|
||||
else \
|
||||
{ \
|
||||
/* Illegal characters. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -529,7 +529,7 @@ static const char from_ucs4[][2] =
|
||||
if (cp[0] == '\0' && ch != 0) \
|
||||
{ \
|
||||
/* Illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -542,7 +542,7 @@ static const char from_ucs4[][2] =
|
||||
{ \
|
||||
/* The result does not fit into the buffer. */ \
|
||||
--outptr; \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Mapping tables for Big5 handling.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -8441,7 +8441,7 @@ static const char from_ucs4_tab13[][2] =
|
||||
if (NEED_LENGTH_TEST && inptr + 1 >= inend) \
|
||||
{ \
|
||||
/* The second character is not available. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -8455,7 +8455,7 @@ static const char from_ucs4_tab13[][2] =
|
||||
else \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -8466,7 +8466,7 @@ static const char from_ucs4_tab13[][2] =
|
||||
if (ch == 0 && *inptr != '\0') \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -8566,7 +8566,7 @@ static const char from_ucs4_tab13[][2] =
|
||||
if (cp[0] == '\0' && ch != 0) \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -8574,7 +8574,7 @@ static const char from_ucs4_tab13[][2] =
|
||||
if (NEED_LENGTH_TEST && cp[1] != '\0' && outptr + 1 >= outend) \
|
||||
{ \
|
||||
/* We have not enough room. */ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Access functions for CNS 11643, plane 2 handling.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -35,46 +35,46 @@ cns11643_to_ucs4 (const char **s, size_t avail, unsigned char offset)
|
||||
int idx;
|
||||
|
||||
if (ch < offset || (ch - offset) <= 0x20 || (ch - offset) > 0x30)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (avail < 3)
|
||||
return 0;
|
||||
|
||||
ch2 = (*s)[1];
|
||||
if ((ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
ch3 = (*s)[2];
|
||||
if ((ch3 - offset) <= 0x20 || (ch3 - offset) >= 0x7f)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
idx = (ch2 - 0x21 - offset) * 94 + (ch3 - 0x21 - offset);
|
||||
|
||||
if ((ch - 0x21 - offset) == 1)
|
||||
{
|
||||
if (idx > 0x2196)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
result = __cns11643l1_to_ucs4_tab[idx];
|
||||
}
|
||||
else if ((ch - 0x21 - offset) == 2)
|
||||
{
|
||||
if (idx > 0x1de1)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
result = __cns11643l2_to_ucs4_tab[idx];
|
||||
}
|
||||
else if ((ch - 0x21 - offset) == 0xe)
|
||||
{
|
||||
if (idx > 0x19bd)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
result = __cns11643l14_to_ucs4_tab[idx];
|
||||
}
|
||||
else
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (result != L'\0')
|
||||
(*s) += 3;
|
||||
else
|
||||
result = UNKNOWN_10646_CHAR;
|
||||
result = __UNKNOWN_10646_CHAR;
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -200,11 +200,11 @@ ucs4_to_cns11643 (uint32_t wch, char *s, size_t avail)
|
||||
cp = "\x22\x64";
|
||||
break;
|
||||
default:
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
}
|
||||
|
||||
if (cp[0] == '\0')
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (avail < needed)
|
||||
return 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Access functions for CNS 11643, plane 1 handling.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -33,22 +33,22 @@ cns11643l1_to_ucs4 (const char **s, size_t avail, unsigned char offset)
|
||||
int idx;
|
||||
|
||||
if (ch < offset || (ch - offset) <= 0x20 || (ch - offset) > 0x7d)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (avail < 2)
|
||||
return 0;
|
||||
|
||||
ch2 = (*s)[1];
|
||||
if ((ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
idx = (ch - 0x21 - offset) * 94 + (ch2 - 0x21 - offset);
|
||||
if (idx > 0x2196)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
(*s) += 2;
|
||||
|
||||
return __cns11643l1_to_ucs4_tab[idx] ?: ((*s) -= 2, UNKNOWN_10646_CHAR);
|
||||
return __cns11643l1_to_ucs4_tab[idx] ?: ((*s) -= 2, __UNKNOWN_10646_CHAR);
|
||||
}
|
||||
|
||||
|
||||
@ -163,11 +163,11 @@ ucs4_to_cns11643l1 (uint32_t wch, char *s, size_t avail)
|
||||
cp = "\x22\x64";
|
||||
break;
|
||||
default:
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
}
|
||||
|
||||
if (cp[0] == '\0')
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (avail < 2)
|
||||
return 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Mapping tables for EUC-CN handling.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
if ((ch <= 0xa0 || ch > 0xfe) && ch != 0x8e && ch != 0x8f) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -60,7 +60,7 @@
|
||||
{ \
|
||||
/* The second character is not available. Store \
|
||||
the intermediate result. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -70,7 +70,7 @@
|
||||
if (ch < 0xa1) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -78,10 +78,10 @@
|
||||
endp = inptr; \
|
||||
\
|
||||
ch = gb2312_to_ucs4 (&endp, 2, 0x80); \
|
||||
if (ch == UNKNOWN_10646_CHAR) \
|
||||
if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -114,10 +114,10 @@
|
||||
? outend - outptr : MAX_NEEDED_OUTPUT)); \
|
||||
if (!NEED_LENGTH_TEST || found != 0) \
|
||||
{ \
|
||||
if (found == UNKNOWN_10646_CHAR) \
|
||||
if (found == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -128,7 +128,7 @@
|
||||
else \
|
||||
{ \
|
||||
/* We ran out of space. */ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Mapping tables for EUC-JP handling.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
else if ((ch <= 0xa0 || ch > 0xfe) && ch != 0x8e && ch != 0x8f) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -62,7 +62,7 @@
|
||||
{ \
|
||||
/* The second character is not available. Store the \
|
||||
intermediate result. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -72,7 +72,7 @@
|
||||
if (ch2 < 0xa1) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -108,13 +108,13 @@
|
||||
if (NEED_LENGTH_TEST && ch == 0) \
|
||||
{ \
|
||||
/* Not enough input available. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
if (ch == UNKNOWN_10646_CHAR) \
|
||||
if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
inptr = endp; \
|
||||
@ -152,12 +152,12 @@
|
||||
/* See whether we have room for at least two characters. */ \
|
||||
if (NEED_LENGTH_TEST && outptr + 1 >= outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
found = ucs4_to_jisx0201 (ch, outptr + 1); \
|
||||
if (found != UNKNOWN_10646_CHAR) \
|
||||
if (found != __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* Yes, it's a JIS 0201 character. Store the shift byte. */ \
|
||||
*outptr = 0x8e; \
|
||||
@ -168,7 +168,7 @@
|
||||
/* No JIS 0201 character. */ \
|
||||
found = ucs4_to_jisx0208 (ch, outptr, 2); \
|
||||
/* Please note that we always have enough room for the output. */ \
|
||||
if (found != UNKNOWN_10646_CHAR) \
|
||||
if (found != __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* It's a JIS 0208 character, adjust it for EUC-JP. */ \
|
||||
*outptr++ += 0x80; \
|
||||
@ -184,10 +184,10 @@
|
||||
if (found == 0) \
|
||||
{ \
|
||||
/* We ran out of space. */ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
else if (found != UNKNOWN_10646_CHAR) \
|
||||
else if (found != __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* It's a JIS 0212 character, adjust it for EUC-JP. */ \
|
||||
*outptr++ = 0x8f; \
|
||||
@ -197,7 +197,7 @@
|
||||
else \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Mapping tables for EUC-KR handling.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Jungshik Shin <jshin@pantheon.yale.edu>
|
||||
and Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
@ -28,7 +28,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
|
||||
{
|
||||
if (ch > 0x7f)
|
||||
{
|
||||
if (ucs4_to_ksc5601 (ch, cp, 2) != UNKNOWN_10646_CHAR)
|
||||
if (ucs4_to_ksc5601 (ch, cp, 2) != __UNKNOWN_10646_CHAR)
|
||||
{
|
||||
cp[0] |= 0x80;
|
||||
cp[1] |= 0x80;
|
||||
@ -79,7 +79,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
|
||||
else if (ch <= 0xa0 || ch > 0xfe || ch == 0xc9) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -91,13 +91,13 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
|
||||
if (NEED_LENGTH_TEST && ch == 0) \
|
||||
{ \
|
||||
/* The second character is not available. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
if (ch == UNKNOWN_10646_CHAR) \
|
||||
if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -124,7 +124,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
|
||||
if (cp[0] == '\0' && ch != 0) \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -136,7 +136,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
|
||||
{ \
|
||||
/* The result does not fit into the buffer. */ \
|
||||
--outptr; \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
*outptr++ = cp[1]; \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Mapping tables for EUC-TW handling.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
else if ((ch <= 0xa0 || ch > 0xfe) && ch != 0x8e) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -61,7 +61,7 @@
|
||||
{ \
|
||||
/* The second character is not available. Store the \
|
||||
intermediate result. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -71,7 +71,7 @@
|
||||
if (ch2 < 0xa1 || ch2 == 0xff) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -85,10 +85,10 @@
|
||||
0x80); \
|
||||
/* Please note that we need not test for the missing input \
|
||||
characters here anymore. */ \
|
||||
if (ch == UNKNOWN_10646_CHAR) \
|
||||
if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* Illegal input. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -104,10 +104,10 @@
|
||||
0x80); \
|
||||
/* Please note that we need not test for the missing input \
|
||||
characters here anymore. */ \
|
||||
if (ch == UNKNOWN_10646_CHAR) \
|
||||
if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* Illegal input. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -142,10 +142,10 @@
|
||||
if (NEED_LENGTH_TEST && found == 0) \
|
||||
{ \
|
||||
/* We ran out of space. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
if (found != UNKNOWN_10646_CHAR) \
|
||||
if (found != __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* It's a CNS 11643, plane 1 character, adjust it for EUC-TW. */ \
|
||||
*outptr++ += 0x80; \
|
||||
@ -161,13 +161,13 @@
|
||||
if (NEED_LENGTH_TEST && found == 0) \
|
||||
{ \
|
||||
/* We ran out of space. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
if (found == UNKNOWN_10646_CHAR) \
|
||||
if (found == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* No legal input. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Access functions for GB2312 conversion.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -37,22 +37,22 @@ gb2312_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
|
||||
int idx;
|
||||
|
||||
if (ch < offset || (ch - offset) <= 0x20 || (ch - offset) > 0x77)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (avail < 2)
|
||||
return 0;
|
||||
|
||||
ch2 = (*s)[1];
|
||||
if ((ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
idx = (ch - 0x21 - offset) * 94 + (ch2 - 0x21 - offset);
|
||||
if (idx > 0x1ff1)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
(*s) += 2;
|
||||
|
||||
return __gb2312_to_ucs[idx] ?: ((*s) -= 2, UNKNOWN_10646_CHAR);
|
||||
return __gb2312_to_ucs[idx] ?: ((*s) -= 2, __UNKNOWN_10646_CHAR);
|
||||
}
|
||||
|
||||
|
||||
@ -210,11 +210,11 @@ ucs4_to_gb2312 (uint32_t wch, unsigned char *s, size_t avail)
|
||||
cp = "\x23\x24";
|
||||
break;
|
||||
default:
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
}
|
||||
|
||||
if (cp[0] == '\0')
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
assert (cp[1] != '\0');
|
||||
|
||||
|
@ -53,10 +53,10 @@ struct gap
|
||||
#define MAX_NEEDED_TO 4
|
||||
#define FROM_DIRECTION (dir == from_iso2022jp)
|
||||
#define PREPARE_LOOP \
|
||||
enum direction dir = ((struct iso2022jp_data *) step->data)->dir; \
|
||||
enum variant var = ((struct iso2022jp_data *) step->data)->var; \
|
||||
enum direction dir = ((struct iso2022jp_data *) step->__data)->dir; \
|
||||
enum variant var = ((struct iso2022jp_data *) step->__data)->var; \
|
||||
int save_set; \
|
||||
int *setp = &data->statep->count;
|
||||
int *setp = &data->__statep->count;
|
||||
#define EXTRA_LOOP_ARGS , var, setp
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ enum
|
||||
|
||||
|
||||
int
|
||||
gconv_init (struct gconv_step *step)
|
||||
gconv_init (struct __gconv_step *step)
|
||||
{
|
||||
/* Determine which direction. */
|
||||
struct iso2022jp_data *new_data;
|
||||
@ -117,59 +117,59 @@ gconv_init (struct gconv_step *step)
|
||||
enum variant var = illegal_var;
|
||||
int result;
|
||||
|
||||
if (__strcasecmp (step->from_name, "ISO-2022-JP//") == 0)
|
||||
if (__strcasecmp (step->__from_name, "ISO-2022-JP//") == 0)
|
||||
{
|
||||
dir = from_iso2022jp;
|
||||
var = iso2022jp;
|
||||
}
|
||||
else if (__strcasecmp (step->to_name, "ISO-2022-JP//") == 0)
|
||||
else if (__strcasecmp (step->__to_name, "ISO-2022-JP//") == 0)
|
||||
{
|
||||
dir = to_iso2022jp;
|
||||
var = iso2022jp;
|
||||
}
|
||||
else if (__strcasecmp (step->from_name, "ISO-2022-JP-2//") == 0)
|
||||
else if (__strcasecmp (step->__from_name, "ISO-2022-JP-2//") == 0)
|
||||
{
|
||||
dir = from_iso2022jp;
|
||||
var = iso2022jp2;
|
||||
}
|
||||
else if (__strcasecmp (step->to_name, "ISO-2022-JP-2//") == 0)
|
||||
else if (__strcasecmp (step->__to_name, "ISO-2022-JP-2//") == 0)
|
||||
{
|
||||
dir = to_iso2022jp;
|
||||
var = iso2022jp2;
|
||||
}
|
||||
|
||||
result = GCONV_NOCONV;
|
||||
result = __GCONV_NOCONV;
|
||||
if (dir != illegal_dir)
|
||||
{
|
||||
new_data
|
||||
= (struct iso2022jp_data *) malloc (sizeof (struct iso2022jp_data));
|
||||
|
||||
result = GCONV_NOMEM;
|
||||
result = __GCONV_NOMEM;
|
||||
if (new_data != NULL)
|
||||
{
|
||||
new_data->dir = dir;
|
||||
new_data->var = var;
|
||||
step->data = new_data;
|
||||
step->__data = new_data;
|
||||
|
||||
if (dir == from_iso2022jp)
|
||||
{
|
||||
step->min_needed_from = MIN_NEEDED_FROM;
|
||||
step->max_needed_from = MAX_NEEDED_FROM;
|
||||
step->min_needed_to = MIN_NEEDED_TO;
|
||||
step->max_needed_to = MAX_NEEDED_TO;
|
||||
step->__min_needed_from = MIN_NEEDED_FROM;
|
||||
step->__max_needed_from = MAX_NEEDED_FROM;
|
||||
step->__min_needed_to = MIN_NEEDED_TO;
|
||||
step->__max_needed_to = MAX_NEEDED_TO;
|
||||
}
|
||||
else
|
||||
{
|
||||
step->min_needed_from = MIN_NEEDED_TO;
|
||||
step->max_needed_from = MAX_NEEDED_TO;
|
||||
step->min_needed_to = MIN_NEEDED_FROM;
|
||||
step->max_needed_to = MAX_NEEDED_FROM + 2;
|
||||
step->__min_needed_from = MIN_NEEDED_TO;
|
||||
step->__max_needed_from = MAX_NEEDED_TO;
|
||||
step->__min_needed_to = MIN_NEEDED_FROM;
|
||||
step->__max_needed_to = MAX_NEEDED_FROM + 2;
|
||||
}
|
||||
|
||||
/* Yes, this is a stateful encoding. */
|
||||
step->stateful = 1;
|
||||
step->__stateful = 1;
|
||||
|
||||
result = GCONV_OK;
|
||||
result = __GCONV_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,9 +178,9 @@ gconv_init (struct gconv_step *step)
|
||||
|
||||
|
||||
void
|
||||
gconv_end (struct gconv_step *data)
|
||||
gconv_end (struct __gconv_step *data)
|
||||
{
|
||||
free (data->data);
|
||||
free (data->__data);
|
||||
}
|
||||
|
||||
|
||||
@ -188,33 +188,33 @@ gconv_end (struct gconv_step *data)
|
||||
the output state to the initial state. This has to be done during the
|
||||
flushing. */
|
||||
#define EMIT_SHIFT_TO_INIT \
|
||||
if (data->statep->count != ASCII_set) \
|
||||
if (data->__statep->count != ASCII_set) \
|
||||
{ \
|
||||
enum direction dir = ((struct iso2022jp_data *) step->data)->dir; \
|
||||
enum direction dir = ((struct iso2022jp_data *) step->__data)->dir; \
|
||||
\
|
||||
if (dir == from_iso2022jp) \
|
||||
/* It's easy, we don't have to emit anything, we just reset the \
|
||||
state for the input. Note that this also clears the G2 \
|
||||
designation. */ \
|
||||
data->statep->count = ASCII_set; \
|
||||
data->__statep->count = ASCII_set; \
|
||||
else \
|
||||
{ \
|
||||
unsigned char *outbuf = data->outbuf; \
|
||||
unsigned char *outbuf = data->__outbuf; \
|
||||
\
|
||||
/* We are not in the initial state. To switch back we have \
|
||||
to emit the sequence `Esc ( B'. */ \
|
||||
if (outbuf + 3 > data->outbufend) \
|
||||
if (outbuf + 3 > data->__outbufend) \
|
||||
/* We don't have enough room in the output buffer. */ \
|
||||
status = GCONV_FULL_OUTPUT; \
|
||||
status = __GCONV_FULL_OUTPUT; \
|
||||
else \
|
||||
{ \
|
||||
/* Write out the shift sequence. */ \
|
||||
*outbuf++ = ESC; \
|
||||
*outbuf++ = '('; \
|
||||
*outbuf++ = 'B'; \
|
||||
data->outbuf = outbuf; \
|
||||
data->__outbuf = outbuf; \
|
||||
/* Note that this also clears the G2 designation. */ \
|
||||
data->statep->count = ASCII_set; \
|
||||
data->__statep->count = ASCII_set; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
@ -251,7 +251,7 @@ gconv_end (struct gconv_step *data)
|
||||
&& inptr + 3 >= inend)) \
|
||||
{ \
|
||||
/* Not enough input available. */ \
|
||||
result = GCONV_EMPTY_INPUT; \
|
||||
result = __GCONV_EMPTY_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -354,20 +354,20 @@ gconv_end (struct gconv_step *data)
|
||||
/* We use the table from the ISO 8859-7 module. */ \
|
||||
if (inptr[2] < 0x20 || inptr[2] > 0x80) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
ch = iso88597_to_ucs4[inptr[2] - 0x20]; \
|
||||
if (ch == 0) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
inptr += 3; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -378,9 +378,9 @@ gconv_end (struct gconv_step *data)
|
||||
{ \
|
||||
/* Use the JIS X 0201 table. */ \
|
||||
ch = jisx0201_to_ucs4 (ch); \
|
||||
if (ch == UNKNOWN_10646_CHAR) \
|
||||
if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
++inptr; \
|
||||
@ -389,9 +389,9 @@ gconv_end (struct gconv_step *data)
|
||||
{ \
|
||||
/* Use the JIS X 0201 table. */ \
|
||||
ch = jisx0201_to_ucs4 (ch + 0x80); \
|
||||
if (ch == UNKNOWN_10646_CHAR) \
|
||||
if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
++inptr; \
|
||||
@ -424,12 +424,12 @@ gconv_end (struct gconv_step *data)
|
||||
\
|
||||
if (NEED_LENGTH_TEST && ch == 0) \
|
||||
{ \
|
||||
result = GCONV_EMPTY_INPUT; \
|
||||
result = __GCONV_EMPTY_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else if (ch == UNKNOWN_10646_CHAR) \
|
||||
else if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -474,25 +474,27 @@ gconv_end (struct gconv_step *data)
|
||||
{ \
|
||||
unsigned char buf[2]; \
|
||||
written = ucs4_to_jisx0201 (ch, buf); \
|
||||
if (written != UNKNOWN_10646_CHAR && buf[0] > 0x20 && buf[0] < 0x80) \
|
||||
if (written != __UNKNOWN_10646_CHAR && buf[0] > 0x20 \
|
||||
&& buf[0] < 0x80) \
|
||||
{ \
|
||||
*outptr++ = buf[0]; \
|
||||
written = 1; \
|
||||
} \
|
||||
else \
|
||||
written = UNKNOWN_10646_CHAR; \
|
||||
written = __UNKNOWN_10646_CHAR; \
|
||||
} \
|
||||
else if (set == JISX0201_Kana_set) \
|
||||
{ \
|
||||
unsigned char buf[2]; \
|
||||
written = ucs4_to_jisx0201 (ch, buf); \
|
||||
if (written != UNKNOWN_10646_CHAR && buf[0] > 0xa0 && buf[0] < 0xe0) \
|
||||
if (written != __UNKNOWN_10646_CHAR && buf[0] > 0xa0 \
|
||||
&& buf[0] < 0xe0) \
|
||||
{ \
|
||||
*outptr++ = buf[0] - 0x80; \
|
||||
written = 1; \
|
||||
} \
|
||||
else \
|
||||
written = UNKNOWN_10646_CHAR; \
|
||||
written = __UNKNOWN_10646_CHAR; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
@ -518,14 +520,14 @@ gconv_end (struct gconv_step *data)
|
||||
\
|
||||
if (NEED_LENGTH_TEST && written == 0) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
else if (written != UNKNOWN_10646_CHAR) \
|
||||
else if (written != __UNKNOWN_10646_CHAR) \
|
||||
outptr += written; \
|
||||
} \
|
||||
\
|
||||
if (written == UNKNOWN_10646_CHAR || written == 0) \
|
||||
if (written == __UNKNOWN_10646_CHAR || written == 0) \
|
||||
{ \
|
||||
if (set2 == ISO88591_set) \
|
||||
{ \
|
||||
@ -557,7 +559,7 @@ gconv_end (struct gconv_step *data)
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if (written == UNKNOWN_10646_CHAR || written == 0) \
|
||||
if (written == __UNKNOWN_10646_CHAR || written == 0) \
|
||||
{ \
|
||||
/* Either this is an unknown character or we have to switch \
|
||||
the currently selected character set. The character sets \
|
||||
@ -576,7 +578,7 @@ gconv_end (struct gconv_step *data)
|
||||
escape sequence. */ \
|
||||
if (NEED_LENGTH_TEST && outptr + 4 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -600,12 +602,12 @@ gconv_end (struct gconv_step *data)
|
||||
unsigned char buf[2]; \
|
||||
\
|
||||
written = ucs4_to_jisx0201 (ch, buf); \
|
||||
if (written != UNKNOWN_10646_CHAR && buf[0] < 0x80) \
|
||||
if (written != __UNKNOWN_10646_CHAR && buf[0] < 0x80) \
|
||||
{ \
|
||||
/* We use JIS X 0201. */ \
|
||||
if (NEED_LENGTH_TEST && outptr + 4 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -618,12 +620,12 @@ gconv_end (struct gconv_step *data)
|
||||
else \
|
||||
{ \
|
||||
written = ucs4_to_jisx0208 (ch, buf, 2); \
|
||||
if (written != UNKNOWN_10646_CHAR) \
|
||||
if (written != __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* We use JIS X 0208. */ \
|
||||
if (NEED_LENGTH_TEST && outptr + 5 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -637,18 +639,18 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == iso2022jp) \
|
||||
{ \
|
||||
/* We have no other choice. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
written = ucs4_to_jisx0212 (ch, buf, 2); \
|
||||
if (written != UNKNOWN_10646_CHAR) \
|
||||
if (written != __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* We use JIS X 0212. */ \
|
||||
if (NEED_LENGTH_TEST && outptr + 6 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
*outptr++ = ESC; \
|
||||
@ -662,12 +664,13 @@ gconv_end (struct gconv_step *data)
|
||||
else \
|
||||
{ \
|
||||
written = ucs4_to_jisx0201 (ch, buf); \
|
||||
if (written != UNKNOWN_10646_CHAR && buf[0] >= 0x80) \
|
||||
if (written != __UNKNOWN_10646_CHAR \
|
||||
&& buf[0] >= 0x80) \
|
||||
{ \
|
||||
/* We use JIS X 0201. */ \
|
||||
if (NEED_LENGTH_TEST && outptr + 4 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -682,7 +685,7 @@ gconv_end (struct gconv_step *data)
|
||||
/* ISO 8859-1 upper half. */ \
|
||||
if (NEED_LENGTH_TEST && outptr + 6 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -697,12 +700,12 @@ gconv_end (struct gconv_step *data)
|
||||
else \
|
||||
{ \
|
||||
written = ucs4_to_gb2312 (ch, buf, 2); \
|
||||
if (written != UNKNOWN_10646_CHAR) \
|
||||
if (written != __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* We use GB 2312. */ \
|
||||
if (NEED_LENGTH_TEST && outptr + 5 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -716,13 +719,13 @@ gconv_end (struct gconv_step *data)
|
||||
else \
|
||||
{ \
|
||||
written = ucs4_to_ksc5601 (ch, buf, 2); \
|
||||
if (written != UNKNOWN_10646_CHAR) \
|
||||
if (written != __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* We use KSC 5601. */ \
|
||||
if (NEED_LENGTH_TEST \
|
||||
&& outptr + 6 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
*outptr++ = ESC; \
|
||||
@ -752,7 +755,7 @@ gconv_end (struct gconv_step *data)
|
||||
if (NEED_LENGTH_TEST \
|
||||
&& outptr + 6 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
*outptr++ = ESC; \
|
||||
@ -765,7 +768,7 @@ gconv_end (struct gconv_step *data)
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
|
@ -44,12 +44,13 @@
|
||||
#define MAX_NEEDED_TO 4
|
||||
#define PREPARE_LOOP \
|
||||
int save_set; \
|
||||
int *setp = &data->statep->count; \
|
||||
if (!FROM_DIRECTION && !data->internal_use && data->invocation_counter == 0)\
|
||||
int *setp = &data->__statep->count; \
|
||||
if (!FROM_DIRECTION && !data->__internal_use \
|
||||
&& data->__invocation_counter == 0) \
|
||||
{ \
|
||||
/* Emit the designator sequence. */ \
|
||||
if (outbuf + 4 > outend) \
|
||||
return GCONV_FULL_OUTPUT; \
|
||||
return __GCONV_FULL_OUTPUT; \
|
||||
\
|
||||
*outbuf++ = ESC; \
|
||||
*outbuf++ = '$'; \
|
||||
@ -72,27 +73,27 @@ enum
|
||||
the output state to the initial state. This has to be done during the
|
||||
flushing. */
|
||||
#define EMIT_SHIFT_TO_INIT \
|
||||
if (data->statep->count != ASCII_set) \
|
||||
if (data->__statep->count != ASCII_set) \
|
||||
{ \
|
||||
if (FROM_DIRECTION) \
|
||||
/* It's easy, we don't have to emit anything, we just reset the \
|
||||
state for the input. */ \
|
||||
data->statep->count = ASCII_set; \
|
||||
data->__statep->count = ASCII_set; \
|
||||
else \
|
||||
{ \
|
||||
unsigned char *outbuf = data->outbuf; \
|
||||
unsigned char *outbuf = data->__outbuf; \
|
||||
\
|
||||
/* We are not in the initial state. To switch back we have \
|
||||
to emit `SI'. */ \
|
||||
if (outbuf == data->outbufend) \
|
||||
if (outbuf == data->__outbufend) \
|
||||
/* We don't have enough room in the output buffer. */ \
|
||||
status = GCONV_FULL_OUTPUT; \
|
||||
status = __GCONV_FULL_OUTPUT; \
|
||||
else \
|
||||
{ \
|
||||
/* Write out the shift sequence. */ \
|
||||
*outbuf++ = SI; \
|
||||
data->outbuf = outbuf; \
|
||||
data->statep->count = ASCII_set; \
|
||||
data->__outbuf = outbuf; \
|
||||
data->__statep->count = ASCII_set; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
@ -119,7 +120,7 @@ enum
|
||||
/* This is a 7bit character set, disallow all 8bit characters. */ \
|
||||
if (ch > 0x7f) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -136,7 +137,7 @@ enum
|
||||
|| (inptr[2] == ')' && inptr + 3 > inend)))) \
|
||||
\
|
||||
{ \
|
||||
result = GCONV_EMPTY_INPUT; \
|
||||
result = __GCONV_EMPTY_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
if (inptr[1] == '$' && inptr[2] == ')' && inptr[3] == 'C') \
|
||||
@ -165,7 +166,7 @@ enum
|
||||
{ \
|
||||
if (ch >= 0x80) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
/* Almost done, just advance the input pointer. */ \
|
||||
@ -181,12 +182,12 @@ enum
|
||||
\
|
||||
if (NEED_LENGTH_TEST && ch == 0) \
|
||||
{ \
|
||||
result = GCONV_EMPTY_INPUT; \
|
||||
result = __GCONV_EMPTY_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else if (ch == UNKNOWN_10646_CHAR) \
|
||||
else if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -221,7 +222,7 @@ enum
|
||||
set = ASCII_set; \
|
||||
if (NEED_LENGTH_TEST && outptr == outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -235,10 +236,10 @@ enum
|
||||
\
|
||||
written = ucs4_to_ksc5601 (ch, buf, 2); \
|
||||
\
|
||||
if (written == UNKNOWN_10646_CHAR) \
|
||||
if (written == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
assert (written == 2); \
|
||||
@ -252,7 +253,7 @@ enum
|
||||
\
|
||||
if (NEED_LENGTH_TEST && outptr + 2 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Conversion to and from the various ISO 646 CCS.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -45,8 +45,8 @@
|
||||
#define MIN_NEEDED_TO 4
|
||||
#define FROM_DIRECTION (dir == from_iso646)
|
||||
#define PREPARE_LOOP \
|
||||
enum direction dir = ((struct iso646_data *) step->data)->dir; \
|
||||
enum variant var = ((struct iso646_data *) step->data)->var;
|
||||
enum direction dir = ((struct iso646_data *) step->__data)->dir; \
|
||||
enum variant var = ((struct iso646_data *) step->__data)->var;
|
||||
#define EXTRA_LOOP_ARGS , var
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ struct iso646_data
|
||||
|
||||
|
||||
int
|
||||
gconv_init (struct gconv_step *step)
|
||||
gconv_init (struct __gconv_step *step)
|
||||
{
|
||||
/* Determine which direction. */
|
||||
struct iso646_data *new_data;
|
||||
@ -133,47 +133,47 @@ gconv_init (struct gconv_step *step)
|
||||
int result;
|
||||
|
||||
for (var = sizeof (names) / sizeof (names[0]) - 1; var > illegal_var; --var)
|
||||
if (__strcasecmp (step->from_name, names[var]) == 0)
|
||||
if (__strcasecmp (step->__from_name, names[var]) == 0)
|
||||
{
|
||||
dir = from_iso646;
|
||||
break;
|
||||
}
|
||||
else if (__strcasecmp (step->to_name, names[var]) == 0)
|
||||
else if (__strcasecmp (step->__to_name, names[var]) == 0)
|
||||
{
|
||||
dir = to_iso646;
|
||||
break;
|
||||
}
|
||||
|
||||
result = GCONV_NOCONV;
|
||||
result = __GCONV_NOCONV;
|
||||
if (dir != illegal_dir)
|
||||
{
|
||||
new_data = (struct iso646_data *) malloc (sizeof (struct iso646_data));
|
||||
|
||||
result = GCONV_NOMEM;
|
||||
result = __GCONV_NOMEM;
|
||||
if (new_data != NULL)
|
||||
{
|
||||
new_data->dir = dir;
|
||||
new_data->var = var;
|
||||
step->data = new_data;
|
||||
step->__data = new_data;
|
||||
|
||||
if (var == from_iso646)
|
||||
{
|
||||
step->min_needed_from = MIN_NEEDED_FROM;
|
||||
step->max_needed_from = MIN_NEEDED_FROM;
|
||||
step->min_needed_to = MIN_NEEDED_TO;
|
||||
step->max_needed_to = MIN_NEEDED_TO;
|
||||
step->__min_needed_from = MIN_NEEDED_FROM;
|
||||
step->__max_needed_from = MIN_NEEDED_FROM;
|
||||
step->__min_needed_to = MIN_NEEDED_TO;
|
||||
step->__max_needed_to = MIN_NEEDED_TO;
|
||||
}
|
||||
else
|
||||
{
|
||||
step->min_needed_from = MIN_NEEDED_TO;
|
||||
step->max_needed_from = MIN_NEEDED_TO;
|
||||
step->min_needed_to = MIN_NEEDED_FROM;
|
||||
step->max_needed_to = MIN_NEEDED_FROM;
|
||||
step->__min_needed_from = MIN_NEEDED_TO;
|
||||
step->__max_needed_from = MIN_NEEDED_TO;
|
||||
step->__min_needed_to = MIN_NEEDED_FROM;
|
||||
step->__max_needed_to = MIN_NEEDED_FROM;
|
||||
}
|
||||
|
||||
step->stateful = 0;
|
||||
step->__stateful = 0;
|
||||
|
||||
result = GCONV_OK;
|
||||
result = __GCONV_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,9 +182,9 @@ gconv_init (struct gconv_step *step)
|
||||
|
||||
|
||||
void
|
||||
gconv_end (struct gconv_step *data)
|
||||
gconv_end (struct __gconv_step *data)
|
||||
{
|
||||
free (data->data);
|
||||
free (data->__data);
|
||||
}
|
||||
|
||||
|
||||
@ -195,7 +195,7 @@ gconv_end (struct gconv_step *data)
|
||||
#define BODY \
|
||||
{ \
|
||||
uint32_t ch; \
|
||||
int failure = GCONV_OK; \
|
||||
int failure = __GCONV_OK; \
|
||||
\
|
||||
ch = *inptr; \
|
||||
switch (ch) \
|
||||
@ -308,7 +308,7 @@ gconv_end (struct gconv_step *data)
|
||||
ch = 0xf9; \
|
||||
else if (var == JP_OCR_B) \
|
||||
/* Illegal character. */ \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
else if (var == YU) \
|
||||
ch = 0x17e; \
|
||||
else if (var == HU) \
|
||||
@ -382,7 +382,7 @@ gconv_end (struct gconv_step *data)
|
||||
ch = 0xec; \
|
||||
else if (var == JP_OCR_B) \
|
||||
/* Illegal character. */ \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
else if (var == YU) \
|
||||
ch = 0x10d; \
|
||||
else if (var == HU) \
|
||||
@ -398,13 +398,13 @@ gconv_end (struct gconv_step *data)
|
||||
break; \
|
||||
case 0x80 ... 0xff: \
|
||||
/* Illegal character. */ \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
/* Hopefully gcc can recognize that the following `if' is only true \
|
||||
when we reach the default case in the `switch' statement. */ \
|
||||
if (failure == GCONV_ILLEGAL_INPUT) \
|
||||
if (failure == __GCONV_ILLEGAL_INPUT) \
|
||||
{ \
|
||||
/* Exit the loop with an error. */ \
|
||||
result = failure; \
|
||||
@ -424,7 +424,7 @@ gconv_end (struct gconv_step *data)
|
||||
#define BODY \
|
||||
{ \
|
||||
unsigned char ch; \
|
||||
int failure = GCONV_OK; \
|
||||
int failure = __GCONV_OK; \
|
||||
\
|
||||
ch = *((uint32_t *) inptr); \
|
||||
switch (*((uint32_t *) inptr)) \
|
||||
@ -432,17 +432,17 @@ gconv_end (struct gconv_step *data)
|
||||
case 0x23: \
|
||||
if (var == GB || var == ES || var == IT || var == FR || var == FR1 \
|
||||
|| var == NO2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x24: \
|
||||
if (var == CN || var == HU || var == CU || var == SE || var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x40: \
|
||||
if (var == CA || var == CA2 || var == DE || var == ES || var == ES2 \
|
||||
|| var == IT || var == YU || var == HU || var == FR || var == FR1 \
|
||||
|| var == PT || var == PT2 || var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x5b: \
|
||||
if (var == CA || var == CA2 || var == DE || var == DK || var == ES \
|
||||
@ -450,7 +450,7 @@ gconv_end (struct gconv_step *data)
|
||||
|| var == HU || var == FR || var == FR1 || var == NO \
|
||||
|| var == NO2 || var == PT || var == PT2 || var == SE \
|
||||
|| var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
else if (var == CU) \
|
||||
ch = 0x7d; \
|
||||
break; \
|
||||
@ -460,7 +460,7 @@ gconv_end (struct gconv_step *data)
|
||||
|| var == YU || var == KR || var == HU || var == CU || var == FR \
|
||||
|| var == FR1 || var == NO || var == NO2 || var == PT \
|
||||
|| var == PT2 || var == SE || var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x5d: \
|
||||
if (var == CA || var == CA2 || var == DE || var == DK || var == ES \
|
||||
@ -468,17 +468,17 @@ gconv_end (struct gconv_step *data)
|
||||
|| var == HU || var == FR || var == FR1 || var == NO \
|
||||
|| var == NO2 || var == PT || var == PT2 || var == SE \
|
||||
|| var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x5e: \
|
||||
if (var == CA || var == CA2 || var == ES2 || var == YU || var == CU \
|
||||
|| var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x60: \
|
||||
if (var == CA || var == CA2 || var == IT || var == JP_OCR_B \
|
||||
|| var == YU || var == HU || var == FR || var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x7b: \
|
||||
if (var == CA || var == CA2 || var == DE || var == DK || var == ES \
|
||||
@ -486,14 +486,14 @@ gconv_end (struct gconv_step *data)
|
||||
|| var == CU || var == FR || var == FR1 || var == NO \
|
||||
|| var == NO2 || var == PT || var == PT2 || var == SE \
|
||||
|| var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x7c: \
|
||||
if (var == CA || var == CA2 || var == DE || var == DK || var == ES \
|
||||
|| var == ES2 || var == IT || var == YU || var == HU || var == CU \
|
||||
|| var == FR || var == FR1 || var == NO || var == PT \
|
||||
|| var == PT2 || var == SE || var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
else if (var == NO2) \
|
||||
ch = 0x7e; \
|
||||
break; \
|
||||
@ -502,7 +502,7 @@ gconv_end (struct gconv_step *data)
|
||||
|| var == ES2 || var == IT || var == YU || var == HU || var == CU \
|
||||
|| var == FR || var == FR1 || var == NO || var == NO2 \
|
||||
|| var == PT || var == PT2 || var == SE || var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x7e: \
|
||||
if (var == GB || var == CA || var == CA2 || var == DE || var == ES2 \
|
||||
@ -510,21 +510,21 @@ gconv_end (struct gconv_step *data)
|
||||
|| var == YU || var == HU || var == CU || var == FR || var == FR1 \
|
||||
|| var == NO || var == NO2 || var == PT || var == SE \
|
||||
|| var == SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xa1: \
|
||||
if (var != ES && var != ES2 && var != CU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5b; \
|
||||
break; \
|
||||
case 0xa3: \
|
||||
if (var != GB && var != ES && var != IT && var != FR && var != FR1) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x23; \
|
||||
break; \
|
||||
case 0xa4: \
|
||||
if (var != HU && var != CU && var != SE && var != SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x24; \
|
||||
break; \
|
||||
case 0xa5: \
|
||||
@ -533,7 +533,7 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == JP || var == JP_OCR_B) \
|
||||
ch = 0x5c; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xa7: \
|
||||
if (var == DE || var == ES || var == IT || var == PT) \
|
||||
@ -543,11 +543,11 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == NO2) \
|
||||
ch = 0x23; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xa8: \
|
||||
if (var != ES2 && var != CU && var != FR && var != FR1) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7e; \
|
||||
break; \
|
||||
case 0xb0: \
|
||||
@ -558,7 +558,7 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == PT) \
|
||||
ch = 0x7e; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xb4: \
|
||||
if (var == ES2 || var == CU) \
|
||||
@ -566,11 +566,11 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == PT2) \
|
||||
ch = 0x40; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xb5: \
|
||||
if (var != FR) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x60; \
|
||||
break; \
|
||||
case 0xbf: \
|
||||
@ -579,31 +579,31 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == ES2 || var == CU) \
|
||||
ch = 0x5e; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xc1: \
|
||||
if (var != HU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x40; \
|
||||
break; \
|
||||
case 0xc3: \
|
||||
if (var != PT && var != PT2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5b; \
|
||||
break; \
|
||||
case 0xc4: \
|
||||
if (var != DE && var != SE && var != SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5b; \
|
||||
break; \
|
||||
case 0xc5: \
|
||||
if (var != DK && var != NO && var != NO2 && var != SE && var != SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5d; \
|
||||
break; \
|
||||
case 0xc6: \
|
||||
if (var != DK && var != NO && var != NO2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5b; \
|
||||
break; \
|
||||
case 0xc7: \
|
||||
@ -612,7 +612,7 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == PT || var == PT2) \
|
||||
ch = 0x5c; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xc9: \
|
||||
if (var == CA2) \
|
||||
@ -622,26 +622,26 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == SE2) \
|
||||
ch = 0x40; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xd1: \
|
||||
if (var != ES && var != ES2 && var != CU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5c; \
|
||||
break; \
|
||||
case 0xd5: \
|
||||
if (var != PT && var != PT2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5d; \
|
||||
break; \
|
||||
case 0xd6: \
|
||||
if (var != DE && var != HU && var != SE && var != SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5c; \
|
||||
break; \
|
||||
case 0xd8: \
|
||||
if (var != DK && var != NO && var != NO2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5c; \
|
||||
break; \
|
||||
case 0xdc: \
|
||||
@ -650,11 +650,11 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == SE2) \
|
||||
ch = 0x5e; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xdf: \
|
||||
if (var != DE) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7e; \
|
||||
break; \
|
||||
case 0xe0: \
|
||||
@ -663,36 +663,36 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == IT) \
|
||||
ch = 0x7b; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xe1: \
|
||||
if (var != HU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x60; \
|
||||
break; \
|
||||
case 0xe2: \
|
||||
if (var != CA && var != CA2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5b; \
|
||||
break; \
|
||||
case 0xe3: \
|
||||
if (var != PT && var != PT2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7b; \
|
||||
break; \
|
||||
case 0xe4: \
|
||||
if (var != DE && var != SE && var != SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7b; \
|
||||
break; \
|
||||
case 0xe5: \
|
||||
if (var != DK && var != NO && var != NO2 && var != SE && var != SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7d; \
|
||||
break; \
|
||||
case 0xe6: \
|
||||
if (var != DK && var != NO && var != NO2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7b; \
|
||||
break; \
|
||||
case 0xe7: \
|
||||
@ -703,11 +703,11 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == PT || var == PT2) \
|
||||
ch = 0x7c; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xe8: \
|
||||
if (var != CA && var != CA2 && var != IT && var != FR && var != FR1) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7d; \
|
||||
break; \
|
||||
case 0xe9: \
|
||||
@ -718,51 +718,51 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == SE2) \
|
||||
ch = 0x60; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xea: \
|
||||
if (var != CA && var != CA2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5d; \
|
||||
break; \
|
||||
case 0xec: \
|
||||
if (var != IT) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7e; \
|
||||
break; \
|
||||
case 0xee: \
|
||||
if (var != CA) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5e; \
|
||||
break; \
|
||||
case 0xf1: \
|
||||
if (var != ES && var != ES2 && var != CU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7c; \
|
||||
break; \
|
||||
case 0xf2: \
|
||||
if (var != IT) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7c; \
|
||||
break; \
|
||||
case 0xf4: \
|
||||
if (var != CA && var != CA2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x60; \
|
||||
break; \
|
||||
case 0xf5: \
|
||||
if (var != PT && var != PT2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7d; \
|
||||
break; \
|
||||
case 0xf6: \
|
||||
if (var != DE && var != HU && var != SE && var != SE2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7c; \
|
||||
break; \
|
||||
case 0xf8: \
|
||||
if (var != DK && var != NO && var != NO2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7c; \
|
||||
break; \
|
||||
case 0xf9: \
|
||||
@ -771,11 +771,11 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == IT) \
|
||||
ch = 0x60; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0xfb: \
|
||||
if (var != CA && var != CA2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7e; \
|
||||
break; \
|
||||
case 0xfc: \
|
||||
@ -784,95 +784,95 @@ gconv_end (struct gconv_step *data)
|
||||
else if (var == SE2) \
|
||||
ch = 0x7e; \
|
||||
else \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
case 0x160: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5b; \
|
||||
break; \
|
||||
case 0x106: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5d; \
|
||||
break; \
|
||||
case 0x107: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7d; \
|
||||
break; \
|
||||
case 0x10c: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5e; \
|
||||
break; \
|
||||
case 0x10d: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7e; \
|
||||
break; \
|
||||
case 0x110: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5c; \
|
||||
break; \
|
||||
case 0x111: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7c; \
|
||||
break; \
|
||||
case 0x161: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7b; \
|
||||
break; \
|
||||
case 0x17d: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x40; \
|
||||
break; \
|
||||
case 0x17e: \
|
||||
if (var != YU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x60; \
|
||||
break; \
|
||||
case 0x2dd: \
|
||||
if (var != HU) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7e; \
|
||||
break; \
|
||||
case 0x2022: \
|
||||
if (var != ES2) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x40; \
|
||||
break; \
|
||||
case 0x203e: \
|
||||
if (var != GB && var != CN && var != JP && var != NO && var != SE) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x7e; \
|
||||
break; \
|
||||
case 0x20a9: \
|
||||
if (var != KR) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5c; \
|
||||
break; \
|
||||
case 0x2329: \
|
||||
if (var != JP_OCR_B) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5b; \
|
||||
break; \
|
||||
case 0x232a: \
|
||||
if (var != JP_OCR_B) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
ch = 0x5d; \
|
||||
break; \
|
||||
default: \
|
||||
if (*((uint32_t *) inptr) > 0x7f) \
|
||||
failure = GCONV_ILLEGAL_INPUT; \
|
||||
failure = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
if (failure == GCONV_ILLEGAL_INPUT) \
|
||||
if (failure == __GCONV_ILLEGAL_INPUT) \
|
||||
{ \
|
||||
/* Exit the loop with an error. */ \
|
||||
result = failure; \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Conversion to and from ISO 8859-1.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
if (ch > 0xff) \
|
||||
{ \
|
||||
/* We have an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
*outptr++ = (unsigned char) ch; \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generic conversion to and from ISO 6937-2.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -409,7 +409,7 @@ static const char from_ucs4[][2] =
|
||||
{ \
|
||||
/* The second character is not available. Store the \
|
||||
intermediate result. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -418,7 +418,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch2 < 0x20 || ch2 >= 0x80) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -427,7 +427,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch == 0) \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -440,7 +440,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch == 0 && *inptr != '\0') \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
++inptr; \
|
||||
@ -542,14 +542,14 @@ static const char from_ucs4[][2] =
|
||||
if (fail) \
|
||||
{ \
|
||||
/* Illegal characters. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
else if (from_ucs4[ch][0] == '\0' && ch != 0) \
|
||||
{ \
|
||||
/* Illegal characters. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -562,7 +562,7 @@ static const char from_ucs4[][2] =
|
||||
if (NEED_LENGTH_TEST && outptr >= outend) \
|
||||
{ \
|
||||
/* The result does not fit into the buffer. */ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
*outptr++ = cp[1]; \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generic conversion to and from ISO 6937.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -401,7 +401,7 @@ static const char from_ucs4[][2] =
|
||||
{ \
|
||||
/* The second character is not available. Store the \
|
||||
intermediate result. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -410,7 +410,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch2 < 0x20 || ch2 >= 0x80) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -419,7 +419,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch == 0) \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -432,7 +432,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch == 0 && *inptr != '\0') \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
++inptr; \
|
||||
@ -513,14 +513,14 @@ static const char from_ucs4[][2] =
|
||||
if (fail) \
|
||||
{ \
|
||||
/* Illegal characters. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
else if (from_ucs4[ch][0] == '\0' && ch != 0) \
|
||||
{ \
|
||||
/* Illegal characters. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -533,7 +533,7 @@ static const char from_ucs4[][2] =
|
||||
if (NEED_LENGTH_TEST && outptr >= outend) \
|
||||
{ \
|
||||
/* The result does not fit into the buffer. */ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
*outptr++ = cp[1]; \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Access functions for JISX0201 conversion.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -31,7 +31,7 @@ jisx0201_to_ucs4 (char ch)
|
||||
uint32_t val = __jisx0201_to_ucs4[(unsigned char) ch];
|
||||
|
||||
if (val == 0 && ch != '\0')
|
||||
val = UNKNOWN_10646_CHAR;
|
||||
val = __UNKNOWN_10646_CHAR;
|
||||
|
||||
return val;
|
||||
}
|
||||
@ -51,7 +51,7 @@ ucs4_to_jisx0201 (uint32_t wch, char *s)
|
||||
else if (wch >= 0xff61 && wch <= 0xff9f)
|
||||
ch = wch - 0xfec0;
|
||||
else
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
s[0] = ch;
|
||||
return 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Access functions for JISX0208 conversion.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -50,22 +50,22 @@ jisx0208_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
|
||||
int idx;
|
||||
|
||||
if (ch < offset || (ch - offset) <= 0x20 || (ch - offset) > 0xea)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (avail < 2)
|
||||
return 0;
|
||||
|
||||
ch2 = (*s)[1];
|
||||
if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
idx = (ch - 0x21 - offset) * 94 + (ch2 - 0x21 - offset);
|
||||
if (idx >= 0x1e80)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
(*s) += 2;
|
||||
|
||||
return __jis0208_to_ucs[idx] ?: ((*s) -= 2, UNKNOWN_10646_CHAR);
|
||||
return __jis0208_to_ucs[idx] ?: ((*s) -= 2, __UNKNOWN_10646_CHAR);
|
||||
}
|
||||
|
||||
|
||||
@ -87,17 +87,17 @@ ucs4_to_jisx0208 (uint32_t wch, char *s, size_t avail)
|
||||
const struct jisx0208_ucs_idx *rp = __jisx0208_from_ucs_idx;
|
||||
|
||||
if (ch >= 0xffff)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
while (ch > rp->end)
|
||||
++rp;
|
||||
if (ch >= rp->start)
|
||||
cp = __jisx0208_from_ucs_tab[rp->idx + ch - rp->start];
|
||||
else
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
}
|
||||
|
||||
if (cp[0] == '\0')
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
s[0] = cp[0];
|
||||
s[1] = cp[1];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Access functions for JISX0212 conversion.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -51,14 +51,14 @@ jisx0212_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
|
||||
int idx;
|
||||
|
||||
if (ch < offset || (ch - offset) < 0x22 || (ch - offset) > 0x6d)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (avail < 2)
|
||||
return 0;
|
||||
|
||||
ch2 = (*s)[1];
|
||||
if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
idx = (ch - offset - 0x21) * 94 + (ch2 - offset - 0x21);
|
||||
|
||||
@ -70,7 +70,7 @@ jisx0212_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
|
||||
if (wch != L'\0')
|
||||
(*s) += 2;
|
||||
else
|
||||
wch = UNKNOWN_10646_CHAR;
|
||||
wch = __UNKNOWN_10646_CHAR;
|
||||
|
||||
return wch;
|
||||
}
|
||||
@ -84,16 +84,16 @@ ucs4_to_jisx0212 (uint32_t wch, char *s, size_t avail)
|
||||
const char *cp;
|
||||
|
||||
if (ch >= 0xffff)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
while (ch > rp->end)
|
||||
++rp;
|
||||
if (ch >= rp->start)
|
||||
cp = __jisx0212_from_ucs[rp->idx + ch - rp->start];
|
||||
else
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (cp[0] == '\0')
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
s[0] = cp[0];
|
||||
if (cp[1] != '\0')
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Mapping tables for JOHAB handling.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Jungshik Shin <jshin@pantheon.yale.edu>
|
||||
and Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
@ -183,7 +183,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
|| (ch > 0xd3 && ch < 0xd9)) \
|
||||
{ \
|
||||
/* These are illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -197,7 +197,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
{ \
|
||||
/* The second character is not available. Store the \
|
||||
intermediate result. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -215,7 +215,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
if (i == -1 || m == -1 || f == -1) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else if (i > 0 && m > 0) \
|
||||
@ -229,7 +229,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
else \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -238,14 +238,14 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
if (ch2 < 0x31 || (ch2 > 0x7e && ch2 < 0x91) || ch2 == 0xff) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else if (ch == 0xda && ch2 > 0xa0 && ch2 < 0xd4) \
|
||||
{ \
|
||||
/* This is illegal. Modern Hangul Jaso is defined \
|
||||
elsewhere in Johab */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -267,7 +267,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
if (ch == 0) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -315,7 +315,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
\
|
||||
if (NEED_LENGTH_TEST && outptr + 2 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -330,7 +330,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
\
|
||||
if (NEED_LENGTH_TEST && outptr + 2 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -346,12 +346,12 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
? outend - outptr : 2)); \
|
||||
if (NEED_LENGTH_TEST && written == 0) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
if (written == UNKNOWN_10646_CHAR) \
|
||||
if (written == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -375,12 +375,12 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|
||||
? outend - outptr : 2)); \
|
||||
if (NEED_LENGTH_TEST && written == 0) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
if (written == UNKNOWN_10646_CHAR) \
|
||||
if (written == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Access functions for KS C 5601-1992 based encoding conversion.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -54,14 +54,14 @@ ksc5601_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
|
||||
|
||||
if (ch < offset || (ch - offset) <= 0x20 || (ch - offset) >= 0x7e
|
||||
|| (ch - offset) == 0x49)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
if (avail < 2)
|
||||
return 0;
|
||||
|
||||
ch2 = (*s)[1];
|
||||
if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f)
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
|
||||
idx = (ch - offset - 0x21) * 94 + (ch2 - offset - 0x21);
|
||||
|
||||
@ -72,13 +72,13 @@ ksc5601_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
|
||||
|
||||
if (idx >= 1410 && idx < 3760)
|
||||
return (__ksc5601_hangul_to_ucs[idx - 1410]
|
||||
?: ((*s) -= 2, UNKNOWN_10646_CHAR));
|
||||
?: ((*s) -= 2, __UNKNOWN_10646_CHAR));
|
||||
else if (idx >= 3854)
|
||||
/* Hanja : row 42 - row 93 : 3854 = 94 * (42-1) */
|
||||
return (__ksc5601_hanja_to_ucs[idx - 3854]
|
||||
?: ((*s) -= 2, UNKNOWN_10646_CHAR));
|
||||
?: ((*s) -= 2, __UNKNOWN_10646_CHAR));
|
||||
else
|
||||
return __ksc5601_sym_to_ucs[idx] ?: ((*s) -= 2, UNKNOWN_10646_CHAR);
|
||||
return __ksc5601_sym_to_ucs[idx] ?: ((*s) -= 2, __UNKNOWN_10646_CHAR);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
@ -108,7 +108,7 @@ ucs4_to_ksc5601_hangul (uint32_t wch, unsigned char *s, size_t avail)
|
||||
}
|
||||
}
|
||||
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
}
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ ucs4_to_ksc5601_hanja (uint32_t wch, unsigned char *s, size_t avail)
|
||||
}
|
||||
}
|
||||
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
@ -169,7 +169,7 @@ ucs4_to_ksc5601_sym (uint32_t wch, unsigned char *s, size_t avail)
|
||||
}
|
||||
}
|
||||
|
||||
return UNKNOWN_10646_CHAR;
|
||||
return __UNKNOWN_10646_CHAR;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Mapping tables for SJIS handling.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -4357,7 +4357,7 @@ static const char from_ucs4_extra[0x100][2] =
|
||||
else if (ch > 0xea || ch == 0xa0 || ch == 0x7f || ch == 0x80) \
|
||||
{ \
|
||||
/* These are illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -4371,7 +4371,7 @@ static const char from_ucs4_extra[0x100][2] =
|
||||
{ \
|
||||
/* The second character is not available. Store \
|
||||
the intermediate result. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -4382,7 +4382,7 @@ static const char from_ucs4_extra[0x100][2] =
|
||||
|| (idx > 0x9ffc && idx < 0xe040) || idx > 0xeaa4) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -4405,7 +4405,7 @@ static const char from_ucs4_extra[0x100][2] =
|
||||
if (ch == 0) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -4436,7 +4436,7 @@ static const char from_ucs4_extra[0x100][2] =
|
||||
else \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -4446,7 +4446,7 @@ static const char from_ucs4_extra[0x100][2] =
|
||||
if (cp[0] == '\0' && ch != 0) \
|
||||
{ \
|
||||
/* Illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -4457,7 +4457,7 @@ static const char from_ucs4_extra[0x100][2] =
|
||||
if (NEED_LENGTH_TEST && outptr >= outend) \
|
||||
{ \
|
||||
/* The result does not fit into the buffer. */ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
*outptr++ = cp[1]; \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generic conversion to and from T.61.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -392,7 +392,7 @@ static const char from_ucs4[][2] =
|
||||
if (NEED_LENGTH_TEST && inptr + 1 >= inend) \
|
||||
{ \
|
||||
/* The second character is not available. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -401,7 +401,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch2 < 0x20 || ch2 >= 0x80) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -418,7 +418,7 @@ static const char from_ucs4[][2] =
|
||||
if (ch == 0 && *inptr != '\0') \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -447,7 +447,7 @@ static const char from_ucs4[][2] =
|
||||
else if (ch < 0x2d8 || ch > 0x2dd || ch == 0x02dc) \
|
||||
{ \
|
||||
/* Illegal characters. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -466,7 +466,7 @@ static const char from_ucs4[][2] =
|
||||
if (cp[0] == '\0' && ch != 0) \
|
||||
{ \
|
||||
/* Illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -479,7 +479,7 @@ static const char from_ucs4[][2] =
|
||||
{ \
|
||||
/* The result does not fit into the buffer. */ \
|
||||
--outptr; \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Mapping tables for UHC handling.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Jungshik Shin <jshin@pantheon.yale.edu>, 1998.
|
||||
|
||||
@ -3066,7 +3066,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
||||
else if (ch <= 0x80 || ch >= 0xfe || ch == 0xc9) \
|
||||
{ \
|
||||
/* This is illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
else \
|
||||
@ -3079,7 +3079,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
||||
{ \
|
||||
/* The second character is not available. Store \
|
||||
the intermediate result. */ \
|
||||
result = GCONV_INCOMPLETE_INPUT; \
|
||||
result = __GCONV_INCOMPLETE_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -3109,7 +3109,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
||||
|| (ch2 > 0x7a && ch2 < 0x81) || (ch == 0xc6 && ch2 > 0x52)) \
|
||||
{ \
|
||||
/* This is not legal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -3122,7 +3122,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
||||
if (ch == 0) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -3131,10 +3131,10 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
||||
else \
|
||||
{ \
|
||||
ch = ksc5601_to_ucs4 (&inptr, 2, 0x80); \
|
||||
if (ch == UNKNOWN_10646_CHAR) \
|
||||
if (ch == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
/* Illegal. */ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
@ -3163,7 +3163,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
||||
\
|
||||
if (NEED_LENGTH_TEST && outptr + 2 > outend) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -3178,12 +3178,12 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
||||
\
|
||||
if (NEED_LENGTH_TEST && written == 0) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
if (written == UNKNOWN_10646_CHAR) \
|
||||
if (written == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
@ -3202,12 +3202,12 @@ static const char uhc_hangul_from_ucs[11172][2] =
|
||||
\
|
||||
if (NEED_LENGTH_TEST && written == 0) \
|
||||
{ \
|
||||
result = GCONV_FULL_OUTPUT; \
|
||||
result = __GCONV_FULL_OUTPUT; \
|
||||
break; \
|
||||
} \
|
||||
if (written == UNKNOWN_10646_CHAR) \
|
||||
if (written == __UNKNOWN_10646_CHAR) \
|
||||
{ \
|
||||
result = GCONV_ILLEGAL_INPUT; \
|
||||
result = __GCONV_ILLEGAL_INPUT; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -42,7 +42,7 @@
|
||||
/* Maximum length of any multibyte character in any locale.
|
||||
We define this value here since the gcc header does not define
|
||||
the correct value. */
|
||||
#define MB_LEN_MAX 6
|
||||
#define MB_LEN_MAX 16
|
||||
|
||||
|
||||
/* If we are not using GNU CC we have to define all the symbols ourself.
|
||||
|
@ -1,32 +1,47 @@
|
||||
#ifndef _WCHAR_H
|
||||
#include <wcsmbs/wchar.h>
|
||||
|
||||
# ifdef _WCHAR_H
|
||||
/* Now define the internal interfaces. */
|
||||
extern int __wcscasecmp __P ((__const wchar_t *__s1, __const wchar_t *__s2));
|
||||
extern int __wcsncasecmp __P ((__const wchar_t *__s1, __const wchar_t *__s2,
|
||||
size_t __n));
|
||||
extern size_t __wcsnlen __P ((__const wchar_t *__s, size_t __maxlen));
|
||||
extern wint_t __btowc __P ((int __c));
|
||||
extern int __mbsinit __P ((__const mbstate_t *__ps));
|
||||
extern int __mbsinit __P ((__const __mbstate_t *__ps));
|
||||
extern size_t __mbrtowc __P ((wchar_t *__restrict __pwc,
|
||||
__const char *__restrict __s, size_t __n,
|
||||
mbstate_t *__restrict __p));
|
||||
__mbstate_t *__restrict __p));
|
||||
extern size_t __wcrtomb __P ((char *__restrict __s, wchar_t __wc,
|
||||
mbstate_t *__restrict __ps));
|
||||
__mbstate_t *__restrict __ps));
|
||||
extern size_t __mbsrtowcs __P ((wchar_t *__restrict __dst,
|
||||
__const char **__restrict __src,
|
||||
size_t __len, mbstate_t *__restrict __ps));
|
||||
size_t __len, __mbstate_t *__restrict __ps));
|
||||
extern size_t __wcsrtombs __P ((char *__restrict __dst,
|
||||
__const wchar_t **__restrict __src,
|
||||
size_t __len, mbstate_t *__restrict __ps));
|
||||
size_t __len, __mbstate_t *__restrict __ps));
|
||||
extern size_t __mbsnrtowcs __P ((wchar_t *__restrict __dst,
|
||||
__const char **__restrict __src, size_t __nmc,
|
||||
size_t __len, mbstate_t *__restrict __ps));
|
||||
size_t __len, __mbstate_t *__restrict __ps));
|
||||
extern size_t __wcsnrtombs __P ((char *__restrict __dst,
|
||||
__const wchar_t **__restrict __src,
|
||||
size_t __nwc, size_t __len,
|
||||
mbstate_t *__restrict __ps));
|
||||
__mbstate_t *__restrict __ps));
|
||||
extern wchar_t *__wcpcpy __P ((wchar_t *__dest, __const wchar_t *__src));
|
||||
extern wchar_t *__wcpncpy __P ((wchar_t *__dest, __const wchar_t *__src,
|
||||
size_t __n));
|
||||
extern wchar_t *__wmemcpy __P ((wchar_t *__s1, __const wchar_t *s2,
|
||||
size_t __n));
|
||||
extern wchar_t *__wmempcpy __P ((wchar_t *__restrict __s1,
|
||||
__const wchar_t *__restrict __s2,
|
||||
size_t __n));
|
||||
extern wchar_t *__wmemmove __P ((wchar_t *__s1, __const wchar_t *__s2,
|
||||
size_t __n));
|
||||
extern wchar_t *__wcschrnul __P ((__const wchar_t *__s, wchar_t __wc));
|
||||
|
||||
extern int __vfwscanf __P ((FILE *__restrict __s,
|
||||
__const wchar_t *__restrict __format,
|
||||
va_list __arg))
|
||||
/* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
|
||||
# endif
|
||||
#endif
|
||||
|
@ -25,11 +25,16 @@ headers := stdio.h libio.h _G_config.h bits/stdio.h
|
||||
|
||||
routines := \
|
||||
filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
|
||||
iofopncook iofputs iofread iofsetpos ioftell \
|
||||
iofopncook iofputs iofread iofsetpos ioftell wfiledoalloc \
|
||||
iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
|
||||
ioseekoff ioseekpos iosetbuffer iosetvbuf iosprintf ioungetc \
|
||||
iovsprintf iovsscanf \
|
||||
iofgetpos64 iofopen64 iofsetpos64 \
|
||||
oldiofgetpos oldiofgetpos64 oldiofsetpos oldiofsetpos64 \
|
||||
fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
|
||||
iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
|
||||
putchar putchar_u swprintf vwprintf wprintf wscanf fwscanf vwscanf \
|
||||
vswprintf iovswscanf swscanf wgenops wstrops wfileops iofwide \
|
||||
\
|
||||
clearerr feof ferror fileno fputc freopen fseek getc getchar \
|
||||
memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
|
||||
@ -38,6 +43,8 @@ routines := \
|
||||
\
|
||||
libc_fatal
|
||||
|
||||
tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf
|
||||
|
||||
all: # Make this the default target; it will be defined in Rules.
|
||||
|
||||
include ../Makeconfig
|
||||
|
@ -100,4 +100,31 @@ libc {
|
||||
# p*
|
||||
pclose; popen;
|
||||
}
|
||||
GLIBC_2.2 {
|
||||
# functions used in libstdc++
|
||||
_IO_fgetpos; _IO_fgetpos64; _IO_fsetpos; _IO_fsetpos64;
|
||||
|
||||
# f*
|
||||
fgetpos; fgetpos64; fgetwc; fgetwc_unlocked; fgetws; fgetws_unlocked;
|
||||
fputwc; fputwc_unlocked; fputws; fputws_unlocked; fsetpos; fsetpos64;
|
||||
fwide; fwprintf; fwscanf;
|
||||
|
||||
# g*
|
||||
getwc; getwc_unlocked; getwchar; getwchar_unlocked;
|
||||
|
||||
# p*
|
||||
putwc; putwc_unlocked; putwchar; putwchar_unlocked;
|
||||
|
||||
# s*
|
||||
swprintf; swscanf;
|
||||
|
||||
# u*
|
||||
ungetwc;
|
||||
|
||||
# v*
|
||||
vfwprintf; vswprintf; vwprintf; vfwscanf; vswscanf; vwscanf;
|
||||
|
||||
# w*
|
||||
wprintf; wscanf;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
Written by Per Bothner <bothner@cygnus.com>.
|
||||
|
||||
@ -136,9 +136,18 @@ _IO_new_file_close_it (fp)
|
||||
close_status = _IO_SYSCLOSE (fp);
|
||||
|
||||
/* Free buffer. */
|
||||
if (fp->_mode <= 0)
|
||||
{
|
||||
_IO_setb (fp, NULL, NULL, 0);
|
||||
_IO_setg (fp, NULL, NULL, NULL);
|
||||
_IO_setp (fp, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
_IO_wsetb (fp, NULL, NULL, 0);
|
||||
_IO_wsetg (fp, NULL, NULL, NULL);
|
||||
_IO_wsetp (fp, NULL, NULL);
|
||||
}
|
||||
|
||||
_IO_un_link (fp);
|
||||
fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
|
||||
@ -319,7 +328,7 @@ new_do_write (fp, data, to_do)
|
||||
fp->_offset = _IO_pos_BAD;
|
||||
else if (fp->_IO_read_end != fp->_IO_write_base)
|
||||
{
|
||||
_IO_fpos64_t new_pos
|
||||
_IO_off64_t new_pos
|
||||
= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
|
||||
if (new_pos == _IO_pos_BAD)
|
||||
return 0;
|
||||
@ -330,7 +339,8 @@ new_do_write (fp, data, to_do)
|
||||
fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, count) + 1;
|
||||
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
|
||||
fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base;
|
||||
fp->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
|
||||
fp->_IO_write_end = (fp->_mode < 0
|
||||
&& (fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
|
||||
? fp->_IO_buf_base : fp->_IO_buf_end);
|
||||
return count;
|
||||
}
|
||||
@ -410,7 +420,7 @@ _IO_new_file_overflow (f, ch)
|
||||
return EOF;
|
||||
}
|
||||
/* If currently reading or no buffer allocated. */
|
||||
if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0)
|
||||
if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0 || f->_IO_write_base == 0)
|
||||
{
|
||||
/* Allocate a buffer if needed. */
|
||||
if (f->_IO_write_base == 0)
|
||||
@ -433,18 +443,20 @@ _IO_new_file_overflow (f, ch)
|
||||
f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
|
||||
|
||||
f->_flags |= _IO_CURRENTLY_PUTTING;
|
||||
if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
|
||||
if (f->_mode < 0 && f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
|
||||
f->_IO_write_end = f->_IO_write_ptr;
|
||||
}
|
||||
if (ch == EOF)
|
||||
return _IO_do_flush (f);
|
||||
return _IO_new_do_write(f, f->_IO_write_base,
|
||||
f->_IO_write_ptr - f->_IO_write_base);
|
||||
if (f->_IO_write_ptr == f->_IO_buf_end ) /* Buffer is really full */
|
||||
if (_IO_do_flush (f) == EOF)
|
||||
return EOF;
|
||||
*f->_IO_write_ptr++ = ch;
|
||||
if ((f->_flags & _IO_UNBUFFERED)
|
||||
|| ((f->_flags & _IO_LINE_BUF) && ch == '\n'))
|
||||
if (_IO_do_flush (f) == EOF)
|
||||
if (_IO_new_do_write(f, f->_IO_write_base,
|
||||
f->_IO_write_ptr - f->_IO_write_base) == EOF)
|
||||
return EOF;
|
||||
return (unsigned char) ch;
|
||||
}
|
||||
@ -483,14 +495,14 @@ _IO_new_file_sync (fp)
|
||||
return retval;
|
||||
}
|
||||
|
||||
_IO_fpos64_t
|
||||
_IO_off64_t
|
||||
_IO_new_file_seekoff (fp, offset, dir, mode)
|
||||
_IO_FILE *fp;
|
||||
_IO_off64_t offset;
|
||||
int dir;
|
||||
int mode;
|
||||
{
|
||||
_IO_fpos64_t result;
|
||||
_IO_off64_t result;
|
||||
_IO_off64_t delta, new_offset;
|
||||
long count;
|
||||
/* POSIX.1 8.2.3.7 says that after a call the fflush() the file
|
||||
@ -534,7 +546,7 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
|
||||
if (fp->_offset == _IO_pos_BAD)
|
||||
goto dumb;
|
||||
/* Make offset absolute, assuming current pointer is file_ptr(). */
|
||||
offset += _IO_pos_as_off (fp->_offset);
|
||||
offset += fp->_offset;
|
||||
|
||||
dir = _IO_seek_set;
|
||||
break;
|
||||
@ -563,7 +575,7 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
|
||||
&& !_IO_in_backup (fp))
|
||||
{
|
||||
/* Offset relative to start of main get area. */
|
||||
_IO_fpos64_t rel_offset = (offset - fp->_offset
|
||||
_IO_off64_t rel_offset = (offset - fp->_offset
|
||||
+ (fp->_IO_read_end - fp->_IO_read_base));
|
||||
if (rel_offset >= 0)
|
||||
{
|
||||
@ -678,7 +690,7 @@ _IO_file_read (fp, buf, size)
|
||||
return read (fp->_fileno, buf, size);
|
||||
}
|
||||
|
||||
_IO_fpos64_t
|
||||
_IO_off64_t
|
||||
_IO_file_seek (fp, offset, dir)
|
||||
_IO_FILE *fp;
|
||||
_IO_off64_t offset;
|
||||
@ -720,7 +732,7 @@ _IO_new_file_write (f, data, n)
|
||||
while (to_do > 0)
|
||||
{
|
||||
_IO_ssize_t count = write (f->_fileno, data, to_do);
|
||||
if (count == EOF)
|
||||
if (count < 0)
|
||||
{
|
||||
f->_flags |= _IO_ERR_SEEN;
|
||||
break;
|
||||
@ -740,7 +752,7 @@ _IO_new_file_xsputn (f, data, n)
|
||||
const void *data;
|
||||
_IO_size_t n;
|
||||
{
|
||||
register const char *s = (char *) data;
|
||||
register const char *s = (const char *) data;
|
||||
_IO_size_t to_do = n;
|
||||
int must_flush = 0;
|
||||
_IO_size_t count;
|
||||
|
45
libio/fputwc.c
Normal file
45
libio/fputwc.c
Normal file
@ -0,0 +1,45 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
wint_t
|
||||
fputwc (wc, fp)
|
||||
wint_t wc;
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
int result;
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
if (_IO_fwide (fp, 1) < 0)
|
||||
result = WEOF;
|
||||
else
|
||||
result = _IO_putwc_unlocked (wc, fp);
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
}
|
40
libio/fputwc_u.c
Normal file
40
libio/fputwc_u.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
#undef fputwc_unlocked
|
||||
|
||||
wint_t
|
||||
fputwc_unlocked (wc, fp)
|
||||
wint_t wc;
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
CHECK_FILE (fp, EOF);
|
||||
if (_IO_fwide (fp, 1) < 0)
|
||||
return WEOF;
|
||||
return _IO_putwc_unlocked (wc, fp);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -32,13 +32,19 @@ off_t
|
||||
ftello (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_pos_t pos;
|
||||
_IO_off_t pos;
|
||||
CHECK_FILE (fp, -1L);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
|
||||
if (_IO_in_backup (fp))
|
||||
{
|
||||
if (fp->_mode <= 0)
|
||||
pos -= fp->_IO_save_end - fp->_IO_save_base;
|
||||
else
|
||||
/* XXX Not done yet. */
|
||||
abort ();
|
||||
}
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
if (pos == _IO_pos_BAD)
|
||||
@ -49,5 +55,5 @@ ftello (fp)
|
||||
#endif
|
||||
return -1L;
|
||||
}
|
||||
return _IO_pos_as_off (pos);
|
||||
return pos;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -33,13 +33,18 @@ ftello64 (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
#ifdef _G_LSEEK64
|
||||
_IO_pos_t pos;
|
||||
_IO_off64_t pos;
|
||||
CHECK_FILE (fp, -1L);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
|
||||
if (_IO_in_backup (fp))
|
||||
{
|
||||
if (fp->_mode <= 0)
|
||||
pos -= fp->_IO_save_end - fp->_IO_save_base;
|
||||
else
|
||||
abort ();
|
||||
}
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
if (pos == _IO_pos_BAD)
|
||||
@ -50,7 +55,7 @@ ftello64 (fp)
|
||||
#endif
|
||||
return -1L;
|
||||
}
|
||||
return _IO_pos_as_off (pos);
|
||||
return pos;
|
||||
#else
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
|
36
libio/fwprintf.c
Normal file
36
libio/fwprintf.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 1991, 1997, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
/* Write formatted output to STREAM from the format string FORMAT. */
|
||||
/* VARARGS2 */
|
||||
int
|
||||
fwprintf (FILE *stream, const wchar_t *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
int done;
|
||||
|
||||
va_start (arg, format);
|
||||
done = vfwprintf (stream, format, arg);
|
||||
va_end (arg);
|
||||
|
||||
return done;
|
||||
}
|
35
libio/fwscanf.c
Normal file
35
libio/fwscanf.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* Copyright (C) 1991, 1997, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <wchar.h>
|
||||
|
||||
/* Read formatted input from STREAM according to the format string FORMAT. */
|
||||
/* VARARGS2 */
|
||||
int
|
||||
fwscanf (FILE *stream, const wchar_t *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
int done;
|
||||
|
||||
va_start (arg, format);
|
||||
done = __vfwscanf (stream, format, arg);
|
||||
va_end (arg);
|
||||
|
||||
return done;
|
||||
}
|
@ -80,9 +80,9 @@ _IO_link_in (fp)
|
||||
|
||||
/* Return minimum _pos markers
|
||||
Assumes the current get area is the main get area. */
|
||||
static _IO_ssize_t _IO_least_marker __P ((_IO_FILE *fp, char *end_p));
|
||||
_IO_ssize_t _IO_least_marker __P ((_IO_FILE *fp, char *end_p));
|
||||
|
||||
static _IO_ssize_t
|
||||
_IO_ssize_t
|
||||
_IO_least_marker (fp, end_p)
|
||||
_IO_FILE *fp;
|
||||
char *end_p;
|
||||
@ -282,6 +282,9 @@ int
|
||||
__underflow (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
if (_IO_fwide (fp, -1) != -1)
|
||||
return EOF;
|
||||
|
||||
if (_IO_in_put_mode (fp))
|
||||
if (_IO_switch_to_get_mode (fp) == EOF)
|
||||
return EOF;
|
||||
@ -307,6 +310,9 @@ int
|
||||
__uflow (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
if (_IO_fwide (fp, -1) != -1)
|
||||
return EOF;
|
||||
|
||||
if (_IO_in_put_mode (fp))
|
||||
if (_IO_switch_to_get_mode (fp) == EOF)
|
||||
return EOF;
|
||||
@ -508,13 +514,13 @@ _IO_default_setbuf (fp, p, len)
|
||||
return fp;
|
||||
}
|
||||
|
||||
_IO_fpos64_t
|
||||
_IO_off64_t
|
||||
_IO_default_seekpos (fp, pos, mode)
|
||||
_IO_FILE *fp;
|
||||
_IO_fpos64_t pos;
|
||||
_IO_off64_t pos;
|
||||
int mode;
|
||||
{
|
||||
return _IO_SEEKOFF (fp, _IO_pos_as_off (pos), 0, mode);
|
||||
return _IO_SEEKOFF (fp, pos, 0, mode);
|
||||
}
|
||||
|
||||
int
|
||||
@ -532,6 +538,17 @@ void
|
||||
_IO_init (fp, flags)
|
||||
_IO_FILE *fp;
|
||||
int flags;
|
||||
{
|
||||
_IO_no_init (fp, flags, -1, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_IO_no_init (fp, flags, orientation, wd, jmp)
|
||||
_IO_FILE *fp;
|
||||
int flags;
|
||||
int orientation;
|
||||
struct _IO_wide_data *wd;
|
||||
struct _IO_jump_t *jmp;
|
||||
{
|
||||
fp->_flags = _IO_MAGIC|flags;
|
||||
fp->_IO_buf_base = NULL;
|
||||
@ -555,6 +572,24 @@ _IO_init (fp, flags)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_init (*fp->_lock);
|
||||
#endif
|
||||
fp->_mode = orientation;
|
||||
if (orientation >= 0)
|
||||
{
|
||||
fp->_wide_data = wd;
|
||||
fp->_wide_data->_IO_buf_base = NULL;
|
||||
fp->_wide_data->_IO_buf_end = NULL;
|
||||
fp->_wide_data->_IO_read_base = NULL;
|
||||
fp->_wide_data->_IO_read_ptr = NULL;
|
||||
fp->_wide_data->_IO_read_end = NULL;
|
||||
fp->_wide_data->_IO_write_base = NULL;
|
||||
fp->_wide_data->_IO_write_ptr = NULL;
|
||||
fp->_wide_data->_IO_write_end = NULL;
|
||||
fp->_wide_data->_IO_save_base = NULL;
|
||||
fp->_wide_data->_IO_backup_base = NULL;
|
||||
fp->_wide_data->_IO_save_end = NULL;
|
||||
|
||||
fp->_wide_data->_wide_vtable = jmp;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@ -595,7 +630,7 @@ _IO_default_finish (fp, dummy)
|
||||
_IO_un_link (fp);
|
||||
}
|
||||
|
||||
_IO_fpos64_t
|
||||
_IO_off64_t
|
||||
_IO_default_seekoff (fp, offset, dir, mode)
|
||||
_IO_FILE *fp;
|
||||
_IO_off64_t offset;
|
||||
@ -706,7 +741,9 @@ _IO_flush_all ()
|
||||
int result = 0;
|
||||
_IO_FILE *fp;
|
||||
for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
|
||||
if (fp->_IO_write_ptr > fp->_IO_write_base
|
||||
if (((fp->_mode < 0 && fp->_IO_write_ptr > fp->_IO_write_base)
|
||||
|| (fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr
|
||||
> fp->_wide_data->_IO_write_base)))
|
||||
&& _IO_OVERFLOW (fp, EOF) == EOF)
|
||||
result = EOF;
|
||||
return result;
|
||||
@ -941,7 +978,7 @@ _IO_default_pbackfail (fp, c)
|
||||
return (unsigned char) c;
|
||||
}
|
||||
|
||||
_IO_fpos64_t
|
||||
_IO_off64_t
|
||||
_IO_default_seek (fp, offset, dir)
|
||||
_IO_FILE *fp;
|
||||
_IO_off64_t offset;
|
||||
|
50
libio/getwc.c
Normal file
50
libio/getwc.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
#undef _IO_getwc
|
||||
|
||||
wint_t
|
||||
_IO_getwc (fp)
|
||||
FILE *fp;
|
||||
{
|
||||
wint_t result;
|
||||
CHECK_FILE (fp, WEOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
result = _IO_getwc_unlocked (fp);
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
}
|
||||
|
||||
#undef getwc
|
||||
|
||||
#ifdef weak_alias
|
||||
weak_alias (_IO_getwc, getwc)
|
||||
weak_alias (_IO_getwc, fgetwc)
|
||||
#endif
|
39
libio/getwc_u.c
Normal file
39
libio/getwc_u.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* Copyright (C) 1993, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include "stdio.h"
|
||||
|
||||
#undef getwc_unlocked
|
||||
|
||||
wint_t
|
||||
__getwc_unlocked (FILE *fp)
|
||||
{
|
||||
CHECK_FILE (fp, EOF);
|
||||
return _IO_getwc_unlocked (fp);
|
||||
}
|
||||
|
||||
weak_alias (__getwc_unlocked, getwc_unlocked)
|
||||
weak_alias (__getwc_unlocked, fgetwc_unlocked)
|
42
libio/getwchar.c
Normal file
42
libio/getwchar.c
Normal file
@ -0,0 +1,42 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
#undef getwchar
|
||||
|
||||
wint_t
|
||||
getwchar ()
|
||||
{
|
||||
wint_t result;
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
|
||||
_IO_stdin);
|
||||
_IO_flockfile (_IO_stdin);
|
||||
result = _IO_getwc_unlocked (_IO_stdin);
|
||||
_IO_funlockfile (_IO_stdin);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
}
|
35
libio/getwchar_u.c
Normal file
35
libio/getwchar_u.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
#undef getwchar_unlocked
|
||||
|
||||
wint_t
|
||||
getwchar_unlocked ()
|
||||
{
|
||||
return _IO_getwc_unlocked (_IO_stdin);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1994, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -50,6 +50,7 @@ _IO_new_fdopen (fd, mode)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_t lock;
|
||||
#endif
|
||||
struct _IO_wide_data wd;
|
||||
} *new_f;
|
||||
int fd_flags;
|
||||
|
||||
@ -112,7 +113,7 @@ _IO_new_fdopen (fd, mode)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
new_f->fp.file._lock = &new_f->lock;
|
||||
#endif
|
||||
_IO_init (&new_f->fp.file, 0);
|
||||
_IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
|
||||
_IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
|
||||
_IO_file_init (&new_f->fp.file);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -27,11 +27,11 @@
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
_IO_fgetpos (fp, posp)
|
||||
_IO_new_fgetpos (fp, posp)
|
||||
_IO_FILE *fp;
|
||||
_IO_fpos_t *posp;
|
||||
{
|
||||
_IO_fpos_t pos;
|
||||
_IO_off_t pos;
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
@ -50,10 +50,16 @@ _IO_fgetpos (fp, posp)
|
||||
#endif
|
||||
return EOF;
|
||||
}
|
||||
*posp = pos;
|
||||
posp->__pos = pos;
|
||||
if (fp->_mode > 0
|
||||
&& (*fp->_codecvt->__codecvt_do_encoding) (fp->_codecvt) < 0)
|
||||
/* This is a stateful encoding, safe the state. */
|
||||
posp->__state = fp->_wide_data->_IO_state;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
weak_alias (_IO_fgetpos, fgetpos)
|
||||
strong_alias (_IO_new_fgetpos, __new_fgetpos)
|
||||
default_symbol_version (_IO_new_fgetpos, _IO_fgetpos, GLIBC_2.2);
|
||||
default_symbol_version (__new_fgetpos, fgetpos, GLIBC_2.2);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -27,12 +27,12 @@
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
_IO_fgetpos64 (fp, posp)
|
||||
_IO_new_fgetpos64 (fp, posp)
|
||||
_IO_FILE *fp;
|
||||
_IO_fpos64_t *posp;
|
||||
{
|
||||
#ifdef _G_LSEEK64
|
||||
_IO_fpos64_t pos;
|
||||
_IO_off64_t pos;
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
@ -45,13 +45,17 @@ _IO_fgetpos64 (fp, posp)
|
||||
{
|
||||
/* ANSI explicitly requires setting errno to a positive value on
|
||||
failure. */
|
||||
#ifdef EIO
|
||||
# ifdef EIO
|
||||
if (errno == 0)
|
||||
__set_errno (EIO);
|
||||
#endif
|
||||
# endif
|
||||
return EOF;
|
||||
}
|
||||
*posp = pos;
|
||||
posp->__pos = pos;
|
||||
if (fp->_mode > 0
|
||||
&& (*fp->_codecvt->__codecvt_do_encoding) (fp->_codecvt) < 0)
|
||||
/* This is a stateful encoding, safe the state. */
|
||||
posp->__state = fp->_wide_data->_IO_state;
|
||||
return 0;
|
||||
#else
|
||||
__set_errno (ENOSYS);
|
||||
@ -60,5 +64,7 @@ _IO_fgetpos64 (fp, posp)
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
weak_alias (_IO_fgetpos64, fgetpos64)
|
||||
default_symbol_version (_IO_new_fgetpos64, _IO_fgetpos64, GLIBC_2.2);
|
||||
strong_alias (_IO_new_fgetpos64, __new_fgetpos64)
|
||||
default_symbol_version (__new_fgetpos64, fgetpos64, GLIBC_2.2);
|
||||
#endif
|
||||
|
63
libio/iofgetws.c
Normal file
63
libio/iofgetws.c
Normal file
@ -0,0 +1,63 @@
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
fgetws (buf, n, fp)
|
||||
wchar_t *buf;
|
||||
int n;
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t count;
|
||||
wchar_t *result;
|
||||
int old_error;
|
||||
CHECK_FILE (fp, NULL);
|
||||
if (n <= 0)
|
||||
return NULL;
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
/* This is very tricky since a file descriptor may be in the
|
||||
non-blocking mode. The error flag doesn't mean much in this
|
||||
case. We return an error only when there is a new error. */
|
||||
old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
|
||||
fp->_IO_file_flags &= ~_IO_ERR_SEEN;
|
||||
count = _IO_getwline (fp, buf, n - 1, L'\n', 1);
|
||||
/* If we read in some bytes and errno is EAGAIN, that error will
|
||||
be reported for next read. */
|
||||
if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
|
||||
&& errno != EAGAIN))
|
||||
result = NULL;
|
||||
else
|
||||
{
|
||||
buf[count] = '\0';
|
||||
result = buf;
|
||||
}
|
||||
fp->_IO_file_flags |= old_error;
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
}
|
59
libio/iofgetws_u.c
Normal file
59
libio/iofgetws_u.c
Normal file
@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
fgetws_unlocked (buf, n, fp)
|
||||
wchar_t *buf;
|
||||
int n;
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t count;
|
||||
wchar_t *result;
|
||||
int old_error;
|
||||
CHECK_FILE (fp, NULL);
|
||||
if (n <= 0)
|
||||
return NULL;
|
||||
/* This is very tricky since a file descriptor may be in the
|
||||
non-blocking mode. The error flag doesn't mean much in this
|
||||
case. We return an error only when there is a new error. */
|
||||
old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
|
||||
fp->_IO_file_flags &= ~_IO_ERR_SEEN;
|
||||
count = _IO_getwline (fp, buf, n - 1, L'\n', 1);
|
||||
/* If we read in some bytes and errno is EAGAIN, that error will
|
||||
be reported for next read. */
|
||||
if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN)
|
||||
&& errno != EAGAIN))
|
||||
result = NULL;
|
||||
else
|
||||
{
|
||||
buf[count] = '\0';
|
||||
result = buf;
|
||||
}
|
||||
fp->_IO_file_flags |= old_error;
|
||||
return result;
|
||||
}
|
@ -39,6 +39,7 @@ _IO_new_fopen (filename, mode)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_t lock;
|
||||
#endif
|
||||
struct _IO_wide_data wd;
|
||||
} *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
|
||||
|
||||
if (new_f == NULL)
|
||||
@ -46,7 +47,7 @@ _IO_new_fopen (filename, mode)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
new_f->fp.file._lock = &new_f->lock;
|
||||
#endif
|
||||
_IO_init (&new_f->fp.file, 0);
|
||||
_IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
|
||||
_IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
|
||||
_IO_file_init (&new_f->fp.file);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
|
@ -40,6 +40,7 @@ _IO_fopen64 (filename, mode)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_t lock;
|
||||
#endif
|
||||
struct _IO_wide_data wd;
|
||||
} *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
|
||||
|
||||
if (new_f == NULL)
|
||||
@ -47,7 +48,7 @@ _IO_fopen64 (filename, mode)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
new_f->fp.file._lock = &new_f->lock;
|
||||
#endif
|
||||
_IO_init (&new_f->fp.file, 0);
|
||||
_IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
|
||||
_IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
|
||||
_IO_file_init (&new_f->fp.file);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
|
@ -33,7 +33,7 @@ static _IO_ssize_t _IO_cookie_read __P ((register _IO_FILE* fp, void* buf,
|
||||
_IO_ssize_t size));
|
||||
static _IO_ssize_t _IO_cookie_write __P ((register _IO_FILE* fp,
|
||||
const void* buf, _IO_ssize_t size));
|
||||
static _IO_fpos64_t _IO_cookie_seek __P ((_IO_FILE *fp, _IO_off64_t offset,
|
||||
static _IO_off64_t _IO_cookie_seek __P ((_IO_FILE *fp, _IO_off64_t offset,
|
||||
int dir));
|
||||
static int _IO_cookie_close __P ((_IO_FILE* fp));
|
||||
|
||||
@ -66,7 +66,7 @@ _IO_cookie_write (fp, buf, size)
|
||||
return cfile->__io_functions.write (cfile->__cookie, buf, size);
|
||||
}
|
||||
|
||||
static _IO_fpos64_t
|
||||
static _IO_off64_t
|
||||
_IO_cookie_seek (fp, offset, dir)
|
||||
_IO_FILE *fp;
|
||||
_IO_off64_t offset;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -32,13 +32,12 @@ _IO_fputs (str, fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t len = strlen (str);
|
||||
int result;
|
||||
int result = EOF;
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
if (_IO_sputn (fp, str, len) != len)
|
||||
result = EOF;
|
||||
else
|
||||
if (_IO_fwide (fp, -1) == -1
|
||||
&& _IO_sputn (fp, str, len) == len)
|
||||
result = 1;
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -33,11 +33,9 @@ fputs_unlocked (str, fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t len = strlen (str);
|
||||
int result;
|
||||
int result = EOF;
|
||||
CHECK_FILE (fp, EOF);
|
||||
if (_IO_sputn (fp, str, len) != len)
|
||||
result = EOF;
|
||||
else
|
||||
if (_IO_fwide (fp, -1) == -1 && _IO_sputn (fp, str, len) == len)
|
||||
result = 1;
|
||||
return result;
|
||||
}
|
||||
|
45
libio/iofputws.c
Normal file
45
libio/iofputws.c
Normal file
@ -0,0 +1,45 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
int
|
||||
fputws (str, fp)
|
||||
const wchar_t *str;
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t len = wcslen (str);
|
||||
int result = EOF;
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
if (_IO_fwide (fp, 1) == 1
|
||||
&& _IO_sputn (fp, (char *) str, len) == len)
|
||||
result = 1;
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
}
|
42
libio/iofputws_u.c
Normal file
42
libio/iofputws_u.c
Normal file
@ -0,0 +1,42 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int
|
||||
fputws_unlocked (str, fp)
|
||||
const wchar_t *str;
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t len = wcslen (str);
|
||||
int result = EOF;
|
||||
CHECK_FILE (fp, EOF);
|
||||
if (_IO_fwide (fp, 1) == 1
|
||||
&& _IO_sputn (fp, (char *) str, len) == len)
|
||||
result = 1;
|
||||
return result;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -27,7 +27,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
_IO_fsetpos (fp, posp)
|
||||
_IO_new_fsetpos (fp, posp)
|
||||
_IO_FILE *fp;
|
||||
const _IO_fpos_t *posp;
|
||||
{
|
||||
@ -35,7 +35,7 @@ _IO_fsetpos (fp, posp)
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
if (_IO_seekpos (fp, *posp, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
|
||||
if (_IO_seekpos (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
|
||||
{
|
||||
/* ANSI explicitly requires setting errno to a positive value on
|
||||
failure. */
|
||||
@ -46,12 +46,20 @@ _IO_fsetpos (fp, posp)
|
||||
result = EOF;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = 0;
|
||||
if (fp->_mode > 0
|
||||
&& (*fp->_codecvt->__codecvt_do_encoding) (fp->_codecvt) < 0)
|
||||
/* This is a stateful encoding, restore the state. */
|
||||
fp->_wide_data->_IO_state = posp->__state;
|
||||
}
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
weak_alias (_IO_fsetpos, fsetpos)
|
||||
default_symbol_version (_IO_new_fsetpos, _IO_fsetpos, GLIBC_2.2);
|
||||
strong_alias (_IO_new_fsetpos, __new_fsetpos)
|
||||
default_symbol_version (__new_fsetpos, fsetpos, GLIBC_2.2);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -27,7 +27,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
_IO_fsetpos64 (fp, posp)
|
||||
_IO_new_fsetpos64 (fp, posp)
|
||||
_IO_FILE *fp;
|
||||
const _IO_fpos64_t *posp;
|
||||
{
|
||||
@ -36,7 +36,7 @@ _IO_fsetpos64 (fp, posp)
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
if (_IO_seekpos (fp, *posp, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
|
||||
if (_IO_seekpos (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
|
||||
{
|
||||
/* ANSI explicitly requires setting errno to a positive value on
|
||||
failure. */
|
||||
@ -47,7 +47,13 @@ _IO_fsetpos64 (fp, posp)
|
||||
result = EOF;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = 0;
|
||||
if (fp->_mode > 0
|
||||
&& (*fp->_codecvt->__codecvt_do_encoding) (fp->_codecvt) < 0)
|
||||
/* This is a stateful encoding, safe the state. */
|
||||
fp->_wide_data->_IO_state = posp->__state;
|
||||
}
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
@ -58,5 +64,7 @@ _IO_fsetpos64 (fp, posp)
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
weak_alias (_IO_fsetpos64, fsetpos64)
|
||||
default_symbol_version (_IO_new_fsetpos64, _IO_fsetpos64, GLIBC_2.2);
|
||||
strong_alias (_IO_new_fsetpos64, __new_fsetpos64)
|
||||
default_symbol_version (__new_fsetpos64, fsetpos64, GLIBC_2.2);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -31,13 +31,19 @@ long int
|
||||
_IO_ftell (fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_pos_t pos;
|
||||
_IO_off_t pos;
|
||||
CHECK_FILE (fp, -1L);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
|
||||
if (_IO_in_backup (fp))
|
||||
{
|
||||
if (fp->_mode < 0)
|
||||
pos -= fp->_IO_save_end - fp->_IO_save_base;
|
||||
else
|
||||
/* XXX For now. */
|
||||
abort ();
|
||||
}
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
if (pos == _IO_pos_BAD)
|
||||
@ -48,7 +54,7 @@ _IO_ftell (fp)
|
||||
#endif
|
||||
return -1L;
|
||||
}
|
||||
return _IO_pos_as_off (pos);
|
||||
return pos;
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
|
365
libio/iofwide.c
Normal file
365
libio/iofwide.c
Normal file
@ -0,0 +1,365 @@
|
||||
/* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include <libioP.h>
|
||||
#ifdef _LIBC
|
||||
# include <wchar.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <langinfo.h>
|
||||
# include <locale/localeinfo.h>
|
||||
# include <wcsmbs/wcsmbsload.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Prototypes of libio's codecvt functions. */
|
||||
static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
|
||||
__mbstate_t *statep,
|
||||
const wchar_t *from_start,
|
||||
const wchar_t *from_end,
|
||||
const wchar_t **from_stop, char *to_start,
|
||||
char *to_end, char **to_stop);
|
||||
static enum __codecvt_result do_unshift (struct _IO_codecvt *codecvt,
|
||||
__mbstate_t *statep, char *to_start,
|
||||
char *to_end, char **to_stop);
|
||||
static enum __codecvt_result do_in (struct _IO_codecvt *codecvt,
|
||||
__mbstate_t *statep,
|
||||
const char *from_start,
|
||||
const char *from_end,
|
||||
const char **from_stop, wchar_t *to_start,
|
||||
wchar_t *to_end, wchar_t **to_stop);
|
||||
static int do_encoding (struct _IO_codecvt *codecvt);
|
||||
static int do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
|
||||
const char *from_start,
|
||||
const char *from_end, _IO_size_t max);
|
||||
static int do_max_length (struct _IO_codecvt *codecvt);
|
||||
static int do_always_noconv (struct _IO_codecvt *codecvt);
|
||||
|
||||
|
||||
/* The functions used in `codecvt' for libio are always the same. */
|
||||
static struct _IO_codecvt libio_codecvt =
|
||||
{
|
||||
.__codecvt_destr = NULL, /* Destructor, never used. */
|
||||
.__codecvt_do_out = do_out,
|
||||
.__codecvt_do_unshift = do_unshift,
|
||||
.__codecvt_do_in = do_in,
|
||||
.__codecvt_do_encoding = do_encoding,
|
||||
.__codecvt_do_always_noconv = do_always_noconv,
|
||||
.__codecvt_do_length = do_length,
|
||||
.__codecvt_do_max_length = do_max_length
|
||||
};
|
||||
|
||||
|
||||
/* Return orientation of stream. If mode is nonzero try to change
|
||||
the orientation first. */
|
||||
#undef _IO_fwide
|
||||
int
|
||||
_IO_fwide (fp, mode)
|
||||
_IO_FILE *fp;
|
||||
int mode;
|
||||
{
|
||||
/* Normalize the value. */
|
||||
mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
|
||||
|
||||
if (mode == 0 || fp->_mode != 0)
|
||||
/* The caller simply wants to know about the current orientation
|
||||
or the orientation already has been determined. */
|
||||
return fp->_mode;
|
||||
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
|
||||
/* Set the orientation appropriately. */
|
||||
if (mode > 0)
|
||||
{
|
||||
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
|
||||
fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;
|
||||
|
||||
/* Clear the state. We start all over again. */
|
||||
memset (&fp->_wide_data->_IO_state, '\0', sizeof (__mbstate_t));
|
||||
memset (&fp->_wide_data->_IO_last_state, '\0', sizeof (__mbstate_t));
|
||||
|
||||
/* Get the character conversion functions based on the currently
|
||||
selected locale for LC_CTYPE. */
|
||||
#ifdef _LIBC
|
||||
{
|
||||
struct gconv_fcts fcts;
|
||||
struct _IO_codecvt *cc = &fp->_wide_data->_codecvt;
|
||||
|
||||
__wcsmbs_clone_conv (&fcts);
|
||||
|
||||
/* The functions are always the same. */
|
||||
*cc = libio_codecvt;
|
||||
|
||||
cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed. */
|
||||
cc->__cd_in.__cd.__steps = fcts.towc;
|
||||
|
||||
cc->__cd_in.__cd.__data[0].__invocation_counter = 0;
|
||||
cc->__cd_in.__cd.__data[0].__internal_use = 1;
|
||||
cc->__cd_in.__cd.__data[0].__is_last = 1;
|
||||
cc->__cd_in.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
|
||||
|
||||
cc->__cd_out.__cd.__nsteps = 1; /* Only one step allowed. */
|
||||
cc->__cd_out.__cd.__steps = fcts.tomb;
|
||||
|
||||
cc->__cd_out.__cd.__data[0].__invocation_counter = 0;
|
||||
cc->__cd_out.__cd.__data[0].__internal_use = 1;
|
||||
cc->__cd_out.__cd.__data[0].__is_last = 1;
|
||||
cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
|
||||
}
|
||||
#else
|
||||
# error "somehow determine this from LC_CTYPE"
|
||||
#endif
|
||||
|
||||
/* From now on use the wide character callback functions. */
|
||||
((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable;
|
||||
}
|
||||
|
||||
/* Set the mode now. */
|
||||
fp->_mode = mode;
|
||||
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
weak_alias (_IO_fwide, fwide)
|
||||
#endif
|
||||
|
||||
|
||||
static enum __codecvt_result
|
||||
do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
|
||||
const wchar_t *from_start, const wchar_t *from_end,
|
||||
const wchar_t **from_stop, char *to_start, char *to_end,
|
||||
char **to_stop)
|
||||
{
|
||||
enum __codecvt_result result;
|
||||
|
||||
#ifdef _LIBC
|
||||
struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
|
||||
int status;
|
||||
size_t written;
|
||||
const unsigned char *from_start_copy = (unsigned char *) from_start;
|
||||
|
||||
codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
|
||||
codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
|
||||
codecvt->__cd_out.__cd.__data[0].__statep = statep;
|
||||
|
||||
status = (*gs->__fct) (gs, codecvt->__cd_out.__cd.__data, &from_start_copy,
|
||||
(const unsigned char *) from_end, &written, 0);
|
||||
|
||||
*from_stop = (wchar_t *) from_start_copy;
|
||||
*to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case __GCONV_OK:
|
||||
case __GCONV_EMPTY_INPUT:
|
||||
result = __codecvt_ok;
|
||||
break;
|
||||
|
||||
case __GCONV_FULL_OUTPUT:
|
||||
case __GCONV_INCOMPLETE_INPUT:
|
||||
result = __codecvt_partial;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = __codecvt_error;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* Decide what to do. */
|
||||
result = __codecvt_error;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static enum __codecvt_result
|
||||
do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep,
|
||||
char *to_start, char *to_end, char **to_stop)
|
||||
{
|
||||
enum __codecvt_result result;
|
||||
|
||||
#ifdef _LIBC
|
||||
struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
|
||||
int status;
|
||||
size_t written;
|
||||
|
||||
codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
|
||||
codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
|
||||
codecvt->__cd_out.__cd.__data[0].__statep = statep;
|
||||
|
||||
status = (*gs->__fct) (gs, codecvt->__cd_out.__cd.__data, NULL, NULL,
|
||||
&written, 1);
|
||||
|
||||
*to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case __GCONV_OK:
|
||||
case __GCONV_EMPTY_INPUT:
|
||||
result = __codecvt_ok;
|
||||
break;
|
||||
|
||||
case __GCONV_FULL_OUTPUT:
|
||||
case __GCONV_INCOMPLETE_INPUT:
|
||||
result = __codecvt_partial;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = __codecvt_error;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* Decide what to do. */
|
||||
result = __codecvt_error;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static enum __codecvt_result
|
||||
do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, const char **from_stop,
|
||||
wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop)
|
||||
{
|
||||
enum __codecvt_result result;
|
||||
|
||||
#ifdef _LIBC
|
||||
struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
|
||||
int status;
|
||||
size_t written;
|
||||
const unsigned char *from_start_copy = (unsigned char *) from_start;
|
||||
|
||||
codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_start;
|
||||
codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) to_end;
|
||||
codecvt->__cd_in.__cd.__data[0].__statep = statep;
|
||||
|
||||
status = (*gs->__fct) (gs, codecvt->__cd_in.__cd.__data, &from_start_copy,
|
||||
from_end, &written, 0);
|
||||
|
||||
*from_stop = from_start_copy;
|
||||
*to_stop = (wchar_t *) codecvt->__cd_in.__cd.__data[0].__outbuf;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case __GCONV_OK:
|
||||
case __GCONV_EMPTY_INPUT:
|
||||
result = __codecvt_ok;
|
||||
break;
|
||||
|
||||
case __GCONV_FULL_OUTPUT:
|
||||
case __GCONV_INCOMPLETE_INPUT:
|
||||
result = __codecvt_partial;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = __codecvt_error;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* Decide what to do. */
|
||||
result = __codecvt_error;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_encoding (struct _IO_codecvt *codecvt)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
/* See whether the encoding is stateful. */
|
||||
if (codecvt->__cd_in.__cd.__steps[0].__stateful)
|
||||
return -1;
|
||||
/* Fortunately not. Now determine the input bytes for the conversion
|
||||
necessary for each wide character. */
|
||||
if (codecvt->__cd_in.__cd.__steps[0].__min_needed_from
|
||||
!= codecvt->__cd_in.__cd.__steps[0].__max_needed_from)
|
||||
/* Not a constant value. */
|
||||
return 0;
|
||||
|
||||
return codecvt->__cd_in.__cd.__steps[0].__min_needed_from;
|
||||
#else
|
||||
/* Worst case scenario. */
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_always_noconv (struct _IO_codecvt *codecvt)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, _IO_size_t max)
|
||||
{
|
||||
int result;
|
||||
#ifdef _LIBC
|
||||
const unsigned char *cp = (const unsigned char *) from_start;
|
||||
wchar_t to_buf[max];
|
||||
struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
|
||||
int status;
|
||||
size_t written;
|
||||
|
||||
codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_buf;
|
||||
codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) &to_buf[max];
|
||||
codecvt->__cd_in.__cd.__data[0].__statep = statep;
|
||||
|
||||
status = (*gs->__fct) (gs, codecvt->__cd_in.__cd.__data, &cp, from_end,
|
||||
&written, 0);
|
||||
|
||||
result = cp - (const unsigned char *) from_start;
|
||||
#else
|
||||
/* Decide what to do. */
|
||||
result = 0;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_max_length (struct _IO_codecvt *codecvt)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
return codecvt->__cd_in.__cd.__steps[0].__max_needed_from;
|
||||
#else
|
||||
return MB_CUR_MAX;
|
||||
#endif
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -33,7 +33,7 @@ _IO_fwrite (buf, size, count, fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t request = size * count;
|
||||
_IO_size_t written;
|
||||
_IO_size_t written = 0;
|
||||
CHECK_FILE (fp, 0);
|
||||
/* Many traditional implementations return 0 if size==0 && count > 0,
|
||||
but ANSI requires us to return count in this case. */
|
||||
@ -41,6 +41,7 @@ _IO_fwrite (buf, size, count, fp)
|
||||
return count;
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
if (_IO_fwide (fp, -1) == -1)
|
||||
written = _IO_sputn (fp, (const char *) buf, request);
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -36,15 +36,18 @@ fwrite_unlocked (buf, size, count, fp)
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
_IO_size_t request = size * count;
|
||||
_IO_size_t written;
|
||||
_IO_size_t written = 0;
|
||||
CHECK_FILE (fp, 0);
|
||||
/* Many traditional implementations return 0 if size==0 && count > 0,
|
||||
but ANSI requires us to return count in this case. */
|
||||
if (request == 0)
|
||||
return count;
|
||||
if (_IO_fwide (fp, -1) == -1)
|
||||
{
|
||||
written = _IO_sputn (fp, (const char *) buf, request);
|
||||
if (written == request)
|
||||
return count;
|
||||
else
|
||||
}
|
||||
|
||||
return written / size;
|
||||
}
|
||||
|
120
libio/iogetwline.c
Normal file
120
libio/iogetwline.c
Normal file
@ -0,0 +1,120 @@
|
||||
/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#if defined _LIBC || !_G_HAVE_IO_GETLINE_INFO
|
||||
|
||||
_IO_size_t
|
||||
_IO_getwline (fp, buf, n, delim, extract_delim)
|
||||
_IO_FILE *fp;
|
||||
wchar_t *buf;
|
||||
_IO_size_t n;
|
||||
wint_t delim;
|
||||
int extract_delim;
|
||||
{
|
||||
return _IO_getwline_info (fp, buf, n, delim, extract_delim, (wint_t *) 0);
|
||||
}
|
||||
|
||||
/* Algorithm based on that used by Berkeley pre-4.4 fgets implementation.
|
||||
|
||||
Read chars into buf (of size n), until delim is seen.
|
||||
Return number of chars read (at most n).
|
||||
Does not put a terminating '\0' in buf.
|
||||
If extract_delim < 0, leave delimiter unread.
|
||||
If extract_delim > 0, insert delim in output. */
|
||||
|
||||
_IO_size_t
|
||||
_IO_getwline_info (fp, buf, n, delim, extract_delim, eof)
|
||||
_IO_FILE *fp;
|
||||
wchar_t *buf;
|
||||
_IO_size_t n;
|
||||
wint_t delim;
|
||||
int extract_delim;
|
||||
wint_t *eof;
|
||||
{
|
||||
wchar_t *ptr = buf;
|
||||
if (eof != NULL)
|
||||
*eof = 0;
|
||||
while (n != 0)
|
||||
{
|
||||
_IO_ssize_t len = (fp->_wide_data->_IO_read_end
|
||||
- fp->_wide_data->_IO_read_ptr);
|
||||
if (len <= 0)
|
||||
{
|
||||
wint_t wc = __wuflow (fp);
|
||||
if (wc == WEOF)
|
||||
{
|
||||
if (eof)
|
||||
*eof = wc;
|
||||
break;
|
||||
}
|
||||
if (wc == delim)
|
||||
{
|
||||
if (extract_delim > 0)
|
||||
*ptr++ = wc;
|
||||
else if (extract_delim < 0)
|
||||
_IO_sputbackc (fp, wc);
|
||||
return ptr - buf;
|
||||
if (extract_delim > 0)
|
||||
++len;
|
||||
}
|
||||
*ptr++ = wc;
|
||||
n--;
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t *t;
|
||||
if ((_IO_size_t) len >= n)
|
||||
len = n;
|
||||
t = (wchar_t *) memchr ((void *) fp->_wide_data->_IO_read_ptr,
|
||||
delim, len);
|
||||
if (t != NULL)
|
||||
{
|
||||
_IO_size_t old_len = ptr - buf;
|
||||
len = t - fp->_wide_data->_IO_read_ptr;
|
||||
if (extract_delim >= 0)
|
||||
{
|
||||
++t;
|
||||
if (extract_delim > 0)
|
||||
++len;
|
||||
}
|
||||
memcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr,
|
||||
len);
|
||||
fp->_wide_data->_IO_read_ptr = t;
|
||||
return old_len + len;
|
||||
}
|
||||
memcpy ((void *) ptr, (void *) fp->_wide_data->_IO_read_ptr, len);
|
||||
fp->_wide_data->_IO_read_ptr += len;
|
||||
ptr += len;
|
||||
n -= len;
|
||||
}
|
||||
}
|
||||
return ptr - buf;
|
||||
}
|
||||
|
||||
#endif /* Defined _LIBC || !_G_HAVE_IO_GETLINE_INFO */
|
@ -41,13 +41,15 @@ extern int _IO_sprintf __P((char *, const char*, ...));
|
||||
extern int _IO_ungetc __P((int, _IO_FILE*));
|
||||
extern int _IO_vsscanf __P((const char *, const char *, _IO_va_list));
|
||||
extern int _IO_vsprintf __P((char*, const char*, _IO_va_list));
|
||||
extern int _IO_vswprintf __P((wchar_t*, _IO_size_t, const wchar_t*,
|
||||
_IO_va_list));
|
||||
|
||||
struct obstack;
|
||||
extern int _IO_obstack_vprintf __P ((struct obstack *, const char *,
|
||||
_IO_va_list));
|
||||
extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...));
|
||||
#ifndef _IO_pos_BAD
|
||||
#define _IO_pos_BAD ((_IO_fpos64_t)(-1))
|
||||
#define _IO_pos_BAD ((_IO_off64_t)(-1))
|
||||
#endif
|
||||
#define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
|
||||
#define _IO_fseek(__fp, __offset, __whence) \
|
||||
|
@ -101,6 +101,8 @@ struct _IO_proc_file
|
||||
};
|
||||
typedef struct _IO_proc_file _IO_proc_file;
|
||||
|
||||
static struct _IO_jump_t _IO_wproc_jumps;
|
||||
|
||||
static struct _IO_proc_file *proc_file_chain;
|
||||
|
||||
_IO_FILE *
|
||||
@ -186,6 +188,7 @@ _IO_new_popen (command, mode)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_t lock;
|
||||
#endif
|
||||
struct _IO_wide_data wd;
|
||||
} *new_f;
|
||||
_IO_FILE *fp;
|
||||
|
||||
@ -196,7 +199,7 @@ _IO_new_popen (command, mode)
|
||||
new_f->fpx.file.file._lock = &new_f->lock;
|
||||
#endif
|
||||
fp = &new_f->fpx.file.file;
|
||||
_IO_init (fp, 0);
|
||||
_IO_no_init (fp, 0, 0, &new_f->wd, &_IO_wproc_jumps);
|
||||
_IO_JUMPS (fp) = &_IO_proc_jumps;
|
||||
_IO_new_file_init (fp);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
@ -273,6 +276,29 @@ struct _IO_jump_t _IO_proc_jumps = {
|
||||
JUMP_INIT(imbue, _IO_default_imbue)
|
||||
};
|
||||
|
||||
static struct _IO_jump_t _IO_wproc_jumps = {
|
||||
JUMP_INIT_DUMMY,
|
||||
JUMP_INIT(finish, _IO_new_file_finish),
|
||||
JUMP_INIT(overflow, _IO_new_file_overflow),
|
||||
JUMP_INIT(underflow, _IO_new_file_underflow),
|
||||
JUMP_INIT(uflow, _IO_default_uflow),
|
||||
JUMP_INIT(pbackfail, _IO_default_pbackfail),
|
||||
JUMP_INIT(xsputn, _IO_new_file_xsputn),
|
||||
JUMP_INIT(xsgetn, _IO_default_xsgetn),
|
||||
JUMP_INIT(seekoff, _IO_new_file_seekoff),
|
||||
JUMP_INIT(seekpos, _IO_default_seekpos),
|
||||
JUMP_INIT(setbuf, _IO_new_file_setbuf),
|
||||
JUMP_INIT(sync, _IO_new_file_sync),
|
||||
JUMP_INIT(doallocate, _IO_file_doallocate),
|
||||
JUMP_INIT(read, _IO_file_read),
|
||||
JUMP_INIT(write, _IO_new_file_write),
|
||||
JUMP_INIT(seek, _IO_file_seek),
|
||||
JUMP_INIT(close, _IO_new_proc_close),
|
||||
JUMP_INIT(stat, _IO_file_stat),
|
||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
||||
JUMP_INIT(imbue, _IO_default_imbue)
|
||||
};
|
||||
|
||||
#if defined PIC && DO_VERSIONING
|
||||
strong_alias (_IO_new_popen, __new_popen)
|
||||
default_symbol_version (_IO_new_popen, _IO_popen, GLIBC_2.1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -30,16 +30,17 @@ int
|
||||
_IO_puts (str)
|
||||
const char *str;
|
||||
{
|
||||
int result;
|
||||
int result = EOF;
|
||||
_IO_size_t len = strlen (str);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
|
||||
_IO_stdout);
|
||||
_IO_flockfile (_IO_stdout);
|
||||
if (_IO_sputn (_IO_stdout, str, len) == len
|
||||
|
||||
if (_IO_fwide (_IO_stdout, -1) == -1
|
||||
&& _IO_sputn (_IO_stdout, str, len) == len
|
||||
&& _IO_putc_unlocked ('\n', _IO_stdout) != EOF)
|
||||
result = len + 1;
|
||||
else
|
||||
result = EOF;
|
||||
|
||||
_IO_funlockfile (_IO_stdout);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -32,14 +32,14 @@ extern int errno;
|
||||
# define __set_errno(Val) errno = (Val)
|
||||
#endif
|
||||
|
||||
_IO_fpos64_t
|
||||
_IO_off64_t
|
||||
_IO_seekoff (fp, offset, dir, mode)
|
||||
_IO_FILE *fp;
|
||||
_IO_off64_t offset;
|
||||
int dir;
|
||||
int mode;
|
||||
{
|
||||
_IO_fpos64_t retval;
|
||||
_IO_off64_t retval;
|
||||
|
||||
if (dir != _IO_seek_cur && dir != _IO_seek_set && dir != _IO_seek_end)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -25,13 +25,13 @@
|
||||
|
||||
#include <libioP.h>
|
||||
|
||||
_IO_fpos64_t
|
||||
_IO_off64_t
|
||||
_IO_seekpos (fp, pos, mode)
|
||||
_IO_FILE *fp;
|
||||
_IO_fpos64_t pos;
|
||||
_IO_off64_t pos;
|
||||
int mode;
|
||||
{
|
||||
_IO_fpos64_t retval;
|
||||
_IO_off64_t retval;
|
||||
|
||||
/* If we have a backup buffer, get rid of it, since the __seekoff
|
||||
callback may not know to do the right thing about it.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -38,6 +38,9 @@ _IO_setbuffer (fp, buf, size)
|
||||
if (!buf)
|
||||
size = 0;
|
||||
(void) _IO_SETBUF (fp, buf, size);
|
||||
if (fp->_mode == 0)
|
||||
/* We also have to set the buffer using the wide char function. */
|
||||
(*fp->_wide_data->_wide_vtable->__setbuf) (fp, buf, size);
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -90,6 +90,10 @@ _IO_setvbuf (fp, buf, mode, size)
|
||||
goto unlock_return;
|
||||
}
|
||||
result = _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0;
|
||||
if (result == 0 && fp->_mode > 0)
|
||||
/* We also have to set the buffer using the wide char function. */
|
||||
result = ((*fp->_wide_data->_wide_vtable->__setbuf) (fp, buf, size) == NULL
|
||||
? EOF : 0);
|
||||
unlock_return:
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
|
44
libio/ioungetwc.c
Normal file
44
libio/ioungetwc.c
Normal file
@ -0,0 +1,44 @@
|
||||
/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
wint_t
|
||||
ungetwc (c, fp)
|
||||
wint_t c;
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
int result;
|
||||
CHECK_FILE (fp, WEOF);
|
||||
if (c == WEOF)
|
||||
return WEOF;
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
result = _IO_sputbackwc (fp, c);
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -36,12 +36,13 @@ _IO_vdprintf (d, format, arg)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_t lock;
|
||||
#endif
|
||||
struct _IO_wide_data wd;
|
||||
int done;
|
||||
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
tmpfil.file._lock = &lock;
|
||||
#endif
|
||||
_IO_init (&tmpfil.file, 0);
|
||||
_IO_no_init (&tmpfil.file, 0, 0, &wd, &_IO_wfile_jumps);
|
||||
_IO_JUMPS (&tmpfil.file) = &_IO_file_jumps;
|
||||
_IO_file_init (&tmpfil.file);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -41,7 +41,7 @@ _IO_vsprintf (string, format, args)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
sf._sbf._f._lock = &lock;
|
||||
#endif
|
||||
_IO_init (&sf._sbf._f, 0);
|
||||
_IO_no_init (&sf._sbf._f, 0, -1, NULL, NULL);
|
||||
_IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps;
|
||||
_IO_str_init_static (&sf._sbf._f, string, -1, string);
|
||||
ret = _IO_vfprintf (&sf._sbf._f, format, args);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -38,7 +38,7 @@ _IO_vsscanf (string, format, args)
|
||||
_IO_lock_t lock;
|
||||
sf._sbf._f._lock = &lock;
|
||||
#endif
|
||||
_IO_init (&sf._sbf._f, 0);
|
||||
_IO_no_init (&sf._sbf._f, 0, -1, NULL, NULL);
|
||||
_IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps;
|
||||
_IO_str_init_static (&sf._sbf._f, (char*)string, 0, NULL);
|
||||
ret = _IO_vfscanf (&sf._sbf._f, format, args, NULL);
|
||||
|
48
libio/iovswscanf.c
Normal file
48
libio/iovswscanf.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include "strfile.h"
|
||||
#include <wchar.h>
|
||||
|
||||
int
|
||||
vswscanf (string, format, args)
|
||||
const wchar_t *string;
|
||||
const wchar_t *format;
|
||||
_IO_va_list args;
|
||||
{
|
||||
int ret;
|
||||
_IO_strfile sf;
|
||||
struct _IO_wide_data wd;
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_t lock;
|
||||
sf._sbf._f._lock = &lock;
|
||||
#endif
|
||||
_IO_no_init (&sf._sbf._f, 0, 1, &wd, &_IO_wstr_jumps);
|
||||
_IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps;
|
||||
_IO_wstr_init_static (&sf._sbf._f, (wchar_t *)string, 0, NULL);
|
||||
ret = _IO_vfwscanf (&sf._sbf._f, format, args, NULL);
|
||||
return ret;
|
||||
}
|
76
libio/iowpadn.c
Normal file
76
libio/iowpadn.c
Normal file
@ -0,0 +1,76 @@
|
||||
/* Copyright (C) 1993, 1997, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
|
||||
#define PADSIZE 16
|
||||
static wchar_t const blanks[PADSIZE] =
|
||||
{
|
||||
L' ', L' ', L' ', L' ', L' ', L' ', L' ', L' ',
|
||||
L' ', L' ', L' ', L' ', L' ', L' ', L' ', L' '
|
||||
};
|
||||
static wchar_t const zeroes[PADSIZE] =
|
||||
{
|
||||
L'0', L'0', L'0', L'0', L'0', L'0', L'0', L'0',
|
||||
L'0', L'0', L'0', L'0', L'0', L'0', L'0', L'0'
|
||||
};
|
||||
|
||||
_IO_ssize_t
|
||||
_IO_wpadn (fp, pad, count)
|
||||
_IO_FILE *fp;
|
||||
wint_t pad;
|
||||
_IO_ssize_t count;
|
||||
{
|
||||
wchar_t padbuf[PADSIZE];
|
||||
const wchar_t *padptr;
|
||||
int i;
|
||||
_IO_size_t written = 0;
|
||||
_IO_size_t w;
|
||||
|
||||
if (pad == L' ')
|
||||
padptr = blanks;
|
||||
else if (pad == L'0')
|
||||
padptr = zeroes;
|
||||
else
|
||||
{
|
||||
for (i = PADSIZE; --i >= 0; )
|
||||
padbuf[i] = pad;
|
||||
padptr = padbuf;
|
||||
}
|
||||
for (i = count; i >= PADSIZE; i -= PADSIZE)
|
||||
{
|
||||
w = _IO_sputn (fp, (char *) padptr, PADSIZE);
|
||||
written += w;
|
||||
if (w != PADSIZE)
|
||||
return written;
|
||||
}
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
w = _IO_sputn (fp, (char *) padptr, i);
|
||||
written += w;
|
||||
}
|
||||
return written;
|
||||
}
|
114
libio/libio.h
114
libio/libio.h
@ -37,10 +37,12 @@
|
||||
#define _IO_off64_t _G_off64_t
|
||||
#define _IO_pid_t _G_pid_t
|
||||
#define _IO_uid_t _G_uid_t
|
||||
#define _IO_iconv_t _G_iconv_t
|
||||
#define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT
|
||||
#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
|
||||
#define _IO_BUFSIZ _G_BUFSIZ
|
||||
#define _IO_va_list _G_va_list
|
||||
#define _IO_wint_t _G_wint_t
|
||||
|
||||
#ifdef _G_NEED_STDARG_H
|
||||
/* This define avoids name pollution if we're using GNU stdarg.h */
|
||||
@ -186,6 +188,70 @@ struct _IO_marker {
|
||||
#endif
|
||||
};
|
||||
|
||||
/* This is the structure from the libstdc++ codecvt class. */
|
||||
enum __codecvt_result
|
||||
{
|
||||
__codecvt_ok,
|
||||
__codecvt_partial,
|
||||
__codecvt_error,
|
||||
__codecvt_noconv
|
||||
};
|
||||
|
||||
/* The order of the elements in the following struct must match the order
|
||||
of the virtual functions in the libstdc++ codecvt class. */
|
||||
struct _IO_codecvt
|
||||
{
|
||||
void (*__codecvt_destr) __P ((struct _IO_codecvt *));
|
||||
enum __codecvt_result (*__codecvt_do_out) __P ((struct _IO_codecvt *,
|
||||
__mbstate_t *,
|
||||
const wchar_t *,
|
||||
const wchar_t *,
|
||||
const wchar_t **, char *,
|
||||
char *, char **));
|
||||
enum __codecvt_result (*__codecvt_do_unshift) __P ((struct _IO_codecvt *,
|
||||
__mbstate_t *, char *,
|
||||
char *, char **));
|
||||
enum __codecvt_result (*__codecvt_do_in) __P ((struct _IO_codecvt *,
|
||||
__mbstate_t *,
|
||||
const char *, const char *,
|
||||
const char **, wchar_t *,
|
||||
wchar_t *, wchar_t **));
|
||||
int (*__codecvt_do_encoding) __P ((struct _IO_codecvt *));
|
||||
int (*__codecvt_do_always_noconv) __P ((struct _IO_codecvt *));
|
||||
int (*__codecvt_do_length) __P ((struct _IO_codecvt *, __mbstate_t *,
|
||||
const char *, const char *, _IO_size_t));
|
||||
int (*__codecvt_do_max_length) __P ((struct _IO_codecvt *));
|
||||
|
||||
_IO_iconv_t __cd_in;
|
||||
_IO_iconv_t __cd_out;
|
||||
};
|
||||
|
||||
/* Extra data for wide character streams. */
|
||||
struct _IO_wide_data
|
||||
{
|
||||
wchar_t *_IO_read_ptr; /* Current read pointer */
|
||||
wchar_t *_IO_read_end; /* End of get area. */
|
||||
wchar_t *_IO_read_base; /* Start of putback+get area. */
|
||||
wchar_t *_IO_write_base; /* Start of put area. */
|
||||
wchar_t *_IO_write_ptr; /* Current put pointer. */
|
||||
wchar_t *_IO_write_end; /* End of put area. */
|
||||
wchar_t *_IO_buf_base; /* Start of reserve area. */
|
||||
wchar_t *_IO_buf_end; /* End of reserve area. */
|
||||
/* The following fields are used to support backing up and undo. */
|
||||
wchar_t *_IO_save_base; /* Pointer to start of non-current get area. */
|
||||
wchar_t *_IO_backup_base; /* Pointer to first valid character of
|
||||
backup area */
|
||||
wchar_t *_IO_save_end; /* Pointer to end of non-current get area. */
|
||||
|
||||
__mbstate_t _IO_state;
|
||||
__mbstate_t _IO_last_state;
|
||||
struct _IO_codecvt _codecvt;
|
||||
|
||||
wchar_t _shortbuf[1];
|
||||
|
||||
struct _IO_jump_t *_wide_vtable;
|
||||
};
|
||||
|
||||
struct _IO_FILE {
|
||||
int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
|
||||
#define _IO_file_flags _flags
|
||||
@ -231,8 +297,12 @@ struct _IO_FILE_complete
|
||||
#endif
|
||||
#if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
|
||||
_IO_off64_t _offset;
|
||||
/* Wide character stream stuff. */
|
||||
struct _IO_codecvt *_codecvt;
|
||||
struct _IO_wide_data *_wide_data;
|
||||
int _mode;
|
||||
/* Make sure we don't get into trouble again. */
|
||||
int _unused2[16];
|
||||
char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -318,6 +388,9 @@ extern "C" {
|
||||
extern int __underflow __P ((_IO_FILE *));
|
||||
extern int __uflow __P ((_IO_FILE *));
|
||||
extern int __overflow __P ((_IO_FILE *, int));
|
||||
extern _IO_wint_t __wunderflow __P ((_IO_FILE *));
|
||||
extern _IO_wint_t __wuflow __P ((_IO_FILE *));
|
||||
extern _IO_wint_t __woverflow __P ((_IO_FILE *, _IO_wint_t));
|
||||
|
||||
#define _IO_getc_unlocked(_fp) \
|
||||
((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow (_fp) \
|
||||
@ -331,16 +404,44 @@ extern int __overflow __P ((_IO_FILE *, int));
|
||||
? __overflow (_fp, (unsigned char) (_ch)) \
|
||||
: (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
|
||||
|
||||
#define _IO_getwc_unlocked(_fp) \
|
||||
((_fp)->_wide_data->_IO_read_ptr >= (_fp)->_wide_data->_IO_read_end \
|
||||
? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
|
||||
#define _IO_putwc_unlocked(_wch, _fp) \
|
||||
((_fp)->_wide_data->_IO_write_ptr >= (_fp)->_wide_data->_IO_write_end \
|
||||
? __woverflow (_fp, _wch) \
|
||||
: (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
|
||||
|
||||
#define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
|
||||
#define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
|
||||
|
||||
extern int _IO_getc __P ((_IO_FILE *__fp));
|
||||
extern int _IO_putc __P ((int __c, _IO_FILE *__fp));
|
||||
extern _IO_wint_t _IO_getwc __P ((_IO_FILE *__fp));
|
||||
extern _IO_wint_t _IO_putwc __P ((_IO_wint_t __wc, _IO_FILE *__fp));
|
||||
extern int _IO_feof __P ((_IO_FILE *__fp));
|
||||
extern int _IO_ferror __P ((_IO_FILE *__fp));
|
||||
|
||||
extern int _IO_peekc_locked __P ((_IO_FILE *__fp));
|
||||
|
||||
extern int _IO_fwide __P ((_IO_FILE *__fp, int __mode));
|
||||
#if __GNUC__ >= 2
|
||||
/* A special optimized version of the function above. It optimizes the
|
||||
case of initializing an unoriented byte stream. */
|
||||
# define _IO_fwide(__fp, __mode) \
|
||||
({ int __result = (__mode); \
|
||||
if (__result < 0) \
|
||||
{ \
|
||||
if ((__fp)->_mode == 0) \
|
||||
/* We know that all we have to do is to set the flag. */ \
|
||||
(__fp)->_mode = -1; \
|
||||
__result = (__fp)->_mode; \
|
||||
} \
|
||||
else \
|
||||
__result = _IO_fwide (__fp, __result); \
|
||||
__result; })
|
||||
#endif
|
||||
|
||||
/* This one is for Emacs. */
|
||||
#define _IO_PENDING_OUTPUT_COUNT(_fp) \
|
||||
((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
|
||||
@ -362,15 +463,22 @@ extern int _IO_ftrylockfile __P ((_IO_FILE *));
|
||||
|
||||
extern int _IO_vfscanf __P ((_IO_FILE * __restrict, const char * __restrict,
|
||||
_IO_va_list, int *__restrict));
|
||||
extern int _IO_vfwscanf __P ((_IO_FILE * __restrict,
|
||||
const wchar_t * __restrict,
|
||||
_IO_va_list, int *__restrict));
|
||||
extern int _IO_vfprintf __P ((_IO_FILE *__restrict, const char *__restrict,
|
||||
_IO_va_list));
|
||||
extern int _IO_vfwprintf __P ((_IO_FILE *__restrict, const wchar_t *__restrict,
|
||||
_IO_va_list));
|
||||
extern _IO_ssize_t _IO_padn __P ((_IO_FILE *, int, _IO_ssize_t));
|
||||
extern _IO_ssize_t _IO_wpadn __P ((_IO_FILE *, wint_t, _IO_ssize_t));
|
||||
extern _IO_size_t _IO_sgetn __P ((_IO_FILE *, void *, _IO_size_t));
|
||||
|
||||
extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int));
|
||||
extern _IO_off64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_off64_t _IO_seekpos __P ((_IO_FILE *, _IO_off64_t, int));
|
||||
|
||||
extern void _IO_free_backup_area __P ((_IO_FILE *));
|
||||
extern void _IO_free_wbackup_area __P ((_IO_FILE *));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
151
libio/libioP.h
151
libio/libioP.h
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -70,6 +70,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define _IO_JUMPS(THIS) ((struct _IO_FILE_plus *) (THIS))->vtable
|
||||
#define _IO_WIDE_JUMPS(THIS) ((struct _IO_FILE *) (THIS))->_wide_data->_wide_vtable
|
||||
#if _IO_JUMPS_OFFSET
|
||||
# define _IO_JUMPS_FUNC(THIS) \
|
||||
(*(struct _IO_jump_t **) ((void *) &((struct _IO_FILE_plus *) (THIS))->vtable\
|
||||
@ -146,7 +147,7 @@ typedef _IO_size_t (*_IO_xsgetn_t) __PMT ((_IO_FILE *FP, void *DATA,
|
||||
(MODE==1), or the end of the file (MODE==2).
|
||||
It matches the streambuf::seekoff virtual function.
|
||||
It is also used for the ANSI fseek function. */
|
||||
typedef _IO_fpos64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF,
|
||||
typedef _IO_off64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF,
|
||||
int DIR, int MODE));
|
||||
#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
|
||||
|
||||
@ -155,7 +156,7 @@ typedef _IO_fpos64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF,
|
||||
It matches the streambuf::seekpos virtual function.
|
||||
It is also used for the ANSI fgetpos and fsetpos functions. */
|
||||
/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
|
||||
typedef _IO_fpos64_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_fpos64_t, int));
|
||||
typedef _IO_off64_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
|
||||
#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
|
||||
|
||||
/* The 'setbuf' hook gives a buffer to the file.
|
||||
@ -205,7 +206,7 @@ typedef _IO_ssize_t (*_IO_write_t) __PMT ((_IO_FILE *, const void *,
|
||||
It generalizes the Unix lseek(2) function.
|
||||
It matches the streambuf::sys_seek virtual function, which is
|
||||
specific to this implementation. */
|
||||
typedef _IO_fpos64_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
|
||||
typedef _IO_off64_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
|
||||
#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
|
||||
|
||||
/* The 'sysclose' hook is used to finalize (close, finish up) an
|
||||
@ -282,9 +283,6 @@ struct _IO_FILE_plus
|
||||
|
||||
/* Generic functions */
|
||||
|
||||
extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int));
|
||||
|
||||
extern void _IO_switch_to_main_get_area __P ((_IO_FILE *));
|
||||
extern void _IO_switch_to_backup_area __P ((_IO_FILE *));
|
||||
extern int _IO_switch_to_get_mode __P ((_IO_FILE *));
|
||||
@ -299,56 +297,94 @@ extern void _IO_setb __P ((_IO_FILE *, char *, char *, int));
|
||||
extern unsigned _IO_adjust_column __P ((unsigned, const char *, int));
|
||||
#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN (__fp, __s, __n)
|
||||
|
||||
extern void _IO_switch_to_main_wget_area __P ((_IO_FILE *));
|
||||
extern void _IO_switch_to_wbackup_area __P ((_IO_FILE *));
|
||||
extern int _IO_switch_to_wget_mode __P ((_IO_FILE *));
|
||||
extern void _IO_wsetb __P ((_IO_FILE *, wchar_t *, wchar_t *, int));
|
||||
extern wint_t _IO_sputbackwc __P ((_IO_FILE *, wint_t));
|
||||
extern wint_t _IO_sungetwc __P ((_IO_FILE *));
|
||||
extern void _IO_wdoallocbuf __P ((_IO_FILE *));
|
||||
extern void _IO_unsave_wmarkers __P ((_IO_FILE *));
|
||||
extern void _IO_wsetb __P ((_IO_FILE *, wchar_t *, wchar_t *, int));
|
||||
extern unsigned _IO_adjust_wcolumn __P ((unsigned, const wchar_t *, int));
|
||||
|
||||
/* Marker-related function. */
|
||||
|
||||
extern void _IO_init_marker __P ((struct _IO_marker *, _IO_FILE *));
|
||||
extern void _IO_init_wmarker __P ((struct _IO_marker *, _IO_FILE *));
|
||||
extern void _IO_remove_marker __P ((struct _IO_marker *));
|
||||
extern int _IO_marker_difference __P ((struct _IO_marker *,
|
||||
struct _IO_marker *));
|
||||
extern int _IO_marker_delta __P ((struct _IO_marker *));
|
||||
extern int _IO_wmarker_delta __P ((struct _IO_marker *));
|
||||
extern int _IO_seekmark __P ((_IO_FILE *, struct _IO_marker *, int));
|
||||
extern int _IO_seekwmark __P ((_IO_FILE *, struct _IO_marker *, int));
|
||||
|
||||
/* Default jumptable functions. */
|
||||
|
||||
extern int _IO_default_underflow __P ((_IO_FILE *));
|
||||
extern int _IO_default_uflow __P ((_IO_FILE *));
|
||||
extern wint_t _IO_wdefault_uflow __P ((_IO_FILE *));
|
||||
extern int _IO_default_doallocate __P ((_IO_FILE *));
|
||||
extern int _IO_wdefault_doallocate __P ((_IO_FILE *));
|
||||
extern void _IO_default_finish __P ((_IO_FILE *, int));
|
||||
extern void _IO_wdefault_finish __P ((_IO_FILE *, int));
|
||||
extern int _IO_default_pbackfail __P ((_IO_FILE *, int));
|
||||
extern wint_t _IO_wdefault_pbackfail __P ((_IO_FILE *, wint_t));
|
||||
extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||
extern _IO_FILE* _IO_wdefault_setbuf __P ((_IO_FILE *, wchar_t *,
|
||||
_IO_ssize_t));
|
||||
extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
|
||||
_IO_size_t));
|
||||
extern _IO_size_t _IO_wdefault_xsputn __P ((_IO_FILE *, const void *,
|
||||
_IO_size_t));
|
||||
extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
|
||||
extern _IO_fpos64_t _IO_default_seekoff __P ((_IO_FILE *,
|
||||
extern _IO_size_t _IO_wdefault_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
|
||||
extern _IO_off64_t _IO_default_seekoff __P ((_IO_FILE *,
|
||||
_IO_off64_t, int, int));
|
||||
extern _IO_fpos64_t _IO_default_seekpos __P ((_IO_FILE *,
|
||||
_IO_fpos64_t, int));
|
||||
extern _IO_off64_t _IO_default_seekpos __P ((_IO_FILE *, _IO_off64_t, int));
|
||||
extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *,
|
||||
_IO_ssize_t));
|
||||
extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t));
|
||||
extern int _IO_default_stat __P ((_IO_FILE *, void *));
|
||||
extern _IO_fpos64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
|
||||
extern _IO_off64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
|
||||
extern int _IO_default_sync __P ((_IO_FILE *));
|
||||
#define _IO_default_close ((_IO_close_t) _IO_default_sync)
|
||||
extern int _IO_default_showmanyc __P ((_IO_FILE *));
|
||||
extern void _IO_default_imbue __P ((_IO_FILE *, void *));
|
||||
|
||||
extern struct _IO_jump_t _IO_file_jumps;
|
||||
extern struct _IO_jump_t _IO_wfile_jumps;
|
||||
extern struct _IO_jump_t _IO_old_file_jumps;
|
||||
extern struct _IO_jump_t _IO_streambuf_jumps;
|
||||
extern struct _IO_jump_t _IO_proc_jumps;
|
||||
extern struct _IO_jump_t _IO_old_proc_jumps;
|
||||
extern struct _IO_jump_t _IO_str_jumps;
|
||||
extern struct _IO_jump_t _IO_wstr_jumps;
|
||||
extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
|
||||
extern int _IO_new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
|
||||
extern int _IO_old_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
|
||||
extern int _IO_wdo_write __P ((_IO_FILE *, const wchar_t *, _IO_size_t));
|
||||
extern int _IO_flush_all __P ((void));
|
||||
extern int _IO_cleanup __P ((void));
|
||||
extern void _IO_flush_all_linebuffered __P ((void));
|
||||
extern int _IO_new_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
|
||||
extern int _IO_old_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
|
||||
extern int _IO_new_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
|
||||
extern int _IO_old_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
|
||||
extern int _IO_new_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
|
||||
extern int _IO_old_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
|
||||
extern int _IO_new_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
|
||||
extern int _IO_old_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
|
||||
|
||||
|
||||
#define _IO_do_flush(_f) \
|
||||
_IO_do_write(_f, (_f)->_IO_write_base, \
|
||||
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
|
||||
((_f)->_mode <= 0 \
|
||||
? _IO_do_write(_f, (_f)->_IO_write_base, \
|
||||
(_f)->_IO_write_ptr-(_f)->_IO_write_base) \
|
||||
: _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base, \
|
||||
((_f)->_wide_data->_IO_write_ptr \
|
||||
- (_f)->_wide_data->_IO_write_base)))
|
||||
#define _IO_old_do_flush(_f) \
|
||||
_IO_old_do_write(_f, (_f)->_IO_write_base, \
|
||||
(_f)->_IO_write_ptr-(_f)->_IO_write_base)
|
||||
@ -357,18 +393,29 @@ extern void _IO_flush_all_linebuffered __P ((void));
|
||||
((fp)->_flags = ((fp)->_flags & ~(mask)) | ((f) & (mask)))
|
||||
#define _IO_setg(fp, eb, g, eg) ((fp)->_IO_read_base = (eb),\
|
||||
(fp)->_IO_read_ptr = (g), (fp)->_IO_read_end = (eg))
|
||||
#define _IO_wsetg(fp, eb, g, eg) ((fp)->_wide_data->_IO_read_base = (eb),\
|
||||
(fp)->_wide_data->_IO_read_ptr = (g), \
|
||||
(fp)->_wide_data->_IO_read_end = (eg))
|
||||
#define _IO_setp(__fp, __p, __ep) \
|
||||
((__fp)->_IO_write_base = (__fp)->_IO_write_ptr = __p, (__fp)->_IO_write_end = (__ep))
|
||||
((__fp)->_IO_write_base = (__fp)->_IO_write_ptr \
|
||||
= __p, (__fp)->_IO_write_end = (__ep))
|
||||
#define _IO_wsetp(__fp, __p, __ep) \
|
||||
((__fp)->_wide_data->_IO_write_base \
|
||||
= (__fp)->_wide_data->_IO_write_ptr = __p, \
|
||||
(__fp)->_wide_data->_IO_write_end = (__ep))
|
||||
#define _IO_have_backup(fp) ((fp)->_IO_save_base != NULL)
|
||||
#define _IO_have_wbackup(fp) ((fp)->_wide_data->_IO_save_base != NULL)
|
||||
#define _IO_in_backup(fp) ((fp)->_flags & _IO_IN_BACKUP)
|
||||
#define _IO_have_markers(fp) ((fp)->_markers != NULL)
|
||||
#define _IO_blen(fp) ((fp)->_IO_buf_end - (fp)->_IO_buf_base)
|
||||
#define _IO_wblen(fp) ((fp)->_wide_data->_IO_buf_end \
|
||||
- (fp)->_wide_data->_IO_buf_base)
|
||||
|
||||
/* Jumptable functions for files. */
|
||||
|
||||
extern int _IO_file_doallocate __P ((_IO_FILE *));
|
||||
extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||
extern _IO_fpos64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_off64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
|
||||
extern _IO_size_t _IO_file_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
|
||||
extern int _IO_file_stat __P ((_IO_FILE *, void *));
|
||||
@ -387,7 +434,7 @@ extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
|
||||
extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t));
|
||||
extern int _IO_file_sync __P ((_IO_FILE *));
|
||||
extern int _IO_file_close_it __P ((_IO_FILE *));
|
||||
extern _IO_fpos64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
|
||||
extern _IO_off64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
|
||||
extern void _IO_file_finish __P ((_IO_FILE *, int));
|
||||
|
||||
extern _IO_FILE* _IO_new_file_attach __P ((_IO_FILE *, int));
|
||||
@ -395,18 +442,20 @@ extern int _IO_new_file_close_it __P ((_IO_FILE *));
|
||||
extern void _IO_new_file_finish __P ((_IO_FILE *, int));
|
||||
extern _IO_FILE* _IO_new_file_fopen __P ((_IO_FILE *, const char *, const char *,
|
||||
int));
|
||||
extern void _IO_no_init __P ((_IO_FILE *, int, int, struct _IO_wide_data *,
|
||||
struct _IO_jump_t *));
|
||||
extern void _IO_new_file_init __P ((_IO_FILE *));
|
||||
extern _IO_FILE* _IO_new_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||
extern int _IO_new_file_sync __P ((_IO_FILE *));
|
||||
extern int _IO_new_file_underflow __P ((_IO_FILE *));
|
||||
extern int _IO_new_file_overflow __P ((_IO_FILE *, int));
|
||||
extern _IO_fpos64_t _IO_new_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_off64_t _IO_new_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_ssize_t _IO_new_file_write __P ((_IO_FILE *, const void *,
|
||||
_IO_ssize_t));
|
||||
extern _IO_size_t _IO_new_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
|
||||
|
||||
extern _IO_FILE* _IO_old_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
|
||||
extern _IO_fpos64_t _IO_old_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int,
|
||||
extern _IO_off64_t _IO_old_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int,
|
||||
int));
|
||||
extern _IO_size_t _IO_old_file_xsputn __P ((_IO_FILE *, const void *,
|
||||
_IO_size_t));
|
||||
@ -422,6 +471,15 @@ extern int _IO_old_file_sync __P ((_IO_FILE *));
|
||||
extern int _IO_old_file_close_it __P ((_IO_FILE *));
|
||||
extern void _IO_old_file_finish __P ((_IO_FILE *, int));
|
||||
|
||||
extern int _IO_wfile_doallocate __P ((_IO_FILE *));
|
||||
extern _IO_size_t _IO_wfile_xsputn __P ((_IO_FILE *, const void *,
|
||||
_IO_size_t));
|
||||
extern _IO_FILE* _IO_wfile_setbuf __P ((_IO_FILE *, wchar_t *, _IO_ssize_t));
|
||||
extern wint_t _IO_wfile_sync __P ((_IO_FILE *));
|
||||
extern wint_t _IO_wfile_underflow __P ((_IO_FILE *));
|
||||
extern wint_t _IO_wfile_overflow __P ((_IO_FILE *, wint_t));
|
||||
extern _IO_off64_t _IO_wfile_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
|
||||
/* Jumptable functions for proc_files. */
|
||||
extern _IO_FILE* _IO_proc_open __P ((_IO_FILE *, const char *, const char *));
|
||||
extern _IO_FILE* _IO_new_proc_open __P ((_IO_FILE *, const char *, const char *));
|
||||
@ -434,7 +492,7 @@ extern int _IO_old_proc_close __P ((_IO_FILE *));
|
||||
extern int _IO_str_underflow __P ((_IO_FILE *));
|
||||
extern int _IO_str_overflow __P ((_IO_FILE *, int));
|
||||
extern int _IO_str_pbackfail __P ((_IO_FILE *, int));
|
||||
extern _IO_fpos64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_off64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern void _IO_str_finish __P ((_IO_FILE *, int));
|
||||
|
||||
/* Other strfile functions */
|
||||
@ -442,6 +500,16 @@ extern void _IO_str_init_static __P ((_IO_FILE *, char *, int, char *));
|
||||
extern void _IO_str_init_readonly __P ((_IO_FILE *, const char *, int));
|
||||
extern _IO_ssize_t _IO_str_count __P ((_IO_FILE *));
|
||||
|
||||
/* And the wide character versions. */
|
||||
extern void _IO_wstr_init_static __P ((_IO_FILE *, wchar_t *, int, wchar_t *));
|
||||
extern void _IO_wstr_init_readonly __P ((_IO_FILE *, const char *, int));
|
||||
extern _IO_ssize_t _IO_wstr_count __P ((_IO_FILE *));
|
||||
extern _IO_wint_t _IO_wstr_overflow __P ((_IO_FILE *, _IO_wint_t));
|
||||
extern _IO_wint_t _IO_wstr_underflow __P ((_IO_FILE *));
|
||||
extern _IO_off64_t _IO_wstr_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
|
||||
extern _IO_wint_t _IO_wstr_pbackfail __P ((_IO_FILE *, _IO_wint_t));
|
||||
extern void _IO_wstr_finish __P ((_IO_FILE *, int));
|
||||
|
||||
extern int _IO_vasprintf __P ((char **result_ptr, __const char *format,
|
||||
_IO_va_list args));
|
||||
extern int _IO_vdprintf __P ((int d, __const char *format, _IO_va_list arg));
|
||||
@ -453,6 +521,10 @@ extern _IO_size_t _IO_getline __P ((_IO_FILE *,char *, _IO_size_t, int, int));
|
||||
extern _IO_size_t _IO_getline_info __P ((_IO_FILE *,char *, _IO_size_t,
|
||||
int, int, int *));
|
||||
extern _IO_ssize_t _IO_getdelim __P ((char **, _IO_size_t *, int, _IO_FILE *));
|
||||
extern _IO_size_t _IO_getwline __P ((_IO_FILE *,wchar_t *, _IO_size_t, wint_t,
|
||||
int));
|
||||
extern _IO_size_t _IO_getwline_info __P ((_IO_FILE *,wchar_t *, _IO_size_t,
|
||||
wint_t, int, wint_t *));
|
||||
extern double _IO_strtod __P ((const char *, char **));
|
||||
extern char *_IO_dtoa __P ((double __d, int __mode, int __ndigits,
|
||||
int *__decpt, int *__sign, char **__rve));
|
||||
@ -516,7 +588,15 @@ extern void (*_IO_cleanup_registration_needed) __PMT ((void));
|
||||
(_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \
|
||||
PROT_READ | PROT_WRITE, \
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
|
||||
if ((_B) == (char *) -1) \
|
||||
if ((_B) == (char *) MAP_FAILED) \
|
||||
return (_R); \
|
||||
} while (0)
|
||||
# define ALLOC_WBUF(_B, _S, _R) \
|
||||
do { \
|
||||
(_B) = (wchar_t *) mmap (0, ROUND_TO_PAGE (_S), \
|
||||
PROT_READ | PROT_WRITE, \
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
|
||||
if ((_B) == (wchar_t *) MAP_FAILED) \
|
||||
return (_R); \
|
||||
} while (0)
|
||||
|
||||
@ -544,26 +624,17 @@ extern int _IO_close __P ((int));
|
||||
extern int _IO_fstat __P ((int, struct stat *));
|
||||
extern int _IO_vscanf __P ((const char *, _IO_va_list));
|
||||
|
||||
/* Operations on _IO_fpos64_t.
|
||||
Normally, these are trivial, but we provide hooks for configurations
|
||||
where an _IO_fpos64_t is a struct.
|
||||
Note that _IO_off64_t must be an integral type. */
|
||||
|
||||
/* _IO_pos_BAD is an _IO_fpos64_t value indicating error, unknown, or EOF. */
|
||||
/* _IO_pos_BAD is an _IO_off64_t value indicating error, unknown, or EOF. */
|
||||
#ifndef _IO_pos_BAD
|
||||
# define _IO_pos_BAD ((_IO_fpos64_t) -1)
|
||||
# define _IO_pos_BAD ((_IO_off64_t) -1)
|
||||
#endif
|
||||
/* _IO_pos_as_off converts an _IO_fpos64_t value to an _IO_off64_t value. */
|
||||
#ifndef _IO_pos_as_off
|
||||
# define _IO_pos_as_off(__pos) ((_IO_off64_t) (__pos))
|
||||
#endif
|
||||
/* _IO_pos_adjust adjust an _IO_fpos64_t by some number of bytes. */
|
||||
/* _IO_pos_adjust adjust an _IO_off64_t by some number of bytes. */
|
||||
#ifndef _IO_pos_adjust
|
||||
# define _IO_pos_adjust(__pos, __delta) ((__pos) += (__delta))
|
||||
# define _IO_pos_adjust(pos, delta) ((pos) += (delta))
|
||||
#endif
|
||||
/* _IO_pos_0 is an _IO_fpos64_t value indicating beginning of file. */
|
||||
/* _IO_pos_0 is an _IO_off64_t value indicating beginning of file. */
|
||||
#ifndef _IO_pos_0
|
||||
# define _IO_pos_0 ((_IO_fpos64_t) 0)
|
||||
# define _IO_pos_0 ((_IO_off64_t) 0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -573,15 +644,16 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
/* check following! */
|
||||
# ifdef _IO_USE_OLD_IO_FILE
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
|
||||
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
|
||||
# else
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
|
||||
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD }
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
|
||||
NULL, WDP, 0 }
|
||||
# endif
|
||||
#else
|
||||
# ifdef _IO_USE_OLD_IO_FILE
|
||||
@ -592,7 +664,8 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
|
||||
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
|
||||
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD }
|
||||
0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
|
||||
NULL, WDP, 0 }
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -32,9 +32,11 @@ struct _IO_FILE_memstream
|
||||
|
||||
static int _IO_mem_sync __P ((_IO_FILE* fp));
|
||||
static void _IO_mem_finish __P ((_IO_FILE* fp, int));
|
||||
static int _IO_wmem_sync __P ((_IO_FILE* fp));
|
||||
static void _IO_wmem_finish __P ((_IO_FILE* fp, int));
|
||||
|
||||
|
||||
static const struct _IO_jump_t _IO_mem_jumps =
|
||||
static struct _IO_jump_t _IO_mem_jumps =
|
||||
{
|
||||
JUMP_INIT_DUMMY,
|
||||
JUMP_INIT (finish, _IO_mem_finish),
|
||||
@ -58,6 +60,30 @@ static const struct _IO_jump_t _IO_mem_jumps =
|
||||
JUMP_INIT(imbue, _IO_default_imbue)
|
||||
};
|
||||
|
||||
static struct _IO_jump_t _IO_wmem_jumps =
|
||||
{
|
||||
JUMP_INIT_DUMMY,
|
||||
JUMP_INIT (finish, (_IO_finish_t) _IO_wmem_finish),
|
||||
JUMP_INIT (overflow, (_IO_overflow_t) _IO_wstr_overflow),
|
||||
JUMP_INIT (underflow, (_IO_underflow_t) _IO_wstr_underflow),
|
||||
JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
|
||||
JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
|
||||
JUMP_INIT (xsputn, (_IO_xsputn_t) _IO_wdefault_xsputn),
|
||||
JUMP_INIT (xsgetn, (_IO_xsgetn_t) _IO_wdefault_xsgetn),
|
||||
JUMP_INIT (seekoff, _IO_wstr_seekoff),
|
||||
JUMP_INIT (seekpos, _IO_default_seekpos),
|
||||
JUMP_INIT (setbuf, (_IO_setbuf_t) _IO_wdefault_setbuf),
|
||||
JUMP_INIT (sync, (_IO_sync_t) _IO_wmem_sync),
|
||||
JUMP_INIT (doallocate, _IO_wdefault_doallocate),
|
||||
JUMP_INIT (read, _IO_default_read),
|
||||
JUMP_INIT (write, _IO_default_write),
|
||||
JUMP_INIT (seek, _IO_default_seek),
|
||||
JUMP_INIT (close, _IO_default_close),
|
||||
JUMP_INIT (stat, _IO_default_stat),
|
||||
JUMP_INIT(showmanyc, _IO_default_showmanyc),
|
||||
JUMP_INIT(imbue, _IO_default_imbue)
|
||||
};
|
||||
|
||||
/* Open a stream that writes into a malloc'd buffer that is expanded as
|
||||
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
|
||||
and the number of characters written on fflush or fclose. */
|
||||
@ -72,6 +98,7 @@ open_memstream (bufloc, sizeloc)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_IO_lock_t lock;
|
||||
#endif
|
||||
struct _IO_wide_data wd;
|
||||
} *new_f;
|
||||
char *buf;
|
||||
|
||||
@ -85,7 +112,7 @@ open_memstream (bufloc, sizeloc)
|
||||
buf = malloc (_IO_BUFSIZ);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
_IO_init (&new_f->fp._sf._sbf._f, 0);
|
||||
_IO_no_init (&new_f->fp._sf._sbf._f, 0, 0, &new_f->wd, &_IO_wmem_jumps);
|
||||
_IO_JUMPS (&new_f->fp._sf._sbf._f) = &_IO_mem_jumps;
|
||||
_IO_str_init_static (&new_f->fp._sf._sbf._f, buf, _IO_BUFSIZ, buf);
|
||||
new_f->fp._sf._sbf._f._flags &= ~_IO_USER_BUF;
|
||||
@ -144,3 +171,55 @@ _IO_mem_finish (fp, dummy)
|
||||
|
||||
_IO_default_finish (fp, 0);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
_IO_wmem_sync (fp)
|
||||
_IO_FILE* fp;
|
||||
{
|
||||
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
|
||||
int res;
|
||||
|
||||
res = _IO_default_sync (fp);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
if (fp->_wide_data->_IO_write_ptr == fp->_wide_data->_IO_write_end)
|
||||
{
|
||||
_IO_wstr_overflow (fp, L'\0');
|
||||
--fp->_wide_data->_IO_write_ptr;
|
||||
}
|
||||
else
|
||||
*fp->_wide_data->_IO_write_ptr = '\0';
|
||||
|
||||
*mp->bufloc = (char *) fp->_wide_data->_IO_write_base;
|
||||
*mp->sizeloc = (fp->_wide_data->_IO_write_ptr
|
||||
- fp->_wide_data->_IO_write_base);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_IO_wmem_finish (fp, dummy)
|
||||
_IO_FILE* fp;
|
||||
int dummy;
|
||||
{
|
||||
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
|
||||
|
||||
*mp->bufloc = (char *) realloc (fp->_wide_data->_IO_write_base,
|
||||
(fp->_wide_data->_IO_write_ptr
|
||||
- fp->_wide_data->_IO_write_base + 1)
|
||||
* sizeof (wchar_t));
|
||||
if (*mp->bufloc != NULL)
|
||||
{
|
||||
((wchar_t *) (*mp->bufloc))[fp->_wide_data->_IO_write_ptr
|
||||
- fp->_wide_data->_IO_write_base] = '\0';
|
||||
*mp->sizeloc = (fp->_wide_data->_IO_write_ptr
|
||||
- fp->_wide_data->_IO_write_base);
|
||||
}
|
||||
|
||||
fp->_wide_data->_IO_buf_base = NULL;
|
||||
|
||||
_IO_default_finish (fp, 0);
|
||||
}
|
||||
|
@ -127,11 +127,11 @@ _IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args)
|
||||
new_f.ofile.file.file._lock = &new_f.lock;
|
||||
#endif
|
||||
|
||||
_IO_init (&new_f.ofile.file.file, 0);
|
||||
_IO_JUMPS (&new_f.ofile.file.file) = &_IO_obstack_jumps;
|
||||
_IO_no_init (&new_f.ofile.file.file, 0, -1, NULL, NULL);
|
||||
_IO_JUMPS (&new_f.ofile.file) = &_IO_obstack_jumps;
|
||||
_IO_str_init_static (&new_f.ofile.file.file, obstack_base (obstack),
|
||||
obstack_object_size (obstack) + obstack_room (obstack),
|
||||
obstack_next_free (obstack));
|
||||
(obstack_object_size (obstack) +
|
||||
obstack_room (obstack)), obstack_next_free (obstack));
|
||||
/* Now allocate the rest of the current chunk. */
|
||||
obstack_blank_fast (obstack,
|
||||
(new_f.ofile.file.file._IO_write_end
|
||||
|
@ -285,7 +285,7 @@ old_do_write (fp, data, to_do)
|
||||
fp->_old_offset = _IO_pos_BAD;
|
||||
else if (fp->_IO_read_end != fp->_IO_write_base)
|
||||
{
|
||||
_IO_pos_t new_pos
|
||||
_IO_off_t new_pos
|
||||
= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
|
||||
if (new_pos == _IO_pos_BAD)
|
||||
return 0;
|
||||
@ -449,14 +449,14 @@ _IO_old_file_sync (fp)
|
||||
return retval;
|
||||
}
|
||||
|
||||
_IO_fpos64_t
|
||||
_IO_off64_t
|
||||
_IO_old_file_seekoff (fp, offset, dir, mode)
|
||||
_IO_FILE *fp;
|
||||
_IO_off64_t offset;
|
||||
int dir;
|
||||
int mode;
|
||||
{
|
||||
_IO_pos_t result;
|
||||
_IO_off_t result;
|
||||
_IO_off64_t delta, new_offset;
|
||||
long count;
|
||||
/* POSIX.1 8.2.3.7 says that after a call the fflush() the file
|
||||
@ -500,7 +500,7 @@ _IO_old_file_seekoff (fp, offset, dir, mode)
|
||||
if (fp->_old_offset == _IO_pos_BAD)
|
||||
goto dumb;
|
||||
/* Make offset absolute, assuming current pointer is file_ptr(). */
|
||||
offset += _IO_pos_as_off (fp->_old_offset);
|
||||
offset += fp->_old_offset;
|
||||
|
||||
dir = _IO_seek_set;
|
||||
break;
|
||||
@ -529,7 +529,7 @@ _IO_old_file_seekoff (fp, offset, dir, mode)
|
||||
&& !_IO_in_backup (fp))
|
||||
{
|
||||
/* Offset relative to start of main get area. */
|
||||
_IO_pos_t rel_offset = (offset - fp->_old_offset
|
||||
_IO_off_t rel_offset = (offset - fp->_old_offset
|
||||
+ (fp->_IO_read_end - fp->_IO_read_base));
|
||||
if (rel_offset >= 0)
|
||||
{
|
||||
|
61
libio/oldiofgetpos.c
Normal file
61
libio/oldiofgetpos.c
Normal file
@ -0,0 +1,61 @@
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
_IO_old_fgetpos (fp, posp)
|
||||
_IO_FILE *fp;
|
||||
_IO_fpos_t *posp;
|
||||
{
|
||||
_IO_off_t pos;
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
|
||||
if (_IO_in_backup (fp))
|
||||
pos -= fp->_IO_save_end - fp->_IO_save_base;
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
if (pos == _IO_pos_BAD)
|
||||
{
|
||||
/* ANSI explicitly requires setting errno to a positive value on
|
||||
failure. */
|
||||
#ifdef EIO
|
||||
if (errno == 0)
|
||||
__set_errno (EIO);
|
||||
#endif
|
||||
return EOF;
|
||||
}
|
||||
posp->__pos = pos;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
symbol_version (_IO_old_fgetpos, _IO_fgetpos, GLIBC_2.0);
|
||||
strong_alias (_IO_old_fgetpos, __old_fgetpos)
|
||||
symbol_version (__old_fgetpos, fgetpos, GLIBC_2.0);
|
||||
#endif
|
66
libio/oldiofgetpos64.c
Normal file
66
libio/oldiofgetpos64.c
Normal file
@ -0,0 +1,66 @@
|
||||
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
_IO_old_fgetpos64 (fp, posp)
|
||||
_IO_FILE *fp;
|
||||
_IO_fpos64_t *posp;
|
||||
{
|
||||
#ifdef _G_LSEEK64
|
||||
_IO_off64_t pos;
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
|
||||
if (_IO_in_backup (fp))
|
||||
pos -= fp->_IO_save_end - fp->_IO_save_base;
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
if (pos == _IO_pos_BAD)
|
||||
{
|
||||
/* ANSI explicitly requires setting errno to a positive value on
|
||||
failure. */
|
||||
#ifdef EIO
|
||||
if (errno == 0)
|
||||
__set_errno (EIO);
|
||||
#endif
|
||||
return EOF;
|
||||
}
|
||||
posp->__pos = pos;
|
||||
return 0;
|
||||
#else
|
||||
__set_errno (ENOSYS);
|
||||
return EOF;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
symbol_version (_IO_old_fgetpos64, _IO_fgetpos64, GLIBC_2.0);
|
||||
strong_alias (_IO_old_fgetpos64, __old_fgetpos64)
|
||||
symbol_version (__old_fgetpos64, fgetpos64, GLIBC_2.0);
|
||||
#endif
|
59
libio/oldiofsetpos.c
Normal file
59
libio/oldiofsetpos.c
Normal file
@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include <libioP.h>
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
_IO_old_fsetpos (fp, posp)
|
||||
_IO_FILE *fp;
|
||||
const _IO_fpos_t *posp;
|
||||
{
|
||||
int result;
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
if (_IO_seekpos (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
|
||||
{
|
||||
/* ANSI explicitly requires setting errno to a positive value on
|
||||
failure. */
|
||||
#ifdef EIO
|
||||
if (errno == 0)
|
||||
__set_errno (EIO);
|
||||
#endif
|
||||
result = EOF;
|
||||
}
|
||||
else
|
||||
result = 0;
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
symbol_version (_IO_old_fsetpos, _IO_fsetpos, GLIBC_2.0);
|
||||
strong_alias (_IO_old_fsetpos, __old_fsetpos)
|
||||
symbol_version (__old_fsetpos, fsetpos, GLIBC_2.0);
|
||||
#endif
|
64
libio/oldiofsetpos64.c
Normal file
64
libio/oldiofsetpos64.c
Normal file
@ -0,0 +1,64 @@
|
||||
/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
#include <libioP.h>
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
_IO_old_fsetpos64 (fp, posp)
|
||||
_IO_FILE *fp;
|
||||
const _IO_fpos64_t *posp;
|
||||
{
|
||||
#ifdef _G_LSEEK64
|
||||
int result;
|
||||
CHECK_FILE (fp, EOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
if (_IO_seekpos (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
|
||||
{
|
||||
/* ANSI explicitly requires setting errno to a positive value on
|
||||
failure. */
|
||||
#ifdef EIO
|
||||
if (errno == 0)
|
||||
__set_errno (EIO);
|
||||
#endif
|
||||
result = EOF;
|
||||
}
|
||||
else
|
||||
result = 0;
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
#else
|
||||
__set_errno (ENOSYS);
|
||||
return EOF;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef weak_alias
|
||||
symbol_version (_IO_old_fsetpos64, _IO_fsetpos64, GLIBC_2.0);
|
||||
strong_alias (_IO_fsetpos64, __old_fsetpos64)
|
||||
symbol_version (__old_fsetpos64, _IO_fsetpos64, GLIBC_2.0);
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1994, 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -37,11 +37,12 @@
|
||||
#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
|
||||
struct _IO_FILE_plus NAME \
|
||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_old_file_jumps};
|
||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), &_IO_old_file_jumps};
|
||||
#else
|
||||
#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
||||
static struct _IO_wide_data _IO_wide_data_##FD; \
|
||||
struct _IO_FILE_plus NAME \
|
||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_old_file_jumps};
|
||||
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), &_IO_old_file_jumps};
|
||||
#endif
|
||||
|
||||
DEF_STDFILE(_IO_stdin_, 0, 0, _IO_NO_WRITES);
|
||||
|
35
libio/putwc.c
Normal file
35
libio/putwc.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* Copyright (C) 1991, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "libioP.h"
|
||||
#include <wchar.h>
|
||||
|
||||
wint_t
|
||||
putwc (wc, fp)
|
||||
wint_t wc;
|
||||
_IO_FILE *fp;
|
||||
{
|
||||
wint_t result;
|
||||
CHECK_FILE (fp, WEOF);
|
||||
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
||||
_IO_flockfile (fp);
|
||||
result = _IO_putwc_unlocked (wc, fp);
|
||||
_IO_funlockfile (fp);
|
||||
_IO_cleanup_region_end (0);
|
||||
return result;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user