Housekeeping
This commit is contained in:
parent
92bc8e2f4c
commit
9201f73e2a
|
@ -1,4 +1,5 @@
|
||||||
<> (eq ?x ?x) (#t)
|
<> (a) (apple)
|
||||||
<> (eq ?x ?y) (#f)
|
<> (b) (banana)
|
||||||
|
<> (apple banana) (fruit salad)
|
||||||
|
|
||||||
(eq foo bar) (eq foo foo)
|
a b
|
14
src/modal.c
14
src/modal.c
|
@ -11,7 +11,7 @@ static char bank_a[0x1000], *prog_ = bank_a;
|
||||||
static char bank_b[0x1000], *outp_ = bank_b;
|
static char bank_b[0x1000], *outp_ = bank_b;
|
||||||
static char *regs[0x100];
|
static char *regs[0x100];
|
||||||
|
|
||||||
#define spacer(c) (c == ' ' || c == '(' || c == ')' || c == 0)
|
#define spacer(c) (c < 0x21 || c == '(' || c == ')')
|
||||||
|
|
||||||
static char *parse_rulefrag(char *line);
|
static char *parse_rulefrag(char *line);
|
||||||
|
|
||||||
|
@ -36,9 +36,9 @@ static int
|
||||||
compare(char *a, char *b)
|
compare(char *a, char *b)
|
||||||
{
|
{
|
||||||
int i = 0, al = walk(a) - a, bl = walk(b) - b;
|
int i = 0, al = walk(a) - a, bl = walk(b) - b;
|
||||||
if(al != bl) return 0;
|
if(al == bl)
|
||||||
while(a[i] == b[i])
|
while(a[i] == b[i])
|
||||||
if(!a[i] || ++i >= al) return 1;
|
if(!a[i] || ++i >= al) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,10 +128,8 @@ addrule(char *s)
|
||||||
{
|
{
|
||||||
Rule *r = &rules[rules_len++];
|
Rule *r = &rules[rules_len++];
|
||||||
s += 3;
|
s += 3;
|
||||||
r->a = parse_rulefrag(s);
|
r->a = parse_rulefrag(s), s = walk(s) + 1;
|
||||||
s = walk(s) + 1;
|
r->b = parse_rulefrag(s), s = walk(s);
|
||||||
r->b = parse_rulefrag(s);
|
|
||||||
s = walk(s);
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue