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

Method genCmd

scripts/base_generator.py:832–923  ·  view source on GitHub ↗
(self, cmdinfo, name, alias)

Source from the content-addressed store, hash-verified

830 #
831 # All <command> from XML
832 def genCmd(self, cmdinfo, name, alias):
833 OutputGenerator.genCmd(self, cmdinfo, name, alias)
834
835 # Do not include APIs from unsupported extensions
836 if self.unsupportedExtension:
837 return
838
839 params = []
840 for param in cmdinfo.elem.findall('param'):
841 paramName = param.find('name').text
842 paramType = textIfFind(param, 'type')
843 paramAlias = param.get('alias')
844
845 cdecl = self.makeCParamDecl(param, 0)
846 paramFullType = ' '.join(cdecl.split()[:-1])
847 pointer = '*' in cdecl or paramType.startswith('PFN_')
848 paramConst = 'const' in cdecl
849 fixedSizeArray = [x[:-1] for x in cdecl.split('[') if x.endswith(']')]
850
851 paramNoautovalidity = boolGet(param, 'noautovalidity')
852
853 nullTerminated = False
854 length = param.get('altlen') if param.get('altlen') is not None else param.get('len')
855 if length:
856 # we will either find it like "null-terminated" or "enabledExtensionCount,null-terminated"
857 # This finds both
858 nullTerminated = 'null-terminated' in length
859 length = length.replace(',null-terminated', '') if 'null-terminated' in length else length
860 length = None if length == 'null-terminated' else length
861
862 if fixedSizeArray and not length:
863 length = ','.join(fixedSizeArray)
864
865 # See Member::optional code for details of this
866 optionalValues = splitIfGet(param, 'optional')
867 optional = len(optionalValues) > 0 and optionalValues[0].lower() == "true"
868 optionalPointer = len(optionalValues) > 1 and optionalValues[1].lower() == "true"
869
870 # externsync will be 'true', 'maybe', '<expression>' or 'maybe:<expression>'
871 (externSync, externSyncPointer) = externSyncGet(param)
872
873 params.append(Param(paramName, paramAlias, paramType, paramFullType, paramNoautovalidity,
874 paramConst, length, nullTerminated, pointer, fixedSizeArray,
875 optional, optionalPointer,
876 externSync, externSyncPointer, cdecl))
877
878 attrib = cmdinfo.elem.attrib
879 alias = attrib.get('alias')
880 tasks = splitIfGet(attrib, 'tasks')
881
882 queues = splitIfGet(attrib, 'queues')
883 allowNoQueues = boolGet(attrib, 'allownoqueues')
884 successcodes = splitIfGet(attrib, 'successcodes')
885 errorcodes = splitIfGet(attrib, 'errorcodes')
886 cmdbufferlevel = attrib.get('cmdbufferlevel')
887 primary = cmdbufferlevel is not None and 'primary' in cmdbufferlevel
888 secondary = cmdbufferlevel is not None and 'secondary' in cmdbufferlevel
889

Callers

nothing calls this directly

Calls 11

ParamClass · 0.90
LegacyClass · 0.90
CommandClass · 0.90
textIfFindFunction · 0.85
boolGetFunction · 0.85
splitIfGetFunction · 0.85
externSyncGetFunction · 0.85
makeCParamDeclMethod · 0.80
appendMethod · 0.80
makeCDeclsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected