mips/masm/gen/log.c

29 lines
481 B
C
Raw Normal View History

2024-10-21 16:27:18 +00:00
#include "../gen.h"
void gen_output_expr(struct generator *gen, struct expr *expr)
{
int line = expr->line_no,
len = expr->byte_end - expr->byte_start,
nl = true,
c = EOF;
FILE *file = gen->parser.lexer.file;
fseek(file, expr->byte_start, SEEK_SET);
while (len--) {
c = getc(file);
if (c == EOF || c == '\0')
break;
if (nl) {
fprintf(stderr, "\t%d | ", line);
line++;
nl = false;
}
if (c == '\n')
nl = true;
putc(c, stderr);
}
}