3 # awk script to convert a bdf file to C declarations in a form specialized
4 # for the mouse cursors in syscons/scvgarndr.c. Usage:
5 # awk -f thisfile < file.bdf < file.c
6 # The accompanying syscons mouse cursor bdf file has specialized comments
7 # which this script converts to details in the C declarations.
8 # This is not a general conversion utility, but produces reasonable output
9 # if the input is for a monospaced font of size between 9x16 and 16x16.
11 /^COMMENT cn.*mouse/ {
14 n = substr($3, 1, i - 1)
19 width[n] = substr($4, i + 1, j - i - 1)
20 height[n] = substr($4, j + 1, k - j - 1)
24 state == 0 && /^STARTCHAR/ {
26 printf("static const struct mousedata %s = { {\n\t", name[n])
29 state >= 1 && state < 7 || state >= 7 + 16 && state < 7 + 16 + 7 {
33 state >= 7 && state < 7 + 16 || state >= 7 + 16 + 7 && state < 7 + 16 + 7 +16 {
35 if (state == 7 + 7 || state == 7 + 16 + 7 + 7)
37 else if (state == 7 + 15)
39 else if (state == 7 + 16 + 7 + 15) {
40 printf(" },\n\t%s, %s, %s, %s, \"%s\",",
41 width[n], height[n], baspect[n], iaspect[n], name[n])