#!/usr/bin/perl ## ## vi:ts=4 ## ##---------------------------------------------------------------------------## ## Author: ## Markus F.X.J. Oberhumer markus.oberhumer@jk.uni-linz.ac.at ## Copyright: ## Copyright (C) 1995, 1996 Markus F.X.J. Oberhumer ## For conditions of distribution and use, see copyright notice in kb.h ## Description: ## create _kbname.hh from kb.h ##---------------------------------------------------------------------------## ($PROG = $0) =~ s%\\%/%g; $keys = 0; %name = (); # # read # $kb = shift || 'kb.h'; open(FILE,$kb) || die "$PROG: unable to open $kb: $!\n"; while () { ## # define KB_SCAN_ESC 1 next unless (/^\s*\#\s*define\s+KB_SCAN_(\w+)\s+(\w+)/); $n = $1; $c = $2; next if ($c =~ /^KB_SCAN_/); # an alias unless ($c =~ /^\d+$/) { die "$PROG: line $.: invalid scancode $c for $n\n"; } if (defined($name{$c})) { die "$PROG: line $.: duplicate entry $c -> $name{$c} $n\n"; } ## print STDERR "$PROG: $n $c\n"; $name{$c} = $n; $keys++; } close(FILE); print STDERR "$PROG: $keys key names found\n"; if ($keys == 0) { die "$PROG: no keys found !\n"; } # # write # binmode(STDOUT); # use unix end-of-line conventions print <