automaton.c File Reference


Detailed Description

(Non)Deterministic Finite Automaton for Regexp

Author:
Antoine Fraboulet
Date:
2005

Definition in file automaton.c.

#include "config.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include "dic.h"
#include "regexp.h"
#include "alist.h"
#include "automaton.h"

Go to the source code of this file.

Data Structures

struct  automaton_state_t
struct  Automaton_t
struct  automaton_t

Defines

#define DMSG(a)
#define MAX_TRANSITION_LETTERS   256

Typedefs

typedef automaton_state_tastate
typedef Automaton_tAutomaton

Functions

automaton automaton_build (int init_state, int *ptl, int *PS, struct search_RegE_list_t *list)
void automaton_delete (automaton a)
int automaton_get_nstate (automaton a)
int automaton_get_init (automaton a)
int automaton_get_accept (automaton a, int state)
int automaton_get_next_state (automaton a, int start, char l)
void automaton_dump (automaton a, char *filename)
static Automaton s_automaton_create ()
static void s_automaton_delete (Automaton a)
static alist s_automaton_id_create (int id)
static char * s_automaton_id_to_str (alist id)
static astate s_automaton_state_create (alist id)
static void s_automaton_add_state (Automaton a, astate s)
static astate s_automaton_get_state (Automaton a, alist id)
static Automaton s_automaton_PS_to_NFA (int init_state, int *ptl, int *PS)
static Automaton s_automaton_NFA_to_DFA (Automaton a, struct search_RegE_list_t *list)
static automaton s_automaton_finalize (Automaton a)
int automaton_get_nstates (automaton a)
void state_delete_fun (void *ps)
static alist s_automaton_successor (alist S, int letter, Automaton nfa, struct search_RegE_list_t *list)
static void s_automaton_node_set_accept (astate s, Automaton nfa)
static void s_automaton_print_nodes (FILE *f, Automaton a)
static void s_automaton_print_edges (FILE *f, Automaton a)
static void s_automaton_dump (Automaton a, char *filename)


Define Documentation

#define DMSG  ) 
 

Definition at line 46 of file automaton.c.

Referenced by automaton_build(), s_automaton_add_state(), s_automaton_NFA_to_DFA(), s_automaton_node_set_accept(), s_automaton_PS_to_NFA(), s_automaton_state_create(), and s_automaton_successor().

#define MAX_TRANSITION_LETTERS   256
 

Definition at line 49 of file automaton.c.

Referenced by s_automaton_finalize(), s_automaton_PS_to_NFA(), and s_automaton_state_create().


Typedef Documentation

typedef struct automaton_state_t* astate
 

Definition at line 51 of file automaton.c.

typedef struct Automaton_t* Automaton
 

Definition at line 52 of file automaton.c.


Function Documentation

automaton automaton_build int  init_state,
int *  ptl,
int *  PS,
struct search_RegE_list_t list
 

Definition at line 118 of file automaton.c.

References automaton_dump(), DMSG, s_automaton_delete(), s_automaton_dump(), s_automaton_finalize(), s_automaton_NFA_to_DFA(), and s_automaton_PS_to_NFA().

Referenced by Dic_search_RegE().

void automaton_delete automaton  a  ) 
 

Definition at line 141 of file automaton.c.

References automaton_t::accept, automaton_t::nstates, and automaton_t::trans.

Referenced by Dic_search_RegE().

void automaton_dump automaton  a,
char *  filename
 

Definition at line 176 of file automaton.c.

References automaton_t::accept, automaton_t::init, and automaton_t::nstates.

Referenced by automaton_build().

int automaton_get_accept automaton  a,
int  state
[inline]
 

Definition at line 164 of file automaton.c.

References automaton_t::accept.

Referenced by Dic_search_regexp_rec().

int automaton_get_init automaton  a  )  [inline]
 

Definition at line 158 of file automaton.c.

References automaton_t::init.

Referenced by Dic_search_RegE().

int automaton_get_next_state automaton  a,
int  start,
char  l
[inline]
 

Definition at line 170 of file automaton.c.

References automaton_t::trans.

Referenced by Dic_search_regexp_rec().

int automaton_get_nstate automaton  a  ) 
 

int automaton_get_nstates automaton  a  )  [inline]
 

Definition at line 152 of file automaton.c.

References automaton_t::nstates.

static void s_automaton_add_state Automaton  a,
astate  s
[static]
 

Definition at line 289 of file automaton.c.

References alist_add(), DMSG, Automaton_t::nstates, s_automaton_id_to_str(), and Automaton_t::states.

Referenced by s_automaton_NFA_to_DFA(), and s_automaton_PS_to_NFA().

static Automaton s_automaton_create  )  [static]
 

Definition at line 235 of file automaton.c.

References alist_create(), alist_set_delete(), Automaton_t::init_state, Automaton_t::nstates, state_delete_fun(), and Automaton_t::states.

Referenced by s_automaton_NFA_to_DFA(), and s_automaton_PS_to_NFA().

static void s_automaton_delete Automaton  a  )  [static]
 

Definition at line 248 of file automaton.c.

References alist_delete(), and Automaton_t::states.

Referenced by automaton_build().

static void s_automaton_dump Automaton  a,
char *  filename
[static]
 

Definition at line 662 of file automaton.c.

References s_automaton_print_edges(), and s_automaton_print_nodes().

Referenced by automaton_build().

static automaton s_automaton_finalize Automaton  a  )  [static]
 

Definition at line 559 of file automaton.c.

References automaton_t::accept, MAX_TRANSITION_LETTERS, Automaton_t::nstates, automaton_t::nstates, and automaton_t::trans.

Referenced by automaton_build().

static astate s_automaton_get_state Automaton  a,
alist  id
[static]
 

Definition at line 297 of file automaton.c.

References alist_elt_get_value(), alist_equal(), alist_get_first(), alist_get_next(), automaton_state_t::id, and Automaton_t::states.

Referenced by s_automaton_NFA_to_DFA(), s_automaton_PS_to_NFA(), and s_automaton_successor().

static alist s_automaton_id_create int  id  )  [static]
 

Definition at line 255 of file automaton.c.

References alist_add(), and alist_create().

Referenced by s_automaton_PS_to_NFA(), and s_automaton_successor().

static char * s_automaton_id_to_str alist  id  )  [static]
 

Definition at line 262 of file automaton.c.

References alist_elt_get_value(), alist_get_first(), and alist_get_next().

Referenced by s_automaton_add_state(), s_automaton_NFA_to_DFA(), s_automaton_node_set_accept(), s_automaton_print_edges(), s_automaton_print_nodes(), s_automaton_PS_to_NFA(), and s_automaton_state_create().

static Automaton s_automaton_NFA_to_DFA Automaton  a,
struct search_RegE_list_t list
[static]
 

Definition at line 486 of file automaton.c.

References alist_add(), alist_clone(), alist_create(), alist_delete(), alist_is_empty(), alist_pop_first_value(), DIC_LETTERS, DMSG, automaton_state_t::id, Automaton_t::init_state, automaton_state_t::next, regexp_print_letter(), s_automaton_add_state(), s_automaton_create(), s_automaton_get_state(), s_automaton_id_to_str(), s_automaton_state_create(), and s_automaton_successor().

Referenced by automaton_build().

static void s_automaton_node_set_accept astate  s,
Automaton  nfa
[static]
 

Definition at line 465 of file automaton.c.

References automaton_state_t::accept, alist_elt_get_value(), alist_get_first(), alist_get_next(), alist_is_in(), DMSG, automaton_state_t::id, s_automaton_id_to_str(), and Automaton_t::states.

static void s_automaton_print_edges FILE *  f,
Automaton  a
[static]
 

Definition at line 637 of file automaton.c.

References alist_elt_get_value(), alist_get_first(), alist_get_next(), automaton_state_t::id, automaton_state_t::next, regexp_print_letter(), s_automaton_id_to_str(), and Automaton_t::states.

Referenced by s_automaton_dump().

static void s_automaton_print_nodes FILE *  f,
Automaton  a
[static]
 

Definition at line 613 of file automaton.c.

References automaton_state_t::accept, alist_elt_get_value(), alist_get_first(), alist_get_next(), automaton_state_t::id, Automaton_t::init_state, s_automaton_id_to_str(), and Automaton_t::states.

Referenced by s_automaton_dump().

Automaton s_automaton_PS_to_NFA int  init_state,
int *  ptl,
int *  PS
[static]
 

Definition at line 318 of file automaton.c.

References alist_add(), alist_create(), alist_delete(), alist_elt_get_value(), alist_get_first(), alist_is_empty(), alist_pop_first_value(), DMSG, automaton_state_t::id, Automaton_t::init_state, MAX_TRANSITION_LETTERS, automaton_state_t::next, s_automaton_add_state(), s_automaton_create(), s_automaton_get_state(), s_automaton_id_create(), s_automaton_id_to_str(), and s_automaton_state_create().

Referenced by automaton_build().

static astate s_automaton_state_create alist  id  )  [static]
 

Definition at line 277 of file automaton.c.

References automaton_state_t::accept, DMSG, automaton_state_t::id, MAX_TRANSITION_LETTERS, automaton_state_t::next, and s_automaton_id_to_str().

Referenced by s_automaton_NFA_to_DFA(), and s_automaton_PS_to_NFA().

static alist s_automaton_successor alist  S,
int  letter,
Automaton  nfa,
struct search_RegE_list_t list
[static]
 

Definition at line 398 of file automaton.c.

References alist_create(), alist_delete(), alist_elt_get_value(), alist_get_first(), alist_get_next(), alist_insert(), alist_is_empty(), DIC_SEARCH_REGE_LIST, DMSG, search_RegE_list_t::letters, RE_EPSILON, RE_FINAL_TOK, regexp_print_letter(), s_automaton_get_state(), s_automaton_id_create(), search_RegE_list_t::symbl, and search_RegE_list_t::valid.

Referenced by s_automaton_NFA_to_DFA().

void state_delete_fun void *  ps  ) 
 

Definition at line 227 of file automaton.c.

References alist_delete(), and automaton_state_t::id.

Referenced by s_automaton_create().


Generated on Thu Dec 29 02:01:15 2005 for Eliot by  doxygen 1.4.5