diff options
author | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-10 17:01:42 -0400 |
---|---|---|
committer | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-10 17:01:42 -0400 |
commit | 0c50dc6241fa21712e041cfa2bfb9db4ccaef10a (patch) | |
tree | 90a3200414c8ad6df8e7983a8e73fedfbe2b324e /nexgb/xgbgen/go_struct.go | |
parent | e239bb3c68a4981a3916534203c2fbd6b96f593c (diff) | |
download | haven-0c50dc6241fa21712e041cfa2bfb9db4ccaef10a.tar.gz haven-0c50dc6241fa21712e041cfa2bfb9db4ccaef10a.tar.xz haven-0c50dc6241fa21712e041cfa2bfb9db4ccaef10a.zip |
a huge commit. splitting extensions into their own sub-packages.
Diffstat (limited to 'nexgb/xgbgen/go_struct.go')
-rw-r--r-- | nexgb/xgbgen/go_struct.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/nexgb/xgbgen/go_struct.go b/nexgb/xgbgen/go_struct.go index 9884194..7f33b21 100644 --- a/nexgb/xgbgen/go_struct.go +++ b/nexgb/xgbgen/go_struct.go @@ -35,7 +35,7 @@ func (s *Struct) Define(c *Context) { // 'ReadStructName' should only be used to read raw reply data from the wire. func (s *Struct) Read(c *Context) { c.Putln("// Struct read %s", s.SrcName()) - c.Putln("func Read%s(buf []byte, v *%s) int {", s.SrcName(), s.SrcName()) + c.Putln("func %sRead(buf []byte, v *%s) int {", s.SrcName(), s.SrcName()) c.Putln("b := 0") c.Putln("") @@ -54,16 +54,16 @@ func (s *Struct) Read(c *Context) { // the number of bytes read from the byte slice. func (s *Struct) ReadList(c *Context) { c.Putln("// Struct list read %s", s.SrcName()) - c.Putln("func Read%sList(buf []byte, dest []%s) int {", + c.Putln("func %sReadList(buf []byte, dest []%s) int {", s.SrcName(), s.SrcName()) c.Putln("b := 0") c.Putln("for i := 0; i < len(dest); i++ {") c.Putln("dest[i] = %s{}", s.SrcName()) - c.Putln("b += Read%s(buf[b:], &dest[i])", s.SrcName()) + c.Putln("b += %sRead(buf[b:], &dest[i])", s.SrcName()) c.Putln("}") - c.Putln("return pad(b)") + c.Putln("return xgb.Pad(b)") c.Putln("}") c.Putln("") @@ -93,7 +93,7 @@ func (s *Struct) WriteList(c *Context) { c.Putln("for _, item := range list {") c.Putln("structBytes = item.Bytes()") c.Putln("copy(buf[b:], structBytes)") - c.Putln("b += pad(len(structBytes))") + c.Putln("b += xgb.Pad(len(structBytes))") c.Putln("}") c.Putln("return b") c.Putln("}") |