From 8338a5c59dfcb1a687a645e4738a97b87e8cfaca Mon Sep 17 00:00:00 2001 From: d_m Date: Sun, 5 May 2024 20:24:50 -0400 Subject: [PATCH] updated limits --- src/modal.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/modal.c b/src/modal.c index d2986ae..c6d80f5 100644 --- a/src/modal.c +++ b/src/modal.c @@ -1,15 +1,19 @@ #include +#define RULES 0x2000 +#define DICT 0x10000 +#define BANK 0x8000 + typedef struct { unsigned int id, refs; char *a, *b; } Rule; -static int flip, quiet, debug, cycles = 0x10000; -static Rule rules[0x1000], *rules_ = rules, lambda; -static char dict[0x8000], *dict_ = dict, empty; -static char bank_a[0x4000], *src_ = bank_a; -static char bank_b[0x4000], *dst_ = bank_b; +static int flip, quiet, unused, debug, cycles = 0x10000; +static Rule rules[RULES], *rules_ = rules, lambda; +static char dict[DICT], *dict_ = dict, empty; +static char bank_a[BANK], *src_ = bank_a; +static char bank_b[BANK], *dst_ = bank_b; static char *regs[0x100], stack[0x10], *stack_ = stack; #define spacer(c) (c <= ' ' || c == '(' || c == ')') @@ -290,6 +294,7 @@ main(int argc, char **argv) case 'q': /* quiet */ quiet = 1; break; case 'p': /* debug */ debug = 1; break; case 'n': /* infinite */ cycles = 0xffffffff; break; + case 'u': /* unused */ unused = 1; break; } } if(!(f = fopen(argv[i], "r"))) @@ -314,7 +319,7 @@ main(int argc, char **argv) if(!quiet) { while(rules_-- > rules) { if(rules_->a) { - if(!rules_->refs) + if(unused && !rules_->refs) fprintf(stderr, "-- Unused rule: %d <> (%s) (%s)\n", rules_->id, rules_->a, rules_->b); if(debug) fprintf(stderr, " (%s) (%s), %d times.\n", rules_->a, rules_->b, rules_->refs);