/*---------------------------------------------------------------------------*
 *  smtxlog.d - LIBERO dialog data definitions for smtxlog.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 clear_event                     0
#define close_event                     1
#define concat_old_event                2
#define cycle_event                     3
#define cycle_now_event                 4
#define delete_old_event                5
#define error_event                     6
#define exception_event                 7
#define log_event                       8
#define move_old_event                  9
#define ok_event                        10
#define open_event                      11
#define process_old_event               12
#define put_event                       13
#define rename_old_event                14
#define shutdown_event                  15
#define timer_event                     16
#define _LR_STATE_after_init            0
#define _LR_STATE_before_opening        1
#define _LR_STATE_cycle_before_open     2
#define _LR_STATE_cycle_while_closed    3
#define _LR_STATE_logfile_open          4
#define _LR_STATE_defaults              5
#define _LR_defaults_state              5


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

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

MODULE initialise_the_thread        (THREAD *thread);
MODULE create_event_queue           (THREAD *thread);
MODULE terminate_the_thread         (THREAD *thread);
MODULE get_logfile_parameters       (THREAD *thread);
MODULE build_log_filename           (THREAD *thread);
MODULE check_if_cycle_before_open   (THREAD *thread);
MODULE open_logfile_append          (THREAD *thread);
MODULE recalculate_cycle_timer      (THREAD *thread);
MODULE check_queued_events_if_any   (THREAD *thread);
MODULE check_cycle_method           (THREAD *thread);
MODULE delete_old_logfile           (THREAD *thread);
MODULE rename_old_logfile           (THREAD *thread);
MODULE open_logfile_create          (THREAD *thread);
MODULE move_old_logfile             (THREAD *thread);
MODULE concat_old_logfile           (THREAD *thread);
MODULE process_old_logfile          (THREAD *thread);
MODULE get_log_request_arguments    (THREAD *thread);
MODULE write_request_log_entry      (THREAD *thread);
MODULE free_log_request_arguments   (THREAD *thread);
MODULE write_plain_log_entry        (THREAD *thread);
MODULE close_logfile                (THREAD *thread);
MODULE flush_event_queue            (THREAD *thread);
MODULE check_if_cycle_while_open    (THREAD *thread);
MODULE destroy_event_queue          (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][17] =
{
    { 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0 },
    { 1,0,0,3,2,0,0,0,0,0,0,4,0,0,0,0,0 },
    { 0,0,4,0,0,4,0,0,0,4,0,0,4,0,4,0,0 },
    { 0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0 },
    { 4,1,0,2,2,0,0,0,4,0,0,0,0,4,0,0,4 },
    { 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 }
};

static word _LR_action [6][17] =
{
    { 0,0,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0 },
    { 5,0,0,4,4,0,0,0,0,0,0,3,0,0,0,0,0 },
    { 0,0,9,0,0,7,0,0,0,8,0,0,10,0,6,0,0 },
    { 0,0,13,0,0,5,0,0,0,12,0,0,14,0,11,0,0 },
    { 18,19,0,17,17,0,0,0,15,0,0,0,0,16,0,0,20 },
    { 22,22,22,22,22,22,22,21,22,22,22,22,22,22,22,21,22 }
};

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

static word _LR_offset [] =
{
    0,
    0,
    2,
    4,
    11,
    13,
    15,
    20,
    24,
    29,
    34,
    39,
    41,
    43,
    46,
    48,
    53,
    56,
    59,
    63,
    66,
    70,
    73
};

static word _LR_vector [] =
{
    0,_LR_STOP,
    1,_LR_STOP,
    2,3,4,5,6,7,_LR_STOP,
    8,_LR_STOP,
    9,_LR_STOP,
    10,5,6,7,_LR_STOP,
    11,6,7,_LR_STOP,
    12,5,6,7,_LR_STOP,
    13,5,6,7,_LR_STOP,
    14,11,6,7,_LR_STOP,
    10,_LR_STOP,
    12,_LR_STOP,
    13,9,_LR_STOP,
    14,_LR_STOP,
    15,16,17,7,_LR_STOP,
    18,7,_LR_STOP,
    19,8,_LR_STOP,
    19,11,7,_LR_STOP,
    19,20,_LR_STOP,
    21,6,7,_LR_STOP,
    22,1,_LR_STOP,
    _LR_STOP
};

static HOOK *_LR_module [23] = {
    create_event_queue,
    terminate_the_thread,
    get_logfile_parameters,
    build_log_filename,
    check_if_cycle_before_open,
    open_logfile_append,
    recalculate_cycle_timer,
    check_queued_events_if_any,
    check_cycle_method,
    delete_old_logfile,
    rename_old_logfile,
    open_logfile_create,
    move_old_logfile,
    concat_old_logfile,
    process_old_logfile,
    get_log_request_arguments,
    write_request_log_entry,
    free_log_request_arguments,
    write_plain_log_entry,
    close_logfile,
    flush_event_queue,
    check_if_cycle_while_open,
    destroy_event_queue
};

#if (defined (DEBUG))
static char *_LR_mname [23] =
{
     "Create-Event-Queue",
     "Terminate-The-Thread",
     "Get-Logfile-Parameters",
     "Build-Log-Filename",
     "Check-If-Cycle-Before-Open",
     "Open-Logfile-Append",
     "Recalculate-Cycle-Timer",
     "Check-Queued-Events-If-Any",
     "Check-Cycle-Method",
     "Delete-Old-Logfile",
     "Rename-Old-Logfile",
     "Open-Logfile-Create",
     "Move-Old-Logfile",
     "Concat-Old-Logfile",
     "Process-Old-Logfile",
     "Get-Log-Request-Arguments",
     "Write-Request-Log-Entry",
     "Free-Log-Request-Arguments",
     "Write-Plain-Log-Entry",
     "Close-Logfile",
     "Flush-Event-Queue",
     "Check-If-Cycle-While-Open",
     "Destroy-Event-Queue"
};

static char *_LR_sname [6] =
{
     "After-Init",
     "Before-Opening",
     "Cycle-Before-Open",
     "Cycle-While-Closed",
     "Logfile-Open",
     "Defaults"
};

static char *_LR_ename [17] =
{
     "Clear-Event",
     "Close-Event",
     "Concat-Old-Event",
     "Cycle-Event",
     "Cycle-Now-Event",
     "Delete-Old-Event",
     "Error-Event",
     "Exception-Event",
     "Log-Event",
     "Move-Old-Event",
     "Ok-Event",
     "Open-Event",
     "Process-Old-Event",
     "Put-Event",
     "Rename-Old-Event",
     "Shutdown-Event",
     "Timer-Event"
};
#else
static char *_LR_mname [23] =
{
     "0",
     "1",
     "2",
     "3",
     "4",
     "5",
     "6",
     "7",
     "8",
     "9",
     "10",
     "11",
     "12",
     "13",
     "14",
     "15",
     "16",
     "17",
     "18",
     "19",
     "20",
     "21",
     "22"
};

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

static char *_LR_ename [17] =
{
     "0",
     "1",
     "2",
     "3",
     "4",
     "5",
     "6",
     "7",
     "8",
     "9",
     "10",
     "11",
     "12",
     "13",
     "14",
     "15",
     "16"
};
#endif
