We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Verified Commit 0185ae4d authored by Camil Staps's avatar Camil Staps 🚀

Minor improvements: show parse error in linker; pretty-print labels in instruction listings

parent e0e67fff
......@@ -58,8 +58,9 @@ int main(int argc, char **argv) {
parser.data_offset = g_data_offset;
code_next_module();
if (parse_program(&parser, &cp)) {
fprintf(stderr, "Could not parse '%s'.\n", input_file_names[i]);
int res;
if ((res=parse_program(&parser, &cp))!=0) {
fprintf(stderr, "Could not parse '%s' (%d).\n", input_file_names[i], res);
exit(1);
}
......
......@@ -325,6 +325,7 @@ unsigned int print_instruction(int to_stderr, struct program *pgm, uint32_t i) {
i++;
switch (*fmt) {
case 'l': /* Code label */
case 'C': /* CAF label */
print_label(_tmp, 256, 1, (BC_WORD*)pgm->code[i], pgm, NULL, 0);
WPRINTF(w, " %s", _tmp);
break;
......@@ -381,10 +382,14 @@ void print_code(WINDOW *w, struct program *pgm) {
# define WPRINTF(w,...) PRINTF(__VA_ARGS__);
void print_code(struct program *pgm) {
# endif
char label_name[128];
label_name[127]='\0';
uint32_t i;
for (i = 0; i < pgm->code_size; i++) {
if (pgm->code_symbols_matching[i]!=-1)
WPRINTF(w,"%s\n",pgm->symbol_table[pgm->code_symbols_matching[i]].name);
if (pgm->code_symbols_matching[i]!=-1) {
print_label_name(label_name,127,pgm->symbol_table[pgm->code_symbols_matching[i]].name);
WPRINTF(w,"%s\n",label_name);
}
i+=print_instruction(
# ifdef DEBUG_CURSES
w,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment