diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-08-17 10:03:56 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-08-17 10:03:56 +0000 |
commit | 39e159b2613be7460dd47bb5d290ac84dc3a9196 (patch) | |
tree | c2915a29c382399282afa8231fa935c3df1f32d7 /src/regex/regex_internal.h | |
parent | 2162464f34cff436c90e61bf967be0f0ec74d31e (diff) | |
download | gnunet-39e159b2613be7460dd47bb5d290ac84dc3a9196.tar.gz gnunet-39e159b2613be7460dd47bb5d290ac84dc3a9196.zip |
Added multi-striding capabilities to regex.
Diffstat (limited to 'src/regex/regex_internal.h')
-rw-r--r-- | src/regex/regex_internal.h | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/regex/regex_internal.h b/src/regex/regex_internal.h index 007870832..f96d51fb0 100644 --- a/src/regex/regex_internal.h +++ b/src/regex/regex_internal.h | |||
@@ -77,11 +77,6 @@ struct GNUNET_REGEX_Transition | |||
77 | * State from which this transition origins. | 77 | * State from which this transition origins. |
78 | */ | 78 | */ |
79 | struct GNUNET_REGEX_State *from_state; | 79 | struct GNUNET_REGEX_State *from_state; |
80 | |||
81 | /** | ||
82 | * Mark this transition. For example when reversing the automaton. | ||
83 | */ | ||
84 | int mark; | ||
85 | }; | 80 | }; |
86 | 81 | ||
87 | 82 | ||
@@ -106,6 +101,12 @@ struct GNUNET_REGEX_State | |||
106 | unsigned int id; | 101 | unsigned int id; |
107 | 102 | ||
108 | /** | 103 | /** |
104 | * Unique state id that is used for traversing the automaton. It is guaranteed | ||
105 | * to be > 0 and < state_count. | ||
106 | */ | ||
107 | unsigned int traversal_id; | ||
108 | |||
109 | /** | ||
109 | * If this is an accepting state or not. | 110 | * If this is an accepting state or not. |
110 | */ | 111 | */ |
111 | int accepting; | 112 | int accepting; |
@@ -152,9 +153,12 @@ struct GNUNET_REGEX_State | |||
152 | struct GNUNET_HashCode hash; | 153 | struct GNUNET_HashCode hash; |
153 | 154 | ||
154 | /** | 155 | /** |
155 | * State ID for proof creation. | 156 | * Linear state ID accquired by depth-first-search. This ID should be used for |
157 | * storing information about the state in an array, because the 'id' of the | ||
158 | * state is not guaranteed to be linear. The 'dfs_id' is guaranteed to be > 0 | ||
159 | * and < 'state_count'. | ||
156 | */ | 160 | */ |
157 | unsigned int proof_id; | 161 | unsigned int dfs_id; |
158 | 162 | ||
159 | /** | 163 | /** |
160 | * Proof for this state. | 164 | * Proof for this state. |
@@ -259,20 +263,24 @@ struct GNUNET_REGEX_Automaton | |||
259 | * @param count current count of the state, from 0 to a->state_count -1. | 263 | * @param count current count of the state, from 0 to a->state_count -1. |
260 | * @param s state. | 264 | * @param s state. |
261 | */ | 265 | */ |
262 | typedef void (*GNUNET_REGEX_traverse_action) (void *cls, unsigned int count, | 266 | typedef void (*GNUNET_REGEX_traverse_action) (void *cls, |
267 | const unsigned int count, | ||
263 | struct GNUNET_REGEX_State * s); | 268 | struct GNUNET_REGEX_State * s); |
264 | 269 | ||
265 | 270 | ||
266 | /** | 271 | /** |
267 | * Traverses the given automaton from it's start state, visiting all reachable | 272 | * Traverses the given automaton using depth-first-search (DFS) from it's start |
268 | * states and calling 'action' on each one of them. | 273 | * state, visiting all reachable states and calling 'action' on each one of |
274 | * them. | ||
269 | * | 275 | * |
270 | * @param a automaton. | 276 | * @param a automaton to be traversed. |
277 | * @param start start state, pass a->start or NULL to traverse the whole automaton. | ||
271 | * @param action action to be performed on each state. | 278 | * @param action action to be performed on each state. |
272 | * @param action_cls closure for action | 279 | * @param action_cls closure for action |
273 | */ | 280 | */ |
274 | void | 281 | void |
275 | GNUNET_REGEX_automaton_traverse (struct GNUNET_REGEX_Automaton *a, | 282 | GNUNET_REGEX_automaton_traverse (const struct GNUNET_REGEX_Automaton *a, |
283 | struct GNUNET_REGEX_State *start, | ||
276 | GNUNET_REGEX_traverse_action action, | 284 | GNUNET_REGEX_traverse_action action, |
277 | void *action_cls); | 285 | void *action_cls); |
278 | 286 | ||
@@ -321,6 +329,7 @@ GNUNET_REGEX_generate_random_regex (size_t rx_length, char *matching_str); | |||
321 | char * | 329 | char * |
322 | GNUNET_REGEX_generate_random_string (size_t max_len); | 330 | GNUNET_REGEX_generate_random_string (size_t max_len); |
323 | 331 | ||
332 | |||
324 | #if 0 /* keep Emacsens' auto-indent happy */ | 333 | #if 0 /* keep Emacsens' auto-indent happy */ |
325 | { | 334 | { |
326 | #endif | 335 | #endif |