diff --git a/generate/generate.go b/generate/generate.go index 685308e..ae36942 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -6,6 +6,7 @@ import "maps" import "math" import "slices" import "strings" +import "encoding/hex" import "git.tebibyte.media/sashakoshka/hopp/tape" const imports = @@ -79,6 +80,8 @@ func (this *Generator) Generate(protocol *Protocol) (n int, err error) { n += nn; if err != nil { return n, err } } + // TODO: pull items from the request queue + return n, nil } @@ -522,7 +525,17 @@ func (this *Generator) generateDecodeValue(typ Type, valueSource, tagSource stri // - err error // - nn int func (this *Generator) generateDecodeBranch(typ Type, valueSource, tagSource string) (n int, err error) { - // TODO + hash := (HashType(typ)) + hashString := hex.EncodeToString(hash[:]) + nn, err := this.iprintf("nn, err = decodeBranch_%(%s, %s)\n", hashString, valueSource, tagSource) + n += nn; if err != nil { return n, err } + nn, err = this.generateErrorCheck() + n += nn; if err != nil { return n, err } + // TODO: define this function to check if the hash exists in the + // request queue, and if not, put it at the back. then, when we actually + // generate these, continually pick items from the front. + this.pushDecodeBranchRequest(hash, typ) + return n, nil } func (this *Generator) generateErrorCheck() (n int, err error) {