[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/8] cex: make sure traces go to stderr
From: |
Akim Demaille |
Subject: |
[PATCH 3/8] cex: make sure traces go to stderr |
Date: |
Sun, 14 Jun 2020 10:24:57 +0200 |
* src/parse-simulation.h, src/parse-simulation.c (print_parse_state):
here.
---
src/counterexample.c | 1 +
src/parse-simulation.c | 17 +++++++++--------
src/parse-simulation.h | 1 +
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/counterexample.c b/src/counterexample.c
index 47ff53e5..2668e621 100644
--- a/src/counterexample.c
+++ b/src/counterexample.c
@@ -561,6 +561,7 @@ search_state_free (search_state *ss)
free (ss);
}
+/* For debugging traces. */
static void
search_state_print (search_state *ss)
{
diff --git a/src/parse-simulation.c b/src/parse-simulation.c
index e439360d..098e4e70 100644
--- a/src/parse-simulation.c
+++ b/src/parse-simulation.c
@@ -572,7 +572,7 @@ simulate_reduction (parse_state *ps, int rule_len, bitset
symbol_set)
gl_list_t
parser_prepend (parse_state *ps)
{
- gl_list_t result = parse_state_list_new ();
+ gl_list_t res = parse_state_list_new ();
const state_item *head = ps->state_items.head_elt;
symbol_number prepend_sym =
item_number_as_symbol_number (*(head->item - 1));
@@ -584,19 +584,20 @@ parser_prepend (parse_state *ps)
ps_si_prepend (copy, state_items + sin);
if (SI_TRANSITION (head))
ps_derivs_prepend (copy, derivation_new_leaf (prepend_sym));
- parse_state_list_append (result, copy);
+ parse_state_list_append (res, copy);
}
- return result;
+ return res;
}
void
print_parse_state (parse_state *ps)
{
- printf ("(size %zu depth %d rc %d)\n",
+ FILE *out = stderr;
+ fprintf (out, "(size %zu depth %d rc %d)\n",
ps->state_items.total_size, ps->depth, ps->reference_count);
- print_state_item (ps->state_items.head_elt, stdout);
- print_state_item (ps->state_items.tail_elt, stdout);
+ print_state_item (ps->state_items.head_elt, out);
+ print_state_item (ps->state_items.tail_elt, out);
if (ps->derivs.total_size > 0)
- derivation_print (ps->derivs.head_elt, stdout);
- putc ('\n', stdout);
+ derivation_print (ps->derivs.head_elt, out);
+ putc ('\n', out);
}
diff --git a/src/parse-simulation.h b/src/parse-simulation.h
index 2e49d769..ff759e37 100644
--- a/src/parse-simulation.h
+++ b/src/parse-simulation.h
@@ -140,6 +140,7 @@ parse_state_list simulate_reduction (parse_state *ps, int
rule_len,
* transition or production step to ps's head. */
parse_state_list parser_prepend (parse_state *ps);
+/* For debugging traces. */
void print_parse_state (parse_state *ps);
#endif /* PARSE_SIMULATION_H */
--
2.27.0
- [PATCH 0/8] cex: show counterexamples in the reports, Akim Demaille, 2020/06/14
- [PATCH 1/8] style: more uses of const, Akim Demaille, 2020/06/14
- [PATCH 2/8] cex: add an argument to the reporting functions to specify the stream, Akim Demaille, 2020/06/14
- [PATCH 3/8] cex: make sure traces go to stderr,
Akim Demaille <=
- [PATCH 4/8] cex: don't report the items, Akim Demaille, 2020/06/14
- [PATCH 5/8] cex: indent the diagnostics to highlight the structure, Akim Demaille, 2020/06/14
- [PATCH 6/8] cex: also include the counterexamples in the report, Akim Demaille, 2020/06/14
- [PATCH 7/8] cex: also include in the report on --report=counterexamples, Akim Demaille, 2020/06/14
- [PATCH 8/8] cex: factor the definition of "•", Akim Demaille, 2020/06/14
- Re: [PATCH 0/8] cex: show counterexamples in the reports, Akim Demaille, 2020/06/16