You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

loadinfo.h 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /* Copyright (C) 1996-1999, 2000-2003 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU Library General Public License as published
  6. by the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  15. USA. */
  16. #ifndef _LOADINFO_H
  17. #define _LOADINFO_H 1
  18. /* Declarations of locale dependent catalog lookup functions.
  19. Implemented in
  20. localealias.c Possibly replace a locale name by another.
  21. explodename.c Split a locale name into its various fields.
  22. l10nflist.c Generate a list of filenames of possible message catalogs.
  23. finddomain.c Find and open the relevant message catalogs.
  24. The main function _nl_find_domain() in finddomain.c is declared
  25. in gettextP.h.
  26. */
  27. #ifndef internal_function
  28. # define internal_function
  29. #endif
  30. /* Tell the compiler when a conditional or integer expression is
  31. almost always true or almost always false. */
  32. #ifndef HAVE_BUILTIN_EXPECT
  33. # define __builtin_expect(expr, val) (expr)
  34. #endif
  35. /* Separator in PATH like lists of pathnames. */
  36. #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
  37. /* Win32, OS/2, DOS */
  38. # define PATH_SEPARATOR ';'
  39. #else
  40. /* Unix */
  41. # define PATH_SEPARATOR ':'
  42. #endif
  43. /* Encoding of locale name parts. */
  44. #define CEN_REVISION 1
  45. #define CEN_SPONSOR 2
  46. #define CEN_SPECIAL 4
  47. #define XPG_NORM_CODESET 8
  48. #define XPG_CODESET 16
  49. #define TERRITORY 32
  50. #define CEN_AUDIENCE 64
  51. #define XPG_MODIFIER 128
  52. #define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
  53. #define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
  54. struct loaded_l10nfile
  55. {
  56. const char *filename;
  57. int decided;
  58. const void *data;
  59. struct loaded_l10nfile *next;
  60. struct loaded_l10nfile *successor[1];
  61. };
  62. /* Normalize codeset name. There is no standard for the codeset
  63. names. Normalization allows the user to use any of the common
  64. names. The return value is dynamically allocated and has to be
  65. freed by the caller. */
  66. extern const char *_nl_normalize_codeset (const char *codeset,
  67. size_t name_len);
  68. /* Lookup a locale dependent file.
  69. *L10NFILE_LIST denotes a pool of lookup results of locale dependent
  70. files of the same kind, sorted in decreasing order of ->filename.
  71. DIRLIST and DIRLIST_LEN are an argz list of directories in which to
  72. look, containing at least one directory (i.e. DIRLIST_LEN > 0).
  73. MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER,
  74. SPECIAL, SPONSOR, REVISION are the pieces of the locale name, as
  75. produced by _nl_explode_name(). FILENAME is the filename suffix.
  76. The return value is the lookup result, either found in *L10NFILE_LIST,
  77. or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
  78. If the return value is non-NULL, it is added to *L10NFILE_LIST, and
  79. its ->next field denotes the chaining inside *L10NFILE_LIST, and
  80. furthermore its ->successor[] field contains a list of other lookup
  81. results from which this lookup result inherits. */
  82. extern struct loaded_l10nfile *
  83. _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
  84. const char *dirlist, size_t dirlist_len, int mask,
  85. const char *language, const char *territory,
  86. const char *codeset, const char *normalized_codeset,
  87. const char *modifier, const char *special,
  88. const char *sponsor, const char *revision,
  89. const char *filename, int do_allocate);
  90. /* Lookup the real locale name for a locale alias NAME, or NULL if
  91. NAME is not a locale alias (but possibly a real locale name).
  92. The return value is statically allocated and must not be freed. */
  93. extern const char *_nl_expand_alias (const char *name);
  94. /* Split a locale name NAME into its pieces: language, modifier,
  95. territory, codeset, special, sponsor, revision.
  96. NAME gets destructively modified: NUL bytes are inserted here and
  97. there. *LANGUAGE gets assigned NAME. Each of *MODIFIER, *TERRITORY,
  98. *CODESET, *SPECIAL, *SPONSOR, *REVISION gets assigned either a
  99. pointer into the old NAME string, or NULL. *NORMALIZED_CODESET
  100. gets assigned the expanded *CODESET, if it is different from *CODESET;
  101. this one is dynamically allocated and has to be freed by the caller.
  102. The return value is a bitmask, where each bit corresponds to one
  103. filled-in value:
  104. XPG_MODIFIER, CEN_AUDIENCE for *MODIFIER,
  105. TERRITORY for *TERRITORY,
  106. XPG_CODESET for *CODESET,
  107. XPG_NORM_CODESET for *NORMALIZED_CODESET,
  108. CEN_SPECIAL for *SPECIAL,
  109. CEN_SPONSOR for *SPONSOR,
  110. CEN_REVISION for *REVISION.
  111. */
  112. extern int _nl_explode_name (char *name, const char **language,
  113. const char **modifier, const char **territory,
  114. const char **codeset,
  115. const char **normalized_codeset,
  116. const char **special, const char **sponsor,
  117. const char **revision);
  118. /* Split a locale name NAME into a leading language part and all the
  119. rest. Return a pointer to the first character after the language,
  120. i.e. to the first byte of the rest. */
  121. extern char *_nl_find_language (const char *name);
  122. #endif /* loadinfo.h */