blob: 7af3231b11bc71a800909647a42d70ad51f87450 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$Revision$';
print <<EOF
#include <stdio.h>
#include <stdbool.h>
#include "button.h"
struct button
{
char* name;
unsigned long value;
};
static struct button buttons[] = {
EOF
;
while(my $line = <STDIN>)
{
chomp($line);
if($line =~ /^#define (BUTTON_[^\s]+) (.+)$/)
{
printf "{\"%s\", %s},\n", $1, $2;
}
}
print <<EOF
{"BUTTON_REL", BUTTON_REL},
{"BUTTON_REPEAT", BUTTON_REPEAT},
{"BUTTON_TOUCHSCREEN", BUTTON_TOUCHSCREEN},
};
int main(void)
{
unsigned int i;
printf("-- Don't change this file!\\n");
printf("-- It is automatically generated of button.h \%s\\n", "$svnrev");
printf("rb.buttons = {\\n");
for(i=0; i<sizeof(buttons)/sizeof(struct button); i++)
printf("\\t\%s = \%ld,\\n", buttons[i].name, buttons[i].value);
printf("}\\n");
return 0;
}
EOF
;
|