xref: /titanic_50/usr/src/lib/libbc/inc/include/locale.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
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 /*
23  * Copyright 1988 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	__locale_h
28 #define	__locale_h
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Locale indices.
34  */
35 
36 #ifndef	NULL
37 #define	NULL		0
38 #endif
39 
40 #define	LC_ALL		0
41 #define	LC_CTYPE	1
42 #define	LC_NUMERIC	2
43 #define	LC_TIME		3
44 #define	LC_MONETARY	4
45 #ifndef	_POSIX_SOURCE
46 #define	LANGINFO	5
47 #endif
48 #define	LC_COLLATE	6
49 #define	LC_MESSAGES	7
50 
51 #ifndef	_POSIX_SOURCE
52 #define	MAXLOCALE	8
53 
54 #define	ON	1
55 #define	OFF	0
56 /* The maximum number of characters in the locale name */
57 
58 #define	MAXLOCALENAME   14
59 
60 /* The maximum number of substitute mappings in LC_COLLATE table */
61 
62 #define	MAXSUBS   	64
63 
64 /* Max width of domain name */
65 
66 #define	MAXDOMAIN	255
67 
68 /* Max width of format string for message domains */
69 
70 #define	MAXFMTS		32
71 
72 /* Max width of the message string */
73 
74 #define	MAXMSGSTR	255
75 
76 /* The directory where category components are kept */
77 
78 #define	LOCALE_DIR	"/usr/share/lib/locale/"
79 
80 /* The directory that is private to an individual workstation user */
81 
82 #define	PRIVATE_LOCALE_DIR	"/etc/locale/"
83 
84 /* The name of the file that contains default locale */
85 
86 #define	DEFAULT_LOC		".default"
87 
88 
89 /* size of "ctype" */
90 
91 #define	CTYPE_SIZE	514
92 #endif	/* _POSIX_SOURCE */
93 
94 extern char *		setlocale(/* int category, const char *locale */);
95 extern struct lconv *	localeconv(/* void */);
96 #ifndef	_POSIX_SOURCE
97 extern struct dtconv *	localdtconv();
98 #endif
99 
100 /*
101  * Numeric and monetary conversion information.
102  */
103 struct lconv {
104 	char	*decimal_point;	/* decimal point character */
105 	char	*thousands_sep;	/* thousands separator character */
106 	char	*grouping;	/* grouping of digits */
107 	char	*int_curr_symbol;	/* international currency symbol */
108 	char	*currency_symbol;	/* local currency symbol */
109 	char	*mon_decimal_point;	/* monetary decimal point character */
110 	char	*mon_thousands_sep;	/* monetary thousands separator */
111 	char	*mon_grouping;	/* monetary grouping of digits */
112 	char	*positive_sign;	/* monetary credit symbol */
113 	char	*negative_sign;	/* monetary debit symbol */
114 	char	int_frac_digits; /* intl monetary number of fractional digits */
115 	char	frac_digits;	/* monetary number of fractional digits */
116 	char	p_cs_precedes;	/* true if currency symbol precedes credit */
117 	char	p_sep_by_space;	/* true if space separates c.s.  from credit */
118 	char	n_cs_precedes;	/* true if currency symbol precedes debit */
119 	char	n_sep_by_space;	/* true if space separates c.s.  from debit */
120 	char	p_sign_posn;	/* position of sign for credit */
121 	char	n_sign_posn;	/* position of sign for debit */
122 };
123 
124 #ifndef	_POSIX_SOURCE
125 /*
126  * Date and time conversion information.
127  */
128 struct dtconv {
129 	char	*abbrev_month_names[12];	/* abbreviated month names */
130 	char	*month_names[12];	/* full month names */
131 	char	*abbrev_weekday_names[7];	/* abbreviated weekday names */
132 	char	*weekday_names[7];	/* full weekday names */
133 	char	*time_format;	/* time format */
134 	char	*sdate_format;	/* short date format */
135 	char	*dtime_format;	/* date/time format */
136 	char	*am_string;	/* AM string */
137 	char	*pm_string;	/* PM string */
138 	char	*ldate_format;	/* long date format */
139 };
140 
141 /*
142  * Langinfo
143  */
144 struct langinfo {
145 	char *yesstr;	/* yes string */
146 	char *nostr;	/* nostr */
147 };
148 
149 /*
150  * NLS nl_init
151  */
152 #define	valid(ptr) (ptr != (char *) NULL)
153 #define	nl_init(lang) ((valid(lang) && *lang) ? \
154     (valid(setlocale (LC_ALL, lang) ) ? 0 : -1) \
155     : -1)
156 #endif	/* _POSIX_SOURCE */
157 
158 #endif	/* !__locale_h */
159