diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-08-23 16:30:39 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-08-23 16:30:39 +0000 |
commit | 09f394f4f8fc77de47857adf9b8630136d930005 (patch) | |
tree | a461aacf16a90e371fb41360d2c6e3c2305c856a /src/regex/regex_internal.h | |
parent | 701f3aaab234871e99915e41a57cae14da9f4b09 (diff) | |
download | gnunet-09f394f4f8fc77de47857adf9b8630136d930005.tar.gz gnunet-09f394f4f8fc77de47857adf9b8630136d930005.zip |
- 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.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/regex/regex_internal.h b/src/regex/regex_internal.h index f96d51fb0..20e81d93c 100644 --- a/src/regex/regex_internal.h +++ b/src/regex/regex_internal.h | |||
@@ -257,6 +257,23 @@ struct GNUNET_REGEX_Automaton | |||
257 | 257 | ||
258 | 258 | ||
259 | /** | 259 | /** |
260 | * Function that get's passed to automaton traversal and is called before each | ||
261 | * next traversal from state 's' using transition 't' to check if traversal | ||
262 | * should proceed. Return GNUNET_NO to stop traversal or GNUNET_YES to continue. | ||
263 | * | ||
264 | * @param cls closure for the check. | ||
265 | * @param s current state in the traversal. | ||
266 | * @param t current transition from state 's' that will be used for the next | ||
267 | * step. | ||
268 | * | ||
269 | * @return GNUNET_YES to proceed traversal, GNUNET_NO to stop. | ||
270 | */ | ||
271 | typedef int (*GNUNET_REGEX_traverse_check) (void *cls, | ||
272 | struct GNUNET_REGEX_State * s, | ||
273 | struct GNUNET_REGEX_Transition * t); | ||
274 | |||
275 | |||
276 | /** | ||
260 | * Function that is called with each state, when traversing an automaton. | 277 | * Function that is called with each state, when traversing an automaton. |
261 | * | 278 | * |
262 | * @param cls closure. | 279 | * @param cls closure. |
@@ -275,16 +292,20 @@ typedef void (*GNUNET_REGEX_traverse_action) (void *cls, | |||
275 | * | 292 | * |
276 | * @param a automaton to be traversed. | 293 | * @param a automaton to be traversed. |
277 | * @param start start state, pass a->start or NULL to traverse the whole automaton. | 294 | * @param start start state, pass a->start or NULL to traverse the whole automaton. |
295 | * @param check function that is checked before advancing on each transition | ||
296 | * in the DFS. | ||
297 | * @param check_cls closure for check. | ||
278 | * @param action action to be performed on each state. | 298 | * @param action action to be performed on each state. |
279 | * @param action_cls closure for action | 299 | * @param action_cls closure for action |
280 | */ | 300 | */ |
281 | void | 301 | void |
282 | GNUNET_REGEX_automaton_traverse (const struct GNUNET_REGEX_Automaton *a, | 302 | GNUNET_REGEX_automaton_traverse (const struct GNUNET_REGEX_Automaton *a, |
283 | struct GNUNET_REGEX_State *start, | 303 | struct GNUNET_REGEX_State *start, |
304 | GNUNET_REGEX_traverse_check check, | ||
305 | void *check_cls, | ||
284 | GNUNET_REGEX_traverse_action action, | 306 | GNUNET_REGEX_traverse_action action, |
285 | void *action_cls); | 307 | void *action_cls); |
286 | 308 | ||
287 | |||
288 | /** | 309 | /** |
289 | * Get the canonical regex of the given automaton. | 310 | * Get the canonical regex of the given automaton. |
290 | * When constructing the automaton a proof is computed for each state, | 311 | * When constructing the automaton a proof is computed for each state, |