diff options
author | Bert Münnich <ber.t@posteo.de> | 2014-01-15 22:40:34 +0100 |
---|---|---|
committer | Bert Münnich <ber.t@posteo.de> | 2014-01-15 22:40:34 +0100 |
commit | 135c4f9263c232456191a67d2e376c76813947c5 (patch) | |
tree | f93fd250c9ed1cf9456530d1ecc257ebcdc7a55c /icon/dat2h.awk | |
parent | 03b1d7cf7a1c1e859674ca6f69999e14b9346eac (diff) |
Added window icons; fixes issue #125
Diffstat (limited to 'icon/dat2h.awk')
-rw-r--r-- | icon/dat2h.awk | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/icon/dat2h.awk b/icon/dat2h.awk new file mode 100644 index 0000000..cd6f362 --- /dev/null +++ b/icon/dat2h.awk @@ -0,0 +1,35 @@ +#!/usr/bin/awk -f + +function printchars() { + while (n > 0) { + x = n / 16 >= 1 ? 16 : n; + printf("0x%x%x,%s", x - 1, ref[c] - 1, ++i % 12 == 0 ? "\n" : " "); + n -= x; + } +} + +/^$/ { + printchars(); + printf("\n\n"); + c = ""; + i = 0; +} + +/./ { + if (!ref[$0]) { + col[cnt++] = $0; + ref[$0] = cnt; + } + if ($0 != c) { + if (c != "") + printchars(); + c = $0; + n = 0; + } + n++; +} + +END { + for (i = 0; i < cnt; i++) + printf("%s,%s", col[i], ++j % 4 == 0 || i + 1 == cnt ? "\n" : " "); +} |