Only get reg id once
This commit is contained in:
parent
3136ae834f
commit
986a1b47dd
2
makefile
2
makefile
|
@ -13,6 +13,8 @@ debug: all bin/modal-debug
|
|||
@ bin/modal-debug examples/hello.modal
|
||||
test: all bin/modal-debug bin/modal
|
||||
@ bin/modal -v
|
||||
@ bin/modal-debug -q examples/fizzbuzz.modal
|
||||
@ bin/modal-debug -q examples/sierpinski.modal
|
||||
@ bin/modal-debug -q examples/tests.modal
|
||||
install: bin/modal
|
||||
cp bin/modal ~/bin/
|
||||
|
|
|
@ -129,9 +129,9 @@ apply_rule(Rule *r, char *s)
|
|||
if(!(c = *s) || spacer(c)) {
|
||||
char *b = r->b, *origin = dst_;
|
||||
while((c = *b++)) {
|
||||
if(c == '?' && (unsigned int)(*b - '0') < 9) {
|
||||
if(c == '?') {
|
||||
unsigned int id = *b - '0';
|
||||
if((reg = regs[id])) {
|
||||
if(id < 9 && (reg = regs[id])) {
|
||||
b++;
|
||||
if(!write_reg(r->key[id], reg) && dst_ != origin) dst_--;
|
||||
} else
|
||||
|
|
Loading…
Reference in New Issue