From fec9cffcd6dbf11567a2dfe258c220af213856d2 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 9 May 2024 21:01:55 -0700 Subject: [PATCH] Removed formatter for file input --- examples/tictactoe.modal | 2 +- src/modal.c | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/examples/tictactoe.modal b/examples/tictactoe.modal index d69b1c3..4b29a7f 100644 --- a/examples/tictactoe.modal +++ b/examples/tictactoe.modal @@ -41,4 +41,4 @@ -- (Interface) ((Input a move, like "X 0 1":\n) put-str) -((- - -) (- - -) (- - -)) ready +((- - -) (- - -) (- - -)) ready diff --git a/src/modal.c b/src/modal.c index 8bc473c..56c55a2 100644 --- a/src/modal.c +++ b/src/modal.c @@ -104,18 +104,13 @@ file_import(char *path) { FILE *f; int pr = 0; - char c, last = 0; + char c; if((f = fopen(path, "r"))) { while(fread(&c, 1, 1, f)) { c = c <= 0x20 ? 0x20 : c; - if(c == ' ' && last == '(') continue; - if(c == ')' && last == ' ') dst_--; - if(c == ' ' && last == ' ') dst_--; if(c == '(') pr++; if(c == ')') pr--; - if(c == '(' && last != '?' && !spacer(last)) *dst_++ = ' '; - if(last == ')' && !spacer(c)) *dst_++ = ' '; - *dst_++ = last = c; + *dst_++ = c; } fclose(f); if(pr) fprintf(stderr, "Modal program imbalanced.\n");