summaryrefslogtreecommitdiff
path: root/csim/sim.c
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-03 20:41:22 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-03 20:41:22 +0100
commit1b32dfecc4fd1c9d9d024bb053c43ea17021cc65 (patch)
treea52a6527a6dd0f34f07f61c20b77b42c1d8ff720 /csim/sim.c
parent1ff268ab13dd299c4cdc1e379df5397bd6a394e3 (diff)
downloadSystDigit-Projet-1b32dfecc4fd1c9d9d024bb053c43ea17021cc65.tar.gz
SystDigit-Projet-1b32dfecc4fd1c9d9d024bb053c43ea17021cc65.zip
Monitor now works correctly.
Diffstat (limited to 'csim/sim.c')
-rw-r--r--csim/sim.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/csim/sim.c b/csim/sim.c
index f91ac75..1dd2791 100644
--- a/csim/sim.c
+++ b/csim/sim.c
@@ -61,6 +61,7 @@ void machine_banner(t_machine *m, FILE *stream) {
m->prog->vars[m->prog->inputs[i]].name);
}
fprintf(stream, "\n");
+ fflush(stream);
}
void read_inputs(t_machine *m, FILE *stream) {
@@ -80,6 +81,8 @@ void read_inputs(t_machine *m, FILE *stream) {
fscanf(stream, " ");
if (fscanf(stream, "/%lu", &(m->var_values[var]))) {
// ok, value is read
+ } else if (fscanf(stream, "x%lx", &(m->var_values[var]))) {
+ // ok, value is read
} else {
m->var_values[var] = read_bool(stream, NULL);
}
@@ -223,6 +226,7 @@ void write_outputs(t_machine *m, FILE *stream) {
fprintf(stream, "\t%ld\n", m->var_values[var]);
}
fprintf(stream, "\n");
+ fflush(stream);
}