Add additional hooks for Community modules (#25050)
This commit is contained in:
		
							parent
							
								
									bb9dd05c6a
								
							
						
					
					
						commit
						12caf0be4e
					
				
					 9 changed files with 137 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -76,6 +76,8 @@ def _render_api_implementations(api, module):
 | 
			
		|||
        lines.append(f'__attribute__((weak)) {api.ret_type} {api.name}_{module_name}_user({api.args}) {{')
 | 
			
		||||
        if api.ret_type == 'bool':
 | 
			
		||||
            lines.append('    return true;')
 | 
			
		||||
        elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
 | 
			
		||||
            lines.append(f'    return {api.call_params};')
 | 
			
		||||
        else:
 | 
			
		||||
            pass
 | 
			
		||||
        lines.append('}')
 | 
			
		||||
| 
						 | 
				
			
			@ -86,6 +88,8 @@ def _render_api_implementations(api, module):
 | 
			
		|||
        if api.ret_type == 'bool':
 | 
			
		||||
            lines.append(f'    if(!{api.name}_{module_name}_user({api.call_params})) {{ return false; }}')
 | 
			
		||||
            lines.append('    return true;')
 | 
			
		||||
        elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
 | 
			
		||||
            lines.append(f'    return {api.name}_{module_name}_user({api.call_params});')
 | 
			
		||||
        else:
 | 
			
		||||
            lines.append(f'    {api.name}_{module_name}_user({api.call_params});')
 | 
			
		||||
        lines.append('}')
 | 
			
		||||
| 
						 | 
				
			
			@ -96,6 +100,8 @@ def _render_api_implementations(api, module):
 | 
			
		|||
        if api.ret_type == 'bool':
 | 
			
		||||
            lines.append(f'    if(!{api.name}_{module_name}_kb({api.call_params})) {{ return false; }}')
 | 
			
		||||
            lines.append('    return true;')
 | 
			
		||||
        elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
 | 
			
		||||
            lines.append(f'    return {api.name}_{module_name}_kb({api.call_params});')
 | 
			
		||||
        else:
 | 
			
		||||
            lines.append(f'    {api.name}_{module_name}_kb({api.call_params});')
 | 
			
		||||
        lines.append('}')
 | 
			
		||||
| 
						 | 
				
			
			@ -113,10 +119,14 @@ def _render_core_implementation(api, modules):
 | 
			
		|||
            module_name = Path(module).name
 | 
			
		||||
            if api.ret_type == 'bool':
 | 
			
		||||
                lines.append(f'        && {api.name}_{module_name}({api.call_params})')
 | 
			
		||||
            elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
 | 
			
		||||
                lines.append(f'    {api.call_params} = {api.name}_{module_name}({api.call_params});')
 | 
			
		||||
            else:
 | 
			
		||||
                lines.append(f'    {api.name}_{module_name}({api.call_params});')
 | 
			
		||||
        if api.ret_type == 'bool':
 | 
			
		||||
            lines.append('    ;')
 | 
			
		||||
        elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
 | 
			
		||||
            lines.append(f'    return {api.call_params};')
 | 
			
		||||
        lines.append('}')
 | 
			
		||||
    return lines
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue