aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-20 09:02:43 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-20 09:02:43 +0000
commit566b7539fcaf9c455da665cb641016d2cfbb1b47 (patch)
treeeb12baa08d99313d6da7eb8c1be17c5e447f1586
parentde9409f80dbfc5cc61a28316b271600e9da95cdc (diff)
renaming symbols from libgnunetregextest to have the prefix REGEX_TEST
-rw-r--r--src/regex/Makefile.am2
-rw-r--r--src/regex/gnunet-daemon-regexprofiler.c14
-rw-r--r--src/regex/gnunet-regex-profiler.c8
-rw-r--r--src/regex/gnunet-regex-simulation-profiler.c10
-rw-r--r--src/regex/gnunet-service-regex.c14
-rw-r--r--src/regex/perf-regex.c18
-rw-r--r--src/regex/plugin_block_regex.c4
-rw-r--r--src/regex/regex_block_lib.c8
-rw-r--r--src/regex/regex_block_lib.h8
-rw-r--r--src/regex/regex_internal.c454
-rw-r--r--src/regex/regex_internal.h96
-rw-r--r--src/regex/regex_internal_dht.c66
-rw-r--r--src/regex/regex_internal_lib.h68
-rw-r--r--src/regex/regex_test_graph.c42
-rw-r--r--src/regex/regex_test_lib.c10
-rw-r--r--src/regex/regex_test_lib.h32
-rw-r--r--src/regex/regex_test_random.c4
-rw-r--r--src/regex/test_regex_eval_api.c42
-rw-r--r--src/regex/test_regex_graph_api.c72
-rw-r--r--src/regex/test_regex_iterate_api.c26
-rw-r--r--src/regex/test_regex_proofs.c32
21 files changed, 514 insertions, 516 deletions
diff --git a/src/regex/Makefile.am b/src/regex/Makefile.am
index 34ef90ca0e..e1c41d91ef 100644
--- a/src/regex/Makefile.am
+++ b/src/regex/Makefile.am
@@ -31,8 +31,6 @@ gnunet_service_regex_LDADD = -lm \
$(GN_LIBINTL)
gnunet_service_regex_DEPENDENCIES = \
libgnunetregex_internal.a
-# todo: link files from libgnunetregex statically into gnunet_service_regex,
-# rename API prefix to avoid collision with 'libgnunetregexnew'...
noinst_LIBRARIES = \
libgnunetregex_internal.a \
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c
index 6a61aa6f00..3f4dd087fd 100644
--- a/src/regex/gnunet-daemon-regexprofiler.c
+++ b/src/regex/gnunet-daemon-regexprofiler.c
@@ -57,7 +57,7 @@ static struct GNUNET_DHT_Handle *dht_handle;
/**
* Peer's regex announce handle.
*/
-static struct REGEX_ITERNAL_Announcement *announce_handle;
+static struct REGEX_INTERNAL_Announcement *announce_handle;
/**
* Periodically reannounce regex.
@@ -109,7 +109,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (NULL != announce_handle)
{
- REGEX_ITERNAL_announce_cancel (announce_handle);
+ REGEX_INTERNAL_announce_cancel (announce_handle);
announce_handle = NULL;
}
@@ -160,7 +160,7 @@ reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
"First time, creating regex: %s\n",
regex);
memset (&id, 0, sizeof (struct GNUNET_PeerIdentity));
- announce_handle = REGEX_ITERNAL_announce (dht_handle,
+ announce_handle = REGEX_INTERNAL_announce (dht_handle,
&id,
regex,
(unsigned int) max_path_compression,
@@ -169,7 +169,7 @@ reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
else
{
GNUNET_assert (NULL != announce_handle);
- REGEX_ITERNAL_reannounce (announce_handle);
+ REGEX_INTERNAL_reannounce (announce_handle);
}
random_delay =
@@ -330,7 +330,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
/* Read regexes from policy files */
GNUNET_assert (-1 != GNUNET_DISK_directory_scan (policy_dir, &scan,
(void *) (long) peer_id));
- if (NULL == (components = REGEX_ITERNAL_read_from_file (policy_filename)))
+ if (NULL == (components = REGEX_TEST_read_from_file (policy_filename)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Policy file %s contains no policies. Exiting.\n",
@@ -339,8 +339,8 @@ run (void *cls, char *const *args GNUNET_UNUSED,
GNUNET_SCHEDULER_shutdown ();
return;
}
- regex = REGEX_ITERNAL_combine (components);
- REGEX_ITERNAL_free_from_file (components);
+ regex = REGEX_TEST_combine (components);
+ REGEX_TEST_free_from_file (components);
/* Announcing regexes from policy_filename */
GNUNET_asprintf (&rx_with_pfx, "%s(%s)(0|1)*", regex_prefix, regex);
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c
index e6f35a6f40..cb257df498 100644
--- a/src/regex/gnunet-regex-profiler.c
+++ b/src/regex/gnunet-regex-profiler.c
@@ -150,7 +150,7 @@ struct RegexPeer
/**
* Handle to a running regex search.
*/
- struct REGEX_ITERNAL_Search *search_handle;
+ struct REGEX_INTERNAL_Search *search_handle;
/**
* Testbed operation handle for DHT.
@@ -702,7 +702,7 @@ find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
* Method called when we've found a peer that announced a regex
* that matches our search string. Now get the statistics.
*
- * @param cls Closure provided in REGEX_ITERNAL_search.
+ * @param cls Closure provided in REGEX_INTERNAL_search.
* @param id Peer providing a regex that matches the string.
* @param get_path Path of the get request.
* @param get_path_length Lenght of get_path.
@@ -1039,7 +1039,7 @@ dht_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
GNUNET_assert (peer->dht_handle == ca_result);
peer->search_str_matched = GNUNET_NO;
- peer->search_handle = REGEX_ITERNAL_search (peer->dht_handle,
+ peer->search_handle = REGEX_INTERNAL_search (peer->dht_handle,
peer->search_str,
&regex_found_handler, peer,
NULL);
@@ -1081,7 +1081,7 @@ dht_da (void *cls, void *op_result)
if (NULL != peer->search_handle)
{
- REGEX_ITERNAL_search_cancel (peer->search_handle);
+ REGEX_INTERNAL_search_cancel (peer->search_handle);
peer->search_handle = NULL;
}
diff --git a/src/regex/gnunet-regex-simulation-profiler.c b/src/regex/gnunet-regex-simulation-profiler.c
index b3d1ff8737..dcb6c02f69 100644
--- a/src/regex/gnunet-regex-simulation-profiler.c
+++ b/src/regex/gnunet-regex-simulation-profiler.c
@@ -335,7 +335,7 @@ return_ok (void *cls, unsigned int num_values, MYSQL_BIND * values)
static void
regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof,
int accepting, unsigned int num_edges,
- const struct REGEX_ITERNAL_Edge *edges)
+ const struct REGEX_INTERNAL_Edge *edges)
{
unsigned int i;
int result;
@@ -460,10 +460,10 @@ regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof,
static int
announce_regex (const char *regex)
{
- struct REGEX_ITERNAL_Automaton *dfa;
+ struct REGEX_INTERNAL_Automaton *dfa;
dfa =
- REGEX_ITERNAL_construct_dfa (regex, strlen (regex), max_path_compression);
+ REGEX_INTERNAL_construct_dfa (regex, strlen (regex), max_path_compression);
if (NULL == dfa)
{
@@ -473,9 +473,9 @@ announce_regex (const char *regex)
return GNUNET_SYSERR;
}
- REGEX_ITERNAL_iterate_all_edges (dfa, &regex_iterator, NULL);
+ REGEX_INTERNAL_iterate_all_edges (dfa, &regex_iterator, NULL);
- REGEX_ITERNAL_automaton_destroy (dfa);
+ REGEX_INTERNAL_automaton_destroy (dfa);
return GNUNET_OK;
}
diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c
index f0a39a3614..697b04a36b 100644
--- a/src/regex/gnunet-service-regex.c
+++ b/src/regex/gnunet-service-regex.c
@@ -54,12 +54,12 @@ struct ClientEntry
/**
* Search handle (if this client is searching).
*/
- struct REGEX_ITERNAL_Search *sh;
+ struct REGEX_INTERNAL_Search *sh;
/**
* Announcement handle (if this client is announcing).
*/
- struct REGEX_ITERNAL_Announcement *ah;
+ struct REGEX_INTERNAL_Announcement *ah;
/**
* Refresh frequency for announcements.
@@ -143,12 +143,12 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
}
if (NULL != ce->ah)
{
- REGEX_ITERNAL_announce_cancel (ce->ah);
+ REGEX_INTERNAL_announce_cancel (ce->ah);
ce->ah = NULL;
}
if (NULL != ce->sh)
{
- REGEX_ITERNAL_search_cancel (ce->sh);
+ REGEX_INTERNAL_search_cancel (ce->sh);
ce->sh = NULL;
}
GNUNET_CONTAINER_DLL_remove (client_head, client_tail, ce);
@@ -171,7 +171,7 @@ reannounce (void *cls,
{
struct ClientEntry *ce = cls;
- REGEX_ITERNAL_reannounce (ce->ah);
+ REGEX_INTERNAL_reannounce (ce->ah);
ce->refresh_task = GNUNET_SCHEDULER_add_delayed (ce->frequency,
&reannounce,
ce);
@@ -207,7 +207,7 @@ handle_announce (void *cls,
}
ce = GNUNET_new (struct ClientEntry);
ce->client = client;
- ce->ah = REGEX_ITERNAL_announce (dht,
+ ce->ah = REGEX_INTERNAL_announce (dht,
&am->pid,
regex,
ntohs (am->compression),
@@ -311,7 +311,7 @@ handle_search (void *cls,
}
ce = GNUNET_new (struct ClientEntry);
ce->client = client;
- ce->sh = REGEX_ITERNAL_search (dht,
+ ce->sh = REGEX_INTERNAL_search (dht,
string,
&handle_search_result,
ce,
diff --git a/src/regex/perf-regex.c b/src/regex/perf-regex.c
index 210b16b814..bc723b6cb3 100644
--- a/src/regex/perf-regex.c
+++ b/src/regex/perf-regex.c
@@ -53,7 +53,7 @@ iter (void *cls,
const char *proof,
int accepting,
unsigned int num_edges,
- const struct REGEX_ITERNAL_Edge *edges)
+ const struct REGEX_INTERNAL_Edge *edges)
{
unsigned int i;
@@ -66,9 +66,9 @@ iter (void *cls,
}
static void
-print_dfa (struct REGEX_ITERNAL_Automaton* dfa)
+print_dfa (struct REGEX_INTERNAL_Automaton* dfa)
{
- REGEX_ITERNAL_iterate_all_edges (dfa, iter, NULL);
+ REGEX_INTERNAL_iterate_all_edges (dfa, iter, NULL);
}
/**
@@ -84,7 +84,7 @@ print_dfa (struct REGEX_ITERNAL_Automaton* dfa)
int
main (int argc, char *const *argv)
{
- struct REGEX_ITERNAL_Automaton* dfa;
+ struct REGEX_INTERNAL_Automaton* dfa;
char **regexes;
char *buffer;
char *regex;
@@ -98,14 +98,14 @@ main (int argc, char *const *argv)
usage();
return 1;
}
- regexes = REGEX_ITERNAL_read_from_file (argv[1]);
+ regexes = REGEX_TEST_read_from_file (argv[1]);
if (NULL == regexes)
{
usage();
return 2;
}
- buffer = REGEX_ITERNAL_combine (regexes);
+ buffer = REGEX_TEST_combine (regexes);
GNUNET_asprintf (&regex, "GNVPN-0001-PAD(%s)(0|1)*", buffer);
size = strlen (regex);
@@ -114,11 +114,11 @@ main (int argc, char *const *argv)
// return 0;
compression = atoi (argv[2]);
- dfa = REGEX_ITERNAL_construct_dfa (regex, size, compression);
+ dfa = REGEX_INTERNAL_construct_dfa (regex, size, compression);
print_dfa (dfa);
- REGEX_ITERNAL_automaton_destroy (dfa);
+ REGEX_INTERNAL_automaton_destroy (dfa);
GNUNET_free (buffer);
- REGEX_ITERNAL_free_from_file (regexes);
+ REGEX_TEST_free_from_file (regexes);
GNUNET_free (regex);
return 0;
}
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index 43e59ea8cc..82341813e5 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -107,10 +107,10 @@ evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Block with no xquery\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " key: %s, %u edges\n",
GNUNET_h2s (&rblock->key), ntohl (rblock->n_edges));
- REGEX_ITERNAL_block_iterate (rblock, reply_block_size, &rdebug, NULL);
+ REGEX_INTERNAL_block_iterate (rblock, reply_block_size, &rdebug, NULL);
return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
}
- switch (REGEX_ITERNAL_block_check (reply_block,
+ switch (REGEX_INTERNAL_block_check (reply_block,
reply_block_size,
xquery))
{
diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c
index 383cf56262..63b673fbe8 100644
--- a/src/regex/regex_block_lib.c
+++ b/src/regex/regex_block_lib.c
@@ -92,7 +92,7 @@ check_edge (void *cls,
int
-REGEX_ITERNAL_block_check (const struct RegexBlock *block,
+REGEX_INTERNAL_block_check (const struct RegexBlock *block,
size_t size,
const char *xquery)
{
@@ -109,7 +109,7 @@ REGEX_ITERNAL_block_check (const struct RegexBlock *block,
ctx.xquery = xquery;
ctx.found = GNUNET_NO;
ctx.key = GNUNET_strdup (GNUNET_h2s (&block->key));
- res = REGEX_ITERNAL_block_iterate (block, size, &check_edge, &ctx);
+ res = REGEX_INTERNAL_block_iterate (block, size, &check_edge, &ctx);
GNUNET_free (ctx.key);
if (GNUNET_SYSERR == res)
return GNUNET_SYSERR;
@@ -120,9 +120,9 @@ REGEX_ITERNAL_block_check (const struct RegexBlock *block,
int
-REGEX_ITERNAL_block_iterate (const struct RegexBlock *block,
+REGEX_INTERNAL_block_iterate (const struct RegexBlock *block,
size_t size,
- REGEX_ITERNAL_EgdeIterator iterator,
+ REGEX_INTERNAL_EgdeIterator iterator,
void *iter_cls)
{
struct RegexEdge *edge;
diff --git a/src/regex/regex_block_lib.h b/src/regex/regex_block_lib.h
index 2ef7ef30c1..a6c5392291 100644
--- a/src/regex/regex_block_lib.h
+++ b/src/regex/regex_block_lib.h
@@ -52,7 +52,7 @@ extern "C"
* GNUNET_SYSERR if the block is invalid.
*/
int
-REGEX_ITERNAL_block_check (const struct RegexBlock *block,
+REGEX_INTERNAL_block_check (const struct RegexBlock *block,
size_t size,
const char *xquery);
@@ -66,7 +66,7 @@ REGEX_ITERNAL_block_check (const struct RegexBlock *block,
*
* @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise.
*/
-typedef int (*REGEX_ITERNAL_EgdeIterator)(void *cls,
+typedef int (*REGEX_INTERNAL_EgdeIterator)(void *cls,
const char *token,
size_t len,
const struct GNUNET_HashCode *key);
@@ -89,9 +89,9 @@ typedef int (*REGEX_ITERNAL_EgdeIterator)(void *cls,
* be errors in further edges.
*/
int
-REGEX_ITERNAL_block_iterate (const struct RegexBlock *block,
+REGEX_INTERNAL_block_iterate (const struct RegexBlock *block,
size_t size,
- REGEX_ITERNAL_EgdeIterator iterator,
+ REGEX_INTERNAL_EgdeIterator iterator,
void *iter_cls);
#if 0 /* keep Emacsens' auto-indent happy */
diff --git a/src/regex/regex_internal.c b/src/regex/regex_internal.c
index e668351346..6fda695a7b 100644
--- a/src/regex/regex_internal.c
+++ b/src/regex/regex_internal.c
@@ -39,17 +39,17 @@
/**
* Set of states using MDLL API.
*/
-struct REGEX_ITERNAL_StateSet_MDLL
+struct REGEX_INTERNAL_StateSet_MDLL
{
/**
* MDLL of states.
*/
- struct REGEX_ITERNAL_State *head;
+ struct REGEX_INTERNAL_State *head;
/**
* MDLL of states.
*/
- struct REGEX_ITERNAL_State *tail;
+ struct REGEX_INTERNAL_State *tail;
/**
* Length of the MDLL.
@@ -65,8 +65,8 @@ struct REGEX_ITERNAL_StateSet_MDLL
* @param state state to be appended
*/
static void
-state_set_append (struct REGEX_ITERNAL_StateSet *set,
- struct REGEX_ITERNAL_State *state)
+state_set_append (struct REGEX_INTERNAL_StateSet *set,
+ struct REGEX_INTERNAL_State *state)
{
if (set->off == set->size)
GNUNET_array_grow (set->states, set->size, set->size * 2 + 4);
@@ -104,12 +104,12 @@ nullstrcmp (const char *str1, const char *str2)
* @param to_state state to where the transition should point to
*/
static void
-state_add_transition (struct REGEX_ITERNAL_Context *ctx,
- struct REGEX_ITERNAL_State *from_state, const char *label,
- struct REGEX_ITERNAL_State *to_state)
+state_add_transition (struct REGEX_INTERNAL_Context *ctx,
+ struct REGEX_INTERNAL_State *from_state, const char *label,
+ struct REGEX_INTERNAL_State *to_state)
{
- struct REGEX_ITERNAL_Transition *t;
- struct REGEX_ITERNAL_Transition *oth;
+ struct REGEX_INTERNAL_Transition *t;
+ struct REGEX_INTERNAL_Transition *oth;
if (NULL == from_state)
{
@@ -132,7 +132,7 @@ state_add_transition (struct REGEX_ITERNAL_Context *ctx,
break;
}
- t = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Transition));
+ t = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Transition));
if (NULL != ctx)
t->id = ctx->transition_id++;
if (NULL != label)
@@ -156,8 +156,8 @@ state_add_transition (struct REGEX_ITERNAL_Context *ctx,
* @param transition transition that should be removed from state 'state'.
*/
static void
-state_remove_transition (struct REGEX_ITERNAL_State *state,
- struct REGEX_ITERNAL_Transition *transition)
+state_remove_transition (struct REGEX_INTERNAL_State *state,
+ struct REGEX_INTERNAL_Transition *transition)
{
if (NULL == state || NULL == transition)
return;
@@ -188,8 +188,8 @@ state_remove_transition (struct REGEX_ITERNAL_State *state,
static int
state_compare (const void *a, const void *b)
{
- struct REGEX_ITERNAL_State **s1 = (struct REGEX_ITERNAL_State **) a;
- struct REGEX_ITERNAL_State **s2 = (struct REGEX_ITERNAL_State **) b;
+ struct REGEX_INTERNAL_State **s1 = (struct REGEX_INTERNAL_State **) a;
+ struct REGEX_INTERNAL_State **s2 = (struct REGEX_INTERNAL_State **) b;
return (*s1)->id - (*s2)->id;
}
@@ -205,9 +205,9 @@ state_compare (const void *a, const void *b)
* @return number of edges.
*/
static unsigned int
-state_get_edges (struct REGEX_ITERNAL_State *s, struct REGEX_ITERNAL_Edge *edges)
+state_get_edges (struct REGEX_INTERNAL_State *s, struct REGEX_INTERNAL_Edge *edges)
{
- struct REGEX_ITERNAL_Transition *t;
+ struct REGEX_INTERNAL_Transition *t;
unsigned int count;
if (NULL == s)
@@ -237,8 +237,8 @@ state_get_edges (struct REGEX_ITERNAL_State *s, struct REGEX_ITERNAL_Edge *edges
* @return 0 if the sets are equal, otherwise non-zero
*/
static int
-state_set_compare (struct REGEX_ITERNAL_StateSet *sset1,
- struct REGEX_ITERNAL_StateSet *sset2)
+state_set_compare (struct REGEX_INTERNAL_StateSet *sset1,
+ struct REGEX_INTERNAL_StateSet *sset2)
{
int result;
unsigned int i;
@@ -264,7 +264,7 @@ state_set_compare (struct REGEX_ITERNAL_StateSet *sset1,
* @param set set to be cleared
*/
static void
-state_set_clear (struct REGEX_ITERNAL_StateSet *set)
+state_set_clear (struct REGEX_INTERNAL_StateSet *set)
{
GNUNET_array_grow (set->states, set->size, 0);
set->off = 0;
@@ -278,7 +278,7 @@ state_set_clear (struct REGEX_ITERNAL_StateSet *set)
* @param a automaton to be cleared
*/
static void
-automaton_fragment_clear (struct REGEX_ITERNAL_Automaton *a)
+automaton_fragment_clear (struct REGEX_INTERNAL_Automaton *a)
{
if (NULL == a)
return;
@@ -298,10 +298,10 @@ automaton_fragment_clear (struct REGEX_ITERNAL_Automaton *a)
* @param s state that should be destroyed
*/
static void
-automaton_destroy_state (struct REGEX_ITERNAL_State *s)
+automaton_destroy_state (struct REGEX_INTERNAL_State *s)
{
- struct REGEX_ITERNAL_Transition *t;
- struct REGEX_ITERNAL_Transition *next_t;
+ struct REGEX_INTERNAL_Transition *t;
+ struct REGEX_INTERNAL_Transition *next_t;
if (NULL == s)
return;
@@ -328,12 +328,12 @@ automaton_destroy_state (struct REGEX_ITERNAL_State *s)
* @param s state to remove
*/
static void
-automaton_remove_state (struct REGEX_ITERNAL_Automaton *a,
- struct REGEX_ITERNAL_State *s)
+automaton_remove_state (struct REGEX_INTERNAL_Automaton *a,
+ struct REGEX_INTERNAL_State *s)
{
- struct REGEX_ITERNAL_State *s_check;
- struct REGEX_ITERNAL_Transition *t_check;
- struct REGEX_ITERNAL_Transition *t_check_next;
+ struct REGEX_INTERNAL_State *s_check;
+ struct REGEX_INTERNAL_Transition *t_check;
+ struct REGEX_INTERNAL_Transition *t_check_next;
if (NULL == a || NULL == s)
return;
@@ -368,15 +368,15 @@ automaton_remove_state (struct REGEX_ITERNAL_Automaton *a,
* @param s2 second state, will be destroyed
*/
static void
-automaton_merge_states (struct REGEX_ITERNAL_Context *ctx,
- struct REGEX_ITERNAL_Automaton *a,
- struct REGEX_ITERNAL_State *s1,
- struct REGEX_ITERNAL_State *s2)
-{
- struct REGEX_ITERNAL_State *s_check;
- struct REGEX_ITERNAL_Transition *t_check;
- struct REGEX_ITERNAL_Transition *t;
- struct REGEX_ITERNAL_Transition *t_next;
+automaton_merge_states (struct REGEX_INTERNAL_Context *ctx,
+ struct REGEX_INTERNAL_Automaton *a,
+ struct REGEX_INTERNAL_State *s1,
+ struct REGEX_INTERNAL_State *s2)
+{
+ struct REGEX_INTERNAL_State *s_check;
+ struct REGEX_INTERNAL_Transition *t_check;
+ struct REGEX_INTERNAL_Transition *t;
+ struct REGEX_INTERNAL_Transition *t_next;
int is_dup;
if (s1 == s2)
@@ -437,8 +437,8 @@ automaton_merge_states (struct REGEX_ITERNAL_Context *ctx,
* @param s state that should be added
*/
static void
-automaton_add_state (struct REGEX_ITERNAL_Automaton *a,
- struct REGEX_ITERNAL_State *s)
+automaton_add_state (struct REGEX_INTERNAL_Automaton *a,
+ struct REGEX_INTERNAL_State *s)
{
GNUNET_CONTAINER_DLL_insert (a->states_head, a->states_tail, s);
a->state_count++;
@@ -460,12 +460,12 @@ automaton_add_state (struct REGEX_ITERNAL_Automaton *a,
* @param action_cls closure for action.
*/
static void
-automaton_state_traverse (struct REGEX_ITERNAL_State *s, int *marks,
+automaton_state_traverse (struct REGEX_INTERNAL_State *s, int *marks,
unsigned int *count,
- REGEX_ITERNAL_traverse_check check, void *check_cls,
- REGEX_ITERNAL_traverse_action action, void *action_cls)
+ REGEX_INTERNAL_traverse_check check, void *check_cls,
+ REGEX_INTERNAL_traverse_action action, void *action_cls)
{
- struct REGEX_ITERNAL_Transition *t;
+ struct REGEX_INTERNAL_Transition *t;
if (GNUNET_YES == marks[s->traversal_id])
return;
@@ -503,15 +503,15 @@ automaton_state_traverse (struct REGEX_ITERNAL_State *s, int *marks,
* @param action_cls closure for action
*/
void
-REGEX_ITERNAL_automaton_traverse (const struct REGEX_ITERNAL_Automaton *a,
- struct REGEX_ITERNAL_State *start,
- REGEX_ITERNAL_traverse_check check,
+REGEX_INTERNAL_automaton_traverse (const struct REGEX_INTERNAL_Automaton *a,
+ struct REGEX_INTERNAL_State *start,
+ REGEX_INTERNAL_traverse_check check,
void *check_cls,
- REGEX_ITERNAL_traverse_action action,
+ REGEX_INTERNAL_traverse_action action,
void *action_cls)
{
unsigned int count;
- struct REGEX_ITERNAL_State *s;
+ struct REGEX_INTERNAL_State *s;
if (NULL == a || 0 == a->state_count)
return;
@@ -1156,7 +1156,7 @@ sb_strkcmp (const struct StringBuffer *str1,
/**
- * Helper function used as 'action' in 'REGEX_ITERNAL_automaton_traverse'
+ * Helper function used as 'action' in 'REGEX_INTERNAL_automaton_traverse'
* function to create the depth-first numbering of the states.
*
* @param cls states array.
@@ -1165,9 +1165,9 @@ sb_strkcmp (const struct StringBuffer *str1,
*/
static void
number_states (void *cls, const unsigned int count,
- struct REGEX_ITERNAL_State *s)
+ struct REGEX_INTERNAL_State *s)
{
- struct REGEX_ITERNAL_State **states = cls;
+ struct REGEX_INTERNAL_State **states = cls;
s->dfs_id = count;
if (NULL != states)
@@ -1604,16 +1604,16 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
* @param a automaton for which to assign proofs and hashes, must not be NULL
*/
static int
-automaton_create_proofs (struct REGEX_ITERNAL_Automaton *a)
+automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a)
{
unsigned int n = a->state_count;
- struct REGEX_ITERNAL_State *states[n];
+ struct REGEX_INTERNAL_State *states[n];
struct StringBuffer *R_last;
struct StringBuffer *R_cur;
struct StringBuffer R_cur_r;
struct StringBuffer R_cur_l;
struct StringBuffer *R_swap;
- struct REGEX_ITERNAL_Transition *t;
+ struct REGEX_INTERNAL_Transition *t;
struct StringBuffer complete_regex;
unsigned int i;
unsigned int j;
@@ -1631,7 +1631,7 @@ automaton_create_proofs (struct REGEX_ITERNAL_Automaton *a)
}
/* create depth-first numbering of the states, initializes 'state' */
- REGEX_ITERNAL_automaton_traverse (a, a->start, NULL, NULL, &number_states,
+ REGEX_INTERNAL_automaton_traverse (a, a->start, NULL, NULL, &number_states,
states);
for (i = 0; i < n; i++)
@@ -1763,18 +1763,18 @@ automaton_create_proofs (struct REGEX_ITERNAL_Automaton *a)
*
* @return new DFA state
*/
-static struct REGEX_ITERNAL_State *
-dfa_state_create (struct REGEX_ITERNAL_Context *ctx,
- struct REGEX_ITERNAL_StateSet *nfa_states)
+static struct REGEX_INTERNAL_State *
+dfa_state_create (struct REGEX_INTERNAL_Context *ctx,
+ struct REGEX_INTERNAL_StateSet *nfa_states)
{
- struct REGEX_ITERNAL_State *s;
+ struct REGEX_INTERNAL_State *s;
char *pos;
size_t len;
- struct REGEX_ITERNAL_State *cstate;
- struct REGEX_ITERNAL_Transition *ctran;
+ struct REGEX_INTERNAL_State *cstate;
+ struct REGEX_INTERNAL_Transition *ctran;
unsigned int i;
- s = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_State));
+ s = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_State));
s->id = ctx->state_id++;
s->index = -1;
s->lowlink = -1;
@@ -1816,7 +1816,7 @@ dfa_state_create (struct REGEX_ITERNAL_Context *ctx,
pos[-1] = '}';
s->name = GNUNET_realloc (s->name, strlen (s->name) + 1);
- memset (nfa_states, 0, sizeof (struct REGEX_ITERNAL_StateSet));
+ memset (nfa_states, 0, sizeof (struct REGEX_INTERNAL_StateSet));
return s;
}
@@ -1835,10 +1835,10 @@ dfa_state_create (struct REGEX_ITERNAL_Context *ctx,
* @return length of the substring comsumed from 'str'
*/
static unsigned int
-dfa_move (struct REGEX_ITERNAL_State **s, const char *str)
+dfa_move (struct REGEX_INTERNAL_State **s, const char *str)
{
- struct REGEX_ITERNAL_Transition *t;
- struct REGEX_ITERNAL_State *new_s;
+ struct REGEX_INTERNAL_Transition *t;
+ struct REGEX_INTERNAL_State *new_s;
unsigned int len;
unsigned int max_len;
@@ -1876,7 +1876,7 @@ dfa_move (struct REGEX_ITERNAL_State **s, const char *str)
* @param s state where the marked attribute will be set to GNUNET_YES.
*/
static void
-mark_states (void *cls, const unsigned int count, struct REGEX_ITERNAL_State *s)
+mark_states (void *cls, const unsigned int count, struct REGEX_INTERNAL_State *s)
{
s->marked = GNUNET_YES;
}
@@ -1889,17 +1889,17 @@ mark_states (void *cls, const unsigned int count, struct REGEX_ITERNAL_State *s)
* @param a DFA automaton
*/
static void
-dfa_remove_unreachable_states (struct REGEX_ITERNAL_Automaton *a)
+dfa_remove_unreachable_states (struct REGEX_INTERNAL_Automaton *a)
{
- struct REGEX_ITERNAL_State *s;
- struct REGEX_ITERNAL_State *s_next;
+ struct REGEX_INTERNAL_State *s;
+ struct REGEX_INTERNAL_State *s_next;
/* 1. unmark all states */
for (s = a->states_head; NULL != s; s = s->next)
s->marked = GNUNET_NO;
/* 2. traverse dfa from start state and mark all visited states */
- REGEX_ITERNAL_automaton_traverse (a, a->start, NULL, NULL, &mark_states, NULL);
+ REGEX_INTERNAL_automaton_traverse (a, a->start, NULL, NULL, &mark_states, NULL);
/* 3. delete all states that were not visited */
for (s = a->states_head; NULL != s; s = s_next)
@@ -1918,11 +1918,11 @@ dfa_remove_unreachable_states (struct REGEX_ITERNAL_Automaton *a)
* @param a DFA automaton
*/
static void
-dfa_remove_dead_states (struct REGEX_ITERNAL_Automaton *a)
+dfa_remove_dead_states (struct REGEX_INTERNAL_Automaton *a)
{
- struct REGEX_ITERNAL_State *s;
- struct REGEX_ITERNAL_State *s_next;
- struct REGEX_ITERNAL_Transition *t;
+ struct REGEX_INTERNAL_State *s;
+ struct REGEX_INTERNAL_State *s_next;
+ struct REGEX_INTERNAL_Transition *t;
int dead;
GNUNET_assert (DFA == a->type);
@@ -1961,16 +1961,16 @@ dfa_remove_dead_states (struct REGEX_ITERNAL_Automaton *a)
* @return GNUNET_OK on success
*/
static int
-dfa_merge_nondistinguishable_states (struct REGEX_ITERNAL_Context *ctx,
- struct REGEX_ITERNAL_Automaton *a)
+dfa_merge_nondistinguishable_states (struct REGEX_INTERNAL_Context *ctx,
+ struct REGEX_INTERNAL_Automaton *a)
{
uint32_t *table;
- struct REGEX_ITERNAL_State *s1;
- struct REGEX_ITERNAL_State *s2;
- struct REGEX_ITERNAL_Transition *t1;
- struct REGEX_ITERNAL_Transition *t2;
- struct REGEX_ITERNAL_State *s1_next;
- struct REGEX_ITERNAL_State *s2_next;
+ struct REGEX_INTERNAL_State *s1;
+ struct REGEX_INTERNAL_State *s2;
+ struct REGEX_INTERNAL_Transition *t1;
+ struct REGEX_INTERNAL_Transition *t2;
+ struct REGEX_INTERNAL_State *s1_next;
+ struct REGEX_INTERNAL_State *s2_next;
int change;
unsigned int num_equal_edges;
unsigned int i;
@@ -2078,8 +2078,8 @@ dfa_merge_nondistinguishable_states (struct REGEX_ITERNAL_Context *ctx,
* @return GNUNET_OK on success
*/
static int
-dfa_minimize (struct REGEX_ITERNAL_Context *ctx,
- struct REGEX_ITERNAL_Automaton *a)
+dfa_minimize (struct REGEX_INTERNAL_Context *ctx,
+ struct REGEX_INTERNAL_Automaton *a)
{
if (NULL == a)
return GNUNET_SYSERR;
@@ -2102,7 +2102,7 @@ dfa_minimize (struct REGEX_ITERNAL_Context *ctx,
/**
* Context for adding strided transitions to a DFA.
*/
-struct REGEX_ITERNAL_Strided_Context
+struct REGEX_INTERNAL_Strided_Context
{
/**
* Length of the strides.
@@ -2113,12 +2113,12 @@ struct REGEX_ITERNAL_Strided_Context
* Strided transitions DLL. New strided transitions will be stored in this DLL
* and afterwards added to the DFA.
*/
- struct REGEX_ITERNAL_Transition *transitions_head;
+ struct REGEX_INTERNAL_Transition *transitions_head;
/**
* Strided transitions DLL.
*/
- struct REGEX_ITERNAL_Transition *transitions_tail;
+ struct REGEX_INTERNAL_Transition *transitions_tail;
};
@@ -2134,16 +2134,16 @@ struct REGEX_ITERNAL_Strided_Context
*/
void
dfa_add_multi_strides_helper (void *cls, const unsigned int depth, char *label,
- struct REGEX_ITERNAL_State *start,
- struct REGEX_ITERNAL_State *s)
+ struct REGEX_INTERNAL_State *start,
+ struct REGEX_INTERNAL_State *s)
{
- struct REGEX_ITERNAL_Strided_Context *ctx = cls;
- struct REGEX_ITERNAL_Transition *t;
+ struct REGEX_INTERNAL_Strided_Context *ctx = cls;
+ struct REGEX_INTERNAL_Transition *t;
char *new_label;
if (depth == ctx->stride)
{
- t = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Transition));
+ t = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Transition));
t->label = GNUNET_strdup (label);
t->to_state = s;
t->from_state = start;
@@ -2184,7 +2184,7 @@ dfa_add_multi_strides_helper (void *cls, const unsigned int depth, char *label,
*/
void
dfa_add_multi_strides (void *cls, const unsigned int count,
- struct REGEX_ITERNAL_State *s)
+ struct REGEX_INTERNAL_State *s)
{
dfa_add_multi_strides_helper (cls, 0, NULL, s, s);
}
@@ -2198,19 +2198,19 @@ dfa_add_multi_strides (void *cls, const unsigned int count,
* @param stride_len length of the strides.
*/
void
-REGEX_ITERNAL_dfa_add_multi_strides (struct REGEX_ITERNAL_Context *regex_ctx,
- struct REGEX_ITERNAL_Automaton *dfa,
+REGEX_INTERNAL_dfa_add_multi_strides (struct REGE