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

Function autoGenFlagsPage

scripts/genRef.py:681–733  ·  view source on GitHub ↗

Autogenerate a single reference page in baseDir for an API *Flags type. - baseDir - base directory to emit page into - flagName - API *Flags name

(baseDir, flagName)

Source from the content-addressed store, hash-verified

679
680
681def autoGenFlagsPage(baseDir, flagName):
682 """Autogenerate a single reference page in baseDir for an API *Flags type.
683
684 - baseDir - base directory to emit page into
685 - flagName - API *Flags name"""
686 pageName = f'{baseDir}/{flagName}{conventions.file_suffix}'
687 fp = open(pageName, 'w', encoding='utf-8')
688
689 # Add a dictionary entry for this page
690 global genDict
691 genDict[flagName] = None
692 logDiag('autoGenFlagsPage:', pageName)
693
694 # Short description
695 matches = flagNamePat.search(flagName)
696 if matches is not None:
697 name = matches.group('name')
698 author = matches.group('author')
699 logDiag('autoGenFlagsPage: split name into', name, 'Flags', author)
700 flagBits = f'{name}FlagBits{author}'
701 desc = f'Bitmask of {flagBits}'
702 else:
703 logWarn(f'autoGenFlagsPage: {pageName} does not end in "Flags<author ID>". Cannot infer FlagBits type.')
704 flagBits = None
705 desc = f'Unknown {apiName} flags type'
706
707 # Description text
708 if flagBits is not None:
709 txt = ''.join((
710 f'etext:{flagName}',
711 f' is a mask of zero or more elink:{flagBits}.\n',
712 'It is used as a member and/or parameter of the structures and commands\n',
713 'in the See Also section below.\n'))
714 else:
715 txt = ''.join((
716 f'etext:{flagName}',
717 f' is an unknown {apiName} type, assumed to be a bitmask.\n'))
718
719 refPageHead(pageName=flagName,
720 pageDesc=desc,
721 pageAliases=set(),
722 specText=makeAPIInclude('flags', flagName),
723 fieldName=None,
724 fieldText=None,
725 descText=txt,
726 fp=fp)
727 refPageTail(pageName=flagName,
728 specType=pi.spec,
729 specAnchor=pi.anchor,
730 seeAlso=seeAlsoList(apiName=flagName),
731 fp=fp,
732 auto=True)
733 fp.close()
734
735
736def autoGenHandlePage(baseDir, handleName):

Callers 1

genRefFunction · 0.85

Calls 7

logDiagFunction · 0.90
logWarnFunction · 0.90
refPageHeadFunction · 0.85
makeAPIIncludeFunction · 0.85
refPageTailFunction · 0.85
seeAlsoListFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected