Added unpack register

This commit is contained in:
Devine Lu Linvega 2024-04-17 08:47:39 -07:00
parent 2449bac4ad
commit 9dd3439986
1 changed files with 5 additions and 1 deletions

View File

@ -65,6 +65,10 @@ put_reg(char r)
for(i = 0; i < depth; i++) for(i = 0; i < depth; i++)
*dst_++ = ')'; *dst_++ = ')';
} }
} else if(r == '.') { /* unpack */
if(*s == '(')
s++, --ss;
while(s < ss) *dst_++ = *s++;
} else if(r == ':') { /* special stdout */ } else if(r == ':') { /* special stdout */
if(*s == '(') s++, --ss; if(*s == '(') s++, --ss;
while(s < ss) { while(s < ss) {
@ -206,7 +210,7 @@ main(int argc, char **argv)
if(argc < 2) if(argc < 2)
return !printf("usage: modal [-v] source.modal\n"); return !printf("usage: modal [-v] source.modal\n");
if(argc < 3 && argv[1][0] == '-' && argv[1][1] == 'v') if(argc < 3 && argv[1][0] == '-' && argv[1][1] == 'v')
return !printf("Modal Interpreter, 16 Apr 2024.\n"); return !printf("Modal Interpreter, 17 Apr 2024.\n");
if(!(f = fopen(argv[1], "r"))) if(!(f = fopen(argv[1], "r")))
return !fprintf(stderr, "Invalid Modal file: %s.\n", argv[1]); return !fprintf(stderr, "Invalid Modal file: %s.\n", argv[1]);
while(fread(&c, 1, 1, f)) { while(fread(&c, 1, 1, f)) {