1 /* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
21 #define _GCONV_INT_H 1
29 /* Structure for alias definition. Simply to strings. */
37 /* How many character should be conveted in one call? */
38 #define GCONV_NCHAR_GOAL 8160
41 /* Structure describing one loaded shared object. This normally are
42 objects to perform conversation but as a special case the db shared
43 object is also handled. */
44 struct __gconv_loaded_object
46 /* Name of the object. */
49 /* Reference counter for the db functionality. If no conversion is
50 needed we unload the db library. */
53 /* The handle for the shared object. */
56 /* Pointer to the functions the module defines. */
58 __gconv_init_fct init_fct
;
59 __gconv_end_fct end_fct
;
63 /* Description for an available conversion module. */
66 const char *from_pattern
;
67 const char *from_constpfx
;
68 size_t from_constpfx_len
;
69 const regex_t
*from_regex
;
70 regex_t from_regex_mem
;
72 const char *to_string
;
77 const char *module_name
;
79 struct gconv_module
*left
; /* Prefix smaller. */
80 struct gconv_module
*same
; /* List of entries with identical prefix. */
81 struct gconv_module
*matching
;/* Next node with more specific prefix. */
82 struct gconv_module
*right
; /* Prefix larger. */
86 /* Flags for `gconv_open'. */
89 GCONV_AVOID_NOCONV
= 1 << 0
93 /* Global variables. */
95 /* Database of alias names. */
96 extern void *__gconv_alias_db
;
98 /* Array with available modules. */
99 extern size_t __gconv_nmodules
;
100 extern struct gconv_module
*__gconv_modules_db
;
103 /* Return in *HANDLE decriptor for transformation from FROMSET to TOSET. */
104 extern int __gconv_open (const char *__toset
, const char *__fromset
,
105 __gconv_t
*__handle
, int flags
)
108 /* Free resources associated with transformation descriptor CD. */
109 extern int __gconv_close (__gconv_t cd
)
112 /* Transform at most *INBYTESLEFT bytes from buffer starting at *INBUF
113 according to rules described by CD and place up to *OUTBYTESLEFT
114 bytes in buffer starting at *OUTBUF. Return number of written
115 characters in *CONVERTED if this pointer is not null. */
116 extern int __gconv (__gconv_t __cd
, const unsigned char **__inbuf
,
117 const unsigned char *inbufend
, unsigned char **__outbuf
,
118 unsigned char *outbufend
, size_t *converted
)
121 /* Return in *HANDLE a pointer to an array with *NSTEPS elements describing
122 the single steps necessary for transformation from FROMSET to TOSET. */
123 extern int __gconv_find_transform (const char *__toset
, const char *__fromset
,
124 struct __gconv_step
**__handle
,
125 size_t *__nsteps
, int flags
)
128 /* Read all the configuration data and cache it. */
129 extern void __gconv_read_conf (void);
131 /* Comparison function to search alias. */
132 extern int __gconv_alias_compare (const void *__p1
, const void *__p2
);
134 /* Clear reference to transformation step implementations which might
135 cause the code to be unloaded. */
136 extern int __gconv_close_transform (struct __gconv_step
*__steps
,
140 /* Load shared object named by NAME. If already loaded increment reference
142 extern struct __gconv_loaded_object
*__gconv_find_shlib (const char *__name
)
145 /* Release shared object. If no further reference is available unload
147 extern int __gconv_release_shlib (struct __gconv_loaded_object
*__handle
)
150 /* Fill STEP with information about builtin module with NAME. */
151 extern void __gconv_get_builtin_trans (const char *__name
,
152 struct __gconv_step
*__step
)
157 /* Builtin transformations. */
159 # define __BUILTIN_TRANS(Name) \
160 extern int Name (struct __gconv_step *__step, \
161 struct __gconv_step_data *__data, \
162 const unsigned char **__inbuf, \
163 const unsigned char *__inbufend, size_t *__written, \
166 __BUILTIN_TRANS (__gconv_transform_ascii_internal
);
167 __BUILTIN_TRANS (__gconv_transform_internal_ascii
);
168 __BUILTIN_TRANS (__gconv_transform_utf8_internal
);
169 __BUILTIN_TRANS (__gconv_transform_internal_utf8
);
170 __BUILTIN_TRANS (__gconv_transform_ucs2_internal
);
171 __BUILTIN_TRANS (__gconv_transform_internal_ucs2
);
172 __BUILTIN_TRANS (__gconv_transform_ucs2little_internal
);
173 __BUILTIN_TRANS (__gconv_transform_internal_ucs2little
);
174 __BUILTIN_TRANS (__gconv_transform_internal_ucs4
);
175 __BUILTIN_TRANS (__gconv_transform_internal_utf16
);
176 __BUILTIN_TRANS (__gconv_transform_utf16_internal
);
177 # undef __BUITLIN_TRANS
183 #endif /* gconv_int.h */