2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 1996, by Sun Microsystems, Inc.
2N/A * All rights reserved.
2N/A */
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A/*
2N/A * Copyright 1993 by Mortice Kern Systems Inc. All rights reserved.
2N/A *
2N/A * $Header: /rd/h/rcs/m_invari.h 1.12 1994/07/06 17:41:39 miked Exp $
2N/A */
2N/A
2N/A/*
2N/A * m_invari.h:
2N/A * Configuration and definitions for support of on systems (e.g EBCDIC)
2N/A * where the POSIX.2 portable characters are not invariant
2N/A */
2N/A
2N/A#ifndef __M_M_INVARI_H__
2N/A#define __M_M_INVARI_H__
2N/A
2N/A/*
2N/A * Are all characters in the portable character set invariant across
2N/A * all locales? The results, for posix, if not, are undefined.
2N/A * For systems that want to try to deal with this, M_VARIANTS is set.
2N/A */
2N/A#ifdef M_VARIANTS
2N/A
2N/Aextern char __m_invariant[];
2N/Aextern char __m_unvariant[];
2N/A
2N/A/*
2N/A * The M_INVARIANTINIT macro must be called to initialize: it returns -1
2N/A * on memory allocation error. It may be called multiple times, but has
2N/A * no effect after the first call. To reinitialize the variant <-->
2N/A * invariant tables after a new setlocale(), use M_INVARIANTREINIT().
2N/A * On error, m_error will have been invoked with an appropriate message.
2N/A */
2N/A#define M_INVARIANTINIT() m_invariantinit()
2N/Aextern void m_invariantinit(void);
2N/A#define M_INVARIANTREINIT() __m_setinvariant()
2N/Aextern void __m_setinvariant(void);
2N/A
2N/A/*
2N/A * Assume wide characters are always ok.
2N/A * Otherwise, always indirect thru the narrow un/invariant table.
2N/A * INVARIANT takes the character in the current locale, and produces an
2N/A * invariant value, equal to that the C compiler would have compiled.
2N/A * UNVARIANT is the inverse; it takes what the C compiler would have
2N/A * compiled, and returns the value in the current locale.
2N/A */
2N/A#define M_INVARIANT(c) (wctob(c) == EOF ? (c) : __m_invariant[c])
2N/A#define M_UNVARIANT(c) (wctob(c) == EOF ? (c) : __m_unvariant[c])
2N/A#define M_UNVARIANTSTR(s) m_unvariantstr(s)
2N/Achar *m_unvariantstr(char const *);
2N/A#define M_WUNVARIANTSTR(ws) m_wunvariantstr(ws)
2N/Awchar_t *m_wunvariantstr(wchar_t const *);
2N/A
2N/A#else /* M_VARIANTS */
2N/A
2N/A/* Normal system */
2N/A#define M_INVARIANTINIT() /* NULL */
2N/A#define M_INVARIANTREINIT() /* NULL */
2N/A#define M_INVARIANT(c) (c)
2N/A#define M_UNVARIANT(c) (c)
2N/A#define M_UNVARIANTSTR(s) (s)
2N/A#define M_WUNVARIANTSTR(ws) (ws)
2N/A
2N/A#endif /* M_VARIANTS */
2N/A
2N/A#endif /*__M_M_INVARI_H__*/
2N/A
2N/A
2N/A