more cleanups. now to add oneof

This commit is contained in:
Jeff Carr 2025-04-02 12:33:29 -05:00
parent 4e3e05684b
commit b4df5436ec
1 changed files with 5 additions and 24 deletions

View File

@ -302,32 +302,13 @@ func (msg *FormatMsg) padding(offset int) string {
func formatEnum(curmsg *FormatMsg) []string {
var newmsg []string
if argv.Debug {
header := fmt.Sprintf("%s%s // enum2 depth=%d", curmsg.padBase(), curmsg.Header, curmsg.Depth)
newmsg = append(newmsg, header)
/*
header = fmt.Sprintf("//%s//%s// enum2 depth=%d", curmsg.padding(2), curmsg.Header, curmsg.Depth)
newmsg = append(newmsg, header)
header = fmt.Sprintf("// %s", curmsg.Header)
newmsg = append(newmsg, header)
*/
} else {
header := fmt.Sprintf("%s%s", curmsg.padBase(), curmsg.Header)
newmsg = append(newmsg, header)
}
newmsg = append(newmsg, curmsg.formatLineBase(curmsg.Header, "enum header"))
for _, line := range curmsg.Lines {
line = fmt.Sprintf("%s%s", curmsg.pad(), line)
newmsg = append(newmsg, line)
newmsg = append(newmsg, curmsg.formatLine(line, "enum"))
}
if argv.Debug {
footer := fmt.Sprintf("%s%s // enum2 footer depth=%d", curmsg.padBase(), curmsg.Footer, curmsg.Depth)
newmsg = append(newmsg, footer)
} else {
footer := fmt.Sprintf("%s%s", curmsg.padBase(), curmsg.Footer)
newmsg = append(newmsg, footer)
}
newmsg = append(newmsg, curmsg.formatLineBase(curmsg.Footer, "enum header"))
return newmsg
}
@ -375,7 +356,7 @@ func (all *FormatMsg) format() []string {
func (msg *FormatMsg) formatLineBase(line string, dbg string) string {
line = strings.TrimSpace(line)
if argv.Debug {
return fmt.Sprintf("%s%s // %s depth=%d", msg.padBase(), line, dbg, msg.Depth)
return fmt.Sprintf("/*a*/ %s%s // %s depth=%d", msg.padBase(), line, dbg, msg.Depth)
}
return fmt.Sprintf("%s%s", msg.padBase(), line)
}
@ -383,7 +364,7 @@ func (msg *FormatMsg) formatLineBase(line string, dbg string) string {
func (msg *FormatMsg) formatLine(line string, dbg string) string {
line = strings.TrimSpace(line)
if argv.Debug {
return fmt.Sprintf("%s%s // %s depth=%d", msg.pad(), line, dbg, msg.Depth)
return fmt.Sprintf("/*a*/ %s%s // %s depth=%d", msg.pad(), line, dbg, msg.Depth)
}
return fmt.Sprintf("%s%s", msg.padBase(), line)
}