/* upstart * * Copyright © 2008 Canonical Ltd. * Author: Casey Dahlin * * This program is free software; you can redistribute it and/or modify * 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. * * This program is distributed in the hope that it will be useful, * 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 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef NFA_H #define NFA_H #include #include /** * NFATransition: * @entry: list entry * @from_state: state to part from * @to_state: state to move into * @on_event: event name that triggers this transition * @on_env: environment that triggers this transition * * A notation of a transition between states that is triggered by a certain * event. **/ typedef struct transition { NihList entry; char *from_state; char *to_state; char *on_event; char *on_env; } NFATransition; /** * NFAState: * @name: name of the state * @env: current environment * * A state which an NFA is currently in **/ typedef struct state { char *name; char **env; } NFAState; /** * NFA: * @state: current state * @transitions: how to change state * @next_anon: next unnamed state to create when we need to add a state at will * * A Non-Deterministic Finite Automaton **/ typedef struct nfa { NihList *states; NihHash *transitions; int next_anon; } NFA; NIH_BEGIN_EXTERN void nfa_conjoin (NFA *self, NFA *other); void nfa_disjoin (NFA *self, NFA *other); NIH_END_EXTERN #endif /* NFA_H */