xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/src/write-catalog.h (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1 /* GNU gettext - internationalization aids
2    Copyright (C) 1995-1998, 2000-2003, 2006 Free Software Foundation, Inc.
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8 
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software Foundation,
16    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17 
18 #ifndef _WRITE_CATALOG_H
19 #define _WRITE_CATALOG_H
20 
21 #include <stdbool.h>
22 #include <stdio.h>
23 
24 #include "message.h"
25 
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
32 /* This structure describes a textual catalog output format.  */
33 struct catalog_output_format
34 {
35   /* Outputs a list of domains of messages to a file.  */
36   void (*print) (msgdomain_list_ty *mdlp, FILE *fp, size_t page_width, bool debug);
37 
38   /* Whether the print function requires the MDLP to be encoded in UTF-8
39      encoding.  */
40   bool requires_utf8;
41 
42   /* Whether the format supports multiple domains in a single file.  */
43   bool supports_multiple_domains;
44 
45   /* Whether the format supports contexts.  */
46   bool supports_contexts;
47 
48   /* Whether the format supports plurals.  */
49   bool supports_plurals;
50 
51   /* Whether the PO file format is a suitable alternative output format for
52      this one.  */
53   bool alternative_is_po;
54 
55   /* Whether a Java class is a suitable alternative output format for this
56      one.  */
57   bool alternative_is_java_class;
58 };
59 
60 typedef const struct catalog_output_format * catalog_output_format_ty;
61 
62 /* These functions set some parameters for use by 'msgdomain_list_print'.  */
63 extern void
64        message_page_width_set (size_t width);
65 
66 /* Output MDLP into a PO file with the given FILENAME, according to the
67    parameters set by the functions above.  */
68 extern void
69        msgdomain_list_print (msgdomain_list_ty *mdlp,
70 			     const char *filename,
71 			     catalog_output_format_ty output_syntax,
72 			     bool force, bool debug);
73 
74 /* Sort MDLP destructively according to the given criterion.  */
75 extern void
76        msgdomain_list_sort_by_msgid (msgdomain_list_ty *mdlp);
77 extern void
78        msgdomain_list_sort_by_filepos (msgdomain_list_ty *mdlp);
79 
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 
86 #endif /* _WRITE_CATALOG_H */
87