|
Packit |
1c1d7e |
/* Copyright (C) 1999-2003 Free Software Foundation, Inc.
|
|
Packit |
1c1d7e |
This file is part of the GNU LIBICONV Library.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The GNU LIBICONV Library is free software; you can redistribute it
|
|
Packit |
1c1d7e |
and/or modify it under the terms of the GNU Library General Public
|
|
Packit |
1c1d7e |
License as published by the Free Software Foundation; either version 2
|
|
Packit |
1c1d7e |
of the License, or (at your option) any later version.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The GNU LIBICONV Library is distributed in the hope that it will be
|
|
Packit |
1c1d7e |
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
1c1d7e |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
1c1d7e |
Library General Public License for more details.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
You should have received a copy of the GNU Library General Public
|
|
Packit |
1c1d7e |
License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
|
Packit |
1c1d7e |
If not, write to the Free Software Foundation, Inc., 59 Temple Place -
|
|
Packit |
1c1d7e |
Suite 330, Boston, MA 02111-1307, USA. */
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* When installed, this file is called "iconv.h". */
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef _LIBICONV_H
|
|
Packit |
1c1d7e |
#define _LIBICONV_H
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#define _LIBICONV_VERSION 0x0109 /* version number: (major<<8) + minor */
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifdef LIBICONV_STATIC
|
|
Packit |
1c1d7e |
#define LIBICONV_DLL_EXPORTED
|
|
Packit |
1c1d7e |
#else /* LIBICONV_STATIC */
|
|
Packit |
1c1d7e |
#ifdef BUILDING_LIBICONV
|
|
Packit |
1c1d7e |
#define LIBICONV_DLL_EXPORTED __declspec(dllexport)
|
|
Packit |
1c1d7e |
#else
|
|
Packit |
1c1d7e |
#define LIBICONV_DLL_EXPORTED __declspec(dllimport)
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
#endif /* LIBICONV_STATIC */
|
|
Packit |
1c1d7e |
extern LIBICONV_DLL_EXPORTED int _libiconv_version; /* Likewise */
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* We would like to #include any system header file which could define
|
|
Packit |
1c1d7e |
iconv_t, 1. in order to eliminate the risk that the user gets compilation
|
|
Packit |
1c1d7e |
errors because some other system header file includes /usr/include/iconv.h
|
|
Packit |
1c1d7e |
which defines iconv_t or declares iconv after this file, 2. when compiling
|
|
Packit |
1c1d7e |
for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
|
|
Packit |
1c1d7e |
binary compatible code.
|
|
Packit |
1c1d7e |
But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
|
|
Packit |
1c1d7e |
has been installed in /usr/local/include, there is no way any more to
|
|
Packit |
1c1d7e |
include the original /usr/include/iconv.h. We simply have to get away
|
|
Packit |
1c1d7e |
without it.
|
|
Packit |
1c1d7e |
Ad 1. The risk that a system header file does
|
|
Packit |
1c1d7e |
#include "iconv.h" or #include_next "iconv.h"
|
|
Packit |
1c1d7e |
is small. They all do #include <iconv.h>.
|
|
Packit |
1c1d7e |
Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
|
|
Packit |
1c1d7e |
has to be a scalar type because (iconv_t)(-1) is a possible return value
|
|
Packit |
1c1d7e |
from iconv_open().) */
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Define iconv_t ourselves. */
|
|
Packit |
1c1d7e |
#undef iconv_t
|
|
Packit |
1c1d7e |
#define iconv_t libiconv_t
|
|
Packit |
1c1d7e |
typedef void* iconv_t;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Get size_t declaration. */
|
|
Packit |
1c1d7e |
#include <stddef.h>
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Get errno declaration and values. */
|
|
Packit |
1c1d7e |
#include <errno.h>
|
|
Packit |
1c1d7e |
/* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS,
|
|
Packit |
1c1d7e |
have EILSEQ in a different header. On these systems, define EILSEQ
|
|
Packit |
1c1d7e |
ourselves. */
|
|
Packit |
1c1d7e |
#ifndef EILSEQ
|
|
Packit |
1c1d7e |
#define EILSEQ
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifdef __cplusplus
|
|
Packit |
1c1d7e |
extern "C" {
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Allocates descriptor for code conversion from encoding `fromcode' to
|
|
Packit |
1c1d7e |
encoding `tocode'. */
|
|
Packit |
1c1d7e |
#ifndef LIBICONV_PLUG
|
|
Packit |
1c1d7e |
#define iconv_open libiconv_open
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes
|
|
Packit |
1c1d7e |
starting at `*inbuf', writing at most `*outbytesleft' bytes starting at
|
|
Packit |
1c1d7e |
`*outbuf'.
|
|
Packit |
1c1d7e |
Decrements `*inbytesleft' and increments `*inbuf' by the same amount.
|
|
Packit |
1c1d7e |
Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */
|
|
Packit |
1c1d7e |
#ifndef LIBICONV_PLUG
|
|
Packit |
1c1d7e |
#define iconv libiconv
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Frees resources allocated for conversion descriptor `cd'. */
|
|
Packit |
1c1d7e |
#ifndef LIBICONV_PLUG
|
|
Packit |
1c1d7e |
#define iconv_close libiconv_close
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
extern LIBICONV_DLL_EXPORTED int iconv_close (iconv_t cd);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef LIBICONV_PLUG
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Nonstandard extensions. */
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Control of attributes. */
|
|
Packit |
1c1d7e |
#define iconvctl libiconvctl
|
|
Packit |
1c1d7e |
extern LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Requests for iconvctl. */
|
|
Packit |
1c1d7e |
#define ICONV_TRIVIALP 0 /* int *argument */
|
|
Packit |
1c1d7e |
#define ICONV_GET_TRANSLITERATE 1 /* int *argument */
|
|
Packit |
1c1d7e |
#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
|
|
Packit |
1c1d7e |
#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
|
|
Packit |
1c1d7e |
#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Listing of locale independent encodings. */
|
|
Packit |
1c1d7e |
#define iconvlist libiconvlist
|
|
Packit |
1c1d7e |
extern LIBICONV_DLL_EXPORTED void iconvlist (int (*do_one) (unsigned int namescount,
|
|
Packit |
1c1d7e |
const char * const * names,
|
|
Packit |
1c1d7e |
void* data),
|
|
Packit |
1c1d7e |
void* data);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Support for relocatable packages. */
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* Sets the original and the current installation prefix of the package.
|
|
Packit |
1c1d7e |
Relocation simply replaces a pathname starting with the original prefix
|
|
Packit |
1c1d7e |
by the corresponding pathname with the current prefix instead. Both
|
|
Packit |
1c1d7e |
prefixes should be directory names without trailing slash (i.e. use ""
|
|
Packit |
1c1d7e |
instead of "/"). */
|
|
Packit |
1c1d7e |
extern LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix,
|
|
Packit |
1c1d7e |
const char *curr_prefix);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifdef __cplusplus
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#endif /* _LIBICONV_H */
|