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

Method endFile

scripts/jsgenerator.py:52–100  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Tested by

no test coverage detected