Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:30:28

0001 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
0002 /* Conversions between Unicode and legacy encodings.
0003    Copyright (C) 2002, 2005, 2007, 2009-2022 Free Software Foundation, Inc.
0004 
0005    This file is free software: you can redistribute it and/or modify
0006    it under the terms of the GNU Lesser General Public License as
0007    published by the Free Software Foundation; either version 2.1 of the
0008    License, or (at your option) any later version.
0009 
0010    This file is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013    GNU Lesser General Public License for more details.
0014 
0015    You should have received a copy of the GNU Lesser General Public License
0016    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
0017 
0018 #ifndef _UNICONV_H
0019 #define _UNICONV_H
0020 
0021 /* Get size_t.  */
0022 #include <stddef.h>
0023 
0024 #include "unitypes.h"
0025 
0026 /* Get enum iconv_ilseq_handler.  */
0027 #include <unistring/iconveh.h>
0028 
0029 /* Get locale_charset() declaration.  */
0030 #include <unistring/localcharset.h>
0031 
0032 
0033 #ifdef __cplusplus
0034 extern "C" {
0035 #endif
0036 
0037 
0038 /* Converts an entire string, possibly including NUL bytes, from one encoding
0039    to a Unicode encoding.
0040    Converts a memory region given in encoding FROMCODE.  FROMCODE is as for
0041    iconv_open(3).
0042    The input is in the memory region between SRC (inclusive) and SRC + SRCLEN
0043    (exclusive).
0044    If OFFSETS is not NULL, it should point to an array of SRCLEN integers; this
0045    array is filled with offsets into the result, i.e. the character starting
0046    at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]],
0047    and other offsets are set to (size_t)(-1).
0048    RESULTBUF and *LENGTHP should initially be a scratch buffer and its size,
0049    or *RESULTBUF can be NULL.
0050    May erase the contents of the memory at RESULTBUF.
0051    If successful: The resulting Unicode string (non-NULL) is returned and its
0052    length stored in *LENGTHP.  The resulting string is RESULTBUF if no dynamic
0053    memory allocation was necessary, or a freshly allocated memory block
0054    otherwise.
0055    In case of error: NULL is returned and errno is set.  Particular errno
0056    values: EINVAL, EILSEQ, ENOMEM.  */
0057 extern uint8_t *
0058        u8_conv_from_encoding (const char *fromcode,
0059                               enum iconv_ilseq_handler handler,
0060                               const char *src, size_t srclen,
0061                               size_t *offsets,
0062                               uint8_t *resultbuf, size_t *lengthp);
0063 extern uint16_t *
0064        u16_conv_from_encoding (const char *fromcode,
0065                                enum iconv_ilseq_handler handler,
0066                                const char *src, size_t srclen,
0067                                size_t *offsets,
0068                                uint16_t *resultbuf, size_t *lengthp);
0069 extern uint32_t *
0070        u32_conv_from_encoding (const char *fromcode,
0071                                enum iconv_ilseq_handler handler,
0072                                const char *src, size_t srclen,
0073                                size_t *offsets,
0074                                uint32_t *resultbuf, size_t *lengthp);
0075 
0076 /* Converts an entire Unicode string, possibly including NUL units, from a
0077    Unicode encoding to a given encoding.
0078    Converts a memory region to encoding TOCODE.  TOCODE is as for
0079    iconv_open(3).
0080    The input is in the memory region between SRC (inclusive) and SRC + SRCLEN
0081    (exclusive).
0082    If OFFSETS is not NULL, it should point to an array of SRCLEN integers; this
0083    array is filled with offsets into the result, i.e. the character starting
0084    at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]],
0085    and other offsets are set to (size_t)(-1).
0086    RESULTBUF and *LENGTHP should initially be a scratch buffer and its size,
0087    or RESULTBUF can be NULL.
0088    May erase the contents of the memory at RESULTBUF.
0089    If successful: The resulting string (non-NULL) is returned and its length
0090    stored in *LENGTHP.  The resulting string is RESULTBUF if no dynamic memory
0091    allocation was necessary, or a freshly allocated memory block otherwise.
0092    In case of error: NULL is returned and errno is set.  Particular errno
0093    values: EINVAL, EILSEQ, ENOMEM.  */
0094 extern char *
0095        u8_conv_to_encoding (const char *tocode,
0096                             enum iconv_ilseq_handler handler,
0097                             const uint8_t *src, size_t srclen,
0098                             size_t *offsets,
0099                             char *_UC_RESTRICT resultbuf, size_t *lengthp);
0100 extern char *
0101        u16_conv_to_encoding (const char *tocode,
0102                              enum iconv_ilseq_handler handler,
0103                              const uint16_t *src, size_t srclen,
0104                              size_t *offsets,
0105                              char *_UC_RESTRICT resultbuf, size_t *lengthp);
0106 extern char *
0107        u32_conv_to_encoding (const char *tocode,
0108                              enum iconv_ilseq_handler handler,
0109                              const uint32_t *src, size_t srclen,
0110                              size_t *offsets,
0111                              char *_UC_RESTRICT resultbuf, size_t *lengthp);
0112 
0113 /* Converts a NUL terminated string from a given encoding.
0114    The result is malloc allocated, or NULL (with errno set) in case of error.
0115    Particular errno values: EILSEQ, ENOMEM.  */
0116 extern uint8_t *
0117        u8_strconv_from_encoding (const char *string,
0118                                  const char *fromcode,
0119                                  enum iconv_ilseq_handler handler);
0120 extern uint16_t *
0121        u16_strconv_from_encoding (const char *string,
0122                                   const char *fromcode,
0123                                   enum iconv_ilseq_handler handler);
0124 extern uint32_t *
0125        u32_strconv_from_encoding (const char *string,
0126                                   const char *fromcode,
0127                                   enum iconv_ilseq_handler handler);
0128 
0129 /* Converts a NUL terminated string to a given encoding.
0130    The result is malloc allocated, or NULL (with errno set) in case of error.
0131    Particular errno values: EILSEQ, ENOMEM.  */
0132 extern char *
0133        u8_strconv_to_encoding (const uint8_t *string,
0134                                const char *tocode,
0135                                enum iconv_ilseq_handler handler);
0136 extern char *
0137        u16_strconv_to_encoding (const uint16_t *string,
0138                                 const char *tocode,
0139                                 enum iconv_ilseq_handler handler);
0140 extern char *
0141        u32_strconv_to_encoding (const uint32_t *string,
0142                                 const char *tocode,
0143                                 enum iconv_ilseq_handler handler);
0144 
0145 /* Converts a NUL terminated string from the locale encoding.
0146    The result is malloc allocated, or NULL (with errno set) in case of error.
0147    Particular errno values: ENOMEM.  */
0148 extern uint8_t *
0149        u8_strconv_from_locale (const char *string);
0150 extern uint16_t *
0151        u16_strconv_from_locale (const char *string);
0152 extern uint32_t *
0153        u32_strconv_from_locale (const char *string);
0154 
0155 /* Converts a NUL terminated string to the locale encoding.
0156    The result is malloc allocated, or NULL (with errno set) in case of error.
0157    Particular errno values: ENOMEM.  */
0158 extern char *
0159        u8_strconv_to_locale (const uint8_t *string);
0160 extern char *
0161        u16_strconv_to_locale (const uint16_t *string);
0162 extern char *
0163        u32_strconv_to_locale (const uint32_t *string);
0164 
0165 
0166 #ifdef __cplusplus
0167 }
0168 #endif
0169 
0170 #endif /* _UNICONV_H */