summaryrefslogtreecommitdiff
path: root/human.go
blob: 0aebb80895792b64233a1d357a56e070b34a07c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main

import (
	"go.wit.com/log"
)

// print the protobuf in human form
func (pf *File) printMsgTable() {
	pf.Bases.printMsg()
	pf.Base.printMsg()

	// everything else
	for _, msg := range pf.MsgNames {
		msg.printMsg()
	}
}

func (msg *MsgName) printMsg() {
	var s string
	if msg.DoMutex {
		s += "(mutex) "
	}
	if msg.DoMarshal {
		s += "(marshal) "
	}
	log.Printf("%s %s\n", msg.Name, s)

	for _, v := range msg.Vars {
		var end string
		if v.IsRepeated {
			end += "(repeated) "
		}
		if v.HasSort {
			end += "(sort) "
		}
		if v.HasUnique {
			end += "(unique) "
		}
		log.Printf("\t%s %s %s\n", v.VarName, v.VarType, end)
	}
}