A minimalistic programming language written in C89.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
479 B

пре 6 месеци
пре 6 месеци
  1. #include "ink.h"
  2. #include <stdio.h>
  3. int main(int argc, char** argv) {
  4. char read_buffer[2048];
  5. struct context* ctx = ink_make_default_context();
  6. char** end_argv = argv + argc;
  7. for(argv+=1; argv != end_argv; argv++) {
  8. FILE* file = fopen(*argv, "r");
  9. size_t cnt = fread(read_buffer, 1, 2047, file);
  10. if(cnt == 0) {
  11. }
  12. read_buffer[cnt] = 0;
  13. ink_run(ctx, read_buffer);
  14. if(ctx->panic) {
  15. perror("Panicked !!");
  16. }
  17. fclose(file);
  18. }
  19. return ctx->panic;
  20. }