xref: /illumos-gate/usr/src/cmd/localedef/localedef.h (revision b72d178a042f6b51c9885059293fb14a838975f2)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy is of the CDDL is also available via the Internet
9  * at http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2017 Nexenta Systems, Inc.
14  * Copyright 2013 DEY Storage Systmes, Inc.
15  */
16 
17 /*
18  * POSIX localedef.
19  */
20 
21 /* Common header files. */
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <stdarg.h>
25 #include <sys/types.h>
26 #include <libintl.h>
27 
28 extern int com_char;
29 extern int esc_char;
30 extern int mb_cur_max;
31 extern int mb_cur_min;
32 extern int last_kw;
33 extern int verbose;
34 extern int yydebug;
35 extern int lineno;
36 extern int undefok;	/* mostly ignore undefined symbols */
37 extern int warnok;
38 extern int warnings;
39 
40 void yyerror(const char *);
41 void errf(const char *, ...);
42 void warn(const char *, ...);
43 
44 int putl_category(const char *, FILE *);
45 int wr_category(void *, size_t, FILE *);
46 FILE *open_category(void);
47 void delete_category(FILE *);
48 void close_category(FILE *);
49 void copy_category(char *);
50 
51 int get_category(void);
52 void reset_scanner(const char *);
53 void scan_to_eol(void);
54 void add_wcs(wchar_t);
55 wchar_t *get_wcs(void);
56 
57 /* charmap.c - CHARMAP handling */
58 void init_charmap(void);
59 void add_charmap(char *, int);
60 void add_charmap_undefined(char *);
61 void add_charmap_posix(void);
62 void add_charmap_range(char *, char *, int);
63 int lookup_charmap(const char *, wchar_t *);
64 int check_charmap_undefined(char *);
65 int check_charmap(wchar_t);
66 
67 /* collate.o - LC_COLLATE handling */
68 typedef struct collelem collelem_t;
69 typedef struct collsym collsym_t;
70 void init_collate(void);
71 void define_collsym(char *);
72 void define_collelem(char *, wchar_t *);
73 void add_order_directive(void);
74 void add_order_bit(int);
75 void dump_collate(void);
76 collsym_t *lookup_collsym(char *);
77 collelem_t *lookup_collelem(char *);
78 void start_order_collelem(collelem_t *);
79 void start_order_undefined(void);
80 void start_order_symbol(char *);
81 void start_order_char(wchar_t);
82 void start_order_ellipsis(void);
83 void end_order_collsym(collsym_t *);
84 void end_order(void);
85 void add_weight_num(int);
86 void add_order_collelem(collelem_t *);
87 void add_order_collsym(collsym_t *);
88 void add_order_char(wchar_t);
89 void add_order_ignore(void);
90 void add_order_ellipsis(void);
91 void add_order_symbol(char *);
92 void add_order_subst(void);
93 void add_subst_char(wchar_t);
94 void add_subst_collsym(collsym_t *);
95 void add_subst_collelem(collelem_t *);
96 void add_subst_symbol(char *);
97 
98 /* ctype.c - LC_CTYPE handling */
99 void init_ctype(void);
100 void add_ctype(int);
101 void add_ctype_range(int);
102 void add_width(int, int);
103 void add_width_range(int, int, int);
104 void add_caseconv(int, int);
105 void dump_ctype(void);
106 
107 /* messages.c - LC_MESSAGES handling */
108 void init_messages(void);
109 void add_message(wchar_t *);
110 void dump_messages(void);
111 
112 /* monetary.c - LC_MONETARY handling */
113 void init_monetary(void);
114 void add_monetary_str(wchar_t *);
115 void add_monetary_num(int);
116 void reset_monetary_group(void);
117 void add_monetary_group(int);
118 void dump_monetary(void);
119 
120 /* numeric.c - LC_NUMERIC handling */
121 void init_numeric(void);
122 void add_numeric_str(wchar_t *);
123 void reset_numeric_group(void);
124 void add_numeric_group(int);
125 void dump_numeric(void);
126 
127 /* time.c - LC_TIME handling */
128 void init_time(void);
129 void add_time_str(wchar_t *);
130 void reset_time_list(void);
131 void add_time_list(wchar_t *);
132 void check_time_list(void);
133 void dump_time(void);
134 
135 /* wide.c -  Wide character handling. */
136 int to_wide(wchar_t *, const char *);
137 int to_mbs(char *, wchar_t);
138 char *to_mb_string(const wchar_t *);
139 void set_wide_encoding(const char *);
140 const char *get_wide_encoding(void);
141 int max_wide(void);
142 
143 #define	_(x)	gettext(x)
144 #define	INTERR	errf(_("internal fault (%s:%d)"), __FILE__, __LINE__)
145