Showing the changes to nodes/buffer/buffer.c (1 of 5 files). Show all
Unified · Split
| @@ -0,0 +1,41 @@ | ||
| 1 | +#include <stdlib.h> | |
| 2 | +#include <stdio.h> | |
| 3 | +#include <string.h> | |
| 4 | +#include "lil/lil.h" | |
| 5 | +#include "patchwerk/patchwerk.h" | |
| 6 | +#include "core.h" | |
| 7 | +#include "sklil.h" | |
| 8 | + | |
| 9 | +static lil_value_t hold(lil_t lil, size_t argc, lil_value_t *argv) | |
| 10 | +{ | |
| 11 | + sk_core *core; | |
| 12 | + int rc; | |
| 13 | + | |
| 14 | + core = lil_get_data(lil); | |
| 15 | + | |
| 16 | + rc = sk_core_hold(core); | |
| 17 | + | |
| 18 | + SKLIL_ERROR_CHECK(lil, rc, "hold didn't work out."); | |
| 19 | + | |
| 20 | + return NULL; | |
| 21 | +} | |
| 22 | + | |
| 23 | +static lil_value_t unhold(lil_t lil, size_t argc, lil_value_t *argv) | |
| 24 | +{ | |
| 25 | + sk_core *core; | |
| 26 | + int rc; | |
| 27 | + | |
| 28 | + core = lil_get_data(lil); | |
| 29 | + | |
| 30 | + rc = sk_core_hold(core); | |
| 31 | + | |
| 32 | + SKLIL_ERROR_CHECK(lil, rc, "unhold didn't work out."); | |
| 33 | + | |
| 34 | + return NULL; | |
| 35 | +} | |
| 36 | + | |
| 37 | +void sklil_load_buffer(lil_t lil) | |
| 38 | +{ | |
| 39 | + lil_register(lil, "hold", hold); | |
| 40 | + lil_register(lil, "unhold", unhold); | |
| 41 | +} | |