*** empty log message ***
[m17n/m17n-db.git] / CHARTAB.awk
1 # Copyright (C) 2003, 2004
2 #   National Institute of Advanced Industrial Science and Technology (AIST)
3 #   Registration Number H15PRO112
4
5 # This file is part of the m17n database; a sub-part of the m17n
6 # library.
7
8 # The m17n library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public License
10 # as published by the Free Software Foundation; either version 2.1 of
11 # the License, or (at your option) any later version.
12
13 # The m17n library 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 GNU
16 # Lesser General Public License for more details.
17
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with the m17n library; if not, write to the Free
20 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 # Boston, MA 02110-1301, USA.
22
23 BEGIN {
24   FS=";"
25   from = to = -1;
26 }
27
28 {
29   if (from < 0)
30     {
31       if (FIELD ~ "CATEGORY")
32         COLUMN = 3;
33       else if (FIELD ~ "COMBINE")
34         COLUMN = 4;
35       else
36         COLUMN = 5;
37       from = $1;
38       val = $COLUMN;
39     }
40   else if ($COLUMN != val)
41     {
42       if (from"" == to"")
43         print "0x"from, val;
44       else
45         print "0x"from"-0x"to, val;
46       from = $1;
47       val = $COLUMN;
48     }
49   to = $1;
50 }
51
52 END {
53   if (from >= 0)
54     {
55       if (from"" == to"")
56         print "0x"from, val;
57       else
58         print "0x"from"-0x"to, val;
59     }
60 }