1 /* $OpenBSD: wcio.h,v 1.1 2005/06/17 20:40:32 espie Exp $ */
2 /* $NetBSD: wcio.h,v 1.3 2003/01/18 11:30:00 thorpej Exp $ */
5 * SPDX-License-Identifier: BSD-2-Clause
7 * Copyright (C)2001 Citrus Project,
19 /* minimal requirement of SUSv2 */
20 #define WCIO_UNGETWC_BUFSIZE 1
22 struct wchar_io_data
{
23 mbstate_t wcio_mbstate_in
;
24 mbstate_t wcio_mbstate_out
;
26 wchar_t wcio_ungetwc_buf
[WCIO_UNGETWC_BUFSIZE
];
27 size_t wcio_ungetwc_inbuf
;
29 int wcio_mode
; /* orientation */
32 #define WCIO_GET(fp) \
33 (_EXT(fp) ? &(_EXT(fp)->_wcio) : (struct wchar_io_data *)0)
35 #define WCIO_GET_NONULL(fp) \
38 #define _SET_ORIENTATION(fp, mode) \
40 struct wchar_io_data *_wcio = WCIO_GET(fp); \
41 if (_wcio && _wcio->wcio_mode == 0) \
42 _wcio->wcio_mode = (mode);\
46 * WCIO_FREE should be called by fclose
48 #define WCIO_FREE(fp) \
50 struct wchar_io_data *_wcio = WCIO_GET(fp); \
52 _wcio->wcio_mode = 0;\
53 _wcio->wcio_ungetwc_inbuf = 0;\
57 #define WCIO_FREEUB(fp) \
59 struct wchar_io_data *_wcio = WCIO_GET(fp); \
61 _wcio->wcio_ungetwc_inbuf = 0;\
65 #define WCIO_INIT(fp) \
66 memset(WCIO_GET_NONULL(fp), 0, sizeof(struct wchar_io_data))
This page took 0.030804 seconds and 4 git commands to generate.