Makefile: remove spurious tab
[xcsoar.git] / tools / xcs2cpp.pl
blobfd886698234c6a4cf9e0795e7b5d438128ba2959
1 #!/usr/bin/perl
3 use strict;
4 use warnings;
6 my %rec = ();
7 my $line = 0;
9 sub c_string($) {
10 my $value = shift;
11 return 'NULL' unless defined $value;
12 return qq|_T("$value")|;
15 sub c_bool($) {
16 my $value = shift;
17 return $value ? "true" : "false";
20 sub print_element($) {
21 my $value = shift;
22 print " $value,\n";
25 %rec = ();
26 while (<>) {
27 chomp;
28 $line++;
29 next if (/^#/);
30 s/\r//;
32 if (/^\s*$/) {
33 if ($rec{key}) {
34 print " {\n";
35 print_element(c_string($rec{key}));
36 print_element(c_string($rec{sound}));
37 print_element(c_bool(not $rec{hide} or $rec{hide} ne "yes"));
38 print_element($rec{delay}) if exists $rec{delay};
39 print " },\n",
41 %rec = ();
43 } elsif (/^([a-z0-9]+)\s*=\s*"*([^"]*)"*$/) {
44 $rec{$1} = $2;
45 } else {
46 die "Error on line $.\n";