Housekeeping

This commit is contained in:
Devine Lu Linvega 2024-04-11 09:26:55 -07:00
parent 50424f4d0c
commit 64e8bc30ab
1 changed files with 4 additions and 4 deletions

View File

@ -5,14 +5,14 @@ typedef struct {
char *a, *b;
} Rule;
static int direction;
static int dst;
static Rule rules[0x1000], lambda, *rules_ = rules;
static char dict[0x8000], *dict_ = dict;
static char bank_a[0x4000], *prog_ = bank_a;
static char bank_b[0x4000], *outp_ = bank_b;
static char *regs[0x100];
#define spacer(c) (c < 0x21 || c == '(' || c == ')')
#define spacer(c) (c <= ' ' || c == '(' || c == ')')
static char *
walk(char *s)
@ -118,7 +118,7 @@ commit_rule(Rule *r, char *s, int create)
while((*outp_++ = *s++))
;
*outp_++ = 0;
if((direction = !direction))
if((dst = !dst))
prog_ = bank_b, outp_ = bank_a;
else
prog_ = bank_a, outp_ = bank_b;
@ -168,7 +168,7 @@ create_rule(Rule *r, int id, char *s)
static int
rewrite(void)
{
char c, last = 0, *p = direction ? bank_b : bank_a, *res;
char c, last = 0, *p = dst ? bank_b : bank_a, *res;
while((c = *p) && c <= ' ') p++;
while((c = *p)) {
if(spacer(last)) {