mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Rename the "status" keyword to "suspension".
This commit is contained in:
1 parent
a014c28865
commit
7a41ee4da1
11 files changed
+114
-113
No files matched your search
@@ -822,7 +822,7 @@ func (g *gen) writeCallSuspendibles(n *a.Expr, depth uint32) error {
|
||||
g.printf("%s%d -= %srend_src - %srptr_src;\n", tPrefix, temp, bPrefix, bPrefix)
|
||||
g.printf("%ssrc.buf->ri = %ssrc.buf->wi;\n", aPrefix, aPrefix)
|
||||
|
||||
g.printf("status = %ssrc.buf->closed ? PUFFS_%s_ERROR_UNEXPECTED_EOF : PUFFS_%s_STATUS_SHORT_READ;",
|
||||
g.printf("status = %ssrc.buf->closed ? PUFFS_%s_ERROR_UNEXPECTED_EOF : PUFFS_%s_SUSPENSION_SHORT_READ;",
|
||||
aPrefix, g.PKGNAME, g.PKGNAME)
|
||||
if g.perFunc.public && g.perFunc.suspendible { // TODO: drop the g.perFunc.public?
|
||||
g.writes("goto suspend;")
|
||||
@@ -844,7 +844,7 @@ func (g *gen) writeCallSuspendibles(n *a.Expr, depth uint32) error {
|
||||
g.writes("}\n")
|
||||
g.printf("if ((%swend_dst - %swptr_dst) < (sizeof(self->private_impl.f_stack) - v_s)) {",
|
||||
bPrefix, bPrefix)
|
||||
g.printf("status = PUFFS_%s_STATUS_SHORT_WRITE;", g.PKGNAME)
|
||||
g.printf("status = PUFFS_%s_SUSPENSION_SHORT_WRITE;", g.PKGNAME)
|
||||
if g.perFunc.public && g.perFunc.suspendible {
|
||||
g.writes("goto suspend;")
|
||||
} else {
|
||||
@@ -857,7 +857,7 @@ func (g *gen) writeCallSuspendibles(n *a.Expr, depth uint32) error {
|
||||
g.printf("b_wptr_dst += sizeof(self->private_impl.f_stack) - v_s;\n")
|
||||
|
||||
} else if isInDst(g.tm, n, t.KeyWriteU8, 1) {
|
||||
g.printf("if (%swptr_dst == %swend_dst) { status = PUFFS_%s_STATUS_SHORT_WRITE;",
|
||||
g.printf("if (%swptr_dst == %swend_dst) { status = PUFFS_%s_SUSPENSION_SHORT_WRITE;",
|
||||
bPrefix, bPrefix, g.PKGNAME)
|
||||
if g.perFunc.public && g.perFunc.suspendible {
|
||||
g.writes("goto suspend;")
|
||||
@@ -968,7 +968,7 @@ func (g *gen) writeShortRead(name string) error {
|
||||
g.printf("\nshort_read_%s:\n", name)
|
||||
// TODO: ri == wi isn't the right condition.
|
||||
g.printf("status = ((%s%s.buf->closed) && (%s%s.buf->ri == %s%s.buf->wi)) ?"+
|
||||
"PUFFS_%s_ERROR_UNEXPECTED_EOF : PUFFS_%s_STATUS_SHORT_READ;",
|
||||
"PUFFS_%s_ERROR_UNEXPECTED_EOF : PUFFS_%s_SUSPENSION_SHORT_READ;",
|
||||
aPrefix, name, aPrefix, name, aPrefix, name, g.PKGNAME, g.PKGNAME)
|
||||
if g.perFunc.public && g.perFunc.suspendible { // TODO: drop the g.perFunc.public?
|
||||
g.writes("goto suspend;")
|
||||
|
||||
@@ -87,9 +87,9 @@ var builtInStatuses = [...]string{
|
||||
"error bad receiver",
|
||||
"error bad argument",
|
||||
"error constructor not called",
|
||||
"error unexpected EOF", // Used if reading when closed == true.
|
||||
"status short read", // Used if reading when closed == false.
|
||||
"status short write",
|
||||
"error unexpected EOF", // Used if reading when closed == true.
|
||||
"suspension short read", // Used if reading when closed == false.
|
||||
"suspension short write",
|
||||
"error closed for writes",
|
||||
}
|
||||
|
||||
@@ -282,6 +282,8 @@ func (g *gen) genImpl() error {
|
||||
for _, s := range builtInStatuses {
|
||||
if strings.HasPrefix(s, "status ") {
|
||||
s = s[len("status "):]
|
||||
} else if strings.HasPrefix(s, "suspension ") {
|
||||
s = s[len("suspension "):]
|
||||
} else if strings.HasPrefix(s, "error ") {
|
||||
s = s[len("error "):]
|
||||
}
|
||||
@@ -406,7 +408,7 @@ func (g *gen) gatherStatuses(n *a.Status) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("bad status message %q", raw)
|
||||
}
|
||||
prefix := "status "
|
||||
prefix := "suspension "
|
||||
isError := n.Keyword().Key() == t.KeyError
|
||||
if isError {
|
||||
prefix = "error "
|
||||
|
||||
Reference in new issue
Block a user