Mercurial > emacs
annotate admin/unidata/biditype.awk @ 112433:7b649f6eac4f
Merge from mainline.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 22 Jan 2011 17:09:09 -0800 |
parents | 6378d1b57038 |
children |
rev | line source |
---|---|
108983
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
1 # Generate data for filling bidi_type_table, see src/bidi.c:bidi_initialize. |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
2 |
112275
6378d1b57038
Add 2011 to remaining FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
108983
diff
changeset
|
3 # Copyright (C) 2010, 2011 Free Software Foundation, Inc. |
108983
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
4 |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
5 # This file is part of GNU Emacs. |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
6 |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
7 # GNU Emacs is free software: you can redistribute it and/or modify |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU General Public License as published by |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
11 |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
12 # GNU Emacs is distributed in the hope that it will be useful, |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
15 # GNU General Public License for more details. |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
16 |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU General Public License |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
18 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
19 |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
20 # Written by Eli Zaretskii <eliz@gnu.org> |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
21 |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
22 function trtype(type) |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
23 { |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
24 # Types are listed in the order of decresing use in UnicodeData.txt: |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
25 if (type == "ON") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
26 return "NEUTRAL_ON"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
27 else if (type == "NSM") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
28 return "WEAK_NSM"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
29 else if (type == "AL") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
30 return "STRONG_AL"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
31 else if (type == "R") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
32 return "STRONG_R"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
33 else if (type == "BN") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
34 return "WEAK_BN"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
35 else if (type == "EN") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
36 return "WEAK_EN"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
37 else if (type == "ET") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
38 return "WEAK_ET"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
39 else if (type == "AN") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
40 return "WEAK_AN"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
41 else if (type == "WS") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
42 return "NEUTRAL_WS"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
43 else if (type == "CS") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
44 return "WEAK_CS"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
45 else if (type == "ES") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
46 return "WEAK_ES"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
47 else if (type == "B") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
48 return "NEUTRAL_B"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
49 else if (type == "S") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
50 return "NEUTRAL_S"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
51 else if (type == "LRE" || type == "RLE" || type == "LRO" || type == "RLO" || type == "PDF") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
52 return type; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
53 else if (type == "L") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
54 return "STRONG_L"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
55 else |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
56 { |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
57 printf "Unknown type: %s\n", type > "/dev/stderr"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
58 exit 1; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
59 } |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
60 } |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
61 |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
62 BEGIN { |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
63 otype = ""; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
64 startcode = ""; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
65 endcode = ""; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
66 printf " struct {\n int from, to;\n bidi_type_t type;\n } bidi_type[] = {\n"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
67 first = 1; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
68 } |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
69 |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
70 { code = $1; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
71 ntype = $5; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
72 if (ntype != otype) |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
73 { |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
74 # Don't output data for L, as that's the default value, see bidi.c. |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
75 if (otype != "L" && startcode != "") |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
76 { |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
77 if (!first) |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
78 printf ",\n"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
79 else |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
80 first = 0; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
81 printf "\t{ 0x%s, 0x%s, %s }", startcode, endcode, trtype(otype); |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
82 } |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
83 otype = ntype; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
84 startcode = code; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
85 endcode = code; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
86 } |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
87 else |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
88 endcode = code; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
89 } |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
90 |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
91 END { |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
92 printf " };\n"; |
7e588bac2220
Use BidiMirroring.txt for mirroring characters in bidi context.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
93 } |