Home | History | Annotate | Download | only in generator

Lines Matching refs:out_file

308   def OutputForward(self, out_file, defined_types, typemap):
309 """Writes a typedef definition to |out_file|.
315 out_file: The output file.
320 self.Output(out_file, defined_types, typemap)
322 def Output(self, out_file, defined_types, typemap):
323 """Writes a typedef definition to |out_file|.
328 out_file: The output file.
337 typemap[self.old_type].OutputForward(out_file, defined_types, typemap)
338 out_file.write(self._TYPEDEF % {'old_type': self.old_type,
342 def OutputSerialize(self, out_file, serialized_types, typemap):
343 """Writes a serialize and parse function for the typedef to |out_file|.
346 out_file: The output file.
354 typemap[self.old_type].OutputSerialize(out_file, serialized_types,
356 out_file.write(self._SERIALIZE_FUNCTION % {'old': self.old_type,
358 out_file.write(self._PARSE_FUNCTION % {'old': self.old_type,
386 def Output(self, out_file, defined_types, typemap):
387 """Writes a constant definition to |out_file|.
392 out_file: The output file.
399 typemap[self.const_type].OutputForward(out_file, defined_types, typemap)
400 out_file.write(self._CONSTANT % {'type': self.const_type,
665 def OutputForward(self, out_file, unused_defined_types, unused_typemap):
666 """Writes a structure forward declaration to |out_file|.
672 out_file: The output file.
679 out_file.write(self._UNION_FORWARD % {'name': self.name})
681 out_file.write(self._STRUCTURE_FORWARD % {'name': self.name})
684 def Output(self, out_file, defined_types, typemap):
685 """Writes a structure definition to |out_file|.
690 out_file: The output file.
700 typemap[field_type].Output(out_file, defined_types, typemap)
703 typemap[required_type].Output(out_file, defined_types, typemap)
705 out_file.write(self._UNION % {'name': self.name})
707 out_file.write(self._STRUCTURE % {'name': self.name})
709 out_file.write(self._STRUCTURE_FIELD % {'type': field[0],
711 out_file.write(self._STRUCTURE_END)
714 def OutputSerialize(self, out_file, serialized_types, typemap):
715 """Writes serialize and parse functions for a structure to |out_file|.
718 out_file: The output file.
731 typemap[field_type].OutputSerialize(out_file, serialized_types, typemap)
733 self._OutputUnionSerialize(out_file)
736 out_file.write(self._SERIALIZE_FUNCTION_START % {'type': self.name})
740 out_file.write(self._SERIALIZE_COMPLEX_TPM2B % {'type': field_type,
745 self._OutputArrayField(out_file, field, self._SERIALIZE_FIELD_ARRAY)
747 self._OutputUnionField(out_file, field,
750 out_file.write(self._SERIALIZE_FIELD % {'type': field[0],
752 out_file.write(self._SERIALIZE_FUNCTION_END)
753 out_file.write(self._PARSE_FUNCTION_START % {'type': self.name})
756 self._OutputArrayField(out_file, field, self._PARSE_FIELD_ARRAY)
758 self._OutputUnionField(out_file, field, self._PARSE_FIELD_WITH_SELECTOR)
760 out_file.write(self._PARSE_FIELD % {'type': field[0],
762 out_file.write(self._SERIALIZE_FUNCTION_END)
766 out_file.write(self._SIMPLE_TPM2B_HELPERS % {'type': self.name,
771 out_file.write(self._COMPLEX_TPM2B_HELPERS % {'type': self.name,
776 def _OutputUnionSerialize(self, out_file):
777 """Writes serialize and parse functions for a union to |out_file|.
785 out_file: The output file
790 out_file.write(self._SERIALIZE_UNION_FUNCTION_START %
796 out_file.write(self._EMPTY_UNION_CASE % {'selector_value': selector})
803 out_file.write(self._SERIALIZE_UNION_FIELD_ARRAY %
809 out_file.write(self._SERIALIZE_UNION_FIELD %
813 out_file.write(self._SERIALIZE_FUNCTION_END)
814 out_file.write(self._PARSE_UNION_FUNCTION_START %
820 out_file.write(self._EMPTY_UNION_CASE % {'selector_value': selector})
827 out_file.write(self._PARSE_UNION_FIELD_ARRAY %
833 out_file.write(self._PARSE_UNION_FIELD %
837 out_file.write(self._SERIALIZE_FUNCTION_END)
839 def _OutputUnionField(self, out_file, field, code_format):
848 out_file: The output file.
860 out_file.write(code_format % {'type': field[0],
864 def _OutputArrayField(self, out_file, field, code_format):
872 out_file: The output file.
881 out_file.write(code_format % {'count': count_field[1],
907 def Output(self, out_file):
908 """Writes a preprocessor define to |out_file|.
911 out_file: The output file.
913 out_file.write(self._DEFINE % {'name': self.name, 'value': self.value})
1467 def OutputDeclarations(self, out_file):
1471 out_file: The output file.
1473 self._OutputCallbackSignature(out_file)
1474 self._OutputMethodSignatures(out_file)
1476 def OutputSerializeFunction(self, out_file):
1480 out_file: Generated code is written to this file.
1485 out_file.write(self._SERIALIZE_FUNCTION_START % {
1488 out_file.write(self._DECLARE_COMMAND_CODE % {'command_code':
1490 out_file.write(self._DECLARE_BOOLEAN % {
1493 out_file.write(self._DECLARE_BOOLEAN % {
1498 out_file.write(self._SERIALIZE_LOCAL_VAR % {'var_name': 'command_code',
1501 out_file.write(self._SERIALIZE_LOCAL_VAR % {'var_name': arg['name'],
1505 out_file.write(self._ENCRYPT_PARAMETER % {'var_name':
1508 out_file.write(self._HASH_START)
1509 out_file.write(self._HASH_UPDATE % {'var_name': 'command_code_bytes'})
1511 out_file.write(self._HASH_UPDATE % {'var_name':
1513 out_file.write(self._APPEND_COMMAND_HANDLE % {'var_name':
1516 out_file.write(self._HASH_UPDATE % {'var_name':
1518 out_file.write(self._APPEND_COMMAND_PARAMETER % {'var_name':
1521 out_file.write(self._AUTHORIZE_COMMAND)
1523 out_file.write(self._SERIALIZE_LOCAL_VAR %
1526 out_file.write(self._SERIALIZE_LOCAL_VAR % {'var_name': 'command_size',
1528 out_file.write(self._SERIALIZE_FUNCTION_END)
1530 def OutputParseFunction(self, out_file):
1534 out_file: Generated code is written to this file.
1536 out_file.write(self._RESPONSE_PARSER_START % {
1540 out_file.write(self._PARSE_LOCAL_VAR % {'var_name': 'tag',
1542 out_file.write(self._PARSE_LOCAL_VAR % {'var_name': 'response_size',
1544 out_file.write(self._PARSE_LOCAL_VAR % {'var_name': 'response_code',
1547 out_file.write(self._RESPONSE_ERROR_CHECK)
1552 out_file.write(self._PARSE_ARG_VAR % {'var_name': handle['name'],
1555 out_file.write(self._DECLARE_COMMAND_CODE % {'command_code':
1557 out_file.write(self._SERIALIZE_LOCAL_VAR % {'var_name': 'command_code',
1560 out_file.write(self._RESPONSE_SECTION_SPLIT)
1562 out_file.write(self._HASH_START)
1563 out_file.write(self._HASH_UPDATE % {'var_name': 'response_code_bytes'})
1564 out_file.write(self._HASH_UPDATE % {'var_name': 'command_code_bytes'})
1565 out_file.write(self._HASH_UPDATE % {'var_name': 'buffer'})
1567 out_file.write(self._AUTHORIZE_RESPONSE)
1570 out_file.write(self._PARSE_ARG_VAR % {'var_name': arg['name'],
1573 out_file.write(self._DECRYPT_PARAMETER % {'var_name':
1577 out_file.write(self._RESPONSE_PARSER_END)
1579 def OutputMethodImplementation(self, out_file):
1587 out_file: Generated code is written to this file.
1589 out_file.write(self._ASYNC_METHOD % {
1594 out_file.write(self._SYNC_METHOD % {
1602 def OutputErrorCallback(self, out_file):
1609 out_file: Generated code is written to this file.
1611 out_file.write(self._ERROR_CALLBACK_START % {'method_name':
1614 out_file.write(self._ERROR_CALLBACK_ARG % {'arg_type': arg['type']})
1615 out_file.write(self._ERROR_CALLBACK_END)
1617 def OutputResponseCallback(self, out_file):
1626 out_file: Generated code is written to this file.
1628 out_file.write(self._RESPONSE_CALLBACK_START % {'method_name':
1631 out_file.write(self._DECLARE_ARG_VAR % {'var_type': arg['type'],
1633 out_file.write(self._RESPONSE_CALLBACK_END % {
1649 def _OutputMethodSignatures(self, out_file):
1656 out_file: The output file.
1658 out_file.write(' static TPM_RC SerializeCommand_%s(%s);\n' % (
1660 out_file.write(' static TPM_RC ParseResponse_%s(%s);\n' % (
1662 out_file.write(' virtual void %s(%s);\n' % (self._MethodName(),
1664 out_file.write(' virtual TPM_RC %sSync(%s);\n' % (self._MethodName(),
1667 def _OutputCallbackSignature(self, out_file):
1671 out_file: The output file.
1677 out_file.write(' typedef base::Callback<void(%s)> %sResponse;\n' %
1949 def GenerateHandleCountFunctions(commands, out_file):
1954 out_file: The output file.
1956 out_file.write(_HANDLE_COUNT_FUNCTION_START % {'handle_type': 'Request'})
1958 out_file.write(_HANDLE_COUNT_FUNCTION_CASE %
1961 out_file.write(_HANDLE_COUNT_FUNCTION_END)
1962 out_file.write(_HANDLE_COUNT_FUNCTION_START % {'handle_type': 'Response'})
1964 out_file.write(_HANDLE_COUNT_FUNCTION_CASE %
1967 out_file.write(_HANDLE_COUNT_FUNCTION_END)
1981 out_file = open(_OUTPUT_FILE_H, 'w')
1982 out_file.write(_COPYRIGHT_HEADER)
1984 out_file.write(_HEADER_FILE_GUARD_HEADER % {'name': guard_name})
1985 out_file.write(_HEADER_FILE_INCLUDES)
1986 out_file.write(_NAMESPACE_BEGIN)
1987 out_file.write(_FORWARD_DECLARATIONS)
1988 out_file.write('\n')
1994 define.Output(out_file)
1995 out_file.write('\n')
2001 typedef.Output(out_file, defined_types, typemap)
2002 out_file.write('\n')
2006 constant.Output(out_file, defined_types, typemap)
2007 out_file.write('\n')
2010 struct.Output(out_file, defined_types, typemap)
2012 out_file.write(_FUNCTION_DECLARATIONS)
2015 out_file.write(_SERIALIZE_DECLARATION % {'type': basic_type})
2017 out_file.write(_SERIALIZE_DECLARATION % {'type': typedef.new_type})
2019 out_file.write(_SERIALIZE_DECLARATION % {'type': struct.name})
2021 out_file.write(_SIMPLE_TPM2B_HELPERS_DECLARATION % {'type': struct.name})
2023 out_file.write(_COMPLEX_TPM2B_HELPERS_DECLARATION % {
2028 out_file.write(_CLASS_BEGIN)
2030 command.OutputDeclarations(out_file)
2031 out_file.write(_CLASS_END)
2032 out_file.write(_NAMESPACE_END)
2033 out_file.write(_HEADER_FILE_GUARD_FOOTER % {'name': guard_name})
2034 out_file.close()
2046 out_file = open(_OUTPUT_FILE_CC, 'w')
2047 out_file.write(_COPYRIGHT_HEADER)
2048 out_file.write(_LOCAL_INCLUDE % {'filename': _OUTPUT_FILE_H})
2049 out_file.write(_IMPLEMENTATION_FILE_INCLUDES)
2050 out_file.write(_NAMESPACE_BEGIN)
2051 GenerateHandleCountFunctions(commands, out_file)
2054 out_file.write(_SERIALIZE_BASIC_TYPE % {'type': basic_type})
2056 typedef.OutputSerialize(out_file, serialized_types, typemap)
2058 struct.OutputSerialize(out_file, serialized_types, typemap)
2060 command.OutputSerializeFunction(out_file)
2061 command.OutputParseFunction(out_file)
2062 command.OutputErrorCallback(out_file)
2063 command.OutputResponseCallback(out_file)
2064 command.OutputMethodImplementation(out_file)
2065 out_file.write(_NAMESPACE_END)
2066 out_file.close()