Drop the "?" from "copy_from32?".

Also add a PUFFS_COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND macro.

Also add a loop to decoder.decode, as the code generator was previously
(incorrectly) not generating a coro_susp_point at the end of the
function.
This commit is contained in:
Nigel Tao committed 2017-10-07 14:34:31 +11:00
1 parent 0e09aa8c10
commit 585ea2024d
10 files changed
+218 -134

No files matched your search

+4 -5
View File
@@ -126,7 +126,7 @@ const maxTemp = 10000
type status struct {
name string
msg string
isError bool
keyword t.ID
}
type buffer []byte
@@ -230,7 +230,7 @@ func (g *gen) genHeader(b *buffer) error {
}
for i, s := range g.statusList {
code := pkgID << statusCodeNamespaceShift
if s.isError {
if s.keyword.Key() == t.KeyError {
code |= 1 << 31
}
code |= uint32(i)
@@ -445,14 +445,13 @@ func (g *gen) gatherStatuses(b *buffer, n *a.Status) error {
return fmt.Errorf("bad status message %q", raw)
}
prefix := "SUSPENSION_"
isError := n.Keyword().Key() == t.KeyError
if isError {
if n.Keyword().Key() == t.KeyError {
prefix = "ERROR_"
}
s := status{
name: strings.ToUpper(g.cName(prefix + msg)),
msg: msg,
isError: isError,
keyword: n.Keyword(),
}
g.statusList = append(g.statusList, s)
g.statusMap[n.Message()] = s