summaryrefslogtreecommitdiff
path: root/nls/convert.awk
blob: e10f0b577bfa006d10bcc8a9c81a384607e3adae (plain)
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
/^\$set/ {
  major++
  minor = 0

  if (major > 1)
    printf "\n" > output
  else if (codeset)
    printf "$ codeset=%s\n", codeset > output
  printf "$set %d %s\n", major, $3 >> output

  if (header) {
    majorName = substr($3, 2)
    if (major > 1)
      printf "\n" > header
    printf "\t%sSet = %#x,\n", majorName, major >> header
  }
}

/^\$ #/ {
  minor++

  if (header) {
    minorName = substr($2, 2)
    printf "\t%s%s = %#x,\n", majorName, minorName, minor >> header
  }
}

/^#/ {
  text = substr($0, 3)  
  printf "%d %s\n", minor, text > output
}
  
! /^(\$|#)/ { print > output }