1 # compact.awk -- Make charset map compact.
2 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
3 # National Institute of Advanced Industrial Science and Technology (AIST)
4 # Registration Number H13PRO009
6 # This file is part of GNU Emacs.
8 # GNU Emacs is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # GNU Emacs is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 # Make a charset map compact by changing this kind of line sequence:
27 # to one line of this format:
59 function decode_hex
(str
, idx
) {
62 for (i = idx
; i
<= len
; i
++)
64 c = tohex
[substr (str
, i
, 1)];
78 code = decode_hex
($
1, 3);
79 unicode = decode_hex
($
2, 3);
80 if ((code == to_code
+ 1) && (unicode == to_unicode
+ 1))
89 if (from_code == to_code
)
90 printf "0x%02X 0x%04X\n", from_code
, from_unicode
;
91 else if (from_code
< to_code
)
92 printf "0x%02X-0x%02X 0x%04X\n", from_code
, to_code
, from_unicode
;
96 if (from_code == to_code
)
97 printf "0x%04X 0x%04X\n", from_code
, from_unicode
;
98 else if (from_code
< to_code
)
99 printf "0x%04X-0x%04X 0x%04X\n", from_code
, to_code
, from_unicode
;
101 from_code = to_code = code
;
102 from_unicode = to_unicode = unicode
;
109 if (from_code == to_code
)
110 printf "0x%02X 0x%04X\n", from_code
, from_unicode
;
112 printf "0x%02X-0x%02X 0x%04X\n", from_code
, to_code
, from_unicode
;
116 if (from_code == to_code
)
117 printf "0x%04X 0x%04X\n", from_code
, from_unicode
;
119 printf "0x%04X-0x%04X 0x%04X\n", from_code
, to_code
, from_unicode
;
123 # arch-tag: 7e6f57c3-8e62-4af3-8916-ca67bca3a0ce