File: [cvs.NetBSD.org] / src / lib / libc / citrus / citrus_ctype_local.h (download)
Revision 1.4, Tue May 28 16:57:56 2013 UTC (10 years, 10 months ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-10-base, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, HEAD Branch point for: perseant-stdc-iso10646
Changes since 1.3: +31 -5
lines
Add mbsnrtowcs and wcsnrtombs. Approved by core.
|
/* $NetBSD: citrus_ctype_local.h,v 1.4 2013/05/28 16:57:56 joerg Exp $ */
/*-
* Copyright (c)2002 Citrus Project,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifndef _CITRUS_CTYPE_LOCAL_H_
#define _CITRUS_CTYPE_LOCAL_H_
#define _CITRUS_CTYPE_GETOPS_FUNC_BASE(_n_) \
int _n_(_citrus_ctype_ops_rec_t *, size_t, uint32_t)
#define _CITRUS_CTYPE_GETOPS_FUNC(_n_) \
_CITRUS_CTYPE_GETOPS_FUNC_BASE(_citrus_##_n_##_ctype_getops)
#define _CITRUS_CTYPE_DECLS(_e_) \
static int _citrus_##_e_##_ctype_init \
(void ** __restrict, void * __restrict, size_t, size_t); \
static void _citrus_##_e_##_ctype_uninit(void *); \
static unsigned _citrus_##_e_##_ctype_get_mb_cur_max(void *); \
static int _citrus_##_e_##_ctype_mblen(void * __restrict, \
const char * __restrict, \
size_t, int * __restrict); \
static int _citrus_##_e_##_ctype_mbrlen(void * __restrict, \
const char * __restrict, \
size_t, void * __restrict, \
size_t * __restrict); \
static int _citrus_##_e_##_ctype_mbrtowc(void * __restrict, \
wchar_t * __restrict, \
const char * __restrict, size_t, \
void * __restrict, \
size_t * __restrict); \
static int _citrus_##_e_##_ctype_mbsinit(void * __restrict, \
void const * __restrict, \
int * __restrict); \
static int _citrus_##_e_##_ctype_mbsrtowcs(void * __restrict, \
wchar_t * __restrict, \
const char ** __restrict, \
size_t, void * __restrict, \
size_t * __restrict); \
static int _citrus_##_e_##_ctype_mbsnrtowcs(_citrus_ctype_rec_t * __restrict, \
wchar_t * __restrict, \
const char ** __restrict, \
size_t, size_t, void * __restrict, \
size_t * __restrict); \
static int _citrus_##_e_##_ctype_mbstowcs(void * __restrict, \
wchar_t * __restrict, \
const char * __restrict, \
size_t, size_t * __restrict); \
static int _citrus_##_e_##_ctype_mbtowc(void * __restrict, \
wchar_t * __restrict, \
const char * __restrict, \
size_t, int * __restrict); \
static int _citrus_##_e_##_ctype_wcrtomb(void * __restrict, \
char * __restrict, wchar_t, \
void * __restrict, \
size_t * __restrict); \
static int _citrus_##_e_##_ctype_wcsrtombs(void * __restrict, \
char * __restrict, \
const wchar_t ** __restrict, \
size_t, void * __restrict, \
size_t * __restrict); \
static int _citrus_##_e_##_ctype_wcsnrtombs(_citrus_ctype_rec_t * __restrict, \
char * __restrict, \
const wchar_t ** __restrict, \
size_t, size_t, void * __restrict, \
size_t * __restrict); \
static int _citrus_##_e_##_ctype_wcstombs(void * __restrict, \
char * __restrict, \
const wchar_t * __restrict, \
size_t, size_t * __restrict); \
static int _citrus_##_e_##_ctype_wctomb(void * __restrict, \
char * __restrict, \
wchar_t, int * __restrict); \
static int _citrus_##_e_##_ctype_btowc(_citrus_ctype_rec_t * __restrict, \
int, wint_t * __restrict); \
static int _citrus_##_e_##_ctype_wctob(_citrus_ctype_rec_t * __restrict, \
wint_t, int * __restrict)
#define _CITRUS_CTYPE_DEF_OPS(_e_) \
_citrus_ctype_ops_rec_t _citrus_##_e_##_ctype_ops = { \
/* co_abi_version */ _CITRUS_CTYPE_ABI_VERSION, \
/* co_init */ &_citrus_##_e_##_ctype_init, \
/* co_uninit */ &_citrus_##_e_##_ctype_uninit, \
/* co_get_mb_cur_max */ &_citrus_##_e_##_ctype_get_mb_cur_max, \
/* co_mblen */ &_citrus_##_e_##_ctype_mblen, \
/* co_mbrlen */ &_citrus_##_e_##_ctype_mbrlen, \
/* co_mbrtowc */ &_citrus_##_e_##_ctype_mbrtowc, \
/* co_mbsinit */ &_citrus_##_e_##_ctype_mbsinit, \
/* co_mbsrtowcs */ &_citrus_##_e_##_ctype_mbsrtowcs, \
/* co_mbstowcs */ &_citrus_##_e_##_ctype_mbstowcs, \
/* co_mbtowc */ &_citrus_##_e_##_ctype_mbtowc, \
/* co_wcrtomb */ &_citrus_##_e_##_ctype_wcrtomb, \
/* co_wcsrtombs */ &_citrus_##_e_##_ctype_wcsrtombs, \
/* co_wcstombs */ &_citrus_##_e_##_ctype_wcstombs, \
/* co_wctomb */ &_citrus_##_e_##_ctype_wctomb, \
/* co_btowc */ &_citrus_##_e_##_ctype_btowc, \
/* co_wctob */ &_citrus_##_e_##_ctype_wctob, \
/* co_mbsnrtowcs */ &_citrus_##_e_##_ctype_mbsnrtowcs, \
/* co_wcsnrtombs */ &_citrus_##_e_##_ctype_wcsnrtombs, \
}
typedef struct _citrus_ctype_ops_rec _citrus_ctype_ops_rec_t;
typedef struct _citrus_ctype_rec _citrus_ctype_rec_t;
typedef int (*_citrus_ctype_init_t)
(void ** __restrict, void * __restrict, size_t, size_t);
typedef void (*_citrus_ctype_uninit_t)(void *);
typedef unsigned (*_citrus_ctype_get_mb_cur_max_t)(void *);
typedef int (*_citrus_ctype_mblen_t)
(void * __restrict, const char * __restrict, size_t, int * __restrict);
typedef int (*_citrus_ctype_mbrlen_t)
(void * __restrict, const char * __restrict, size_t,
void * __restrict, size_t * __restrict);
typedef int (*_citrus_ctype_mbrtowc_t)
(void * __restrict, wchar_t * __restrict, const char * __restrict,
size_t, void * __restrict, size_t * __restrict);
typedef int (*_citrus_ctype_mbsinit_t)
(void * __restrict, const void * __restrict, int * __restrict);
typedef int (*_citrus_ctype_mbsrtowcs_t)
(void * __restrict, wchar_t * __restrict, const char ** __restrict,
size_t, void * __restrict, size_t * __restrict);
typedef int (*_citrus_ctype_mbsnrtowcs_t)
(_citrus_ctype_rec_t * __restrict, wchar_t * __restrict,
const char ** __restrict, size_t, size_t, void * __restrict,
size_t * __restrict);
typedef int (*_citrus_ctype_mbstowcs_t)
(void * __restrict, wchar_t * __restrict, const char * __restrict,
size_t, size_t * __restrict);
typedef int (*_citrus_ctype_mbtowc_t)
(void * __restrict, wchar_t * __restrict, const char * __restrict,
size_t, int * __restrict);
typedef int (*_citrus_ctype_wcrtomb_t)
(void * __restrict, char * __restrict, wchar_t, void * __restrict,
size_t * __restrict);
typedef int (*_citrus_ctype_wcsrtombs_t)
(void * __restrict, char * __restrict, const wchar_t ** __restrict,
size_t, void * __restrict, size_t * __restrict);
typedef int (*_citrus_ctype_wcsnrtombs_t)
(_citrus_ctype_rec_t * __restrict, char * __restrict,
const wchar_t ** __restrict, size_t, size_t, void * __restrict,
size_t * __restrict);
typedef int (*_citrus_ctype_wcstombs_t)
(void * __restrict, char * __restrict, const wchar_t * __restrict,
size_t, size_t * __restrict);
typedef int (*_citrus_ctype_wctomb_t)
(void * __restrict, char * __restrict, wchar_t, int * __restrict);
typedef int (*_citrus_ctype_btowc_t)
(_citrus_ctype_rec_t * __restrict, int, wint_t * __restrict);
typedef int (*_citrus_ctype_wctob_t)
(_citrus_ctype_rec_t * __restrict, wint_t, int * __restrict);
#include "citrus_ctype_fallback.h"
/*
* ABI Version change log:
* 0x00000001
* initial version
* 0x00000002
* ops record: btowc and wctob added.
* ctype record: unchanged.
* 0x00000003
* ops record: mbsnrtowcs and wcsnrtombs added.
* ctype record: unchanged.
*/
#define _CITRUS_CTYPE_ABI_VERSION 0x00000003
struct _citrus_ctype_ops_rec {
uint32_t co_abi_version;
/* version 0x00000001 */
_citrus_ctype_init_t co_init;
_citrus_ctype_uninit_t co_uninit;
_citrus_ctype_get_mb_cur_max_t co_get_mb_cur_max;
_citrus_ctype_mblen_t co_mblen;
_citrus_ctype_mbrlen_t co_mbrlen;
_citrus_ctype_mbrtowc_t co_mbrtowc;
_citrus_ctype_mbsinit_t co_mbsinit;
_citrus_ctype_mbsrtowcs_t co_mbsrtowcs;
_citrus_ctype_mbstowcs_t co_mbstowcs;
_citrus_ctype_mbtowc_t co_mbtowc;
_citrus_ctype_wcrtomb_t co_wcrtomb;
_citrus_ctype_wcsrtombs_t co_wcsrtombs;
_citrus_ctype_wcstombs_t co_wcstombs;
_citrus_ctype_wctomb_t co_wctomb;
/* version 0x00000002 */
_citrus_ctype_btowc_t co_btowc;
_citrus_ctype_wctob_t co_wctob;
/* version 0x00000003 */
_citrus_ctype_mbsnrtowcs_t co_mbsnrtowcs;
_citrus_ctype_wcsnrtombs_t co_wcsnrtombs;
};
#define _CITRUS_DEFAULT_CTYPE_NAME "NONE"
#define _CITRUS_DEFAULT_CTYPE_OPS _citrus_NONE_ctype_ops
#define _CITRUS_DEFAULT_CTYPE_HEADER "citrus_none.h"
typedef _CITRUS_CTYPE_GETOPS_FUNC_BASE((*_citrus_ctype_getops_t));
struct _citrus_ctype_rec {
_citrus_ctype_ops_rec_t *cc_ops;
void *cc_closure;
_citrus_module_t cc_module;
};
#endif