aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex_internal.h
diff options
context:
space:
mode:
authorMaximilian Szengel <gnunet@maxsz.de>2012-08-23 16:30:39 +0000
committerMaximilian Szengel <gnunet@maxsz.de>2012-08-23 16:30:39 +0000
commit09f394f4f8fc77de47857adf9b8630136d930005 (patch)
treea461aacf16a90e371fb41360d2c6e3c2305c856a /src/regex/regex_internal.h
parent701f3aaab234871e99915e41a57cae14da9f4b09 (diff)
- added check for automaton traversal
- fixed a bug that caused nfa's state_count to be incorrect for certain regexes - only compute scc's when coloring option is set
Diffstat (limited to 'src/regex/regex_internal.h')
-rw-r--r--src/regex/regex_internal.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/regex/regex_internal.h b/src/regex/regex_internal.h
index f96d51fb09..20e81d93cd 100644
--- a/src/regex/regex_internal.h
+++ b/src/regex/regex_internal.h
@@ -257,6 +257,23 @@ struct GNUNET_REGEX_Automaton
/**
+ * Function that get's passed to automaton traversal and is called before each
+ * next traversal from state 's' using transition 't' to check if traversal
+ * should proceed. Return GNUNET_NO to stop traversal or GNUNET_YES to continue.
+ *
+ * @param cls closure for the check.
+ * @param s current state in the traversal.
+ * @param t current transition from state 's' that will be used for the next
+ * step.
+ *
+ * @return GNUNET_YES to proceed traversal, GNUNET_NO to stop.
+ */
+typedef int (*GNUNET_REGEX_traverse_check) (void *cls,
+ struct GNUNET_REGEX_State * s,
+ struct GNUNET_REGEX_Transition * t);
+
+
+/**
* Function that is called with each state, when traversing an automaton.
*
* @param cls closure.
@@ -275,16 +292,20 @@ typedef void (*GNUNET_REGEX_traverse_action) (void *cls,
*
* @param a automaton to be traversed.
* @param start start state, pass a->start or NULL to traverse the whole automaton.
+ * @param check function that is checked before advancing on each transition
+ * in the DFS.
+ * @param check_cls closure for check.
* @param action action to be performed on each state.
* @param action_cls closure for action
*/
void
GNUNET_REGEX_automaton_traverse (const struct GNUNET_REGEX_Automaton *a,
struct GNUNET_REGEX_State *start,
+ GNUNET_REGEX_traverse_check check,
+ void *check_cls,
GNUNET_REGEX_traverse_action action,
void *action_cls);
-
/**
* Get the canonical regex of the given automaton.
* When constructing the automaton a proof is computed for each state,