49 unsigned int num_edges,
54 printf (
"%s: %s, proof: `%s'\n",
56 accepting ?
"ACCEPTING" :
"",
58 for (i = 0; i < num_edges; i++)
59 printf (
" `%s': %s\n",
76main (
int argc,
char *
const *argv)
83 unsigned int alphabet_size;
90 "Usage: %s REGEX_FILE ALPHABET_SIZE COMPRESSION\n",
98 "Failed to read regexes from `%s'\n",
102 alphabet_size = atoi (argv[2]);
103 compression = atoi (argv[3]);
104 printf (
"********* PERF-REGEX *********'\n");
105 printf (
"Using:\n file '%s'\n Alphabet size %u\n compression %d\n",
106 argv[1], alphabet_size, compression);
113 "Combined regex (%ld bytes):\n%s\n",
117 printf (
"********* ALL EDGES *********'\n");
119 printf (
"\n\n********* REACHABLE EDGES *********'\n");
struct GNUNET_HashCode key
The key used in the DHT.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
enum GNUNET_GenericReturnValue GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_free(ptr)
Wrapper around free.
static unsigned int size
Size of the "table".
static void print_edge(void *cls, const struct GNUNET_HashCode *key, const char *proof, int accepting, unsigned int num_edges, const struct REGEX_BLOCK_Edge *edges)
Print information about the given node and its edges to stdout.
int main(int argc, char *const *argv)
The main function of the regex performance test.
void REGEX_INTERNAL_iterate_all_edges(struct REGEX_INTERNAL_Automaton *a, REGEX_INTERNAL_KeyIterator iterator, void *iterator_cls)
Iterate over all edges starting from start state of automaton 'a'.
struct REGEX_INTERNAL_Automaton * REGEX_INTERNAL_construct_dfa(const char *regex, const size_t len, unsigned int max_path_len)
Construct DFA for the given 'regex' of length 'len'.
void REGEX_INTERNAL_iterate_reachable_edges(struct REGEX_INTERNAL_Automaton *a, REGEX_INTERNAL_KeyIterator iterator, void *iterator_cls)
Iterate over all edges of automaton 'a' that are reachable from a state with a proof of at least GNUN...
void REGEX_INTERNAL_automaton_destroy(struct REGEX_INTERNAL_Automaton *a)
Free the memory allocated by constructing the REGEX_INTERNAL_Automaton.
library to parse regular expressions into dfa
void REGEX_TEST_free_from_file(char **regexes)
Free all memory reserved for a set of regexes created by read_from_file.
char * REGEX_TEST_combine(char *const regexes[], unsigned int alphabet_size)
Combine an array of regexes into a single prefix-shared regex.
char ** REGEX_TEST_read_from_file(const char *filename)
Read a set of regexes from a file, one per line and return them in an array suitable for REGEX_TEST_c...
Automaton representation.