Back to index

glibc  2.9
wcsmbsload.h
Go to the documentation of this file.
00001 /* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _WCSMBSLOAD_H
00021 #define _WCSMBSLOAD_H       1
00022 
00023 #include <locale.h>
00024 #include <wchar.h>
00025 #include <locale/localeinfo.h>
00026 
00027 
00028 /* Contains pointers to the used functions in the `gconv' modules.  */
00029 struct gconv_fcts
00030   {
00031     struct __gconv_step *towc;
00032     size_t towc_nsteps;
00033     struct __gconv_step *tomb;
00034     size_t tomb_nsteps;
00035   };
00036 
00037 /* Set of currently active conversion functions.  */
00038 extern const struct gconv_fcts __wcsmbs_gconv_fcts_c attribute_hidden;
00039 
00040 /* Load conversion functions for the currently selected locale.  */
00041 extern void __wcsmbs_load_conv (struct locale_data *new_category)
00042      internal_function;
00043 
00044 /* Clone the current `__wcsmbs_load_conv' value.  */
00045 extern void __wcsmbs_clone_conv (struct gconv_fcts *copy)
00046      internal_function;
00047 
00048 /* Find the conversion functions for converting to and from NAME.  */
00049 extern int __wcsmbs_named_conv (struct gconv_fcts *copy, const char *name)
00050      internal_function;
00051 
00052 /* Function used for the `private.cleanup' hook.  */
00053 extern void _nl_cleanup_ctype (struct locale_data *)
00054      internal_function attribute_hidden;
00055 
00056 
00057 #include <iconv/gconv_int.h>
00058 
00059 
00060 /* Load the function implementation if necessary.  */
00061 extern struct __gconv_step *__wcsmbs_getfct (const char *to, const char *from,
00062                                         size_t *nstepsp)
00063      attribute_hidden;
00064 
00065 extern const struct locale_data _nl_C_LC_CTYPE attribute_hidden;
00066 
00067 /* Check whether the LC_CTYPE locale changed since the last call.
00068    Update the pointers appropriately.  */
00069 static inline const struct gconv_fcts *
00070 get_gconv_fcts (struct locale_data *data)
00071 {
00072   if (__builtin_expect (data->private.ctype == NULL, 0))
00073     {
00074       if (__builtin_expect (data == &_nl_C_LC_CTYPE, 0))
00075        return &__wcsmbs_gconv_fcts_c;
00076       __wcsmbs_load_conv (data);
00077     }
00078   return data->private.ctype;
00079 }
00080 
00081 #endif /* wcsmbsload.h */