Blame iconv/gconv.h

Packit 6c4009
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
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
/* This header provides no interface for a user to the internals of
Packit 6c4009
   the gconv implementation in the libc.  Therefore there is no use
Packit 6c4009
   for these definitions beside for writing additional gconv modules.  */
Packit 6c4009
Packit 6c4009
#ifndef _GCONV_H
Packit 6c4009
#define _GCONV_H	1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
#include <bits/types/__mbstate_t.h>
Packit 6c4009
#include <bits/types/wint_t.h>
Packit 6c4009
Packit 6c4009
#define __need_size_t
Packit 6c4009
#define __need_wchar_t
Packit 6c4009
#include <stddef.h>
Packit 6c4009
Packit 6c4009
/* ISO 10646 value used to signal invalid value.  */
Packit 6c4009
#define __UNKNOWN_10646_CHAR	((wchar_t) 0xfffd)
Packit 6c4009
Packit 6c4009
/* Error codes for gconv functions.  */
Packit 6c4009
enum
Packit 6c4009
{
Packit 6c4009
  __GCONV_OK = 0,
Packit 6c4009
  __GCONV_NOCONV,
Packit 6c4009
  __GCONV_NODB,
Packit 6c4009
  __GCONV_NOMEM,
Packit 6c4009
Packit 6c4009
  __GCONV_EMPTY_INPUT,
Packit 6c4009
  __GCONV_FULL_OUTPUT,
Packit 6c4009
  __GCONV_ILLEGAL_INPUT,
Packit 6c4009
  __GCONV_INCOMPLETE_INPUT,
Packit 6c4009
Packit 6c4009
  __GCONV_ILLEGAL_DESCRIPTOR,
Packit 6c4009
  __GCONV_INTERNAL_ERROR
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Flags the `__gconv_open' function can set.  */
Packit 6c4009
enum
Packit 6c4009
{
Packit 6c4009
  __GCONV_IS_LAST = 0x0001,
Packit 6c4009
  __GCONV_IGNORE_ERRORS = 0x0002,
Packit 6c4009
  __GCONV_SWAP = 0x0004,
Packit 6c4009
  __GCONV_TRANSLIT = 0x0008
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Forward declarations.  */
Packit 6c4009
struct __gconv_step;
Packit 6c4009
struct __gconv_step_data;
Packit 6c4009
struct __gconv_loaded_object;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Type of a conversion function.  */
Packit 6c4009
typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
Packit 6c4009
			    const unsigned char **, const unsigned char *,
Packit 6c4009
			    unsigned char **, size_t *, int, int);
Packit 6c4009
Packit 6c4009
/* Type of a specialized conversion function for a single byte to INTERNAL.  */
Packit 6c4009
typedef wint_t (*__gconv_btowc_fct) (struct __gconv_step *, unsigned char);
Packit 6c4009
Packit 6c4009
/* Constructor and destructor for local data for conversion step.  */
Packit 6c4009
typedef int (*__gconv_init_fct) (struct __gconv_step *);
Packit 6c4009
typedef void (*__gconv_end_fct) (struct __gconv_step *);
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Description of a conversion step.  */
Packit 6c4009
struct __gconv_step
Packit 6c4009
{
Packit 6c4009
  struct __gconv_loaded_object *__shlib_handle;
Packit 6c4009
  const char *__modname;
Packit 6c4009
Packit 6c4009
  int __counter;
Packit 6c4009
Packit 6c4009
  char *__from_name;
Packit 6c4009
  char *__to_name;
Packit 6c4009
Packit 6c4009
  __gconv_fct __fct;
Packit 6c4009
  __gconv_btowc_fct __btowc_fct;
Packit 6c4009
  __gconv_init_fct __init_fct;
Packit 6c4009
  __gconv_end_fct __end_fct;
Packit 6c4009
Packit 6c4009
  /* Information about the number of bytes needed or produced in this
Packit 6c4009
     step.  This helps optimizing the buffer sizes.  */
Packit 6c4009
  int __min_needed_from;
Packit 6c4009
  int __max_needed_from;
Packit 6c4009
  int __min_needed_to;
Packit 6c4009
  int __max_needed_to;
Packit 6c4009
Packit 6c4009
  /* Flag whether this is a stateful encoding or not.  */
Packit 6c4009
  int __stateful;
Packit 6c4009
Packit 6c4009
  void *__data;		/* Pointer to step-local data.  */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* Additional data for steps in use of conversion descriptor.  This is
Packit 6c4009
   allocated by the `init' function.  */
Packit 6c4009
struct __gconv_step_data
Packit 6c4009
{
Packit 6c4009
  unsigned char *__outbuf;    /* Output buffer for this step.  */
Packit 6c4009
  unsigned char *__outbufend; /* Address of first byte after the output
Packit 6c4009
				 buffer.  */
Packit 6c4009
Packit 6c4009
  /* Is this the last module in the chain.  */
Packit 6c4009
  int __flags;
Packit 6c4009
Packit 6c4009
  /* Counter for number of invocations of the module function for this
Packit 6c4009
     descriptor.  */
Packit 6c4009
  int __invocation_counter;
Packit 6c4009
Packit 6c4009
  /* Flag whether this is an internal use of the module (in the mb*towc*
Packit 6c4009
     and wc*tomb* functions) or regular with iconv(3).  */
Packit 6c4009
  int __internal_use;
Packit 6c4009
Packit 6c4009
  __mbstate_t *__statep;
Packit 6c4009
  __mbstate_t __state;	/* This element must not be used directly by
Packit 6c4009
			   any module; always use STATEP!  */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Combine conversion step description with data.  */
Packit 6c4009
typedef struct __gconv_info
Packit 6c4009
{
Packit 6c4009
  size_t __nsteps;
Packit 6c4009
  struct __gconv_step *__steps;
Packit 6c4009
  __extension__ struct __gconv_step_data __data[0];
Packit 6c4009
} *__gconv_t;
Packit 6c4009
Packit 6c4009
/* Transliteration using the locale's data.  */
Packit 6c4009
extern int __gconv_transliterate (struct __gconv_step *step,
Packit 6c4009
				  struct __gconv_step_data *step_data,
Packit 6c4009
				  const unsigned char *inbufstart,
Packit 6c4009
				  const unsigned char **inbufp,
Packit 6c4009
				  const unsigned char *inbufend,
Packit 6c4009
				  unsigned char **outbufstart,
Packit 6c4009
				  size_t *irreversible);
Packit 6c4009
Packit 6c4009
#endif /* gconv.h */