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) 1996 by Sun Microsystems, Inc. 23 */ 24 25 26 #ifndef _COMMON_THAI_H_ 27 #define _COMMON_THAI_H_ 28 29 #include <sys/isa_defs.h> 30 31 #ifdef _BIG_ENDIAN 32 33 typedef union { 34 unsigned int code; 35 struct { 36 unsigned short high; 37 unsigned short low; 38 } word; 39 struct { 40 unsigned char byte1; 41 unsigned char byte2; 42 unsigned char byte3; 43 unsigned char byte4; 44 } byte; 45 struct { 46 unsigned int high16bits: 16; /* should be 0x00 */ 47 unsigned int msb1: 1; /* should be 0x01 */ 48 unsigned int data1: 7; 49 unsigned int msb2: 1; /* should be 0x01 */ 50 unsigned int data2: 7; 51 } eucTH; 52 struct { 53 unsigned int high16bits: 16; /* should be 0x00 */ 54 unsigned int data1: 4; 55 unsigned int data2: 6; 56 unsigned int data3: 6; 57 } unicode; 58 struct { 59 unsigned int high8bits: 8; /* should be 0x00 */ 60 unsigned int sign1: 4; /* should be 0x0E */ 61 unsigned int data1: 4; 62 unsigned int sign2: 2; /* should be 0x02 */ 63 unsigned int data2: 6; 64 unsigned int sign3: 2; /* should be 0x02 */ 65 unsigned int data3: 6; 66 } utf8; 67 } hcode_type; 68 69 #else /* _BIG_ENDIAN */ 70 71 typedef union { 72 unsigned int code; 73 struct { 74 unsigned short low; 75 unsigned short high; 76 } word; 77 struct { 78 unsigned char byte4; 79 unsigned char byte3; 80 unsigned char byte2; 81 unsigned char byte1; 82 } byte; 83 struct { 84 unsigned int data2: 7; 85 unsigned int msb2: 1; /* should be 0x01 */ 86 unsigned int data1: 7; 87 unsigned int msb1: 1; /* should be 0x01 */ 88 unsigned int high16bits: 16; /* should be 0x00 */ 89 } eucTH; 90 struct { 91 unsigned int data3: 6; 92 unsigned int data2: 6; 93 unsigned int data1: 4; 94 unsigned int high16bits: 16; /* should be 0x00 */ 95 } unicode; 96 struct { 97 unsigned int data3: 6; 98 unsigned int sign3: 2; /* should be 0x02 */ 99 unsigned int data2: 6; 100 unsigned int sign2: 2; /* should be 0x02 */ 101 unsigned int data1: 4; 102 unsigned int sign1: 4; /* should be 0x0E */ 103 unsigned int high8bits: 8; /* should be 0x00 */ 104 } utf8; 105 } hcode_type; 106 107 #endif /* _BIG_ENDIAN */ 108 109 #endif /* _COMMON_THAI_H_ */ 110