summaryrefslogtreecommitdiff
path: root/agen5/defParse-fsm.h
blob: bdda896bc3d7270333097b53fd02dcd1412db11f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*   -*- buffer-read-only: t -*- vi: set ro:
 *  
 *  DO NOT EDIT THIS FILE   (defParse-fsm.h)
 *  
 *  It has been AutoGen-ed  August 11, 2012 at 09:41:34 AM by AutoGen 5.16.2pre7
 *  From the definitions    defParse.def
 *  and the template file   fsm
 *
 *  Automated Finite State Machine
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name ``Bruce Korb'' nor the name of any other
 *    contributor may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 * 
 * AutoFSM IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
/*
 *  This file enumerates the states and transition events for a FSM.
 *
 *  te_dp_state
 *      The available states.  FSS_INIT is always defined to be zero
 *      and FSS_INVALID and FSS_DONE are always made the last entries.
 *
 *  te_dp_event
 *      The transition events.  These enumerate the event values used
 *      to select the next state from the current state.
 *      DP_EV_INVALID is always defined at the end.
 */
#ifndef AUTOFSM_DEFPARSE_FSM_H_GUARD
#define AUTOFSM_DEFPARSE_FSM_H_GUARD 1

/*
 *  Finite State machine States
 *
 *  Count of non-terminal states.  The generated states INVALID and DONE
 *  are terminal, but INIT is not  :-).
 */
#define DP_STATE_CT  11
typedef enum {
    DP_ST_INIT,       DP_ST_NEED_DEF,   DP_ST_NEED_TPL,   DP_ST_NEED_SEMI,
    DP_ST_NEED_NAME,  DP_ST_HAVE_NAME,  DP_ST_NEED_VALUE, DP_ST_NEED_IDX,
    DP_ST_NEED_CBKT,  DP_ST_INDX_NAME,  DP_ST_HAVE_VALUE, DP_ST_INVALID,
    DP_ST_DONE
} te_dp_state;

/*
 *  Finite State machine transition Events.
 *
 *  Count of the valid transition events
 */
#define DP_EVENT_CT 15
typedef enum {
    DP_EV_AUTOGEN,       DP_EV_DEFINITIONS,   DP_EV_END,
    DP_EV_VAR_NAME,      DP_EV_OTHER_NAME,    DP_EV_STRING,
    DP_EV_HERE_STRING,   DP_EV_NUMBER,        DP_EV_LIT_SEMI,
    DP_EV_LIT_EQ,        DP_EV_LIT_COMMA,     DP_EV_LIT_O_BRACE,
    DP_EV_LIT_C_BRACE,   DP_EV_LIT_OPEN_BKT,  DP_EV_LIT_CLOSE_BKT,
    DP_EV_INVALID
} te_dp_event;

/**
 *  Run the FSM.  Will return DP_ST_DONE or DP_ST_INVALID
 */
extern te_dp_state
dp_run_fsm( void );

#endif /* AUTOFSM_DEFPARSE_FSM_H_GUARD */
/*
 * Local Variables:
 * mode: C
 * c-file-style: "stroustrup"
 * indent-tabs-mode: nil
 * End:
 * end of defParse-fsm.h */