23 lines
895 B
Plaintext
23 lines
895 B
Plaintext
|
|
/*
|
||
|
|
* akglbody -- the inside of a function that returns an error context.
|
||
|
|
*
|
||
|
|
* The overwhelmingly common shape of a libakgl example: a few locals, an
|
||
|
|
* ATTEMPT block, and calls that are checked. Written out in full, every one of
|
||
|
|
* those blocks would open with the same four lines and close with the same two,
|
||
|
|
* and a reader would learn the protocol six times instead of the call once.
|
||
|
|
*
|
||
|
|
* The block supplies everything between `PREPARE_ERROR` and the closing brace.
|
||
|
|
* `errctx` is the local error context, per the house parameter names.
|
||
|
|
*
|
||
|
|
* Nothing here declares an akgl_ function. A prelude that did would let an
|
||
|
|
* example calling it with the wrong arguments compile, which is the one thing
|
||
|
|
* this whole harness exists to catch.
|
||
|
|
*/
|
||
|
|
#include <docs_prelude.h>
|
||
|
|
|
||
|
|
akerr_ErrorContext AKERR_NOIGNORE *docs_example(void);
|
||
|
|
|
||
|
|
akerr_ErrorContext *docs_example(void)
|
||
|
|
{
|
||
|
|
PREPARE_ERROR(errctx);
|