1 /* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 /* This header provides no interface for a user to the internals of
20 the gconv implementation in the libc. Therefore there is no use
21 for these definitions beside for writing additional gconv modules. */
27 #define __need_mbstate_t
32 /* ISO 10646 value used to signal invalid value. */
33 #define __UNKNOWN_10646_CHAR ((wchar_t) 0xfffd)
35 /* Error codes for gconv functions. */
45 __GCONV_ILLEGAL_INPUT
,
46 __GCONV_INCOMPLETE_INPUT
,
48 __GCONV_ILLEGAL_DESCRIPTOR
,
49 __GCONV_INTERNAL_ERROR
53 /* Flags the `__gconv_open' function can set. */
56 __GCONV_IS_LAST
= 0x0001,
57 __GCONV_IGNORE_ERRORS
= 0x0002
61 /* Forward declarations. */
63 struct __gconv_step_data
;
64 struct __gconv_loaded_object
;
65 struct __gconv_trans_data
;
68 /* Type of a conversion function. */
69 typedef int (*__gconv_fct
) (struct __gconv_step
*, struct __gconv_step_data
*,
70 __const
unsigned char **, __const
unsigned char *,
71 unsigned char **, size_t *, int, int);
73 /* Constructor and destructor for local data for conversion step. */
74 typedef int (*__gconv_init_fct
) (struct __gconv_step
*);
75 typedef void (*__gconv_end_fct
) (struct __gconv_step
*);
78 /* Type of a transliteration/transscription function. */
79 typedef int (*__gconv_trans_fct
) (struct __gconv_step
*,
80 struct __gconv_step_data
*, void *,
81 __const
unsigned char *,
82 __const
unsigned char **,
83 __const
unsigned char *, unsigned char **,
86 /* Function to call to provide transliteration module with context. */
87 typedef int (*__gconv_trans_context_fct
) (void *, __const
unsigned char *,
88 __const
unsigned char *,
89 unsigned char *, unsigned char *);
91 /* Function to query module about supported encoded character sets. */
92 typedef int (*__gconv_trans_query_fct
) (__const
char *, __const
char ***,
95 /* Constructor and destructor for local data for transliteration. */
96 typedef int (*__gconv_trans_init_fct
) (void **, const char *);
97 typedef void (*__gconv_trans_end_fct
) (void *);
99 struct __gconv_trans_data
101 /* Transliteration/Transscription function. */
102 __gconv_trans_fct __trans_fct
;
103 __gconv_trans_context_fct __trans_context_fct
;
104 __gconv_trans_end_fct __trans_end_fct
;
106 struct __gconv_trans_data
*__next
;
110 /* Description of a conversion step. */
113 struct __gconv_loaded_object
*__shlib_handle
;
114 __const
char *__modname
;
122 __gconv_init_fct __init_fct
;
123 __gconv_end_fct __end_fct
;
125 /* Information about the number of bytes needed or produced in this
126 step. This helps optimizing the buffer sizes. */
127 int __min_needed_from
;
128 int __max_needed_from
;
132 /* Flag whether this is a stateful encoding or not. */
135 void *__data
; /* Pointer to step-local data. */
138 /* Additional data for steps in use of conversion descriptor. This is
139 allocated by the `init' function. */
140 struct __gconv_step_data
142 unsigned char *__outbuf
; /* Output buffer for this step. */
143 unsigned char *__outbufend
; /* Address of first byte after the output
146 /* Is this the last module in the chain. */
149 /* Counter for number of invocations of the module function for this
151 int __invocation_counter
;
153 /* Flag whether this is an internal use of the module (in the mb*towc*
154 and wc*tomb* functions) or regular with iconv(3). */
157 __mbstate_t
*__statep
;
158 __mbstate_t __state
; /* This element must not be used directly by
159 any module; always use STATEP! */
161 /* Transliteration information. */
162 struct __gconv_trans_data
*__trans
;
166 /* Combine conversion step description with data. */
167 typedef struct __gconv_info
170 struct __gconv_step
*__steps
;
171 __extension__
struct __gconv_step_data __data __flexarr
;