chiark / gitweb /
include crossing A5/A6
[trains.git] / hostside / errorcodes.h.gen
1 #!/usr/bin/perl
2
3 @f= qw(
4        OK
5        Invalid
6        Safety
7        MovFeatTooLate
8        MovFeatKindsCombination
9        BufferFull
10        );
11
12
13     
14 $decl= "const char *const errorcodelist[]";
15
16 print <<END
17 typedef enum {
18 END
19     ."  ".(join ",\n  ", map {
20         $f=$_; $f =~ s/\-//g; "EC_$f";
21     } @f).<<END
22
23 } ErrorCode;
24
25 extern $decl;
26 #define DEFINE_ERRORCODELIST_DATA \\
27 $decl= { \\
28 END
29     ."  ".(join ", \\\n  ", map {
30         '"'.(lc).'"';
31     } @f).<<END
32  \\
33 };
34 END
35     or die $!;