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",
244 to_name, ctran->
label);
252 fwrite (s_tran, strlen (s_tran), 1,
ctx->filep);
296 if (NULL ==
ctx.filep)
307 start = (
char*)
"digraph G {\nrankdir=LR\n";
314 end = (
char*)
"\n}\n";
315 fwrite (
end, strlen (
end), 1,
ctx.filep);
struct GNUNET_GETOPT_CommandLineOption options[]
static int start
Set if we are to start default services (including ARM).
static int end
Set if we are to shutdown all services (including ARM).
static struct GNUNET_FS_Handle * ctx
static char * name
Name (label) of the records to list.
static struct GNUNET_SCHEDULER_Task * t
Main task.
#define GNUNET_log(kind,...)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_ERROR
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_free(ptr)
Wrapper around free.
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,...
library to parse regular expressions into dfa
static void automaton_save_graph_step(void *cls, unsigned int count, struct REGEX_INTERNAL_State *s)
Save a state to an open file pointer.
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...
static void scc_tarjan(struct REGEX_INTERNAL_Automaton *a)
Detect all SCCs (Strongly Connected Components) inside the given automaton.
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.
REGEX_TEST_GraphSavingOptions
Options for graph creation function REGEX_TEST_automaton_save_graph.
@ REGEX_TEST_GRAPH_COLORING
Enable graph coloring.
@ REGEX_TEST_GRAPH_VERBOSE
The generated graph will include extra information such as the NFA states that were used to generate ...
struct GNUNET_SCHEDULER_Task * next
This is a linked list.
Automaton representation.
struct REGEX_INTERNAL_State * start
First state of the automaton.
unsigned int state_count
Number of states in the automaton.
struct REGEX_INTERNAL_State * states_head
DLL of states.
struct REGEX_INTERNAL_State * next
This is a linked list to keep states in an automaton.
char * proof
Proof for this state.
unsigned int dfs_id
Linear state ID acquired by depth-first-search.
char * name
Human readable name of the state.
unsigned int id
Unique state id.
int accepting
If this is an accepting state or not.
int lowlink
Used for SCC detection.
int contained
Marking the state as contained.
struct REGEX_INTERNAL_Transition * transitions_head
DLL of transitions.
struct GNUNET_HashCode hash
Hash of the state.
int index
Used for SCC detection.
unsigned int scc_id
Marking the state as part of an SCC (Strongly Connected Component).
Transition between two states.
struct REGEX_INTERNAL_State * to_state
State to which this transition leads.
struct REGEX_INTERNAL_Transition * next
This is a linked list.
char * label
Label for this transition.
Context for graph creation.
int verbose
Verbose flag, if it's set to GNUNET_YES additional info will be printed in the graph.
int coloring
Coloring flag, if set to GNUNET_YES SCCs will be colored.
FILE * filep
File pointer to the dot file used for output.