Replace legacy make with bmake
[dragonfly.git] / lib / libc / citrus / citrus_iconv_local.h
CommitLineData
52347f71
HT
1/* $NetBSD: citrus_iconv_local.h,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
2/* $DragonFly: src/lib/libc/citrus/citrus_iconv_local.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
2180e8af
JS
3
4/*-
5 * Copyright (c)2003 Citrus Project,
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#ifndef _CITRUS_ICONV_LOCAL_H_
31#define _CITRUS_ICONV_LOCAL_H_
32
5be9f868
JS
33#include "citrus_module.h"
34
ce6c5be0
SW
35struct _citrus_iconv;
36struct _citrus_iconv_ops;
37struct _citrus_iconv_shared;
38
2180e8af
JS
39#define _CITRUS_ICONV_GETOPS_FUNC_BASE(_n_) \
40int _n_(struct _citrus_iconv_ops *, size_t, uint32_t)
41#define _CITRUS_ICONV_GETOPS_FUNC(_n_) \
42_CITRUS_ICONV_GETOPS_FUNC_BASE(_citrus_##_n_##_iconv_getops)
43
44#define _CITRUS_ICONV_DECLS(_m_) \
45static int _citrus_##_m_##_iconv_init_shared \
46 (struct _citrus_iconv_shared * __restrict, \
47 const char * __restrict, \
48 const char * __restrict, const char * __restrict, \
49 const void * __restrict, size_t); \
50static void _citrus_##_m_##_iconv_uninit_shared \
51 (struct _citrus_iconv_shared *); \
52static int _citrus_##_m_##_iconv_convert \
53 (struct _citrus_iconv * __restrict, \
54 const char * __restrict * __restrict, size_t * __restrict, \
55 char * __restrict * __restrict, size_t * __restrict outbytes, \
56 uint32_t, size_t * __restrict); \
57static int _citrus_##_m_##_iconv_init_context \
58 (struct _citrus_iconv *); \
59static void _citrus_##_m_##_iconv_uninit_context \
5be9f868
JS
60 (struct _citrus_iconv *); \
61CITRUS_MODULE(_m_, iconv, _citrus_##_m_##_iconv_getops)
2180e8af
JS
62
63
64#define _CITRUS_ICONV_DEF_OPS(_m_) \
65struct _citrus_iconv_ops _citrus_##_m_##_iconv_ops = { \
66 /* io_abi_version */ _CITRUS_ICONV_ABI_VERSION, \
67 /* io_init_shared */ &_citrus_##_m_##_iconv_init_shared, \
68 /* io_uninit_shared */ &_citrus_##_m_##_iconv_uninit_shared, \
69 /* io_init_context */ &_citrus_##_m_##_iconv_init_context, \
70 /* io_uninit_context */ &_citrus_##_m_##_iconv_uninit_context, \
71 /* io_convert */ &_citrus_##_m_##_iconv_convert \
72}
73
74typedef _CITRUS_ICONV_GETOPS_FUNC_BASE((*_citrus_iconv_getops_t));
75typedef int (*_citrus_iconv_init_shared_t)
76 (struct _citrus_iconv_shared * __restrict,
77 const char * __restrict, const char * __restrict,
78 const char * __restrict, const void * __restrict, size_t);
79typedef void (*_citrus_iconv_uninit_shared_t)
80 (struct _citrus_iconv_shared *);
81typedef int (*_citrus_iconv_convert_t)
82 (struct _citrus_iconv * __restrict,
83 const char *__restrict* __restrict, size_t * __restrict,
84 char * __restrict * __restrict, size_t * __restrict, uint32_t,
85 size_t * __restrict);
86typedef int (*_citrus_iconv_init_context_t)(struct _citrus_iconv *);
87typedef void (*_citrus_iconv_uninit_context_t)(struct _citrus_iconv *);
88
89struct _citrus_iconv_ops {
90 uint32_t io_abi_version;
91 _citrus_iconv_init_shared_t io_init_shared;
92 _citrus_iconv_uninit_shared_t io_uninit_shared;
93 _citrus_iconv_init_context_t io_init_context;
94 _citrus_iconv_uninit_context_t io_uninit_context;
95 _citrus_iconv_convert_t io_convert;
96};
97#define _CITRUS_ICONV_ABI_VERSION 2
98
99struct _citrus_iconv_shared {
100 struct _citrus_iconv_ops *ci_ops;
101 void *ci_closure;
102 /* private */
103 _CITRUS_HASH_ENTRY(_citrus_iconv_shared) ci_hash_entry;
104 TAILQ_ENTRY(_citrus_iconv_shared) ci_tailq_entry;
105 _citrus_module_t ci_module;
106 unsigned int ci_used_count;
107 char *ci_convname;
108};
109
110struct _citrus_iconv {
111 struct _citrus_iconv_shared *cv_shared;
112 void *cv_closure;
113};
114
115#endif