summaryrefslogtreecommitdiff
path: root/cesar/lib/visual_state_api
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/lib/visual_state_api')
-rw-r--r--cesar/lib/visual_state_api/Module2
-rw-r--r--cesar/lib/visual_state_api/src/SEMExpl.c27
-rw-r--r--cesar/lib/visual_state_api/src/SEMExplA.c28
-rw-r--r--cesar/lib/visual_state_api/src/SEMForce.c27
-rw-r--r--cesar/lib/visual_state_api/src/SEMInq.c45
-rw-r--r--cesar/lib/visual_state_api/src/SEMInst.c33
-rw-r--r--cesar/lib/visual_state_api/src/SEMLibE.h1882
-rw-r--r--cesar/lib/visual_state_api/src/SEMMach.c27
-rw-r--r--cesar/lib/visual_state_api/src/SEMMain.c154
-rw-r--r--cesar/lib/visual_state_api/src/SEMName.c27
-rw-r--r--cesar/lib/visual_state_api/src/SEMNameA.c28
-rw-r--r--cesar/lib/visual_state_api/src/SEMStAll.c28
-rw-r--r--cesar/lib/visual_state_api/src/SEMState.c27
-rw-r--r--cesar/lib/visual_state_api/src/SMPExpl.c92
-rw-r--r--cesar/lib/visual_state_api/src/SMPExplA.c68
-rw-r--r--cesar/lib/visual_state_api/src/SMPForce.c32
-rw-r--r--cesar/lib/visual_state_api/src/SMPInq.c238
-rw-r--r--cesar/lib/visual_state_api/src/SMPInst.c78
-rw-r--r--cesar/lib/visual_state_api/src/SMPMach.c32
-rw-r--r--cesar/lib/visual_state_api/src/SMPMain.c939
-rw-r--r--cesar/lib/visual_state_api/src/SMPName.c92
-rw-r--r--cesar/lib/visual_state_api/src/SMPNameA.c67
-rw-r--r--cesar/lib/visual_state_api/src/SMPStAll.c36
-rw-r--r--cesar/lib/visual_state_api/src/SMPState.c32
24 files changed, 4041 insertions, 0 deletions
diff --git a/cesar/lib/visual_state_api/Module b/cesar/lib/visual_state_api/Module
new file mode 100644
index 0000000000..7645df89eb
--- /dev/null
+++ b/cesar/lib/visual_state_api/Module
@@ -0,0 +1,2 @@
+SOURCES := SEMExpl.c SEMExplA.c SEMForce.c SEMInq.c SEMInst.c SEMMach.c SEMMain.c SEMName.c SEMNameA.c SEMStAll.c SEMState.c SMPExpl.c SMPExplA.c SMPForce.c SMPInq.c SMPInst.c SMPMach.c SMPMain.c SMPName.c SMPNameA.c SMPStAll.c SMPState.c
+INCLUDES += lib/visual_state_api/src
diff --git a/cesar/lib/visual_state_api/src/SEMExpl.c b/cesar/lib/visual_state_api/src/SEMExpl.c
new file mode 100644
index 0000000000..054442b215
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMExpl.c
@@ -0,0 +1,27 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMExpl.c
+ *
+ * Function: Contains the SEM_Expl SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_Expl (unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char *Text, unsigned short MaxSize)
+{
+ return (SMP_Expl (SEMContext, IdentType, IdentNo, Text, MaxSize));
+}
diff --git a/cesar/lib/visual_state_api/src/SEMExplA.c b/cesar/lib/visual_state_api/src/SEMExplA.c
new file mode 100644
index 0000000000..ae7bed445e
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMExplA.c
@@ -0,0 +1,28 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMExplA.c
+ *
+ * Function: Contains the SEM_ExplAbs SEM Library Expert version 4
+ * function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_ExplAbs (unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char VS_TQ_RULEBASE **Text)
+{
+ return (SMP_ExplAbs (SEMContext, IdentType, IdentNo, Text));
+}
diff --git a/cesar/lib/visual_state_api/src/SEMForce.c b/cesar/lib/visual_state_api/src/SEMForce.c
new file mode 100644
index 0000000000..f3bce1add9
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMForce.c
@@ -0,0 +1,27 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMExpl.c
+ *
+ * Function: Contains the SEM_ForceState SEM Library Expert version 4
+ * function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_ForceState (SEM_STATE_TYPE StateNo)
+{
+ return (SMP_ForceState (SEMContext, StateNo));
+}
diff --git a/cesar/lib/visual_state_api/src/SEMInq.c b/cesar/lib/visual_state_api/src/SEMInq.c
new file mode 100644
index 0000000000..203c998f80
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMInq.c
@@ -0,0 +1,45 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMInq.c
+ *
+ * Function: Contains the SEM_Inquiry, SEM_GetInput and SEM_GetInputAll
+ * SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_Inquiry (void)
+{
+ return (SMP_Inquiry (SEMContext));
+}
+
+
+unsigned char VS_CALL_CONV SEM_GetInput (SEM_EVENT_TYPE *EventNo,
+ SEM_EVENT_TYPE *EventList)
+{
+ return (SMP_GetInput (SEMContext, EventNo, EventList));
+}
+
+
+
+#ifdef SEM_GET_INPUT_ALL
+unsigned char VS_CALL_CONV SEM_GetInputAll (SEM_EVENT_TYPE *EventVector,
+ SEM_EVENT_TYPE *EventList, SEM_EVENT_TYPE MaxSize)
+{
+ return (SMP_GetInputAll (SEMContext, EventVector, EventList, MaxSize));
+}
+#endif
+
diff --git a/cesar/lib/visual_state_api/src/SEMInst.c b/cesar/lib/visual_state_api/src/SEMInst.c
new file mode 100644
index 0000000000..ddd32600ba
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMInst.c
@@ -0,0 +1,33 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMInst.c
+ *
+ * Function: Contains the SEM_InitInstances and SEM_SetInstance
+ SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.1 ! 021298 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_InitInstances (void)
+{
+ return (SMP_InitInstances (SEMContext));
+}
+
+
+unsigned char VS_CALL_CONV SEM_SetInstance (SEM_INSTANCE_TYPE Instance)
+{
+ return (SMP_SetInstance (SEMContext, Instance));
+}
diff --git a/cesar/lib/visual_state_api/src/SEMLibE.h b/cesar/lib/visual_state_api/src/SEMLibE.h
new file mode 100644
index 0000000000..6262d60aea
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMLibE.h
@@ -0,0 +1,1882 @@
+/*
+ * Type: Header File
+ *
+ * Id: SEMLibE.h
+ *
+ * Function: Header file for the SEM Library Expert version 4 definitions
+ * and function prototypes.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.9 ! 240299 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#ifndef __SEMLIBE_H
+#define __SEMLIBE_H
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+
+/* Include SEM Library Definition Header File. */
+#include "SEMEDef.h"
+
+
+#ifndef VS_CODER_GUID
+#error The generated files were generated by a visualSTATE Coder, which is not compliant with this version of the visualSTATE Expert API.
+#endif
+
+
+#ifdef VISUALSTATE_EXPERT_DLL
+#include "SEMEdll.h"
+#else
+#define VS_CALL_CONV
+#define VS_CONTEXT_TYPE SEMContext
+#endif
+
+
+#ifndef VS_TRUE
+#define VS_TRUE (1)
+#endif
+
+#ifndef VS_FALSE
+#define VS_FALSE (0)
+#endif
+
+
+#define SEM_VERS_ID 0X050
+
+
+#ifdef VS_RUNTIME_INFO
+typedef struct
+{
+ char pSignatureVersion[VS_SIGNATURE_VERSION_LENGTH];
+ char pSignatureContent[VS_SIGNATURE_CONTENT_LENGTH];
+} VSRunTimeInfo;
+#endif
+
+
+typedef struct
+{
+ unsigned long IdAndEventGroupType;
+ unsigned long nNofEvents;
+ unsigned long nNofSignals;
+ unsigned long nNofStates;
+ unsigned long nNofStateMachines;
+ unsigned long nNofActionFunctions;
+ unsigned long nNofInstances;
+ unsigned long SSize;
+ unsigned long SMIPos;
+ unsigned long EGTPos;
+ unsigned long EGTIPos;
+ unsigned long RDPos;
+ unsigned long RIPos;
+ unsigned long RTIPos;
+ unsigned long TSPos;
+ unsigned long ENIPos;
+ unsigned long SNIPos;
+ unsigned long ANIPos;
+ unsigned long EEIPos;
+ unsigned long SEIPos;
+ unsigned long AEIPos;
+ unsigned long contextPtrOffset;
+} RBH;
+
+
+extern SEM_CONTEXT *SEMContext;
+extern unsigned char SEMInitCC;
+
+
+enum
+{
+ /*
+ * Status code 0: SES_OKAY.
+ *
+ * Explanation: Function performed successfully.
+ *
+ * Solution: None.
+ */
+ SES_OKAY, /* 0 */
+
+
+ /*
+ * Status code: SES_FOUND.
+ *
+ * Explanation: The called function has returned an identifier index
+ * number.
+ *
+ * Solution: Process the returned identifier index number. If the
+ * function SEM_GetInput/SMP_GetInput or SEM_GetOutput/
+ * SMP_GetOutput was called, the function can be called
+ * again to find more events or action expressions.
+ */
+ SES_FOUND, /* 1 */
+
+
+ /*
+ * Status code: SES_ACTIVE.
+ *
+ * Explanation: The completion code has one of the two expositions:
+ * 1) A state/event deduction is started, while an event
+ * inquiry is active. All inquired events have not been
+ * returned by the function SEM_GetInput/SMP_GetInput.
+ * 2) An event inquiry is started, while a state/event
+ * deduction is active. All deduced action expressions
+ * have not been returned by the function SEM_GetOutput/
+ * SMP_GetOutput and the SEM_NextState/SMP_NextState has
+ * not been called to finish the state/event deduction.
+ *
+ * Solution: The completion code is a warning and perhaps the
+ * application program should be rewritten. An event inquiry
+ * and a state/event deduction should not be active at the
+ * same time.
+ */
+ SES_ACTIVE, /* 2 */
+
+
+ /*
+ * Error code: SES_CONTRADICTION.
+ *
+ * Explanation: A contradiction has been detected between two states in a
+ * state machine.
+ *
+ * Solution: Check the VS System.
+ */
+ SES_CONTRADICTION, /* 3 */
+
+
+ /*
+ * Error code: SES_RANGE_ERR.
+ *
+ * Explanation: You are making a reference to an identifier that does not
+ * exist. Note that the first index number is 0. If the rule
+ * base has 4 identifier of the same type and you use a
+ * function with the variable parameter = 4, the function
+ * will return with a SES_RANGE_ERR error. In this case the
+ * highest variable index number is 3.
+ *
+ * Solution: The application program may check the index parameters
+ * with one of the following variables in the SEM_Context
+ * struct:
+ *
+ * nNofEvents
+ * nNofStates
+ * nNofActionFunctions
+ * nNofStateMachines
+ */
+ SES_RANGE_ERR, /* 4 */
+
+
+ /*
+ * Error code: SES_TEXT_TOO_LONG.
+ *
+ * Explanation: The requested text is longer than the specified maximum
+ * length.
+ *
+ * Solution: Increase the maximum length.
+ */
+ SES_TEXT_TOO_LONG, /* 5 */
+
+
+ /*
+ * Error code: SES_TYPE_ERR.
+ *
+ * Explanation: A text function has been called with the wrong identifier
+ * type or the specified text is not included in the VS
+ * System source file.
+ *
+ * Solution: Use the indentifier type symbols (EVENT_TYPE, STATE_TYPE
+ * or ACTION_TYPE) defined in the SEMlibE.h file and remember
+ * to include wanted text in the VS System.
+ */
+ SES_TYPE_ERR, /* 6 */
+
+
+ /*
+ * Error code: SES_EMPTY.
+ *
+ * Explanation: No events has been given to the SEM_Deduct/SMP_Deduct
+ * function before calling this function.
+ *
+ * Solution: Call the SEM_Deduct/SMP_Deduct function with an event
+ * number.
+ */
+ SES_EMPTY, /* 7 */
+
+
+ /*
+ * Error code: SES_BUFFER_OVERFLOW.
+ *
+ * Explanation: A destination buffer cannot hold the number of items
+ * found.
+ *
+ * Solution: Call the function with an extended buffer as destination.
+ */
+ SES_BUFFER_OVERFLOW, /* 8 */
+
+
+ /*
+ * Error code: SES_SIGNAL_QUEUE_FULL.
+ *
+ * Explanation: Signal queue is full.
+ *
+ * Solution: Increase the maximum signal queue size in the VS System or
+ * via the VS Coder signal queue size option.
+ */
+ SES_SIGNAL_QUEUE_FULL, /* 9 */
+
+
+ /*
+ * Status code: SES_VERS_ERR
+ *
+ * Explanation: Incompatible version of VS System attempted loaded.
+ *
+ * Solution: Recompile the VS System.
+ */
+ SES_VERS_ERR = 16, /* 16 */
+
+
+ /*
+ * Status code: SES_FILE_ERR
+ *
+ * Explanation: Error while accessing VS System file.
+ *
+ * Solution: 1) Check file name.
+ * 2) Regenerate VS System.
+ */
+ SES_FILE_ERR, /* 17 */
+
+
+ /*
+ * Status code: SES_MEM_ERR
+ *
+ * Explanation: Error while allocating memory for VS System.
+ *
+ * Solution: 1) Free some memory in your computer.
+ * 2) On PCs, use a large-data memory model.
+ */
+ SES_MEM_ERR, /* 18 */
+
+
+ /*
+ * Status code: SES_NOT_LOADED
+ *
+ * Explanation: No VS System is loaded.
+ *
+ * Solution: Load a VS System before calling the function.
+ */
+ SES_NOT_LOADED, /* 19 */
+
+
+ /*
+ * Status code: SES_NOT_COMPATIBLE
+ *
+ * Explanation: Function is not compatible with current setup.
+ *
+ * Solution: Use an other function.
+ */
+ SES_NOT_COMPATIBLE, /* 20 */
+
+
+ /*
+ * Status code: SES_TYPE_OVERFLOW
+ *
+ * Explanation: The number of instances * state machines exceeds
+ * the range for an unsigned long.
+ *
+ * Solution: Reduce the number of instances or state machines.
+ */
+ SES_TYPE_OVERFLOW /* 21 */
+};
+
+
+/* Identifier types, used when getting texts and explanations. */
+enum {EVENT_TYPE, STATE_TYPE, ACTION_TYPE};
+
+
+/*
+ * Used internal in SMPMain.c
+ */
+#define STATE_SEM_INITIALIZE 0x00
+#define STATE_SEM_SIGNAL 0x01
+#define STATE_SEM_PREPARE 0x02
+#define STATE_SEM_CONSULT 0x03
+#define STATE_SEM_OUTPUT 0x04
+#define STATE_SEM_OKAY 0x05
+
+// added by GL 29/10/2007
+#define SEM_FUNC_OLD_NAMING_STYLE 0
+/*
+ * State/event naming style.
+ */
+#if (SEM_FUNC_OLD_NAMING_STYLE)
+#define SEM_Load sem_load
+#define SEM_Connect sem_connect
+#define SEM_Free sem_free
+#define SEM_Init sem_init
+#define SEM_InitGuardCallBack sem_init_guard_call_back
+#define SEM_InitSignalDBCallBack sem_init_signal_d_b_call_back
+#define SEM_InitSignalQueue sem_init_signal_queue
+#define SEM_InitInstances sem_init_instances
+#define SEM_SetInstance sem_set_instance
+#define SEM_Deduct sem_deduct
+#define SEM_GetOutput sem_get_output
+#define SEM_GetOutputAll sem_get_output_all
+#define SEM_NextState sem_next_state
+#define SEM_NextStateChg sem_next_state_chg
+#define SEM_Inquiry sem_inquiry
+#define SEM_GetInput sem_get_input
+#define SEM_GetInputAll sem_get_input_all
+#define SEM_Name sem_name
+#define SEM_NameAbs sem_name_abs
+#define SEM_Expl sem_expl
+#define SEM_ExplAbs sem_expl_abs
+#define SEM_State sem_state
+#define SEM_StateAll sem_state_all
+#define SEM_Machine sem_machine
+#define SEM_ForceState sem_force_state
+
+#define SMP_Connect smp_connect
+#define SMP_Load smp_load
+#define SMP_Free smp_free
+#define SMP_Init smp_init
+#define SMP_InitGuardCallBack smp_init_guard_call_back
+#define SMP_InitSignalDBCallBack smp_init_signal_d_b_call_back
+#define SMP_InitSignalQueue smp_init_signal_queue
+#define SMP_InitInstances smp_init_instances
+#define SMP_SetInstance smp_set_instance
+#define SMP_Deduct smp_deduct
+#define SMP_GetOutput smp_get_output
+#define SMP_GetOutputAll smp_get_output_all
+#define SMP_NextState smp_next_state
+#define SMP_NextStateChg smp_next_state_chg
+#define SMP_Inquiry smp_inquiry
+#define SMP_GetInput smp_get_input
+#define SMP_GetInputAll smp_get_input_all
+#define SMP_Name smp_name
+#define SMP_NameAbs smp_name_abs
+#define SMP_Expl smp_expl
+#define SMP_ExplAbs smp_expl_abs
+#define SMP_State smp_state
+#define SMP_StateAll smp_state_all
+#define SMP_Machine smp_machine
+#define SMP_ForceState smp_force_state
+#endif
+
+
+/*
+ * Name : SEM_Load
+ *
+ * Description : Calls SMP_Load.
+ *
+ * Argument : See 'argument' section for SMP_Load.
+ *
+ * Return : See 'return' section for SMP_Load.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_Load (const char *FileName);
+
+
+/*
+ * Name : SEM_Connect
+ *
+ * Description : Calls SMP_Connect.
+ *
+ * Argument : See 'argument' section for SMP_Connect.
+ *
+ * Return : See 'return' section for SMP_Connect.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SEM_Connect (void VS_TQ_RULEBASE *VSData);
+
+
+/*
+ * Name : SEM_Free
+ *
+ * Description : Calls SMP_Free.
+ *
+ * Argument : See 'argument' section for SMP_Free.
+ *
+ * Return : See 'return' section for SMP_Free.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern void VS_CALL_CONV SEM_Free (void);
+
+
+/*
+ * Name : SEM_Init
+ *
+ * Description : Calls SMP_Init.
+ *
+ * Argument : See 'argument' section for SMP_Init.
+ *
+ * Return : See 'return' section for SMP_Init.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern void VS_CALL_CONV SEM_Init (void);
+
+
+/*
+ * Name : SEM_InitGuardCallBack
+ *
+ * Description : Calls SEM_InitGuardCallBack.
+ *
+ * Argument : See 'argument' section for SEM_InitGuardCallBack.
+ *
+ * Return : See 'return' section for SEM_InitGuardCallBack.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_GUARD_EXPRESSION)
+#if (SEM_FUNCEXPHANDLING == 0)
+void SEM_InitGuardCallBack (VS_GUARDEXPR_TYPE VS_TQ_GUARDEXPRCOL * Guard);
+#else
+void SEM_InitGuardCallBack (unsigned char (*Guard)(struct SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_GUARD_EXPRESSION_TYPE i));
+#endif
+#endif
+
+
+/*
+ * Name : SEM_InitSignalDBCallBack
+ *
+ * Description : Calls SEM_InitSignalDBCallBack.
+ *
+ * Argument : See 'argument' section for SEM_InitSignalDBCallBack.
+ *
+ * Return : See 'return' section for SEM_InitSignalDBCallBack.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_SIGNAL_DB)
+void SEM_InitSignalDBCallBack (void (*SEM_SignalDB)(SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_EVENT_TYPE SignalNo));
+#endif
+
+
+/*
+ * Name : SEM_InitSignalQueue
+ *
+ * Description : Calls SMP_InitSignalQueue.
+ *
+ * Argument : See 'argument' section for SMP_InitSignalQueue.
+ *
+ * Return : See 'return' section for SMP_InitSignalQueue.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_SIGNAL)
+extern void VS_CALL_CONV SEM_InitSignalQueue (void);
+#endif
+
+
+/*
+ * Name : SEM_InitInstances
+ *
+ * Description : Calls SMP_InitInstances.
+ *
+ * Argument : See 'argument' section for SMP_InitInstances.
+ *
+ * Return : See 'return' section for SMP_InitInstances.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_InitInstances (void);
+
+
+/*
+ * Name : SEM_SetInstance
+ *
+ * Description : Calls SMP_SetInstance.
+ *
+ * Argument : See 'argument' section for SMP_SetInstance.
+ *
+ * Return : See 'return' section for SMP_SetInstance.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_SetInstance (SEM_INSTANCE_TYPE Instance);
+
+
+/*
+ * Name : SEM_Deduct
+ *
+ * Description : Calls SMP_Deduct.
+ *
+ * Argument : See 'argument' section for SMP_Deduct.
+ *
+ * Return : See 'return' section for SMP_Deduct.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_Deduct (SEM_EVENT_TYPE EventNo);
+
+
+/*
+ * Name : SEM_GetOutput
+ *
+ * Description : Calls SMP_GetOutput.
+ *
+ * Argument : See 'argument' section for SMP_GetOutput.
+ *
+ * Return : See 'return' section for SMP_GetOutput.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_GetOutput (SEM_ACTION_EXPRESSION_TYPE *ActionNo);
+
+
+/*
+ * Name : SEM_GetOutputAll
+ *
+ * Description : Calls SMP_GetOutputAll.
+ *
+ * Argument : See 'argument' section for SMP_GetOutputAll.
+ *
+ * Return : See 'return' section for SMP_GetOutputAll.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_GetOutputAll (
+ SEM_ACTION_EXPRESSION_TYPE *ActionExprVector,
+ SEM_ACTION_EXPRESSION_TYPE MaxSize);
+
+
+/*
+ * Name : SEM_NextState
+ *
+ * Description : Calls SMP_NextState.
+ *
+ * Argument : See 'argument' section for SMP_NextState.
+ *
+ * Return : See 'return' section for SMP_NextState.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if !defined SEM_NEXT_STATE_CHG || defined VISUALSTATE_EXPERT_DLL
+extern unsigned char VS_CALL_CONV SEM_NextState (void);
+#endif
+
+
+/*
+ * Name : SEM_NextStateChg
+ *
+ * Description : Calls SMP_NextStateChg.
+ *
+ * Argument : See 'argument' section for SMP_NextStateChg.
+ *
+ * Return : See 'return' section for SMP_NextStateChg.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if defined SEM_NEXT_STATE_CHG || defined VISUALSTATE_EXPERT_DLL
+extern unsigned char VS_CALL_CONV SEM_NextStateChg (void);
+#endif
+
+
+/*
+ * Name : SEM_Inquiry
+ *
+ * Description : Calls SMP_Inquiry.
+ *
+ * Argument : See 'argument' section for SMP_Inquiry.
+ *
+ * Return : See 'return' section for SMP_Inquiry.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_Inquiry (void);
+
+
+/*
+ * Name : SEM_GetInput
+ *
+ * Description : Calls SMP_GetInput.
+ *
+ * Argument : See 'argument' section for SMP_GetInput.
+ *
+ * Return : See 'return' section for SMP_GetInput.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_GetInput (SEM_EVENT_TYPE *EventNo,
+ SEM_EVENT_TYPE *EventList);
+
+
+/*
+ * Name : SEM_GetInputAll
+ *
+ * Description : Calls SMP_GetInputAll.
+ *
+ * Argument : See 'argument' section for SMP_GetInputAll.
+ *
+ * Return : See 'return' section for SMP_GetInputAll.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_GetInputAll (SEM_EVENT_TYPE *EventVector,
+ SEM_EVENT_TYPE *EventList, SEM_EVENT_TYPE MaxSize);
+
+
+/*
+ * Name : SEM_Name
+ *
+ * Description : Calls SMP_Name.
+ *
+ * Argument : See 'argument' section for SMP_Name.
+ *
+ * Return : See 'return' section for SMP_Name.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_Name (unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char *Text, unsigned short MaxSize);
+
+
+/*
+ * Name : SEM_NameAbs
+ *
+ * Description : Calls SMP_NameAbs.
+ *
+ * Argument : See 'argument' section for SMP_NameAbs.
+ *
+ * Return : See 'return' section for SMP_NameAbs.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_NameAbs (unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char VS_TQ_RULEBASE **Text);
+
+
+/*
+ * Name : SEM_Expl
+ *
+ * Description : Calls SMP_Expl.
+ *
+ * Argument : See 'argument' section for SMP_Expl.
+ *
+ * Return : See 'return' section for SMP_Expl.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_Expl (unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char *Text, unsigned short MaxSize);
+
+
+/*
+ * Name : SEM_ExplAbs
+ *
+ * Description : Calls SMP_ExplAbs.
+ *
+ * Argument : See 'argument' section for SMP_ExplAbs.
+ *
+ * Return : See 'return' section for SMP_ExplAbs
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_ExplAbs (unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char VS_TQ_RULEBASE **Text);
+
+
+/*
+ * Name : SEM_State
+ *
+ * Description : Calls SMP_State.
+ *
+ * Argument : See 'argument' section for SMP_State.
+ *
+ * Return : See 'return' section for SMP_State.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_State (SEM_STATE_MACHINE_TYPE StateMachineNo,
+ SEM_STATE_TYPE *StateNo);
+
+
+/*
+ * Name : SEM_StateAll
+ *
+ * Description : Calls SMP_StateAll.
+ *
+ * Argument : See 'argument' section for SMP_StateAll.
+ *
+ * Return : See 'return' section for SMP_StateAll.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_StateAll (SEM_STATE_TYPE *StateVector,
+ SEM_STATE_MACHINE_TYPE MaxSize);
+
+
+/*
+ * Name : SEM_Machine
+ *
+ * Description : Calls SMP_Machine.
+ *
+ * Argument : See 'argument' section for SMP_Machine.
+ *
+ * Return : See 'return' section for SMP_Machine.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_Machine (SEM_STATE_TYPE StateNo,
+ SEM_STATE_MACHINE_TYPE *StateMachineNo);
+
+
+/*
+ * Name : SEM_ForceState
+ *
+ * Description : Calls SMP_ForceState.
+ *
+ * Argument : See 'argument' section for SMP_ForceState.
+ *
+ * Return : See 'return' section for SMP_ForceState.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char VS_CALL_CONV SEM_ForceState (SEM_STATE_TYPE StateNo);
+
+
+/*
+ * Name : SEM_Action
+ *
+ * Description : The macro will call an action function by using the
+ * VSAction function pointer table.
+ *
+ * Argument : ActionNo:
+ * Action index number.
+ *
+ * Return : None.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_FUNC_OLD_NAMING_STYLE)
+#define sem_action(ActionNo) (*VSAction[ActionNo])(VS_CONTEXT_TYPE)
+#else
+#define SEM_Action(ActionNo) (*VSAction[ActionNo])(VS_CONTEXT_TYPE)
+#endif
+
+
+/*
+ * Name : SEM_TableAction
+ *
+ * Description : The macro will call an action function by using the
+ * specified function pointer table.
+ *
+ * Argument : Table:
+ * Function pointer table.
+ *
+ * ActionNo:
+ * Action index number.
+ *
+ * Context (not in DLL):
+ * A pointer to a VS system context.
+ *
+ * Return : None.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_FUNC_OLD_NAMING_STYLE)
+#define sem_table_action(Table, ActionNo) (* (Table)[ActionNo])(VS_CONTEXT_TYPE)
+#else
+#define SEM_TableAction(Table, ActionNo) (* (Table)[ActionNo])(VS_CONTEXT_TYPE)
+#endif
+
+
+/*
+ * Name : SMP_Connect
+ *
+ * Description : This function connects to a binary VS System already
+ * residing in memory.
+ *
+ * Argument : Context:
+ * A pointer pointer to a VS System context.
+ *
+ * VSData:
+ * A pointer to the memory area where the VS System
+ * resides.
+ * The VS System area must be an image of the binary
+ * VS System file including texts.
+ *
+ * Return : Completion code:
+ *
+ * SES_FILE_ERR:
+ * VS System file version error.
+ *
+ * SES_MEM_ERR:
+ * There is not enough heap memory.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_Connect(SEM_CONTEXT **Context, void VS_TQ_RULEBASE *VSDdata);
+
+
+/*
+ * Name : SMP_Load
+ *
+ * Description : This function loads a binary VS System from a file.
+ * A new context is allocated, the VS System is loaded and
+ * the context is initialized.
+ * Futhermore SMP_Init is called. SMP_InitSignalQueue is also
+ * called if the VS System has signals.
+ * Texts are not loaded into memory.
+ *
+ * Argument : Context:
+ * A pointer pointer to a VS System context.
+ *
+ * FileName:
+ * A pointer to the character string containing the name of
+ * the VS System file to be loaded.
+ *
+ * Return : Completion code:
+ *
+ * SES_FILE_ERR:
+ * VS System file version error.
+ *
+ * SES_MEM_ERR:
+ * There is not enough heap memory.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_Load (SEM_CONTEXT **Context, const char *FileName);
+
+
+/*
+ * Name : SMP_Free
+ *
+ * Description : This function frees the memory allocated by a previous
+ * call to SMP_Load or SMP_Connect. If the VS System was
+ * loaded from disk, the corresponding heap memory is
+ * deallocated.
+ * If context is not equal to NULL, SMP_Free will free the
+ * memory allocated by the VS System and the context.
+ * If the VS System was loaded from disk, the VS System file
+ * is closed.
+ * If context is NULL, nothing is done.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * Return : None.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern void SMP_Free (SEM_CONTEXT VS_TQ_CONTEXT *Context);
+
+
+/*
+ * Name : SMP_Init
+ *
+ * Description : This function (re)initializes the VS System.
+ * Before calling any of the following SEM functions, this
+ * function can be called to initialize the state/event
+ * system.
+ * Both SMP_Load and SMP_Connect implicitly calls SMP_Init
+ * and SMP_InitSignalQueue, thus no call should be
+ * neccessary except if reinitialization is needed.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * Return : Completion code:
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_Init (SEM_CONTEXT VS_TQ_CONTEXT *Context);
+
+
+/*
+ * Name : SMP_InitGuardCallBack
+ *
+ * Description : This function initializes the guard expression call back
+ * function.
+ * This function should be called after the
+ * SMP_Load/SMP_Connect function if the VS System contains
+ * guard expressions.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * Guard:
+ * If function pointer tables are not used:
+ * A pointer pointer to the VS System guard function
+ * else
+ * A pointer pointer to the VS System guard expression
+ * function pointer table.
+ *
+ * Return : None.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_GUARD_EXPRESSION)
+#if (SEM_FUNCEXPHANDLING == 0)
+extern void SMP_InitGuardCallBack (SEM_CONTEXT VS_TQ_CONTEXT *Context, VS_GUARDEXPR_TYPE VS_TQ_GUARDEXPRCOL * Guard);
+#else
+extern void SMP_InitGuardCallBack (SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char (* Guard)(SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_GUARD_EXPRESSION_TYPE i));
+#endif
+#endif
+
+
+/*
+ * Name : SMP_InitSignalDBCallBack
+ *
+ * Description : This function initializes the signal double buffer call
+ * back function.
+ * This function should be called after the
+ * SMP_Load/SMP_Connect function if the VS System used
+ * double buffering for any signals.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * SEM_SignalDB:
+ * A pointer to the VS System signal double buffer function
+ * pointer table.
+ *
+ * Return : None.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_SIGNAL_DB)
+extern void SMP_InitSignalDBCallBack (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ void (*SEM_SignalDB)(SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_EVENT_TYPE SignalNo));
+#endif
+
+
+/*
+ * Name : SMP_InitSignalQueue
+ *
+ * Description : This function (re)initialize the signal queue in a
+ * VS System. This function must be called together with
+ * the SMP_Init function.
+ * Both SMP_Load and SMP_Connect implicitly calls SMP_Init
+ * and SMP_InitSignalQueue, thus no call should be
+ * neccessary except if reinitialization is needed.
+ * The function will only be avaliable if the signal queue
+ * is enable.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * Return : None.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_SIGNAL)
+extern void SMP_InitSignalQueue (SEM_CONTEXT VS_TQ_CONTEXT *Context);
+#endif
+
+
+/*
+ * Name : SMP_InitInstances
+ *
+ * Description : Initialize a set of instances of the VS System.
+ * The function is used for initializing a number of
+ * instances of the VS System.
+ * If the function has already been called, previous
+ * instances are deallocated and a new set is allocated.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * Return : Completion code:
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_MEM_ERR:
+ * There is not enough heap memory.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_InitInstances (SEM_CONTEXT VS_TQ_CONTEXT *Context);
+
+
+/*
+ * Name : SMP_SetInstance
+ *
+ * Description : The function is used for setting up the instances of
+ * the VS System. The instance will be active until
+ * another call of the function.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * Instances:
+ * The number of VS System instances to be initialized.
+ *
+ * Return : Completion code:
+ *
+ * SES_ACTIVE:
+ * The function was attempted executed while a deduct or
+ * inquiry session was active. The function is not
+ * executed.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * The index number of the VS System instance is
+ * invalid.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_SetInstance (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_INSTANCE_TYPE Instance);
+
+
+/*
+ * Name : SMP_Deduct
+ *
+ * Description : The function prepares the reception of action expressions,
+ * that can be deduced on basis of the given event, the
+ * internal current state vector and the rules in the
+ * VS System.
+ * All action expressions are deduced by continously calling
+ * the function SMP_GetOutput or by one call to
+ * SMP_GetOutputAll.
+ * Before calling the SMP_Deduct function again, the
+ * SMP_NextState or SMP_NextStateChg should be called to
+ * enter the new states, if any.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * EventNo:
+ * Event number to be processed.
+ *
+ * Return : Completion code:
+ *
+ * SES_ACTIVE:
+ * The function SMP_Inquiry has been called. All inquired
+ * events have not been returned by the function
+ * SMP_GetInput or SMP_GetInputAll.
+ * The deduction is okay, but the user should not call the
+ * function SMP_GetInput before the functions
+ * SMP_NextState or SMP_NextStateChg and SMP_Inquiry have
+ * been called.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * Event is out of range.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_Deduct (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_EVENT_TYPE EventNo);
+
+
+
+/*
+ * Name : SMP_GetOutput
+ *
+ * Description : The function finds an action expressions, if any has been
+ * deduced on basis of the event given to the function
+ * SMP_Deduct, the internal current state vector and the
+ * rules in the VS System.
+ * All action expressions are found by continuous calls to
+ * the SMP_GetOutput function. When the SMP_GetOutput returns
+ * the completion code SES_OKAY all action expressions have
+ * been found.
+ * Use the SMP_Action or SMP_TableAction macros to call the
+ * action expressions.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * ActionNo:
+ * Pointer to store the deduced action expression.
+ *
+ * Return : Completion code:
+ *
+ * SES_CONTRADICTION:
+ * Contradiction detected, the VS System is not consistent.
+ * Check the VS System.
+ *
+ * SES_EMPTY:
+ * No event has been given to the SMP_Deduct function, i.e.
+ * SMP_Deduct has not been called before calling the
+ * SMP_GetOutput function.
+ *
+ * SES_FOUND:
+ * An action expression has been found. The user can
+ * continue to call the SMP_GetOutput, more action
+ * expressions may be found.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_OKAY:
+ * All action expressions have been found.
+ * The user can now call the SMP_NextState or
+ * SMP_NextStateChg function to change state.
+ * If SMP_deduct is called with the same event and
+ * SMP_NextState and SMP_NextStateChg is not called, all
+ * action expressions can be found again by calling
+ * SMP_GetOutput.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_GetOutput (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_ACTION_EXPRESSION_TYPE *ActionNo);
+
+
+/*
+ * Name : SMP_GetOutputAll
+ *
+ * Description : The function finds all action expression, if any has been
+ * deduced on basis of the event given to the function
+ * SMP_Deduct, the internal current state vector and the
+ * rules in the VS System.
+ * All action expressions are found by one call to the
+ * SMP_GetOutputAll function.
+ * SMP_GetOutputAll returns the completion code SES_OKAY if
+ * all action expression have succesfully been found.
+ * Defining the symbol SEM_GET_OUTPUT_ALL for your
+ * preprocessor/compiler will enable this function.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * ActionExprVector:
+ * A pointer to array to store the deduced outputs.
+ *
+ * MaxSize:
+ * Specifies the maximum length of the output vector
+ * including the symbol ACTION_EXPRESSION_TERMINATION_ID.
+ *
+ * Return : Completion code:
+ *
+ * SES_BUFFER_OVERFLOW:
+ * The specified MaxSize is too small. The action
+ * expressions vector array is not valid.
+ *
+ * SES_CONTRADICTION:
+ * Contradiction detected, the VS System is not
+ * consistent. Check the VS System.
+ *
+ * SES_EMPTY:
+ * No event has been given to the SMP_Deduct function,
+ * i.e. SMP_Deduct has not been called before calling the
+ * SMP_GetOutputAll function.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_OKAY:
+ * All action expressions have been found.
+ * The user can now call the SMP_NextState or
+ * SMP_NextStateChg function to change state.
+ * If SMP_Deduct is called with the same event and
+ * SMP_NextState or SMP_NextStateChg is not called, all
+ * action expressions can be found again by calling
+ * SMP_GetOutpuAll.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_GetOutputAll (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_ACTION_EXPRESSION_TYPE *ActionExprVector,
+ SEM_ACTION_EXPRESSION_TYPE MaxSize);
+
+
+#if defined SEM_NEXT_STATE_CHG || defined VISUALSTATE_EXPERT_DLL
+
+extern unsigned char _SMP_NextStateChg(SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char nextStateChg);
+
+#else
+
+extern unsigned char _SMP_NextStateChg(SEM_CONTEXT VS_TQ_CONTEXT *Context);
+
+#endif
+
+
+/*
+ * Name : SMP_NextState
+ *
+ * Description : The function will update the intern current state vector,
+ * if any states can be found on basis of the event given to
+ * the function SMP_Deduct, the internal current state vector
+ * and the rules in the VS System.
+ * The field StateChange in the current SEM_CONTEXT is VS_FALSE
+ * if no state change has occurred, else VS_TRUE.
+ * The state change feature can also be reached by using the
+ * function SMP_NextStateChg. This function is mutually
+ * exclusive with the SMP_NextStateChg function.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * Return : Completion code:
+ *
+ * SES_CONTRADICTION:
+ * Contradiction detected, the VS System is not
+ * consistent. Check the VS System.
+ *
+ * SES_EMPTY:
+ * No event has been given to the SMP_Deduct function,
+ * i.e. SMP_deduct has not been called before calling
+ * the SMP_NextState function.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if defined VISUALSTATE_EXPERT_DLL
+
+#define SMP_NextState(Context) _SMP_NextStateChg(Context, VS_FALSE)
+
+#elif !defined SEM_NEXT_STATE_CHG
+
+/* default for normal users */
+#define SMP_NextState(Context) _SMP_NextStateChg(Context)
+
+#endif
+
+
+/*
+ * Name : SMP_NextStateChg
+ *
+ * Description : The function will update the internal current state
+ * vector, if any states can be found on basis of the event
+ * given to the function SMP_Deduct, the internal current
+ * state vector and the rules in the VS System.
+ * The returned completion code will tell if the internal
+ * state vector was updated with a new value or not, see also
+ * SMP_NextState. This feature could be used to determine if
+ * the SMP_Inquiry function needs to be called.
+ * This function is mutually exclusive with SMP_NextState and
+ * must be enabled by defining the symbol SEM_NEXT_STATE_CHG
+ * for your preprocessor/compiler.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * Return : Completion code:
+ *
+ * SES_CONTRADICTION:
+ * Contradiction detected, the VS System is not
+ * consistent. Check the VS System.
+ *
+ * SES_EMPTY:
+ * No event has been given to the SMP_Deduct function,
+ * i.e. SMP_Deduct has not been called before calling the
+ * SMP_NextStateChg function.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_FOUND:
+ * Success. The internal state vector was updated with a
+ * new value.
+ *
+ * SES_OKAY:
+ * Success. The internal state vector did not change
+ * value.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if defined SEM_NEXT_STATE_CHG || defined VISUALSTATE_EXPERT_DLL
+
+#define SMP_NextStateChg(Context) _SMP_NextStateChg(Context, VS_TRUE)
+
+#endif
+
+
+/*
+ * Name : SMP_Inquiry
+ *
+ * Description : The function prepares for finding events that can be used
+ * to perform transitions from the current state.
+ * All events are found by continuous calls to the function
+ * SMP_GetInput or one call to SMP_GetInputAll.
+ * As the function will inquire events on the basis of the
+ * internal current state vector, a state transition should
+ * be finished, i.e. the previously called function should
+ * be SMP_Load, SMP_Connect, SMP_Init, SMP_NextState or
+ * SMP_NextStateChg.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * Return : Completion code:
+ *
+ * SES_ACTIVE:
+ * A state transition has not been finished. The user
+ * should not call the function SMP_GetInput, because
+ * wrong events could be inquired, if the function
+ * SMP_NextState is called to finish running transitions.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_Inquiry (SEM_CONTEXT VS_TQ_CONTEXT *Context);
+
+
+/*
+ * Name : SMP_GetInput
+ *
+ * Description : The function is used to find events that can be used to
+ * perform state/event transitions and/or to derive action
+ * expressions from the current state. All events are found
+ * by continuous calls to this function.
+ * Because the function will inquire events on the basis of
+ * he internal current state vector, a state/event deduction
+ * should not be inquired.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * EventNo:
+ * A pointer to array to store the inquired event number.
+ *
+ * EventList:
+ * A pointer to an array which holds the event numbers that
+ * can be inquired. The EventList must be terminated with
+ * the symbol EVENT_TERMINATION_ID.
+ * If the pointer is a NULL pointer, then all events can be
+ * inquired.
+ *
+ * Return : Completion code:
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * Event number form the EventList is out of range.
+ *
+ * SES_FOUND:
+ * Success. An event has been found. The user should
+ * continue to call the SMP_GetInput, since more events
+ * may be found.
+ *
+ * SES_OKAY:
+ * Success. No more events can be found.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_GetInput (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_EVENT_TYPE *EventNo, SEM_EVENT_TYPE *EventList);
+
+
+/*
+ * Name : SMP_GetInputAll
+ *
+ * Description : The function is used to find all events that can be used
+ * to perform state/event transitions and/or to derive action
+ * expressions from the current state.
+ * All events are found by one call to this function.
+ * Because the function will inquire events on the basis of
+ * the internal current state vector, a state/event deduction
+ * should not be running.
+ * Defining the symbol SEM_GET_INPUT_ALL for your
+ * preprocessor/compiler will enable this function.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * EventVector:
+ * A pointer to array to store the inquired event numbers.
+ *
+ * EventList:
+ * Pointer to an array that holds the event numbers that
+ * can be inquired. The EventList must be terminated with
+ * the symbol EVENT_TERMINATION_ID.
+ * If the pointer is a NULL pointer, then all events can be
+ * inquired.
+ *
+ * MaxSize:
+ * Specifies the maximum length of the event vector
+ * including the symbol EVENT_TERMINATION_ID.
+ *
+ * Return : Completion code:
+ *
+ * SES_BUFFER_OVERFLOW:
+ * Event number from the EventList is out of range.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * Event number from the EventList is out of range.
+ *
+ * SES_OKAY:
+ * Success. All events are found successfully.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_GetInputAll (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_EVENT_TYPE *EventVector, SEM_EVENT_TYPE *EventList,
+ SEM_EVENT_TYPE MaxSize);
+
+
+/*
+ * Name : SMP_Name
+ *
+ * Description : The function get the ASCII name of the specified
+ * identifier.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * IdentType:
+ * Must contain the identifier type of the identifier
+ * number which can be EVENT_TYPE, STATE_TYPE or
+ * ACTION_TYPE.
+ *
+ * IdentNo:
+ * Must contain the index number of an identifier.
+ *
+ * Test:
+ * A pointer to a text string. If the function terminates
+ * successfully, the text string contains the name of the
+ * specified identifier.
+ *
+ * MazSize:
+ * Specifies the maximum length of the text including the
+ * NULL termination character.
+ *
+ * Return : Completion code:
+ *
+ * SES_FILE_ERR:
+ * Unable to read from file.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * Identifier number is out of range.
+ *
+ * SES_TEXT_TOO_LONG:
+ * The text is longer than MazSize.
+ *
+ * SES_TYPE_ERR:
+ * The identifier type is not correct. Remember to
+ * include the desired text in the VS System and specify the
+ * correct identifier type when calling this function.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_Name (SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char *Text, unsigned short MazSize);
+
+
+/*
+ * Name : SMP_NameAbs
+ *
+ * Description : The function gets the pointer to the ASCII name of the
+ * specified identifier.
+ * This function will not work together with the VS Systems
+ * loaded from disk.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * IdentType:
+ * Must contain the identifier type of the identifier
+ * number which can be EVENT_TYPE, STATE_TYPE or
+ * ACTION_TYPE.
+ *
+ * IdentNo:
+ * Must contain the index number of an identifier.
+ *
+ * Text:
+ * Must be a pointer to a char pointer. If the function
+ * terminates successfully, the pointer points to the text
+ * containing the name of the specified identifier.
+ *
+ * Return : Completion code:
+ *
+ * SES_NOT_COMPATIBLE:
+ * The function is not compatible with current setup. The
+ * VS System is probably loaded from disk.
+ * Use the SMP_Name function or compile/link the
+ * VS System into the application.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * Identifier number is out of range.
+ *
+ * SES_TYPE_ERR:
+ * The identifier type is not correct. Remember to
+ * include the desired text in the VS System and specify
+ * the correct identifier type when calling this
+ * function.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_NameAbs (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ unsigned char IdentType, SEM_EXPLANATION_TYPE IdentNo, char VS_TQ_RULEBASE **Text);
+
+
+/*
+ * Name : SMP_Expl
+ *
+ * Description : The function get the ASCII explanation text of the
+ * specified identifier.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * IdentType:
+ * Must contain the identifier type of the identifier
+ * number which can be EVENT_TYPE, STATE_TYPE or
+ * ACTION_TYPE.
+ *
+ * IdentNo:
+ * Must contain the index number of an identifier.
+ *
+ * Text:
+ * Must be a pointer to a char pointer. If the function
+ * terminates successfully, the pointer points to the text
+ * containing the name of the specified identifier.
+ *
+ * MazSize:
+ * Specifies the maximum length of the Text including the
+ * NULL termination character.
+ *
+ * Return : Completion code:
+ *
+ * SES_FILE_ERR:
+ * Unable to read from file.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * Identifier number is out of range.
+ *
+ * SES_TEXT_TOO_LONG:
+ * The text is longer than MazSize.
+ *
+ * SES_TYPE_ERR:
+ * The identifier type is not correct. Remember to
+ * include the desired text in the VS System and specify the
+ * correct identifier type when calling this function.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_Expl (SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char *Text, unsigned short MaxSize);
+
+
+/*
+ * Name : SMP_ExplAbs
+ *
+ * Description : The function get the pointer to the ASCII explanation text
+ * of the specified identifier.
+ * This function will not work together with VS Systems
+ * loaded from disk.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * IdentType:
+ * Must contain the identifier type of the identifier
+ * number which can be EVENT_TYPE, STATE_TYPE or
+ * ACTION_TYPE.
+ *
+ * IdentNo:
+ * Must contain the index number of an identifier.
+ *
+ * Text:
+ * Must be a pointer to a char pointer. If the function
+ * terminates successfully, the pointer points to the Text
+ * containing the name of the specified identifier.
+ *
+ * Return : Completion code:
+ *
+ * SES_NOT_COMPATIBLE:
+ * The function is not compatible with current setup. The
+ * VS System is probably loaded from disk.
+ * Use the SMP_Expl function or compile/link the
+ * VS System into the application.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * Identifier number is out of range.
+ *
+ * SES_TYPE_ERR:
+ * The identifier type is not correct. Remember to
+ * include the desired text in the VS System and specify
+ * the correct identifier type when calling this
+ * function.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_ExplAbs (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ unsigned char IdentType, SEM_EXPLANATION_TYPE IdentNo, char VS_TQ_RULEBASE **Text);
+
+
+/*
+ * Name : SMP_State
+ *
+ * Description : The function will return the current state of the
+ * specified state machine.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * StateMachineNo:
+ * State machine number.
+ *
+ * StateNo:
+ * Pointer to store the current state of the specified
+ * state machine.
+ *
+ * Return : Completion code:
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * State machine index is out of range.
+ *
+ * SES_FOUND:
+ * Success. State number index found.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_State (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_STATE_MACHINE_TYPE StateMachineNo, SEM_STATE_TYPE *StateNo);
+
+
+/*
+ * Name : SMP_StateAll
+ *
+ * Description : The function will find the current state of all state
+ * machines.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * StateVector:
+ * A pointer to array to store the current state of the
+ * state machines.
+ *
+ * MaxSize:
+ * Specifies the maximum length of the state vector.
+ * Normally the length will be equal to the number of state
+ * machines. The array is not terminated.
+ *
+ * Return : Completion code:
+ *
+ * SES_BUFFER_OVERFLOW:
+ * The specified MaxSize is too small. The state vector
+ * is not valid.
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_FOUND:
+ * Success. State numbers are found successfully.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_StateAll (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_STATE_TYPE *StateVector, SEM_STATE_MACHINE_TYPE MaxSize);
+
+
+/*
+ * Name : SMP_Machine
+ *
+ * Description : The function will return the state machine index of the
+ * specified state.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * StateNo:
+ * State index number.
+ *
+ * StateMachineNo:
+ * A pointer to store the found state machine index number
+ * of the specified state.
+ *
+ * Return : Completion code:
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * State index is out of range.
+ *
+ * SES_FOUND:
+ * Success. State machine index number found.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_Machine (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_STATE_TYPE StateNo, SEM_STATE_MACHINE_TYPE *StateMachineNo);
+
+
+/*
+ * Name : SMP_ForceState
+ *
+ * Description : The function is used for forcing the internal state vector
+ * into the specified state.
+ * The funcition is useful, if the user wants to reestablish
+ * the internal state vector after a power failure of the
+ * target system.
+ * Before calling this function the first time after a power
+ * down, the SMP_Init function should be called to initialize
+ * the VS system.
+ * The state vector established by calls to SMP_ForceState
+ * should be stored in EEPROM before power down.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * StateNo:
+ * State index number.
+ *
+ * Return : Completion code:
+ *
+ * SES_NOT_LOADED:
+ * No VS System loaded or connected.
+ *
+ * SES_RANGE_ERR:
+ * State index is out of range.
+ *
+ * SES_OKAY:
+ * Success.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+extern unsigned char SMP_ForceState (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_STATE_TYPE StateNo);
+
+
+/*
+ * Name : SMP_Action
+ *
+ * Description : The macro will call an action function by using the
+ * VSAction function pointer table.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+ * ActionNo:
+ * Action index number.
+ *
+ * Return : None.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_FUNC_OLD_NAMING_STYLE)
+
+#if (SEM_FUNCEXPHANDLING == 0)
+#define smp_action(Context, ActionNo) (*VSAction[ActionNo])(Context)
+#else
+#define smp_action(Context, ActionNo) VSAction(Context, ActionNo)
+#endif
+
+#else
+
+#if (SEM_FUNCEXPHANDLING == 0)
+#define SMP_Action(Context, ActionNo) (*VSAction[ActionNo])(Context)
+#else
+#define SMP_Action(Context, ActionNo) VSAction(Context, ActionNo)
+#endif
+
+#endif
+
+
+/*
+ * Name : SMP_TableAction
+ *
+ * Description : The macro will call an action function by using the
+ * specified function pointer table.
+ *
+ * Argument : Context:
+ * A pointer to a VS System context.
+ *
+* Table:
+ * Function pointer table.
+ *
+ * ActionNo:
+ * Action index number.
+ *
+ * Return : None.
+ *
+ * Portability : ANSI-C Compiler.
+ */
+#if (SEM_FUNC_OLD_NAMING_STYLE)
+
+#if (SEM_FUNCEXPHANDLING == 0)
+#define smp_table_action(Context, Table, ActionNo) (* (Table)[ActionNo])(Context)
+#else
+#define smp_table_action(Context, Func, ActionNo) Func(Context, ActionNo)
+#endif
+
+#else
+
+#if (SEM_FUNCEXPHANDLING == 0)
+#define SMP_TableAction(Context, Table, ActionNo) (* (Table)[ActionNo])(Context)
+#else
+#define SMP_TableAction(Context, Func, ActionNo) Func(Context, ActionNo)
+#endif
+
+#endif
+
+#endif
diff --git a/cesar/lib/visual_state_api/src/SEMMach.c b/cesar/lib/visual_state_api/src/SEMMach.c
new file mode 100644
index 0000000000..352a3a756b
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMMach.c
@@ -0,0 +1,27 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMMach.c
+ *
+ * Function: Contains the SEM_Machine SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_Machine (SEM_STATE_TYPE StateNo,
+ SEM_STATE_MACHINE_TYPE *StateMachineNo)
+{
+ return (SMP_Machine (SEMContext, StateNo, StateMachineNo));
+}
diff --git a/cesar/lib/visual_state_api/src/SEMMain.c b/cesar/lib/visual_state_api/src/SEMMain.c
new file mode 100644
index 0000000000..79eab6180c
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMMain.c
@@ -0,0 +1,154 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMMain.c
+ *
+ * Function: Contains the general SEM Library Expert version 4 functions.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.2 ! 200199 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+SEM_CONTEXT VS_TQ_CONTEXT *SEMContext = ((SEM_CONTEXT VS_TQ_CONTEXT *) 0);
+unsigned char SEMInitCC = SES_OKAY;
+
+
+#ifdef VISUALSTATE_EXPERT_DLL
+unsigned char DLL_EXPORT SEM_GetInitCC (void)
+{
+ return SEMInitCC;
+}
+#endif
+
+
+unsigned char SEM_Connect (void VS_TQ_RULEBASE *VSData)
+{
+ if (SEMContext)
+ SEM_Free ();
+
+ return (SMP_Connect (&SEMContext, VSData));
+}
+
+
+#ifdef SE_EXPERTDLL
+unsigned char VS_CALL_CONV SEM_Load (const char *FileName)
+{
+ if (SEMContext)
+ SEM_Free ();
+ return (SMP_Load (&SEMContext, FileName));
+}
+#endif
+
+
+void VS_CALL_CONV SEM_Free (void)
+{
+ SMP_Free (SEMContext);
+ SEMContext = NULL;
+}
+
+
+void VS_CALL_CONV SEM_Init (void)
+{
+ SEMInitCC = SMP_Init (SEMContext);
+}
+
+
+#if (SEM_GUARD_EXPRESSION)
+#ifdef VISUALSTATE_EXPERT_DLL
+void SEM_InitGuardCallBack (unsigned char (**Guard)(void))
+#else
+#if (SEM_FUNCEXPHANDLING == 0)
+void SEM_InitGuardCallBack (VS_GUARDEXPR_TYPE VS_TQ_GUARDEXPRCOL * Guard)
+#else
+void SEM_InitGuardCallBack (unsigned char (*Guard)(SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_GUARD_EXPRESSION_TYPE i))
+#endif
+#endif
+{
+ SMP_InitGuardCallBack (SEMContext, Guard);
+}
+#endif
+
+
+#if (SEM_SIGNAL_DB)
+void SEM_InitSignalDBCallBack (void (*SEM_SignalDB)(SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_EVENT_TYPE SignalNo))
+{
+ SMP_InitSignalDBCallBack (SEMContext, SEM_SignalDB);
+}
+#endif
+
+
+#if (SEM_SIGNAL)
+void VS_CALL_CONV SEM_InitSignalQueue (void)
+{
+ SMP_InitSignalQueue (SEMContext);
+}
+#endif
+
+
+unsigned char VS_CALL_CONV SEM_Deduct (SEM_EVENT_TYPE EventNo)
+{
+ return (SMP_Deduct (SEMContext, EventNo));
+}
+
+
+unsigned char VS_CALL_CONV SEM_GetOutput (SEM_ACTION_EXPRESSION_TYPE *ActionNo)
+{
+ return (SMP_GetOutput (SEMContext, ActionNo));
+}
+
+
+#if defined SEM_GET_OUTPUT_ALL || defined VISUALSTATE_EXPERT_DLL
+#if (SEM_SIGNAL)
+#ifndef VISUALSTATE_EXPERT_DLL
+#error SEM_GetOutputAll cannot be used when the Project contains signals.
+#endif
+#endif
+unsigned char VS_CALL_CONV SEM_GetOutputAll (SEM_ACTION_EXPRESSION_TYPE *ActionExprVector,
+ SEM_ACTION_EXPRESSION_TYPE MaxSize)
+{
+ return (SMP_GetOutputAll (SEMContext, ActionExprVector, MaxSize));
+}
+#endif
+
+
+#ifdef VISUALSTATE_EXPERT_DLL
+#ifdef SEM_NEXT_STATE_CHG
+#undef SEM_NEXT_STATE_CHG
+#endif
+#endif
+
+#ifndef SEM_NEXT_STATE_CHG
+unsigned char VS_CALL_CONV SEM_NextState (void)
+{
+ return (SMP_NextState (SEMContext));
+}
+#endif
+
+
+#ifdef VISUALSTATE_EXPERT_DLL
+#define SEM_NEXT_STATE_CHG
+#endif
+
+
+#ifdef SEM_NEXT_STATE_CHG
+unsigned char VS_CALL_CONV SEM_NextStateChg (void)
+{
+ return (SMP_NextStateChg (SEMContext));
+}
+#endif
+
+
+#ifdef VISUALSTATE_EXPERT_DLL
+#undef SEM_NEXT_STATE_CHG
+#endif
diff --git a/cesar/lib/visual_state_api/src/SEMName.c b/cesar/lib/visual_state_api/src/SEMName.c
new file mode 100644
index 0000000000..81e5b65c0b
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMName.c
@@ -0,0 +1,27 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMName.c
+ *
+ * Function: Contains the SEM_Name SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_Name (unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char *Text, unsigned short MaxSize)
+{
+ return (SMP_Name (SEMContext, IdentType, IdentNo, Text, MaxSize));
+}
diff --git a/cesar/lib/visual_state_api/src/SEMNameA.c b/cesar/lib/visual_state_api/src/SEMNameA.c
new file mode 100644
index 0000000000..e813741197
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMNameA.c
@@ -0,0 +1,28 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMNameA.c
+ *
+ * Function: Contains the SEM_NameAbs SEM Library Expert version 4
+ * function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_NameAbs (unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char VS_TQ_RULEBASE **Text)
+{
+ return (SMP_NameAbs (SEMContext, IdentType, IdentNo, Text));
+}
diff --git a/cesar/lib/visual_state_api/src/SEMStAll.c b/cesar/lib/visual_state_api/src/SEMStAll.c
new file mode 100644
index 0000000000..2ebdaae2f5
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMStAll.c
@@ -0,0 +1,28 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMStAll.c
+ *
+ * Function: Contains the SEM_StateAll SEM Library Expert version 4
+ * function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_StateAll (SEM_STATE_TYPE *StateVector,
+ SEM_STATE_MACHINE_TYPE MaxSize)
+{
+ return (SMP_StateAll (SEMContext, StateVector, MaxSize));
+}
diff --git a/cesar/lib/visual_state_api/src/SEMState.c b/cesar/lib/visual_state_api/src/SEMState.c
new file mode 100644
index 0000000000..b487762ea6
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SEMState.c
@@ -0,0 +1,27 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SEMState.c
+ *
+ * Function: Contains the SEM_State SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char VS_CALL_CONV SEM_State (SEM_STATE_MACHINE_TYPE StateMachineNo,
+ SEM_STATE_TYPE *StateNo)
+{
+ return (SMP_State (SEMContext, StateMachineNo, StateNo));
+}
diff --git a/cesar/lib/visual_state_api/src/SMPExpl.c b/cesar/lib/visual_state_api/src/SMPExpl.c
new file mode 100644
index 0000000000..b4b6c15aba
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPExpl.c
@@ -0,0 +1,92 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPExpl.c
+ *
+ * Function: Contains the SMP_Expl SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.1 ! 101298 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char SMP_Expl (SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char *Text, unsigned short MaxSize)
+{
+ int c;
+ unsigned long Pos;
+ unsigned short i;
+ char VS_TQ_RULEBASE * pT = NULL; /* initialization may be necessary to avoid compiler warnings */
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (!MaxSize)
+ return (SES_TEXT_TOO_LONG);
+ switch (IdentType)
+ {
+ case EVENT_TYPE :
+ if (!Context->pEEIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofEvents <= (SEM_EVENT_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pEEIPos[IdentNo];
+ break;
+ case STATE_TYPE :
+ if (!Context->pSEIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofStates <= (SEM_STATE_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pSEIPos[IdentNo];
+ break;
+ case ACTION_TYPE :
+ if (!Context->pAEIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofActionFunctions <= (SEM_ACTION_FUNCTION_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pAEIPos[IdentNo];
+ break;
+ default :
+ return (SES_TYPE_ERR);
+ }
+ if (Context->pVSFile)
+ {
+#ifndef SE_EXPERTDLL
+ return (SES_NOT_LOADED);
+#else
+ if (fseek (Context->pVSFile, (long)Pos, SEEK_SET))
+ return (SES_FILE_ERR);
+#endif
+ }
+ else
+ pT = (char VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)Context->pVSData + Pos);
+
+ for (i = 0; i < MaxSize; i++)
+ {
+#ifdef SE_EXPERTDLL
+ if (Context->pVSFile)
+ {
+ c = fgetc (Context->pVSFile);
+ if (c == EOF)
+ return (SES_FILE_ERR);
+ }
+ else
+#endif
+ c = *pT++;
+ *Text++ = (char)c;
+ if (c == '\0')
+ return (SES_OKAY);
+ }
+ Text--;
+ *Text = '\0';
+ return (SES_TEXT_TOO_LONG);
+}
diff --git a/cesar/lib/visual_state_api/src/SMPExplA.c b/cesar/lib/visual_state_api/src/SMPExplA.c
new file mode 100644
index 0000000000..54e6ad0e6a
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPExplA.c
@@ -0,0 +1,68 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPExplA.c
+ *
+ * Function: Contains the SMP_ExplAbs SEM Library Expert version 4
+ * function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.1 ! 101298 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char SMP_ExplAbs (SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char VS_TQ_RULEBASE **Text)
+{
+ unsigned long Pos;
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+ switch (IdentType)
+ {
+ case EVENT_TYPE :
+ if (!Context->pEEIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofEvents <= (SEM_EVENT_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pEEIPos[IdentNo];
+ break;
+ case STATE_TYPE :
+ if (!Context->pSEIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofStates <= (SEM_STATE_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pSEIPos[IdentNo];
+ break;
+ case ACTION_TYPE :
+ if (!Context->pAEIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofActionFunctions <= (SEM_ACTION_FUNCTION_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pAEIPos[IdentNo];
+ break;
+ default :
+ return (SES_TYPE_ERR);
+ }
+ if (Context->pVSFile)
+ {
+#ifndef SE_EXPERTDLL
+ return (SES_NOT_LOADED);
+#else
+ return (SES_NOT_COMPATIBLE);
+#endif
+ }
+ else
+ *Text = (char VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)Context->pVSData + Pos);
+ return (SES_OKAY);
+}
diff --git a/cesar/lib/visual_state_api/src/SMPForce.c b/cesar/lib/visual_state_api/src/SMPForce.c
new file mode 100644
index 0000000000..955d206ac1
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPForce.c
@@ -0,0 +1,32 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPForce.c
+ *
+ * Function: Contains the SMP_ForceState SEM Library Expert version 4
+ * function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char SMP_ForceState (SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_STATE_TYPE StateNo)
+{
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (Context->nNofStates <= StateNo)
+ return (SES_RANGE_ERR);
+ Context->pCSV[Context->pSMI[StateNo]] = StateNo;
+ return (SES_OKAY);
+}
diff --git a/cesar/lib/visual_state_api/src/SMPInq.c b/cesar/lib/visual_state_api/src/SMPInq.c
new file mode 100644
index 0000000000..007b374bc9
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPInq.c
@@ -0,0 +1,238 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPInq.c
+ *
+ * Function: Contains the SMP_Inquiry, SMP_GetInput and SMP_GetInputAll
+ * SEM Library Expert version 4 functions.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.5 ! 200199 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ * 4.0.4.1 ! 050799 ! Closed ! SMP_GetInput fixed.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char SMP_Inquiry (SEM_CONTEXT VS_TQ_CONTEXT *Context)
+{
+ if (!Context)
+ return (SES_NOT_LOADED);
+ Context->InqAct = VS_FALSE;
+ if (Context->State != STATE_SEM_INITIALIZE)
+ return (SES_ACTIVE);
+ else
+ return (SES_OKAY);
+}
+
+
+unsigned char SMP_GetInput (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_EVENT_TYPE *EventNo, SEM_EVENT_TYPE *EventList)
+{
+ SEM_RULE_DATA_TYPE rd;
+ SEM_RULE_TABLE_INDEX_TYPE iInqFirstR, iInqLastR;
+ unsigned char i, InqIt, nPos;
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ SEM_STATE_TYPE s;
+ unsigned char nNeg;
+#endif
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (!Context->InqAct)
+ Context->InqEventNo = 0;
+ for(;;)
+ {
+ Context->InqAct = VS_FALSE;
+ if (Context->InqEventNo >= Context->nNofEvents)
+ break;
+ if (EventList)
+ {
+ Context->InqFoundEventNo = EventList[Context->InqEventNo];
+ if (Context->InqFoundEventNo == EVENT_TERMINATION_ID)
+ break;
+ if (Context->nNofEvents <= Context->InqFoundEventNo)
+ return (SES_RANGE_ERR);
+ }
+ else
+ Context->InqFoundEventNo = Context->InqEventNo;
+ Context->InqEventNo++;
+ Context->InqCurrentEventNo = Context->InqFoundEventNo;
+ for (InqIt = 2; InqIt; InqIt--)
+ {
+#if (SEM_EVENT_GROUP_TABLE_INDEX) || defined VISUALSTATE_EXPERT_DLL
+ if (InqIt == 2)
+ {
+ if (Context->EventGroupType == 2)
+ {
+ Context->iInqFirstEgi = Context->pEGTI[Context->InqCurrentEventNo];
+ Context->iInqLastEgi = Context->pEGTI[Context->InqCurrentEventNo + 1];
+ }
+ }
+#endif
+ if (InqIt == 1)
+ {
+#if (SEM_EVENT_GROUP_INDEX) || defined VISUALSTATE_EXPERT_DLL
+ if (Context->EventGroupType == 1)
+ {
+ Context->InqCurrentEventNo = (SEM_EVENT_TYPE) Context->pEGT[Context->InqCurrentEventNo];
+ if (Context->InqCurrentEventNo == EVENT_UNDEFINED)
+ break;
+ Context->InqCurrentEventNo = (SEM_EVENT_TYPE)(Context->InqCurrentEventNo + Context->nNofEvents);
+ }
+#endif
+#if (SEM_EVENT_GROUP_TABLE_INDEX) || defined VISUALSTATE_EXPERT_DLL
+ if (Context->EventGroupType == 2)
+ {
+ if (Context->iInqFirstEgi == Context->iInqLastEgi)
+ break;
+ Context->InqCurrentEventNo = (SEM_EVENT_TYPE) Context->pEGT[Context->iInqFirstEgi++];
+ Context->InqCurrentEventNo = (SEM_EVENT_TYPE)(Context->InqCurrentEventNo + Context->nNofEvents);
+ InqIt++;
+ }
+#endif
+ }
+ iInqFirstR = Context->pRTI[Context->InqCurrentEventNo];
+ iInqLastR = Context->pRTI[Context->InqCurrentEventNo + 1];
+ while (iInqFirstR < iInqLastR)
+ {
+ Context->iInqRI = Context->pRI[iInqFirstR++];
+#if (SEM_RD_WIDTH_8_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_16_BIT)
+ Context->iInqRI++;
+ rd = Context->pRD[Context->iInqRI++];
+ nPos = (unsigned char)(rd & 0x0F);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)(rd >> 4);
+#endif
+#endif
+#if (SEM_RD_WIDTH_8_BIT && SEM_RDHW_TYPE_2 && SEM_RDHW_WIDTH_24_BIT)
+ rd = Context->pRD[Context->iInqRI];
+ Context->iInqRI += 3;
+ nPos = (unsigned char)(rd & 0x0F);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)(rd >> 4);
+#endif
+#endif
+#if (SEM_RD_WIDTH_8_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_32_BIT)
+ Context->iInqRI += 2;
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)Context->pRD[Context->iInqRI++];
+#else
+ Context->iInqRI++;
+#endif
+ nPos = (unsigned char)Context->pRD[Context->iInqRI++];
+#endif
+#if (SEM_RD_WIDTH_8_BIT && SEM_RDHW_TYPE_2 && SEM_RDHW_WIDTH_48_BIT)
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)Context->pRD[Context->iInqRI++];
+#else
+ Context->iInqRI++;
+#endif
+ nPos = (unsigned char)Context->pRD[Context->iInqRI];
+ Context->iInqRI += 5;
+#endif
+#if (SEM_RD_WIDTH_16_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_16_BIT)
+ rd = Context->pRD[Context->iInqRI++];
+ nPos = (unsigned char)(rd & 0x0F);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)((rd >> 4) & 0x0F);
+#endif
+#endif
+#if (SEM_RD_WIDTH_16_BIT && SEM_RDHW_TYPE_3 && SEM_RDHW_WIDTH_32_BIT)
+ rd = Context->pRD[Context->iInqRI++];
+ nPos = (unsigned char)(rd & 0x0F);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)((rd >> 4) & 0x0F);
+#endif
+ Context->iInqRI += 1;
+#endif
+#if (SEM_RD_WIDTH_16_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_32_BIT)
+ Context->iInqRI++;
+ rd = Context->pRD[Context->iInqRI++];
+ nPos = (unsigned char)(rd & 0x0FF);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)(rd >> 8);
+#endif
+#endif
+#if (SEM_RD_WIDTH_16_BIT && SEM_RDHW_TYPE_2 && SEM_RDHW_WIDTH_48_BIT)
+ rd = Context->pRD[Context->iInqRI];
+ Context->iInqRI += 3;
+ nPos = (unsigned char)(rd & 0x0FF);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)(rd >> 8);
+#endif
+#endif
+#if (SEM_RD_WIDTH_32_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_32_BIT)
+ rd = Context->pRD[Context->iInqRI++];
+ nPos = (unsigned char)(rd & 0X0FF);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)((rd >> 8) & 0X0FF);
+#endif
+#endif
+#if (SEM_RD_WIDTH_32_BIT && SEM_RDHW_TYPE_3 && SEM_RDHW_WIDTH_64_BIT)
+ rd = Context->pRD[Context->iInqRI++];
+ nPos = (unsigned char)(rd & 0x0FF);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)((rd >> 8) & 0x0FF);
+#endif
+ Context->iInqRI++;
+#endif
+ for (i = 0; i < nPos; i++)
+ {
+ rd = Context->pRD[Context->iInqRI++];
+ if (rd != Context->pCSV[Context->pSMI[rd]])
+ goto NextRule;
+ }
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ for (i = 0; i < nNeg; i++)
+ {
+ rd = Context->pRD[Context->iInqRI++];
+ s = Context->pCSV[Context->pSMI[rd]];
+ if ((s == STATE_UNDEFINED) || (s == (SEM_STATE_TYPE) rd))
+ goto NextRule;
+ }
+#endif
+ Context->InqAct = VS_TRUE;
+ *EventNo = Context->InqFoundEventNo;
+ return (SES_FOUND);
+NextRule :
+ ;
+ }
+ }
+ }
+ return (SES_OKAY);
+}
+
+
+#if defined SEM_GET_INPUT_ALL || defined VISUALSTATE_EXPERT_DLL
+unsigned char SMP_GetInputAll (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_EVENT_TYPE *EventVector, SEM_EVENT_TYPE *EventList,
+ SEM_EVENT_TYPE MaxSize)
+{
+ SEM_EVENT_TYPE i;
+ unsigned char CC;
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+
+ for (i = 0; ((CC = SMP_GetInput (Context, &EventVector[i], EventList)) == SES_FOUND)
+ && i < MaxSize - 1; i++);
+
+ if (CC == SES_OKAY)
+ {
+ EventVector[i] = EVENT_TERMINATION_ID;
+ return (SES_OKAY);
+ }
+ if (CC == SES_FOUND)
+ return (SES_BUFFER_OVERFLOW);
+ return (CC);
+}
+#endif
diff --git a/cesar/lib/visual_state_api/src/SMPInst.c b/cesar/lib/visual_state_api/src/SMPInst.c
new file mode 100644
index 0000000000..13b094f700
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPInst.c
@@ -0,0 +1,78 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPInst.c
+ *
+ * Function: Contains the SMP_InitInstances and SMP_SetInstance
+ * SEM Library Expert version 4 functions.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.1 ! 021298 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+#include "limits.h"
+
+#if (VS_REALLINKMODE == 1)
+#include "RealLink.h"
+#endif
+
+unsigned char SMP_InitInstances (SEM_CONTEXT VS_TQ_CONTEXT *Context)
+{
+ unsigned long i;
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+
+#if VS_USE_HEAP
+ if (Context->pIns)
+ free (Context->pIns);
+ if ((unsigned long) ULONG_MAX / Context->nNofInstances < (unsigned long) Context->nNofStateMachines)
+ return (SES_TYPE_OVERFLOW);
+#endif
+ if (Context->nNofInstances > 1)
+ {
+#if VS_USE_HEAP
+ Context->pIns = (SEM_STATE_TYPE *)malloc ((Context->nNofInstances * Context->nNofStateMachines) * sizeof (SEM_STATE_TYPE));
+ if (!Context->pIns)
+ return (SES_MEM_ERR);
+
+#endif
+ Context->pCSV = Context->pIns;
+ Context->ActIns = 0;
+
+ for (i = 0; i < (unsigned long)Context->nNofStateMachines * Context->nNofInstances; i++)
+ Context->pIns[i] = STATE_UNDEFINED;
+ }
+
+ return (SES_OKAY);
+}
+
+
+unsigned char SMP_SetInstance (SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_INSTANCE_TYPE Instance)
+{
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (Instance >= Context->nNofInstances)
+ return (SES_RANGE_ERR);
+ if ((Context->State != STATE_SEM_INITIALIZE) || (Context->InqAct))
+ return (SES_ACTIVE);
+ if (Context->nNofInstances > 1)
+ {
+ Context->pCSV = (Context->pIns + Instance * Context->nNofStateMachines);
+ Context->ActIns = Instance;
+ }
+
+#if (VS_REALLINKMODE == 1)
+ VS_WAIT_ELM(Context, VS_ENABLE_INSTANCE, Ind_INSTANCE_SET, &Instance);
+#endif
+ return (SES_OKAY);
+}
diff --git a/cesar/lib/visual_state_api/src/SMPMach.c b/cesar/lib/visual_state_api/src/SMPMach.c
new file mode 100644
index 0000000000..8a154790c9
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPMach.c
@@ -0,0 +1,32 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPMach.c
+ *
+ * Function: Contains the SMP_Machine SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.1 ! 301198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char SMP_Machine (SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_STATE_TYPE StateNo,
+ SEM_STATE_MACHINE_TYPE *StateMachineNo)
+{
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (Context->nNofStates <= StateNo)
+ return (SES_RANGE_ERR);
+ *StateMachineNo = Context->pSMI[StateNo];
+ return (SES_FOUND);
+}
diff --git a/cesar/lib/visual_state_api/src/SMPMain.c b/cesar/lib/visual_state_api/src/SMPMain.c
new file mode 100644
index 0000000000..4b0d78c835
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPMain.c
@@ -0,0 +1,939 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPMain.c
+ *
+ * Function: Contains the general SEM Library Expert version 4 functions.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.17 ! 290199 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+#if (VS_REALLINKMODE == 1)
+#include "RealLink.h"
+#endif
+
+
+
+#if (VS_REALLINKMODE == 1)
+extern VS_VOID volatile const * const vsrl_aVspInfo[];
+extern SEM_CONTEXT * vsrl_aVspContextPointer[];
+#endif
+
+
+
+#ifdef VS_RUNTIME_INFO
+VSRunTimeInfo volatile const VS_RUNTIME_INFO_EXTKW vsRunTimeInfo =
+{
+ VS_SIGNATURE_VERSION,
+ VS_SIGNATURE_CONTENT
+};
+#endif
+
+
+
+#ifdef SE_EXPERTDLL
+static unsigned char _SMP_ReadTP (FILE *pRBF, unsigned long **Pos, unsigned long NbR, unsigned long FPos)
+{
+ unsigned long *p;
+
+ if (FPos)
+ {
+ if ((p = (unsigned long *)malloc (NbR * sizeof (unsigned long))) == NULL)
+ return (SES_MEM_ERR);
+ *Pos = p;
+ if (fseek (pRBF, (long)FPos, SEEK_SET))
+ return (SES_FILE_ERR);
+ if (fread (p, sizeof (unsigned long) * NbR, 1, pRBF) != 1)
+ return (SES_FILE_ERR);
+ }
+ return (SES_OKAY);
+}
+#endif
+
+
+
+static unsigned char _SMP_Connect (SEM_CONTEXT VS_TQ_CONTEXT *Context, void VS_TQ_RULEBASE *VSData)
+{
+ RBH VS_TQ_RULEBASE *pRBH;
+ unsigned char CC;
+
+ pRBH = (RBH VS_TQ_RULEBASE *)VSData;
+ if ((pRBH->IdAndEventGroupType & 0x0FF) != SEM_VERS_ID)
+ goto FileError;
+
+#ifdef SE_EXPERTDLL
+ if (!((pRBH->IdAndEventGroupType >> 12) & 1))
+ goto FileError;
+#endif
+
+ Context->nNofEvents = (SEM_EVENT_TYPE) pRBH->nNofEvents;
+#if (SEM_SIGNAL)
+ Context->nNofSignals = (SEM_EVENT_TYPE) pRBH->nNofSignals;
+ Context->SSize = (SEM_SIGNAL_QUEUE_TYPE) pRBH->SSize;
+#endif
+ Context->nNofStates = (SEM_STATE_TYPE) pRBH->nNofStates;
+ Context->nNofStateMachines = (SEM_STATE_MACHINE_TYPE) pRBH->nNofStateMachines;
+ Context->nNofActionFunctions = (SEM_ACTION_FUNCTION_TYPE) pRBH->nNofActionFunctions;
+ Context->nNofInstances = (SEM_INSTANCE_TYPE) pRBH->nNofInstances;
+ Context->EventGroupType = (unsigned char)((pRBH->IdAndEventGroupType >> 8) & 0x0F);
+
+#if VS_USE_HEAP
+ Context->pCSV = NULL;
+ Context->pWSV = NULL;
+ Context->pIns = NULL;
+#if (SEM_SIGNAL)
+ Context->pSQueue = NULL;
+#endif
+#endif
+ Context->pENIPos = NULL;
+ Context->pSNIPos = NULL;
+ Context->pANIPos = NULL;
+ Context->pEEIPos = NULL;
+ Context->pSEIPos = NULL;
+ Context->pAEIPos = NULL;
+
+#if (SEM_GUARD_EXPRESSION)
+ Context->pGuard = NULL;
+#endif
+#if (SEM_SIGNAL_DB)
+ Context->pSEM_SignalDB = NULL;
+#endif
+
+#if VS_USE_HEAP
+ if (Context->nNofStates)
+ {
+ if (Context->nNofInstances == 1)
+ {
+ if ((Context->pCSV = (SEM_STATE_TYPE *)malloc (sizeof (SEM_STATE_TYPE) * Context->nNofStateMachines)) == NULL)
+ goto MemoryError;
+ }
+ if ((Context->pWSV = (SEM_STATE_TYPE *)malloc (sizeof (SEM_STATE_TYPE) * Context->nNofStateMachines)) == NULL)
+ goto MemoryError;
+ }
+#if (SEM_SIGNAL)
+ if (Context->SSize)
+ {
+ if ((Context->pSQueue = (SEM_EVENT_TYPE *)malloc (sizeof (SEM_EVENT_TYPE) * Context->SSize)) == NULL)
+ goto MemoryError;
+ }
+#endif
+#endif
+
+ if (Context->nNofStates)
+ Context->pSMI = (SEM_STATE_MACHINE_TYPE VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->SMIPos);
+ if (Context->EventGroupType != 0)
+ Context->pEGT = (SEM_EVENT_GROUP_TYPE VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->EGTPos);
+ if (Context->EventGroupType == 2)
+ Context->pEGTI = (SEM_EGTI_TYPE VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->EGTIPos);
+ Context->pRD = (SEM_RULE_DATA_TYPE VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->RDPos);
+ Context->pRI = (SEM_RULE_INDEX_TYPE VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->RIPos);
+ Context->pRTI = (SEM_RULE_TABLE_INDEX_TYPE VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->RTIPos);
+
+ if (!Context->pVSFile)
+ {
+ if (pRBH->ENIPos && pRBH->nNofEvents)
+ Context->pENIPos = (unsigned long VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->ENIPos);
+ if (pRBH->SNIPos && pRBH->nNofStates)
+ Context->pSNIPos = (unsigned long VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->SNIPos);
+ if (pRBH->ANIPos && pRBH->nNofActionFunctions)
+ Context->pANIPos = (unsigned long VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->ANIPos);
+ if (pRBH->EEIPos && pRBH->nNofEvents)
+ Context->pEEIPos = (unsigned long VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->EEIPos);
+ if (pRBH->SEIPos && pRBH->nNofStates)
+ Context->pSEIPos = (unsigned long VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->SEIPos);
+ if (pRBH->AEIPos && pRBH->nNofActionFunctions)
+ Context->pAEIPos = (unsigned long VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)pRBH + pRBH->AEIPos);
+ }
+ else
+ {
+#ifndef SE_EXPERTDLL
+ CC = SES_NOT_LOADED;
+ goto CCError;
+#else
+ if ((CC = _SMP_ReadTP (Context->pVSFile, &Context->pENIPos, pRBH->nNofEvents, pRBH->ENIPos)) != SES_OKAY)
+ goto CCError;
+ if ((CC = _SMP_ReadTP (Context->pVSFile, &Context->pSNIPos, pRBH->nNofStates, pRBH->SNIPos)) != SES_OKAY)
+ goto CCError;
+ if ((CC = _SMP_ReadTP (Context->pVSFile, &Context->pANIPos, pRBH->nNofActionFunctions, pRBH->ANIPos)) != SES_OKAY)
+ goto CCError;
+ if ((CC = _SMP_ReadTP (Context->pVSFile, &Context->pEEIPos, pRBH->nNofEvents, pRBH->EEIPos)) != SES_OKAY)
+ goto CCError;
+ if ((CC = _SMP_ReadTP (Context->pVSFile, &Context->pSEIPos, pRBH->nNofStates, pRBH->SEIPos)) != SES_OKAY)
+ goto CCError;
+ if ((CC = _SMP_ReadTP (Context->pVSFile, &Context->pAEIPos, pRBH->nNofActionFunctions, pRBH->AEIPos)) != SES_OKAY)
+ goto CCError;
+#endif
+ }
+ SMP_Init (Context);
+#if (SEM_SIGNAL)
+ SMP_InitSignalQueue (Context);
+#endif
+
+#if (VS_REALLINKMODE == 1)
+ Context->systemNo = (VS_UINT8)((pRBH->IdAndEventGroupType >> 24) & 0x0FF);
+ vsrl_aVspContextPointer[Context->systemNo] = Context;
+#endif
+
+ return (SES_OKAY);
+
+CCError :
+ SMP_Free (Context);
+ return (CC);
+
+#if VS_USE_HEAP
+MemoryError :
+ SMP_Free (Context);
+ return (SES_MEM_ERR);
+#endif
+
+FileError :
+ SMP_Free (Context);
+ return (SES_FILE_ERR);
+}
+
+
+
+unsigned char SMP_Connect (SEM_CONTEXT VS_TQ_CONTEXT **Context, void VS_TQ_RULEBASE *VSData)
+{
+ SEM_CONTEXT VS_TQ_CONTEXT *pCont;
+
+#if VS_USE_HEAP
+ if ((pCont = (SEM_CONTEXT VS_TQ_CONTEXT *)malloc (sizeof (SEM_CONTEXT))) == NULL)
+ return (SES_MEM_ERR);
+#else
+ pCont = *(SEM_CONTEXT VS_TQ_CONTEXT * VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)VSData + ((RBH VS_TQ_RULEBASE *)VSData)->contextPtrOffset);
+#endif
+ pCont->pVSData = VSData;
+ pCont->pVSFile = NULL;
+ *Context = pCont;
+ return (_SMP_Connect (pCont, VSData));
+}
+
+
+#ifdef SE_EXPERTDLL
+unsigned char SMP_Load (SEM_CONTEXT VS_TQ_CONTEXT **Context, const char *FileName)
+{
+ FILE *pVSF;
+ RBH RBHe;
+ char *pc;
+ long Bytes;
+ size_t Chunk;
+ SEM_CONTEXT VS_TQ_CONTEXT *pCont;
+
+ if ((pCont = (SEM_CONTEXT VS_TQ_CONTEXT *)malloc (sizeof (SEM_CONTEXT))) == NULL)
+ return (SES_MEM_ERR);
+
+ pCont->pCSV = NULL;
+ pCont->pWSV = NULL;
+ pCont->pIns = NULL;
+#if (SEM_SIGNAL)
+ pCont->pSQueue = NULL;
+#endif
+ pCont->pENIPos = NULL;
+ pCont->pSNIPos = NULL;
+ pCont->pANIPos = NULL;
+ pCont->pEEIPos = NULL;
+ pCont->pSEIPos = NULL;
+ pCont->pAEIPos = NULL;
+
+ pVSF = fopen (FileName, "rb");
+ pCont->pVSFile = pVSF;
+ if (!pVSF)
+ goto FileError;
+ if (fread (&RBHe, sizeof (RBHe), 1, pVSF) != 1)
+ goto FileError;
+ if ((RBHe.IdAndEventGroupType & 0x0FF) != SEM_VERS_ID)
+ goto FileError;
+ if (((RBHe.IdAndEventGroupType >> 16) & 0x0FF) != SEM_RDFM_NUMBER)
+ goto FileError;
+ if (fseek (pVSF, 0L, SEEK_SET))
+ goto FileError;
+
+ Bytes = RBHe.TSPos;
+
+ if ((sizeof(size_t) == sizeof (short)) * (Bytes >> 16))
+ goto MemoryError;
+ if ((pCont->pVSData = (void *)malloc ((size_t)Bytes)) == NULL)
+ goto MemoryError;
+
+ pc = (char *)pCont->pVSData;
+ while (Bytes)
+ {
+ if (Bytes > 0x04000)
+ Chunk = 0x04000;
+ else
+ Chunk = (size_t)Bytes;
+ Bytes -= Chunk;
+ if (fread (pc, Chunk, 1, pVSF) != 1)
+ goto FileError;
+ pc += Chunk;
+ }
+
+ *Context = pCont;
+ return (_SMP_Connect (pCont, pCont->pVSData));
+
+MemoryError:
+ SMP_Free (pCont);
+ return (SES_MEM_ERR);
+
+FileError:
+ SMP_Free (pCont);
+ return (SES_FILE_ERR);
+}
+#endif
+
+
+void SMP_Free (SEM_CONTEXT VS_TQ_CONTEXT *Context)
+{
+ if (!Context)
+ return;
+
+#if (VS_REALLINKMODE == 1)
+ VS_WAIT_ELM(Context, VS_ENABLE_SYSTEM, Ind_SYSTEM_FREE, &Context->systemNo);
+ vsrl_aVspContextPointer[Context->systemNo] = NULL;
+#endif
+
+#if VS_USE_HEAP
+ if (Context->pCSV && Context->nNofInstances == 1)
+ free (Context->pCSV);
+ if (Context->pWSV)
+ free (Context->pWSV);
+ if (Context->pIns)
+ free (Context->pIns);
+#if (SEM_SIGNAL)
+ if (Context->pSQueue)
+ free (Context->pSQueue);
+#endif
+#endif
+#ifdef SE_EXPERTDLL
+ if (Context->pVSFile)
+ {
+ fclose (Context->pVSFile);
+ if (Context->pVSData)
+ free (Context->pVSData);
+ if (Context->pENIPos)
+ free (Context->pENIPos);
+ if (Context->pSNIPos)
+ free (Context->pSNIPos);
+ if (Context->pANIPos)
+ free (Context->pANIPos);
+ if (Context->pEEIPos)
+ free (Context->pEEIPos);
+ if (Context->pSEIPos)
+ free (Context->pSEIPos);
+ if (Context->pAEIPos)
+ free (Context->pAEIPos);
+ }
+#endif
+#if VS_USE_HEAP
+ free (Context);
+#endif
+}
+
+
+unsigned char SMP_Init (SEM_CONTEXT VS_TQ_CONTEXT *Context)
+{
+ SEM_STATE_MACHINE_TYPE i;
+
+#ifdef VS_RUNTIME_INFO
+ *vsRunTimeInfo.pSignatureVersion;
+#endif
+ if (!Context)
+ return (SES_NOT_LOADED);
+ for (i = 0; i < Context->nNofStateMachines; i++)
+ {
+ Context->pWSV[i] = STATE_UNDEFINED;
+ if (Context->nNofInstances == 1)
+ Context->pCSV[i] = STATE_UNDEFINED;
+ }
+ Context->State = STATE_SEM_INITIALIZE;
+ Context->InqAct = VS_FALSE;
+#if (SEM_SIGNAL)
+ Context->SignalStateChg = 0;
+#endif
+ Context->StateChange = VS_FALSE;
+ return (SES_OKAY);
+}
+
+
+#if (SEM_GUARD_EXPRESSION)
+#if (SEM_FUNCEXPHANDLING == 0)
+void SMP_InitGuardCallBack (SEM_CONTEXT VS_TQ_CONTEXT *Context, VS_GUARDEXPR_TYPE VS_TQ_GUARDEXPRCOL * Guard)
+#else
+void SMP_InitGuardCallBack (SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char (* Guard)(SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_GUARD_EXPRESSION_TYPE i))
+#endif
+{
+ Context->pGuard = Guard;
+}
+#endif
+
+
+#if (SEM_SIGNAL_DB)
+void SMP_InitSignalDBCallBack (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ void (*SEM_SignalDB)(SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_EVENT_TYPE SignalNo))
+{
+ Context->pSEM_SignalDB = SEM_SignalDB;
+}
+#endif
+
+
+#if (SEM_SIGNAL)
+void SMP_InitSignalQueue (SEM_CONTEXT VS_TQ_CONTEXT *Context)
+{
+ Context->SPut = 0;
+ Context->SGet = 0;
+ Context->SUsed = 0;
+}
+
+
+static unsigned char SMP_SignalQueuePut (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_EVENT_TYPE SignalNo)
+{
+ if (Context->SUsed == Context->SSize)
+ return (SES_SIGNAL_QUEUE_FULL);
+ Context->SUsed++;
+ Context->pSQueue[Context->SPut] = SignalNo;
+ if (++Context->SPut == Context->SSize)
+ Context->SPut = 0;
+ return (SES_OKAY);
+}
+
+
+static SEM_EVENT_TYPE SMP_SignalQueueGet (SEM_CONTEXT VS_TQ_CONTEXT *Context)
+{
+ SEM_EVENT_TYPE SignalNo;
+
+ if (!Context->SUsed)
+ return (EVENT_UNDEFINED);
+ Context->SUsed--;
+ SignalNo = Context->pSQueue[Context->SGet];
+
+ if (++Context->SGet == Context->SSize)
+ Context->SGet = 0;
+
+ return (SignalNo);
+}
+#endif
+
+
+unsigned char SMP_Deduct (SEM_CONTEXT VS_TQ_CONTEXT *Context, SEM_EVENT_TYPE EventNo)
+{
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (Context->nNofEvents <= EventNo)
+ return (SES_RANGE_ERR);
+ Context->EventNo = EventNo;
+ Context->State = STATE_SEM_PREPARE;
+ Context->DIt = 2;
+ if (Context->InqAct)
+ return (SES_ACTIVE);
+
+#if (VS_REALLINKMODE == 1)
+ VS_WAIT_ELM(Context, VS_ENABLE_EVENT, Ind_EVENT, &EventNo);
+#endif
+
+ return (SES_OKAY);
+}
+
+
+unsigned char SMP_GetOutput (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_ACTION_EXPRESSION_TYPE *ActionNo)
+{
+ SEM_RULE_DATA_TYPE rd;
+ unsigned char i, nPos, nNxt;
+#if (SEM_RDHW_TYPE_2 || SEM_RDHW_TYPE_3)
+ unsigned char nGuard;
+#endif
+#if (SEM_SIGNAL)
+ unsigned char nSignal;
+#endif
+ SEM_STATE_MACHINE_TYPE m;
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ unsigned char nNeg;
+ SEM_STATE_TYPE s;
+#endif
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+ for(;;)
+ {
+ switch (Context->State)
+ {
+#if (SEM_SIGNAL)
+ case STATE_SEM_SIGNAL :
+Signal :
+ Context->EventNo = SMP_SignalQueueGet (Context);
+ if (Context->EventNo == EVENT_UNDEFINED)
+ {
+ Context->State = STATE_SEM_OKAY;
+ return (SES_OKAY);
+ }
+#if (SEM_SIGNAL_DB)
+ if (Context->pSEM_SignalDB)
+ (*Context->pSEM_SignalDB) (Context, Context->EventNo);
+#endif
+ for (m = 0; m < Context->nNofStateMachines; m++)
+ {
+ if (Context->pWSV[m] != STATE_UNDEFINED)
+ {
+#ifdef SEM_NEXT_STATE_CHG
+ if (Context->pCSV[m] != Context->pWSV[m])
+ Context->SignalStateChg = 2;
+ else
+#endif
+ Context->SignalStateChg = 1;
+
+ Context->pCSV[m] = Context->pWSV[m];
+ Context->pWSV[m] = STATE_UNDEFINED;
+ }
+ }
+#if (VS_REALLINKMODE == 1)
+ VS_WAIT_ELM(Context, VS_ENABLE_SIGNAL, Ind_SIGNAL, &Context->EventNo);
+#endif
+ goto FirstRule;
+#endif
+ case STATE_SEM_PREPARE :
+#if (SEM_EVENT_GROUP_INDEX) || defined VISUALSTATE_EXPERT_DLL
+ if (Context->EventGroupType == 1)
+ {
+ if (Context->DIt == 1)
+ {
+ Context->EventNo = (SEM_EVENT_TYPE) Context->pEGT[Context->EventNo];
+ if (Context->EventNo == EVENT_UNDEFINED)
+ {
+#if (SEM_SIGNAL)
+ if (Context->nNofSignals != 0)
+ {
+ Context->DIt = 0;
+ goto Signal;
+ }
+ else
+#endif
+ {
+ Context->State = STATE_SEM_OKAY;
+ return (SES_OKAY);
+ }
+ }
+ Context->EventNo = (SEM_EVENT_TYPE) (Context->EventNo + Context->nNofEvents);
+ }
+ else if (Context->DIt == 0)
+ {
+#if (SEM_SIGNAL)
+ if (Context->nNofSignals != 0)
+ goto Signal;
+ else
+#endif
+ {
+ Context->State = STATE_SEM_OKAY;
+ return (SES_OKAY);
+ }
+ }
+ Context->DIt--;
+ }
+#endif
+#if (SEM_EVENT_GROUP_TABLE_INDEX) || defined VISUALSTATE_EXPERT_DLL
+ if (Context->EventGroupType == 2)
+ {
+ if (Context->DIt == 0)
+ {
+ if (++Context->iFirstEgi >= Context->iLastEgi)
+ {
+#if (SEM_SIGNAL)
+ if (Context->nNofSignals != 0)
+ goto Signal;
+ else
+#endif
+ {
+ Context->State = STATE_SEM_OKAY;
+ return (SES_OKAY);
+ }
+ }
+ Context->EventNo = Context->pEGT[Context->iFirstEgi];
+ Context->EventNo = (SEM_EVENT_TYPE) (Context->EventNo + Context->nNofEvents);
+ }
+ else if (Context->DIt == 1)
+ {
+ Context->iFirstEgi = Context->pEGTI[Context->EventNo];
+ Context->iLastEgi = Context->pEGTI[Context->EventNo + 1];
+ if (Context->iFirstEgi == Context->iLastEgi)
+ {
+#if (SEM_SIGNAL)
+ if (Context->nNofSignals != 0)
+ {
+ Context->DIt = 0;
+ goto Signal;
+ }
+ else
+#endif
+ {
+ Context->State = STATE_SEM_OKAY;
+ return (SES_OKAY);
+ }
+ }
+ Context->EventNo = Context->pEGT[Context->iFirstEgi];
+ Context->EventNo = (SEM_EVENT_TYPE) (Context->EventNo + Context->nNofEvents);
+ Context->DIt--;
+ }
+ else if (Context->DIt == 2)
+ {
+ Context->DIt--;
+ }
+ }
+#endif
+#if (SEM_SIGNAL)
+FirstRule :
+#endif
+ Context->iFirstR = Context->pRTI[Context->EventNo];
+ Context->iLastR = Context->pRTI[Context->EventNo + 1];
+ Context->State = STATE_SEM_CONSULT;
+ case STATE_SEM_CONSULT :
+ while (Context->iFirstR < Context->iLastR)
+ {
+ Context->iRI = Context->pRI[Context->iFirstR++];
+#if (SEM_RD_WIDTH_8_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_16_BIT)
+ rd = Context->pRD[Context->iRI++];
+ nNxt = (unsigned char)(rd & 0x0F);
+ Context->nNofActions = (unsigned char)(rd >> 4);
+ rd = Context->pRD[Context->iRI++];
+ nPos = (unsigned char)(rd & 0x0F);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)(rd >> 4);
+#endif
+#endif
+#if (SEM_RD_WIDTH_8_BIT && SEM_RDHW_TYPE_2 && SEM_RDHW_WIDTH_24_BIT)
+ rd = Context->pRD[Context->iRI++];
+ nPos = (unsigned char)(rd & 0x0F);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)(rd >> 4);
+#endif
+ rd = Context->pRD[Context->iRI++];
+ nGuard = (unsigned char)(rd & 0x0F);
+ nNxt = (unsigned char)(rd >> 4);
+ rd = Context->pRD[Context->iRI++];
+ Context->nNofActions = (unsigned char)(rd & 0x0F);
+#if (SEM_SIGNAL)
+ nSignal = (unsigned char)(rd >> 4);
+#endif
+#endif
+#if (SEM_RD_WIDTH_8_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_32_BIT)
+ Context->nNofActions = (unsigned char)Context->pRD[Context->iRI++];
+ nNxt = (unsigned char)Context->pRD[Context->iRI++];
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)Context->pRD[Context->iRI++];
+#else
+ Context->iRI++;
+#endif
+ nPos = (unsigned char)Context->pRD[Context->iRI++];
+#endif
+#if (SEM_RD_WIDTH_8_BIT && SEM_RDHW_TYPE_2 && SEM_RDHW_WIDTH_48_BIT)
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)Context->pRD[Context->iRI++];
+#else
+ Context->iRI++;
+#endif
+ nPos = (unsigned char)Context->pRD[Context->iRI++];
+ nNxt = (unsigned char)Context->pRD[Context->iRI++];
+ nGuard = (unsigned char)Context->pRD[Context->iRI++];
+#if (SEM_SIGNAL)
+ nSignal = (unsigned char)Context->pRD[Context->iRI++];
+#else
+ Context->iRI++;
+#endif
+ Context->nNofActions = (unsigned char)Context->pRD[Context->iRI++];
+#endif
+#if (SEM_RD_WIDTH_16_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_16_BIT)
+ rd = Context->pRD[Context->iRI++];
+ nPos = (unsigned char)(rd & 0x0F);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)((rd >> 4) & 0x0F);
+#endif
+ nNxt = (unsigned char)((rd >> 8) & 0x0F);
+ Context->nNofActions = (unsigned char)((rd >> 12) & 0x0F);
+#endif
+#if (SEM_RD_WIDTH_16_BIT && SEM_RDHW_TYPE_3 && SEM_RDHW_WIDTH_32_BIT)
+ rd = Context->pRD[Context->iRI++];
+ nPos = (unsigned char)(rd & 0x0F);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)((rd >> 4) & 0x0F);
+#endif
+ nGuard = (unsigned char)((rd >> 8) & 0x0F);
+ nNxt = (unsigned char)(rd >> 12);
+ rd = Context->pRD[Context->iRI++];
+ Context->nNofActions = (unsigned char)(rd & 0x0F);
+#if (SEM_SIGNAL)
+ nSignal = (unsigned char)((rd >> 4) & 0x0F);
+#endif
+#endif
+#if (SEM_RD_WIDTH_16_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_32_BIT)
+ rd = Context->pRD[Context->iRI++];
+ nNxt = (unsigned char)(rd & 0x0FF);
+ Context->nNofActions = (unsigned char)(rd >> 8);
+ rd = Context->pRD[Context->iRI++];
+ nPos = (unsigned char)(rd & 0x0FF);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)(rd >> 8);
+#endif
+#endif
+#if (SEM_RD_WIDTH_16_BIT && SEM_RDHW_TYPE_2 && SEM_RDHW_WIDTH_48_BIT)
+ rd = Context->pRD[Context->iRI++];
+ nPos = (unsigned char)(rd & 0x0FF);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)(rd >> 8);
+#endif
+ rd = Context->pRD[Context->iRI++];
+ nGuard = (unsigned char)(rd & 0x0FF);
+ nNxt = (unsigned char)(rd >> 8);
+ rd = Context->pRD[Context->iRI++];
+ Context->nNofActions = (unsigned char)(rd & 0x0FF);
+#if (SEM_SIGNAL)
+ nSignal = (unsigned char)(rd >> 8);
+#endif
+#endif
+#if (SEM_RD_WIDTH_32_BIT && SEM_RDHW_TYPE_1 && SEM_RDHW_WIDTH_32_BIT)
+ rd = Context->pRD[Context->iRI++];
+ nPos = (unsigned char)(rd & 0X0FF);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)((rd >> 8) & 0X0FF);
+#endif
+ nNxt = (unsigned char)((rd >> 16) & 0x0FF);
+ Context->nNofActions = (unsigned char)(rd >> 24);
+#endif
+#if (SEM_RD_WIDTH_32_BIT && SEM_RDHW_TYPE_3 && SEM_RDHW_WIDTH_64_BIT)
+ rd = Context->pRD[Context->iRI++];
+ nPos = (unsigned char)(rd & 0x0FF);
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ nNeg = (unsigned char)((rd >> 8) & 0x0FF);
+#endif
+ nGuard = (unsigned char)((rd >> 16) & 0x0FF);
+ nNxt = (unsigned char)(rd >> 24);
+ rd = Context->pRD[Context->iRI++];
+ Context->nNofActions = (unsigned char)(rd & 0x0FF);
+#if (SEM_SIGNAL)
+ nSignal = (unsigned char)((rd >> 8) & 0x0FF);
+#endif
+#endif
+ for (i = 0; i < nPos; i++)
+ {
+ rd = Context->pRD[Context->iRI++];
+ if (rd != Context->pCSV[Context->pSMI[rd]])
+ goto NextRule;
+ }
+#if (SEM_RMN_NEGATIVE_STATE_SYNCS || defined VISUALSTATE_EXPERT_DLL)
+ for (i = 0; i < nNeg; i++)
+ {
+ rd = Context->pRD[Context->iRI++];
+ s = Context->pCSV[Context->pSMI[rd]];
+ if ((s == STATE_UNDEFINED) || (s == (SEM_STATE_TYPE) rd))
+ goto NextRule;
+ }
+#endif
+#if (SEM_GUARD_EXPRESSION)
+ if (nGuard)
+ {
+ if (Context->pGuard)
+ for (i = 0; i < nGuard; i++)
+#if (SEM_FUNCEXPHANDLING == 0)
+ if ((*Context->pGuard[Context->pRD[Context->iRI++]])(Context) == VS_FALSE)
+#else
+ if ((*Context->pGuard)(Context, (SEM_GUARD_EXPRESSION_TYPE) Context->pRD[Context->iRI++]) == VS_FALSE)
+#endif
+ goto NextRule;
+ }
+#endif
+
+#if (VS_REALLINKMODE == 1)
+ {
+ SEM_RULE_TABLE_INDEX_TYPE ri = Context->iFirstR - 1;
+ VS_WAIT_ELM(Context, VS_ENABLE_TRANS, Ind_TRANS, &ri);
+ }
+#endif
+
+ for (i = 0; i < nNxt; i++)
+ {
+ rd = Context->pRD[Context->iRI++];
+ m = Context->pSMI[rd];
+ if (Context->pWSV[m] == STATE_UNDEFINED)
+ Context->pWSV[m] = (SEM_STATE_TYPE) rd;
+ else if (Context->pWSV[m] != rd)
+ return (SES_CONTRADICTION);
+ }
+#if (SEM_SIGNAL)
+ if (nSignal)
+ {
+ for (i = 0; i < nSignal; i++)
+ {
+ rd = Context->pRD[Context->iRI++];
+#if (SEM_SIGNAL_QUEUE_ERROR_IF_FULL)
+ if (SMP_SignalQueuePut (Context, (SEM_EVENT_TYPE)rd) == SES_SIGNAL_QUEUE_FULL)
+ return (SES_SIGNAL_QUEUE_FULL);
+#endif
+#if (SEM_SIGNAL_QUEUE_NO_ERROR_IF_FULL)
+ SMP_SignalQueuePut (Context, (SEM_EVENT_TYPE)rd);
+#endif
+ }
+ }
+#endif
+ if (Context->nNofActions)
+ {
+ *ActionNo = (SEM_ACTION_EXPRESSION_TYPE)Context->pRD[Context->iRI];
+ if (Context->nNofActions > 1)
+ {
+ Context->iRI++;
+ Context->nNofActions--;
+ Context->State = STATE_SEM_OUTPUT;
+ }
+
+#if (VS_REALLINKMODE == 1)
+ VS_WAIT_ELM(Context, VS_ENABLE_ACTION, Ind_ACTION, ActionNo);
+#endif
+
+ return (SES_FOUND);
+ }
+NextRule :
+ ;
+ }
+#if (SEM_EVENT_GROUP_INDEX || SEM_EVENT_GROUP_TABLE_INDEX) || defined VISUALSTATE_EXPERT_DLL
+ if (Context->EventGroupType != 0)
+ {
+ Context->State = STATE_SEM_PREPARE;
+ break;
+ }
+ else
+ {
+#if (SEM_SIGNAL)
+ if (Context->nNofSignals != 0)
+ goto Signal;
+ else
+#endif
+ {
+ Context->State = STATE_SEM_OKAY;
+ return (SES_OKAY);
+ }
+ }
+#else
+#if (SEM_SIGNAL)
+ if (Context->nNofSignals != 0)
+ goto Signal;
+ else
+#endif
+ {
+ Context->State = STATE_SEM_OKAY;
+ return (SES_OKAY);
+ }
+#endif
+ case STATE_SEM_OUTPUT :
+ if (Context->nNofActions)
+ {
+ *ActionNo = (SEM_ACTION_EXPRESSION_TYPE)Context->pRD[Context->iRI++];
+ Context->nNofActions--;
+
+#if (VS_REALLINKMODE == 1)
+ VS_WAIT_ELM(Context, VS_ENABLE_ACTION, Ind_ACTION, ActionNo);
+#endif
+
+ return (SES_FOUND);
+ }
+ Context->State = STATE_SEM_CONSULT;
+ break;
+ case STATE_SEM_OKAY :
+ return (SES_OKAY);
+ default :
+ return (SES_EMPTY);
+ }
+ }
+}
+
+
+#if defined SEM_GET_OUTPUT_ALL || defined VISUALSTATE_EXPERT_DLL
+#if (SEM_SIGNAL)
+#ifndef VISUALSTATE_EXPERT_DLL
+#error SMP_GetOutputAll cannot be used when the Project contains signals.
+#endif
+#endif
+unsigned char SMP_GetOutputAll (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_ACTION_EXPRESSION_TYPE *ActionExprVector,
+ SEM_ACTION_EXPRESSION_TYPE MaxSize)
+{
+ SEM_ACTION_EXPRESSION_TYPE i;
+ unsigned char CC;
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+
+ for (i = 0; ((CC = SMP_GetOutput (Context, &ActionExprVector[i])) == SES_FOUND) && i < MaxSize - 1; i++);
+
+ if (CC == SES_OKAY)
+ {
+ ActionExprVector[i] = ACTION_EXPRESSION_TERMINATION_ID;
+ return (SES_OKAY);
+ }
+ if (CC == SES_FOUND)
+ return (SES_BUFFER_OVERFLOW);
+ return (CC);
+}
+#endif
+
+
+
+#if defined SEM_NEXT_STATE_CHG || defined VISUALSTATE_EXPERT_DLL
+unsigned char _SMP_NextStateChg (SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char nextStateChg)
+#else
+unsigned char _SMP_NextStateChg (SEM_CONTEXT VS_TQ_CONTEXT *Context)
+#endif
+{
+ unsigned char CC;
+ SEM_STATE_MACHINE_TYPE i;
+ SEM_ACTION_EXPRESSION_TYPE ActionNo;
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (Context->State != STATE_SEM_OKAY)
+ {
+ while ((CC = SMP_GetOutput (Context, &ActionNo)) == SES_FOUND);
+ if (CC != SES_OKAY)
+ return (CC);
+ }
+ CC = SES_OKAY;
+
+#if (SEM_SIGNAL)
+ if (Context->SignalStateChg != 0)
+ {
+#if defined SEM_NEXT_STATE_CHG || defined VISUALSTATE_EXPERT_DLL
+ if (nextStateChg && Context->SignalStateChg == 2)
+ CC = SES_FOUND;
+#endif
+ Context->StateChange = VS_TRUE;
+ Context->SignalStateChg = 0;
+ }
+ else
+#endif
+ Context->StateChange = VS_FALSE;
+
+ for (i = 0; i < Context->nNofStateMachines; i++)
+ {
+ if (Context->pWSV[i] != STATE_UNDEFINED)
+ {
+#if defined SEM_NEXT_STATE_CHG || defined VISUALSTATE_EXPERT_DLL
+ if (nextStateChg && Context->pCSV[i] != Context->pWSV[i])
+ CC = SES_FOUND;
+#endif
+ Context->pCSV[i] = Context->pWSV[i];
+ Context->pWSV[i] = STATE_UNDEFINED;
+ Context->StateChange = VS_TRUE;
+ }
+ }
+ Context->State = STATE_SEM_INITIALIZE;
+
+ return CC;
+}
diff --git a/cesar/lib/visual_state_api/src/SMPName.c b/cesar/lib/visual_state_api/src/SMPName.c
new file mode 100644
index 0000000000..4562f9573e
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPName.c
@@ -0,0 +1,92 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPName.c
+ *
+ * Function: Contains the SMP_Name SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.1 ! 101298 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char SMP_Name (SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char *Text, unsigned short MaxSize)
+{
+ int c;
+ unsigned long Pos;
+ unsigned short i;
+ char VS_TQ_RULEBASE * pT = NULL; /* initialization may be necessary to avoid compiler warnings */
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (!MaxSize)
+ return (SES_TEXT_TOO_LONG);
+ switch (IdentType)
+ {
+ case EVENT_TYPE :
+ if (!Context->pENIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofEvents <= (SEM_EVENT_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pENIPos[IdentNo];
+ break;
+ case STATE_TYPE :
+ if (!Context->pSNIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofStates <= (SEM_STATE_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pSNIPos[IdentNo];
+ break;
+ case ACTION_TYPE :
+ if (!Context->pANIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofActionFunctions <= (SEM_ACTION_FUNCTION_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pANIPos[IdentNo];
+ break;
+ default :
+ return (SES_TYPE_ERR);
+ }
+ if (Context->pVSFile)
+ {
+#ifndef SE_EXPERTDLL
+ return (SES_NOT_LOADED);
+#else
+ if (fseek (Context->pVSFile, (long)Pos, SEEK_SET))
+ return (SES_FILE_ERR);
+#endif
+ }
+ else
+ pT = (char VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)Context->pVSData + Pos);
+
+ for (i = 0; i < MaxSize; i++)
+ {
+#ifdef SE_EXPERTDLL
+ if (Context->pVSFile)
+ {
+ c = fgetc (Context->pVSFile);
+ if (c == EOF)
+ return (SES_FILE_ERR);
+ }
+ else
+#endif
+ c = *pT++;
+ *Text++ = (char)c;
+ if (c == '\0')
+ return (SES_OKAY);
+ }
+ Text--;
+ *Text = '\0';
+ return (SES_TEXT_TOO_LONG);
+}
diff --git a/cesar/lib/visual_state_api/src/SMPNameA.c b/cesar/lib/visual_state_api/src/SMPNameA.c
new file mode 100644
index 0000000000..f2c50b6d2f
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPNameA.c
@@ -0,0 +1,67 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPNameA.c
+ *
+ * Function: Contains the SMP_NameAbs SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.1 ! 101298 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char SMP_NameAbs (SEM_CONTEXT VS_TQ_CONTEXT *Context, unsigned char IdentType,
+ SEM_EXPLANATION_TYPE IdentNo, char VS_TQ_RULEBASE **Text)
+{
+ unsigned long Pos;
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+ switch (IdentType)
+ {
+ case EVENT_TYPE :
+ if (!Context->pENIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofEvents <= (SEM_EVENT_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pENIPos[IdentNo];
+ break;
+ case STATE_TYPE :
+ if (!Context->pSNIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofStates <= (SEM_STATE_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pSNIPos[IdentNo];
+ break;
+ case ACTION_TYPE :
+ if (!Context->pANIPos)
+ return (SES_TYPE_ERR);
+ if (Context->nNofActionFunctions <= (SEM_ACTION_FUNCTION_TYPE)IdentNo)
+ return (SES_RANGE_ERR);
+ Pos = Context->pANIPos[IdentNo];
+ break;
+ default :
+ return (SES_TYPE_ERR);
+ }
+ if (Context->pVSFile)
+ {
+#ifndef SE_EXPERTDLL
+ return (SES_NOT_LOADED);
+#else
+ return (SES_NOT_COMPATIBLE);
+#endif
+ }
+ else
+ *Text = (char VS_TQ_RULEBASE *)((char VS_TQ_RULEBASE *)Context->pVSData + Pos);
+ return (SES_OKAY);
+}
diff --git a/cesar/lib/visual_state_api/src/SMPStAll.c b/cesar/lib/visual_state_api/src/SMPStAll.c
new file mode 100644
index 0000000000..318fd74dc5
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPStAll.c
@@ -0,0 +1,36 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPStAll.c
+ *
+ * Function: Contains the SMP_StateAll SEM Library Expert version 4
+ * function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char SMP_StateAll (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_STATE_TYPE *StateVector, SEM_STATE_MACHINE_TYPE MaxSize)
+{
+ SEM_STATE_MACHINE_TYPE i;
+
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (Context->nNofStateMachines > MaxSize)
+ return (SES_BUFFER_OVERFLOW);
+ for (i = 0; i < Context->nNofStateMachines; i++)
+ StateVector[i] = Context->pCSV[i];
+ return (SES_FOUND);
+}
diff --git a/cesar/lib/visual_state_api/src/SMPState.c b/cesar/lib/visual_state_api/src/SMPState.c
new file mode 100644
index 0000000000..180000e320
--- /dev/null
+++ b/cesar/lib/visual_state_api/src/SMPState.c
@@ -0,0 +1,32 @@
+/*
+ * Type: Source Code File
+ *
+ * Id: SMPState.c
+ *
+ * Function: Contains the SEM_State SEM Library Expert version 4 function.
+ *
+ * Portability: ANSI-C Compiler.
+ *
+ * Copyright (c) 1999-2006 IAR Systems. All rights reserved.
+ */
+
+/*
+ * Version ! Date ! Status ! Changes
+ *----------------------------------------------------------------------------
+ * 4.0.0.0 ! 011198 ! Closed ! -
+ * 4.0.4 ! 010799 ! Closed ! Minor update, there might be no changes to this particular file.
+ */
+
+#include "SEMLibE.h"
+
+
+unsigned char SMP_State (SEM_CONTEXT VS_TQ_CONTEXT *Context,
+ SEM_STATE_MACHINE_TYPE StateMachineNo, SEM_STATE_TYPE *StateNo)
+{
+ if (!Context)
+ return (SES_NOT_LOADED);
+ if (Context->nNofStateMachines <= StateMachineNo)
+ return (SES_RANGE_ERR);
+ *StateNo = Context->pCSV[StateMachineNo];
+ return (SES_FOUND);
+}