xref: /illumos-gate/usr/src/cmd/localedef/localedef.h (revision f3041bfa)
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(const char *, int);
60 void add_charmap_undefined(char *);
61 void add_charmap_posix(void);
62 void add_charmap_range(char *, char *, int);
63 void add_charmap_char(const char *name, int val);
64 int lookup_charmap(const char *, wchar_t *);
65 int check_charmap_undefined(char *);
66 int check_charmap(wchar_t);
67 
68 /* collate.o - LC_COLLATE handling */
69 typedef struct collelem collelem_t;
70 typedef struct collsym collsym_t;
71 void init_collate(void);
72 void define_collsym(char *);
73 void define_collelem(char *, wchar_t *);
74 void add_order_directive(void);
75 void add_order_bit(int);
76 void dump_collate(void);
77 collsym_t *lookup_collsym(char *);
78 collelem_t *lookup_collelem(char *);
79 void start_order_collelem(collelem_t *);
80 void start_order_undefined(void);
81 void start_order_symbol(char *);
82 void start_order_char(wchar_t);
83 void start_order_ellipsis(void);
84 void end_order_collsym(collsym_t *);
85 void end_order(void);
86 void add_weight_num(int);
87 void add_order_collelem(collelem_t *);
88 void add_order_collsym(collsym_t *);
89 void add_order_char(wchar_t);
90 void add_order_ignore(void);
91 void add_order_ellipsis(void);
92 void add_order_symbol(char *);
93 void add_order_subst(void);
94 void add_subst_char(wchar_t);
95 void add_subst_collsym(collsym_t *);
96 void add_subst_collelem(collelem_t *);
97 void add_subst_symbol(char *);
98 
99 /* ctype.c - LC_CTYPE handling */
100 void init_ctype(void);
101 void add_ctype(int);
102 void add_ctype_range(wchar_t);
103 void add_width(int, int);
104 void add_width_range(int, int, int);
105 void add_caseconv(int, int);
106 void dump_ctype(void);
107 
108 /* messages.c - LC_MESSAGES handling */
109 void init_messages(void);
110 void add_message(wchar_t *);
111 void dump_messages(void);
112 
113 /* monetary.c - LC_MONETARY handling */
114 void init_monetary(void);
115 void add_monetary_str(wchar_t *);
116 void add_monetary_num(int);
117 void reset_monetary_group(void);
118 void add_monetary_group(int);
119 void dump_monetary(void);
120 
121 /* numeric.c - LC_NUMERIC handling */
122 void init_numeric(void);
123 void add_numeric_str(wchar_t *);
124 void reset_numeric_group(void);
125 void add_numeric_group(int);
126 void dump_numeric(void);
127 
128 /* time.c - LC_TIME handling */
129 void init_time(void);
130 void add_time_str(wchar_t *);
131 void reset_time_list(void);
132 void add_time_list(wchar_t *);
133 void check_time_list(void);
134 void dump_time(void);
135 
136 /* wide.c -  Wide character handling. */
137 int to_wide(wchar_t *, const char *);
138 int to_mbs(char *, wchar_t);
139 char *to_mb_string(const wchar_t *);
140 void set_wide_encoding(const char *);
141 const char *get_wide_encoding(void);
142 int max_wide(void);
143 
144 #define	_(x)	gettext(x)
145 #define	INTERR	errf(_("internal fault (%s:%d)"), __FILE__, __LINE__)
146