|
|
- #include "ink.h"
-
- int main(int argc, char** argv) {
- struct context* ctx;
- ctx = ink_make_default_context();
-
- int coro = ink_compile(
- ctx,
- "20 print_int 10 10 + print_int 2 10 * print_int 5 5 5 * swap - print_int 60 3 / print_int\n"
- "5 1 1 1 1 + + + * print_int\n"
- "2 2 9 * + print_int\n"
- "20 -1 80 10 10 * - * print_int print_int"
- );
-
- ctx->routines[coro].panic = 0;
-
- int increment = 1 << 16;
- int counter = increment;
- int c;
-
- while(ink_can_run(ctx)) {
- for(c = 0; c < 64; ++c)
- ink_step_everyone(ctx);
-
-
- if(ctx->steps < counter) {
- ink_gc(ctx);
- counter += increment;
- }
- }
-
- return ctx->routines[coro].panic != INK_ROUTINE_SUCCESS && ctx->routines[coro].panic != INK_ROUTINE_CAN_REUSE;
- }
|