xref: /titanic_51/usr/src/lib/libbc/inc/include/locale.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /* Copyright (c) 1988 Sun Microsystems Inc */
23 
24 #pragma ident	"%Z%%M%	%I%	%E% SMI"
25 
26 /*
27  * Locale indices.
28  */
29 
30 #ifndef	__locale_h
31 #define	__locale_h
32 
33 #ifndef	NULL
34 #define	NULL		0
35 #endif
36 
37 #define	LC_ALL		0
38 #define	LC_CTYPE	1
39 #define	LC_NUMERIC	2
40 #define	LC_TIME		3
41 #define	LC_MONETARY	4
42 #ifndef	_POSIX_SOURCE
43 #define	LANGINFO	5
44 #endif
45 #define	LC_COLLATE	6
46 #define	LC_MESSAGES	7
47 
48 #ifndef	_POSIX_SOURCE
49 #define	MAXLOCALE	8
50 
51 #define	ON	1
52 #define	OFF	0
53 /* The maximum number of characters in the locale name */
54 
55 #define	MAXLOCALENAME   14
56 
57 /* The maximum number of substitute mappings in LC_COLLATE table */
58 
59 #define	MAXSUBS   	64
60 
61 /* Max width of domain name */
62 
63 #define	MAXDOMAIN	255
64 
65 /* Max width of format string for message domains */
66 
67 #define	MAXFMTS		32
68 
69 /* Max width of the message string */
70 
71 #define	MAXMSGSTR	255
72 
73 /* The directory where category components are kept */
74 
75 #define	LOCALE_DIR	"/usr/share/lib/locale/"
76 
77 /* The directory that is private to an individual workstation user */
78 
79 #define	PRIVATE_LOCALE_DIR	"/etc/locale/"
80 
81 /* The name of the file that contains default locale */
82 
83 #define	DEFAULT_LOC		".default"
84 
85 
86 /* size of "ctype" */
87 
88 #define	CTYPE_SIZE	514
89 #endif	/* _POSIX_SOURCE */
90 
91 extern char *		setlocale(/* int category, const char *locale */);
92 extern struct lconv *	localeconv(/* void */);
93 #ifndef	_POSIX_SOURCE
94 extern struct dtconv *	localdtconv();
95 #endif
96 
97 /*
98  * Numeric and monetary conversion information.
99  */
100 struct lconv {
101 	char	*decimal_point;	/* decimal point character */
102 	char	*thousands_sep;	/* thousands separator character */
103 	char	*grouping;	/* grouping of digits */
104 	char	*int_curr_symbol;	/* international currency symbol */
105 	char	*currency_symbol;	/* local currency symbol */
106 	char	*mon_decimal_point;	/* monetary decimal point character */
107 	char	*mon_thousands_sep;	/* monetary thousands separator */
108 	char	*mon_grouping;	/* monetary grouping of digits */
109 	char	*positive_sign;	/* monetary credit symbol */
110 	char	*negative_sign;	/* monetary debit symbol */
111 	char	int_frac_digits; /* intl monetary number of fractional digits */
112 	char	frac_digits;	/* monetary number of fractional digits */
113 	char	p_cs_precedes;	/* true if currency symbol precedes credit */
114 	char	p_sep_by_space;	/* true if space separates c.s.  from credit */
115 	char	n_cs_precedes;	/* true if currency symbol precedes debit */
116 	char	n_sep_by_space;	/* true if space separates c.s.  from debit */
117 	char	p_sign_posn;	/* position of sign for credit */
118 	char	n_sign_posn;	/* position of sign for debit */
119 };
120 
121 #ifndef	_POSIX_SOURCE
122 /*
123  * Date and time conversion information.
124  */
125 struct dtconv {
126 	char	*abbrev_month_names[12];	/* abbreviated month names */
127 	char	*month_names[12];	/* full month names */
128 	char	*abbrev_weekday_names[7];	/* abbreviated weekday names */
129 	char	*weekday_names[7];	/* full weekday names */
130 	char	*time_format;	/* time format */
131 	char	*sdate_format;	/* short date format */
132 	char	*dtime_format;	/* date/time format */
133 	char	*am_string;	/* AM string */
134 	char	*pm_string;	/* PM string */
135 	char	*ldate_format;	/* long date format */
136 };
137 
138 /*
139  * Langinfo
140  */
141 struct langinfo {
142 	char *yesstr;	/* yes string */
143 	char *nostr;	/* nostr */
144 };
145 
146 /*
147  * NLS nl_init
148  */
149 #define	valid(ptr) (ptr != (char *) NULL)
150 #define	nl_init(lang) ((valid(lang) && *lang) ? \
151     (valid(setlocale (LC_ALL, lang) ) ? 0 : -1) \
152     : -1)
153 #endif	/* _POSIX_SOURCE */
154 
155 #endif / *!__locale_h */
156