MCPcopy
hub / github.com/KhronosGroup/Vulkan-Docs / endFile

Method endFile

scripts/pygenerator.py:45–94  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

43 self.writeDict(l, name, printValues = False)
44
45 def endFile(self):
46 # Creates the inverse mapping of nonexistent APIs to their aliases.
47 super().createInverseMap()
48
49 # Print out all the dictionaries as Python strings.
50 # Could just print(dict) but that is not human-readable
51 dicts = ( [ self.basetypes, 'basetypes' ],
52 [ self.consts, 'consts' ],
53 [ self.enums, 'enums' ],
54 [ self.flags, 'flags' ],
55 [ self.funcpointers, 'funcpointers' ],
56 [ self.protos, 'protos' ],
57 [ self.structs, 'structs' ],
58 [ self.handles, 'handles' ],
59 [ self.defines, 'defines' ],
60 [ self.typeCategory, 'typeCategory' ],
61 [ self.alias, 'alias' ],
62 [ self.nonexistent, 'nonexistent' ],
63 )
64
65 for (dict, name) in dicts:
66 self.writeDict(dict, name)
67
68 # Dictionary containing the relationships of a type
69 # (e.g. a dictionary with each related type as keys).
70 # Could just print(self.mapDict), but prefer something
71 # human-readable and stable-ordered
72 write(self.beginDict('mapDict'), file=self.outFile)
73 for baseType in sorted(self.mapDict.keys()):
74 write('{} : {},'.format(enquote(baseType),
75 pprint.pformat(self.mapDict[baseType])), file=self.outFile)
76 write(self.endDict(), file=self.outFile)
77
78 # List of included feature names
79 self.writeList(sorted(self.features), 'features')
80
81 # Generate feature <-> interface mappings
82 for feature in self.features:
83 self.mapInterfaces(feature)
84
85 # Write out the reverse map from APIs to requiring features
86 write(self.beginDict('requiredBy'), file=self.outFile)
87 for api in sorted(self.apimap):
88 # Sort requirements by first feature in each one
89 deps = sorted(self.apimap[api], key = lambda dep: dep[0])
90 reqs = ', '.join(f'({enquote(dep[0])}, {enquote(dep[1])})' for dep in deps)
91 write(f'{enquote(api)} : [{reqs}],', file=self.outFile)
92 write(self.endDict(), file=self.outFile)
93
94 super().endFile()

Callers

nothing calls this directly

Calls 9

writeDictMethod · 0.95
beginDictMethod · 0.95
endDictMethod · 0.95
writeListMethod · 0.95
writeFunction · 0.90
enquoteFunction · 0.90
createInverseMapMethod · 0.80
keysMethod · 0.80
mapInterfacesMethod · 0.80

Tested by

no test coverage detected