133548Sjkh/* $NetBSD: setlocale_local.h,v 1.6 2010/05/22 13:50:02 tnozaki Exp $ */ 233548Sjkh 32893Sdfr/*- 42893Sdfr * Copyright (c)2008 Citrus Project, 52893Sdfr * All rights reserved. 68876Srgrimes * 72893Sdfr * Redistribution and use in source and binary forms, with or without 82893Sdfr * modification, are permitted provided that the following conditions 98876Srgrimes * are met: 102893Sdfr * 1. Redistributions of source code must retain the above copyright 118876Srgrimes * notice, this list of conditions and the following disclaimer. 122893Sdfr * 2. Redistributions in binary form must reproduce the above copyright 132893Sdfr * notice, this list of conditions and the following disclaimer in the 142893Sdfr * documentation and/or other materials provided with the distribution. 152893Sdfr * 168876Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 172893Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 182893Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 192893Sdfr * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 202893Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 212893Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 222893Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 232893Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2433548Sjkh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2533548Sjkh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2633548Sjkh * SUCH DAMAGE. 2733548Sjkh */ 2833548Sjkh 2933548Sjkh#ifndef _SETLOCALE_LOCAL_H_ 3033548Sjkh#define _SETLOCALE_LOCAL_H_ 3133548Sjkh 3233548Sjkh#define _LOCALENAME_LEN_MAX 33 3333548Sjkh 3433548Sjkh#define _C_LOCALE "C" 352893Sdfr#define _POSIX_LOCALE "POSIX" 362893Sdfr 372893Sdfrextern const char *_PathLocale; 382893Sdfr#define _LOCALE_ALIAS_NAME "locale.alias" 392893Sdfr 402893Sdfrtypedef void *_locale_part_t; 412893Sdfr 4233548Sjkhstruct _locale_cache_t { 4333548Sjkh const unsigned char *ctype_tab; 4433548Sjkh const short *tolower_tab; 4533548Sjkh const short *toupper_tab; 4633548Sjkh size_t mb_cur_max; 4733548Sjkh struct lconv *ldata; 4833548Sjkh const char **items; 4933548Sjkh}; 5033548Sjkh 5133548Sjkhstruct _locale_impl_t { 5233548Sjkh struct _locale_cache_t *cache; 5333548Sjkh char query[_LOCALENAME_LEN_MAX * (_LC_LAST - 1)]; 542893Sdfr const char *part_name[_LC_LAST]; 552893Sdfr _locale_part_t part_impl[_LC_LAST]; 562893Sdfr}; 5733548Sjkh 5833548Sjkhtypedef const char *(*_locale_set_t)(const char * __restrict, 5933548Sjkh struct _locale_impl_t * __restrict); 6033548Sjkh 6133548Sjkhtypedef struct { 6233548Sjkh const char* name; 6333548Sjkh int category; 6433548Sjkh _locale_set_t setlocale; 6533548Sjkh} _locale_category_t; 6633548Sjkh 6733548Sjkh__BEGIN_DECLS 6833548Sjkh_locale_category_t *_find_category(int); 6933548Sjkhconst char *_get_locale_env(const char *); 7033548Sjkhstruct _locale_impl_t **_current_locale(void); 7133548Sjkhchar *__setlocale(int, const char *); 7233548Sjkh__END_DECLS 7333548Sjkh 7433548Sjkhstatic __inline struct _locale_cache_t * 7533548Sjkh_current_cache(void) 7633548Sjkh{ 7733548Sjkh return (*_current_locale())->cache; 7833548Sjkh} 7933548Sjkh 8033548Sjkhextern struct _locale_impl_t _global_locale; 8133548Sjkhextern size_t __mb_len_max_runtime; 8233548Sjkh 8333548Sjkh#endif /*_SETLOCALE_LOCAL_H_*/ 8433548Sjkh