Walk over incompiled registers
This commit is contained in:
parent
4535c11017
commit
3136ae834f
10
src/modal.c
10
src/modal.c
|
@ -105,11 +105,11 @@ write_rule(Rule *r, char *s, int create)
|
||||||
static int
|
static int
|
||||||
apply_rule(Rule *r, char *s)
|
apply_rule(Rule *r, char *s)
|
||||||
{
|
{
|
||||||
char c, *a = r->a, *regs[0x08] = {NULL};
|
char c, *a = r->a, *regs[0x08] = {NULL}, *reg;
|
||||||
/* phase: match rule */
|
/* phase: match rule */
|
||||||
while((c = *a)) {
|
while((c = *a)) {
|
||||||
if(c == '?') {
|
if(c == '?') {
|
||||||
char *pcap = walk(s), *reg = NULL;
|
char *pcap = walk(s);
|
||||||
unsigned int id = *(++a) - '0';
|
unsigned int id = *(++a) - '0';
|
||||||
if((reg = regs[id])) { /* reg cmp */
|
if((reg = regs[id])) { /* reg cmp */
|
||||||
char *rcap = walk(reg), *pp = s;
|
char *rcap = walk(reg), *pp = s;
|
||||||
|
@ -129,11 +129,9 @@ apply_rule(Rule *r, char *s)
|
||||||
if(!(c = *s) || spacer(c)) {
|
if(!(c = *s) || spacer(c)) {
|
||||||
char *b = r->b, *origin = dst_;
|
char *b = r->b, *origin = dst_;
|
||||||
while((c = *b++)) {
|
while((c = *b++)) {
|
||||||
if(c == '?') {
|
if(c == '?' && (unsigned int)(*b - '0') < 9) {
|
||||||
char *reg = NULL;
|
|
||||||
unsigned int id = *b - '0';
|
unsigned int id = *b - '0';
|
||||||
if(id < r->ptr) reg = regs[id];
|
if((reg = regs[id])) {
|
||||||
if(reg) {
|
|
||||||
b++;
|
b++;
|
||||||
if(!write_reg(r->key[id], reg) && dst_ != origin) dst_--;
|
if(!write_reg(r->key[id], reg) && dst_ != origin) dst_--;
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue