1
/* GNU gettext - internationalization aids
2
Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
4
This file was written by Peter Miller <millerp@canb.auug.org.au>
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free SoftwareFoundation,
18
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
35
/* According to Sun's Uniforum proposal the default message domain is
37
#define MESSAGE_DOMAIN_DEFAULT "messages"
40
/* Kinds of format strings. */
63
#define NFORMATS 19 /* Number of format_type enum values. */
64
extern DLL_VARIABLE const char *const format_language[NFORMATS];
65
extern DLL_VARIABLE const char *const format_language_pretty[NFORMATS];
67
/* Is current msgid a format string? */
73
yes_according_to_context,
79
possible_format_p (enum is_format);
82
/* Is current msgid wrappable? */
90
#else /* HACK - C's enum concept is so stupid */
91
#define is_wrap is_format
95
typedef struct message_ty message_ty;
98
/* The msgid string. */
101
/* The msgid's plural, if present. */
102
const char *msgid_plural;
104
/* The msgstr strings. */
106
/* The number of bytes in msgstr, including the terminating NUL. */
109
/* Position in the source PO file. */
112
/* Plain comments (#) appearing before the message. */
113
string_list_ty *comment;
115
/* Extracted comments (#.) appearing before the message. */
116
string_list_ty *comment_dot;
118
/* File position comments (#:) appearing before the message, one for
119
each unique file position instance, sorted by file name and then
121
size_t filepos_count;
124
/* Informations from special comments (e.g. generated by msgmerge). */
126
enum is_format is_format[NFORMATS];
128
/* Do we want the string to be wrapped in the emitted PO file? */
129
enum is_wrap do_wrap;
131
/* If set the message is obsolete and while writing out it should be
135
/* Used for checking that messages have been used, in the msgcmp,
136
msgmerge, msgcomm and msgcat programs. */
139
/* Used for looking up the target message, in the msgcat program. */
142
/* Used for combining alternative translations, in the msgcat program. */
143
int alternative_count;
148
const char *msgstr_end;
149
string_list_ty *comment;
150
string_list_ty *comment_dot;
157
message_alloc (const char *msgid, const char *msgid_plural,
158
const char *msgstr, size_t msgstr_len,
159
const lex_pos_ty *pp);
161
message_free (message_ty *mp);
163
message_comment_append (message_ty *mp, const char *comment);
165
message_comment_dot_append (message_ty *mp, const char *comment);
167
message_comment_filepos (message_ty *mp, const char *name, size_t line);
169
message_copy (message_ty *mp);
172
typedef struct message_list_ty message_list_ty;
173
struct message_list_ty
179
hash_table htable; /* Table mapping msgid to 'message_ty *'. */
182
/* Create a fresh message list.
183
If USE_HASHTABLE is true, a hash table will be used to speed up
184
message_list_search(). USE_HASHTABLE can only be set to true if it is
185
known that the message list will not contain duplicate msgids. */
186
extern message_list_ty *
187
message_list_alloc (bool use_hashtable);
189
message_list_free (message_list_ty *mlp);
191
message_list_append (message_list_ty *mlp, message_ty *mp);
193
message_list_prepend (message_list_ty *mlp, message_ty *mp);
195
message_list_delete_nth (message_list_ty *mlp, size_t n);
196
typedef bool message_predicate_ty (const message_ty *mp);
198
message_list_remove_if_not (message_list_ty *mlp,
199
message_predicate_ty *predicate);
200
/* Recompute the hash table of a message list after the msgids changed. */
202
message_list_msgids_changed (message_list_ty *mlp);
204
message_list_search (message_list_ty *mlp, const char *msgid);
206
message_list_search_fuzzy (message_list_ty *mlp, const char *msgid);
209
typedef struct message_list_list_ty message_list_list_ty;
210
struct message_list_list_ty
212
message_list_ty **item;
217
extern message_list_list_ty *
218
message_list_list_alloc (void);
220
message_list_list_free (message_list_list_ty *mllp);
222
message_list_list_append (message_list_list_ty *mllp,
223
message_list_ty *mlp);
225
message_list_list_append_list (message_list_list_ty *mllp,
226
message_list_list_ty *mllp2);
228
message_list_list_search (message_list_list_ty *mllp,
231
message_list_list_search_fuzzy (message_list_list_ty *mllp,
235
typedef struct msgdomain_ty msgdomain_ty;
239
message_list_ty *messages;
242
extern msgdomain_ty *
243
msgdomain_alloc (const char *domain, bool use_hashtable);
245
msgdomain_free (msgdomain_ty *mdp);
248
typedef struct msgdomain_list_ty msgdomain_list_ty;
249
struct msgdomain_list_ty
255
const char *encoding; /* canonicalized encoding or NULL if unknown */
258
extern msgdomain_list_ty *
259
msgdomain_list_alloc (bool use_hashtable);
261
msgdomain_list_free (msgdomain_list_ty *mdlp);
263
msgdomain_list_append (msgdomain_list_ty *mdlp, msgdomain_ty *mdp);
265
msgdomain_list_append_list (msgdomain_list_ty *mdlp,
266
msgdomain_list_ty *mdlp2);
267
extern message_list_ty *
268
msgdomain_list_sublist (msgdomain_list_ty *mdlp, const char *domain,
271
msgdomain_list_search (msgdomain_list_ty *mdlp, const char *msgid);
273
msgdomain_list_search_fuzzy (msgdomain_list_ty *mdlp, const char *msgid);
281
#endif /* message.h */