def outputGeneratedHeaderWarning(self): # File Comment generated_warning = '// *********** THIS FILE IS GENERATED - DO NOT EDIT ***********\n' generated_warning += '// See cpp_generator.py for modifications\n' generated_warning += '// ************************************************************\n' assert(self.createEnumValue("XR_TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFT", "XrStructureType") == "SpatialAnchorSpaceCreateInfoMSFT") assert(self.createEnumValue("XR_PERF_SETTINGS_SUB_DOMAIN_COMPOSITING_EXT", "XrPerfSettingsSubDomainEXT") == "Compositing") write(generated_warning, file=self.outFile)
def endFile(self): sorted_cmds = self.core_commands + self.ext_commands file_data = self.template.render( gen=self, registry=self.registry, null_instance_ok=VALID_FOR_NULL_INSTANCE, sorted_cmds=sorted_cmds) write(file_data, file=self.outFile) # Finish processing in superclass AutomaticSourceOutputGenerator.endFile(self)
def endFile(self): sorted_cmds = self.core_commands + self.ext_commands skip_hooks = set(self.no_trampoline_or_terminator).union( set(MANUALLY_DEFINED_IN_LAYER)) file_data = self.template.render(gen=self, registry=self.registry, sorted_cmds=sorted_cmds, skip_hooks=skip_hooks) write(file_data, file=self.outFile) # Finish processing in superclass AutomaticSourceOutputGenerator.endFile(self)
def outputGeneratedHeaderWarning(self): # File Comment generated_warning = '// *********** THIS FILE IS GENERATED - DO NOT EDIT ***********\n' generated_warning += '// See conformance_layer_generator.py for modifications\n' generated_warning += '// ************************************************************\n' write(generated_warning, file=self.outFile)
def endFile(self): sorted_cmds = self.core_commands + self.ext_commands self.dict_extensions = {} for ext in self.extensions: self.dict_extensions[ext.name] = ext self.dict_handles = {} for handle in self.api_handles: self.dict_handles[handle.name] = handle self.dict_enums = {} for enum in self.api_enums: self.dict_enums[enum.name] = enum if enum.name == 'XrResult': result_enum = enum self.dict_structs = {} for struct in self.api_structures: self.dict_structs[struct.name] = struct self.dict_bitmasks = {} for bitmask in self.api_bitmasks: self.dict_bitmasks[bitmask.name] = bitmask self.dict_atoms = {} for basetype in self.api_base_types: if basetype.type == "XR_DEFINE_ATOM": self.dict_atoms[basetype.name] = basetype self.projected_types = MANUALLY_PROJECTED.union( self.dict_handles.keys()) self.projected_types.update(self.dict_enums.keys()) self.projected_types.update(self.dict_structs.keys()) self.projected_types.update(self.dict_bitmasks.keys()) self.projected_types.update(self.dict_atoms.keys()) self.projected_types.difference_update(SKIP_PROJECTION) # Every type mentioned in some other type's parentstruct attribute. struct_parents = ((otherType, otherType.elem.get('parentstruct')) for otherType in self.registry.typedict.values()) self.struct_parents = { child.elem.get('name'): parent for child, parent in struct_parents if parent is not None } self.parents = set(self.struct_parents.values()) self.skip_projection = SKIP_PROJECTION def children_of(t): return set(child for child, parent in self.struct_parents.items() if parent == t) self.struct_children = { parent: children_of(parent) for parent in self.parents } def fields_of(t): struct = self.dict_structs[t] members = struct.members return set(field.name for field in members if not self._cpp_hidden_member(field)) self.struct_fields = { parent: fields_of(parent) for parent in self.parents if parent in self.dict_structs } basic_cmds = {} enhanced_cmds = {} enhanced_cmds_no_exceptions = {} unique_cmds = {} unique_cmds_no_exceptions = {} for cmd in sorted_cmds: basic = MethodProjection(cmd, self) self._basic_method_projection(basic) basic_cmds[cmd.name] = basic enhanced = MethodProjection(cmd, self) self._enhanced_method_projection(enhanced) enhanced_cmds[cmd.name] = enhanced if enhanced.explicit_result_elided: # Now try again to make one without exceptions. enhanced_noexcept = MethodProjection(cmd, self) enhanced_noexcept.exceptions_permitted = False self._enhanced_method_projection(enhanced_noexcept) enhanced_cmds_no_exceptions[cmd.name] = enhanced_noexcept if enhanced.is_create: unique = MethodProjection(cmd, self) self._unique_method_projection(unique) unique_cmds[cmd.name] = unique # Now try again to make one without exceptions, if unique.explicit_result_elided: # all creation calls can elide the result. unique_noexcept = MethodProjection(cmd, self) unique_noexcept.exceptions_permitted = False self._unique_method_projection(unique_noexcept) unique_cmds_no_exceptions[cmd.name] = unique_noexcept else: # assumption violated assert (False) # Verify self.selftests() file_data = self.template.render( gen=self, registry=self.registry, null_instance_ok=VALID_FOR_NULL_INSTANCE, sorted_cmds=sorted_cmds, create_enum_value=self.createEnumValue, create_flag_value=self.createFlagValue, project_type_name=_project_type_name, result_enum=result_enum, create_enum_exception=self.createEnumException, basic_cmds=basic_cmds, enhanced_cmds=enhanced_cmds, enhanced_cmds_no_exceptions=enhanced_cmds_no_exceptions, unique_cmds=unique_cmds, unique_cmds_no_exceptions=unique_cmds_no_exceptions, discouraged_begin=_discouraged_begin, discouraged_end=_discouraged_end, generate_structure_type_from_name=self.conventions. generate_structure_type_from_name, is_tagged_type=self._is_tagged_type, project_cppdecl=self._project_cppdecl, bitmask_for_flags=self._bitmask_for_flags, is_static_length_array=_is_static_length_array, is_static_length_string=_is_static_length_string, struct_parents=self.struct_parents, struct_children=self.struct_children, struct_fields=self.struct_fields, project_struct=(lambda s: StructProjection(s, self)), get_default_for_member=self._get_default_for_member, index0_of_first_visible_defaultable_member=self. _index0_of_first_visible_defaultable_member, manually_projected=MANUALLY_PROJECTED, skip=SKIP, ) write(file_data, file=self.outFile) # Finish processing in superclass AutomaticSourceOutputGenerator.endFile(self)
def endFile(self): sorted_cmds = self.core_commands + self.ext_commands self.dict_handles = {} for handle in self.api_handles: self.dict_handles[handle.name] = handle self.dict_enums = {} for enum in self.api_enums: self.dict_enums[enum.name] = enum if enum.name == 'XrResult': result_enum = enum self.dict_structs = {} for struct in self.api_structures: self.dict_structs[struct.name] = struct self.dict_bitmasks = {} for bitmask in self.api_bitmasks: self.dict_bitmasks[bitmask.name] = bitmask self.projected_types = MANUALLY_PROJECTED.union(self.dict_handles.keys()) self.projected_types.update(self.dict_enums.keys()) self.projected_types.update(self.dict_structs.keys()) self.projected_types.update(self.dict_bitmasks.keys()) # Every type mentioned in some other type's parentstruct attribute. struct_parents = ((otherType, otherType.elem.get('parentstruct')) for otherType in self.registry.typedict.values()) self.struct_parents = {child.elem.get('name'): parent for child, parent in struct_parents if parent is not None} self.parents = set(self.struct_parents.values()) def children_of(t): return set(child for child, parent in self.struct_parents.items() if parent == t) self.struct_children = {parent: children_of(parent) for parent in self.parents} def fields_of(t): struct = self.dict_structs[t] members = struct.members return set(field.name for field in members if not self._cpp_hidden_member(field)) self.struct_fields = {parent: fields_of(parent) for parent in self.parents} basic_cmds = {} enhanced_cmds = {} unique_cmds = {} for cmd in sorted_cmds: basic = MethodProjection(cmd, self) self._basic_method_projection(basic) basic_cmds[cmd.name] = basic enhanced = MethodProjection(cmd, self) self._enhanced_method_projection(enhanced) enhanced_cmds[cmd.name] = enhanced if enhanced.is_create: unique = MethodProjection(cmd, self) self._unique_method_projection(unique) unique_cmds[cmd.name] = unique file_data = self.template.render( gen=self, registry=self.registry, null_instance_ok=VALID_FOR_NULL_INSTANCE, sorted_cmds=sorted_cmds, create_enum_value=self.createEnumValue, create_flag_value=self.createFlagValue, project_type_name=_project_type_name, result_enum=result_enum, create_enum_exception=self.createEnumException, basic_cmds=basic_cmds, enhanced_cmds=enhanced_cmds, unique_cmds=unique_cmds, discouraged_begin=_discouraged_begin, discouraged_end=_discouraged_end, generate_structure_type_from_name=self.conventions.generate_structure_type_from_name, is_tagged_type=self._is_tagged_type, project_cppdecl=self._project_cppdecl, cpp_hidden_member=self._cpp_hidden_member, struct_member_count=self._struct_member_count, bitmask_for_flags=self._bitmask_for_flags, is_static_length_string=_is_static_length_string, parents=self.parents, struct_parents=self.struct_parents, struct_children=self.struct_children, struct_fields=self.struct_fields, get_tag=self._get_tag, is_base_only=self._is_base_only ) write(file_data, file=self.outFile) # Finish processing in superclass AutomaticSourceOutputGenerator.endFile(self)