|
|
- #include "ink.h"
- #include <stdio.h>
- #include <string.h>
- #include <malloc.h>
-
- int nop_putchar(int n) {
- return n;
- }
-
- int main(int _1, char** _2) {
- char read_buffer[2048];
- struct context* ctx = ink_make_default_context();
-
- ctx->putchar = nop_putchar;
- char* argv_d[3];
- argv_d[0] = "test/bench01.nk";
- argv_d[1] = "test/bench02.nk";
- argv_d[2] = "test/bench03.nk";
- char** it = argv_d;
- char** end_argv = it + 3;
- for(; it != end_argv; it++) {
- FILE* file = fopen(*it, "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) {
- perror("Panicked !!");
- }
-
- fclose(file);
- }
-
- return ctx->panic;
- }
|