parameters: (self, typeinfo, name, alias)
docstring: Generate type.
  
          - For 'struct' or 'union' types, defer to genStruct() to
            add to the dictionary.
          - For 'bitmask' types, add the type name to the 'flags' dictionary,
            with the value being the corresponding 'enums' name defining
            the acceptable flag bits.
          - For 'enum' types, add the type name to the 'enums' dictionary,
            with the value being '@STOPHERE@' (because this case seems
            never to happen).
          - For 'funcpointer' types, add the type name to the 'funcpointers'
            dictionary.
          - For 'handle' and 'define' types, add the handle or #define name
            to the 'struct' dictionary, because that is how the spec sources
            tag these types even though they are not structs.
docstring_summary: Generate type.
docstring_tokens: Generate type .
function: def genType(self, typeinfo, name, alias):
          """Generate type.
  
          - For 'struct' or 'union' types, defer to genStruct() to
            add to the dictionary.
          - For 'bitmask' types, add the type name to the 'flags' dictionary,
            with the value being the corresponding 'enums' name defining
            the acceptable flag bits.
          - For 'enum' types, add the type name to the 'enums' dictionary,
            with the value being '@STOPHERE@' (because this case seems
            never to happen).
          - For 'funcpointer' types, add the type name to the 'funcpointers'
            dictionary.
          - For 'handle' and 'define' types, add the handle or #define name
            to the 'struct' dictionary, because that is how the spec sources
            tag these types even though they are not structs."""
          OutputGenerator.genType(self, typeinfo, name, alias)
  
          typeElem = typeinfo.elem
          # If the type is a struct type, traverse the embedded <member> tags
          # generating a structure. Otherwise, emit the tag text.
          category = typeElem.get('category')
  
          # Add a typeCategory{} entry for the category of this type.
          self.addName(self.typeCategory, name, category)
  
          if category in ('struct', 'union'):
              self.genStruct(typeinfo, name, alias)
          else:
              if alias:
                  # Add name -> alias mapping
                  self.addName(self.alias, name, alias)
  
                  # Always emit an alias (?!)
                  count = 1
  
                  # May want to only emit full type definition when not an alias?
              else:
                  # Extract the type name
                  # (from self.genOpts). Copy other text through unchanged.
                  # If the resulting text is an empty string, do not emit it.
                  count = len(noneStr(typeElem.text))
                  for elem in typeElem:
                      count += len(noneStr(elem.text)) + len(noneStr(elem.tail))
  
              if count > 0:
                  if category == 'bitmask':
                      requiredEnum = typeElem.get('requires')
                      self.addName(self.flags, name, requiredEnum)
  
                      # This happens when the Flags type is defined, but no
                      # FlagBits are defined yet.
                      if requiredEnum is not None:
                          self.addMapping(name, requiredEnum)
                  elif category == 'enum':
                      # This case does not seem to come up. It nominally would
                      # result from
                      #   <type name="Something" category="enum"/>,
                      # but the output generator does not emit them directly.
                      self.logMsg('warn', 'ScriptOutputGenerator::genType: invalid \'enum\' category for name:', name)
                  elif category == 'funcpointer':
                      self.funcpointers[name] = None
                  elif category == 'handle':
                      self.handles[name] = None
                  elif category == 'define':
                      self.defines[name] = None
                  elif category == 'basetype':
                      # Do not add an entry for base types that are not API types
                      # e.g. an API Bool type gets an entry, uint32_t does not
                      if self.apiName(name):
                          self.basetypes[name] = None
                          self.addName(self.typeCategory, name, 'basetype')
                      else:
                          self.logMsg('diag', 'ScriptOutputGenerator::genType: unprocessed type:', name, 'category:', category)
              else:
                  self.logMsg('diag', 'ScriptOutputGenerator::genType: unprocessed type:', name)
function_tokens: def genType ( self , typeinfo , name , alias ) : OutputGenerator . genType ( self , typeinfo , name , alias ) typeElem = typeinfo . elem # If the type is a struct type, traverse the embedded <member> tags # generating a structure. Otherwise, emit the tag text. category = typeElem . get ( 'category' ) # Add a typeCategory{} entry for the category of this type. self . addName ( self . typeCategory , name , category ) if category in ( 'struct' , 'union' ) : self . genStruct ( typeinfo , name , alias ) else : if alias : # Add name -> alias mapping self . addName ( self . alias , name , alias ) # Always emit an alias (?!) count = 1 # May want to only emit full type definition when not an alias? else : # Extract the type name # (from self.genOpts). Copy other text through unchanged. # If the resulting text is an empty string, do not emit it. count = len ( noneStr ( typeElem . text ) ) for elem in typeElem : count += len ( noneStr ( elem . text ) ) + len ( noneStr ( elem . tail ) ) if count > 0 : if category == 'bitmask' : requiredEnum = typeElem . get ( 'requires' ) self . addName ( self . flags , name , requiredEnum ) # This happens when the Flags type is defined, but no # FlagBits are defined yet. if requiredEnum is not None : self . addMapping ( name , requiredEnum ) elif category == 'enum' : # This case does not seem to come up. It nominally would # result from #   <type name="Something" category="enum"/>, # but the output generator does not emit them directly. self . logMsg ( 'warn' , 'ScriptOutputGenerator::genType: invalid \'enum\' category for name:' , name ) elif category == 'funcpointer' : self . funcpointers [ name ] = None elif category == 'handle' : self . handles [ name ] = None elif category == 'define' : self . defines [ name ] = None elif category == 'basetype' : # Do not add an entry for base types that are not API types # e.g. an API Bool type gets an entry, uint32_t does not if self . apiName ( name ) : self . basetypes [ name ] = None self . addName ( self . typeCategory , name , 'basetype' ) else : self . logMsg ( 'diag' , 'ScriptOutputGenerator::genType: unprocessed type:' , name , 'category:' , category ) else : self . logMsg ( 'diag' , 'ScriptOutputGenerator::genType: unprocessed type:' , name )