1 # compact.awk -- Make charset map compact.
2 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
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, or (at your option)
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; see the file COPYING. If not, write to the
20 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 # Boston, MA 02110-1301, USA.
24 # Make a charset map compact by changing this kind of line sequence:
29 # to one line of this format:
61 function decode_hex
(str
, idx
) {
64 for (i = idx
; i
<= len
; i
++)
66 c = tohex
[substr (str
, i
, 1)];
80 code = decode_hex
($
1, 3);
81 unicode = decode_hex
($
2, 3);
82 if ((code == to_code
+ 1) && (unicode == to_unicode
+ 1))
91 if (from_code == to_code
)
92 printf "0x%02X 0x%04X\n", from_code
, from_unicode
;
93 else if (from_code
< to_code
)
94 printf "0x%02X-0x%02X 0x%04X\n", from_code
, to_code
, from_unicode
;
98 if (from_code == to_code
)
99 printf "0x%04X 0x%04X\n", from_code
, from_unicode
;
100 else if (from_code
< to_code
)
101 printf "0x%04X-0x%04X 0x%04X\n", from_code
, to_code
, from_unicode
;
103 from_code = to_code = code
;
104 from_unicode = to_unicode = unicode
;
111 if (from_code == to_code
)
112 printf "0x%02X 0x%04X\n", from_code
, from_unicode
;
114 printf "0x%02X-0x%02X 0x%04X\n", from_code
, to_code
, from_unicode
;
118 if (from_code == to_code
)
119 printf "0x%04X 0x%04X\n", from_code
, from_unicode
;
121 printf "0x%04X-0x%04X 0x%04X\n", from_code
, to_code
, from_unicode
;
125 # arch-tag: 7e6f57c3-8e62-4af3-8916-ca67bca3a0ce