1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2013 Garrett D'Amore <garrett@damore.org>
  14  */
  15 
  16 #ifndef _LCTYPE_H_
  17 #define _LCTYPE_H_
  18 
  19 #include <wchar.h>
  20 
  21 /* private LC_CTYPE related structures */
  22 
  23 /* encoding callbacks */
  24 struct lc_ctype {
  25 
  26         size_t (*lc_mbrtowc)(wchar_t *_RESTRICT_KYWD,
  27             const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD);
  28 
  29         int (*lc_mbsinit)(const mbstate_t *);
  30 
  31         size_t (*lc_mbsnrtowcs)(wchar_t *_RESTRICT_KYWD,
  32             const char **_RESTRICT_KYWD, size_t, size_t,
  33             mbstate_t *_RESTRICT_KYWD);
  34 
  35         size_t (*lc_wcrtomb)(char *_RESTRICT_KYWD, wchar_t,
  36             mbstate_t *_RESTRICT_KYWD);
  37 
  38         size_t (*lc_wcsnrtombs)(char *_RESTRICT_KYWD,
  39             const wchar_t **_RESTRICT_KYWD, size_t, size_t,
  40             mbstate_t *_RESTRICT_KYWD);
  41 
  42         unsigned char lc_is_ascii;
  43         unsigned char lc_max_mblen;
  44 
  45         const int *lc_trans_upper;
  46         const int *lc_trans_lower;
  47         const unsigned *lc_ctype_mask;
  48 };
  49 
  50 /*
  51  * Default implementation (C locale, i.e. ASCII).
  52  */
  53 size_t  __mbrtowc_ascii(wchar_t *_RESTRICT_KYWD,
  54     const char *_RESTRICT_KYWD, size_t, mbstate_t *_RESTRICT_KYWD);
  55 int     __mbsinit_ascii(const mbstate_t *);
  56 size_t  __mbsnrtowcs_ascii(wchar_t *_RESTRICT_KYWD dst,
  57     const char **_RESTRICT_KYWD src, size_t nms, size_t len,
  58     mbstate_t *_RESTRICT_KYWD);
  59 size_t  __wcrtomb_ascii(char *_RESTRICT_KYWD, wchar_t,
  60     mbstate_t *_RESTRICT_KYWD);
  61 size_t  __wcsnrtombs_ascii(char *_RESTRICT_KYWD,
  62     const wchar_t **_RESTRICT_KYWD,
  63     size_t, size_t, mbstate_t *_RESTRICT_KYWD);
  64 
  65 
  66 #endif /* !_LCTYPE_H_ */