Skip to content

Commit

Permalink
vp20compiler: Forward comments from input to output
Browse files Browse the repository at this point in the history
  • Loading branch information
JayFoxRox authored and thrimbor committed Jul 13, 2019
1 parent 48c8a86 commit ab134c1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tools/vp20compiler/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,24 @@ void translate(const char* str)

// printf("num_instructions: %u\n", num_instructions);

const char* cur = str;
const char* end = &str[strlen(str) - 1];
while(cur < end) {

const char* lf = strchr(cur + 1, '\n');
const char* cr = strchr(cur + 1, '\r');
if (lf == NULL) { lf = end; }
if (cr == NULL) { cr = end; }
const char* line_end = (lf < cr ? lf : cr) + 1;

if (*cur == '#') {
printf("//%.*s\n", line_end - &cur[1] - 1, &cur[1]);
}

cur = line_end;

}

uint32_t vsh_buf[136*4];
memset(vsh_buf, 0, sizeof(vsh_buf));

Expand Down

0 comments on commit ab134c1

Please sign in to comment.