@ -15,7 +15,7 @@ for my $line (@data) {
}
}
my @ keys = split ( /\s+/ , $ line ) ;
my @ keys = split ( /\s+/ , $ line ) ;
push @ map , join ( ', ' , map { ' Key_ '. lookup ( $ _ ) . '' } @ keys ) ;
push @ map , join ( ', ' , map { ' '. lookup ( $ _ ) . '' } @ keys ) ;
}
}
print "#define KEYMAP_$name { /* Generated keymap for $name */ " ;
print "#define KEYMAP_$name { /* Generated keymap for $name */ " ;
@ -27,23 +27,24 @@ print "},\n";
sub lookup {
sub lookup {
my % table = (
my % table = (
'{' = > ' LCurlyBracket',
'{' = > ' Key_ LCurlyBracket',
'}' = > ' RCurlyBracket',
'}' = > ' Key_ RCurlyBracket',
'[' = > ' LSquareBracket',
'[' = > ' Key_ LSquareBracket',
']' = > ' RSquareBracket',
']' = > ' Key_ RSquareBracket',
'|' = > ' Pipe',
'|' = > ' Key_ Pipe',
'\\' = > ' Backslash',
'\\' = > ' Key_ Backslash',
';' = > ' Semicolon',
';' = > ' Key_ Semicolon',
',' = > ' Comma',
',' = > ' Key_ Comma',
'.' = > ' Period',
'.' = > ' Key_ Period',
'/' = > ' Slash',
'/' = > ' Key_ Slash',
"'" = > ' Quote',
"'" = > ' Key_ Quote',
'`' = > ' Backtick',
'`' = > ' Key_ Backtick',
'-' = > ' Minus',
'-' = > ' Key_ Minus',
'=' = > ' Equals') ;
'=' = > ' Key_ Equals') ;
my $ x = shift ;
my $ x = shift ;
return $ x unless defined $ table { $ x } ;
return $ x if $ x =~ /\(.*\)/ ;
return 'Key_' . $ x unless defined $ table { $ x } ;
return $ table { $ x } ;
return $ table { $ x } ;
}
}