xref: /netbsd-src/external/gpl2/grep/dist/intl/loadinfo.h (revision a8fa202a6440953be7b92a8960a811bff58203f4)
1 /*	$NetBSD: loadinfo.h,v 1.1.1.1 2016/01/10 21:36:18 christos Exp $	*/
2 
3 /* Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc.
4    This file is part of the GNU C Library.
5    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
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 _LOADINFO_H
23 #define _LOADINFO_H	1
24 
25 /* Declarations of locale dependent catalog lookup functions.
26    Implemented in
27 
28      localealias.c    Possibly replace a locale name by another.
29      explodename.c    Split a locale name into its various fields.
30      l10nflist.c      Generate a list of filenames of possible message catalogs.
31      finddomain.c     Find and open the relevant message catalogs.
32 
33    The main function _nl_find_domain() in finddomain.c is declared
34    in gettextP.h.
35  */
36 
37 #ifndef PARAMS
38 # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
39 #  define PARAMS(args) args
40 # else
41 #  define PARAMS(args) ()
42 # endif
43 #endif
44 
45 #ifndef internal_function
46 # define internal_function
47 #endif
48 
49 /* Tell the compiler when a conditional or integer expression is
50    almost always true or almost always false.  */
51 #ifndef HAVE_BUILTIN_EXPECT
52 # define __builtin_expect(expr, val) (expr)
53 #endif
54 
55 /* Separator in PATH like lists of pathnames.  */
56 #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
57   /* Win32, OS/2, DOS */
58 # define PATH_SEPARATOR ';'
59 #else
60   /* Unix */
61 # define PATH_SEPARATOR ':'
62 #endif
63 
64 /* Encoding of locale name parts.  */
65 #define CEN_REVISION		1
66 #define CEN_SPONSOR		2
67 #define CEN_SPECIAL		4
68 #define XPG_NORM_CODESET	8
69 #define XPG_CODESET		16
70 #define TERRITORY		32
71 #define CEN_AUDIENCE		64
72 #define XPG_MODIFIER		128
73 
74 #define CEN_SPECIFIC	(CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
75 #define XPG_SPECIFIC	(XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
76 
77 
78 struct loaded_l10nfile
79 {
80   const char *filename;
81   int decided;
82 
83   const void *data;
84 
85   struct loaded_l10nfile *next;
86   struct loaded_l10nfile *successor[1];
87 };
88 
89 
90 /* Normalize codeset name.  There is no standard for the codeset
91    names.  Normalization allows the user to use any of the common
92    names.  The return value is dynamically allocated and has to be
93    freed by the caller.  */
94 extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
95 						  size_t name_len));
96 
97 extern struct loaded_l10nfile *
98 _nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
99 			    const char *dirlist, size_t dirlist_len, int mask,
100 			    const char *language, const char *territory,
101 			    const char *codeset,
102 			    const char *normalized_codeset,
103 			    const char *modifier, const char *special,
104 			    const char *sponsor, const char *revision,
105 			    const char *filename, int do_allocate));
106 
107 
108 extern const char *_nl_expand_alias PARAMS ((const char *name));
109 
110 /* normalized_codeset is dynamically allocated and has to be freed by
111    the caller.  */
112 extern int _nl_explode_name PARAMS ((char *name, const char **language,
113 				     const char **modifier,
114 				     const char **territory,
115 				     const char **codeset,
116 				     const char **normalized_codeset,
117 				     const char **special,
118 				     const char **sponsor,
119 				     const char **revision));
120 
121 extern char *_nl_find_language PARAMS ((const char *name));
122 
123 #endif	/* loadinfo.h */
124