def _run(self): mgd_api_function_names, unstring_names = _unpack_mgd_api_functions( self.MGD_API_FUNCTIONS) all_mgd_functions = get_funcspecs( self.STUBMAIN.free_functions(in_set(mgd_api_function_names)), self.STUBMAIN.free_functions(prefixed('IC_')), self.STUBMAIN.variables(prefixed('IC_'))) all_mgd_functions = _unstring_mgd_api_functions( all_mgd_functions, unstring_names) method_infos = [] not_implemented = self.EXPORTED_FUNCTIONS - self.PURE_C_SYMBOLS for (name, spec) in sorted(all_mgd_functions): if name in not_implemented: not_implemented.remove(name) method_infos.append(self._generate_method_info(name, spec)) not_implemented_method_infos = _symbol_dicts(not_implemented) api_methods_code = glom_templates( '\n\n', (METHOD_TEMPLATE, method_infos), (METHOD_NOT_IMPL_TEMPLATE, not_implemented_method_infos), ) getaddress_cases_code = glom_templates( '\n', (GETADDRESS_CASE_TEMPLATE, method_infos), (GETADDRESS_CASE_NOT_IMPL_TEMPLATE, not_implemented_method_infos), ) mgd_data_infos = _symbol_dicts(self.MGD_API_DATA) data_properties_code = glom_templates( "\n\n", (DATA_PROPERTY_TEMPLATE, mgd_data_infos)) setdata_cases_code = glom_templates( "\n", (SETDATA_CASE_TEMPLATE, mgd_data_infos)) return PYTHONAPI_FILE_TEMPLATE % { 'api_methods': api_methods_code, 'getaddress_cases': getaddress_cases_code, 'data_properties': data_properties_code, 'setdata_cases': setdata_cases_code }
def _run(self): mgd_api_function_names, unstring_names = _unpack_mgd_api_functions(self.MGD_API_FUNCTIONS) all_mgd_functions = get_funcspecs( self.STUBMAIN.free_functions(in_set(mgd_api_function_names)), self.STUBMAIN.free_functions(prefixed('IC_')), self.STUBMAIN.variables(prefixed('IC_'))) all_mgd_functions = _unstring_mgd_api_functions(all_mgd_functions, unstring_names) method_infos = [] not_implemented = self.EXPORTED_FUNCTIONS - self.PURE_C_SYMBOLS for (name, spec) in sorted(all_mgd_functions): if name in not_implemented: not_implemented.remove(name) method_infos.append(self._generate_method_info(name, spec)) not_implemented_method_infos = _symbol_dicts(not_implemented) api_methods_code = glom_templates('\n\n', (METHOD_TEMPLATE, method_infos), (METHOD_NOT_IMPL_TEMPLATE, not_implemented_method_infos), ) getaddress_cases_code = glom_templates('\n', (GETADDRESS_CASE_TEMPLATE, method_infos), (GETADDRESS_CASE_NOT_IMPL_TEMPLATE, not_implemented_method_infos), ) mgd_data_infos = _symbol_dicts(self.MGD_API_DATA) data_properties_code = glom_templates("\n\n", (DATA_PROPERTY_TEMPLATE, mgd_data_infos)) setdata_cases_code = glom_templates("\n", (SETDATA_CASE_TEMPLATE, mgd_data_infos)) return PYTHONAPI_FILE_TEMPLATE % { 'api_methods': api_methods_code, 'getaddress_cases': getaddress_cases_code, 'data_properties': data_properties_code, 'setdata_cases': setdata_cases_code }
def generate_jumps(functions): jump_infos = map(_jump_info, enumerate(functions)) return JUMPS_FILE_TEMPLATE % glom_templates('\n', (JUMP_DECLARE_TEMPLATE, jump_infos), (JUMP_DEFINE_TEMPLATE, jump_infos))
def _generate_file(infos, item_template='%s', file_template=MAPPER_FILE_TEMPLATE, joiner='\n\n'): return file_template % glom_templates(joiner, (item_template, infos))
def generate_jumps(functions): jump_infos = map(_jump_info, enumerate(functions)) return JUMPS_FILE_TEMPLATE % glom_templates( '\n', (JUMP_DECLARE_TEMPLATE, jump_infos), (JUMP_DEFINE_TEMPLATE, jump_infos))