1 /* xgettext common functions.
2 Copyright (C) 2001-2003, 2005-2006, 2008-2009, 2011, 2013-2014, 2018, 2020, 2023 Free Software Foundation, Inc.
3 Written by Peter Miller <millerp@canb.auug.org.au>
4 and Bruno Haible <haible@clisp.cons.org>, 2001.
5
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 3 of the License, or
9 (at your option) any later version.
10
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.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19 #ifndef _XGETTEXT_H
20 #define _XGETTEXT_H
21
22 #include <stdbool.h>
23 #include <stddef.h>
24
25 #include "message.h"
26 #include "rc-str-list.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32
33 /* If true, add all comments immediately preceding one of the keywords. */
34 extern bool add_all_comments;
35
36 /* Tag used in comment of prevailing domain. */
37 extern char *comment_tag;
38
39 /* List of messages whose msgids must not be extracted, or NULL.
40 Used by remember_a_message(). */
41 extern message_list_ty *exclude;
42
43 /* String used as prefix for msgstr. */
44 extern const char *msgstr_prefix;
45
46 /* String used as suffix for msgstr. */
47 extern const char *msgstr_suffix;
48
49 /* If true, omit the header entry.
50 If false, keep the header entry present in the input. */
51 extern int xgettext_omit_header;
52
53 /* Be more verbose. */
54 extern int verbose;
55
56 extern enum is_syntax_check default_syntax_check[NSYNTAXCHECKS];
57
58 /* Language dependent format string parser.
59 NULL if the language has no notion of format strings. */
60 extern struct formatstring_parser *current_formatstring_parser1;
61 extern struct formatstring_parser *current_formatstring_parser2;
62 extern struct formatstring_parser *current_formatstring_parser3;
63 extern struct formatstring_parser *current_formatstring_parser4;
64
65
66 /* Record a flag in the appropriate backend's table.
67 OPTIONSTRING has the syntax WORD:ARG:FLAG (as documented)
68 or WORD:ARG:FLAG!BACKEND.
69 The latter syntax is undocumented and only needed for format string types
70 that are used by multiple backends. */
71 extern void xgettext_record_flag (const char *optionstring);
72
73
74 extern const char * xgettext_comment (size_t n);
75 extern void xgettext_comment_reset (void);
76
77 /* Comment handling for backends which support combining adjacent strings
78 even across lines.
79 In these backends we cannot use the xgettext_comment* functions directly,
80 because in multiline string expressions like
81 "string1" +
82 "string2"
83 the newline between "string1" and "string2" would cause a call to
84 xgettext_comment_reset(), thus destroying the accumulated comments
85 that we need a little later, when we have concatenated the two strings
86 and pass them to remember_a_message().
87 Instead, we do the bookkeeping of the accumulated comments directly,
88 and save a pointer to the accumulated comments when we read "string1".
89 In order to avoid excessive copying of strings, we use reference
90 counting. */
91
92 extern refcounted_string_list_ty *savable_comment;
93 extern void savable_comment_add (const char *str);
94 extern void savable_comment_reset (void);
95 extern void
96 savable_comment_to_xgettext_comment (refcounted_string_list_ty *rslp);
97
98
99 extern bool recognize_qt_formatstrings (void);
100
101
102 #ifdef __cplusplus
103 }
104 #endif
105
106
107 #endif /* _XGETTEXT_H */