1/* $NetBSD: gettextP.h,v 1.1.1.1 2016/01/10 21:36:17 christos Exp $ */ 2 3/* Header describing internals of libintl library. 4 Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. 5 Written by Ulrich Drepper <drepper@cygnus.com>, 1995. 6 7 This program is free software; you can redistribute it and/or modify it 8 under the terms of the GNU Library General Public License as published 9 by the Free Software Foundation; either version 2, or (at your option) 10 any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Library General Public License for more details. 16 17 You should have received a copy of the GNU Library General Public 18 License along with this program; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 20 USA. */ 21 22#ifndef _GETTEXTP_H 23#define _GETTEXTP_H 24 25#include <stddef.h> /* Get size_t. */ 26 27#ifdef _LIBC 28# include "../iconv/gconv_int.h" 29#else 30# if HAVE_ICONV 31# include <iconv.h> 32# endif 33#endif 34 35#include "loadinfo.h" 36 37#include "gmo.h" /* Get nls_uint32. */ 38 39/* @@ end of prolog @@ */ 40 41#ifndef PARAMS 42# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES 43# define PARAMS(args) args 44# else 45# define PARAMS(args) () 46# endif 47#endif 48 49#ifndef internal_function 50# define internal_function 51#endif 52 53/* Tell the compiler when a conditional or integer expression is 54 almost always true or almost always false. */ 55#ifndef HAVE_BUILTIN_EXPECT 56# define __builtin_expect(expr, val) (expr) 57#endif 58 59#ifndef W 60# define W(flag, data) ((flag) ? SWAP (data) : (data)) 61#endif 62 63 64#ifdef _LIBC 65# include <byteswap.h> 66# define SWAP(i) bswap_32 (i) 67#else 68static inline nls_uint32 69SWAP (i) 70 nls_uint32 i; 71{ 72 return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24); 73} 74#endif 75 76 77/* The representation of an opened message catalog. */ 78struct loaded_domain 79{ 80 const char *data; 81 int use_mmap; 82 size_t mmap_size; 83 int must_swap; 84 nls_uint32 nstrings; 85 struct string_desc *orig_tab; 86 struct string_desc *trans_tab; 87 nls_uint32 hash_size; 88 nls_uint32 *hash_tab; 89 int codeset_cntr; 90#ifdef _LIBC 91 __gconv_t conv; 92#else 93# if HAVE_ICONV 94 iconv_t conv; 95# endif 96#endif 97 char **conv_tab; 98 99 struct expression *plural; 100 unsigned long int nplurals; 101}; 102 103/* We want to allocate a string at the end of the struct. But ISO C 104 doesn't allow zero sized arrays. */ 105#ifdef __GNUC__ 106# define ZERO 0 107#else 108# define ZERO 1 109#endif 110 111/* A set of settings bound to a message domain. Used to store settings 112 from bindtextdomain() and bind_textdomain_codeset(). */ 113struct binding 114{ 115 struct binding *next; 116 char *dirname; 117 int codeset_cntr; /* Incremented each time codeset changes. */ 118 char *codeset; 119 char domainname[ZERO]; 120}; 121 122/* A counter which is incremented each time some previous translations 123 become invalid. 124 This variable is part of the external ABI of the GNU libintl. */ 125extern int _nl_msg_cat_cntr; 126 127#ifndef _LIBC 128const char *_nl_locale_name PARAMS ((int category, const char *categoryname)); 129#endif 130 131struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname, 132 char *__locale, 133 const char *__domainname, 134 struct binding *__domainbinding)) 135 internal_function; 136void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain, 137 struct binding *__domainbinding)) 138 internal_function; 139void _nl_unload_domain PARAMS ((struct loaded_domain *__domain)) 140 internal_function; 141const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file, 142 struct loaded_domain *__domain, 143 struct binding *__domainbinding)) 144 internal_function; 145void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain)) 146 internal_function; 147 148char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file, 149 struct binding *domainbinding, 150 const char *msgid, size_t *lengthp)) 151 internal_function; 152 153#ifdef _LIBC 154extern char *__gettext PARAMS ((const char *__msgid)); 155extern char *__dgettext PARAMS ((const char *__domainname, 156 const char *__msgid)); 157extern char *__dcgettext PARAMS ((const char *__domainname, 158 const char *__msgid, int __category)); 159extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2, 160 unsigned long int __n)); 161extern char *__dngettext PARAMS ((const char *__domainname, 162 const char *__msgid1, const char *__msgid2, 163 unsigned long int n)); 164extern char *__dcngettext PARAMS ((const char *__domainname, 165 const char *__msgid1, const char *__msgid2, 166 unsigned long int __n, int __category)); 167extern char *__dcigettext PARAMS ((const char *__domainname, 168 const char *__msgid1, const char *__msgid2, 169 int __plural, unsigned long int __n, 170 int __category)); 171extern char *__textdomain PARAMS ((const char *__domainname)); 172extern char *__bindtextdomain PARAMS ((const char *__domainname, 173 const char *__dirname)); 174extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname, 175 const char *__codeset)); 176#else 177extern char *gettext__ PARAMS ((const char *__msgid)); 178extern char *dgettext__ PARAMS ((const char *__domainname, 179 const char *__msgid)); 180extern char *dcgettext__ PARAMS ((const char *__domainname, 181 const char *__msgid, int __category)); 182extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2, 183 unsigned long int __n)); 184extern char *dngettext__ PARAMS ((const char *__domainname, 185 const char *__msgid1, const char *__msgid2, 186 unsigned long int __n)); 187extern char *dcngettext__ PARAMS ((const char *__domainname, 188 const char *__msgid1, const char *__msgid2, 189 unsigned long int __n, int __category)); 190extern char *dcigettext__ PARAMS ((const char *__domainname, 191 const char *__msgid1, const char *__msgid2, 192 int __plural, unsigned long int __n, 193 int __category)); 194extern char *textdomain__ PARAMS ((const char *__domainname)); 195extern char *bindtextdomain__ PARAMS ((const char *__domainname, 196 const char *__dirname)); 197extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname, 198 const char *__codeset)); 199#endif 200 201/* @@ begin of epilog @@ */ 202 203#endif /* gettextP.h */ 204