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

Method endFeature

scripts/cgenerator.py:250–315  ·  view source on GitHub ↗

Actually write the interface to the output file.

(self)

Source from the content-addressed store, hash-verified

248 return f' /* !{protect_str} */'
249
250 def endFeature(self):
251 "Actually write the interface to the output file."
252 # C-specific
253 if self.emit:
254 if self.feature_not_empty:
255 if self.genOpts is None:
256 raise MissingGeneratorOptionsError()
257 if self.genOpts.conventions is None:
258 raise MissingGeneratorOptionsConventionsError()
259 is_core = self.featureName and self.featureName.startswith(f"{self.conventions.api_prefix}VERSION_")
260 if self.genOpts.conventions.writeFeature(self.featureName, self.featureExtraProtect, self.genOpts.filename):
261 self.newline()
262 if self.genOpts.protectFeature:
263 write('#ifndef', self.featureName, file=self.outFile)
264
265 # If type declarations are needed by other features based on
266 # this one, it may be necessary to suppress the ExtraProtect,
267 # or move it below the 'for section...' loop.
268 if self.featureExtraProtect is not None:
269 write('#ifdef', self.featureExtraProtect, file=self.outFile)
270 self.newline()
271
272 # Generate warning of possible use in IDEs
273 write(f'// {self.featureName} is a preprocessor guard. Do not pass it to API calls.', file=self.outFile)
274 write('#define', self.featureName, '1', file=self.outFile)
275 for section in self.TYPE_SECTIONS:
276 contents = self.sections[section]
277 if contents:
278 write('\n'.join(contents), file=self.outFile)
279
280 if self.genOpts.genFuncPointers and self.sections['commandPointer']:
281 write('\n'.join(self.sections['commandPointer']), file=self.outFile)
282 self.newline()
283
284 if self.sections['command']:
285 if self.genOpts.protectProto:
286 write(self.genOpts.protectProto,
287 self.genOpts.protectProtoStr, file=self.outFile)
288 if self.genOpts.protectExtensionProto and not is_core:
289 write(self.genOpts.protectExtensionProto,
290 self.genOpts.protectExtensionProtoStr, file=self.outFile)
291 write('\n'.join(self.sections['command']), end='', file=self.outFile)
292 if self.genOpts.protectExtensionProto and not is_core:
293 write('#endif' +
294 self._endProtectComment(protect_directive=self.genOpts.protectExtensionProto,
295 protect_str=self.genOpts.protectExtensionProtoStr),
296 file=self.outFile)
297 if self.genOpts.protectProto:
298 write('#endif' +
299 self._endProtectComment(protect_directive=self.genOpts.protectProto,
300 protect_str=self.genOpts.protectProtoStr),
301 file=self.outFile)
302 else:
303 self.newline()
304
305 if self.featureExtraProtect is not None:
306 write('#endif' +
307 self._endProtectComment(protect_str=self.featureExtraProtect),

Callers

nothing calls this directly

Calls 6

_endProtectCommentMethod · 0.95
writeFunction · 0.90
writeFeatureMethod · 0.80
newlineMethod · 0.80

Tested by

no test coverage detected