]> git.draconx.ca Git - cdecl99.git/blob - src/cdecl-internal.h
cf7fc1487469fa9881dce071111146c9f1102369
[cdecl99.git] / src / cdecl-internal.h
1 /*
2  * Internal declarations for libcdecl.
3  * Copyright © 2021, 2023 Nick Bowler
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 CDECL_INTERNAL_H_
19 #define CDECL_INTERNAL_H_
20
21 #include <stddef.h>
22 #include <gettext.h>
23
24 #define _(s) dgettext(PACKAGE, s)
25 #define N_(s) s
26
27 struct cdecl_error;
28 struct cdecl_declspec;
29
30 #if ENABLE_NLS
31 void cdecl__init_i18n(void);
32 #else
33 static inline void cdecl__init_i18n(void)
34 {
35 }
36 #endif
37
38 void cdecl__err(unsigned code, const char *fmt, const char *arg);
39 void cdecl__errmsg(unsigned msg);
40
41 struct cdecl_declspec *cdecl__normalize_specs(struct cdecl_declspec *specs);
42
43 struct output_state {
44         char *dst;
45         size_t dstlen;
46         size_t accum;
47 };
48
49 size_t cdecl__advance(struct output_state *dst, size_t amount);
50 size_t cdecl__emit(struct output_state *dst, const char *src);
51
52 const char *cdecl__emit_specs(struct output_state *dst,
53                               struct cdecl_declspec *s,
54                               unsigned mask);
55
56 int cdecl__to_keyword(const char *s, int len, int english_mode);
57
58 #endif