1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/source3/script/gap.awk
Alexander Bokovoy e83031c84d Refactor charset plugins a bit and add CP437 module.
Now all 8-bit charsets with gaps (not all symbols defined) could be produced through
one macro -- SMB_GENERATE_CHARSET_MODULE_8_BIT_GAP(CHARSETNAME) within source file
with three charset tables. Full source code for such modules can be generated by
source/script/gen-8bit-gap.sh script which was taken from GNU libc and changed slightly
to follow our data types and structure.
(This used to be commit 37042c7bc0)
2003-08-28 17:16:27 +00:00

40 lines
777 B
Awk

BEGIN { hv["0"] = 0; hv["1"] = 1; hv["2"] = 2; hv["3"] = 3;
hv["4"] = 4; hv["5"] = 5; hv["6"] = 6; hv["7"] = 7;
hv["8"] = 8; hv["9"] = 9; hv["A"] = 10; hv["B"] = 11;
hv["C"] = 12; hv["D"] = 13; hv["E"] = 14; hv["F"] = 15;
hv["a"] = 10; hv["b"] = 11; hv["c"] = 12; hv["d"] = 13;
hv["e"] = 14; hv["f"] = 15;
first = 0; last = 0; idx = 0;
}
function tonum(str)
{
num=0;
cnt=1;
while (cnt <= length(str)) {
num *= 16;
num += hv[substr(str,cnt,1)];
++cnt;
}
return num;
}
{
u = tonum($1);
if (u - last > 6)
{
if (last)
{
printf (" { 0x%04x, 0x%04x, %5d },\n",
first, last, idx);
idx -= u - last - 1;
}
first = u;
}
last = u;
}
END { printf (" { 0x%04x, 0x%04x, %5d },\n",
first, last, idx); }