#include "gnunet_regex_lib.h"
#include "regex_internal.h"
+/**
+ * Regex initial padding.
+ */
#define INITIAL_PADDING "PADPADPADPADPADP"
+
+/**
+ * Set to GNUNET_YES to save a debug graph.
+ */
#define GNUNET_REGEX_ITERATE_SAVE_DEBUG_GRAPH GNUNET_NO
static unsigned int transition_counter;
char *strings[20];
};
-void
+
+static void
key_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof,
int accepting, unsigned int num_edges,
const struct GNUNET_REGEX_Edge *edges)
char *out_str;
char *state_id = GNUNET_strdup (GNUNET_h2s (key));
+ GNUNET_assert (NULL != proof);
if (GNUNET_YES == ctx->should_save_graph)
{
if (GNUNET_YES == accepting)
rxstr[i].regex);
- // Create graph
+ /* Create graph */
if (GNUNET_YES == GNUNET_REGEX_ITERATE_SAVE_DEBUG_GRAPH)
{
GNUNET_asprintf (&filename, "iteration_graph_%u.dot", i);
ctx.graph_filep = NULL;
}
- // Iterate over DFA edges
+ /* Iterate over DFA edges */
transition_counter = 0;
ctx.string_count = rxstr[i].string_count;
ctx.strings = rxstr[i].strings;
ctx.match_count = 0;
- dfa = GNUNET_REGEX_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex));
+ dfa =
+ GNUNET_REGEX_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0);
GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, &ctx);
num_transitions =
GNUNET_REGEX_get_transition_count (dfa) - dfa->start->transition_count;
GNUNET_REGEX_automaton_destroy (dfa);
- // Finish graph
+ /* Finish graph */
if (GNUNET_YES == ctx.should_save_graph)
{
fwrite (graph_end_str, strlen (graph_end_str), 1, ctx.graph_filep);
ctx.strings = rxstr[i].strings;
ctx.match_count = 0;
- dfa = GNUNET_REGEX_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex));
+ dfa =
+ GNUNET_REGEX_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0);
GNUNET_REGEX_dfa_add_multi_strides (NULL, dfa, 2);
GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, &ctx);