]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/localedef/localedef.h
bluetooth: Fix a mandoc related issues
[FreeBSD/FreeBSD.git] / usr.bin / localedef / localedef.h
1 /*-
2  * Copyright 2018 Nexenta Systems, Inc.
3  * Copyright 2015 John Marino <draco@marino.st>
4  *
5  * This source code is derived from the illumos localedef command, and
6  * provided under BSD-style license terms by Nexenta Systems, Inc.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  * $FreeBSD$
31  */
32
33 /*
34  * POSIX localedef.
35  */
36
37 /* Common header files. */
38 #include <sys/cdefs.h>
39 #include <sys/types.h>
40 #include <stdarg.h>
41 #include <stdio.h>
42 #include <stdlib.h>
43
44 extern int com_char;
45 extern int esc_char;
46 extern int mb_cur_max;
47 extern int mb_cur_min;
48 extern int last_kw;
49 extern int verbose;
50 #if YYDEBUG
51 extern int yydebug;
52 #endif
53 extern int lineno;
54 extern int undefok;     /* mostly ignore undefined symbols */
55 extern int warnok;
56 extern int warnings;
57
58 extern char *version;
59
60 int yylex(void);
61 void yyerror(const char *);
62 _Noreturn void errf(const char *, ...) __printflike(1, 2);
63 void warn(const char *, ...) __printflike(1, 2);
64
65 int putl_category(const char *, FILE *);
66 int wr_category(void *, size_t, FILE *);
67 FILE *open_category(void);
68 void close_category(FILE *);
69 void copy_category(char *);
70 const char *category_name(void);
71
72 int get_category(void);
73 int get_symbol(void);
74 int get_escaped(int);
75 int get_wide(void);
76 void reset_scanner(const char *);
77 void scan_to_eol(void);
78 void add_wcs(wchar_t);
79 void add_tok(int);
80 wchar_t *get_wcs(void);
81
82 uint32_t htote(uint32_t);
83
84 /* charmap.c - CHARMAP handling */
85 void init_charmap(void);
86 void add_charmap(const char *, int);
87 void add_charmap_undefined(char *);
88 void add_charmap_posix(void);
89 void add_charmap_range(char *, char *, int);
90 void add_charmap_char(const char *name, int val);
91 int lookup_charmap(const char *, wchar_t *);
92 int check_charmap_undefined(char *);
93 int check_charmap(wchar_t);
94
95 /* collate.o - LC_COLLATE handling */
96 typedef struct collelem collelem_t;
97 typedef struct collsym collsym_t;
98 void init_collate(void);
99 void define_collsym(char *);
100 void define_collelem(char *, wchar_t *);
101 void add_order_directive(void);
102 void add_order_bit(int);
103 void dump_collate(void);
104 collsym_t *lookup_collsym(char *);
105 collelem_t *lookup_collelem(char *);
106 void start_order_collelem(collelem_t *);
107 void start_order_undefined(void);
108 void start_order_symbol(char *);
109 void start_order_char(wchar_t);
110 void start_order_ellipsis(void);
111 void end_order_collsym(collsym_t *);
112 void end_order(void);
113 void add_weight(int32_t, int);
114 void add_weights(int32_t *);
115 void add_weight_num(int);
116 void add_order_collelem(collelem_t *);
117 void add_order_collsym(collsym_t *);
118 void add_order_char(wchar_t);
119 void add_order_ignore(void);
120 void add_order_ellipsis(void);
121 void add_order_symbol(char *);
122 void add_order_subst(void);
123 void add_subst_char(wchar_t);
124 void add_subst_collsym(collsym_t *);
125 void add_subst_collelem(collelem_t *);
126 void add_subst_symbol(char *);
127 int32_t get_weight(int32_t, int);
128 wchar_t * wsncpy(wchar_t *, const wchar_t *, size_t);
129
130
131 /* ctype.c - LC_CTYPE handling */
132 void init_ctype(void);
133 void add_ctype(int);
134 void add_ctype_range(wchar_t);
135 void add_width(int, int);
136 void add_width_range(int, int, int);
137 void add_caseconv(int, int);
138 void dump_ctype(void);
139
140 /* messages.c - LC_MESSAGES handling */
141 void init_messages(void);
142 void add_message(wchar_t *);
143 void dump_messages(void);
144
145 /* monetary.c - LC_MONETARY handling */
146 void init_monetary(void);
147 void add_monetary_str(wchar_t *);
148 void add_monetary_num(int);
149 void reset_monetary_group(void);
150 void add_monetary_group(int);
151 void dump_monetary(void);
152
153 /* numeric.c - LC_NUMERIC handling */
154 void init_numeric(void);
155 void add_numeric_str(wchar_t *);
156 void reset_numeric_group(void);
157 void add_numeric_group(int);
158 void dump_numeric(void);
159
160 /* time.c - LC_TIME handling */
161 void init_time(void);
162 void add_time_str(wchar_t *);
163 void reset_time_list(void);
164 void add_time_list(wchar_t *);
165 void check_time_list(void);
166 void dump_time(void);
167
168 /* wide.c -  Wide character handling. */
169 int to_wide(wchar_t *, const char *);
170 int to_mbs(char *, wchar_t);
171 int to_mb(char *, wchar_t);
172 char *to_mb_string(const wchar_t *);
173 void set_wide_encoding(const char *);
174 void werr(const char *, ...);
175 const char *get_wide_encoding(void);
176 int max_wide(void);
177
178 //#define       _(x)    gettext(x)
179 #define INTERR  fprintf(stderr,"internal fault (%s:%d)", __FILE__, __LINE__)