parameters: (self, features, required)
docstring: Require or remove features specified in the Element
docstring_summary: Require or remove features specified in the Element
docstring_tokens: Require or remove features specified in the Element
function: def markRequired(self, features, required):
          """Require or remove features specified in the Element"""
          self.gen.logMsg('diag', '*** markRequired (features = <too long to print>, required =', required, ')')
          # Loop over types, enums, and commands in the tag
          # @@ It would be possible to respect 'api' and 'profile' attributes
          #  in individual features, but that's not done yet.
          for typeElem in features.findall('type'):
              self.markTypeRequired(typeElem.get('name'), required)
          for enumElem in features.findall('enum'):
              name = enumElem.get('name')
              self.gen.logMsg('diag', '*** tagging enum:', name, '-> required =', required)
              enum = self.lookupElementInfo(name, self.enumdict)
              if (enum != None):
                  enum.required = required
              else:
                  self.gen.logMsg('warn', '*** enum:', name , 'IS NOT DEFINED')
          for cmdElem in features.findall('command'):
              name = cmdElem.get('name')
              self.gen.logMsg('diag', '*** tagging command:', name, '-> required =', required)
              cmd = self.lookupElementInfo(name, self.cmddict)
              if (cmd != None):
                  cmd.required = required
                  # Tag all parameter types of this command as required.
                  # This DOES NOT remove types of commands in a <remove>
                  # tag, because many other commands may use the same type.
                  # We could be more clever and reference count types,
                  # instead of using a boolean.
                  if (required):
                      # Look for <ptype> in entire <command> tree,
                      # not just immediate children
                      for ptype in cmd.elem.findall('.//ptype'):
                          self.gen.logMsg('diag', '*** markRequired: command implicitly requires dependent type', ptype.text)
                          self.markTypeRequired(ptype.text, required)
              else:
                  self.gen.logMsg('warn', '*** command:', name, 'IS NOT DEFINED')
function_tokens: def markRequired ( self , features , required ) : self . gen . logMsg ( 'diag' , '*** markRequired (features = <too long to print>, required =' , required , ')' ) # Loop over types, enums, and commands in the tag # @@ It would be possible to respect 'api' and 'profile' attributes #  in individual features, but that's not done yet. for typeElem in features . findall ( 'type' ) : self . markTypeRequired ( typeElem . get ( 'name' ) , required ) for enumElem in features . findall ( 'enum' ) : name = enumElem . get ( 'name' ) self . gen . logMsg ( 'diag' , '*** tagging enum:' , name , '-> required =' , required ) enum = self . lookupElementInfo ( name , self . enumdict ) if ( enum != None ) : enum . required = required else : self . gen . logMsg ( 'warn' , '*** enum:' , name , 'IS NOT DEFINED' ) for cmdElem in features . findall ( 'command' ) : name = cmdElem . get ( 'name' ) self . gen . logMsg ( 'diag' , '*** tagging command:' , name , '-> required =' , required ) cmd = self . lookupElementInfo ( name , self . cmddict ) if ( cmd != None ) : cmd . required = required # Tag all parameter types of this command as required. # This DOES NOT remove types of commands in a <remove> # tag, because many other commands may use the same type. # We could be more clever and reference count types, # instead of using a boolean. if ( required ) : # Look for <ptype> in entire <command> tree, # not just immediate children for ptype in cmd . elem . findall ( './/ptype' ) : self . gen . logMsg ( 'diag' , '*** markRequired: command implicitly requires dependent type' , ptype . text ) self . markTypeRequired ( ptype . text , required ) else : self . gen . logMsg ( 'warn' , '*** command:' , name , 'IS NOT DEFINED' )