parameters: (self, typename, required)
docstring: Require (along with its dependencies) or remove (but not its dependencies) a type.
  
          - typename - name of type
          - required - boolean (to tag features as required or not)
docstring_summary: Require (along with its dependencies) or remove (but not its dependencies) a type.
docstring_tokens: Require ( along with its dependencies ) or remove ( but not its dependencies ) a type .
function: def markTypeRequired(self, typename, required):
          """Require (along with its dependencies) or remove (but not its dependencies) a type.
  
          - typename - name of type
          - required - boolean (to tag features as required or not)
          """
          self.gen.logMsg('diag', 'tagging type:', typename, '-> required =', required)
          # Get TypeInfo object for <type> tag corresponding to typename
          typeinfo = self.lookupElementInfo(typename, self.typedict)
          if typeinfo is not None:
              if required:
                  # Tag type dependencies in 'alias' and 'required' attributes as
                  # required. This does not un-tag dependencies in a <remove>
                  # tag. See comments in markRequired() below for the reason.
                  for attrib_name in ['requires', 'alias']:
                      depname = typeinfo.elem.get(attrib_name)
                      if depname:
                          self.gen.logMsg('diag', 'Generating dependent type',
                                          depname, 'for', attrib_name, 'type', typename)
                          # Don't recurse on self-referential structures.
                          if typename != depname:
                              self.markTypeRequired(depname, required)
                          else:
                              self.gen.logMsg('diag', 'type', typename, 'is self-referential')
                  # Tag types used in defining this type (e.g. in nested
                  # <type> tags)
                  # Look for <type> in entire <command> tree,
                  # not just immediate children
                  for subtype in typeinfo.elem.findall('.//type'):
                      self.gen.logMsg('diag', 'markRequired: type requires dependent <type>', subtype.text)
                      if typename != subtype.text:
                          self.markTypeRequired(subtype.text, required)
                      else:
                          self.gen.logMsg('diag', 'type', typename, 'is self-referential')
                  # Tag enums used in defining this type, for example in
                  #   <member><name>member</name>[<enum>MEMBER_SIZE</enum>]</member>
                  for subenum in typeinfo.elem.findall('.//enum'):
                      self.gen.logMsg('diag', 'markRequired: type requires dependent <enum>', subenum.text)
                      self.markEnumRequired(subenum.text, required)
                  # Tag type dependency in 'bitvalues' attributes as
                  # required. This ensures that the bit values for a flag
                  # are emitted
                  depType = typeinfo.elem.get('bitvalues')
                  if depType:
                      self.gen.logMsg('diag', 'Generating bitflag type',
                                      depType, 'for type', typename)
                      self.markTypeRequired(depType, required)
                      group = self.lookupElementInfo(depType, self.groupdict)
                      if group is not None:
                          group.flagType = typeinfo
  
              typeinfo.required = required
          elif '.h' not in typename:
              self.gen.logMsg('warn', 'type:', typename, 'IS NOT DEFINED')
function_tokens: def markTypeRequired ( self , typename , required ) : self . gen . logMsg ( 'diag' , 'tagging type:' , typename , '-> required =' , required ) # Get TypeInfo object for <type> tag corresponding to typename typeinfo = self . lookupElementInfo ( typename , self . typedict ) if typeinfo is not None : if required : # Tag type dependencies in 'alias' and 'required' attributes as # required. This does not un-tag dependencies in a <remove> # tag. See comments in markRequired() below for the reason. for attrib_name in [ 'requires' , 'alias' ] : depname = typeinfo . elem . get ( attrib_name ) if depname : self . gen . logMsg ( 'diag' , 'Generating dependent type' , depname , 'for' , attrib_name , 'type' , typename ) # Don't recurse on self-referential structures. if typename != depname : self . markTypeRequired ( depname , required ) else : self . gen . logMsg ( 'diag' , 'type' , typename , 'is self-referential' ) # Tag types used in defining this type (e.g. in nested # <type> tags) # Look for <type> in entire <command> tree, # not just immediate children for subtype in typeinfo . elem . findall ( './/type' ) : self . gen . logMsg ( 'diag' , 'markRequired: type requires dependent <type>' , subtype . text ) if typename != subtype . text : self . markTypeRequired ( subtype . text , required ) else : self . gen . logMsg ( 'diag' , 'type' , typename , 'is self-referential' ) # Tag enums used in defining this type, for example in #   <member><name>member</name>[<enum>MEMBER_SIZE</enum>]</member> for subenum in typeinfo . elem . findall ( './/enum' ) : self . gen . logMsg ( 'diag' , 'markRequired: type requires dependent <enum>' , subenum . text ) self . markEnumRequired ( subenum . text , required ) # Tag type dependency in 'bitvalues' attributes as # required. This ensures that the bit values for a flag # are emitted depType = typeinfo . elem . get ( 'bitvalues' ) if depType : self . gen . logMsg ( 'diag' , 'Generating bitflag type' , depType , 'for type' , typename ) self . markTypeRequired ( depType , required ) group = self . lookupElementInfo ( depType , self . groupdict ) if group is not None : group . flagType = typeinfo typeinfo . required = required elif '.h' not in typename : self . gen . logMsg ( 'warn' , 'type:' , typename , 'IS NOT DEFINED' )