code: func generateEnum(ctx *context, w io.Writer, enum *Enum) {
  	name := camelCaseName(enum.Name)
  	typ := binapiTypes[enum.Type]
  
  	logf(" writing enum %q (%s) with %d entries", enum.Name, name, len(enum.Entries))
  
  	// generate enum comment
  	generateComment(ctx, w, name, enum.Name, "enum")
  
  	// generate enum definition
  	fmt.Fprintf(w, "type %s %s\n", name, typ)
  	fmt.Fprintln(w)
  
  	fmt.Fprintln(w, "const (")
  
  	// generate enum entries
  	for _, entry := range enum.Entries {
  		fmt.Fprintf(w, "\t%s %s = %v\n", entry.Name, name, entry.Value)
  	}
  
  	fmt.Fprintln(w, ")")
  
  	fmt.Fprintln(w)
  }
docs: // generateEnum writes generated code for the enum into w