xref: /titanic_50/usr/src/lib/iconv_modules/utf-8/common/utf_ebcdic_to_utf8.h (revision 880d797826457b77414b37d531cc3e1aa166ecbe)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 1999 by Sun Microsystems, Inc.
23  * All rights reserved.
24  */
25 
26 
27 #ifndef	UTF_EBCDIC_TO_UTF8_H
28 #define	UTF_EBCDIC_TO_UTF8_H
29 
30 
31 #include "common_defs.h"
32 
33 
34 static 	unsigned int utf_ebcdic_to_i8[0x100] = {
35 
36 #include "txt_ebcdic_utf/utf_ebcdic_to_i8.txt"
37 
38 };
39 
40 
41 /*
42  * shadow flag defined in specification.
43  */
44 static 	signed char number_of_bytes_in_utf_ebcidc[0x100] = {
45 
46 #include "txt_ebcdic_utf/shadow.txt"
47 
48 };
49 #define UTF_EBCDIC_LEAD_OCTET_MAX 7
50 #define UTF_EBCDIC_LEAD_OCTET_MIN 0 /* Control Character */
51 #define UTF_EBCDIC_TRAILING_OCTET 9
52 
53 
54 /*
55  * Following is a vector of bit-masks to get used bits in the first byte of
56  * a UTF-EBCDIC character.  Index is 0 for control character or the number
57  * of bytes in the UTF-EBCDIC character.
58  * and the index value comes from above table.
59  */
60 static const uchar_t utf_ebcdic_masks_tbl[UTF_EBCDIC_LEAD_OCTET_MAX+1] =
61 	{ 0xff, 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x01};
62 /*	     0     1     2     3     4     5     6     7	*/
63 
64 #define	UTF_EBCDIC_BIT_SHIFT		5
65 #define	UTF_EBCDIC_BIT_MASK		0x1f
66 
67 
68 #endif	/* UTF_EBCDIC_TO_UTF8_H */
69