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

Method endFile

scripts/rubygenerator.py:59–120  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

57 write('end', file=self.outFile)
58
59 def endFile(self):
60 # Creates the inverse mapping of nonexistent APIs to their aliases.
61 super().createInverseMap()
62
63 # Print out all the dictionaries as Ruby strings.
64 # Use a simple container class for namespace control
65 write('class APInames\n', ' def initialize', file=self.outFile)
66
67 dicts = ( [ self.basetypes, 'basetypes' ],
68 [ self.consts, 'consts' ],
69 [ self.enums, 'enums' ],
70 [ self.flags, 'flags' ],
71 [ self.funcpointers, 'funcpointers' ],
72 [ self.protos, 'protos' ],
73 [ self.structs, 'structs' ],
74 [ self.handles, 'handles' ],
75 [ self.defines, 'defines' ],
76 [ self.typeCategory, 'typeCategory' ],
77 [ self.alias, 'aliases' ],
78 [ self.nonexistent, 'nonexistent' ],
79 )
80 for (dict, name) in dicts:
81 self.writeDict(dict, name)
82
83 # Dictionary containing the relationships of a type
84 # (e.g. a dictionary with each related type as keys).
85 write(self.beginDict('mapDict'), file=self.outFile)
86 for baseType in sorted(self.mapDict):
87 # Not actually including the relationships yet
88 write(f'{enquote(baseType)} => nil,',
89 file=self.outFile)
90 write(self.endDict(), file=self.outFile)
91
92 # List of included feature names
93 self.writeList(sorted(self.features), 'features')
94
95 # Generate feature <-> interface mappings
96 for feature in self.features:
97 self.mapInterfaces(feature)
98
99 # Write out the reverse map from APIs to requiring features
100 write(self.beginDict('requiredBy'), file=self.outFile)
101 for api in sorted(self.apimap):
102 # Sort requirements by first feature in each one
103 deps = sorted(self.apimap[api], key = lambda dep: dep[0])
104 reqs = ', '.join(f'[{nilquote(dep[0])}, {nilquote(dep[1])}]' for dep in deps)
105 write(f'{enquote(api)} => [{reqs}],', file=self.outFile)
106 write(self.endDict(), file=self.outFile)
107
108 # Remainder of the class definition
109 # End initialize method
110 write('end', file=self.outFile)
111
112 # Accessor methods
113 for (_, name) in dicts:
114 self.makeAccessor(name)
115 self.makeAccessor('features')
116

Callers

nothing calls this directly

Calls 10

writeDictMethod · 0.95
beginDictMethod · 0.95
endDictMethod · 0.95
writeListMethod · 0.95
makeAccessorMethod · 0.95
writeFunction · 0.90
enquoteFunction · 0.90
nilquoteFunction · 0.85
createInverseMapMethod · 0.80
mapInterfacesMethod · 0.80

Tested by

no test coverage detected