1 /* Resolving ambiguity of argument lists: Information given through
2 command-line options.
3 Copyright (C) 2001-2018, 2020 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18 #ifndef _XGETTEXT_ARGLIST_CALLSHAPE_H
19 #define _XGETTEXT_ARGLIST_CALLSHAPE_H
20
21 #include <stdbool.h>
22 #include <stddef.h>
23
24 #include "str-list.h"
25 #include "mem-hash-map.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31
32 /* Calling convention for a given keyword. */
33 struct callshape
34 {
35 int argnum1; /* argument number to use for msgid */
36 int argnum2; /* argument number to use for msgid_plural */
37 int argnumc; /* argument number to use for msgctxt */
38 bool argnum1_glib_context; /* argument argnum1 has the syntax "ctxt|msgid" */
39 bool argnum2_glib_context; /* argument argnum2 has the syntax "ctxt|msgid" */
40 int argtotal; /* total number of arguments */
41 string_list_ty xcomments; /* auto-extracted comments */
42 };
43
44 /* Split keyword spec into keyword, argnum1, argnum2, argnumc. */
45 extern void split_keywordspec (const char *spec, const char **endp,
46 struct callshape *shapep);
47
48 /* Set of alternative calling conventions for a given keyword. */
49 struct callshapes
50 {
51 const char *keyword; /* the keyword, not NUL terminated */
52 size_t keyword_len; /* the keyword's length */
53 size_t nshapes;
54 struct callshape shapes[1]; /* actually nshapes elements */
55 };
56
57 /* Insert a (keyword, callshape) pair into a hash table mapping keyword to
58 'struct callshapes *'. */
59 extern void insert_keyword_callshape (hash_table *table,
60 const char *keyword, size_t keyword_len,
61 const struct callshape *shape);
62
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68
69 #endif /* _XGETTEXT_ARGLIST_CALLSHAPE_H */