本文整理汇总了Python中generator.OutputGenerator.beginFeature方法的典型用法代码示例。如果您正苦于以下问题:Python OutputGenerator.beginFeature方法的具体用法?Python OutputGenerator.beginFeature怎么用?Python OutputGenerator.beginFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类generator.OutputGenerator
的用法示例。
在下文中一共展示了OutputGenerator.beginFeature方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: beginFeature
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import beginFeature [as 别名]
def beginFeature(self, interface, emit):
# Start processing in superclass
OutputGenerator.beginFeature(self, interface, emit)
if interface.tag != 'extension':
self.logMsg('diag', 'beginFeature: ignoring non-extension feature', self.featureName)
return
# These attributes must exist
name = self.featureName
number = self.getAttrib(interface, 'number')
ext_type = self.getAttrib(interface, 'type')
revision = self.getSpecVersion(interface, name)
# These attributes are optional
OPTIONAL = False
requires = self.getAttrib(interface, 'requires', OPTIONAL)
requiresCore = self.getAttrib(interface, 'requiresCore', OPTIONAL, '1.0')
contact = self.getAttrib(interface, 'contact', OPTIONAL)
promotedTo = self.getAttrib(interface, 'promotedto', OPTIONAL)
deprecatedBy = self.getAttrib(interface, 'deprecatedby', OPTIONAL)
obsoletedBy = self.getAttrib(interface, 'obsoletedby', OPTIONAL)
provisional = self.getAttrib(interface, 'provisional', OPTIONAL, 'false')
filename = self.directory + '/' + name + self.file_suffix
self.extensions.append( Extension(self, filename, name, number, ext_type, requires, requiresCore, contact, promotedTo, deprecatedBy, obsoletedBy, provisional, revision) )
示例2: beginFeature
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import beginFeature [as 别名]
def beginFeature(self, interface, emit):
OutputGenerator.beginFeature(self, interface, emit)
self.currentFeature = "// {0}".format(interface.attrib['name'])
self.sections = dict([(section, []) for section in self.ALL_SECTIONS])
self.opaqueStruct.clear()
self.surfaceExtensionVersionIndent = ""
self.isSurfaceExtension = self.currentFeature in self.surfaceExtensions
if self.isSurfaceExtension:
self.surfaceExtensionVersionIndent = "\t"
示例3: beginFeature
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import beginFeature [as 别名]
def beginFeature(self, interface, emit):
# Start processing in superclass
OutputGenerator.beginFeature(self, interface, emit)
# C-specific
# Accumulate includes, defines, types, enums, function pointer typedefs,
# end function prototypes separately for this feature. They're only
# printed in endFeature().
self.sections = {section: [] for section in self.ALL_SECTIONS}
self.feature_not_empty = False
示例4: beginFeature
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import beginFeature [as 别名]
def beginFeature( self, interface, emit ):
OutputGenerator.beginFeature( self, interface, emit )
#if interface.attrib.get( 'protect' ):
#write( interface.attrib[ 'name' ], file = self.testsFile )
self.currentFeature = "// {0}".format( interface.attrib[ 'name' ] )
self.sections = dict( [ ( section, [] ) for section in self.ALL_SECTIONS ] )
self.opaqueStruct.clear()
self.platformExtensionVersionIndent = ""
self.isPlatformExtension = self.currentFeature in self.platformExtensions
if self.isPlatformExtension:
self.platformExtensionVersionIndent = "\t"
示例5: beginFeature
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import beginFeature [as 别名]
def beginFeature(self, interface, emit):
# Start processing in superclass
OutputGenerator.beginFeature(self, interface, emit)
# Verify that each extension has a unique number during doc generation
extension_number = interface.get('number')
if extension_number is not None and extension_number != "0":
if extension_number in self.extension_numbers:
self.logMsg('error', 'Duplicate extension number ', extension_number, ' detected in feature ', interface.get('name'), '\n')
exit(1)
else:
self.extension_numbers.add(extension_number)
示例6: __init__
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import beginFeature [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')