aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/go.go
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-06 03:06:02 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-06 03:06:02 -0400
commitea30f1a0a718e5e86343cceac12104baab1bedca (patch)
treecb947c3533bf048336ba0e1c16a53a8c7f35e1ca /nexgb/xgbgen/go.go
parent014a0598bfe6d997a5dacda9eae4591df0b17826 (diff)
downloadhaven-ea30f1a0a718e5e86343cceac12104baab1bedca.tar.gz
haven-ea30f1a0a718e5e86343cceac12104baab1bedca.tar.xz
haven-ea30f1a0a718e5e86343cceac12104baab1bedca.zip
more bug fixes for the rest of the extensions
Diffstat (limited to 'nexgb/xgbgen/go.go')
-rw-r--r--nexgb/xgbgen/go.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/nexgb/xgbgen/go.go b/nexgb/xgbgen/go.go
index df12e69..e0d4579 100644
--- a/nexgb/xgbgen/go.go
+++ b/nexgb/xgbgen/go.go
@@ -150,15 +150,21 @@ func (f *ExprField) Write(c *Context, prefix string) {
// Value field
func (f *ValueField) Define(c *Context) {
- c.Putln("// valueparam field: type: %s, mask name: %s, list name: %s",
- f.MaskType.SrcName(), f.MaskName, f.ListName)
- panic("todo")
+ c.Putln("%s %s", f.MaskName, f.SrcType())
+ c.Putln("%s []uint32", f.ListName)
}
func (f *ValueField) Read(c *Context, prefix string) {
- c.Putln("// reading valueparam: type: %s, mask name: %s, list name: %s",
- f.MaskType.SrcName(), f.MaskName, f.ListName)
- panic("todo")
+ ReadSimpleSingleField(c,
+ fmt.Sprintf("%s%s", prefix, f.MaskName), f.MaskType)
+ c.Putln("")
+ c.Putln("%s%s = make([]uint32, %s)",
+ prefix, f.ListName, f.ListLength().Reduce(prefix))
+ c.Putln("for i := 0; i < %s; i++ {", f.ListLength().Reduce(prefix))
+ c.Putln("%s%s[i] = Get32(buf[b:])", prefix, f.ListName)
+ c.Putln("b += 4")
+ c.Putln("}")
+ c.Putln("b = pad(b)")
}
func (f *ValueField) Write(c *Context, prefix string) {