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