2004-06-20 22:13:59 +02:00
|
|
|
/* Eliot */
|
2005-05-06 01:45:04 +02:00
|
|
|
/* Copyright (C) 2005 Antoine Fraboulet */
|
2004-06-20 22:13:59 +02:00
|
|
|
/* */
|
2005-05-06 01:45:04 +02:00
|
|
|
/* This file is part of Eliot. */
|
|
|
|
/* */
|
|
|
|
/* Eliot is free software; you can redistribute it and/or modify */
|
2004-06-20 22:13:59 +02:00
|
|
|
/* it under the terms of the GNU General Public License as published by */
|
|
|
|
/* the Free Software Foundation; either version 2 of the License, or */
|
|
|
|
/* (at your option) any later version. */
|
|
|
|
/* */
|
2005-05-06 01:45:04 +02:00
|
|
|
/* Elit is distributed in the hope that it will be useful, */
|
2004-06-20 22:13:59 +02:00
|
|
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
|
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
|
|
/* GNU General Public License for more details. */
|
|
|
|
/* */
|
|
|
|
/* You should have received a copy of the GNU General Public License */
|
|
|
|
/* along with this program; if not, write to the Free Software */
|
2005-10-23 16:53:42 +02:00
|
|
|
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
2005-05-06 01:45:04 +02:00
|
|
|
|
|
|
|
/**
|
2005-05-06 09:39:58 +02:00
|
|
|
* \file automaton.h
|
2005-11-04 21:00:05 +01:00
|
|
|
* \brief Diterministic Finite Automaton
|
2005-05-06 01:45:04 +02:00
|
|
|
* \author Antoine Fraboulet
|
|
|
|
* \date 2005
|
2004-06-20 22:13:59 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DIC_AUTOMATON_H_
|
|
|
|
#define _DIC_AUTOMATON_H_
|
2005-05-06 01:45:04 +02:00
|
|
|
#if defined(__cplusplus)
|
2005-11-04 21:00:05 +01:00
|
|
|
extern "C"
|
2005-05-06 01:45:04 +02:00
|
|
|
{
|
2005-11-04 21:00:05 +01:00
|
|
|
#endif
|
2005-05-06 01:45:04 +02:00
|
|
|
|
|
|
|
typedef struct automaton_t *automaton;
|
|
|
|
|
|
|
|
/**
|
2005-11-04 21:00:05 +01:00
|
|
|
* build a static deterministic finite automaton from
|
2005-05-06 01:45:04 +02:00
|
|
|
* "init_state", "ptl" and "PS" given by the parser
|
2005-11-04 21:00:05 +01:00
|
|
|
*/
|
2005-05-06 01:45:04 +02:00
|
|
|
automaton automaton_build(int init_state, int *ptl, int *PS, struct search_RegE_list_t *list);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* automaton delete function
|
|
|
|
*/
|
|
|
|
void automaton_delete (automaton a);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get the number of states in the automaton
|
|
|
|
* @returns number of states
|
|
|
|
*/
|
|
|
|
int automaton_get_nstate (automaton a);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* query the id of the init state
|
|
|
|
* @returns init state id
|
|
|
|
*/
|
|
|
|
int automaton_get_init (automaton a);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ask for the acceptor flag for the state
|
|
|
|
* @returns boolean flag 0 or 1
|
|
|
|
*/
|
|
|
|
int automaton_get_accept (automaton a, int state);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* returns the next state when the transition is taken
|
|
|
|
* @returns next state id (1 <= id <= nstate, 0 = invalid id)
|
|
|
|
*/
|
|
|
|
int automaton_get_next_state (automaton a, int start, char l);
|
|
|
|
|
|
|
|
void automaton_dump (automaton a, char* filename);
|
2004-06-20 22:13:59 +02:00
|
|
|
|
2005-05-06 01:45:04 +02:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
2005-11-04 21:00:05 +01:00
|
|
|
#endif
|
2005-05-06 01:45:04 +02:00
|
|
|
#endif /* _DIC_AUTOMATON_H_ */
|