Housekeeping

This commit is contained in:
Devine Lu Linvega 2024-04-07 15:50:27 -07:00
parent 4798fe53a5
commit c61e775241
1 changed files with 6 additions and 9 deletions

View File

@ -25,7 +25,7 @@ walk(char *s)
if(!depth) return s; if(!depth) return s;
} }
} }
while(!spacer(s[0]) && (c = *s++)) while(!spacer(s[0]) && *s++)
; ;
return s; return s;
} }
@ -122,20 +122,17 @@ commit(char r, char *incoming)
} }
static int static int
save(int rule, char *p) save(int rule, char *s)
{ {
while((*outp_++ = *p++)) while((*outp_++ = *s++))
; ;
*outp_++ = 0; *outp_++ = 0;
if((direction = !direction)) if((direction = !direction))
prog_ = bank_b, outp_ = bank_a; prog_ = bank_b, outp_ = bank_a;
else else
prog_ = bank_a, outp_ = bank_b; prog_ = bank_a, outp_ = bank_b;
if(rule >= 0) { if(rule >= 0)
char *program = direction ? bank_b : bank_a; fprintf(stderr, "%02d %s\n", rule, prog_);
while(program[1] && program[0] < 0x21) program++;
fprintf(stderr, "%02d %s\n", rule, program);
}
return 1; return 1;
} }
@ -170,7 +167,7 @@ static int
rewrite(char *incoming) rewrite(char *incoming)
{ {
char c, *p = direction ? bank_b : bank_a; char c, *p = direction ? bank_b : bank_a;
while(*p == 0xa || *p == ' ') p++; while((c = *p) && c <= ' ') p++;
while((c = *p)) { while((c = *p)) {
int i; int i;
if(p[0] == '<' && p[1] == '>') { if(p[0] == '<' && p[1] == '>') {