From: Aaron Taylor Date: Wed, 7 Aug 2019 19:40:14 +0000 (-0700) Subject: Fixed bug in compiler related to pushing ASCII strings to the stack. X-Git-Url: http://git.subgeniuskitty.com/vvhitespace/.git/commitdiff_plain/971552ffb5ecc3962d54b909f91527ac0e42a2b9?hp=75098baa04f129944fb6d4fc2b4b4e863d49410b Fixed bug in compiler related to pushing ASCII strings to the stack. The stream pointer was left at the start of the string since it was walked backward. Now it properly advances to the end after processing the string. --- diff --git a/vv_compiler.c b/vv_compiler.c index e53f70d..988eee9 100644 --- a/vv_compiler.c +++ b/vv_compiler.c @@ -26,8 +26,8 @@ print_usage(char ** argv) } /* Builds an ASCII string on the stack using VVS PUSH_IMMEDIATE commands. */ -/* The syntax: A"test" results in six PUSH_IMMEDIATE commands for the four */ -/* letters, newline, and null-terminator. */ +/* The syntax: A"test" results in five PUSH_IMMEDIATE commands for the four */ +/* letters, and null-terminator. */ /* Expects 'input' to present a double-quoted ('"') ASCII string. */ /* The 'A' has already been chomped. */ void @@ -65,6 +65,9 @@ parse_ascii_string(FILE * input, FILE * output) fseek(input, -2, SEEK_CUR); fread(&temp_byte, 1, 1, input); } + + /* Advance the stream pointer to the end of the string before returning. */ + for (fread(&temp_byte,1,1,input); temp_byte != '"'; fread(&temp_byte,1,1,input)) continue; } int