lib/iec_types_all.h
author laurent
Fri, 24 Feb 2012 18:16:56 +0100
changeset 407 2d77f0f77773
parent 404 ff3313e22883
child 628 fe0d516fe291
permissions -rwxr-xr-x
Fix bug in code generated for MUL function
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;\
404
ff3313e22883 Fix bug pointed structure not declared for directly derived datatypes
laurent
parents: 394
diff changeset
    89
typedef __IEC_##base##_t __IEC_##type##_t;\
ff3313e22883 Fix bug pointed structure not declared for directly derived datatypes
laurent
parents: 394
diff changeset
    90
typedef __IEC_##base##_p __IEC_##type##_p;
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
    91
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
#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
    93
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
    94
  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
    95
  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
    96
} __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
    97
\
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
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
    99
  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
   100
  IEC_BYTE flags;\
394
8a04e93f9ef2 Fixing bug in generated code for complex type external variable
laurent
parents: 350
diff changeset
   101
  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
   102
} __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
   103
327
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   104
#define __DECLARE_ENUMERATED_TYPE(type, ...)\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   105
typedef enum {\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   106
  __VA_ARGS__\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   107
} type;\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   108
__DECLARE_COMPLEX_STRUCT(type)
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   109
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   110
#define __DECLARE_ARRAY_TYPE(type, base, size)\
237
cece842c7417 Adding support for using arrays in POU interface
laurent
parents: 235
diff changeset
   111
typedef struct {\
cece842c7417 Adding support for using arrays in POU interface
laurent
parents: 235
diff changeset
   112
  base table size;\
cece842c7417 Adding support for using arrays in POU interface
laurent
parents: 235
diff changeset
   113
} type;\
327
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   114
__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
   115
327
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   116
#define __DECLARE_STRUCT_TYPE(type, elements)\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   117
typedef struct {\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   118
  elements\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   119
} type;\
da78d0d93c75 Fix bug in declaring variable of enumerated type
laurent
parents: 301
diff changeset
   120
__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
   121
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   122
/* Those typdefs clash with windows.h */
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   123
/* 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
   124
__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
   125
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   126
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
   127
  __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
   128
  BOOL prev_state;  // previous step state. 0 : inative, 1: active
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   129
  TIME elapsed_time;  // time since step is active
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   130
} STEP;
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   131
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   132
typedef struct {
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   133
  BOOL stored;  // action storing state. 0 : not stored, 1: stored
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   134
  BOOL state; // current action state. 0 : inative, 1: active
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   135
  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
   136
  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
   137
  TIME set_remaining_time;    // time before set will be requested
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   138
  TIME reset_remaining_time;  // time before reset will be requested
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   139
} ACTION;
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   140
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   141
/* 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
   142
#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
   143
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   144
/* Enumerate native types */
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   145
#define __decl_enum_type(TYPENAME) TYPENAME##_ENUM,
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   146
#define __decl_enum_pointer(TYPENAME) TYPENAME##_P_ENUM,
235
ed66dc50f31a Bug on generate_c_inlinefcall fixed
laurent
parents: 227
diff changeset
   147
#define __decl_enum_output(TYPENAME) TYPENAME##_O_ENUM,
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   148
typedef enum{
350
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_type)
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_pointer)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
   151
  __ANY(__decl_enum_output)
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   152
  /* SFC specific types are never external or global */
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   153
  UNKNOWN_ENUM
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   154
} __IEC_types_enum;
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   155
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   156
/* Get size of type from its number */
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   157
#define __decl_size_case(TYPENAME) \
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   158
	case TYPENAME##_ENUM:\
246
e8b5b163804d A forgotten case in type size getter switch prevented debugging outputs.
edouard
parents: 237
diff changeset
   159
	case TYPENAME##_O_ENUM:\
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   160
	case TYPENAME##_P_ENUM:\
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   161
		return sizeof(TYPENAME);
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   162
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
   163
 switch(t){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 327
diff changeset
   164
  __ANY(__decl_size_case)
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   165
  /* size do not correspond to real struct.
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   166
   * only a bool is used to represent state*/
224
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   167
  default:
270ba3d91e59 type definition to match accessor and new debug
edouard
parents: 222
diff changeset
   168
	  return 0;
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   169
 }
199
b075f28ec081 Bug with type conversion EN/ENO not evaluated fixed
laurent
parents: 137
diff changeset
   170
 return 0;
137
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
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents:
diff changeset
   173
#endif /*IEC_TYPES_ALL_H*/