69 unsigned int *stack_size)
77 stack[(*stack_size)++] = v;
101 w = stack[--(*stack_size)];
120 unsigned int scc_counter;
123 unsigned int stack_size;
175 "\"%s\" [shape=doublecircle, color=\"0.%i 0.8 0.95\"];\n",
186 "\"%s\" [shape=circle, color=\"0.%i 0.8 0.95\"];\n", name,
196 fwrite (s_acc, strlen (s_acc), 1, ctx->
filep);
205 "Transition from State %i has no state for transitioning\n",
219 if (NULL == ctran->
label)
224 "\"%s\" -> \"%s\" [label = \"ε\", color=\"0.%i 0.8 0.95\"];\n",
238 "\"%s\" -> \"%s\" [label = \"%s\", color=\"0.%i 0.8 0.95\"];\n",
243 GNUNET_asprintf (&s_tran,
"\"%s\" -> \"%s\" [label = \"%s\"];\n", name,
244 to_name, ctran->
label);
252 fwrite (s_tran, strlen (s_tran), 1, ctx->
filep);
284 if ((NULL == filename) || (strlen (filename) < 1))
290 ctx.
filep = fopen (filename,
"w");
296 if (NULL == ctx.
filep)
307 start =
"digraph G {\nrankdir=LR\n";
308 fwrite (start, strlen (start), 1, ctx.
filep);
315 fwrite (end, strlen (end), 1, ctx.
filep);
unsigned int state_count
Number of states in the automaton.
unsigned int scc_id
Marking the state as part of an SCC (Strongly Connected Component).
struct REGEX_INTERNAL_State * states_head
DLL of states.
FILE * filep
File pointer to the dot file used for output.
int index
Used for SCC detection.
static int end
Set if we are to shutdown all services (including ARM).
struct REGEX_INTERNAL_Transition * next
This is a linked list.
Context for graph creation.
struct GNUNET_HashCode hash
Hash of the state.
struct GNUNET_GETOPT_CommandLineOption options[]
int accepting
If this is an accepting state or not.
The generated graph will include extra information such as the NFA states that were used to generate ...
static int start
Set if we are to start default services (including ARM).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct REGEX_INTERNAL_Transition * transitions_head
DLL of transitions.
static void scc_tarjan_strongconnect(unsigned int *scc_counter, struct REGEX_INTERNAL_State *v, unsigned int *index, struct REGEX_INTERNAL_State **stack, unsigned int *stack_size)
Recursive function doing DFS with 'v' as a start, detecting all SCCs inside the subgraph reachable fr...
int contained
Marking the state as contained.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
Automaton representation.
static struct GNUNET_SCHEDULER_Task * t
Main task.
char * proof
Proof for this state.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
REGEX_TEST_GraphSavingOptions
Options for graph creation function REGEX_TEST_automaton_save_graph.
void REGEX_INTERNAL_automaton_traverse(const struct REGEX_INTERNAL_Automaton *a, struct REGEX_INTERNAL_State *start, REGEX_INTERNAL_traverse_check check, void *check_cls, REGEX_INTERNAL_traverse_action action, void *action_cls)
Traverses the given automaton using depth-first-search (DFS) from it's start state, visiting all reachable states and calling 'action' on each one of them.
int coloring
Coloring flag, if set to GNUNET_YES SCCs will be colored.
void REGEX_TEST_automaton_save_graph(struct REGEX_INTERNAL_Automaton *a, const char *filename, enum REGEX_TEST_GraphSavingOptions options)
Save the given automaton as a GraphViz dot file.
library to parse regular expressions into dfa
char * name
Human readable name of the state.
Transition between two states.
int verbose
Verbose flag, if it's set to GNUNET_YES additional info will be printed in the graph.
struct REGEX_INTERNAL_State * start
First state of the automaton.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
struct REGEX_INTERNAL_State * next
This is a linked list to keep states in an automaton.
void REGEX_TEST_automaton_save_graph_step(void *cls, unsigned int count, struct REGEX_INTERNAL_State *s)
Save a state to an open file pointer.
library to read regexes representing IP networks from a file.
static void scc_tarjan(struct REGEX_INTERNAL_Automaton *a)
Detect all SCCs (Strongly Connected Components) inside the given automaton.
unsigned int dfs_id
Linear state ID accquired by depth-first-search.
struct REGEX_INTERNAL_State * to_state
State to which this transition leads.
#define GNUNET_log(kind,...)
char * label
Label for this transition.
common internal definitions for regex library.
int lowlink
Used for SCC detection.
unsigned int id
Unique state id.
#define GNUNET_free(ptr)
Wrapper around free.