28 lines
1.0 KiB
Plaintext
28 lines
1.0 KiB
Plaintext
|
|
/*
|
||
|
|
* Prelude for the "used like this" fragment in README.md.
|
||
|
|
*
|
||
|
|
* The fragment is a run of CATCH calls, which only compile inside an ATTEMPT --
|
||
|
|
* that is the whole point of the macro protocol and the reason the fragment is
|
||
|
|
* shown without its scaffolding. `host_set_string` is the third accessor the
|
||
|
|
* surrounding prose says exists but does not print.
|
||
|
|
*/
|
||
|
|
#include <akerror.h>
|
||
|
|
#include <akbasic/error.h>
|
||
|
|
#include <akbasic/runtime.h>
|
||
|
|
#include <akbasic/variable.h>
|
||
|
|
|
||
|
|
static akbasic_Runtime SCRIPT;
|
||
|
|
static const char *PROGRAM = "10 PRINT \"HI\"\n";
|
||
|
|
|
||
|
|
akerr_ErrorContext AKERR_NOIGNORE *host_set_int(akbasic_Runtime *obj, const char *name, int64_t value);
|
||
|
|
akerr_ErrorContext AKERR_NOIGNORE *host_get_int(akbasic_Runtime *obj, const char *name, int64_t *dest);
|
||
|
|
akerr_ErrorContext AKERR_NOIGNORE *host_set_string(akbasic_Runtime *obj, const char *name, const char *value);
|
||
|
|
|
||
|
|
akerr_ErrorContext AKERR_NOIGNORE *akbasic_docs_fragment(void);
|
||
|
|
akerr_ErrorContext AKERR_NOIGNORE *akbasic_docs_fragment(void)
|
||
|
|
{
|
||
|
|
PREPARE_ERROR(errctx);
|
||
|
|
int64_t score = 0;
|
||
|
|
|
||
|
|
ATTEMPT {
|