1*16d86563SAlexander Pyhalov /*
2*16d86563SAlexander Pyhalov * CDDL HEADER START
3*16d86563SAlexander Pyhalov *
4*16d86563SAlexander Pyhalov * The contents of this file are subject to the terms of the
5*16d86563SAlexander Pyhalov * Common Development and Distribution License (the "License").
6*16d86563SAlexander Pyhalov * You may not use this file except in compliance with the License.
7*16d86563SAlexander Pyhalov *
8*16d86563SAlexander Pyhalov * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
9*16d86563SAlexander Pyhalov * or http://www.opensolaris.org/os/licensing.
10*16d86563SAlexander Pyhalov * See the License for the specific language governing permissions
11*16d86563SAlexander Pyhalov * and limitations under the License.
12*16d86563SAlexander Pyhalov *
13*16d86563SAlexander Pyhalov * When distributing Covered Code, include this CDDL HEADER in each
14*16d86563SAlexander Pyhalov * file and include the License file at src/OPENSOLARIS.LICENSE.
15*16d86563SAlexander Pyhalov * If applicable, add the following below this CDDL HEADER, with the
16*16d86563SAlexander Pyhalov * fields enclosed by brackets "[]" replaced with your own identifying
17*16d86563SAlexander Pyhalov * information: Portions Copyright [yyyy] [name of copyright owner]
18*16d86563SAlexander Pyhalov *
19*16d86563SAlexander Pyhalov * CDDL HEADER END
20*16d86563SAlexander Pyhalov */
21*16d86563SAlexander Pyhalov /*
22*16d86563SAlexander Pyhalov * Copyright (c) 1994 by Sun Microsystems, Inc.
23*16d86563SAlexander Pyhalov */
24*16d86563SAlexander Pyhalov
25*16d86563SAlexander Pyhalov
26*16d86563SAlexander Pyhalov #include <errno.h>
27*16d86563SAlexander Pyhalov #include "ktable.h"
28*16d86563SAlexander Pyhalov #include "hangulcode.h"
29*16d86563SAlexander Pyhalov
30*16d86563SAlexander Pyhalov
31*16d86563SAlexander Pyhalov /**** _ J O H A P _ T O _ W A N S U N G ****/
32*16d86563SAlexander Pyhalov
_johap_to_wansung(unsigned short ci,unsigned short v,unsigned short cf)33*16d86563SAlexander Pyhalov unsigned short _johap_to_wansung(unsigned short ci, unsigned short v,
34*16d86563SAlexander Pyhalov unsigned short cf)
35*16d86563SAlexander Pyhalov {
36*16d86563SAlexander Pyhalov register unsigned short i;
37*16d86563SAlexander Pyhalov unsigned short code, mask, disp;
38*16d86563SAlexander Pyhalov long cfbit;
39*16d86563SAlexander Pyhalov
40*16d86563SAlexander Pyhalov if (ci <= 18 && v == CVC_FILL && cf == CVC_FILL)
41*16d86563SAlexander Pyhalov return(0xA4A0 + Y19_32[ci + 1]);
42*16d86563SAlexander Pyhalov else if (ci == CVC_FILL && v <= 20 && cf == CVC_FILL)
43*16d86563SAlexander Pyhalov return(0xA4BF + v);
44*16d86563SAlexander Pyhalov else if (ci != CVC_FILL && ci <= 18 && v != CVC_FILL && v <= 20)
45*16d86563SAlexander Pyhalov {
46*16d86563SAlexander Pyhalov if (cf == CVC_FILL)
47*16d86563SAlexander Pyhalov cf = 1;
48*16d86563SAlexander Pyhalov
49*16d86563SAlexander Pyhalov cfbit = cmp_bitmap[ci][v];
50*16d86563SAlexander Pyhalov for (disp = 0, i = 0; i < cf; i++)
51*16d86563SAlexander Pyhalov {
52*16d86563SAlexander Pyhalov if (cfbit & BIT_MASK)
53*16d86563SAlexander Pyhalov disp++;
54*16d86563SAlexander Pyhalov cfbit >>= 1;
55*16d86563SAlexander Pyhalov }
56*16d86563SAlexander Pyhalov if (!(cfbit & BIT_MASK))
57*16d86563SAlexander Pyhalov return(FAILED);
58*16d86563SAlexander Pyhalov
59*16d86563SAlexander Pyhalov code = cmp_srchtbl[ci][v] + disp;
60*16d86563SAlexander Pyhalov mask = cmp_srchtbl[ci][v] & 0xFF;
61*16d86563SAlexander Pyhalov
62*16d86563SAlexander Pyhalov return(code + (((short)(mask + disp) > 0xFE) ? SKIP : 0));
63*16d86563SAlexander Pyhalov }
64*16d86563SAlexander Pyhalov
65*16d86563SAlexander Pyhalov return(FAILED);
66*16d86563SAlexander Pyhalov } /* end of unsigned short _johap_to_wansung(unsigned short, unsigned short,
67*16d86563SAlexander Pyhalov * unsigned short). */
68