Blame intl/loadinfo.h

Packit 6c4009
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
Packit 6c4009
Packit 6c4009
   This program is free software: you can redistribute it and/or modify
Packit 6c4009
   it under the terms of the GNU Lesser General Public License as published by
Packit 6c4009
   the Free Software Foundation; either version 2.1 of the License, or
Packit 6c4009
   (at your option) any later version.
Packit 6c4009
Packit 6c4009
   This program is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 6c4009
   GNU Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public License
Packit 6c4009
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _LOADINFO_H
Packit 6c4009
#define _LOADINFO_H	1
Packit 6c4009
Packit 6c4009
/* Declarations of locale dependent catalog lookup functions.
Packit 6c4009
   Implemented in
Packit 6c4009
Packit 6c4009
     localealias.c    Possibly replace a locale name by another.
Packit 6c4009
     explodename.c    Split a locale name into its various fields.
Packit 6c4009
     l10nflist.c      Generate a list of filenames of possible message catalogs.
Packit 6c4009
     finddomain.c     Find and open the relevant message catalogs.
Packit 6c4009
Packit 6c4009
   The main function _nl_find_domain() in finddomain.c is declared
Packit 6c4009
   in gettextP.h.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef LIBINTL_DLL_EXPORTED
Packit 6c4009
# define LIBINTL_DLL_EXPORTED
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Tell the compiler when a conditional or integer expression is
Packit 6c4009
   almost always true or almost always false.  */
Packit 6c4009
#ifndef HAVE_BUILTIN_EXPECT
Packit 6c4009
# define __builtin_expect(expr, val) (expr)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Separator in PATH like lists of pathnames.  */
Packit 6c4009
#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
Packit 6c4009
  /* Win32, OS/2, DOS */
Packit 6c4009
# define PATH_SEPARATOR ';'
Packit 6c4009
#else
Packit 6c4009
  /* Unix */
Packit 6c4009
# define PATH_SEPARATOR ':'
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Encoding of locale name parts.  */
Packit 6c4009
#define XPG_NORM_CODESET	1
Packit 6c4009
#define XPG_CODESET		2
Packit 6c4009
#define XPG_TERRITORY		4
Packit 6c4009
#define XPG_MODIFIER		8
Packit 6c4009
Packit 6c4009
Packit 6c4009
struct loaded_l10nfile
Packit 6c4009
{
Packit 6c4009
  const char *filename;
Packit 6c4009
  int decided;
Packit 6c4009
Packit 6c4009
  const void *data;
Packit 6c4009
Packit 6c4009
  struct loaded_l10nfile *next;
Packit 6c4009
  struct loaded_l10nfile *successor[1];
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Normalize codeset name.  There is no standard for the codeset
Packit 6c4009
   names.  Normalization allows the user to use any of the common
Packit 6c4009
   names.  The return value is dynamically allocated and has to be
Packit 6c4009
   freed by the caller.  */
Packit 6c4009
extern const char *_nl_normalize_codeset (const char *codeset,
Packit 6c4009
					  size_t name_len);
Packit 6c4009
Packit 6c4009
/* Lookup a locale dependent file.
Packit 6c4009
   *L10NFILE_LIST denotes a pool of lookup results of locale dependent
Packit 6c4009
   files of the same kind, sorted in decreasing order of ->filename.
Packit 6c4009
   DIRLIST and DIRLIST_LEN are an argz list of directories in which to
Packit 6c4009
   look, containing at least one directory (i.e. DIRLIST_LEN > 0).
Packit 6c4009
   MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER
Packit 6c4009
   are the pieces of the locale name, as produced by _nl_explode_name().
Packit 6c4009
   FILENAME is the filename suffix.
Packit 6c4009
   The return value is the lookup result, either found in *L10NFILE_LIST,
Packit 6c4009
   or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
Packit 6c4009
   If the return value is non-NULL, it is added to *L10NFILE_LIST, and
Packit 6c4009
   its ->next field denotes the chaining inside *L10NFILE_LIST, and
Packit 6c4009
   furthermore its ->successor[] field contains a list of other lookup
Packit 6c4009
   results from which this lookup result inherits.  */
Packit 6c4009
extern struct loaded_l10nfile *
Packit 6c4009
_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
Packit 6c4009
		    const char *dirlist, size_t dirlist_len, int mask,
Packit 6c4009
		    const char *language, const char *territory,
Packit 6c4009
		    const char *codeset, const char *normalized_codeset,
Packit 6c4009
		    const char *modifier,
Packit 6c4009
		    const char *filename, int do_allocate);
Packit 6c4009
Packit 6c4009
/* Lookup the real locale name for a locale alias NAME, or NULL if
Packit 6c4009
   NAME is not a locale alias (but possibly a real locale name).
Packit 6c4009
   The return value is statically allocated and must not be freed.  */
Packit 6c4009
/* Part of the libintl ABI only for the sake of the gettext.m4 macro.  */
Packit 6c4009
extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name);
Packit 6c4009
Packit 6c4009
/* Split a locale name NAME into its pieces: language, modifier,
Packit 6c4009
   territory, codeset.
Packit 6c4009
   NAME gets destructively modified: NUL bytes are inserted here and
Packit 6c4009
   there.  *LANGUAGE gets assigned NAME.  Each of *MODIFIER, *TERRITORY,
Packit 6c4009
   *CODESET gets assigned either a pointer into the old NAME string, or
Packit 6c4009
   NULL.  *NORMALIZED_CODESET gets assigned the expanded *CODESET, if it
Packit 6c4009
   is different from *CODESET; this one is dynamically allocated and has
Packit 6c4009
   to be freed by the caller.
Packit 6c4009
   The return value is a bitmask, where each bit corresponds to one
Packit 6c4009
   filled-in value:
Packit 6c4009
     XPG_MODIFIER                for *MODIFIER,
Packit 6c4009
     XPG_TERRITORY               for *TERRITORY,
Packit 6c4009
     XPG_CODESET                 for *CODESET,
Packit 6c4009
     XPG_NORM_CODESET            for *NORMALIZED_CODESET.
Packit 6c4009
 */
Packit 6c4009
extern int _nl_explode_name (char *name, const char **language,
Packit 6c4009
			     const char **modifier, const char **territory,
Packit 6c4009
			     const char **codeset,
Packit 6c4009
			     const char **normalized_codeset);
Packit 6c4009
Packit 6c4009
#endif	/* loadinfo.h */