Mercurial > emacs
annotate admin/charsets/eucjp-ms.awk @ 96695:98ae99a5a007
Switch to recommended form of GPLv3 permissions notice.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 16 Jul 2008 02:24:31 +0000 |
parents | eb2d9dfc8486 |
children | ce88a631c161 |
rev | line source |
---|---|
89750 | 1 # eucjp-ms.awk -- Generate a translation table for eucJP-ms. |
91415
c50a10842bd9
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
2 # Copyright (C) 2004, 2005, 2006, 2007, 2008 |
89750 | 3 # National Institute of Advanced Industrial Science and Technology (AIST) |
4 # Registration Number H13PRO009 | |
94832
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91415
diff
changeset
|
5 |
89750 | 6 # This file is part of GNU Emacs. |
94832
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91415
diff
changeset
|
7 |
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91415
diff
changeset
|
8 # GNU Emacs is free software: you can redistribute it and/or modify |
89750 | 9 # 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:
91415
diff
changeset
|
10 # 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:
91415
diff
changeset
|
11 # (at your option) any later version. |
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91415
diff
changeset
|
12 |
89750 | 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. | |
94832
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91415
diff
changeset
|
17 |
89750 | 18 # 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:
91415
diff
changeset
|
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
89750 | 20 |
94832
eb2d9dfc8486
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91415
diff
changeset
|
21 # Commentary: |
89750 | 22 |
23 # eucJP-ms is one of eucJP-open encoding defined at this page: | |
24 # http://www.opengroup.or.jp/jvc/cde/appendix.html | |
25 | |
26 BEGIN { | |
27 print ";;; eucjp-ms.el -- translation table for eucJP-ms. -*- no-byte-compile: t -*-"; | |
28 print ";;; Automatically genrated from eucJP-13th.txt, eucJP-udc.txt, eucJP-ibmext.txt"; | |
29 print "(let ((map"; | |
30 printf " '(;JISEXT<->UNICODE"; | |
31 | |
32 tohex["A"] = 10; | |
33 tohex["B"] = 11; | |
34 tohex["C"] = 12; | |
35 tohex["D"] = 13; | |
36 tohex["E"] = 14; | |
37 tohex["F"] = 15; | |
38 } | |
39 | |
40 function decode_hex(str) { | |
41 n = 0; | |
42 len = length(str); | |
43 for (i = 1; i <= len; i++) | |
44 { | |
45 c = substr(str, i, 1); | |
46 if (c >= "0" && c <= "9") | |
47 n = n * 16 + (c - "0"); | |
48 else | |
49 n = n * 16 + tohex[c]; | |
50 } | |
51 return n; | |
52 } | |
53 | |
54 /0x8F/ { | |
55 code = decode_hex(substr($1, 5, 4)); | |
56 code -= 32896; # code -= 0x8080 | |
57 printf "\n (#x%04x #x%s)", code, substr($2, 3, 4); | |
58 next; | |
59 } | |
60 | |
61 /0x[A-F]/ { | |
62 code = decode_hex(substr($1, 3, 4)); | |
63 code -= 32896; # code -= 0x8080 | |
64 printf "\n (#x%04x . #x%s)", code, substr($2, 3, 4); | |
65 } | |
66 | |
67 END { | |
68 print ")))"; | |
69 print " (mapc #'(lambda (x)"; | |
70 print " (if (integerp (cdr x))"; | |
71 print " (setcar x (decode-char 'japanese-jisx0208 (car x)))"; | |
72 print " (setcar x (decode-char 'japanese-jisx0212 (car x)))"; | |
73 print " (setcdr x (cadr x))))"; | |
74 print " map)"; | |
75 print " (define-translation-table 'eucjp-ms-decode map)"; | |
76 print " (mapc #'(lambda (x)"; | |
77 print " (let ((tmp (car x)))"; | |
78 print " (setcar x (cdr x)) (setcdr x tmp)))"; | |
79 print " map)"; | |
80 print " (define-translation-table 'eucjp-ms-encode map))"; | |
81 } | |
89916
e0e4e6a0599f
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
89750
diff
changeset
|
82 |
e0e4e6a0599f
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
89750
diff
changeset
|
83 # arch-tag: d9cc7af7-2d6e-48cd-8eed-a6d25226de7c |