(hsearch_r): Add back ensurance that hval is not zero.
[glibc/history.git] / iconvdata / gap.awk
blob6c5ef51a04df102d621dc9463f3b741bf359470b
1 BEGIN { 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;
8 first = 0; last = 0; idx = 0;
11 function tonum(str)
13 num=0;
14 cnt=1;
15 while (cnt <= length(str)) {
16 num *= 16;
17 num += hv[substr(str,cnt,1)];
18 ++cnt;
20 return num;
24 u = tonum($1);
25 if (u - last > 6)
27 if (last)
29 printf (" { .start = 0x%04x, .end = 0x%04x, .idx = %5d },\n",
30 first, last, idx);
31 idx -= u - last - 1;
33 first = u;
35 last = u;
38 END { printf (" { .start = 0x%04x, .end = 0x%04x, .idx = %5d },\n",
39 first, last, idx); }