xref: /haiku/src/system/libroot/posix/glibc/iconv/gconv_int.h (revision 25a7b01d15612846f332751841da3579db313082)
1 /* Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
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    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19 
20 #ifndef _GCONV_INT_H
21 #define _GCONV_INT_H	1
22 
23 #include "gconv.h"
24 #include <stdlib.h>		/* For alloca used in macro below.  */
25 
26 __BEGIN_DECLS
27 
28 
29 /* How many character should be conveted in one call?  */
30 #define GCONV_NCHAR_GOAL	8160
31 
32 
33 /* Description for an available conversion module.  */
34 struct gconv_module
35 {
36   const char *from_string;
37   const char *to_string;
38 
39   int cost_hi;
40   int cost_lo;
41 
42   const char *module_name;
43 
44   struct gconv_module *left;	/* Prefix smaller.  */
45   struct gconv_module *same;	/* List of entries with identical prefix.  */
46   struct gconv_module *right;	/* Prefix larger.  */
47 };
48 
49 
50 /* Internal data structure to represent transliteration module.  */
51 struct trans_struct
52 {
53   const char *name;
54   struct trans_struct *next;
55 
56   const char **csnames;
57   size_t ncsnames;
58   __gconv_trans_fct trans_fct;
59   __gconv_trans_context_fct trans_context_fct;
60   __gconv_trans_init_fct trans_init_fct;
61   __gconv_trans_end_fct trans_end_fct;
62 };
63 
64 
65 /* Builtin transformations.  */
66 #ifdef _LIBC
67 # define __BUILTIN_TRANSFORM(Name) \
68   extern int Name (struct __gconv_step *step,				      \
69 		   struct __gconv_step_data *data,			      \
70 		   const unsigned char **inbuf,				      \
71 		   const unsigned char *inbufend,			      \
72 		   unsigned char **outbufstart, size_t *irreversible,	      \
73 		   int do_flush, int consume_incomplete)
74 
75 __BUILTIN_TRANSFORM (__gconv_transform_multibyte_wchar);
76 __BUILTIN_TRANSFORM (__gconv_transform_wchar_multibyte);
77 # undef __BUITLIN_TRANSFORM
78 
79 #endif
80 
81 __END_DECLS
82 
83 #endif /* gconv_int.h */
84