libutil: add O_NOCTTY back to old pty open code
[minix.git] / lib / libc / citrus / citrus_ctype.h
blobaeb0a2beaeefff7bce98bcb4b3a53bdf5abf3c14
1 /* $NetBSD: citrus_ctype.h,v 1.2 2003/03/05 20:18:15 tshiozak Exp $ */
3 /*-
4 * Copyright (c)2002 Citrus Project,
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
30 #ifndef _CITRUS_CTYPE_H_
31 #define _CITRUS_CTYPE_H_
33 #include "citrus_ctype_local.h"
35 typedef struct _citrus_ctype_rec *_citrus_ctype_t;
37 __BEGIN_DECLS
38 int _citrus_ctype_open(_citrus_ctype_t * __restrict,
39 char const * __restrict, void * __restrict,
40 size_t, size_t);
41 void _citrus_ctype_close(_citrus_ctype_t);
42 __END_DECLS
44 static __inline unsigned
45 _citrus_ctype_get_mb_cur_max(_citrus_ctype_t cc)
48 _DIAGASSERT(cc && cc->cc_ops);
49 return (*cc->cc_ops->co_get_mb_cur_max)(cc->cc_closure);
52 static __inline int
53 _citrus_ctype_mblen(_citrus_ctype_t cc, const char *s, size_t n, int *nresult)
56 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_mblen && nresult);
57 return (*cc->cc_ops->co_mblen)(cc->cc_closure, s, n, nresult);
60 static __inline int
61 _citrus_ctype_mbrlen(_citrus_ctype_t cc, const char *s, size_t n,
62 void *pspriv, size_t *nresult)
65 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_mbrlen && nresult);
66 return (*cc->cc_ops->co_mbrlen)(cc->cc_closure, s, n, pspriv, nresult);
69 static __inline int
70 _citrus_ctype_mbrtowc(_citrus_ctype_t cc, wchar_t *pwc, const char *s,
71 size_t n, void *pspriv, size_t *nresult)
74 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_mbrtowc);
75 return (*cc->cc_ops->co_mbrtowc)(cc->cc_closure, pwc, s, n, pspriv,
76 nresult);
79 static __inline int
80 _citrus_ctype_mbsinit(_citrus_ctype_t cc, void const *pspriv, int *nresult)
83 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_mbsinit && nresult);
84 return (*cc->cc_ops->co_mbsinit)(cc->cc_closure, pspriv, nresult);
87 static __inline int
88 _citrus_ctype_mbsrtowcs(_citrus_ctype_t cc, wchar_t *pwcs, const char **s,
89 size_t n, void *pspriv, size_t *nresult)
92 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_mbsrtowcs && nresult);
93 return (*cc->cc_ops->co_mbsrtowcs)(cc->cc_closure, pwcs, s, n, pspriv,
94 nresult);
97 static __inline int
98 _citrus_ctype_mbstowcs(_citrus_ctype_t cc, wchar_t *pwcs, const char *s,
99 size_t n, size_t *nresult)
102 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_mbstowcs && nresult);
103 return (*cc->cc_ops->co_mbstowcs)(cc->cc_closure, pwcs, s, n, nresult);
106 static __inline int
107 _citrus_ctype_mbtowc(_citrus_ctype_t cc, wchar_t *pw, const char *s, size_t n,
108 int *nresult)
111 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_mbtowc && nresult);
112 return (*cc->cc_ops->co_mbtowc)(cc->cc_closure, pw, s, n, nresult);
115 static __inline int
116 _citrus_ctype_wcrtomb(_citrus_ctype_t cc, char *s, wchar_t wc,
117 void *pspriv, size_t *nresult)
120 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_wcrtomb && nresult);
121 return (*cc->cc_ops->co_wcrtomb)(cc->cc_closure, s, wc, pspriv,
122 nresult);
125 static __inline int
126 _citrus_ctype_wcsrtombs(_citrus_ctype_t cc, char *s, const wchar_t **ppwcs,
127 size_t n, void *pspriv, size_t *nresult)
130 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_wcsrtombs && nresult);
131 return (*cc->cc_ops->co_wcsrtombs)(cc->cc_closure, s, ppwcs, n,
132 pspriv, nresult);
135 static __inline int
136 _citrus_ctype_wcstombs(_citrus_ctype_t cc, char *s, const wchar_t *wcs,
137 size_t n, size_t *nresult)
140 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_wcstombs && nresult);
141 return (*cc->cc_ops->co_wcstombs)(cc->cc_closure, s, wcs, n, nresult);
144 static __inline int
145 _citrus_ctype_wctomb(_citrus_ctype_t cc, char *s, wchar_t wc, int *nresult)
148 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_wctomb && nresult);
149 return (*cc->cc_ops->co_wctomb)(cc->cc_closure, s, wc, nresult);
152 static __inline int
153 _citrus_ctype_btowc(_citrus_ctype_t cc, int c, wint_t *wcresult)
156 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_btowc && wcresult);
157 return (*cc->cc_ops->co_btowc)(cc, c, wcresult);
160 static __inline int
161 _citrus_ctype_wctob(_citrus_ctype_t cc, wint_t c, int *cresult)
164 _DIAGASSERT(cc && cc->cc_ops && cc->cc_ops->co_wctob && cresult);
165 return (*cc->cc_ops->co_wctob)(cc, c, cresult);
168 extern _citrus_ctype_rec_t _citrus_ctype_default;
170 #endif