mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 09:01:35 +01:00
Add cgen templates.
This commit is contained in:
1 parent
38bfebf204
commit
f3970d6670
4 files changed
+207
-23
No files matched your search
@@ -0,0 +1,22 @@
|
||||
// After editing this file, run "go generate" in this directory.
|
||||
|
||||
// This file contains C-like code. It is close enough to C so that clang-format
|
||||
// can format it well. But it is not C code per se. It contains templates that
|
||||
// the code generator expands via a custom mechanism.
|
||||
//
|
||||
// This file has a .h extension, not a .c extension, so that Go tools such as
|
||||
// "go generate" don't try to build it as part of the Go package, via cgo.
|
||||
|
||||
template short_read(string qPKGPREFIXq, string qnameq) {
|
||||
short_read_qnameq:
|
||||
// TODO: is ptr_to_len the right check?
|
||||
if (a_qnameq.limit.ptr_to_len) {
|
||||
status = qPKGPREFIXqSUSPENSION_LIMITED_READ;
|
||||
} else if (a_qnameq.buf->closed) {
|
||||
status = qPKGPREFIXqERROR_UNEXPECTED_EOF;
|
||||
goto exit;
|
||||
} else {
|
||||
status = qPKGPREFIXqSUSPENSION_SHORT_READ;
|
||||
}
|
||||
goto suspend;
|
||||
}
|
||||
Reference in new issue
Block a user