xref: /illumos-gate/usr/src/lib/libxcurses/h/m_i18n.h (revision 7c478bd9)
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 (c) 1996, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  * m_i18n.h: Header file dealing with all i18n issues.  #included from mks.h,
31  * no program should ever #include any i18n-specific header (i.e. this
32  * will decide to include locale.h, nls.h and what not).
33  *
34  * Copyright 1992, 1993 by Mortice Kern Systems Inc.  All rights reserved.
35  *
36  * $Header: /rd/h/rcs/m_i18n.h 1.17 1995/01/04 02:42:04 mark Exp ross $
37  */
38 
39 #ifndef __M_M_I18N_H_
40 #define __M_M_I18N_H_
41 
42 #ifndef	M_I18N_M_
43 /*l
44  * Libraries do not have leading m_ prefixes.
45  * Thus, we must create #defines which will change all our code from
46  * having m_ prefixes, to direct library calls.
47  */
48 #define	m_collel_t	collel_t
49 #define	m_ismccollel	ismccollel
50 #define	m_collequiv	collequiv
51 #define	m_collrange	collrange
52 #define	m_collorder	collorder
53 #define	m_cclass	cclass
54 #define	m_strtocoll	strtocoll
55 #define	m_colltostr	colltostr
56 
57 #define	m_localedtconv	localedtconv
58 #define	m_localeldconv	localeldconv
59 #define	m_dtconv	dtconv
60 
61 #endif	/* !M_I18N_M_ */
62 
63 #define	M_CSETSIZE	(UCHAR_MAX+1)
64 
65 /*l
66  *  Fetch all the data structures.
67  *  Even if I18N is off, we need access to the data structures.
68  *  Routines defined inside these headers may get changed via #define's
69  *  below.
70  */
71 #include <m_nls.h>	/* Our messaging scheme file */
72 #include <locale.h>	/* Local compiler's locale.h */
73 #include <collate.h>	/* Local compiler's collation: includes m_collel_t */
74 
75 /*l
76  * Define i18n portability routines -- built on top of what we define
77  * as the mks extentions.
78  */
79 extern int		m_isyes (char *);
80 
81 #ifndef	I18N
82 
83 /*l
84  * I18N is not supported -- make most of it disappear
85  *
86  * If we don't want all the internationalization stuff, then we get rid
87  * all the code, and all the data except the lconv structure (if used).
88  * This is done if I18N is undefined at compile time.  In this case, #define's
89  * are used to convert strcoll into strcmp; setlocale to simply return POSIX,
90  * and localeconv to return a pointer to the static lconv structure.
91  */
92 
93 /* messaging */
94 #undef	m_textstr
95 #undef	m_msgdup
96 #undef	m_msgfree
97 #define	m_textdomain(str)
98 #define m_textmsg(id, str, cls)		(str)
99 #define m_textstr(id, str, cls)		str
100 #define m_strmsg(str)			(str)
101 #define m_msgdup(m)	(m)
102 #define m_msgfree(m)
103 
104 /* locale */
105 #define	setlocale(class, locale)	((char *)"POSIX")
106 #define	strcoll				strcmp
107 #define	localeconv()			(&_m_lconv)
108 #undef	m_localedtconv
109 #define	m_localedtconv()		(&_m_dtconv)
110 #undef	m_localeldconv
111 #define	m_localeldconv()		(&_m_locdef)
112 #undef	m_colltostr
113 #define	m_colltostr(c)			(NULL)
114 
115 extern struct lconv		_m_lconv;
116 extern struct m_dtconv		_m_dtconv;
117 extern struct _m_localedef	_m_locdef;
118 
119 #endif /*I18N*/
120 
121 #endif /*__M_M_I18N_H_*/
122