From 3e9ed4eac6a953b2616bcf129b515a857271acdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sat, 29 Sep 2018 21:42:23 +0200 Subject: xgbgen: process elements Most of XCB documentation now ends up in Go sources, although the end result is of mixed quality. --- nexgb/xgbgen/context.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'nexgb/xgbgen/context.go') diff --git a/nexgb/xgbgen/context.go b/nexgb/xgbgen/context.go index 32dee58..b35bc5a 100644 --- a/nexgb/xgbgen/context.go +++ b/nexgb/xgbgen/context.go @@ -6,6 +6,7 @@ import ( "fmt" "log" "sort" + "strings" ) // Context represents the protocol we're converting to Go, and a writer @@ -34,6 +35,13 @@ func (c *Context) Put(format string, v ...interface{}) { } } +// PutComment writes each line of comment commented out to 'out'. +func (c *Context) PutComment(comment string) { + for _, line := range strings.Split(comment, "\n") { + c.Putln("// %s", line) + } +} + // Morph is the big daddy of them all. It takes in an XML byte slice, // parse it, transforms the XML types into more usable types, // and writes Go code to the 'out' buffer. -- cgit v1.2.3