Insert \ before # for auto-indent.
[m17n/m17n-db.git] / CASE-MAPPING.awk
1 # CASE-MAPPING.awk -- awk script to generate CASE-MAPPING.tab
2 # Copyright (C) 2005
3 #   National Institute of Advanced Industrial Science and Technology (AIST)
4 #   Registration Number H15PRO112
5
6 # This file is part of the m17n database; a sub-part of the m17n
7 # library.
8
9 # The m17n library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1 of
12 # the License, or (at your option) any later version.
13
14 # The m17n library 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 GNU
17 # Lesser General Public License for more details.
18
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with the m17n library; if not, write to the Free
21 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 # 02111-1307, USA.
23
24 BEGIN {
25   FS = ";";
26   FILE = 1;
27 }
28
29 function mtext (str) {
30   if (n = split (str, A, " "))
31     {
32       printf ("\"");
33       for (i = 1; i <= n; i++)
34         printf ("\\u%s", A[i]);
35       printf ("\"");
36     }
37   else
38     printf ("\"\\u%s\"", str);
39   printf (" ");
40 }
41
42 FILE == 1 && /^[^\#]/ && NF == 5 {
43   printf ("0x%s ( ", $1);
44   mtext ($2);
45   mtext ($3);
46   mtext ($4);
47   printf (")\n");
48   X[$1] = 1;
49   next;
50 }
51
52 /^0000;/ {
53   FILE = 2;
54 }
55
56 FILE == 2 && /^[^\#]/ && ($13 || $14 || $15) && ! X[$1] {
57   if (! $13) $13 = $1;
58   if (! $14) $14 = $1;
59   if (! $15) $15 = $1;
60   printf ("0x%s ( \"\\u%s\" \"\\u%s\" \"\\u%s\" )\n",
61           $1, $14, $15, $13);
62 }