annotate admin/charsets/big5.awk @ 94625:be875b5d451e

(vc-dir-mark-buffer-changed): Fix typo client-mode -> vc-client-object, and guess `funcall' was meant. (vc-dir-mode): Rename client-mode -> vc-client.mode.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 05 May 2008 06:12:33 +0000
parents ebb1b38229bc
children eb2d9dfc8486
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
91411
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
1 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
2 # National Institute of Advanced Industrial Science and Technology (AIST)
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
3 # Registration Number H13PRO009
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
4 #
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
5 # This file is part of GNU Emacs.
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
6 #
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
7 # GNU Emacs is free software; you can redistribute it and/or modify
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
8 # it under the terms of the GNU General Public License as published by
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
9 # the Free Software Foundation; either version 3, or (at your option)
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
10 # any later version.
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
11 #
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
12 # GNU Emacs is distributed in the hope that it will be useful,
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
15 # GNU General Public License for more details.
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
16 #
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
17 # You should have received a copy of the GNU General Public License
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
18 # along with GNU Emacs; see the file COPYING. If not, write to the
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
19 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
20 # Boston, MA 02110-1301, USA.
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
21
88123
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 BEGIN {
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
23 tohex["A"] = 10;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
24 tohex["B"] = 11;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25 tohex["C"] = 12;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
26 tohex["D"] = 13;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
27 tohex["E"] = 14;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
28 tohex["F"] = 15;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29 tohex["a"] = 10;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
30 tohex["b"] = 11;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
31 tohex["c"] = 12;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32 tohex["d"] = 13;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
33 tohex["e"] = 14;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
34 tohex["f"] = 15;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
35 }
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
36
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
37 function decode_hex(str) {
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
38 n = 0;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
39 len = length(str);
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40 for (i = 1; i <= len; i++)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
41 {
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
42 c = substr (str, i, 1);
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
43 if (c >= "0" && c <= "9")
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
44 n = n * 16 + (c - "0");
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
45 else
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
46 n = n * 16 + tohex[c];
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
47 }
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
48 return n;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
49 }
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
50
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
51 function decode_big5(big5) {
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
52 b0 = int(big5 / 256);
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
53 b1 = big5 % 256;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
54 # (0xFF - 0xA1 + 0x7F - 0x40) = 157
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
55 # (0xA1 - (0x7F - 0x40)) = 98
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
56 # (0xC9 - 0xA1) * (0xFF - 0xA1 + 0x7F - 0x40) = 6280
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
57 if (b1 < 127)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
58 idx = (b0 - 161) * 157 + (b1 - 64);
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
59 else
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
60 idx = (b0 - 161) * 157 + (b1 - 98);
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
61 if (b0 >= 201)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
62 idx -= 6280;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
63 b0 = int(idx / 94) + 33;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
64 b1 = (idx % 94) + 33;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
65 return (b0 * 256 + b1)
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
66 }
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
67
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
68 {
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
69 big5 = decode_hex($1);
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
70 code = decode_big5(big5);
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
71 printf "0x%04X %s\n", code, $2;
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
72 }
375f2633d815 New directory
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
73
91411
ebb1b38229bc Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents: 89916
diff changeset
74
89916
e0e4e6a0599f Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 88123
diff changeset
75 # arch-tag: 36f08d21-0d24-4b67-852d-a9a51299586d