unsigned int len;
};
+/*
+ * Debug helper function
+ */
+/*
+static void debug_print_transition (struct Transition *);
+
static void
debug_print_state (struct GNUNET_REGEX_State *s)
{
char *proof;
+ int i;
if (NULL == s->proof)
proof = "NULL";
"State %i: %s marked: %i accepting: %i scc_id: %i transitions: %i proof: %s\n",
s->id, s->name, s->marked, s->accepting, s->scc_id,
s->transition_count, proof);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Incoming transitions:\n");
+
+ for (i=0; i < s->incoming_transition_count; i++)
+ debug_print_transition (s->incoming_transitions[i]);
}
static void
for (t = s->transitions_head; NULL != t; t = t->next)
debug_print_transition (t);
}
+*/
/**
* Recursive function doing DFS with 'v' as a start, detecting all SCCs inside
}
}
}
- if (num_equal_edges == 0)
- {
- table[s1->marked][s2->marked] = -1;
- }
- else if (num_equal_edges != s1->transition_count ||
- num_equal_edges != s2->transition_count)
+ if (num_equal_edges != s1->transition_count ||
+ num_equal_edges != s2->transition_count)
{
// Make sure ALL edges of possible equal states are the same
table[s1->marked][s2->marked] = -2;
// Create proofs for all states
automaton_traverse (NULL, dfa, &state_create_proof);
-
return dfa;
}
int error;
const char *regex;
struct GNUNET_REGEX_Automaton *dfa;
- struct GNUNET_REGEX_Automaton *nfa;
error = 0;
- /*regex = "ab?|xy|(abcd)?"; */
- /*regex = "(ab|cd|ef)xy"; */
- /*regex = "(ac|bc)de"; */
- /*regex = "((a|b)c)de"; */
- /*regex = "a+X*y+c|p|R|Z*K*y*R+w|Y*6+n+h*k*w+V*F|W*B*e*"; */
regex = "ab(c|d)+c*(a(b|c)d)+";
- /*regex = "ab?(abcd)?"; */
- const char *regex1 = "(ac|bc)de";
- const char *regex2 = "((a|b)c)de";
- /*nfa = GNUNET_REGEX_construct_nfa (regex, strlen (regex)); */
- /*GNUNET_REGEX_automaton_save_graph (nfa, "nfa.dot"); */
dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex));
GNUNET_REGEX_automaton_save_graph (dfa, "dfa.dot");
GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, NULL);
GNUNET_REGEX_automaton_destroy (dfa);
- dfa = GNUNET_REGEX_construct_dfa (regex1, strlen (regex1));
- GNUNET_REGEX_automaton_save_graph (dfa, "dfa1.dot");
- GNUNET_REGEX_automaton_destroy (dfa);
- dfa = GNUNET_REGEX_construct_dfa (regex2, strlen (regex2));
- GNUNET_REGEX_automaton_save_graph (dfa, "dfa2.dot");
- GNUNET_REGEX_automaton_destroy (dfa);
return error;
}