Follow the pkg__type__method convention for base.

This commit is contained in:
Nigel Tao committed 2017-10-21 15:59:08 +11:00
1 parent 362bb94e68
commit f29c4e278f
19 files changed
+747 -734

No files matched your search

+8 -7
View File
@@ -226,7 +226,7 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
}
} else if n.XType().Decorator().Key() == t.KeyColon {
// TODO: don't assume that the slice is a slice of u8.
b.printf("((puffs_base_slice_u8){})")
b.printf("((puffs_base__slice_u8){})")
} else {
b.writeb('0')
}
@@ -250,7 +250,7 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
// TODO: don't assume that the slice is a slice of u8. In particular,
// the code gen can be subtle if the slice element type has zero size,
// such as the empty struct.
b.printf("puffs_base_slice_u8 %sslice_%s =", iPrefix, name)
b.printf("puffs_base__slice_u8 %sslice_%s =", iPrefix, name)
if err := g.writeExpr(b, v.Value(), replaceCallSuspendibles, parenthesesOptional, 0); err != nil {
return err
}
@@ -334,7 +334,7 @@ func (g *gen) writeCoroSuspPoint(b *buffer, maybeSuspend bool) error {
if maybeSuspend {
macro = "_MAYBE_SUSPEND"
}
b.printf("PUFFS_COROUTINE_SUSPENSION_POINT%s(%d);\n", macro, g.currFunk.coroSuspPoint)
b.printf("PUFFS_BASE__COROUTINE_SUSPENSION_POINT%s(%d);\n", macro, g.currFunk.coroSuspPoint)
return nil
}
@@ -388,7 +388,8 @@ func (g *gen) writeCallSuspendibles(b *buffer, n *a.Expr, depth uint32) error {
temp := g.currFunk.tempW
g.currFunk.tempW++
b.printf("if (PUFFS_UNLIKELY(%srptr_src == %srend_src)) { goto short_read_src; }", bPrefix, bPrefix)
b.printf("if (PUFFS_BASE__UNLIKELY(%srptr_src == %srend_src)) { goto short_read_src; }",
bPrefix, bPrefix)
g.currFunk.shortReads = append(g.currFunk.shortReads, "src")
// TODO: watch for passing an array type to writeCTypeName? In C, an
// array type can decay into a pointer.
@@ -612,8 +613,8 @@ func (g *gen) writeReadUXX(b *buffer, n *a.Expr, name string, size uint32, endia
scratchName := fmt.Sprintf("self->private_impl.%s%s[0].scratch",
cPrefix, g.currFunk.astFunc.Name().String(g.tm))
b.printf("if (PUFFS_LIKELY(%srend_src - %srptr_src >= %d)) {", bPrefix, bPrefix, size/8)
b.printf("%s%d = puffs_base_load_u%d%s(%srptr_src);\n", tPrefix, temp1, size, endianness, bPrefix)
b.printf("if (PUFFS_BASE__LIKELY(%srend_src - %srptr_src >= %d)) {", bPrefix, bPrefix, size/8)
b.printf("%s%d = puffs_base__load_u%d%s(%srptr_src);\n", tPrefix, temp1, size, endianness, bPrefix)
b.printf("%srptr_src += %d;\n", bPrefix, size/8)
b.printf("} else {")
b.printf("%s = 0;\n", scratchName)
@@ -622,7 +623,7 @@ func (g *gen) writeReadUXX(b *buffer, n *a.Expr, name string, size uint32, endia
}
b.printf("while (true) {")
b.printf("if (PUFFS_UNLIKELY(%srptr_%s == %srend_%s)) { goto short_read_%s; }",
b.printf("if (PUFFS_BASE__UNLIKELY(%srptr_%s == %srend_%s)) { goto short_read_%s; }",
bPrefix, name, bPrefix, name, name)
g.currFunk.shortReads = append(g.currFunk.shortReads, name)