/*---------------------------------------------------------------------------*
 *  smtecho.d - LIBERO dialog data definitions for smtecho.c.                *
 *  Generated by LIBERO 2.4 on 11 Oct, 2010, 17:15.                          *
 *  Schema file used: smtschm.c.                                             *
 *---------------------------------------------------------------------------*/

/*- Symbolic constants and event numbers ------------------------------------*/

#define _LR_STOP                        0xFFFFL
#define _LR_NULL_EVENT                  -2
#define _LR_NULL_STATE                  -1
#define terminate_event                 -1
#define client_event                    0
#define closed_event                    1
#define error_event                     2
#define exception_event                 3
#define fatal_event                     4
#define master_event                    5
#define ok_event                        6
#define read_ok_event                   7
#define shutdown_event                  8
#define _LR_STATE_after_init            0
#define _LR_STATE_start_thread          1
#define _LR_STATE_master_input          2
#define _LR_STATE_echoing_data          3
#define _LR_STATE_defaults              4
#define _LR_STATE_end_thread            5
#define _LR_defaults_state              4


/*- Function prototypes and macros ------------------------------------------*/

#ifndef MODULE
#define MODULE  static void             /*  Libero dialog modules            */
#endif

MODULE initialise_the_thread        (THREAD *thread);
MODULE check_socket_type            (THREAD *thread);
MODULE open_agent_log_file          (THREAD *thread);
MODULE open_master_socket           (THREAD *thread);
MODULE wait_for_socket_input        (THREAD *thread);
MODULE read_socket_data_repeatedly  (THREAD *thread);
MODULE accept_client_connection     (THREAD *thread);
MODULE signal_socket_error          (THREAD *thread);
MODULE shutdown_the_application     (THREAD *thread);
MODULE terminate_the_thread         (THREAD *thread);
MODULE echo_socket_data             (THREAD *thread);
MODULE close_agent_log_file         (THREAD *thread);

#define the_next_event              _the_next_event
#define the_exception_event         _the_exception_event
#define the_external_event          _the_external_event
#define exception_raised            _exception_raised
#define io_completed                _io_completed


/*- Static areas shared by all threads --------------------------------------*/

static word _LR_nextst [6][9] =
{
    { 0,0,0,0,0,0,1,0,0 },
    { 3,0,0,0,0,2,0,0,0 },
    { 0,2,5,0,0,0,2,0,0 },
    { 0,3,5,0,0,0,3,3,0 },
    { 0,0,0,5,4,0,0,0,5 },
    { 5,0,0,0,0,5,0,0,0 }
};

static word _LR_action [6][9] =
{
    { 0,0,0,0,0,0,1,0,0 },
    { 3,0,0,0,0,2,0,0,0 },
    { 0,6,5,0,0,0,4,0,0 },
    { 0,9,5,0,0,0,8,7,0 },
    { 0,0,0,1,6,0,0,0,1 },
    { 9,0,0,0,0,10,0,0,0 }
};

#if (defined (SMT_PROFILE))
static word _LR_count [11];
static long _LR_time  [11];
static word _LR_flow  [6][9];
#endif

static word _LR_offset [] =
{
    0,
    0,
    2,
    6,
    8,
    11,
    14,
    17,
    19,
    20,
    22
};

static word _LR_vector [] =
{
    0,_LR_STOP,
    1,2,3,_LR_STOP,
    4,_LR_STOP,
    5,3,_LR_STOP,
    6,0,_LR_STOP,
    7,8,_LR_STOP,
    9,_LR_STOP,
    _LR_STOP,
    8,_LR_STOP,
    10,8,_LR_STOP
};

static HOOK *_LR_module [11] = {
    check_socket_type,
    open_agent_log_file,
    open_master_socket,
    wait_for_socket_input,
    read_socket_data_repeatedly,
    accept_client_connection,
    signal_socket_error,
    shutdown_the_application,
    terminate_the_thread,
    echo_socket_data,
    close_agent_log_file
};

#if (defined (DEBUG))
static char *_LR_mname [11] =
{
     "Check-Socket-Type",
     "Open-Agent-Log-File",
     "Open-Master-Socket",
     "Wait-For-Socket-Input",
     "Read-Socket-Data-Repeatedly",
     "Accept-Client-Connection",
     "Signal-Socket-Error",
     "Shutdown-The-Application",
     "Terminate-The-Thread",
     "Echo-Socket-Data",
     "Close-Agent-Log-File"
};

static char *_LR_sname [6] =
{
     "After-Init",
     "Start-Thread",
     "Master-Input",
     "Echoing-Data",
     "Defaults",
     "End-Thread"
};

static char *_LR_ename [9] =
{
     "Client-Event",
     "Closed-Event",
     "Error-Event",
     "Exception-Event",
     "Fatal-Event",
     "Master-Event",
     "Ok-Event",
     "Read-Ok-Event",
     "Shutdown-Event"
};
#else
static char *_LR_mname [11] =
{
     "0",
     "1",
     "2",
     "3",
     "4",
     "5",
     "6",
     "7",
     "8",
     "9",
     "10"
};

static char *_LR_sname [6] =
{
     "0",
     "1",
     "2",
     "3",
     "4",
     "5"
};

static char *_LR_ename [9] =
{
     "0",
     "1",
     "2",
     "3",
     "4",
     "5",
     "6",
     "7",
     "8"
};
#endif
