#!/bin/sh gofmt < $hex, ident => $ident, comment => $comment }; $nametokeysym{$name} = $ident; # All but the first name listed should be considered deprecated. $keysymtoname{$ident} = $name unless exists $seen{$hex}; $seen{$hex}++; END { print "const ("; print "$_->{ident} = 0x$_->{hex} // $_->{comment}" for @a; print ")"; # Very large tables, should be an on-demand package :( print "// KeysymToName maps X11 keysym constants to their names"; print "var KeysymToName = map[xproto.Keysym]string{"; print "$_: \"$keysymtoname{$_}\"," for sort keys %keysymtoname; print "}"; print "// NameToKeysym maps X11 keysym names to their constants"; print "var NameToKeysym = map[string]xproto.Keysym{"; print "\"$_\": $nametokeysym{$_}," for sort keys %nametokeysym; print "}"; } ') EOF