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 /* Elementary Unicode string functions.
0003    Copyright (C) 2002, 2005-2007, 2009-2022 Free Software Foundation, Inc.
0004 
0005    This file is free software.
0006    It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
0007    You can redistribute it and/or modify it under either
0008      - the terms of the GNU Lesser General Public License as published
0009        by the Free Software Foundation, either version 3, or (at your
0010        option) any later version, or
0011      - the terms of the GNU General Public License as published by the
0012        Free Software Foundation; either version 2, or (at your option)
0013        any later version, or
0014      - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
0015 
0016    This file is distributed in the hope that it will be useful,
0017    but WITHOUT ANY WARRANTY; without even the implied warranty of
0018    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0019    Lesser General Public License and the GNU General Public License
0020    for more details.
0021 
0022    You should have received a copy of the GNU Lesser General Public
0023    License and of the GNU General Public License along with this
0024    program.  If not, see <https://www.gnu.org/licenses/>.  */
0025 
0026 #ifndef _UNISTDIO_H
0027 #define _UNISTDIO_H
0028 
0029 #include "unitypes.h"
0030 
0031 /* Get size_t.  */
0032 #include <stddef.h>
0033 
0034 /* Get FILE.  */
0035 #include <stdio.h>
0036 
0037 /* Get va_list.  */
0038 #include <stdarg.h>
0039 
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043 
0044 /* These work like the printf function family.
0045    In the format string:
0046    The format directive 'U' takes an UTF-8 string (const uint8_t *).
0047    The format directive 'lU' takes an UTF-16 string (const uint16_t *).
0048    The format directive 'llU' takes an UTF-32 string (const uint32_t *).
0049 
0050    The prefix (ulc_, u8_, u16_, u16_) indicates the type of the resulting
0051    string.  The prefix 'ulc' stands for "locale encoded".
0052 
0053    An infix 'v' indicates that a va_list is passed instead of multiple
0054    arguments.
0055 
0056    The functions *sprintf have a 'buf' argument that is assumed to be large
0057    enough.  (DANGEROUS!  Overflowing the buffer will crash the program.)
0058    The functions *snprintf have a 'buf' argument that is assumed to be 'size'
0059    units large.  (DANGEROUS!  The resulting string might be truncated in the
0060    middle of a multibyte character.)
0061    The functions *asprintf have a 'resultp' argument.  The result will be
0062    freshly allocated and stored in *resultp.
0063    The functions *asnprintf have a (resultbuf, lengthp) argument pair.  If
0064    resultbuf is not NULL and the result fits into *lengthp units, it is put
0065    in resultbuf, and resultbuf is returned.  Otherwise, a freshly allocated
0066    string is returned.  In both cases, *lengthp is set to the length (number
0067    of units) of the returned string.  In case of error, NULL is returned and
0068    errno is set.
0069  */
0070 
0071 /* ASCII format string, result in locale dependent encoded 'char *'.  */
0072 extern int
0073        ulc_sprintf (char *_UC_RESTRICT buf,
0074                     const char *format, ...);
0075 extern int
0076        ulc_snprintf (char *_UC_RESTRICT buf, size_t size,
0077                      const char *format, ...);
0078 extern int
0079        ulc_asprintf (char **resultp,
0080                      const char *format, ...);
0081 extern char *
0082        ulc_asnprintf (char *_UC_RESTRICT resultbuf, size_t *lengthp,
0083                       const char *format, ...);
0084 extern int
0085        ulc_vsprintf (char *_UC_RESTRICT buf,
0086                      const char *format, va_list ap);
0087 extern int
0088        ulc_vsnprintf (char *_UC_RESTRICT buf, size_t size,
0089                       const char *format, va_list ap);
0090 extern int
0091        ulc_vasprintf (char **resultp,
0092                       const char *format, va_list ap);
0093 extern char *
0094        ulc_vasnprintf (char *_UC_RESTRICT resultbuf, size_t *lengthp,
0095                        const char *format, va_list ap);
0096 
0097 /* ASCII format string, result in UTF-8 format.  */
0098 extern int
0099        u8_sprintf (uint8_t *buf,
0100                    const char *format, ...);
0101 extern int
0102        u8_snprintf (uint8_t *buf, size_t size,
0103                     const char *format, ...);
0104 extern int
0105        u8_asprintf (uint8_t **resultp,
0106                     const char *format, ...);
0107 extern uint8_t *
0108        u8_asnprintf (uint8_t *resultbuf, size_t *lengthp,
0109                      const char *format, ...);
0110 extern int
0111        u8_vsprintf (uint8_t *buf,
0112                     const char *format, va_list ap);
0113 extern int
0114        u8_vsnprintf (uint8_t *buf, size_t size,
0115                      const char *format, va_list ap);
0116 extern int
0117        u8_vasprintf (uint8_t **resultp,
0118                      const char *format, va_list ap);
0119 extern uint8_t *
0120        u8_vasnprintf (uint8_t *resultbuf, size_t *lengthp,
0121                       const char *format, va_list ap);
0122 
0123 /* UTF-8 format string, result in UTF-8 format.  */
0124 extern int
0125        u8_u8_sprintf (uint8_t *_UC_RESTRICT buf,
0126                       const uint8_t *format, ...);
0127 extern int
0128        u8_u8_snprintf (uint8_t *_UC_RESTRICT buf, size_t size,
0129                        const uint8_t *format, ...);
0130 extern int
0131        u8_u8_asprintf (uint8_t **resultp,
0132                        const uint8_t *format, ...);
0133 extern uint8_t *
0134        u8_u8_asnprintf (uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp,
0135                         const uint8_t *format, ...);
0136 extern int
0137        u8_u8_vsprintf (uint8_t *_UC_RESTRICT buf,
0138                        const uint8_t *format, va_list ap);
0139 extern int
0140        u8_u8_vsnprintf (uint8_t *_UC_RESTRICT buf, size_t size,
0141                         const uint8_t *format, va_list ap);
0142 extern int
0143        u8_u8_vasprintf (uint8_t **resultp,
0144                         const uint8_t *format, va_list ap);
0145 extern uint8_t *
0146        u8_u8_vasnprintf (uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp,
0147                          const uint8_t *format, va_list ap);
0148 
0149 /* ASCII format string, result in UTF-16 format.  */
0150 extern int
0151        u16_sprintf (uint16_t *buf,
0152                     const char *format, ...);
0153 extern int
0154        u16_snprintf (uint16_t *buf, size_t size,
0155                      const char *format, ...);
0156 extern int
0157        u16_asprintf (uint16_t **resultp,
0158                      const char *format, ...);
0159 extern uint16_t *
0160        u16_asnprintf (uint16_t *resultbuf, size_t *lengthp,
0161                       const char *format, ...);
0162 extern int
0163        u16_vsprintf (uint16_t *buf,
0164                      const char *format, va_list ap);
0165 extern int
0166        u16_vsnprintf (uint16_t *buf, size_t size,
0167                       const char *format, va_list ap);
0168 extern int
0169        u16_vasprintf (uint16_t **resultp,
0170                       const char *format, va_list ap);
0171 extern uint16_t *
0172        u16_vasnprintf (uint16_t *resultbuf, size_t *lengthp,
0173                        const char *format, va_list ap);
0174 
0175 /* UTF-16 format string, result in UTF-16 format.  */
0176 extern int
0177        u16_u16_sprintf (uint16_t *_UC_RESTRICT buf,
0178                         const uint16_t *format, ...);
0179 extern int
0180        u16_u16_snprintf (uint16_t *_UC_RESTRICT buf, size_t size,
0181                          const uint16_t *format, ...);
0182 extern int
0183        u16_u16_asprintf (uint16_t **resultp,
0184                          const uint16_t *format, ...);
0185 extern uint16_t *
0186        u16_u16_asnprintf (uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp,
0187                           const uint16_t *format, ...);
0188 extern int
0189        u16_u16_vsprintf (uint16_t *_UC_RESTRICT buf,
0190                          const uint16_t *format, va_list ap);
0191 extern int
0192        u16_u16_vsnprintf (uint16_t *_UC_RESTRICT buf, size_t size,
0193                           const uint16_t *format, va_list ap);
0194 extern int
0195        u16_u16_vasprintf (uint16_t **resultp,
0196                           const uint16_t *format, va_list ap);
0197 extern uint16_t *
0198        u16_u16_vasnprintf (uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp,
0199                            const uint16_t *format, va_list ap);
0200 
0201 /* ASCII format string, result in UTF-32 format.  */
0202 extern int
0203        u32_sprintf (uint32_t *buf,
0204                     const char *format, ...);
0205 extern int
0206        u32_snprintf (uint32_t *buf, size_t size,
0207                      const char *format, ...);
0208 extern int
0209        u32_asprintf (uint32_t **resultp,
0210                      const char *format, ...);
0211 extern uint32_t *
0212        u32_asnprintf (uint32_t *resultbuf, size_t *lengthp,
0213                       const char *format, ...);
0214 extern int
0215        u32_vsprintf (uint32_t *buf,
0216                      const char *format, va_list ap);
0217 extern int
0218        u32_vsnprintf (uint32_t *buf, size_t size,
0219                       const char *format, va_list ap);
0220 extern int
0221        u32_vasprintf (uint32_t **resultp,
0222                       const char *format, va_list ap);
0223 extern uint32_t *
0224        u32_vasnprintf (uint32_t *resultbuf, size_t *lengthp,
0225                        const char *format, va_list ap);
0226 
0227 /* UTF-32 format string, result in UTF-32 format.  */
0228 extern int
0229        u32_u32_sprintf (uint32_t *_UC_RESTRICT buf,
0230                         const uint32_t *format, ...);
0231 extern int
0232        u32_u32_snprintf (uint32_t *_UC_RESTRICT buf, size_t size,
0233                          const uint32_t *format, ...);
0234 extern int
0235        u32_u32_asprintf (uint32_t **resultp,
0236                          const uint32_t *format, ...);
0237 extern uint32_t *
0238        u32_u32_asnprintf (uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp,
0239                           const uint32_t *format, ...);
0240 extern int
0241        u32_u32_vsprintf (uint32_t *_UC_RESTRICT buf,
0242                          const uint32_t *format, va_list ap);
0243 extern int
0244        u32_u32_vsnprintf (uint32_t *_UC_RESTRICT buf, size_t size,
0245                           const uint32_t *format, va_list ap);
0246 extern int
0247        u32_u32_vasprintf (uint32_t **resultp,
0248                           const uint32_t *format, va_list ap);
0249 extern uint32_t *
0250        u32_u32_vasnprintf (uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp,
0251                            const uint32_t *format, va_list ap);
0252 
0253 /* ASCII format string, output to FILE in locale dependent encoding.  */
0254 extern int
0255        ulc_fprintf (FILE *stream,
0256                     const char *format, ...);
0257 extern int
0258        ulc_vfprintf (FILE *stream,
0259                      const char *format, va_list ap);
0260 
0261 #ifdef __cplusplus
0262 }
0263 #endif
0264 
0265 #endif /* _UNISTDIO_H */