1 /*
2  * itable_t.h
3  *
4  * All rights reserved. Copyright (C) 1996 by NARITA Tomio
5  * $Id: itable_t.h,v 1.6 2003/11/13 03:08:19 nrt Exp $
6  */
7 
8 #ifndef __ITABLE_T_H__
9 #define __ITABLE_T_H__
10 
11 #include <ascii.h>
12 #include <attr.h>
13 #include <ichar.h>
14 
15 /*
16  * character sets's name space (byte)
17  */
18 
19 #define ISO646_US	0	/* ISO 646 United states (ANSI X3.4-1968) */
20 #define X0201ROMAN	1	/* JIS X0201-1976 Japanese Roman */
21 
22 #define X0201KANA	2	/* JIS X0201-1976 Japanese Katakana */
23 
24 #define ISO8859_1	3	/* ISO 8859/1 Latin1 alphabet */
25 #define ISO8859_2	4	/* ISO 8859/2 Latin2 alphabet */
26 #define ISO8859_3	5	/* ISO 8859/3 Latin3 alphabet */
27 #define ISO8859_4	6	/* ISO 8859/4 Latin4 alphabet */
28 #define ISO8859_5	7	/* ISO 8859/5 Cyrillic alphabet */
29 #define ISO8859_6	8	/* ISO 8859/6 Arabic alphabet */
30 #define ISO8859_7	9	/* ISO 8859/7 Greek alphabet */
31 #define ISO8859_8	10	/* ISO 8859/8 Hebrew alphabet */
32 #define ISO8859_9	11	/* ISO 8859/9 Latin5 alphabet */
33 #define ISO8859_10	12	/* ISO 8859/10 Latin6 alphabet */
34 #define ISO8859_11	13	/* ISO 8859/13 Thai alphabet */
35 #define ISO8859_13	14	/* ISO 8859/13 Latin7 alphabet */
36 #define ISO8859_14	15	/* ISO 8859/14 Latin8 alphabet */
37 #define ISO8859_15	16	/* ISO 8859/15 Latin9 alphabet */
38 #define ISO8859_16	17	/* ISO 8859/16 Latin10 alphabet */
39 
40 #define C6226		18	/* JIS C 6226-1978 Japanese kanji */
41 #define GB2312		19	/* GB 2312-80 Chinese kanji */
42 #define X0208		20	/* JIS X 0208-1983 Japanese kanji */
43 #define KSC5601		21	/* KS C 5601-1987 Korean graphic charset */
44 #define X0212		22	/* JIS X 0212-1990 Supplementary charset */
45 #define ISO_IR_165	23	/* ISO-IR-165 */
46 #define CNS_1		24	/* CNS 11643-1992 Plane 1 */
47 #define CNS_2		25	/* CNS 11643-1992 Plane 2 */
48 #define CNS_3		26	/* CNS 11643-1992 Plane 3 */
49 #define CNS_4		27	/* CNS 11643-1992 Plane 4 */
50 #define CNS_5		28	/* CNS 11643-1992 Plane 5 */
51 #define CNS_6		29	/* CNS 11643-1992 Plane 6 */
52 #define CNS_7		30	/* CNS 11643-1992 Plane 7 */
53 
54 #define X0213_1		31	/* JIS X 0213-2000 Plane 1 */
55 #define X0213_2		32	/* JIS X 0213-2000 Plane 2 */
56 
57 #define BIG5		33	/* Big5 Traditional Chinese */
58 
59 #define UNICODE		34	/* Unicode */
60 
61 #define PSEUDO		35
62 
63 #define SPACE		36
64 #define HTAB		37
65 #define CNTRL		38
66 
67 #define LINE_FEED	39
68 
69 #define I_TABLE_SIZE	40
70 
71 #define NOSET		I_TABLE_SIZE
72 
73 #define ASCII		ISO646_US
74 
75 /*
76  * international charset table
77  */
78 
79 typedef struct {
80   byte       charset;
81   byte       fin;		/* final character */
82   boolean_t  multi;		/* is multi bytes charset */
83   boolean_t  set94;		/* is 94 chars charset */
84   int        length;		/* code length for the charset */
85   int        width;		/* graphical width of each char */
86 } i_table_t;
87 
88 #define SET94		TRUE
89 #define SET96		FALSE
90 
91 public boolean_t allow_unify;
92 public ic_t unicode_width_threshold;
93 
94 public void ItableInit();
95 public byte ItableLookup( byte fin, boolean_t multi, boolean_t set94 );
96 
97 public int IcharWidth( byte charset, ic_t c );
98 public int IstrWidth( i_str_t *istr );
99 
100 #endif /* __ITABLE_T_H__ */
101