Command generation
(self, cmdinfo, name, alias)
| 535 | self.appendSection('enum', body) |
| 536 | |
| 537 | def genCmd(self, cmdinfo, name, alias): |
| 538 | "Command generation" |
| 539 | OutputGenerator.genCmd(self, cmdinfo, name, alias) |
| 540 | |
| 541 | # if alias: |
| 542 | # prefix = '// ' + name + ' is an alias of command ' + alias + '\n' |
| 543 | # else: |
| 544 | # prefix = '' |
| 545 | if self.genOpts is None: |
| 546 | raise MissingGeneratorOptionsError() |
| 547 | |
| 548 | prefix = '' |
| 549 | decls = self.makeCDecls(cmdinfo.elem) |
| 550 | |
| 551 | # If the 'export' attribute is not set for this command, or does not |
| 552 | # match the export name selected during generation, wrap the command |
| 553 | # prototype in a C conditional which can be enabled to make the |
| 554 | # prototype not appear at compile time. |
| 555 | |
| 556 | export = cmdinfo.elem.get('export','') |
| 557 | protect_prefix = protect_suffix = '' |
| 558 | if export is None or self.genOpts.protectExportName not in export.split(','): |
| 559 | if self.genOpts.protectExportProtoStr is not None: |
| 560 | # Command is not exported, so should not be visible if |
| 561 | # suppressed by this symbol |
| 562 | protect_prefix = f'#ifndef {self.genOpts.protectExportProtoStr}\n' |
| 563 | protect_suffix = '\n#endif' |
| 564 | |
| 565 | decls[0] = protect_prefix + decls[0] + protect_suffix |
| 566 | |
| 567 | self.appendSection('command', f"{prefix + decls[0]}\n") |
| 568 | if self.genOpts.genFuncPointers: |
| 569 | self.appendSection('commandPointer', decls[1]) |
| 570 | |
| 571 | def misracstyle(self): |
| 572 | return self.genOpts.misracstyle |
nothing calls this directly
no test coverage detected