Blame wcsmbs/wcsmbsload.h

Packit 6c4009
/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _WCSMBSLOAD_H
Packit 6c4009
#define _WCSMBSLOAD_H	1
Packit 6c4009
Packit 6c4009
#include <locale.h>
Packit 6c4009
#include <wchar.h>
Packit 6c4009
#include <locale/localeinfo.h>
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Contains pointers to the used functions in the `gconv' modules.  */
Packit 6c4009
struct gconv_fcts
Packit 6c4009
  {
Packit 6c4009
    struct __gconv_step *towc;
Packit 6c4009
    size_t towc_nsteps;
Packit 6c4009
    struct __gconv_step *tomb;
Packit 6c4009
    size_t tomb_nsteps;
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
/* Set of currently active conversion functions.  */
Packit 6c4009
extern const struct gconv_fcts __wcsmbs_gconv_fcts_c attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Load conversion functions for the currently selected locale.  */
Packit 6c4009
extern void __wcsmbs_load_conv (struct __locale_data *new_category)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Clone the current `__wcsmbs_load_conv' value.  */
Packit 6c4009
extern void __wcsmbs_clone_conv (struct gconv_fcts *copy)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Find the conversion functions for converting to and from NAME.  */
Packit 6c4009
extern int __wcsmbs_named_conv (struct gconv_fcts *copy, const char *name)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Function used for the `private.cleanup' hook.  */
Packit 6c4009
extern void _nl_cleanup_ctype (struct __locale_data *) attribute_hidden;
Packit 6c4009
Packit 6c4009
Packit 6c4009
#include <iconv/gconv_int.h>
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Load the function implementation if necessary.  */
Packit 6c4009
extern struct __gconv_step *__wcsmbs_getfct (const char *to, const char *from,
Packit 6c4009
					     size_t *nstepsp)
Packit 6c4009
     attribute_hidden;
Packit 6c4009
Packit 6c4009
extern const struct __locale_data _nl_C_LC_CTYPE attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Check whether the LC_CTYPE locale changed since the last call.
Packit 6c4009
   Update the pointers appropriately.  */
Packit 6c4009
static inline const struct gconv_fcts *
Packit 6c4009
get_gconv_fcts (struct __locale_data *data)
Packit 6c4009
{
Packit 6c4009
  if (__glibc_unlikely (data->private.ctype == NULL))
Packit 6c4009
    {
Packit 6c4009
      if (__glibc_unlikely (data == &_nl_C_LC_CTYPE))
Packit 6c4009
	return &__wcsmbs_gconv_fcts_c;
Packit 6c4009
      __wcsmbs_load_conv (data);
Packit 6c4009
    }
Packit 6c4009
  return data->private.ctype;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
#endif	/* wcsmbsload.h */