Housekeeping
This commit is contained in:
parent
50424f4d0c
commit
64e8bc30ab
|
@ -5,14 +5,14 @@ typedef struct {
|
||||||
char *a, *b;
|
char *a, *b;
|
||||||
} Rule;
|
} Rule;
|
||||||
|
|
||||||
static int direction;
|
static int dst;
|
||||||
static Rule rules[0x1000], lambda, *rules_ = rules;
|
static Rule rules[0x1000], lambda, *rules_ = rules;
|
||||||
static char dict[0x8000], *dict_ = dict;
|
static char dict[0x8000], *dict_ = dict;
|
||||||
static char bank_a[0x4000], *prog_ = bank_a;
|
static char bank_a[0x4000], *prog_ = bank_a;
|
||||||
static char bank_b[0x4000], *outp_ = bank_b;
|
static char bank_b[0x4000], *outp_ = bank_b;
|
||||||
static char *regs[0x100];
|
static char *regs[0x100];
|
||||||
|
|
||||||
#define spacer(c) (c < 0x21 || c == '(' || c == ')')
|
#define spacer(c) (c <= ' ' || c == '(' || c == ')')
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
walk(char *s)
|
walk(char *s)
|
||||||
|
@ -118,7 +118,7 @@ commit_rule(Rule *r, char *s, int create)
|
||||||
while((*outp_++ = *s++))
|
while((*outp_++ = *s++))
|
||||||
;
|
;
|
||||||
*outp_++ = 0;
|
*outp_++ = 0;
|
||||||
if((direction = !direction))
|
if((dst = !dst))
|
||||||
prog_ = bank_b, outp_ = bank_a;
|
prog_ = bank_b, outp_ = bank_a;
|
||||||
else
|
else
|
||||||
prog_ = bank_a, outp_ = bank_b;
|
prog_ = bank_a, outp_ = bank_b;
|
||||||
|
@ -168,7 +168,7 @@ create_rule(Rule *r, int id, char *s)
|
||||||
static int
|
static int
|
||||||
rewrite(void)
|
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) && c <= ' ') p++;
|
||||||
while((c = *p)) {
|
while((c = *p)) {
|
||||||
if(spacer(last)) {
|
if(spacer(last)) {
|
||||||
|
|
Loading…
Reference in New Issue