1 // ident "%Z%%M% %I% %E% SMI"
2 // Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 // Use is subject to license terms.
7 // The contents of this file are subject to the terms of the
8 // Common Development and Distribution License, Version 1.0 only
9 // (the "License"). You may not use this file except in compliance
12 // You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13 // or http://www.opensolaris.org/os/licensing.
14 // See the License for the specific language governing permissions
15 // and limitations under the License.
17 // When distributing Covered Code, include this CDDL HEADER in each
18 // file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19 // If applicable, add the following below this CDDL HEADER, with the
20 // fields enclosed by brackets "[]" replaced with your own identifying
21 // information: Portions Copyright [yyyy] [name of copyright owner]
27 // ISO-2022-JP to eucJP
30 #include <sys/errno.h>
39 // Emit state reset sequence, ESC ( J, for
47 condition { // JIS X 0201 Latin (ASCII)
51 // We will emit four bytes.
52 if (outputsize <= 3) {
55 // Emit state reset sequence, ESC ( J.
59 if (outputsize <= 0) {
65 // Move input buffer pointer one byte.
69 condition { // JIS X 0208
70 between 0xa1a1...0xfefe;
73 if (outputsize <= 4) {
76 // Emit JIS X 0208 sequence, ESC $ B.
80 if (outputsize <= 1) {
84 output = (input[0] & 0x7f);
85 output = (input[1] & 0x7f);
87 // Move input buffer pointer two bytes.
91 condition { // JIS X 0201 Kana
92 between 0x8ea1...0x8edf;
95 if (outputsize <= 3) {
98 // Emit JIS X 0201 Kana sequence,
103 if (outputsize <= 0) {
107 output = (input[1] & 127);
109 // Move input buffer pointer two bytes.
113 condition { // JIS X 0212
114 between 0x8fa1a1...0x8ffefe;
117 if (outputsize <= 5) {
120 // Emit JIS X 0212 sequence, ESC $ ( D.
124 if (outputsize <= 1) {
128 output = (input[1] & 127);
129 output = (input[2] & 127);
133 true operation { // error