lib/iec_types_all.h
author laurent
Wed, 25 Jan 2012 01:16:30 +0100
changeset 397 85151b2f35ca
parent 394 8a04e93f9ef2
child 404 ff3313e22883
permissions -rwxr-xr-x
Adding Common_Ticktime to informations printed in VARIABLES.csv file
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
     1
/*
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
     2
 * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
     3
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
     4
 * See COPYING and COPYING.LESSER files for copyright details.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
     5
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
     6
 * This library is free software; you can redistribute it and/or
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
     7
 * modify it under the terms of the GNU Lesser General Public
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
     8
 * License as published by the Free Software Foundation; either
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
     9
 * version 3 of the License, or (at your option) any later version.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    10
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    11
 * This library is distributed in the hope that it will be useful,
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    14
 * Lesser General Public License for more details.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    15
 * 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    16
 * You should have received a copy of the GNU Lesser General Public License 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    17
 * along with this library. If not, see <http://www.gnu.org/licenses/>.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    18
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    19
 */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    20
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    21
#ifndef IEC_TYPES_ALL_H
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    22
#define IEC_TYPES_ALL_H
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    23
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    24
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    25
/* Macro that expand to subtypes */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    26
#define __ANY(DO)                 __ANY_DERIVED(DO) __ANY_ELEMENTARY(DO)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    27
#define __ANY_DERIVED(DO)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    28
#define __ANY_ELEMENTARY(DO)      __ANY_MAGNITUDE(DO) __ANY_BIT(DO) __ANY_STRING(DO) __ANY_DATE(DO)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    29
#define __ANY_MAGNITUDE(DO)       __ANY_NUM(DO) DO(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    30
#define __ANY_BIT(DO)             __ANY_NBIT(DO) DO(BOOL)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    31
#define __ANY_NBIT(DO)            DO(BYTE) DO(WORD) DO(DWORD) DO(LWORD)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    32
#define __ANY_STRING(DO)          DO(STRING)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    33
#define __ANY_DATE(DO)            DO(DATE) DO(TOD) DO(DT)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    34
#define __ANY_NUM(DO)             __ANY_REAL(DO) __ANY_INT(DO)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    35
#define __ANY_REAL(DO)            DO(REAL) DO(LREAL)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    36
#define __ANY_INT(DO)             __ANY_SINT(DO) __ANY_UINT(DO)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    37
#define __ANY_SINT(DO)            DO(SINT) DO(INT) DO(DINT) DO(LINT)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    38
#define __ANY_UINT(DO)            DO(USINT) DO(UINT) DO(UDINT) DO(ULINT)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    39
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    40
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    41
/* Macro that expand to subtypes */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    42
#define __ANY_1(DO,P1)            __ANY_DERIVED_1(DO,P1) __ANY_ELEMENTARY_1(DO,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    43
#define __ANY_DERIVED_1(DO,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    44
#define __ANY_ELEMENTARY_1(DO,P1) __ANY_MAGNITUDE_1(DO,P1) __ANY_BIT_1(DO,P1) __ANY_STRING_1(DO,P1) __ANY_DATE_1(DO,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    45
#define __ANY_MAGNITUDE_1(DO,P1)  __ANY_NUM_1(DO,P1) DO(TIME,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    46
#define __ANY_BIT_1(DO,P1)        __ANY_NBIT_1(DO,P1) DO(BOOL,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    47
#define __ANY_NBIT_1(DO,P1)       DO(BYTE,P1) DO(WORD,P1) DO(DWORD,P1) DO(LWORD,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    48
#define __ANY_STRING_1(DO,P1)     DO(STRING,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    49
#define __ANY_DATE_1(DO,P1)       DO(DATE,P1) DO(TOD,P1) DO(DT,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    50
#define __ANY_NUM_1(DO,P1)        __ANY_REAL_1(DO,P1) __ANY_INT_1(DO,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    51
#define __ANY_REAL_1(DO,P1)       DO(REAL,P1) DO(LREAL,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    52
#define __ANY_INT_1(DO,P1)        __ANY_SINT_1(DO,P1) __ANY_UINT_1(DO,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    53
#define __ANY_SINT_1(DO,P1)       DO(SINT,P1) DO(INT,P1) DO(DINT,P1) DO(LINT,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    54
#define __ANY_UINT_1(DO,P1)       DO(USINT,P1) DO(UINT,P1) DO(UDINT,P1) DO(ULINT,P1)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    55
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
    56
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    57
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    58
/*********************/
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    59
/*  IEC Types defs   */
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    60
/*********************/
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    61
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    62
/* Include non windows.h clashing typedefs */
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    63
#include "iec_types.h"
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
    64
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    65
#define TRUE 1
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    66
#define FALSE 0
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    67
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
    68
#define __IEC_DEBUG_FLAG 0x01
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
    69
#define __IEC_FORCE_FLAG 0x02
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
    70
#define __IEC_RETAIN_FLAG 0x04
301
15bf9ecb936d Added __IEC_OUTPUT_FLAG, to mark variable whose forcing implies refresh on eache cycle.
Edouard Tisserant
parents: 246
diff changeset
    71
#define __IEC_OUTPUT_FLAG 0x08
222
8b1757417a54 Adding Flags bit symbols
laurent
parents: 221
diff changeset
    72
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    73
#define __DECLARE_IEC_TYPE(type)\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    74
typedef IEC_##type type;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    75
\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    76
typedef struct {\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    77
  IEC_##type value;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    78
  IEC_BYTE flags;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    79
} __IEC_##type##_t;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    80
\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    81
typedef struct {\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    82
  IEC_##type *value;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    83
  IEC_BYTE flags;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    84
  IEC_##type fvalue;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    85
} __IEC_##type##_p;
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    86
327
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
    87
#define __DECLARE_DERIVED_TYPE(type, base)\
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    88
typedef base type;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    89
typedef __IEC_##base##_t __IEC_##type##_t;
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    90
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    91
#define __DECLARE_COMPLEX_STRUCT(type)\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    92
typedef struct {\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    93
  type value;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    94
  IEC_BYTE flags;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    95
} __IEC_##type##_t;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    96
\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    97
typedef struct {\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    98
  type *value;\
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
    99
  IEC_BYTE flags;\
394
8a04e93f9ef2 Fixing bug in generated code for complex type external variable
laurent
parents: 350
diff changeset
   100
  type fvalue;\
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
   101
} __IEC_##type##_p;
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
   102
327
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   103
#define __DECLARE_ENUMERATED_TYPE(type, ...)\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   104
typedef enum {\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   105
  __VA_ARGS__\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   106
} type;\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   107
__DECLARE_COMPLEX_STRUCT(type)
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   108
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   109
#define __DECLARE_ARRAY_TYPE(type, base, size)\
237
cece842c7417 Adding support for using arrays in POU interface
laurent
parents: 235
diff changeset
   110
typedef struct {\
cece842c7417 Adding support for using arrays in POU interface
laurent
parents: 235
diff changeset
   111
  base table size;\
cece842c7417 Adding support for using arrays in POU interface
laurent
parents: 235
diff changeset
   112
} type;\
327
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   113
__DECLARE_COMPLEX_STRUCT(type)
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
   114
327
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   115
#define __DECLARE_STRUCT_TYPE(type, elements)\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   116
typedef struct {\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   117
  elements\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   118
} type;\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   119
__DECLARE_COMPLEX_STRUCT(type)
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
   120
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   121
/* Those typdefs clash with windows.h */
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   122
/* i.e. this file cannot be included aside windows.h */
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
   123
__ANY(__DECLARE_IEC_TYPE)
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
   124
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   125
typedef struct {
221
c6aed7e5f070 Adding support for flags on Function Block variables for marking which variable must be debugged, retained or is forced
laurent
parents: 199
diff changeset
   126
  __IEC_BOOL_t state;     // current step state. 0 : inative, 1: active
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   127
  BOOL prev_state;  // previous step state. 0 : inative, 1: active
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   128
  TIME elapsed_time;  // time since step is active
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   129
} STEP;
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   130
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   131
typedef struct {
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   132
  BOOL stored;  // action storing state. 0 : not stored, 1: stored
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   133
  BOOL state; // current action state. 0 : inative, 1: active
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   134
  BOOL set;   // set have been requested (reset each time the body is evaluated)
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   135
  BOOL reset; // reset have been requested (reset each time the body is evaluated)
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   136
  TIME set_remaining_time;    // time before set will be requested
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   137
  TIME reset_remaining_time;  // time before reset will be requested
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   138
} ACTION;
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   139
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   140
/* Extra debug types for SFC */
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
   141
#define __ANY_SFC(DO) DO(STEP) DO(TRANSITION) DO(ACTION)
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   142
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   143
/* Enumerate native types */
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   144
#define __decl_enum_type(TYPENAME) TYPENAME##_ENUM,
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   145
#define __decl_enum_pointer(TYPENAME) TYPENAME##_P_ENUM,
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 227
diff changeset
   146
#define __decl_enum_output(TYPENAME) TYPENAME##_O_ENUM,
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   147
typedef enum{
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
   148
  __ANY(__decl_enum_type)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
   149
  __ANY(__decl_enum_pointer)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
   150
  __ANY(__decl_enum_output)
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   151
  /* SFC specific types are never external or global */
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   152
  UNKNOWN_ENUM
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   153
} __IEC_types_enum;
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   154
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   155
/* Get size of type from its number */
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   156
#define __decl_size_case(TYPENAME) \
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   157
	case TYPENAME##_ENUM:\
246
e8b5b163804d A forgotten case in type size getter switch prevented debugging outputs.
edouard
parents: 237
diff changeset
   158
	case TYPENAME##_O_ENUM:\
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   159
	case TYPENAME##_P_ENUM:\
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   160
		return sizeof(TYPENAME);
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   161
static inline USINT __get_type_enum_size(__IEC_types_enum t){
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   162
 switch(t){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
   163
  __ANY(__decl_size_case)
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   164
  /* size do not correspond to real struct.
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   165
   * only a bool is used to represent state*/
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   166
  default:
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   167
	  return 0;
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   168
 }
199
b075f28ec081 Bug with type conversion EN/ENO not evaluated fixed
laurent
parents: 137
diff changeset
   169
 return 0;
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   170
}
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   171
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   172
#endif /*IEC_TYPES_ALL_H*/