File: NAME.awk

package info (click to toggle)
m17n-db 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,828 kB
  • sloc: sh: 4,445; awk: 732; makefile: 243; cs: 181; sed: 16
file content (46 lines) | stat: -rw-r--r-- 722 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
BEGIN {
  FS = ";";
  from = -1;
  name = "";
}

# For these lines:
#   3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
#   4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
/, First>/ {
  from = $1; 
  split ($2, a, "[<,]");
  getline;
  print "0x"from"-0x"$1, a[2];
  from = -1;
  next;
}

# For succeeding same names.
/CJK COMPATIBILITY IDEOGRAPH|<control>/ {
  if (from < 0)
    {
      from = $1;
      if ($2 ~ "CJK")
	name = "CJK COMPATIBILITY IDEOGRAPH";
      else
	name = "control";
    }
  to = $1;
  next;
}

# For normal names.
{
  if (from >= 0)
    {
      print "0x"from"-0x"to, name;
      from = -1;
    }
  print "0x"$1, $2;
}

END {
  if (from >= 0)
    print "0x"from"-0x"to, name;
}