[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27316 - gnunet/src/regex
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27316 - gnunet/src/regex |
Date: |
Tue, 28 May 2013 01:36:54 +0200 |
Author: bartpolot
Date: 2013-05-28 01:36:54 +0200 (Tue, 28 May 2013)
New Revision: 27316
Modified:
gnunet/src/regex/perf-regex.c
Log:
- expand regex perf to show resulting DFA: evaluate simplification from r27315
Modified: gnunet/src/regex/perf-regex.c
===================================================================
--- gnunet/src/regex/perf-regex.c 2013-05-27 23:35:17 UTC (rev 27315)
+++ gnunet/src/regex/perf-regex.c 2013-05-27 23:36:54 UTC (rev 27316)
@@ -38,6 +38,40 @@
}
/**
+ * Iterator callback function.
+ *
+ * @param cls closure.
+ * @param key hash for current state.
+ * @param proof proof for current state.
+ * @param accepting GNUNET_YES if this is an accepting state, GNUNET_NO if not.
+ * @param num_edges number of edges leaving current state.
+ * @param edges edges leaving current state.
+ */
+static void
+iter (void *cls,
+ const struct GNUNET_HashCode *key,
+ const char *proof,
+ int accepting,
+ unsigned int num_edges,
+ const struct GNUNET_REGEX_Edge *edges)
+{
+ unsigned int i;
+
+ printf ("%s: %s\n", GNUNET_h2s (key), accepting ? "ACCEPTING" : "");
+ printf (" proof: %s\n", proof);
+ for (i = 0; i < num_edges; i++)
+ {
+ printf (" %s: %s\n", edges[i].label, GNUNET_h2s
(&edges[i].destination));
+ }
+}
+
+static void
+print_dfa (struct GNUNET_REGEX_Automaton* dfa)
+{
+ GNUNET_REGEX_iterate_all_edges (dfa, iter, NULL);
+}
+
+/**
* The main function of the regex performace test.
*
* Read a set of regex from a file, combine them and create a DFA from the
@@ -81,6 +115,7 @@
compression = atoi (argv[2]);
dfa = GNUNET_REGEX_construct_dfa (regex, size, compression);
+ print_dfa (dfa);
GNUNET_REGEX_automaton_destroy (dfa);
GNUNET_free (buffer);
GNUNET_REGEX_free_from_file (regexes);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27316 - gnunet/src/regex,
gnunet <=