2005-09-15 09:58:31 -04:00
|
|
|
/* Header describing internals of libintl library.
|
|
|
|
Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
|
|
|
|
Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software Foundation,
|
|
|
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
#ifndef _GETTEXTP_H
|
|
|
|
#define _GETTEXTP_H
|
|
|
|
|
|
|
|
#include <stddef.h> /* Get size_t. */
|
|
|
|
|
|
|
|
#include "util/string.h" /* Get possible stubs. */
|
|
|
|
|
|
|
|
#ifdef HAVE_ICONV
|
|
|
|
#include <iconv.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "intl/gettext/loadinfo.h"
|
|
|
|
#include "intl/gettext/gettext.h" /* Get nls_uint32. */
|
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
#ifndef W
|
|
|
|
#define W(flag, data) ((flag) ? SWAP (data) : (data))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline nls_uint32
|
|
|
|
SWAP(nls_uint32 i)
|
|
|
|
{
|
|
|
|
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >>
|
|
|
|
24);
|
|
|
|
}
|
|
|
|
|
2016-04-20 15:23:55 -04:00
|
|
|
enum operator_ {
|
|
|
|
/* Without arguments: */
|
|
|
|
var, /* The variable "n". */
|
|
|
|
num, /* Decimal number. */
|
|
|
|
/* Unary operators: */
|
|
|
|
lnot, /* Logical NOT. */
|
|
|
|
/* Binary operators: */
|
|
|
|
mult, /* Multiplication. */
|
|
|
|
divide, /* Division. */
|
|
|
|
module, /* Module operation. */
|
|
|
|
plus, /* Addition. */
|
|
|
|
minus, /* Subtraction. */
|
|
|
|
less_than, /* Comparison. */
|
|
|
|
greater_than, /* Comparison. */
|
|
|
|
less_or_equal, /* Comparison. */
|
|
|
|
greater_or_equal, /* Comparison. */
|
|
|
|
equal, /* Comparision for equality. */
|
|
|
|
not_equal, /* Comparision for inequality. */
|
|
|
|
land, /* Logical AND. */
|
|
|
|
lor, /* Logical OR. */
|
|
|
|
/* Ternary operators: */
|
|
|
|
qmop /* Question mark operator. */
|
|
|
|
};
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
/* This is the representation of the expressions to determine the
|
|
|
|
plural form. */
|
|
|
|
struct expression {
|
|
|
|
int nargs; /* Number of arguments. */
|
2016-04-20 15:23:55 -04:00
|
|
|
enum operator_ operation;
|
2005-09-15 09:58:31 -04:00
|
|
|
union {
|
|
|
|
unsigned long int num; /* Number value for `num'. */
|
|
|
|
struct expression *args[3]; /* Up to three arguments. */
|
|
|
|
} val;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This is the data structure to pass information to the parser and get
|
|
|
|
the result in a thread-safe way. */
|
|
|
|
struct parse_args {
|
2021-01-02 10:20:27 -05:00
|
|
|
const char *cp;
|
2005-09-15 09:58:31 -04:00
|
|
|
struct expression *res;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The representation of an opened message catalog. */
|
|
|
|
struct loaded_domain {
|
2021-01-02 10:20:27 -05:00
|
|
|
const char *data;
|
2005-09-15 09:58:31 -04:00
|
|
|
int use_mmap;
|
|
|
|
size_t mmap_size;
|
|
|
|
int must_swap;
|
|
|
|
nls_uint32 nstrings;
|
|
|
|
struct string_desc *orig_tab;
|
|
|
|
struct string_desc *trans_tab;
|
|
|
|
nls_uint32 hash_size;
|
|
|
|
nls_uint32 *hash_tab;
|
|
|
|
int codeset_cntr;
|
|
|
|
#if HAVE_ICONV
|
|
|
|
iconv_t conv;
|
|
|
|
#endif
|
2021-01-02 10:20:27 -05:00
|
|
|
char **conv_tab;
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
struct expression *plural;
|
|
|
|
unsigned long int nplurals;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* A set of settings bound to a message domain. Used to store settings
|
|
|
|
from bindtextdomain() and bind_textdomain_codeset(). */
|
|
|
|
struct binding {
|
|
|
|
struct binding *next;
|
2021-01-02 10:20:27 -05:00
|
|
|
char *dirname;
|
2005-09-15 09:58:31 -04:00
|
|
|
int codeset_cntr; /* Incremented each time codeset changes. */
|
2021-01-02 10:20:27 -05:00
|
|
|
char *codeset;
|
|
|
|
char domainname[1];
|
2005-09-15 09:58:31 -04:00
|
|
|
};
|
|
|
|
|
2021-01-02 10:20:27 -05:00
|
|
|
extern char *LANGUAGE;
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
/* A counter which is incremented each time some previous translations
|
|
|
|
become invalid.
|
|
|
|
This variable is part of the external ABI of the GNU libintl. */
|
|
|
|
extern int _nl_msg_cat_cntr;
|
|
|
|
|
2021-01-02 10:20:27 -05:00
|
|
|
struct loaded_l10nfile *_nl_find_domain(const char *__dirname,
|
|
|
|
char *__locale,
|
|
|
|
const char *__domainname,
|
2005-09-15 09:58:31 -04:00
|
|
|
struct binding *
|
|
|
|
__domainbinding);
|
|
|
|
void _nl_load_domain(struct loaded_l10nfile * __domain,
|
|
|
|
struct binding * __domainbinding);
|
|
|
|
void _nl_unload_domain(struct loaded_domain * __domain);
|
2021-01-02 10:20:27 -05:00
|
|
|
const char *_nl_init_domain_conv(struct loaded_l10nfile * __domain_file,
|
2005-09-15 09:58:31 -04:00
|
|
|
struct loaded_domain * __domain,
|
|
|
|
struct binding * __domainbinding);
|
|
|
|
void _nl_free_domain_conv(struct loaded_domain * __domain);
|
|
|
|
|
2021-01-02 10:20:27 -05:00
|
|
|
char *_nl_find_msg(struct loaded_l10nfile * domain_file,
|
2005-09-15 09:58:31 -04:00
|
|
|
struct binding * domainbinding,
|
2021-01-02 10:20:27 -05:00
|
|
|
const char *msgid, size_t * lengthp);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2021-01-02 10:20:27 -05:00
|
|
|
extern char *gettext__(const char *__msgid);
|
|
|
|
extern char *dgettext__(const char *__domainname, const char *__msgid);
|
|
|
|
extern char *dcgettext__(const char *__domainname,
|
|
|
|
const char *__msgid, int __category);
|
|
|
|
extern char *ngettext__(const char *__msgid1, const char *__msgid2,
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned long int __n);
|
2021-01-02 10:20:27 -05:00
|
|
|
extern char *dngettext__(const char *__domainname,
|
|
|
|
const char *__msgid1, const char *__msgid2,
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned long int __n);
|
2021-01-02 10:20:27 -05:00
|
|
|
extern char *dcngettext__(const char *__domainname,
|
|
|
|
const char *__msgid1, const char *__msgid2,
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned long int __n, int __category);
|
2021-01-02 10:20:27 -05:00
|
|
|
extern char *dcigettext__(const char *__domainname,
|
|
|
|
const char *__msgid1, const char *__msgid2,
|
2005-09-15 09:58:31 -04:00
|
|
|
int __plural, unsigned long int __n,
|
|
|
|
int __category);
|
2021-01-02 10:20:27 -05:00
|
|
|
extern char *textdomain__(const char *__domainname);
|
|
|
|
extern char *bindtextdomain__(const char *__domainname,
|
|
|
|
const char *__dirname);
|
|
|
|
extern char *bind_textdomain_codeset__(const char *__domainname,
|
|
|
|
const char *__codeset);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
extern void gettext_free_exp__(struct expression * exp);
|
2015-02-25 15:16:09 -05:00
|
|
|
extern int gettext__parse(struct parse_args *arg);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
#endif /* gettextP.h */
|