|
|
|
@ -34,6 +34,19 @@ type Message interface {
|
|
|
|
// Method returns the method code of the message.
|
|
|
|
// Method returns the method code of the message.
|
|
|
|
Method() uint16
|
|
|
|
Method() uint16
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// canAssign determines if data from the given source tag can be assigned to
|
|
|
|
|
|
|
|
// a Go type represented by destination. It is designed to receive destination
|
|
|
|
|
|
|
|
// values from [generate.Generator.generateCanAssign]. The eventual Go type and
|
|
|
|
|
|
|
|
// the destination tag must come from the same (or hash-equivalent) PDL type.
|
|
|
|
|
|
|
|
func canAssign(destination, source tape.Tag) bool {
|
|
|
|
|
|
|
|
if destination.Is(source) { return true }
|
|
|
|
|
|
|
|
if (destination == tape.SBA || destination == tape.LBA) &&
|
|
|
|
|
|
|
|
(source == tape.SBA || source == tape.LBA) {
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
`
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
|
|
// Generator converts protocols into Go code.
|
|
|
|
// Generator converts protocols into Go code.
|
|
|
|
@ -585,6 +598,7 @@ func (this *Generator) generateDecodeBranch(hash [16]byte, typ Type) (n int, err
|
|
|
|
nn, err = this.iprintf("for _ = range %s {\n", lengthVar)
|
|
|
|
nn, err = this.iprintf("for _ = range %s {\n", lengthVar)
|
|
|
|
n += nn; if err != nil { return n, err }
|
|
|
|
n += nn; if err != nil { return n, err }
|
|
|
|
this.push()
|
|
|
|
this.push()
|
|
|
|
|
|
|
|
// FIXME: wrong tag var
|
|
|
|
nn, err = this.iprintf("nn, err = tape.Skim(decoder, tag)")
|
|
|
|
nn, err = this.iprintf("nn, err = tape.Skim(decoder, tag)")
|
|
|
|
n += nn; if err != nil { return n, err }
|
|
|
|
n += nn; if err != nil { return n, err }
|
|
|
|
nn, err = this.generateErrorCheck()
|
|
|
|
nn, err = this.generateErrorCheck()
|
|
|