1 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
2 # National Institute of Advanced Industrial Science and Technology (AIST)
3 # Registration Number H13PRO009
5 # This file is part of GNU Emacs.
7 # GNU Emacs is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
12 # GNU Emacs is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Emacs; see the file COPYING. If not, write to the
19 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 # Boston, MA 02110-1301, USA.
37 function decode_hex
(str
) {
40 for (i =
1; i
<= len
; i
++)
42 c =
substr (str
, i
, 1);
43 if (c
>=
"0" && c
<=
"9")
44 n = n
* 16 + (c
- "0");
46 n = n
* 16 + tohex
[c
];
51 function gb_to_index
(gb
) {
54 idx =
(((b0
- 129)) * 191 + b1
- 64);
60 function index_to_gb
(idx
) {
63 b2 =
(idx %
126) + 129;
66 b0 = int
(idx
/ 10) + 129;
67 return sprintf("%02X%02X%02X%02X", b0
, b1
, b2
, b3
);
76 gb_from = gb_to_index
(decode_hex
(substr($
1, 3, 4)));
77 gb_to = gb_to_index
(decode_hex
(substr($
1, 10, 4)));
78 unicode = decode_hex
(substr($
2, 3, 4));
79 while (gb_from
<= gb_to
)
88 gb = decode_hex
(substr($
1, 3, 4));
89 unicode = decode_hex
(substr($
2, 3, 4));
98 for (i =
128; i
<=
65536; i
++)
102 if (i
< 55296 || i
>=
57344)
112 else if (from_gb
>=
0)
114 if (from_gb
+ 1 == to_gb
)
115 printf "0x%s\t\t0x%04X\n",
116 index_to_gb
(from_gb
), from_i
;
118 printf "0x%s-0x%s\t0x%04X\n",
119 index_to_gb
(from_gb
), index_to_gb
(to_gb
- 1), from_i
;
125 # arch-tag: 8e5a22ae-610e-411f-ae17-d6e528b30d71