xref: /illumos-gate/usr/src/cmd/localedef/localedef.h (revision b6805bf78d2bbbeeaea8909a05623587b42d58b3)
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 2010 Nexenta Systems, Inc.  All rights reserved.
14  */
15 
16 /*
17  * POSIX localedef.
18  */
19 
20 /* Common header files. */
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <stdarg.h>
24 #include <sys/types.h>
25 #include <libintl.h>
26 
27 extern int com_char;
28 extern int esc_char;
29 extern int mb_cur_max;
30 extern int mb_cur_min;
31 extern int last_kw;
32 extern int verbose;
33 extern int yydebug;
34 extern int lineno;
35 extern int undefok;	/* mostly ignore undefined symbols */
36 extern int warnok;
37 extern int warnings;
38 
39 void yyerror(const char *);
40 void errf(const char *, ...);
41 void warn(const char *, ...);
42 
43 int putl_category(const char *, FILE *);
44 int wr_category(void *, size_t, FILE *);
45 FILE *open_category(void);
46 void close_category(FILE *);
47 void copy_category(char *);
48 
49 int get_category(void);
50 void reset_scanner(const char *);
51 void scan_to_eol(void);
52 void add_wcs(wchar_t);
53 wchar_t *get_wcs(void);
54 
55 /* charmap.c - CHARMAP handling */
56 void init_charmap(void);
57 void add_charmap(char *, int);
58 void add_charmap_undefined(char *);
59 void add_charmap_posix(void);
60 void add_charmap_range(char *, char *, int);
61 int lookup_charmap(const char *, wchar_t *);
62 int check_charmap_undefined(char *);
63 int check_charmap(wchar_t);
64 
65 /* collate.o - LC_COLLATE handling */
66 typedef struct collelem collelem_t;
67 typedef struct collsym collsym_t;
68 void init_collate(void);
69 void define_collsym(char *);
70 void define_collelem(char *, wchar_t *);
71 void add_order_directive(void);
72 void add_order_bit(int);
73 void dump_collate(void);
74 collsym_t *lookup_collsym(char *);
75 collelem_t *lookup_collelem(char *);
76 void start_order_collelem(collelem_t *);
77 void start_order_undefined(void);
78 void start_order_symbol(char *);
79 void start_order_char(wchar_t);
80 void start_order_ellipsis(void);
81 void end_order_collsym(collsym_t *);
82 void end_order(void);
83 void add_weight_num(int);
84 void add_order_collelem(collelem_t *);
85 void add_order_collsym(collsym_t *);
86 void add_order_char(wchar_t);
87 void add_order_ignore(void);
88 void add_order_ellipsis(void);
89 void add_order_symbol(char *);
90 void add_order_subst(void);
91 void add_subst_char(wchar_t);
92 void add_subst_collsym(collsym_t *);
93 void add_subst_collelem(collelem_t *);
94 void add_subst_symbol(char *);
95 
96 /* ctype.c - LC_CTYPE handling */
97 void init_ctype(void);
98 void add_ctype(int);
99 void add_ctype_range(int);
100 void add_caseconv(int, int);
101 void dump_ctype(void);
102 
103 /* messages.c - LC_MESSAGES handling */
104 void init_messages(void);
105 void add_message(wchar_t *);
106 void dump_messages(void);
107 
108 /* monetary.c - LC_MONETARY handling */
109 void init_monetary(void);
110 void add_monetary_str(wchar_t *);
111 void add_monetary_num(int);
112 void reset_monetary_group(void);
113 void add_monetary_group(int);
114 void dump_monetary(void);
115 
116 /* numeric.c - LC_NUMERIC handling */
117 void init_numeric(void);
118 void add_numeric_str(wchar_t *);
119 void reset_numeric_group(void);
120 void add_numeric_group(int);
121 void dump_numeric(void);
122 
123 /* time.c - LC_TIME handling */
124 void init_time(void);
125 void add_time_str(wchar_t *);
126 void reset_time_list(void);
127 void add_time_list(wchar_t *);
128 void check_time_list(void);
129 void dump_time(void);
130 
131 /* wide.c -  Wide character handling. */
132 int to_wide(wchar_t *, const char *);
133 int to_mbs(char *, wchar_t);
134 char *to_mb_string(const wchar_t *);
135 void set_wide_encoding(const char *);
136 const char *get_wide_encoding(void);
137 int max_wide(void);
138 
139 #define	_(x)	gettext(x)
140 #define	INTERR	errf(_("internal fault (%s:%d)"), __FILE__, __LINE__)
141