Removed copy after rewriting
This commit is contained in:
parent
f2e1b60f99
commit
cced3c8d26
12
src/modal.c
12
src/modal.c
|
@ -4,7 +4,7 @@ typedef struct {
|
|||
char *a, *b;
|
||||
} Rule;
|
||||
|
||||
static int rules_len;
|
||||
static int rules_len, direction = 0;
|
||||
static Rule rules[0x100];
|
||||
static char dict[0x8000], *dict_ = dict;
|
||||
static char bank_a[0x1000], *prog_ = bank_a;
|
||||
|
@ -89,11 +89,11 @@ bind(char r)
|
|||
static void
|
||||
save(int rule)
|
||||
{
|
||||
int i, end = outp_ - bank_b;
|
||||
/* todo: change pointer instead of copying memory */
|
||||
for(i = 0; i <= end; i++) bank_a[i] = bank_b[i];
|
||||
if((direction = !direction))
|
||||
prog_ = bank_b, outp_ = bank_a;
|
||||
else
|
||||
prog_ = bank_a, outp_ = bank_b;
|
||||
printf("%02d %s\n", rule, bank_a);
|
||||
printf("%02d %s\n", rule, direction ? bank_b : bank_a);
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -138,7 +138,7 @@ addrule(char *s)
|
|||
static int
|
||||
rewrite(void)
|
||||
{
|
||||
char c, *p = bank_a;
|
||||
char c, *p = direction ? bank_b : bank_a;
|
||||
while((c = *p)) {
|
||||
int i;
|
||||
if(p[0] == '<' && p[1] == '>')
|
||||
|
|
Loading…
Reference in New Issue