Archived
1
0

Adding convenience capability function declarations.

- This makes it easier to define capabilties in any C file
This commit is contained in:
Jacob Alexander 2015-08-18 01:09:52 -07:00
parent 5f8880d7ef
commit 296fc5946c
2 changed files with 6 additions and 0 deletions

View File

@ -129,6 +129,7 @@ class Backend( BackendBase ):
## Capabilities ## ## Capabilities ##
self.fill_dict['CapabilitiesFuncDecl'] = ""
self.fill_dict['CapabilitiesList'] = "const Capability CapabilitiesList[] = {\n" self.fill_dict['CapabilitiesList'] = "const Capability CapabilitiesList[] = {\n"
# Keys are pre-sorted # Keys are pre-sorted
@ -136,6 +137,7 @@ class Backend( BackendBase ):
funcName = capabilities.funcName( key ) funcName = capabilities.funcName( key )
argByteWidth = capabilities.totalArgBytes( key ) argByteWidth = capabilities.totalArgBytes( key )
self.fill_dict['CapabilitiesList'] += "\t{{ {0}, {1} }},\n".format( funcName, argByteWidth ) self.fill_dict['CapabilitiesList'] += "\t{{ {0}, {1} }},\n".format( funcName, argByteWidth )
self.fill_dict['CapabilitiesFuncDecl'] += "void {0}( uint8_t state, uint8_t stateType, uint8_t *args );\n".format( funcName )
self.fill_dict['CapabilitiesList'] += "};" self.fill_dict['CapabilitiesList'] += "};"

View File

@ -28,6 +28,10 @@
// ----- Capabilities ----- // ----- Capabilities -----
// Capability function declarations
<|CapabilitiesFuncDecl|>
// Indexed Capabilities Table // Indexed Capabilities Table
<|CapabilitiesList|> <|CapabilitiesList|>