diff --git a/src/modal.c b/src/modal.c index 3fd69c8..9f5c316 100644 --- a/src/modal.c +++ b/src/modal.c @@ -9,13 +9,36 @@ static Rule rules[0x100]; static char dict[0x8000], *next = dict; static char prog[0x1000], *prog_ = prog; +static char *regs[0x100]; + +static void +bind(int id, char *addr) +{ + printf("bind register %02x -> %s\n", id, addr); + regs[id] = addr; +} + +static char * +walk(char *s) +{ + char c; + while((c = *s++)) + if(*s == ')') break; + return s; +} + static int match(char *p, Rule *r) { char c, *a = r->a, *b = p; while((c = *a)) { + /* registers */ if(c == '?') { - printf("WILDCARD: %s | %s\n", p, r->a); + char cc; + int id = *(++a); + bind(id, b); + a++, b = walk(b); + printf("[%s][%s]\n", a, b); } if(c != *b) return 0; a++, b++;