Mercurial > emacs
annotate admin/charsets/mapconv @ 94822:e93f071bc17a
Item said "vc-update/vc-merge should deal with VC systems that don't
update/merge on a file basis, but on a whole repository basis." That's
what selecting the top-level directory of the repo or working copy is
for.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Fri, 09 May 2008 20:28:54 +0000 |
parents | 8ae4a64098f2 |
children | eb2d9dfc8486 |
rev | line source |
---|---|
88123 | 1 #!/bin/sh |
2 # | |
91418
8ae4a64098f2
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
3 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 |
88123 | 4 # National Institute of Advanced Industrial Science and Technology (AIST) |
5 # Registration Number H13PRO009 | |
6 # | |
7 # This file is part of GNU Emacs. | |
8 # | |
9 # GNU Emacs is free software; you can redistribute it and/or modify | |
10 # it under the terms of the GNU General Public License as published by | |
91418
8ae4a64098f2
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
11 # the Free Software Foundation; either version 3, or (at your option) |
88123 | 12 # any later version. |
13 # | |
14 # GNU Emacs is distributed in the hope that it will be useful, | |
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 # GNU General Public License for more details. | |
18 # | |
19 # You should have received a copy of the GNU General Public License | |
20 # along with GNU Emacs; see the file COPYING. If not, write to the | |
91418
8ae4a64098f2
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
21 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
8ae4a64098f2
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
89916
diff
changeset
|
22 # Boston, MA 02110-1301, USA. |
88123 | 23 |
24 # Comment: | |
25 # Convert charset map of various format into this: | |
26 # 0xXX 0xYYYY | |
27 # where, | |
28 # XX is a code point of the charset in hexa-decimal, | |
29 # YYYY is the corresponding Unicode character code in hexa-decimal. | |
30 # Arguments are: | |
31 # $1: source map file | |
32 # $2: address pattern for sed (optionally with substitution command) | |
33 # $3: format of source map file | |
34 # GLIBC-1 GLIBC-2 GLIBC-2-7 CZYBORRA IANA UNICODE YASUOKA MICROSOFT | |
35 # $4: awk script | |
36 | |
37 BASE=`basename $1` | |
38 | |
39 case "$3" in | |
40 GLIBC*) | |
89823 | 41 SOURCE="glibc-2.3.2/localedata/charmaps/${BASE}";; |
88123 | 42 CZYBORRA) |
43 SOURCE="http://czyborra.com/charsets/${BASE}";; | |
44 IANA) | |
45 SOURCE="http://www.iana.org/assignments/charset-reg/${BASE}";; | |
46 UNICODE) | |
47 SOURCE="http://www.unicode.org/Public/MAPPINGS/.../${BASE}";; | |
89742 | 48 UNICODE2) |
49 SOURCE="http://www.unicode.org/Public/MAPPINGS/.../${BASE}";; | |
88123 | 50 YASUOKA) |
51 SOURCE="http://kanji.zinbun.kyoto-u.ac.jp/~yasuoka/.../${BASE}";; | |
52 MICROSOFT) | |
53 SOURCE="http://www.microsoft.com/globaldev/reference/oem/${BASE}";; | |
89815
59bbae51ad73
Add code for handling KANJI-DATABASE format.
Kenichi Handa <handa@m17n.org>
parents:
89746
diff
changeset
|
54 KANJI-DATABASE) |
59bbae51ad73
Add code for handling KANJI-DATABASE format.
Kenichi Handa <handa@m17n.org>
parents:
89746
diff
changeset
|
55 SOURCE="data at http://sourceforge.net/cvs/?group_id=26261";; |
88123 | 56 *) |
57 echo "Unknown file type: $3"; | |
58 exit 1;; | |
59 esac | |
60 | |
61 echo "# Generated from $SOURCE" | |
62 | |
63 if [ -n "$4" ] ; then | |
64 if [ -f "$4" ] ; then | |
65 AWKPROG="gawk -f $4" | |
66 else | |
67 echo "Awk program does not exist: $4" | |
68 exit 1 | |
69 fi | |
70 else | |
71 AWKPROG=cat | |
72 fi | |
73 | |
74 if [ "$3" == "GLIBC-1" ] ; then | |
75 # Source format is: | |
76 # <UYYYY> /xXX | |
77 sed -n -e "$2 p" < $1 \ | |
78 | sed -e 's,<U\([^>]*\)>[ ]*/x\(..\).*,0x\2 0x\1,' \ | |
79 | sort | ${AWKPROG} | |
80 elif [ "$3" == "GLIBC-2" ] ; then | |
81 # Source format is: | |
82 # <UYYYY> /xXX/xZZ | |
83 sed -n -e "$2 p" < $1 \ | |
84 | sed -e 's,<U\([^>]*\)>[ ]*/x\(..\)/x\(..\).*,0x\2\3 0x\1,' \ | |
85 | sort | ${AWKPROG} | |
86 elif [ "$3" == "GLIBC-2-7" ] ; then | |
87 # Source format is: | |
88 # <UYYYY> /xXX/xZZ | |
89 # We must drop MSBs of XX and ZZ | |
90 sed -n -e "$2 p" < $1 \ | |
91 | sed -e 's/xa/x2/g' -e 's/xb/x3/g' -e 's/xc/x4/g' \ | |
92 -e 's/xd/x5/g' -e 's/xe/x6/g' -e 's/xf/x7/g' \ | |
93 -e 's,<U\([^>]*\)>[ ]*/x\(..\)/x\(..\).*,0x\2\3 0x\1,' \ | |
94 | tee temp \ | |
95 | sort | ${AWKPROG} | |
96 elif [ "$3" == "CZYBORRA" ] ; then | |
97 # Source format is: | |
98 # =XX U+YYYY | |
99 zcat $1 | sed -n -e "$2 p" \ | |
100 | sed -e 's/=\(..\)[^U]*U+\([0-9A-F]*\).*/0x\1 0x\2/' \ | |
101 | sort | ${AWKPROG} | |
102 elif [ "$3" == "IANA" ] ; then | |
103 # Source format is: | |
104 # 0xXX 0xYYYY | |
105 sed -n -e "$2 p" < $1 \ | |
106 | sed -e 's/\(0x[0-9A-Fa-f]*\)[^0]*\(0x[0-9A-Fa-f]*\).*/\1 \2/' \ | |
107 | sort | ${AWKPROG} | |
108 elif [ "$3" == "UNICODE" ] ; then | |
109 # Source format is: | |
110 # YYYY XX | |
111 sed -n -e "$2 p" < $1 \ | |
112 | sed -e 's/\([0-9A-F]*\)[^0-9A-F]*\([0-9A-F]*\).*/0x\2 0x\1/' \ | |
113 | sort | ${AWKPROG} | |
89742 | 114 elif [ "$3" == "UNICODE2" ] ; then |
115 # Source format is: | |
116 # 0xXXXX 0xYYYY # ... | |
117 sed -n -e "$2 p" < $1 \ | |
118 | sed -e 's/\([0-9A-Fx]*\)[^0]*\([0-9A-Fx]*\).*/\1 \2/' \ | |
89746
b7afe7c870d3
In UNICODE2 case, sort by 4th field after
Kenichi Handa <handa@m17n.org>
parents:
89742
diff
changeset
|
119 | ${AWKPROG} | sort -n -k 4,4 |
88123 | 120 elif [ "$3" == "YASUOKA" ] ; then |
121 # Source format is: | |
122 # YYYY 0-XXXX (XXXX is a Kuten code) | |
123 sed -n -e "$2 p" < $1 \ | |
124 | sed -e 's/\([0-9A-F]*\)[^0]*0-\([0-9]*\).*/0x\2 0x\1/' \ | |
125 | sort | ${AWKPROG} | |
126 elif [ "$3" == "MICROSOFT" ] ; then | |
127 # Source format is: | |
128 # XX = U+YYYY | |
129 sed -n -e "$2 p" < $1 \ | |
130 | sed -e 's/\([0-9A-F]*\).*U+\([0-9A-F]*\).*/0x\1 0x\2/' \ | |
131 | sort | ${AWKPROG} | |
89815
59bbae51ad73
Add code for handling KANJI-DATABASE format.
Kenichi Handa <handa@m17n.org>
parents:
89746
diff
changeset
|
132 elif [ "$3" == "KANJI-DATABASE" ] ; then |
59bbae51ad73
Add code for handling KANJI-DATABASE format.
Kenichi Handa <handa@m17n.org>
parents:
89746
diff
changeset
|
133 # Source format is: |
59bbae51ad73
Add code for handling KANJI-DATABASE format.
Kenichi Handa <handa@m17n.org>
parents:
89746
diff
changeset
|
134 # C?-XXXX U+YYYYY ..... |
59bbae51ad73
Add code for handling KANJI-DATABASE format.
Kenichi Handa <handa@m17n.org>
parents:
89746
diff
changeset
|
135 sed -n -e "$2 p" < $1 \ |
59bbae51ad73
Add code for handling KANJI-DATABASE format.
Kenichi Handa <handa@m17n.org>
parents:
89746
diff
changeset
|
136 | sed -e 's/...\(....\) U+\([0-9A-F]*\).*/0x\1 0x\2/' \ |
59bbae51ad73
Add code for handling KANJI-DATABASE format.
Kenichi Handa <handa@m17n.org>
parents:
89746
diff
changeset
|
137 | sort | ${AWKPROG} |
88123 | 138 else |
139 echo "Invalid arguments" | |
140 exit 1 | |
141 fi | |
89916
e0e4e6a0599f
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
89823
diff
changeset
|
142 |
e0e4e6a0599f
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
89823
diff
changeset
|
143 # arch-tag: c33acb47-7eb6-4872-b871-15e1447e8f0e |