OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 Google Inc. All rights reserved. | 2 # Copyright (c) 2011 Google Inc. All rights reserved. |
3 # Copyright (c) 2012 Intel Corporation. All rights reserved. | 3 # Copyright (c) 2012 Intel Corporation. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 return value_ref | 1766 return value_ref |
1767 | 1767 |
1768 class Generator: | 1768 class Generator: |
1769 frontend_class_field_lines = [] | 1769 frontend_class_field_lines = [] |
1770 frontend_domain_class_lines = [] | 1770 frontend_domain_class_lines = [] |
1771 | 1771 |
1772 method_name_enum_list = [] | 1772 method_name_enum_list = [] |
1773 backend_method_declaration_list = [] | 1773 backend_method_declaration_list = [] |
1774 backend_method_implementation_list = [] | 1774 backend_method_implementation_list = [] |
1775 backend_method_name_declaration_list = [] | 1775 backend_method_name_declaration_list = [] |
| 1776 backend_method_name_declaration_index_list = [] |
| 1777 backend_method_name_declaration_current_index = 0 |
1776 method_handler_list = [] | 1778 method_handler_list = [] |
1777 frontend_method_list = [] | 1779 frontend_method_list = [] |
1778 | 1780 |
1779 backend_virtual_setters_list = [] | 1781 backend_virtual_setters_list = [] |
1780 backend_agent_interface_list = [] | 1782 backend_agent_interface_list = [] |
1781 backend_setters_list = [] | 1783 backend_setters_list = [] |
1782 backend_constructor_init_list = [] | 1784 backend_constructor_init_list = [] |
1783 backend_field_list = [] | 1785 backend_field_list = [] |
1784 frontend_constructor_init_list = [] | 1786 frontend_constructor_init_list = [] |
1785 type_builder_fragments = [] | 1787 type_builder_fragments = [] |
1786 type_builder_forwards = [] | 1788 type_builder_forwards = [] |
1787 validator_impl_list = [] | 1789 validator_impl_list = [] |
1788 type_builder_impl_list = [] | 1790 type_builder_impl_list = [] |
1789 | 1791 |
1790 | 1792 |
1791 @staticmethod | 1793 @staticmethod |
1792 def go(): | 1794 def go(): |
1793 Generator.process_types(type_map) | 1795 Generator.process_types(type_map) |
1794 | 1796 |
1795 first_cycle_guardable_list_list = [ | 1797 first_cycle_guardable_list_list = [ |
1796 Generator.backend_method_declaration_list, | 1798 Generator.backend_method_declaration_list, |
1797 Generator.backend_method_implementation_list, | 1799 Generator.backend_method_implementation_list, |
1798 Generator.backend_method_name_declaration_list, | 1800 Generator.backend_method_name_declaration_list, |
| 1801 Generator.backend_method_name_declaration_index_list, |
1799 Generator.backend_agent_interface_list, | 1802 Generator.backend_agent_interface_list, |
1800 Generator.frontend_class_field_lines, | 1803 Generator.frontend_class_field_lines, |
1801 Generator.frontend_constructor_init_list, | 1804 Generator.frontend_constructor_init_list, |
1802 Generator.frontend_domain_class_lines, | 1805 Generator.frontend_domain_class_lines, |
1803 Generator.frontend_method_list, | 1806 Generator.frontend_method_list, |
1804 Generator.method_handler_list, | 1807 Generator.method_handler_list, |
1805 Generator.method_name_enum_list, | 1808 Generator.method_name_enum_list, |
1806 Generator.backend_constructor_init_list, | 1809 Generator.backend_constructor_init_list, |
1807 Generator.backend_virtual_setters_list, | 1810 Generator.backend_virtual_setters_list, |
1808 Generator.backend_setters_list, | 1811 Generator.backend_setters_list, |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 Generator.backend_method_implementation_list.append(Templates.backend_me
thod.substitute(None, | 2059 Generator.backend_method_implementation_list.append(Templates.backend_me
thod.substitute(None, |
2057 domainName=domain_name, methodName=json_command_name, | 2060 domainName=domain_name, methodName=json_command_name, |
2058 agentField="m_" + agent_field_name, | 2061 agentField="m_" + agent_field_name, |
2059 methodInCode=method_in_code, | 2062 methodInCode=method_in_code, |
2060 methodOutCode=method_out_code, | 2063 methodOutCode=method_out_code, |
2061 agentCallParams="".join(agent_call_param_list), | 2064 agentCallParams="".join(agent_call_param_list), |
2062 requestMessageObject=request_message_param, | 2065 requestMessageObject=request_message_param, |
2063 responseCook=normal_response_cook_text, | 2066 responseCook=normal_response_cook_text, |
2064 errorCook=error_response_cook_text, | 2067 errorCook=error_response_cook_text, |
2065 commandNameIndex=cmd_enum_name)) | 2068 commandNameIndex=cmd_enum_name)) |
2066 Generator.backend_method_name_declaration_list.append(" \"%s.%s\"," %
(domain_name, json_command_name)) | 2069 declaration_command_name = "%s.%s\\0" % (domain_name, json_command_name) |
| 2070 Generator.backend_method_name_declaration_list.append(" \"%s\"" % dec
laration_command_name) |
| 2071 Generator.backend_method_name_declaration_index_list.append(" %d," %
Generator.backend_method_name_declaration_current_index) |
| 2072 Generator.backend_method_name_declaration_current_index += len(declarati
on_command_name) - 1 |
2067 | 2073 |
2068 Generator.backend_agent_interface_list.append(") = 0;\n") | 2074 Generator.backend_agent_interface_list.append(") = 0;\n") |
2069 | 2075 |
2070 class CallbackMethodStructTemplate: | 2076 class CallbackMethodStructTemplate: |
2071 @staticmethod | 2077 @staticmethod |
2072 def append_prolog(line_list): | 2078 def append_prolog(line_list): |
2073 pass | 2079 pass |
2074 | 2080 |
2075 @staticmethod | 2081 @staticmethod |
2076 def append_epilog(line_list): | 2082 def append_epilog(line_list): |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2300 backend_h_file.write(Templates.backend_h.substitute(None, | 2306 backend_h_file.write(Templates.backend_h.substitute(None, |
2301 virtualSetters="\n".join(Generator.backend_virtual_setters_list), | 2307 virtualSetters="\n".join(Generator.backend_virtual_setters_list), |
2302 agentInterfaces="".join(flatten_list(Generator.backend_agent_interface_list)
), | 2308 agentInterfaces="".join(flatten_list(Generator.backend_agent_interface_list)
), |
2303 methodNamesEnumContent="\n".join(Generator.method_name_enum_list))) | 2309 methodNamesEnumContent="\n".join(Generator.method_name_enum_list))) |
2304 | 2310 |
2305 backend_cpp_file.write(Templates.backend_cpp.substitute(None, | 2311 backend_cpp_file.write(Templates.backend_cpp.substitute(None, |
2306 constructorInit="\n".join(Generator.backend_constructor_init_list), | 2312 constructorInit="\n".join(Generator.backend_constructor_init_list), |
2307 setters="\n".join(Generator.backend_setters_list), | 2313 setters="\n".join(Generator.backend_setters_list), |
2308 fieldDeclarations="\n".join(Generator.backend_field_list), | 2314 fieldDeclarations="\n".join(Generator.backend_field_list), |
2309 methodNameDeclarations="\n".join(Generator.backend_method_name_declaration_l
ist), | 2315 methodNameDeclarations="\n".join(Generator.backend_method_name_declaration_l
ist), |
| 2316 methodNameDeclarationsIndex="\n".join(Generator.backend_method_name_declarat
ion_index_list), |
2310 methods="\n".join(Generator.backend_method_implementation_list), | 2317 methods="\n".join(Generator.backend_method_implementation_list), |
2311 methodDeclarations="\n".join(Generator.backend_method_declaration_list), | 2318 methodDeclarations="\n".join(Generator.backend_method_declaration_list), |
2312 messageHandlers="\n".join(Generator.method_handler_list))) | 2319 messageHandlers="\n".join(Generator.method_handler_list))) |
2313 | 2320 |
2314 frontend_h_file.write(Templates.frontend_h.substitute(None, | 2321 frontend_h_file.write(Templates.frontend_h.substitute(None, |
2315 fieldDeclarations="".join(Generator.frontend_class_field_lines), | 2322 fieldDeclarations="".join(Generator.frontend_class_field_lines), |
2316 domainClassList="".join(Generator.frontend_domain_class_lines))) | 2323 domainClassList="".join(Generator.frontend_domain_class_lines))) |
2317 | 2324 |
2318 frontend_cpp_file.write(Templates.frontend_cpp.substitute(None, | 2325 frontend_cpp_file.write(Templates.frontend_cpp.substitute(None, |
2319 constructorInit="".join(Generator.frontend_constructor_init_list), | 2326 constructorInit="".join(Generator.frontend_constructor_init_list), |
(...skipping 11 matching lines...) Expand all Loading... |
2331 validatorIfdefName=VALIDATOR_IFDEF_NAME)) | 2338 validatorIfdefName=VALIDATOR_IFDEF_NAME)) |
2332 | 2339 |
2333 backend_h_file.close() | 2340 backend_h_file.close() |
2334 backend_cpp_file.close() | 2341 backend_cpp_file.close() |
2335 | 2342 |
2336 frontend_h_file.close() | 2343 frontend_h_file.close() |
2337 frontend_cpp_file.close() | 2344 frontend_cpp_file.close() |
2338 | 2345 |
2339 typebuilder_h_file.close() | 2346 typebuilder_h_file.close() |
2340 typebuilder_cpp_file.close() | 2347 typebuilder_cpp_file.close() |
OLD | NEW |