1BEGIN { hv["0"] =  0; hv["1"] =  1; hv["2"] =  2; hv["3"] =  3;
2	hv["4"] =  4; hv["5"] =  5; hv["6"] =  6; hv["7"] =  7;
3	hv["8"] =  8; hv["9"] =  9; hv["A"] = 10; hv["B"] = 11;
4	hv["C"] = 12; hv["D"] = 13; hv["E"] = 14; hv["F"] = 15;
5	hv["a"] = 10; hv["b"] = 11; hv["c"] = 12; hv["d"] = 13;
6	hv["e"] = 14; hv["f"] = 15;
7
8	first = 0; last = 0; idx = 0;
9}
10
11function tonum(str)
12{
13  num=0;
14  cnt=1;
15  while (cnt <= length(str)) {
16    num *= 16;
17    num += hv[substr(str,cnt,1)];
18    ++cnt;
19  }
20  return num;
21}
22
23{
24  u = tonum($1);
25  if (u - last > 6)
26    {
27      if (last)
28	{
29	  printf ("  { .start = 0x%04x, .end = 0x%04x, .idx = %5d },\n",
30		  first, last, idx);
31	  idx -= u - last - 1;
32	}
33      first = u;
34    }
35  last = u;
36}
37
38END { printf ("  { .start = 0x%04x, .end = 0x%04x, .idx = %5d },\n",
39	      first, last, idx); }
40