src/gen_err_codes.pl
raw| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | $err_name = ""; |
| 4 | |
| 5 | $num = 0; |
| 6 | |
| 7 | print STDOUT qq (/* |
| 8 | * Automatically generated file. Don't edit. |
| 9 | */ |
| 10 | |
| 11 | typedef enum canl_error {); |
| 12 | |
| 13 | while (<STDIN>) { |
| 14 | chomp; |
| 15 | next if /^\s*#/; |
| 16 | printf ("\n CANL_ERR_%s%s,", |
| 17 | $_, |
| 18 | (!$num++) ? " = 1024" : ""); |
| 19 | } |
| 20 | |
| 21 | print STDOUT qq ( |
| 22 | } canl_error; |
| 23 | ); |