Mercurial > emacs
annotate admin/charsets/gb180304.awk @ 99471:ef31eb276c4b
Add standard Emacs copyright notice, treating this file as part of
Emacs/nxml-mode (following private communication from FSF).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 09 Nov 2008 04:05:39 +0000 |
parents | eb2d9dfc8486 |
children | ce88a631c161 |
rev | line source |
---|---|
91417
c8aabc9d9db2
Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
1 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 |
c8aabc9d9db2
Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
2 # National Institute of Advanced Industrial Science and Technology (AIST) |
c8aabc9d9db2
Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
3 # Registration Number H13PRO009 |
94832
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91417
diff
changeset
|
4 |
91417
c8aabc9d9db2
Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
5 # This file is part of GNU Emacs. |
94832
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91417
diff
changeset
|
6 |
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91417
diff
changeset
|
7 # GNU Emacs is free software: you can redistribute it and/or modify |
91417
c8aabc9d9db2
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 |
94832
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91417
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91417
diff
changeset
|
10 # (at your option) any later version. |
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91417
diff
changeset
|
11 |
91417
c8aabc9d9db2
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, |
c8aabc9d9db2
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 |
c8aabc9d9db2
Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c8aabc9d9db2
Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
15 # GNU General Public License for more details. |
94832
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91417
diff
changeset
|
16 |
91417
c8aabc9d9db2
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 |
94832
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91417
diff
changeset
|
18 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
91417
c8aabc9d9db2
Add copyright and license notice.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
19 |
88123 | 20 BEGIN { |
21 tohex["A"] = 10; | |
22 tohex["B"] = 11; | |
23 tohex["C"] = 12; | |
24 tohex["D"] = 13; | |
25 tohex["E"] = 14; | |
26 tohex["F"] = 15; | |
27 tohex["a"] = 10; | |
28 tohex["b"] = 11; | |
29 tohex["c"] = 12; | |
30 tohex["d"] = 13; | |
31 tohex["e"] = 14; | |
32 tohex["f"] = 15; | |
33 } | |
34 | |
35 function decode_hex(str) { | |
36 n = 0; | |
37 len = length(str); | |
38 for (i = 1; i <= len; i++) | |
39 { | |
40 c = substr (str, i, 1); | |
41 if (c >= "0" && c <= "9") | |
42 n = n * 16 + (c - "0"); | |
43 else | |
44 n = n * 16 + tohex[c]; | |
45 } | |
46 return n; | |
47 } | |
48 | |
49 function gb_to_index(gb) { | |
50 b0 = int(gb / 256); | |
51 b1 = gb % 256; | |
52 idx = (((b0 - 129)) * 191 + b1 - 64); | |
53 # if (b1 >= 127) | |
54 # idx--; | |
55 return idx | |
56 } | |
57 | |
58 function index_to_gb(idx) { | |
59 b3 = (idx % 10) + 48; | |
60 idx = int(idx / 10); | |
61 b2 = (idx % 126) + 129; | |
62 idx = int(idx / 126); | |
63 b1 = (idx % 10) + 48; | |
64 b0 = int(idx / 10) + 129; | |
65 return sprintf("%02X%02X%02X%02X", b0, b1, b2, b3); | |
66 } | |
67 | |
68 /^\#/ { | |
69 print; | |
70 next; | |
71 } | |
72 | |
73 /0x....-0x..../ { | |
74 gb_from = gb_to_index(decode_hex(substr($1, 3, 4))); | |
75 gb_to = gb_to_index(decode_hex(substr($1, 10, 4))); | |
76 unicode = decode_hex(substr($2, 3, 4)); | |
77 while (gb_from <= gb_to) | |
78 { | |
79 table[unicode++] = 1; | |
80 gb_from++; | |
81 } | |
82 next; | |
83 } | |
84 | |
85 { | |
86 gb = decode_hex(substr($1, 3, 4)); | |
87 unicode = decode_hex(substr($2, 3, 4)); | |
88 table[unicode] = 1; | |
89 } | |
90 | |
91 END { | |
92 from_gb = -1; | |
93 to_gb = 0; | |
94 from_i = 0; | |
95 table[65536] = 1; | |
96 for (i = 128; i <= 65536; i++) | |
97 { | |
98 if (table[i] == 0) | |
99 { | |
100 if (i < 55296 || i >= 57344) | |
101 { | |
102 if (from_gb < 0) | |
103 { | |
104 from_gb = to_gb; | |
105 from_i = i; | |
106 } | |
107 to_gb++; | |
108 } | |
109 } | |
110 else if (from_gb >= 0) | |
111 { | |
112 if (from_gb + 1 == to_gb) | |
113 printf "0x%s\t\t0x%04X\n", | |
114 index_to_gb(from_gb), from_i; | |
115 else | |
116 printf "0x%s-0x%s\t0x%04X\n", | |
117 index_to_gb(from_gb), index_to_gb(to_gb - 1), from_i; | |
118 from_gb = -1; | |
119 } | |
120 } | |
121 } | |
89916
e0e4e6a0599f
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
88123
diff
changeset
|
122 |
e0e4e6a0599f
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
88123
diff
changeset
|
123 # arch-tag: 8e5a22ae-610e-411f-ae17-d6e528b30d71 |