|
|
- #include "ink.h"
- #include <stdio.h>
-
- int main(int argc, char** argv) {
- char read_buffer[2048];
- struct context* ctx = ink_make_default_context();
- char** end_argv = argv + argc;
- for(argv+=1; argv != end_argv; argv++) {
- FILE* file = fopen(*argv, "r");
- size_t cnt = fread(read_buffer, 1, 2047, file);
- if(cnt == 0) {
-
- }
- read_buffer[cnt] = 0;
- ink_compile(ctx, read_buffer);
-
- if(ctx->panic) {
- fprintf(stderr, "Panicked !! -> %d\n", ctx->panic);
- }
-
- fclose(file);
- }
-
- while(ink_can_run(ctx)) {
- ink_step_everyone(ctx);
- }
- ink_gc(ctx);
- printf("\nExecuted in %u steps\nCollected %u times\n", ctx->steps, ctx->collections);
- return ctx->panic;
- }
|