executable dumps were always written to stdout. Now they can be written to any stream
This commit is contained in:
@@ -185,7 +185,7 @@ void Executable_Free(Executable *exe)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Executable_Dump(Executable *exe)
|
void Executable_Dump(Executable *exe, FILE *fp)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < exe->bodyl; i += 1)
|
for(int i = 0; i < exe->bodyl; i += 1)
|
||||||
{
|
{
|
||||||
@@ -197,7 +197,7 @@ void Executable_Dump(Executable *exe)
|
|||||||
|
|
||||||
const InstrInfo *info = Executable_GetInstrByOpcode(opcode);
|
const InstrInfo *info = Executable_GetInstrByOpcode(opcode);
|
||||||
|
|
||||||
fprintf(stderr, "%d: %s ", i, info->name);
|
fprintf(fp, "%d: %s ", i, info->name);
|
||||||
|
|
||||||
for(int j = 0; j < opc; j += 1)
|
for(int j = 0; j < opc; j += 1)
|
||||||
{
|
{
|
||||||
@@ -205,15 +205,15 @@ void Executable_Dump(Executable *exe)
|
|||||||
{
|
{
|
||||||
case OPTP_IDX:
|
case OPTP_IDX:
|
||||||
case OPTP_INT:
|
case OPTP_INT:
|
||||||
fprintf(stderr, "%lld ", ops[j].as_int);
|
fprintf(fp, "%lld ", ops[j].as_int);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPTP_FLOAT:
|
case OPTP_FLOAT:
|
||||||
fprintf(stderr, "%f ", ops[j].as_float);
|
fprintf(fp, "%f ", ops[j].as_float);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPTP_STRING:
|
case OPTP_STRING:
|
||||||
fprintf(stderr, "[%s] ", ops[j].as_string);
|
fprintf(fp, "[%s] ", ops[j].as_string);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPTP_PROMISE:
|
case OPTP_PROMISE:
|
||||||
@@ -222,7 +222,7 @@ void Executable_Dump(Executable *exe)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ typedef struct xExeBuilder ExeBuilder;
|
|||||||
|
|
||||||
Executable *Executable_Copy(Executable *exe);
|
Executable *Executable_Copy(Executable *exe);
|
||||||
void Executable_Free(Executable *exe);
|
void Executable_Free(Executable *exe);
|
||||||
void Executable_Dump(Executable *exe);
|
void Executable_Dump(Executable *exe, FILE *fp);
|
||||||
_Bool Executable_Equiv(Executable *exe1, Executable *exe2, FILE *log, const char *log_prefix);
|
_Bool Executable_Equiv(Executable *exe1, Executable *exe2, FILE *log, const char *log_prefix);
|
||||||
_Bool Executable_Fetch(Executable *exe, int index, Opcode *opcode, Operand *ops, int *opc);
|
_Bool Executable_Fetch(Executable *exe, int index, Opcode *opcode, Operand *ops, int *opc);
|
||||||
_Bool Executable_SetSource(Executable *exe, Source *src);
|
_Bool Executable_SetSource(Executable *exe, Source *src);
|
||||||
|
|||||||
+1
-1
@@ -117,7 +117,7 @@ static _Bool disassemble(Source *src)
|
|||||||
{
|
{
|
||||||
Executable *exe = compile_source_and_print_error_on_failure(src);
|
Executable *exe = compile_source_and_print_error_on_failure(src);
|
||||||
if(exe == NULL) return 0;
|
if(exe == NULL) return 0;
|
||||||
Executable_Dump(exe);
|
Executable_Dump(exe, stdout);
|
||||||
Executable_Free(exe);
|
Executable_Free(exe);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user