Resolve ifdef todo

This commit is contained in:
zvecr 2022-10-02 00:53:05 +01:00
parent 309a08ff8f
commit 77a86b018a

View File

@ -107,9 +107,12 @@ def _append_routing_table_declaration(lines, container, container_id, route_stac
route_name = to_snake('_'.join([r['define'] for r in route_stack])) route_name = to_snake('_'.join([r['define'] for r in route_stack]))
condition = route_conditions(route_stack)
if condition:
lines.append(f'#if {condition}')
if 'routes' in container: if 'routes' in container:
pass pass
elif 'return_execute' in container: elif 'return_execute' in container:
execute = container['return_execute'] execute = container['return_execute']
lines.append(f'bool xap_respond_{execute}(xap_token_t token, const uint8_t *data, size_t data_len);') lines.append(f'bool xap_respond_{execute}(xap_token_t token, const uint8_t *data, size_t data_len);')
@ -165,6 +168,10 @@ def _append_routing_table_declaration(lines, container, container_id, route_stac
elif container['return_type'] == 'struct': elif container['return_type'] == 'struct':
pass pass
if condition:
lines.append(f'#endif // {condition}')
lines.append('')
route_stack.pop() route_stack.pop()
@ -404,10 +411,8 @@ def _append_lighting_mapping(lines, xap_defs):
lines.append(f'#ifdef {feature.upper()}_ENABLE') lines.append(f'#ifdef {feature.upper()}_ENABLE')
_append_lighting_map(lines, feature, spec) _append_lighting_map(lines, feature, spec)
lines.append(f'#endif //{feature.upper()}_ENABLE')
# TODO: should be inside ifdef but causes build issues
_append_lighting_bitmask(lines, feature, spec) _append_lighting_bitmask(lines, feature, spec)
lines.append(f'#endif //{feature.upper()}_ENABLE')
def generate_inline(output_file, keyboard, keymap): def generate_inline(output_file, keyboard, keymap):