当前位置: 首页>>代码示例>>Python>>正文


Python OutputGenerator.endFeature方法代码示例

本文整理汇总了Python中generator.OutputGenerator.endFeature方法的典型用法代码示例。如果您正苦于以下问题:Python OutputGenerator.endFeature方法的具体用法?Python OutputGenerator.endFeature怎么用?Python OutputGenerator.endFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在generator.OutputGenerator的用法示例。


在下文中一共展示了OutputGenerator.endFeature方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: endFeature

# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import endFeature [as 别名]
 def endFeature(self):
     # C-specific
     # Actually write the interface to the output file.
     if self.emit:
         if self.feature_not_empty:
             if self.genOpts.conventions.writeFeature(self.featureExtraProtect, self.genOpts.filename):
                 self.newline()
                 if self.genOpts.protectFeature:
                     write('#ifndef', self.featureName, file=self.outFile)
                 # If type declarations are needed by other features based on
                 # this one, it may be necessary to suppress the ExtraProtect,
                 # or move it below the 'for section...' loop.
                 if self.featureExtraProtect is not None:
                     write('#ifdef', self.featureExtraProtect, file=self.outFile)
                 self.newline()
                 write('#define', self.featureName, '1', file=self.outFile)
                 for section in self.TYPE_SECTIONS:
                     # OpenXR:
                     # If we need the explicit include of the external platform header,
                     # put it right before the function pointer definitions
                     if section == "funcpointer" and self.need_platform_include:
                         write('// Include for OpenXR Platform-Specific Types', file=self.outFile)
                         write('#include "openxr_platform.h"', file=self.outFile)
                         self.newline()
                         self.need_platform_include = False
                     contents = self.sections[section]
                     if contents:
                         write('\n'.join(contents), file=self.outFile)
                 if self.genOpts.genFuncPointers and self.sections['commandPointer']:
                     write('\n'.join(self.sections['commandPointer']), file=self.outFile)
                     self.newline()
                 if self.sections['command']:
                     if self.genOpts.protectProto:
                         write(self.genOpts.protectProto,
                             self.genOpts.protectProtoStr, file=self.outFile)
                     write('\n'.join(self.sections['command']), end='', file=self.outFile)
                     if self.genOpts.protectProto:
                         write('#endif', file=self.outFile)
                     else:
                         self.newline()
                 if self.featureExtraProtect is not None:
                     write('#endif /*', self.featureExtraProtect, '*/', file=self.outFile)
                 if self.genOpts.protectFeature:
                     write('#endif /*', self.featureName, '*/', file=self.outFile)
     # Finish processing in superclass
     OutputGenerator.endFeature(self)
开发者ID:krOoze,项目名称:Vulkan-Docs,代码行数:48,代码来源:cgenerator.py

示例2: __init__

# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import endFeature [as 别名]

#.........这里部分代码省略.........
                    extName, '(matches explicitly requested extensions to remove)')
                include = False
            #
            # If the extension is to be included, add it to the
            # extension features list.
            if (include):
                ei.emit = True
                features.append(ei)
            else:
                self.gen.logMsg('diag', '*** NOT including extension',
                    extName, '(does not match api attribute or explicitly requested extensions)')
        #
        # Sort the extension features list, if a sort procedure is defined
        if (self.genOpts.sortProcedure):
            self.genOpts.sortProcedure(features)
        #
        # Pass 1: loop over requested API versions and extensions tagging
        #   types/commands/features as required (in an <require> block) or no
        #   longer required (in an <remove> block). It is possible to remove
        #   a feature in one version and restore it later by requiring it in
        #   a later version.
        # If a profile other than 'None' is being generated, it must
        #   match the profile attribute (if any) of the <require> and
        #   <remove> tags.
        self.gen.logMsg('diag', '*** PASS 1: TAG FEATURES ********************************************')
        for f in features:
            self.gen.logMsg('diag', '*** PASS 1: Tagging required and removed features for',
                f.name)
            self.requireAndRemoveFeatures(f.elem, self.genOpts.apiname, self.genOpts.profile)
            self.assignAdditionalValidity(f.elem, self.genOpts.apiname, self.genOpts.profile)
        #
        # Pass 2: loop over specified API versions and extensions printing
        #   declarations for required things which haven't already been
        #   generated.
        self.gen.logMsg('diag', '*** PASS 2: GENERATE INTERFACES FOR FEATURES ************************')
        self.gen.beginFile(self.genOpts)
        for f in features:
            self.gen.logMsg('diag', '*** PASS 2: Generating interface for',
                f.name)
            emit = self.emitFeatures = f.emit
            if (not emit):
                self.gen.logMsg('diag', '*** PASS 2: NOT declaring feature',
                    f.elem.get('name'), 'because it is not tagged for emission')
            # Generate the interface (or just tag its elements as having been
            # emitted, if they haven't been).
            self.gen.beginFeature(f.elem, emit)
            self.generateRequiredInterface(f.elem)
            self.gen.endFeature()
        self.gen.endFile()
    #
    # apiReset - use between apiGen() calls to reset internal state
    #
    def apiReset(self):
        """Reset type/enum/command dictionaries before generating another API"""
        for type in self.typedict:
            self.typedict[type].resetState()
        for enum in self.enumdict:
            self.enumdict[enum].resetState()
        for cmd in self.cmddict:
            self.cmddict[cmd].resetState()
        for cmd in self.apidict:
            self.apidict[cmd].resetState()
    #
    # validateGroups - check that group= attributes match actual groups
    #
    def validateGroups(self):
        """Validate group= attributes on <param> and <proto> tags"""
        # Keep track of group names not in <group> tags
        badGroup = {}
        self.gen.logMsg('diag', '*** VALIDATING GROUP ATTRIBUTES ***')
        for cmd in self.reg.findall('commands/command'):
            proto = cmd.find('proto')
            funcname = cmd.find('proto/name').text
            if ('group' in proto.attrib.keys()):
                group = proto.get('group')
                # self.gen.logMsg('diag', '*** Command ', funcname, ' has return group ', group)
                if (group not in self.groupdict.keys()):
                    # self.gen.logMsg('diag', '*** Command ', funcname, ' has UNKNOWN return group ', group)
                    if (group not in badGroup.keys()):
                        badGroup[group] = 1
                    else:
                        badGroup[group] = badGroup[group] +  1
            for param in cmd.findall('param'):
                pname = param.find('name')
                if (pname != None):
                    pname = pname.text
                else:
                    pname = type.get('name')
                if ('group' in param.attrib.keys()):
                    group = param.get('group')
                    if (group not in self.groupdict.keys()):
                        # self.gen.logMsg('diag', '*** Command ', funcname, ' param ', pname, ' has UNKNOWN group ', group)
                        if (group not in badGroup.keys()):
                            badGroup[group] = 1
                        else:
                            badGroup[group] = badGroup[group] +  1
        if (len(badGroup.keys()) > 0):
            self.gen.logMsg('diag', '*** SUMMARY OF UNRECOGNIZED GROUPS ***')
            for key in sorted(badGroup.keys()):
                self.gen.logMsg('diag', '    ', key, ' occurred ', badGroup[key], ' times')
开发者ID:LUXOPHIA,项目名称:LUX.GPGPU.Vulkan,代码行数:104,代码来源:reg.py

示例3: endFeature

# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import endFeature [as 别名]
	def endFeature(self):
		if self.emit:
			# first write all types into types.d

			# special treat for platform surface extension which get wraped into a version block
			extIndent = self.surfaceExtensionVersionIndent
			self.typesFileContent += "\n{0}\n".format(self.currentFeature)
			surfaceVersion = ""
			if self.isSurfaceExtension:
				surfaceVersion = "version({0}) {{".format(self.surfaceExtensions[self.currentFeature][0])
				self.typesFileContent += "{0}\n\t{1}\n".format(surfaceVersion, self.surfaceExtensions[self.currentFeature][1])
			
			isFirstSectionInFeature = True		# for output file formating
			for section in self.TYPE_SECTIONS:
				# write contents of type section
				contents = self.sections[section]
				if contents:
					# check if opaque structs were registered and write tem into types file	
					if section == 'struct':
						if self.opaqueStruct:
							for opaque in self.opaqueStruct:
								self.typesFileContent += "{1}struct {0};\n".format(opaque, extIndent)
							self.typesFileContent += '\n'

					elif not isFirstSectionInFeature:
						self.typesFileContent += '\n'

					# for output file formating
					isFirstSectionInFeature = False

					# write the rest of the contents, eg. enums, structs, etc. into types file
					for content in self.sections[section]:
						self.typesFileContent += "{1}{0}\n".format(content, extIndent)

			if self.isSurfaceExtension:
				self.typesFileContent += "}\n"

			# currently the commandPointer token is not used
			if self.genOpts.genFuncPointers and self.sections['commandPointer']:
				if self.isSurfaceExtension: write(surfaceVersion, file=self.funcsFile)
				write(extIndent + ('\n' + extIndent).join(self.sections['commandPointer']), file=self.funcsFile)
				if self.isSurfaceExtension: write("}", file=self.funcsFile)
				write('', file=self.funcsFile)

			# write function aliases into functions.d and build strings for later injection
			if self.sections['command']:
				# update indention of currentFeature for functions.d content
				self.currentFeature = "\t" + self.currentFeature;

				# write the aliases to function types
				write("\n{0}".format(self.currentFeature), file=self.funcsFile)
				if self.isSurfaceExtension: write("\t" + surfaceVersion, file=self.funcsFile)
				write(extIndent + ('\n' + extIndent).join(self.sections['command']), file=self.funcsFile)
				if self.isSurfaceExtension: write("\t}", file=self.funcsFile)

				# capture if function is a instance or device level function
				inInstanceLevelFuncNames = False
				inDeviceLevelFuncNames = False

				# comment the current feature
				self.functionTypeDefinition += "\n\n{0}".format(self.currentFeature)

				# surface extension version directive
				if self.isSurfaceExtension: self.functionTypeDefinition += "\n\t" + surfaceVersion

				# create string of functionTypes functionVars
				for command in self.sections['command']:
					name = self.functionTypeName[command]
					self.functionTypeDefinition += "\n\t{1}PFN_{0} {0};".format(name, extIndent)

					# query if the current function is in instance or deviceLevelFuncNames for the next step
					if not inInstanceLevelFuncNames and name in self.instanceLevelFuncNames:
						inInstanceLevelFuncNames = True

					if not inDeviceLevelFuncNames and name in self.deviceLevelFuncNames:
						inDeviceLevelFuncNames = True

				# surface extension version closing curly brace
				if self.isSurfaceExtension: self.functionTypeDefinition += "\n\t}"

				# create a strings to load instance level functions
				if inInstanceLevelFuncNames:
					# comment the current feature
					self.instanceLevelFunctions += "\n\n{0}".format(self.currentFeature)

					# surface extension version directive
					if self.isSurfaceExtension: self.instanceLevelFunctions += "\n\t" + surfaceVersion
					
					# set of global level function names, function pointers are ignored here are set in endFile method
					gloablLevelFuncNames = {"vkGetInstanceProcAddr", "vkEnumerateInstanceExtensionProperties", "vkEnumerateInstanceLayerProperties", "vkCreateInstance"}

					# build the commands
					for command in self.sections['command']:
						name = self.functionTypeName[command]
						if name in self.instanceLevelFuncNames and name not in gloablLevelFuncNames:
							self.instanceLevelFunctions += "\n\t{1}{0} = cast(typeof({0})) vkGetInstanceProcAddr(instance, \"{0}\");".format(name, extIndent)

					# surface extension version closing curly brace
					if self.isSurfaceExtension: self.instanceLevelFunctions += "\n\t}"

#.........这里部分代码省略.........
开发者ID:MaikKlein,项目名称:ErupteD,代码行数:103,代码来源:erupt.py

示例4: endFeature

# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import endFeature [as 别名]
 def endFeature(self):
     # Finish processing in superclass
     OutputGenerator.endFeature(self)
开发者ID:krOoze,项目名称:Vulkan-Docs,代码行数:5,代码来源:extensionmetadocgenerator.py


注:本文中的generator.OutputGenerator.endFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。