aboutsummaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
authorMaximilian Szengel <gnunet@maxsz.de>2012-04-18 09:30:06 +0000
committerMaximilian Szengel <gnunet@maxsz.de>2012-04-18 09:30:06 +0000
commita5146a4cbe70177d9110553072d605ba151867be (patch)
treef6b5b90167fa4a930fc89412f316474bc3896ef1 /src/regex
parent76b03048616812cf8f538b217ac4c4dbee1484cb (diff)
downloadgnunet-a5146a4cbe70177d9110553072d605ba151867be.tar.gz
gnunet-a5146a4cbe70177d9110553072d605ba151867be.zip
added accepting state info to api
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/regex.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/regex/regex.c b/src/regex/regex.c
index e9b262f95..51ceab26a 100644
--- a/src/regex/regex.c
+++ b/src/regex/regex.c
@@ -663,14 +663,15 @@ automaton_add_state (struct GNUNET_REGEX_Automaton *a,
663 a->state_count++; 663 a->state_count++;
664} 664}
665 665
666typedef void (*GNUNET_REGEX_traverse_action)(void *cls, struct 666typedef void (*GNUNET_REGEX_traverse_action) (void *cls,
667 GNUNET_REGEX_State *s); 667 struct GNUNET_REGEX_State * s);
668 668
669/** 669/**
670 * Traverses all states that are reachable from state 's'. Expects 670 * Traverses all states that are reachable from state 's'. Expects
671 * the states to be unmarked (s->marked == GNUNET_NO). Performs 671 * the states to be unmarked (s->marked == GNUNET_NO). Performs
672 * 'action' on each visited state. 672 * 'action' on each visited state.
673 * 673 *
674 * @param cls closure.
674 * @param s start state. 675 * @param s start state.
675 * @param action action to be performed on each state. 676 * @param action action to be performed on each state.
676 */ 677 */
@@ -696,6 +697,7 @@ automaton_state_traverse (void *cls, struct GNUNET_REGEX_State *s,
696 * Traverses the given automaton from it's start state, visiting all 697 * Traverses the given automaton from it's start state, visiting all
697 * reachable states and calling 'action' on each one of them. 698 * reachable states and calling 'action' on each one of them.
698 * 699 *
700 * @param cls closure.
699 * @param a automaton. 701 * @param a automaton.
700 * @param action action to be performed on each state. 702 * @param action action to be performed on each state.
701 */ 703 */
@@ -1188,8 +1190,7 @@ nfa_closure_create (struct GNUNET_REGEX_Automaton *nfa,
1188 */ 1190 */
1189static struct GNUNET_REGEX_StateSet * 1191static struct GNUNET_REGEX_StateSet *
1190nfa_closure_set_create (struct GNUNET_REGEX_Automaton *nfa, 1192nfa_closure_set_create (struct GNUNET_REGEX_Automaton *nfa,
1191 struct GNUNET_REGEX_StateSet *states, 1193 struct GNUNET_REGEX_StateSet *states, const char label)
1192 const char label)
1193{ 1194{
1194 struct GNUNET_REGEX_State *s; 1195 struct GNUNET_REGEX_State *s;
1195 struct GNUNET_REGEX_StateSet *sset; 1196 struct GNUNET_REGEX_StateSet *sset;
@@ -1953,9 +1954,8 @@ GNUNET_REGEX_eval (struct GNUNET_REGEX_Automaton *a, const char *string)
1953 * to construct the key 1954 * to construct the key
1954 */ 1955 */
1955unsigned int 1956unsigned int
1956GNUNET_REGEX_get_first_key (const char *input_string, 1957GNUNET_REGEX_get_first_key (const char *input_string, unsigned int string_len,
1957 unsigned int string_len, 1958 GNUNET_HashCode * key)
1958 GNUNET_HashCode *key)
1959{ 1959{
1960 unsigned int size; 1960 unsigned int size;
1961 1961
@@ -1981,8 +1981,7 @@ GNUNET_REGEX_get_first_key (const char *input_string,
1981 * @return GNUNET_OK if the proof is valid for the given key 1981 * @return GNUNET_OK if the proof is valid for the given key
1982 */ 1982 */
1983int 1983int
1984GNUNET_REGEX_check_proof (const char *proof, 1984GNUNET_REGEX_check_proof (const char *proof, const GNUNET_HashCode * key)
1985 const GNUNET_HashCode *key)
1986{ 1985{
1987 return GNUNET_OK; 1986 return GNUNET_OK;
1988} 1987}
@@ -2027,8 +2026,7 @@ state_get_edges (struct GNUNET_REGEX_State *s, struct GNUNET_REGEX_Edge *edges)
2027 * @param iterator_cls closure. 2026 * @param iterator_cls closure.
2028 */ 2027 */
2029static void 2028static void
2030iterate_edge (struct GNUNET_REGEX_State *s, 2029iterate_edge (struct GNUNET_REGEX_State *s, GNUNET_REGEX_KeyIterator iterator,
2031 GNUNET_REGEX_KeyIterator iterator,
2032 void *iterator_cls) 2030 void *iterator_cls)
2033{ 2031{
2034 struct Transition *t; 2032 struct Transition *t;
@@ -2041,12 +2039,7 @@ iterate_edge (struct GNUNET_REGEX_State *s,
2041 2039
2042 num_edges = state_get_edges (s, edges); 2040 num_edges = state_get_edges (s, edges);
2043 2041
2044 iterator (iterator_cls, 2042 iterator (iterator_cls, &s->hash, NULL, s->accepting, num_edges, edges);
2045 &s->hash,
2046 NULL,
2047
2048 num_edges,
2049 edges);
2050 2043
2051 2044
2052 for (t = s->transitions_head; NULL != t; t = t->next) 2045 for (t = s->transitions_head; NULL != t; t = t->next)