Rev 950 | Rev 1046 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 950 | Rev 965 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | 38 | ||
| 39 | open (MYFILE, '>' . $cfile); |
39 | open (MYFILE, '>' . $cfile); |
| 40 | 40 | ||
| 41 | print MYFILE "// Built on $now by $binaryname\n"; |
41 | print MYFILE "// Built on $now by $binaryname\n"; |
| 42 | print MYFILE "// DO NOT CHANGE MANUALLY\n\n"; |
42 | print MYFILE "// DO NOT CHANGE MANUALLY\n\n"; |
| - | 43 | ||
| - | 44 | ||
| - | 45 | print MYFILE "#ifndef MODULEID_H_\n"; |
|
| - | 46 | print MYFILE "#define MODULEID_H_\n\n"; |
|
| 43 | 47 | ||
| 44 | print MYFILE "//------------------ //\n"; |
48 | print MYFILE "//------------------ //\n"; |
| 45 | print MYFILE "// Class definitions //\n"; |
49 | print MYFILE "// Class definitions //\n"; |
| 46 | print MYFILE "//------------------ //\n"; |
50 | print MYFILE "//------------------ //\n"; |
| 47 | print MYFILE "\n"; |
51 | print MYFILE "\n"; |
| 48 | 52 | ||
| 49 | foreach my $class ($root->first_child('classes')->children('class')) |
53 | foreach my $class ($root->first_child('classes')->children('class')) |
| 50 | { |
54 | { |
| 51 | my $className = $class->att('name'); |
55 | my $className = $class->att('name'); |
| 52 | $className =~ tr/a-z/A-Z/; |
56 | $className =~ tr/a-z/A-Z/; |
| 53 | print MYFILE "#define CAN_MODULE_CLASS_$className " . $class->att('id') . "\n"; |
57 | print MYFILE "#define CAN_MODULE_CLASS_$className " . $class->att('id') . "\n"; |
| 54 | } |
58 | } |
| 55 | 59 | ||
| 56 | print MYFILE "\n"; |
60 | print MYFILE "\n"; |
| 57 | print MYFILE "//-------------------- //\n"; |
61 | print MYFILE "//-------------------- //\n"; |
| 58 | print MYFILE "// Command definitions //\n"; |
62 | print MYFILE "// Command definitions //\n"; |
| 59 | print MYFILE "//-------------------- //\n"; |
63 | print MYFILE "//-------------------- //\n"; |
| 60 | print MYFILE "\n"; |
64 | print MYFILE "\n"; |
| 61 | 65 | ||
| 62 | foreach my $command ($root->first_child('commands')->children('command')) |
66 | foreach my $command ($root->first_child('commands')->children('command')) |
| 63 | { |
67 | { |
| 64 | my $commandName = $command->att('name'); |
68 | my $commandName = $command->att('name'); |
| 65 | $commandName =~ tr/a-z/A-Z/; |
69 | $commandName =~ tr/a-z/A-Z/; |
| 66 | my $commandType = $command->att('type'); |
70 | my $commandType = $command->att('type'); |
| 67 | $commandType =~ tr/a-z/A-Z/; |
71 | $commandType =~ tr/a-z/A-Z/; |
| 68 | 72 | ||
| 69 | if ($commandType eq "SPECIFIC") |
73 | if ($commandType eq "SPECIFIC") |
| 70 | { |
74 | { |
| 71 | $commandType = $command->att('module'); |
75 | $commandType = $command->att('module'); |
| 72 | $commandType =~ tr/a-z/A-Z/; |
76 | $commandType =~ tr/a-z/A-Z/; |
| 73 | } |
77 | } |
| 74 | 78 | ||
| 75 | print MYFILE "#define CAN_MODULE_CMD_" . $commandType . "_" . $commandName . " " . $command->att('id') . "\n"; |
79 | print MYFILE "#define CAN_MODULE_CMD_" . $commandType . "_" . $commandName . " " . $command->att('id') . "\n"; |
| 76 | } |
80 | } |
| 77 | 81 | ||
| 78 | print MYFILE "\n"; |
82 | print MYFILE "\n"; |
| 79 | print MYFILE "//------------------- //\n"; |
83 | print MYFILE "//------------------- //\n"; |
| 80 | print MYFILE "// Module definitions //\n"; |
84 | print MYFILE "// Module definitions //\n"; |
| 81 | print MYFILE "//------------------- //\n"; |
85 | print MYFILE "//------------------- //\n"; |
| 82 | print MYFILE "\n"; |
86 | print MYFILE "\n"; |
| 83 | 87 | ||
| Line 104... | Line 108... | ||
| 104 | $defineName =~ tr/a-z/A-Z/; |
108 | $defineName =~ tr/a-z/A-Z/; |
| 105 | print MYFILE "#define " . $groupName . "_" . $defineName . " " . $define->att('id') . "\n"; |
109 | print MYFILE "#define " . $groupName . "_" . $defineName . " " . $define->att('id') . "\n"; |
| 106 | } |
110 | } |
| 107 | 111 | ||
| 108 | print MYFILE "\n"; |
112 | print MYFILE "\n"; |
| - | 113 | ||
| - | 114 | print MYFILE "#endif /*MODULEID_H_*/\n"; |
|
| 109 | 115 | ||
| 110 | close (MYFILE); |
116 | close (MYFILE); |
| 111 | 117 | ||
| 112 | print "Successfully wrote " . $cfile . "\n"; |
118 | print "Successfully wrote " . $cfile . "\n"; |
| 113 | - | ||