lib/C/iec_std_functions.h
author Mario de Sousa <msousa@fe.up.pt>
Fri, 02 Feb 2018 18:15:48 +0000
changeset 1067 ce81fa6d9024
parent 1063 b5b48b6f7606
child 1068 222879991f44
permissions -rwxr-xr-x
improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
107
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
     1
/*
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
     2
 * copyright 2008 Edouard TISSERANT
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
     3
 * copyright 2011 Mario de Sousa (msousa@fe.up.pt)
107
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
     4
 *
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
     5
 * Offered to the public under the terms of the GNU Lesser General Public
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
     6
 * License as published by the Free Software Foundation; either version 2
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
     7
 * of the License, or (at your option) any later version.
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
     8
 *
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
     9
 * This program is distributed in the hope that it will be useful, but
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
    10
 * WITHOUT ANY WARRANTY; without even the implied warranty of
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
    12
 * General Public License for more details.
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
    13
 *
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
    14
 * This code is made available on the understanding that it will not be
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
    15
 * used in safety-critical situations without a full and competent review.
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
    16
 */
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
    17
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
    18
/****
107
ff5c92df0c78 Fixed headers of generated code
etisserant
parents: 66
diff changeset
    19
 * IEC 61131-3 standard function library
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
    20
 */
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
    21
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    22
/* NOTE: This file is full of (what may seem at first) very strange macros.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    23
 *       If you want to know what all these strange macros are doing,
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    24
 *       just parse this file through a C preprocessor (e.g. cpp), 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    25
 *       and analyse the output!
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    26
 *       $gcc -E iec_std_lib.h 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    27
 */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    28
905
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 904
diff changeset
    29
#ifndef _IEC_STD_FUNCTIONS_H
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 904
diff changeset
    30
#define _IEC_STD_FUNCTIONS_H
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    31
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    32
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    33
/*****************************************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    34
/*****************************************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    35
/*****                                                       *****/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    36
/*****                 IEC 61131-3                           *****/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    37
/*****      S T A N D A R D     F U N C T I O N S            *****/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    38
/*****                                                       *****/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    39
/*****************************************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    40
/*****************************************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    41
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    42
/* NOTE: If you want to know what all these strange macros are doing,
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    43
 *       just parse this file through a C preprocessor, and analyse the output!
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    44
 *       $gcc -E iec_std_lib.h 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    45
 */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    46
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    47
/* NOTE: We only define and declare the explicitly typed standard functions
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    48
 *       (e.g., SIN_REAL, SIN_LREAL, ..., ADD_SINT, ADD_INT, ADD_LINT, ...)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    49
 *       We do not declare/define the overloaded functions
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    50
 *       (SIN, ADD, ...). 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    51
 *       When handling a call to an overloaded function, the iec2c compiler 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    52
 *       will determine in stage3 the data type of the parameter being passed, 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    53
 *       and in stage4 generate the C code to call the correct
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    54
 *       typed standard function.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    55
 */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    56
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    57
/* NOTE on explicit typing of:
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    58
 *           - Table 25 - Standard bit shift functions
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    59
 *           - Table 29 - Character string Functions
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    60
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    61
 *  In section 2.5.1.4 (Typing, overloading, and type conversion) of the IEC 61131-3 (version 2)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    62
 *  of the standard, it is stated:
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    63
 * "A standard function, [...] is said to be overloaded when it
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    64
 * can operate on input data elements of various types within a generic type designator as defined in
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    65
 * 2.3.2. For instance, an overloaded addition function on generic type ANY_NUM can operate on data
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    66
 * of types LREAL, REAL, DINT, INT, and SINT."
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    67
 * [...]
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    68
 * "When a function which normally represents an overloaded operator is to be typed, i.e., the types
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    69
 * of its inputs and outputs restricted to a particular elementary or derived data type as defined in
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    70
 * 2.3, this shall be done by appending an "underline" character followed by the required type, as
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    71
 * shown in table 21."
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    72
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    73
 * However, this explanation (as well as the example in table 21) only refers to functions where the same
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    74
 * generic data type is used for the single input and the output parameter.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    75
 * How can we create explicitly types functions when this is not the case?
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    76
 * It does not seem to be covered by the standard.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    77
 *
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    78
 * For this reason, we do not define the LEN_SINT, LEN_INT, LEN_STRING, LEN_[ANY_INT], LEN_[ANY_STRING] functions...
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    79
 */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    80
 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    81
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    82
/********************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    83
/*   EN/ENO PARAMS  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
    84
/********************/
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    85
#ifdef DISABLE_EN_ENO_PARAMETERS
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    86
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    87
  /* Do _not_ generate the EN and ENO parameters! */
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    88
  #define EN_ENO_PARAMS
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    89
  #define EN_ENO
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
    90
  #define EN_PFX _NO_EN
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    91
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    92
  #define TEST_EN(TYPENAME)
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    93
  #define TEST_EN_COND(TYPENAME, COND)
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    94
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    95
#else
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    96
    
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    97
  /* _Do_ generate the EN and ENO parameters! */
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    98
  #define EN_ENO_PARAMS BOOL EN, BOOL *ENO,
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
    99
  #define EN_ENO EN, ENO,
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   100
  #define EN_PFX _EN
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   101
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   102
  #define TEST_EN(TYPENAME)\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   103
    if (!EN) {\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   104
      if (ENO != NULL)\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   105
        *ENO = __BOOL_LITERAL(FALSE);\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   106
      return __INIT_##TYPENAME;\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   107
    }\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   108
    else if (ENO != NULL)\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   109
      *ENO = __BOOL_LITERAL(TRUE);
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   110
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   111
  #define TEST_EN_COND(TYPENAME, COND)\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   112
    if (!EN || (COND)) {\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   113
      if (ENO != NULL)\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   114
        *ENO = __BOOL_LITERAL(FALSE);\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   115
      return __INIT_##TYPENAME;\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   116
    }\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   117
    else if (ENO != NULL)\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   118
      *ENO = __BOOL_LITERAL(TRUE);
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   119
    
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   120
#endif
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   121
  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   122
  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   123
/*****************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   124
/*****************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   125
/*  2.5.1.5.1 Type Conversion Functions  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   126
/*****************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   127
/*****************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   128
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   129
#define __convert_type(from_TYPENAME,to_TYPENAME, oper) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   130
static inline to_TYPENAME from_TYPENAME##_TO_##to_TYPENAME(EN_ENO_PARAMS from_TYPENAME op){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   131
  TEST_EN(to_TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   132
  return (to_TYPENAME)oper(op);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   133
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   134
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   135
/******** [ANY_NUM | ANY_NBIT]_TO_BOOL   ************/
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   136
#define __convert_num_to_bool(TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   137
static inline BOOL TYPENAME##_TO_BOOL(EN_ENO_PARAMS TYPENAME op){\
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   138
  TEST_EN(BOOL)\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   139
  return op == 0 ? 0 : 1;\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   140
}
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   141
__ANY_NUM(__convert_num_to_bool)
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   142
__ANY_NBIT(__convert_num_to_bool)
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   143
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   144
/******** [TIME | ANY_DATE]_TO_BOOL   ************/
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   145
#define __convert_time_to_bool(TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   146
static inline BOOL TYPENAME##_TO_BOOL(EN_ENO_PARAMS TYPENAME op){\
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   147
  TEST_EN(BOOL)\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   148
  return op.tv_sec == 0 && op.tv_nsec == 0 ? 0 : 1;\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   149
}
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   150
__convert_time_to_bool(TIME)
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   151
__ANY_DATE(__convert_time_to_bool)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   152
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   153
#define __to_anynum_(from_TYPENAME)   __ANY_NUM_1(__iec_,from_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   154
#define __to_anyint_(from_TYPENAME)   __ANY_INT_1(__iec_,from_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   155
#define __to_anybit_(from_TYPENAME)   __ANY_BIT_1(__iec_,from_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   156
#define __to_anynbit_(from_TYPENAME) __ANY_NBIT_1(__iec_,from_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   157
#define __to_anysint_(from_TYPENAME) __ANY_SINT_1(__iec_,from_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   158
#define __to_anyuint_(from_TYPENAME) __ANY_UINT_1(__iec_,from_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   159
#define __to_anyreal_(from_TYPENAME) __ANY_REAL_1(__iec_,from_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   160
#define __to_anydate_(from_TYPENAME) __ANY_DATE_1(__iec_,from_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   161
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   162
/******** [ANY_BIT]_TO_[ANY_NUM | ANT_NBIT]   ************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   163
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __move_##to_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   164
__ANY_BIT(__to_anynum_)
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   165
__ANY_BIT(__to_anynbit_)
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   166
#undef __iec_
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   167
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   168
/******** [ANY_INT]_TO_[ANY_NUM | ANT_NBIT]   ************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   169
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __move_##to_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   170
__ANY_INT(__to_anynum_)
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   171
__ANY_INT(__to_anynbit_)
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   172
#undef __iec_
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   173
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   174
/******** [ANY_REAL]_TO_[ANY_NBIT]   ************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   175
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __real_to_bit)
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   176
__ANY_REAL(__to_anynbit_)
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   177
#undef __iec_
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   178
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   179
/******** [ANY_REAL]_TO_[ANY_NINT]   ************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   180
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __real_to_sint)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   181
__ANY_REAL(__to_anysint_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   182
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   183
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __real_to_uint)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   184
__ANY_REAL(__to_anyuint_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   185
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   186
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   187
/******** [ANY_REAL]_TO_[ANY_REAL]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   188
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __move_##to_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   189
__ANY_REAL(__to_anyreal_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   190
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   191
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   192
/******** [ANY_BIT | ANY_INT]_TO_[TIME | ANY_DATE]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   193
#define __iec_(from_TYPENAME) __convert_type(from_TYPENAME, TIME, __int_to_time)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   194
__ANY_BIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   195
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   196
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   197
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __int_to_time)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   198
__ANY_BIT(__to_anydate_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   199
__ANY_INT(__to_anydate_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   200
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   201
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   202
/******** [ANY_REAL]_TO_[TIME | ANY_DATE]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   203
#define __iec_(from_TYPENAME) __convert_type(from_TYPENAME, TIME, __real_to_time)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   204
__ANY_REAL(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   205
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   206
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __real_to_time)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   207
__ANY_REAL(__to_anydate_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   208
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   209
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   210
/******** [TIME | ANY_DATE]_TO_[ANY_BIT | ANY_INT]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   211
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __time_to_int)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   212
__to_anyint_(TIME)
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   213
__to_anynbit_(TIME)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   214
__ANY_DATE(__to_anyint_)
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   215
__ANY_DATE(__to_anynbit_)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   216
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   217
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   218
/******** [TIME | ANY_DATE]_TO_[ANY_REAL]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   219
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __time_to_real)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   220
__to_anyreal_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   221
__ANY_DATE(__to_anyreal_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   222
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   223
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   224
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   225
/******** [ANY_DATE]_TO_[ANY_DATE | TIME]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   226
/* Not supported: DT_TO_TIME */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   227
__convert_type(DT, DATE,  __date_and_time_to_date)
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   228
static inline DATE DATE_AND_TIME_TO_DATE(EN_ENO_PARAMS DT op){
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   229
	return DT_TO_DATE(EN_ENO op);
705
f2323f79252e Fix DATE conversions standard functions
Laurent Bessard
parents: 704
diff changeset
   230
}
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   231
__convert_type(DT, DT,    __move_DT)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   232
__convert_type(DT, TOD,   __date_and_time_to_time_of_day)
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   233
static inline DATE DATE_AND_TIME_TO_TIME_OF_DAY(EN_ENO_PARAMS DT op){
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   234
	return DT_TO_TOD(EN_ENO op);
705
f2323f79252e Fix DATE conversions standard functions
Laurent Bessard
parents: 704
diff changeset
   235
}
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   236
/* Not supported: DATE_TO_TIME */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   237
__convert_type(DATE, DATE, __move_DATE)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   238
/* Not supported: DATE_TO_DT */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   239
/* Not supported: DATE_TO_TOD */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   240
/* Not supported: TOD_TO_TIME */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   241
/* Not supported: TOD_TO_DATE */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   242
/* Not supported: TOD_TO_DT */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   243
__convert_type(TOD, TOD, __move_TOD)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   244
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   245
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   246
/******** TIME_TO_[ANY_DATE]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   247
/* Not supported: TIME_TO_DATE */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   248
/* Not supported: TIME_TO_DT */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   249
/* Not supported: TIME_TO_TOD */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   250
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   251
/******** TIME_TO_TIME   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   252
__convert_type(TIME, TIME, __move_TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   253
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   254
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   255
/******** [ANY_BIT]_TO_STRING   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   256
__convert_type(BOOL, STRING, __bool_to_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   257
#define __iec_(from_TYPENAME) __convert_type(from_TYPENAME, STRING, __bit_to_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   258
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   259
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   260
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   261
/******** [ANY_INT]_TO_STRING   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   262
#define __iec_(from_TYPENAME) __convert_type(from_TYPENAME, STRING, __sint_to_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   263
__ANY_SINT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   264
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   265
#define __iec_(from_TYPENAME) __convert_type(from_TYPENAME, STRING, __uint_to_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   266
__ANY_UINT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   267
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   268
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   269
/******** [ANY_REAL]_TO_STRING   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   270
#define __iec_(from_TYPENAME) __convert_type(from_TYPENAME, STRING, __real_to_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   271
__ANY_REAL(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   272
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   273
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   274
/******** [ANY_DATE]_TO_STRING   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   275
__convert_type(DATE, STRING, __date_to_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   276
__convert_type(DT,   STRING, __dt_to_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   277
__convert_type(TOD,  STRING, __tod_to_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   278
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   279
/******** TIME_TO_STRING   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   280
__convert_type(TIME, STRING, __time_to_string)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   281
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   282
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   283
/******** STRING_TO_[ANY_BIT]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   284
__convert_type(STRING, BOOL, __string_to_bool)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   285
#define __iec_(to_TYPENAME) __convert_type(STRING, to_TYPENAME, __string_to_bit)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   286
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   287
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   288
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   289
/******** STRING_TO_[ANY_INT]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   290
#define __iec_(to_TYPENAME) __convert_type(STRING, to_TYPENAME, __string_to_sint)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   291
__ANY_SINT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   292
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   293
#define __iec_(to_TYPENAME) __convert_type(STRING, to_TYPENAME, __string_to_uint)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   294
__ANY_UINT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   295
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   296
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   297
/******** STRING_TO_[ANY_REAL]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   298
#define __iec_(to_TYPENAME) __convert_type(STRING, to_TYPENAME, __string_to_real)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   299
__ANY_REAL(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   300
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   301
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   302
/******** STRING_TO_[ANY_DATE]   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   303
#define __iec_(to_TYPENAME) __convert_type(STRING, to_TYPENAME, __string_to_time)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   304
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   305
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   306
                                   
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   307
/******** STRING_TO_TIME   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   308
__convert_type(STRING, TIME, __string_to_time)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   309
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   310
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   311
/********   TRUNC   ************/ 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   312
#define __iec_(to_TYPENAME,from_TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   313
static inline to_TYPENAME TRUNC__##to_TYPENAME##__##from_TYPENAME(EN_ENO_PARAMS from_TYPENAME op){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   314
  TEST_EN(to_TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   315
  return (to_TYPENAME)__move_##to_TYPENAME(op);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   316
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   317
__ANY_REAL(__to_anyint_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   318
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   319
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   320
704
1adc8df05d2b Fix definition of BCD to ANY_UINT and ANY_UINT to BCD conversion standard functions
Laurent Bessard
parents: 639
diff changeset
   321
/********   _TO_BCD   ************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   322
#define __iec_(to_TYPENAME,from_TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   323
static inline to_TYPENAME from_TYPENAME##_TO_BCD_##to_TYPENAME(EN_ENO_PARAMS from_TYPENAME op){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   324
  TEST_EN(to_TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   325
  return (to_TYPENAME)__uint_to_bcd(op);\
704
1adc8df05d2b Fix definition of BCD to ANY_UINT and ANY_UINT to BCD conversion standard functions
Laurent Bessard
parents: 639
diff changeset
   326
}\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   327
static inline to_TYPENAME from_TYPENAME##_TO_BCD__##to_TYPENAME##__##from_TYPENAME(EN_ENO_PARAMS from_TYPENAME op){\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   328
  return from_TYPENAME##_TO_BCD_##to_TYPENAME(EN_ENO op);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   329
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   330
__ANY_UINT(__to_anynbit_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   331
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   332
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   333
704
1adc8df05d2b Fix definition of BCD to ANY_UINT and ANY_UINT to BCD conversion standard functions
Laurent Bessard
parents: 639
diff changeset
   334
/********   BCD_TO_   ************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   335
#define __iec_(to_TYPENAME,from_TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   336
static inline to_TYPENAME from_TYPENAME##_BCD_TO_##to_TYPENAME(EN_ENO_PARAMS from_TYPENAME op){\
715
134f110060db Added support for testing BCD value validity in BCD_TO_UINT function
Laurent Bessard
parents: 714
diff changeset
   337
  TEST_EN_COND(to_TYPENAME, __test_bcd(op))\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   338
  return (to_TYPENAME)__bcd_to_uint(op);\
704
1adc8df05d2b Fix definition of BCD to ANY_UINT and ANY_UINT to BCD conversion standard functions
Laurent Bessard
parents: 639
diff changeset
   339
}\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   340
static inline to_TYPENAME BCD_TO_##to_TYPENAME##__##to_TYPENAME##__##from_TYPENAME(EN_ENO_PARAMS from_TYPENAME op){\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   341
  return from_TYPENAME##_BCD_TO_##to_TYPENAME(EN_ENO op);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   342
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   343
__ANY_NBIT(__to_anyuint_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   344
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   345
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   346
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   347
/***********************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   348
/***********************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   349
/*  2.5.1.5.2 Numerical Functions  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   350
/***********************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   351
/***********************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   352
271
4f281513277f Fixes to make handling of standard functions in Semantic analyser compatible with code generation of standard functions
Edouard Tisserant
parents: 254
diff changeset
   353
/* workaround for va-args limitation on shorter than int params */
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   354
#define VA_ARGS_REAL LREAL
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   355
#define VA_ARGS_LREAL LREAL
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   356
#define VA_ARGS_SINT DINT
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   357
#define VA_ARGS_INT DINT
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   358
#define VA_ARGS_DINT DINT
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   359
#define VA_ARGS_LINT LINT
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   360
#define VA_ARGS_USINT UDINT
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   361
#define VA_ARGS_UINT UDINT
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   362
#define VA_ARGS_UDINT UDINT
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   363
#define VA_ARGS_ULINT ULINT
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   364
#define VA_ARGS_TIME TIME
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   365
#define VA_ARGS_BOOL DWORD
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   366
#define VA_ARGS_BYTE DWORD
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   367
#define VA_ARGS_WORD DWORD
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   368
#define VA_ARGS_DWORD DWORD
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   369
#define VA_ARGS_LWORD LWORD
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   370
#define VA_ARGS_STRING STRING
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   371
#define VA_ARGS_WSTRING WSTRING
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   372
#define VA_ARGS_DATE DATE
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   373
#define VA_ARGS_TOD TOD
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   374
#define VA_ARGS_DT DT
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
   375
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   376
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   377
#define __numeric(fname,TYPENAME, FUNC) \
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   378
/* explicitly typed function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   379
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS TYPENAME op){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   380
  TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   381
  return FUNC(op);\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   382
}\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   383
/* overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   384
static inline TYPENAME fname##_##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME op) {\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   385
  return fname##TYPENAME(EN_ENO op);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   386
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   387
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   388
/******************************************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   389
/***   Table 23 - Standard functions of one numeric variable    ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   390
/******************************************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   391
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   392
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   393
  /*    ABS     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   394
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   395
#define __abs_signed(TYPENAME) \
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   396
/* explicitly typed function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   397
static inline TYPENAME ABS_##TYPENAME(EN_ENO_PARAMS TYPENAME op){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   398
  TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   399
  if (op < 0)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   400
    return -op;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   401
  return op;\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   402
}\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   403
/* overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   404
static inline TYPENAME ABS__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME op) {\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   405
  return ABS_##TYPENAME(EN_ENO op);\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   406
}
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   407
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   408
#define __abs_unsigned(TYPENAME) \
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   409
/* explicitly typed function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   410
static inline TYPENAME ABS_##TYPENAME(EN_ENO_PARAMS TYPENAME op){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   411
  TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   412
  return op;\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   413
}\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   414
/* overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   415
static inline TYPENAME ABS__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME op) {\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   416
  return ABS_##TYPENAME(EN_ENO op);\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   417
}
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   418
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   419
__ANY_REAL(__abs_signed)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   420
__ANY_SINT(__abs_signed)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   421
__ANY_UINT(__abs_unsigned)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   422
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   423
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   424
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   425
  /*    SQRT    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   426
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   427
#define __sqrt(TYPENAME) __numeric(SQRT_, TYPENAME, sqrt)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   428
__ANY_REAL(__sqrt)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   429
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   430
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   431
/**************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   432
  /*     LN     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   433
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   434
#define __ln(TYPENAME) __numeric(LN_, TYPENAME, log)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   435
__ANY_REAL(__ln)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   436
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   437
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   438
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   439
  /*     LOG    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   440
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   441
#define __log(TYPENAME) __numeric(LOG_, TYPENAME, log10)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   442
__ANY_REAL(__log)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   443
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   444
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   445
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   446
  /*     EXP    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   447
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   448
#define __exp(TYPENAME) __numeric(EXP_, TYPENAME, exp)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   449
__ANY_REAL(__exp)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   450
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   451
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   452
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   453
  /*     SIN    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   454
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   455
#define __sin(TYPENAME) __numeric(SIN_, TYPENAME, sin)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   456
__ANY_REAL(__sin)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   457
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   458
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   459
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   460
  /*     COS    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   461
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   462
#define __cos(TYPENAME) __numeric(COS_, TYPENAME, cos)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   463
__ANY_REAL(__cos)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   464
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   465
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   466
  /*     TAN    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   467
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   468
#define __tan(TYPENAME) __numeric(TAN_, TYPENAME, tan)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   469
__ANY_REAL(__tan)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   470
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   471
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   472
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   473
  /*    ASIN    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   474
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   475
#define __asin(TYPENAME) __numeric(ASIN_, TYPENAME, asin)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   476
__ANY_REAL(__asin)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   477
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   478
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   479
  /*    ACOS    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   480
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   481
#define __acos(TYPENAME) __numeric(ACOS_, TYPENAME, acos)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   482
__ANY_REAL(__acos)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   483
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   484
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   485
  /*    ATAN    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   486
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   487
#define __atan(TYPENAME) __numeric(ATAN_, TYPENAME, atan)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   488
__ANY_REAL(__atan)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   489
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   490
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   491
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   492
/*****************************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   493
/***   Table 24 - Standard arithmetic functions    ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   494
/*****************************************************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   495
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   496
#define __arith_expand(fname, TYPENAME, OP)				\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   497
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   498
	static inline TYPENAME fname##1(EN_ENO_PARAMS			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   499
					TYPENAME op1) {			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   500
		TEST_EN(TYPENAME);					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   501
		return op1;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   502
	}								\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   503
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   504
	static inline TYPENAME fname##2(EN_ENO_PARAMS			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   505
					TYPENAME op1,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   506
					TYPENAME op2) {			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   507
		TEST_EN(TYPENAME);					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   508
		op1 = op1 OP op2;					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   509
		return op1;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   510
	}								\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   511
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   512
	static inline TYPENAME fname##3(EN_ENO_PARAMS			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   513
					TYPENAME op1,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   514
					TYPENAME op2,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   515
					TYPENAME op3){			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   516
		TEST_EN(TYPENAME);					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   517
		op1 = op1 OP op2 OP op3;				\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   518
		return op1;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   519
	}								\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   520
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   521
	static inline TYPENAME fname##4(EN_ENO_PARAMS			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   522
					TYPENAME op1,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   523
					TYPENAME op2,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   524
					TYPENAME op3,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   525
					TYPENAME op4){			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   526
		TEST_EN(TYPENAME);					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   527
		op1 = op1 OP op2 OP op3 OP op4;				\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   528
		return op1;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   529
	}								\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   530
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   531
	static inline TYPENAME fname##5(EN_ENO_PARAMS			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   532
					TYPENAME op1,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   533
					TYPENAME op2,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   534
					TYPENAME op3,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   535
					TYPENAME op4,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   536
					TYPENAME op5){			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   537
		TEST_EN(TYPENAME);					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   538
		op1 = op1 OP op2 OP op3 OP op4 OP op5;			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   539
		return op1;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   540
	}								\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   541
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   542
	static inline TYPENAME fname##6(EN_ENO_PARAMS			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   543
					TYPENAME op1,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   544
					TYPENAME op2,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   545
					TYPENAME op3,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   546
					TYPENAME op4,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   547
					TYPENAME op5,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   548
					TYPENAME op6){			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   549
		TEST_EN(TYPENAME);					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   550
		op1 = op1 OP op2 OP op3 OP op4 OP op5 OP op6;		\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   551
		return op1;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   552
	}								\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   553
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   554
	static inline TYPENAME fname##7(EN_ENO_PARAMS			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   555
					TYPENAME op1,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   556
					TYPENAME op2,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   557
					TYPENAME op3,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   558
					TYPENAME op4,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   559
					TYPENAME op5,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   560
					TYPENAME op6,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   561
					TYPENAME op7){			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   562
		TEST_EN(TYPENAME);					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   563
		op1 = op1 OP op2 OP op3 OP op4 OP op5 OP op6 OP op7;	\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   564
		return op1;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   565
	}								\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   566
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   567
	static inline TYPENAME fname##8(EN_ENO_PARAMS			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   568
					TYPENAME op1,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   569
					TYPENAME op2,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   570
					TYPENAME op3,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   571
					TYPENAME op4,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   572
					TYPENAME op5,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   573
					TYPENAME op6,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   574
					TYPENAME op7,			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   575
					TYPENAME op8){			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   576
		TEST_EN(TYPENAME);					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   577
		op1 =   op1 OP op2 OP op3 OP op4 OP			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   578
			op5 OP op6 OP op7 OP op8;			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   579
		return op1;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   580
	}								\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   581
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   582
	static inline TYPENAME fname##_VAR(EN_ENO_PARAMS		\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   583
					UINT param_count,		\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   584
					TYPENAME op1, ...){		\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   585
		va_list ap;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   586
		UINT i;							\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   587
		TEST_EN(TYPENAME)					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   588
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   589
			va_start (ap, op1);         /* Initialize the argument list.  */ \
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   590
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   591
		for (i = 0; i < param_count - 1; i++){			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   592
			op1 = op1 OP va_arg (ap, VA_ARGS_##TYPENAME);	\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   593
		}							\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   594
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   595
		va_end (ap);                  /* Clean up.  */		\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   596
		return op1;						\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   597
	}								\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   598
									\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   599
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   600
/* macros needed for #if-like behaviour inside of macro */
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   601
#define ARITH_OPERATION_COND_IGNORE(...)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   602
#define ARITH_OPERATION_COND_IDENT(...) __VA_ARGS__
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   603
#define ARITH_OPERATION_COND_SKIP_
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   604
#define ARITH_OPERATION_COND_CLAUSE1(...) __VA_ARGS__ ARITH_OPERATION_COND_IGNORE
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   605
#define ARITH_OPERATION_COND_CLAUSE2(...) ARITH_OPERATION_COND_IDENT
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   606
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   607
#define ARITH_OPERATION_COND_(A,B,C,...) C
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   608
#define ARITH_OPERATION_COND(EXP)			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   609
	ARITH_OPERATION_COND_(				\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   610
		EXP,					\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   611
		ARITH_OPERATION_COND_CLAUSE1,		\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   612
		ARITH_OPERATION_COND_CLAUSE2, ~)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   613
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   614
#define ARITH_OPERATION_LE_(X, Y) ARITH_OPERATION_COND_ ## X ## _LE_ ## Y
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   615
#define ARITH_OPERATION_LE( X, Y) ARITH_OPERATION_LE_(X, Y)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   616
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   617
/*
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   618
 * Macro to remove typecast in argument number placed by code generator:
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   619
 * (UINT)3 -> 3
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   620
 */
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   621
#define CLEAR_TYPECAST(X)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   622
#define MAX_INLINE_PARAM_COUNT 8
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   623
#ifdef DISABLE_EN_ENO_PARAMETERS
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   624
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   625
#define ARITH_OPERATION_CALL__(FNAME, PARAM_COUNT, ...)			\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   626
	ARITH_OPERATION_COND(ARITH_OPERATION_LE(PARAM_COUNT, MAX_INLINE_PARAM_COUNT)) \
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   627
	(FNAME##_VAR(PARAM_COUNT, __VA_ARGS__))				\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   628
	(FNAME##PARAM_COUNT(      __VA_ARGS__))
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   629
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   630
#define ARITH_OPERATION_CALL_( FNAME, PARAM_COUNT, ...)    ARITH_OPERATION_CALL__(FNAME, PARAM_COUNT, __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   631
#define ARITH_OPERATION_CALL(  FNAME, PARAM_COUNT, ...)    ARITH_OPERATION_CALL_( FNAME, CLEAR_TYPECAST PARAM_COUNT, __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   632
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   633
#else
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   634
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   635
#define ARITH_OPERATION_CALL__(EN, ENO, FNAME, PARAM_COUNT, ...)	\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   636
	ARITH_OPERATION_COND(ARITH_OPERATION_LE(PARAM_COUNT, MAX_INLINE_PARAM_COUNT)) \
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   637
	(FNAME##_VAR(       (EN), (ENO), PARAM_COUNT, __VA_ARGS__))	\
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   638
	(FNAME##PARAM_COUNT((EN), (ENO), __VA_ARGS__))
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   639
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   640
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   641
#define ARITH_OPERATION_CALL_( EN, ENO, FNAME, PARAM_COUNT, ...)    ARITH_OPERATION_CALL__(EN, ENO, FNAME, PARAM_COUNT, __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   642
#define ARITH_OPERATION_CALL(  EN, ENO, FNAME, PARAM_COUNT, ...)    ARITH_OPERATION_CALL_(EN, ENO, FNAME, CLEAR_TYPECAST PARAM_COUNT, __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   643
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   644
#endif
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   645
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   646
#ifdef DISABLE_EN_ENO_PARAMETERS
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   647
#define ARITH_OPERATION__TYPE__TYPE_NO_EN(FNAME, PARAM_COUNT, ...)             ARITH_OPERATION_CALL(FNAME, PARAM_COUNT, __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   648
#else
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   649
#define ARITH_OPERATION__TYPE__TYPE_EN(FNAME, EN, ENO, PARAM_COUNT, ...)       ARITH_OPERATION_CALL(EN, ENO, FNAME, PARAM_COUNT, __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   650
#endif
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   651
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   652
#define ARITH_OPERATION__TYPE__TYPE_(PFX, ...)               ARITH_OPERATION__TYPE__TYPE##PFX(__VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   653
#define ARITH_OPERATION__TYPE__TYPE( PFX, ...)               ARITH_OPERATION__TYPE__TYPE_(PFX, __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   654
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   655
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
   656
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   657
#define __arith_static(fname,TYPENAME, OP)\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   658
/* explicitly typed function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   659
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS TYPENAME op1, TYPENAME op2){\
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
   660
  TEST_EN(TYPENAME)\
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
   661
  return op1 OP op2;\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   662
}\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   663
/* overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   664
static inline TYPENAME fname##_##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME op1, TYPENAME op2){\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   665
  return fname##TYPENAME(EN_ENO op1, op2);\
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
   666
}
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
   667
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   668
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   669
  /*     ADD    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   670
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   671
#define __add(TYPENAME) \
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   672
__arith_expand(ADD_##TYPENAME, TYPENAME, +) 			 /* explicitly typed function */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   673
__arith_expand(ADD__##TYPENAME##__##TYPENAME, TYPENAME, +)	 /* overloaded function */
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   674
__ANY_NUM(__add)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   675
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   676
#define ADD_SINT(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_SINT,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   677
#define ADD__SINT__SINT(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__SINT__SINT,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   678
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   679
#define ADD_INT(...)           ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_INT,             __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   680
#define ADD__INT__INT(...)     ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__INT__INT,       __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   681
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   682
#define ADD_DINT(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_DINT,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   683
#define ADD__DINT__DINT(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__DINT__DINT,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   684
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   685
#define ADD_LINT(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_LINT,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   686
#define ADD__LINT__LINT(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__LINT__LINT,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   687
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   688
#define ADD_USINT(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_USINT,           __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   689
#define ADD__USINT__USINT(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__USINT__USINT,   __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   690
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   691
#define ADD_UINT(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_UINT,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   692
#define ADD__UINT__UINT(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__UINT__UINT,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   693
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   694
#define ADD_UDINT(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_UDINT,           __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   695
#define ADD__UDINT__UDINT(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__UDINT__UDINT,   __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   696
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   697
#define ADD_ULINT(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_ULINT,           __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   698
#define ADD__ULINT__ULINT(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__ULINT__ULINT,   __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   699
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   700
#define ADD_REAL(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_REAL,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   701
#define ADD__REAL__REAL(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__REAL__REAL,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   702
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   703
#define ADD_LREAL(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD_LREAL,           __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   704
#define ADD__LREAL__LREAL(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, ADD__LREAL__LREAL,   __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   705
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   706
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   707
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   708
  /*     MUL    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   709
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   710
#define __mul(TYPENAME) \
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   711
__arith_expand(MUL_##TYPENAME, TYPENAME, *) 			 /* explicitly typed function */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   712
__arith_expand(MUL__##TYPENAME##__##TYPENAME, TYPENAME, *)	 /* overloaded function */
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   713
__ANY_NUM(__mul)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   714
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   715
#define MUL_SINT(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_SINT,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   716
#define MUL__SINT__SINT(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__SINT__SINT,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   717
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   718
#define MUL_INT(...)           ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_INT,             __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   719
#define MUL__INT__INT(...)     ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__INT__INT,       __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   720
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   721
#define MUL_DINT(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_DINT,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   722
#define MUL__DINT__DINT(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__DINT__DINT,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   723
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   724
#define MUL_LINT(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_LINT,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   725
#define MUL__LINT__LINT(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__LINT__LINT,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   726
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   727
#define MUL_USINT(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_USINT,           __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   728
#define MUL__USINT__USINT(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__USINT__USINT,   __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   729
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   730
#define MUL_UINT(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_UINT,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   731
#define MUL__UINT__UINT(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__UINT__UINT,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   732
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   733
#define MUL_UDINT(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_UDINT,           __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   734
#define MUL__UDINT__UDINT(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__UDINT__UDINT,   __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   735
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   736
#define MUL_ULINT(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_ULINT,           __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   737
#define MUL__ULINT__ULINT(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__ULINT__ULINT,   __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   738
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   739
#define MUL_REAL(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_REAL,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   740
#define MUL__REAL__REAL(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__REAL__REAL,     __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   741
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   742
#define MUL_LREAL(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL_LREAL,           __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   743
#define MUL__LREAL__LREAL(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, MUL__LREAL__LREAL,   __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   744
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   745
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   746
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   747
  /*     SUB    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   748
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   749
#define __sub(TYPENAME) __arith_static(SUB_, TYPENAME, -)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   750
__ANY_NUM(__sub)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   751
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   752
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   753
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   754
  /*     DIV    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   755
  /**************/
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   756
#define __div(TYPENAME)\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   757
/* The explicitly typed standard functions */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   758
static inline TYPENAME DIV_##TYPENAME(EN_ENO_PARAMS TYPENAME op1, TYPENAME op2){\
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
   759
  TEST_EN_COND(TYPENAME, op2 == 0)\
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
   760
  return op1 / op2;\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   761
}\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   762
/* The overloaded standard functions */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   763
static inline TYPENAME DIV__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME op1, TYPENAME op2){\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   764
  return DIV_##TYPENAME(EN_ENO op1, op2);\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   765
}
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   766
__ANY_NUM(__div)
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   767
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   768
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   769
  /**************/
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   770
  /*     MOD    */
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   771
  /**************/
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   772
#define __mod(TYPENAME)\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   773
/* The explicitly typed standard functions */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   774
static inline TYPENAME MOD_##TYPENAME(EN_ENO_PARAMS TYPENAME op1, TYPENAME op2){\
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   775
  TEST_EN(TYPENAME)\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
   776
  if (op2 == 0) return 0;\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   777
  return op1 % op2;\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   778
}\
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   779
/* The overloaded standard functions */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   780
static inline TYPENAME MOD__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME op1, TYPENAME op2){\
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   781
  return MOD_##TYPENAME(EN_ENO op1, op2);\
393
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   782
}
f09a5ffe1edc Fixing SUB standard function defined in standard library
laurent
parents: 389
diff changeset
   783
__ANY_INT(__mod)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   784
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   785
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   786
  /*    EXPT    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   787
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   788
/* overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   789
#define __iec_(in1_TYPENAME,in2_TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   790
static inline in1_TYPENAME EXPT__##in1_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   791
  (EN_ENO_PARAMS in1_TYPENAME IN1, in2_TYPENAME IN2){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   792
  TEST_EN(in1_TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   793
  return __expt(IN1, IN2);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   794
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   795
#define __in1_anyreal_(in2_TYPENAME)   __ANY_REAL_1(__iec_,in2_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   796
__ANY_NUM(__in1_anyreal_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   797
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   798
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   799
  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   800
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   801
  /***************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   802
  /*     MOVE    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   803
  /***************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   804
/* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   805
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   806
static inline TYPENAME MOVE_##TYPENAME(EN_ENO_PARAMS TYPENAME op1){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   807
  TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   808
  return op1;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   809
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   810
__ANY(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   811
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   812
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   813
/* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   814
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   815
static inline TYPENAME MOVE__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME op1){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   816
  TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   817
  return op1;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   818
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   819
__ANY(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   820
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   821
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   822
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   823
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   824
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   825
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   826
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   827
/***********************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   828
/***********************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   829
/*  2.5.1.5.3 Bit String Functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   830
/***********************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   831
/***********************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   832
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   833
/****************************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   834
/***   Table 25 - Standard bit shift functions    ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   835
/****************************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   836
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   837
/* We do not delcare explcitly typed versions of the functions in table 25.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   838
 * See note above regarding explicitly typed functions for more details.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   839
 */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   840
#define __in1_anynbit_(in2_TYPENAME)   __ANY_NBIT_1(__iec_,in2_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   841
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   842
#define __shift_(fname, in1_TYPENAME, in2_TYPENAME, OP)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   843
static inline in1_TYPENAME fname(EN_ENO_PARAMS in1_TYPENAME IN, in2_TYPENAME N) {\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   844
  TEST_EN(in1_TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   845
  return IN OP N;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   846
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   847
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   848
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   849
  /*     SHL    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   850
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   851
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   852
/* Overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   853
static inline BOOL SHL__BOOL__##TYPENAME(EN_ENO_PARAMS BOOL IN, TYPENAME N) { \
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   854
  TEST_EN(BOOL);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   855
  return (N==0)? IN : __INIT_BOOL;  /* shifting by N>1 will always introduce a 0 */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   856
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   857
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   858
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   859
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   860
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   861
#define __iec_(in1_TYPENAME,in2_TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   862
__shift_(SHL__##in1_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME, in1_TYPENAME, in2_TYPENAME, << )/* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   863
__ANY_INT(__in1_anynbit_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   864
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   865
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   866
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   867
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   868
  /*     SHR    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   869
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   870
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   871
/* Overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   872
static inline BOOL SHR__BOOL__##TYPENAME(EN_ENO_PARAMS BOOL IN, TYPENAME N) { \
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   873
  TEST_EN(BOOL);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   874
  return (N==0)? IN : __INIT_BOOL;  /* shifting by N>1 will always introduce a 0 */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   875
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   876
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   877
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   878
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   879
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   880
#define __iec_(in1_TYPENAME,in2_TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   881
__shift_(SHR__##in1_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME, in1_TYPENAME, in2_TYPENAME, >> )/* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   882
__ANY_INT(__in1_anynbit_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   883
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   884
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   885
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   886
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   887
  /*     ROR    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   888
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   889
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   890
/* Overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   891
static inline BOOL ROR__BOOL__##TYPENAME(EN_ENO_PARAMS BOOL IN, TYPENAME N) { \
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   892
  TEST_EN(BOOL);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   893
  return IN; /* rotating a single bit by any value N will not change that bit! */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   894
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   895
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   896
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   897
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   898
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   899
#define __iec_(in1_TYPENAME,in2_TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   900
static inline in1_TYPENAME ROR__##in1_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME(EN_ENO_PARAMS in1_TYPENAME IN, in2_TYPENAME N){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   901
  TEST_EN(in1_TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   902
  N %= 8*sizeof(in1_TYPENAME);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   903
  return (IN >> N) | (IN << (8*sizeof(in1_TYPENAME)-N));\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   904
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   905
__ANY_INT(__in1_anynbit_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   906
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   907
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   908
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   909
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   910
  /*     ROL    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   911
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   912
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   913
/* Overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   914
static inline BOOL ROL__BOOL__##TYPENAME(EN_ENO_PARAMS BOOL IN, TYPENAME N) { \
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   915
  TEST_EN(BOOL);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   916
  return IN; /* rotating a single bit by any value N will not change that bit! */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   917
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   918
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   919
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   920
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   921
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   922
#define __iec_(in1_TYPENAME,in2_TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   923
static inline in1_TYPENAME ROL__##in1_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME(EN_ENO_PARAMS in1_TYPENAME IN, in2_TYPENAME N){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   924
  TEST_EN(in1_TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   925
  N %= 8*sizeof(in1_TYPENAME);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   926
  return (IN << N) | (IN >> (8*sizeof(in1_TYPENAME)-N));\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   927
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   928
__ANY_INT(__in1_anynbit_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   929
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   930
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   931
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   932
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   933
/*********************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   934
/***   Table 26    ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   935
/*********************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   936
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   937
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   938
  /*     AND    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   939
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   940
__arith_expand(AND_BOOL, BOOL, && )         /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   941
__arith_expand(AND__BOOL__BOOL, BOOL, && )  /* Overloaded function */
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   942
#define AND_BOOL(...)        ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND_BOOL,        __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   943
#define AND__BOOL__BOOL(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND__BOOL__BOOL, __VA_ARGS__)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   944
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   945
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   946
__arith_expand(AND_##TYPENAME, TYPENAME, &)  /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   947
__arith_expand(AND__##TYPENAME##__##TYPENAME, TYPENAME, &)  /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   948
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   949
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   950
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   951
#define AND_BYTE(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND_BYTE,             __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   952
#define AND__BYTE__BYTE(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND__BYTE__BYTE,      __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   953
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   954
#define AND_WORD(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND_WORD,             __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   955
#define AND__WORD__WORD(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND__WORD__WORD,      __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   956
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   957
#define AND_DWORD(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND_DWORD,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   958
#define AND__DWORD__DWORD(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND__DWORD__DWORD,    __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   959
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   960
#define AND_LWORD(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND_LWORD,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   961
#define AND__LWORD__LWORD(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, AND__LWORD__LWORD,    __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   962
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   963
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   964
  /*************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   965
  /*     OR    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   966
  /*************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   967
__arith_expand(OR_BOOL, BOOL, || )         /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   968
__arith_expand(OR__BOOL__BOOL, BOOL, || )  /* Overloaded function */
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   969
#define OR_BOOL(...)        ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR_BOOL,        __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   970
#define OR__BOOL__BOOL(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR__BOOL__BOOL, __VA_ARGS__)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   971
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   972
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   973
__arith_expand(OR_##TYPENAME, TYPENAME, |)  /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   974
__arith_expand(OR__##TYPENAME##__##TYPENAME, TYPENAME, |)  /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   975
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   976
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   977
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   978
#define OR_BYTE(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR_BYTE,             __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   979
#define OR__BYTE__BYTE(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR__BYTE__BYTE,      __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   980
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   981
#define OR_WORD(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR_WORD,             __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   982
#define OR__WORD__WORD(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR__WORD__WORD,      __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   983
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   984
#define OR_DWORD(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR_DWORD,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   985
#define OR__DWORD__DWORD(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR__DWORD__DWORD,    __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   986
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   987
#define OR_LWORD(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR_LWORD,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   988
#define OR__LWORD__LWORD(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, OR__LWORD__LWORD,    __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   989
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
   990
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   991
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   992
  /*     XOR    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   993
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   994
#define __xorbool_expand(fname) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
   995
static inline BOOL fname(EN_ENO_PARAMS UINT param_count, BOOL op1, ...){ \
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   996
  va_list ap; \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   997
  UINT i; \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   998
  TEST_EN(BOOL) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
   999
\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1000
  va_start (ap, op1);         /* Initialize the argument list.  */ \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1001
\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1002
  for (i = 0; i < param_count - 1; i++){ \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1003
    BOOL tmp = va_arg (ap, VA_ARGS_BOOL); \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1004
    op1 = (op1 && !tmp) || (!op1 && tmp); \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1005
  } \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1006
\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1007
  va_end (ap);                  /* Clean up.  */ \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1008
  return op1; \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1009
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1010
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1011
__xorbool_expand(XOR_BOOL) /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1012
__xorbool_expand(XOR__BOOL__BOOL) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1013
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1014
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1015
__arith_expand(XOR_##TYPENAME, TYPENAME, ^) /* The explicitly typed standard functions */\
1063
b5b48b6f7606 Fix bug: XOR operator was broken for ANY_BIT types. No XOR__[DL]WORD__[DL]WORD functions were generated.
Andrey Skvortsov
parents: 1011
diff changeset
  1016
__arith_expand(XOR__##TYPENAME##__##TYPENAME, TYPENAME, ^) /* Overloaded function */
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1017
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1018
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1019
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1020
#define XOR_BYTE(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, XOR_BYTE,             __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1021
#define XOR__BYTE__BYTE(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, XOR__BYTE__BYTE,      __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1022
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1023
#define XOR_WORD(...)          ARITH_OPERATION__TYPE__TYPE(EN_PFX, XOR_WORD,             __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1024
#define XOR__WORD__WORD(...)   ARITH_OPERATION__TYPE__TYPE(EN_PFX, XOR__WORD__WORD,      __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1025
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1026
#define XOR_DWORD(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, XOR_DWORD,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1027
#define XOR__DWORD__DWORD(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, XOR__DWORD__DWORD,    __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1028
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1029
#define XOR_LWORD(...)         ARITH_OPERATION__TYPE__TYPE(EN_PFX, XOR_LWORD,            __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1030
#define XOR__LWORD__LWORD(...) ARITH_OPERATION__TYPE__TYPE(EN_PFX, XOR__LWORD__LWORD,    __VA_ARGS__)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1031
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1032
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1033
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1034
  /*     NOT    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1035
  /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1036
/* The explicitly typed standard functions */
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1037
static inline BOOL NOT_BOOL(EN_ENO_PARAMS BOOL op1){
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1038
  TEST_EN(BOOL)
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1039
  return !op1;
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1040
}
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1041
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1042
/* Overloaded function */
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1043
static inline BOOL NOT__BOOL__BOOL(EN_ENO_PARAMS BOOL op1){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1044
  TEST_EN(BOOL)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1045
  return !op1;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1046
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1047
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1048
/* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1049
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1050
static inline TYPENAME NOT_##TYPENAME(EN_ENO_PARAMS TYPENAME op1){\
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1051
  TEST_EN(TYPENAME)\
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1052
  return ~op1;\
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1053
}
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1054
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1055
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1056
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1057
/* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1058
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1059
static inline TYPENAME NOT__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME op1){\
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1060
  TEST_EN(TYPENAME)\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1061
  return ~op1;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1062
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1063
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1064
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1065
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1066
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1067
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1068
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1069
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1070
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1071
/***************************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1072
/***************************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1073
/*  2.5.1.5.4  Selection and comparison Functions  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1074
/***************************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1075
/***************************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1076
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1077
/*********************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1078
/***   Table 27    ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1079
/*********************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1080
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1081
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1082
    /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1083
    /*    SEL     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1084
    /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1085
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1086
/* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1087
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1088
static inline TYPENAME SEL_##TYPENAME(EN_ENO_PARAMS BOOL G, TYPENAME op0, TYPENAME op1){\
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1089
  TEST_EN(TYPENAME)\
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1090
  return G ? op1 : op0;\
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1091
}
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1092
__ANY(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1093
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1094
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1095
/* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1096
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1097
static inline TYPENAME SEL__##TYPENAME##__BOOL__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS BOOL G, TYPENAME op0, TYPENAME op1){\
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1098
  TEST_EN(TYPENAME)\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1099
  return G ? op1 : op0;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1100
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1101
__ANY(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1102
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1103
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1104
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1105
    /**************/
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1106
    /*     MAX    */
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1107
    /**************/
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1108
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1109
#define __extrem_(fname,TYPENAME, COND) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1110
static inline TYPENAME fname(EN_ENO_PARAMS UINT param_count, TYPENAME op1, ...){\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1111
  va_list ap;\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1112
  UINT i;\
200
fde2d08ebaee Applying patch from Iztok for old gcc versions
laurent
parents: 199
diff changeset
  1113
  TEST_EN(TYPENAME)\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1114
  \
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1115
  va_start (ap, op1);         /* Initialize the argument list.  */\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1116
  \
165
83963465b773 Bug on standard function not defined with EN/ENO fixed
lbessard
parents: 163
diff changeset
  1117
  for (i = 0; i < param_count - 1; i++){\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1118
    TYPENAME tmp = va_arg (ap, VA_ARGS_##TYPENAME);\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1119
    op1 = COND ? tmp : op1;\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1120
  }\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1121
  \
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1122
  va_end (ap);                  /* Clean up.  */\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1123
  return op1;\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1124
}
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1125
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1126
/* Max for numerical data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1127
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1128
__extrem_(MAX_##TYPENAME,TYPENAME, op1 < tmp) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1129
__extrem_(MAX__##TYPENAME##__##TYPENAME,TYPENAME, op1 < tmp) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1130
__ANY_BIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1131
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1132
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1133
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1134
/* Max for time data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1135
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1136
__extrem_(MAX_##TYPENAME, TYPENAME, __time_cmp(op1, tmp) < 0) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1137
__extrem_(MAX__##TYPENAME##__##TYPENAME, TYPENAME, __time_cmp(op1, tmp) < 0) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1138
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1139
__iec_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1140
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1141
378
7f2e120c7352 moved declaration __STR_CMP to prevent warning
Edouard Tisserant
parents: 375
diff changeset
  1142
#define __STR_CMP(str1, str2) memcmp((char*)&str1.body,(char*)&str2.body, str1.len < str2.len ? str1.len : str2.len)
7f2e120c7352 moved declaration __STR_CMP to prevent warning
Edouard Tisserant
parents: 375
diff changeset
  1143
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1144
/* Max for string data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1145
__extrem_(MAX_STRING, STRING, __STR_CMP(op1,tmp) < 0) /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1146
__extrem_(MAX__STRING__STRING, STRING, __STR_CMP(op1,tmp) < 0) /* Overloaded function */
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1147
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1148
    /**************/
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1149
    /*     MIN    */
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1150
    /**************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1151
/* Min for numerical data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1152
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1153
__extrem_(MIN_##TYPENAME, TYPENAME, op1 > tmp) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1154
__extrem_(MIN__##TYPENAME##__##TYPENAME, TYPENAME, op1 > tmp) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1155
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1156
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1157
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1158
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1159
/* Min for time data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1160
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1161
__extrem_(MIN_##TYPENAME, TYPENAME, __time_cmp(op1, tmp) > 0) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1162
__extrem_(MIN__##TYPENAME##__##TYPENAME, TYPENAME, __time_cmp(op1, tmp) > 0) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1163
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1164
__iec_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1165
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1166
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1167
/* Min for string data types */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1168
__extrem_(MIN_STRING, STRING, __STR_CMP(op1,tmp) > 0) /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1169
__extrem_(MIN__STRING__STRING, STRING, __STR_CMP(op1,tmp) > 0) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1170
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1171
    /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1172
    /*   LIMIT    */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1173
    /**************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1174
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1175
/* Limit for numerical data types */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1176
#define __iec_(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1177
/* The explicitly typed standard functions */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1178
static inline TYPENAME LIMIT_##TYPENAME(EN_ENO_PARAMS TYPENAME MN, TYPENAME IN, TYPENAME MX){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1179
  TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1180
  return IN > MN ? IN < MX ? IN : MX : MN;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1181
}\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1182
/* Overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1183
static inline TYPENAME LIMIT__##TYPENAME##__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME MN, TYPENAME IN, TYPENAME MX){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1184
  TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1185
  return IN > MN ? IN < MX ? IN : MX : MN;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1186
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1187
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1188
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1189
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1190
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1191
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1192
/* Limit for time data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1193
#define __iec_(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1194
/* The explicitly typed standard functions */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1195
static inline TYPENAME LIMIT_##TYPENAME(EN_ENO_PARAMS TYPENAME MN, TYPENAME IN, TYPENAME MX){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1196
    TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1197
    return __time_cmp(IN, MN) > 0 ? /* IN>MN ?*/\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1198
           __time_cmp(IN, MX) < 0 ? /* IN<MX ?*/\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1199
           IN : MX : MN;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1200
}\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1201
/* Overloaded function */\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1202
static inline TYPENAME LIMIT__##TYPENAME##__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS TYPENAME MN, TYPENAME IN, TYPENAME MX){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1203
    TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1204
    return __time_cmp(IN, MN) > 0 ? /* IN>MN ?*/\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1205
           __time_cmp(IN, MX) < 0 ? /* IN<MX ?*/\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1206
           IN : MX : MN;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1207
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1208
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1209
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1210
__iec_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1211
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1212
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1213
/* Limit for string data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1214
/* The explicitly typed standard functions */
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1215
static inline STRING LIMIT_STRING(EN_ENO_PARAMS STRING MN, STRING IN, STRING MX){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1216
    TEST_EN(STRING)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1217
    return __STR_CMP(IN, MN) > 0 ? __STR_CMP(IN, MX) < 0 ? IN : MX : MN;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1218
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1219
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1220
/* Overloaded function */
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1221
static inline STRING LIMIT__STRING__STRING__STRING__STRING(EN_ENO_PARAMS STRING MN, STRING IN, STRING MX){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1222
    TEST_EN(STRING)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1223
    return __STR_CMP(IN, MN) > 0 ? __STR_CMP(IN, MX) < 0 ? IN : MX : MN;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1224
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1225
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1226
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1227
    /**************/
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1228
    /*     MUX    */
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1229
    /**************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1230
/* The standard states that the inputs for SEL and MUX must be named starting off from 0,
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1231
 * unlike remaining functions, that start off at 1.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1232
 */    
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1233
/* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1234
#define __in1_anyint_(in2_TYPENAME)   __ANY_INT_1(__iec_,in2_TYPENAME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1235
#define __iec_(in1_TYPENAME,in2_TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1236
static inline in2_TYPENAME MUX__##in2_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME(EN_ENO_PARAMS in1_TYPENAME K, UINT param_count, ...){\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1237
  va_list ap;\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1238
  UINT i;\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1239
  in2_TYPENAME tmp;\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1240
  TEST_EN_COND(in2_TYPENAME, K >= param_count)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1241
  tmp = __INIT_##in2_TYPENAME;\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1242
  \
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1243
  va_start (ap, param_count);         /* Initialize the argument list.  */\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1244
  \
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1245
  for (i = 0; i < param_count; i++){\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1246
    if(K == i){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1247
        tmp = va_arg (ap, VA_ARGS_##in2_TYPENAME);\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1248
        va_end (ap);                  /* Clean up.  */\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1249
        return tmp;\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1250
    }else{\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1251
        va_arg (ap, VA_ARGS_##in2_TYPENAME);\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1252
    }\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1253
  }\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1254
  \
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1255
  va_end (ap);                  /* Clean up.  */\
41
8998c8b24b60 First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents: 40
diff changeset
  1256
  return tmp;\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1257
}
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1258
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1259
__ANY(__in1_anyint_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1260
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1261
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1262
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1263
/******************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1264
/***             Table 28               ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1265
/***   Standard comparison functions    ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1266
/******************************************/
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1267
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1268
#define __compare_(fname,TYPENAME, COND) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1269
static inline BOOL fname(EN_ENO_PARAMS UINT param_count, TYPENAME op1, ...){\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1270
  va_list ap;\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1271
  UINT i;\
200
fde2d08ebaee Applying patch from Iztok for old gcc versions
laurent
parents: 199
diff changeset
  1272
  TEST_EN(BOOL)\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1273
  \
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1274
  va_start (ap, op1);         /* Initialize the argument list.  */\
43
37dd4e2fd2ec Test IEC_LIB and fix bugs (EQ, GT et all)
etisserant
parents: 42
diff changeset
  1275
  DBG(#fname #TYPENAME "\n")\
37dd4e2fd2ec Test IEC_LIB and fix bugs (EQ, GT et all)
etisserant
parents: 42
diff changeset
  1276
  DBG_TYPE(TYPENAME, op1)\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1277
  \
43
37dd4e2fd2ec Test IEC_LIB and fix bugs (EQ, GT et all)
etisserant
parents: 42
diff changeset
  1278
  for (i = 0; i < param_count - 1; i++){\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1279
    TYPENAME tmp = va_arg (ap, VA_ARGS_##TYPENAME);\
43
37dd4e2fd2ec Test IEC_LIB and fix bugs (EQ, GT et all)
etisserant
parents: 42
diff changeset
  1280
    DBG_TYPE(TYPENAME, tmp)\
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1281
    if(COND){\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1282
        op1 = tmp;\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1283
    }else{\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1284
        va_end (ap);                  /* Clean up.  */\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1285
        return 0;\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1286
    }\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1287
  }\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1288
  \
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1289
  va_end (ap);                  /* Clean up.  */\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1290
  return 1;\
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1291
}
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1292
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1293
#define __compare_num(fname, TYPENAME, TEST) __compare_(fname, TYPENAME, op1 TEST tmp )
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1294
#define __compare_time(fname, TYPENAME, TEST) __compare_(fname, TYPENAME, __time_cmp(op1, tmp) TEST 0)
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1295
#define __compare_string(fname, TEST) __compare_(fname, STRING, __STR_CMP(op1, tmp) TEST 0 )
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1296
149
05ca171a3d57 Adding support for EN/ENO in standard functions
lbessard
parents: 140
diff changeset
  1297
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1298
    /**************/
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1299
    /*     GT     */
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1300
    /**************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1301
/* Comparison for numerical data types */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1302
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1303
__compare_num(GT_##TYPENAME, TYPENAME, > ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1304
__compare_num(GT__BOOL__##TYPENAME, TYPENAME, > ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1305
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1306
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1307
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1308
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1309
/* Comparison for time data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1310
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1311
__compare_time(GT_##TYPENAME, TYPENAME, > ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1312
__compare_time(GT__BOOL__##TYPENAME, TYPENAME, > ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1313
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1314
__iec_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1315
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1316
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1317
/* Comparison for string data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1318
__compare_string(GT_STRING, > ) /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1319
__compare_string(GT__BOOL__STRING, > ) /* Overloaded function */
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1320
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1321
    /**************/
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1322
    /*     GE     */
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1323
    /**************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1324
/* Comparison for numerical data types */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1325
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1326
__compare_num(GE_##TYPENAME, TYPENAME, >= ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1327
__compare_num(GE__BOOL__##TYPENAME, TYPENAME, >= ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1328
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1329
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1330
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1331
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1332
/* Comparison for time data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1333
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1334
__compare_time(GE_##TYPENAME, TYPENAME, >= ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1335
__compare_time(GE__BOOL__##TYPENAME, TYPENAME, >= ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1336
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1337
__iec_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1338
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1339
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1340
/* Comparison for string data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1341
__compare_string(GE_STRING, >= ) /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1342
__compare_string(GE__BOOL__STRING, >= ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1343
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1344
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1345
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1346
    /**************/
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1347
    /*     EQ     */
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1348
    /**************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1349
/* Comparison for numerical data types */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1350
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1351
__compare_num(EQ_##TYPENAME, TYPENAME, == ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1352
__compare_num(EQ__BOOL__##TYPENAME, TYPENAME, == ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1353
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1354
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1355
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1356
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1357
/* Comparison for time data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1358
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1359
__compare_time(EQ_##TYPENAME, TYPENAME, == ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1360
__compare_time(EQ__BOOL__##TYPENAME, TYPENAME, == ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1361
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1362
__iec_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1363
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1364
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1365
/* Comparison for string data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1366
__compare_string(EQ_STRING, == ) /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1367
__compare_string(EQ__BOOL__STRING, == ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1368
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1369
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1370
    /**************/
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1371
    /*     LT     */
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1372
    /**************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1373
/* Comparison for numerical data types */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1374
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1375
__compare_num(LT_##TYPENAME, TYPENAME, < ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1376
__compare_num(LT__BOOL__##TYPENAME, TYPENAME, < ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1377
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1378
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1379
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1380
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1381
/* Comparison for time data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1382
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1383
__compare_time(LT_##TYPENAME, TYPENAME, < ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1384
__compare_time(LT__BOOL__##TYPENAME, TYPENAME, < ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1385
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1386
__iec_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1387
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1388
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1389
/* Comparison for string data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1390
__compare_string(LT_STRING, < ) /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1391
__compare_string(LT__BOOL__STRING, < ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1392
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1393
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1394
    /**************/
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1395
    /*     LE     */
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1396
    /**************/
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1397
/* Comparison for numerical data types */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1398
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1399
__compare_num(LE_##TYPENAME, TYPENAME, <= ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1400
__compare_num(LE__BOOL__##TYPENAME, TYPENAME, <= ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1401
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1402
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1403
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1404
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1405
/* Comparison for time data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1406
#define __iec_(TYPENAME) \
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1407
__compare_time(LE_##TYPENAME, TYPENAME, <= ) /* The explicitly typed standard functions */\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1408
__compare_time(LE__BOOL__##TYPENAME, TYPENAME, <= ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1409
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1410
__iec_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1411
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1412
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1413
/* Comparison for string data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1414
__compare_string(LE_STRING, <= ) /* The explicitly typed standard functions */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1415
__compare_string(LE__BOOL__STRING, <= ) /* Overloaded function */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1416
40
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1417
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1418
    /**************/
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1419
    /*     NE     */
873a5b60a7ea Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff changeset
  1420
    /**************/
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1421
#define __ne_num(fname, TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1422
static inline BOOL fname(EN_ENO_PARAMS TYPENAME op1, TYPENAME op2){\
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1423
  TEST_EN(BOOL)\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1424
  return op1 != op2 ? 1 : 0;\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1425
}
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1426
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1427
#define __ne_time(fname, TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1428
static inline BOOL fname(EN_ENO_PARAMS TYPENAME op1, TYPENAME op2){\
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1429
  TEST_EN(BOOL)\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1430
  return __time_cmp(op1, op2) != 0 ? 1 : 0;\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1431
}
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1432
638
049748e9410a Fix bug with NE function for STRING variables
Laurent Bessard
parents: 625
diff changeset
  1433
#define __ne_string(fname, TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1434
static inline BOOL fname(EN_ENO_PARAMS TYPENAME op1, TYPENAME op2){\
638
049748e9410a Fix bug with NE function for STRING variables
Laurent Bessard
parents: 625
diff changeset
  1435
  TEST_EN(BOOL)\
049748e9410a Fix bug with NE function for STRING variables
Laurent Bessard
parents: 625
diff changeset
  1436
  return __STR_CMP(op1, op2) != 0 ? 1 : 0;\
049748e9410a Fix bug with NE function for STRING variables
Laurent Bessard
parents: 625
diff changeset
  1437
}
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1438
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1439
/* Comparison for numerical data types */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1440
#define __iec_(TYPENAME) \
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1441
__ne_num(NE_##TYPENAME, TYPENAME) /* The explicitly typed standard functions */\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1442
__ne_num(NE__BOOL__##TYPENAME##__##TYPENAME, TYPENAME) /* Overloaded function */
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1443
__ANY_NBIT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1444
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1445
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1446
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1447
/* Comparison for time data types */	
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1448
#define __iec_(TYPENAME) \
398
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1449
__ne_time(NE_##TYPENAME, TYPENAME) /* The explicitly typed standard functions */\
f1f3facc59e7 Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents: 393
diff changeset
  1450
__ne_time(NE__BOOL__##TYPENAME##__##TYPENAME, TYPENAME) /* Overloaded function */
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1451
__ANY_DATE(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1452
__iec_(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1453
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1454
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1455
/* Comparison for string data types */	
638
049748e9410a Fix bug with NE function for STRING variables
Laurent Bessard
parents: 625
diff changeset
  1456
__ne_string(NE_STRING, STRING) /* The explicitly typed standard functions */
049748e9410a Fix bug with NE function for STRING variables
Laurent Bessard
parents: 625
diff changeset
  1457
__ne_string(NE__BOOL__STRING__STRING, STRING) /* Overloaded function */
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1458
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1459
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1460
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1461
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1462
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1463
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1464
/*********************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1465
/*********************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1466
/*  2.5.1.5.5   Character string  Functions  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1467
/*********************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1468
/*********************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1469
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1470
/*************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1471
/***           Table 29            ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1472
/***  Character string  Functions  ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1473
/*************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1474
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1475
/* We do not delcare explcitly typed versions of the functions in table 29.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1476
 * See note above regarding explicitly typed functions for more details.
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1477
 */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1478
 
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1479
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1480
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1481
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1482
    /***************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1483
    /*     LEN     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1484
    /***************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1485
static inline __strlen_t __len(STRING IN) {return IN.len;}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1486
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1487
/* A function, with 1 input paramter, implementing a generic OPERATION */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1488
#define __genoper_1p_(fname,ret_TYPENAME, par_TYPENAME, OPERATION) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1489
static inline ret_TYPENAME fname(EN_ENO_PARAMS par_TYPENAME par1){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1490
  TEST_EN(ret_TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1491
  return (ret_TYPENAME)OPERATION(par1);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1492
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1493
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1494
#define __iec_(TYPENAME) __genoper_1p_(LEN__##TYPENAME##__STRING, TYPENAME, STRING, __len)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1495
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1496
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1497
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1498
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1499
    /****************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1500
    /*     LEFT     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1501
    /****************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1502
384
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1503
#define __left(TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1504
static inline STRING LEFT__STRING__STRING__##TYPENAME(EN_ENO_PARAMS STRING IN, TYPENAME L){\
384
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1505
    STRING res;\
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1506
    TEST_EN_COND(STRING, L < 0)\
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1507
    res = __INIT_STRING;\
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1508
    L = L < (TYPENAME)IN.len ? L : (TYPENAME)IN.len;\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1509
    memcpy(&res.body, &IN.body, (size_t)L);\
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1510
    res.len = (__strlen_t)L;\
384
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1511
    return res;\
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1512
}
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1513
__ANY_INT(__left)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1514
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1515
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1516
    /*****************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1517
    /*     RIGHT     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1518
    /*****************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1519
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1520
#define __right(TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1521
static inline STRING RIGHT__STRING__STRING__##TYPENAME(EN_ENO_PARAMS STRING IN, TYPENAME L){\
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1522
  STRING res;\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1523
  TEST_EN_COND(STRING, L < 0)\
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1524
  res = __INIT_STRING;\
384
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1525
  L = L < (TYPENAME)IN.len ? L : (TYPENAME)IN.len;\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1526
  memcpy(&res.body, &IN.body[(TYPENAME)IN.len - L], (size_t)L);\
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1527
  res.len = (__strlen_t)L;\
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1528
  return res;\
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1529
}
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1530
__ANY_INT(__right)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1531
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1532
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1533
    /***************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1534
    /*     MID     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1535
    /***************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1536
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1537
#define __mid(TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1538
static inline STRING MID__STRING__STRING__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS STRING IN, TYPENAME L, TYPENAME P){\
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1539
  STRING res;\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1540
  TEST_EN_COND(STRING, L < 0 || P < 0)\
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1541
  res = __INIT_STRING;\
384
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1542
  if(P <= (TYPENAME)IN.len){\
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1543
	P -= 1; /* now can be used as [index]*/\
384
4626828277f9 fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents: 379
diff changeset
  1544
	L = L + P <= (TYPENAME)IN.len ? L : (TYPENAME)IN.len - P;\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1545
	memcpy(&res.body, &IN.body[P] , (size_t)L);\
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1546
	res.len = (__strlen_t)L;\
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1547
  }\
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1548
  return res;\
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1549
}
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1550
__ANY_INT(__mid)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1551
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1552
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1553
    /******************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1554
    /*     CONCAT     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1555
    /******************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1556
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1557
static inline STRING CONCAT(EN_ENO_PARAMS UINT param_count, ...){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1558
  UINT i;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1559
  STRING res;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1560
  va_list ap;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1561
  __strlen_t charcount;
379
7dc97c825bb8 Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents: 378
diff changeset
  1562
  TEST_EN(STRING)
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1563
  charcount = 0;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1564
  res = __INIT_STRING;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1565
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1566
  va_start (ap, param_count);         /* Initialize the argument list.  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1567
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1568
  for (i = 0; i < param_count && charcount < STR_MAX_LEN; i++)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1569
  {
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1570
    STRING tmp = va_arg(ap, STRING);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1571
    __strlen_t charrem = STR_MAX_LEN - charcount;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1572
    __strlen_t to_write = tmp.len > charrem ? charrem : tmp.len;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1573
    memcpy(&res.body[charcount], &tmp.body , to_write);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1574
    charcount += to_write;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1575
  }
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1576
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1577
  res.len = charcount;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1578
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1579
  va_end (ap);                  /* Clean up.  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1580
  return res;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1581
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1582
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1583
    /******************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1584
    /*     INSERT     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1585
    /******************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1586
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1587
static inline STRING __insert(STRING IN1, STRING IN2, __strlen_t P){
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1588
    STRING res;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1589
    __strlen_t to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1590
    res = __INIT_STRING;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1591
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1592
    to_copy = P > IN1.len ? IN1.len : P;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1593
    memcpy(&res.body, &IN1.body , to_copy);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1594
    P = res.len = to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1595
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1596
    to_copy = IN2.len + res.len > STR_MAX_LEN ? STR_MAX_LEN - res.len : IN2.len;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1597
    memcpy(&res.body[res.len], &IN2.body , to_copy);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1598
    res.len += to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1599
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1600
    to_copy = IN1.len - P < STR_MAX_LEN - res.len ? IN1.len - P : STR_MAX_LEN - res.len ;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1601
    memcpy(&res.body[res.len], &IN1.body[P] , to_copy);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1602
    res.len += to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1603
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1604
    return res;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1605
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1606
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1607
#define __iec_(TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1608
static inline STRING INSERT__STRING__STRING__STRING__##TYPENAME(EN_ENO_PARAMS STRING str1, STRING str2, TYPENAME P){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1609
  TEST_EN_COND(STRING, P < 0)\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1610
  return (STRING)__insert(str1,str2,(__strlen_t)P);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1611
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1612
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1613
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1614
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1615
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1616
    /******************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1617
    /*     DELETE     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1618
    /******************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1619
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1620
static inline STRING __delete(STRING IN, __strlen_t L, __strlen_t P){
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1621
    STRING res;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1622
    __strlen_t to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1623
    res = __INIT_STRING;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1624
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1625
    to_copy = P > IN.len ? IN.len : P-1;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1626
    memcpy(&res.body, &IN.body , to_copy);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1627
    P = res.len = to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1628
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1629
    if( IN.len > P + L ){
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1630
        to_copy = IN.len - P - L;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1631
        memcpy(&res.body[res.len], &IN.body[P + L], to_copy);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1632
        res.len += to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1633
    }
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1634
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1635
    return res;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1636
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1637
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1638
#define __iec_(TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1639
static inline STRING DELETE__STRING__STRING__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS STRING str, TYPENAME L, TYPENAME P){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1640
  TEST_EN_COND(STRING, L < 0 || P < 0)\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1641
  return (STRING)__delete(str,(__strlen_t)L,(__strlen_t)P);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1642
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1643
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1644
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1645
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1646
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1647
    /*******************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1648
    /*     REPLACE     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1649
    /*******************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1650
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1651
static inline STRING __replace(STRING IN1, STRING IN2, __strlen_t L, __strlen_t P){
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1652
    STRING res;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1653
    __strlen_t to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1654
    res = __INIT_STRING;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1655
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1656
    to_copy = P > IN1.len ? IN1.len : P-1;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1657
    memcpy(&res.body, &IN1.body , to_copy);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1658
    P = res.len = to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1659
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1660
    to_copy = IN2.len < L ? IN2.len : L;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1661
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1662
    if( to_copy + res.len > STR_MAX_LEN )
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1663
       to_copy = STR_MAX_LEN - res.len;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1664
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1665
    memcpy(&res.body[res.len], &IN2.body , to_copy);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1666
    res.len += to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1667
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1668
    P += L;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1669
    if( res.len <  STR_MAX_LEN && P < IN1.len)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1670
    {
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1671
        to_copy = IN1.len - P;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1672
        memcpy(&res.body[res.len], &IN1.body[P] , to_copy);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1673
        res.len += to_copy;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1674
    }
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1675
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1676
    return res;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1677
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1678
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1679
#define __iec_(TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1680
static inline STRING REPLACE__STRING__STRING__STRING__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS STRING str1, STRING str2, TYPENAME L, TYPENAME P){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1681
  TEST_EN_COND(STRING, L < 0 || P < 0)\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1682
  return (STRING)__replace(str1,str2,(__strlen_t)L,(__strlen_t)P);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1683
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1684
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1685
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1686
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1687
    /****************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1688
    /*     FIND     */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1689
    /****************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1690
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1691
static inline __strlen_t __pfind(STRING* IN1, STRING* IN2){
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1692
    UINT count1 = 0; /* offset of first matching char in IN1 */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1693
    UINT count2 = 0; /* count of matching char */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1694
    while(count1 + count2 < IN1->len && count2 < IN2->len)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1695
    {
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1696
        if(IN1->body[count1 + count2] != IN2->body[count2]){
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1697
            count1 += count2 + 1;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1698
            count2 = 0;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1699
        }
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1700
        else {
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1701
            count2++;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1702
        }
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1703
    }
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1704
    return count2 == IN2->len -1 ? 0 : count1 + 1;
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1705
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1706
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1707
#define __iec_(TYPENAME) \
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1708
static inline TYPENAME FIND__##TYPENAME##__STRING__STRING(EN_ENO_PARAMS STRING str1, STRING str2){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1709
  TEST_EN(TYPENAME)\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1710
  return (TYPENAME)__pfind(&str1,&str2);\
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1711
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1712
__ANY_INT(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1713
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1714
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1715
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1716
/*********************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1717
/*********************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1718
/*  2.5.1.5.6  Functions of time data types  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1719
/*********************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1720
/*********************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1721
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1722
/**************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1723
/***           Table 30             ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1724
/***  Functions of time data types  ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1725
/**************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1726
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1727
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1728
static inline TIME ADD_TIME(EN_ENO_PARAMS TIME IN1, TIME IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1729
  TEST_EN(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1730
  return __time_add(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1731
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1732
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1733
static inline TOD ADD_TOD_TIME(EN_ENO_PARAMS TOD IN1, TIME IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1734
  TEST_EN(TOD)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1735
  return __time_add(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1736
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1737
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1738
static inline DT ADD_DT_TIME(EN_ENO_PARAMS DT IN1, TIME IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1739
  TEST_EN(DT)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1740
  return __time_add(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1741
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1742
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1743
static inline TIME SUB_TIME(EN_ENO_PARAMS TIME IN1, TIME IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1744
  TEST_EN(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1745
  return __time_sub(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1746
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1747
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1748
static inline TIME SUB_DATE_DATE(EN_ENO_PARAMS DATE IN1, DATE IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1749
  TEST_EN(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1750
  return __time_sub(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1751
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1752
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1753
static inline TOD SUB_TOD_TIME(EN_ENO_PARAMS TOD IN1, TIME IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1754
  TEST_EN(TOD)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1755
  return __time_sub(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1756
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1757
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1758
static inline TIME SUB_TOD_TOD(EN_ENO_PARAMS TOD IN1, TOD IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1759
  TEST_EN(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1760
  return __time_sub(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1761
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1762
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1763
static inline DT SUB_DT_TIME(EN_ENO_PARAMS DT IN1, TIME IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1764
  TEST_EN(DT)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1765
  return __time_sub(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1766
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1767
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1768
static inline TIME SUB_DT_DT(EN_ENO_PARAMS DT IN1, DT IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1769
  TEST_EN(TIME)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1770
  return __time_sub(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1771
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1772
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1773
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1774
/***  MULTIME  ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1775
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1776
static inline TIME MULTIME__TIME__TIME__##TYPENAME(EN_ENO_PARAMS TIME IN1, TYPENAME IN2){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1777
  TEST_EN(TIME)\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1778
  return __time_mul(IN1, (LREAL)IN2);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1779
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1780
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1781
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1782
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1783
/***  MUL  ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1784
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1785
static inline TIME MUL__TIME__TIME__##TYPENAME(EN_ENO_PARAMS TIME IN1, TYPENAME IN2){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1786
  TEST_EN(TIME)\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1787
  return __time_mul(IN1, (LREAL)IN2);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1788
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1789
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1790
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1791
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1792
/***  DIVTIME  ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1793
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1794
static inline TIME DIVTIME__TIME__TIME__##TYPENAME(EN_ENO_PARAMS TIME IN1, TYPENAME IN2){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1795
  TEST_EN(TIME)\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1796
  return __time_div(IN1, (LREAL)IN2);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1797
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1798
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1799
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1800
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1801
/***  DIV  ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1802
#define __iec_(TYPENAME)\
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1803
static inline TIME DIV__TIME__TIME__##TYPENAME(EN_ENO_PARAMS TIME IN1, TYPENAME IN2){\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1804
  TEST_EN(TIME)\
696
7530eae6786d Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents: 625
diff changeset
  1805
  return __time_div(IN1, (LREAL)IN2);\
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1806
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1807
__ANY_NUM(__iec_)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1808
#undef __iec_
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1809
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1810
/*** CONCAT_DATE_TOD ***/
1011
76175defb87b Add option to not add the EN and ENO parameters to every function and FB (generated C code becomes smaller, and uses less memory for function invocations)
mjsousa
parents: 905
diff changeset
  1811
static inline DT CONCAT_DATE_TOD(EN_ENO_PARAMS DATE IN1, TOD IN2){
350
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1812
  TEST_EN(DT)
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1813
  return __time_add(IN1, IN2);
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1814
}
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1815
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1816
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1817
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1818
/****************************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1819
/****************************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1820
/*  2.5.1.5.6   Functions of enumerated data types  */
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1821
/****************************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1822
/****************************************************/  
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1823
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1824
/********************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1825
/***              Table 31                ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1826
/***  Functions of enumerated data types  ***/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1827
/********************************************/
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1828
2c3c4dc34979 Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents: 314
diff changeset
  1829
/* Do we support this? */
739
Mario de Sousa <msousa@fe.up.pt>
parents: 700
diff changeset
  1830
905
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 904
diff changeset
  1831
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 904
diff changeset
  1832
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 904
diff changeset
  1833
1067
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1834
/*************************************/
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1835
/*
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1836
  These defines are needed to have #if-like
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1837
  behaviour inside of macro. See macro
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1838
  ARITH_OPERATION_COND above.
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1839
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1840
  emacs commands to generate defines below.
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1841
  Select commands and eval-region
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1842
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1843
  (next-line)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1844
  (next-line)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1845
  (dotimes (i 200)
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1846
    (insert
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1847
     (format "\n#define ARITH_OPERATION_COND_%d_LE_8 %s" i (if (> i 8) "," "1"))))
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1848
*/
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1849
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1850
#define ARITH_OPERATION_COND_0_LE_8 1
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1851
#define ARITH_OPERATION_COND_1_LE_8 1
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1852
#define ARITH_OPERATION_COND_2_LE_8 1
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1853
#define ARITH_OPERATION_COND_3_LE_8 1
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1854
#define ARITH_OPERATION_COND_4_LE_8 1
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1855
#define ARITH_OPERATION_COND_5_LE_8 1
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1856
#define ARITH_OPERATION_COND_6_LE_8 1
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1857
#define ARITH_OPERATION_COND_7_LE_8 1
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1858
#define ARITH_OPERATION_COND_8_LE_8 1
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1859
#define ARITH_OPERATION_COND_9_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1860
#define ARITH_OPERATION_COND_10_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1861
#define ARITH_OPERATION_COND_11_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1862
#define ARITH_OPERATION_COND_12_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1863
#define ARITH_OPERATION_COND_13_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1864
#define ARITH_OPERATION_COND_14_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1865
#define ARITH_OPERATION_COND_15_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1866
#define ARITH_OPERATION_COND_16_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1867
#define ARITH_OPERATION_COND_17_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1868
#define ARITH_OPERATION_COND_18_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1869
#define ARITH_OPERATION_COND_19_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1870
#define ARITH_OPERATION_COND_20_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1871
#define ARITH_OPERATION_COND_21_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1872
#define ARITH_OPERATION_COND_22_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1873
#define ARITH_OPERATION_COND_23_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1874
#define ARITH_OPERATION_COND_24_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1875
#define ARITH_OPERATION_COND_25_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1876
#define ARITH_OPERATION_COND_26_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1877
#define ARITH_OPERATION_COND_27_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1878
#define ARITH_OPERATION_COND_28_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1879
#define ARITH_OPERATION_COND_29_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1880
#define ARITH_OPERATION_COND_30_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1881
#define ARITH_OPERATION_COND_31_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1882
#define ARITH_OPERATION_COND_32_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1883
#define ARITH_OPERATION_COND_33_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1884
#define ARITH_OPERATION_COND_34_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1885
#define ARITH_OPERATION_COND_35_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1886
#define ARITH_OPERATION_COND_36_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1887
#define ARITH_OPERATION_COND_37_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1888
#define ARITH_OPERATION_COND_38_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1889
#define ARITH_OPERATION_COND_39_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1890
#define ARITH_OPERATION_COND_40_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1891
#define ARITH_OPERATION_COND_41_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1892
#define ARITH_OPERATION_COND_42_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1893
#define ARITH_OPERATION_COND_43_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1894
#define ARITH_OPERATION_COND_44_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1895
#define ARITH_OPERATION_COND_45_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1896
#define ARITH_OPERATION_COND_46_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1897
#define ARITH_OPERATION_COND_47_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1898
#define ARITH_OPERATION_COND_48_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1899
#define ARITH_OPERATION_COND_49_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1900
#define ARITH_OPERATION_COND_50_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1901
#define ARITH_OPERATION_COND_51_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1902
#define ARITH_OPERATION_COND_52_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1903
#define ARITH_OPERATION_COND_53_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1904
#define ARITH_OPERATION_COND_54_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1905
#define ARITH_OPERATION_COND_55_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1906
#define ARITH_OPERATION_COND_56_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1907
#define ARITH_OPERATION_COND_57_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1908
#define ARITH_OPERATION_COND_58_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1909
#define ARITH_OPERATION_COND_59_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1910
#define ARITH_OPERATION_COND_60_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1911
#define ARITH_OPERATION_COND_61_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1912
#define ARITH_OPERATION_COND_62_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1913
#define ARITH_OPERATION_COND_63_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1914
#define ARITH_OPERATION_COND_64_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1915
#define ARITH_OPERATION_COND_65_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1916
#define ARITH_OPERATION_COND_66_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1917
#define ARITH_OPERATION_COND_67_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1918
#define ARITH_OPERATION_COND_68_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1919
#define ARITH_OPERATION_COND_69_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1920
#define ARITH_OPERATION_COND_70_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1921
#define ARITH_OPERATION_COND_71_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1922
#define ARITH_OPERATION_COND_72_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1923
#define ARITH_OPERATION_COND_73_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1924
#define ARITH_OPERATION_COND_74_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1925
#define ARITH_OPERATION_COND_75_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1926
#define ARITH_OPERATION_COND_76_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1927
#define ARITH_OPERATION_COND_77_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1928
#define ARITH_OPERATION_COND_78_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1929
#define ARITH_OPERATION_COND_79_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1930
#define ARITH_OPERATION_COND_80_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1931
#define ARITH_OPERATION_COND_81_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1932
#define ARITH_OPERATION_COND_82_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1933
#define ARITH_OPERATION_COND_83_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1934
#define ARITH_OPERATION_COND_84_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1935
#define ARITH_OPERATION_COND_85_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1936
#define ARITH_OPERATION_COND_86_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1937
#define ARITH_OPERATION_COND_87_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1938
#define ARITH_OPERATION_COND_88_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1939
#define ARITH_OPERATION_COND_89_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1940
#define ARITH_OPERATION_COND_90_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1941
#define ARITH_OPERATION_COND_91_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1942
#define ARITH_OPERATION_COND_92_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1943
#define ARITH_OPERATION_COND_93_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1944
#define ARITH_OPERATION_COND_94_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1945
#define ARITH_OPERATION_COND_95_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1946
#define ARITH_OPERATION_COND_96_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1947
#define ARITH_OPERATION_COND_97_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1948
#define ARITH_OPERATION_COND_98_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1949
#define ARITH_OPERATION_COND_99_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1950
#define ARITH_OPERATION_COND_100_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1951
#define ARITH_OPERATION_COND_101_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1952
#define ARITH_OPERATION_COND_102_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1953
#define ARITH_OPERATION_COND_103_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1954
#define ARITH_OPERATION_COND_104_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1955
#define ARITH_OPERATION_COND_105_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1956
#define ARITH_OPERATION_COND_106_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1957
#define ARITH_OPERATION_COND_107_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1958
#define ARITH_OPERATION_COND_108_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1959
#define ARITH_OPERATION_COND_109_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1960
#define ARITH_OPERATION_COND_110_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1961
#define ARITH_OPERATION_COND_111_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1962
#define ARITH_OPERATION_COND_112_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1963
#define ARITH_OPERATION_COND_113_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1964
#define ARITH_OPERATION_COND_114_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1965
#define ARITH_OPERATION_COND_115_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1966
#define ARITH_OPERATION_COND_116_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1967
#define ARITH_OPERATION_COND_117_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1968
#define ARITH_OPERATION_COND_118_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1969
#define ARITH_OPERATION_COND_119_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1970
#define ARITH_OPERATION_COND_120_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1971
#define ARITH_OPERATION_COND_121_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1972
#define ARITH_OPERATION_COND_122_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1973
#define ARITH_OPERATION_COND_123_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1974
#define ARITH_OPERATION_COND_124_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1975
#define ARITH_OPERATION_COND_125_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1976
#define ARITH_OPERATION_COND_126_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1977
#define ARITH_OPERATION_COND_127_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1978
#define ARITH_OPERATION_COND_128_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1979
#define ARITH_OPERATION_COND_129_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1980
#define ARITH_OPERATION_COND_130_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1981
#define ARITH_OPERATION_COND_131_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1982
#define ARITH_OPERATION_COND_132_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1983
#define ARITH_OPERATION_COND_133_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1984
#define ARITH_OPERATION_COND_134_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1985
#define ARITH_OPERATION_COND_135_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1986
#define ARITH_OPERATION_COND_136_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1987
#define ARITH_OPERATION_COND_137_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1988
#define ARITH_OPERATION_COND_138_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1989
#define ARITH_OPERATION_COND_139_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1990
#define ARITH_OPERATION_COND_140_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1991
#define ARITH_OPERATION_COND_141_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1992
#define ARITH_OPERATION_COND_142_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1993
#define ARITH_OPERATION_COND_143_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1994
#define ARITH_OPERATION_COND_144_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1995
#define ARITH_OPERATION_COND_145_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1996
#define ARITH_OPERATION_COND_146_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1997
#define ARITH_OPERATION_COND_147_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1998
#define ARITH_OPERATION_COND_148_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  1999
#define ARITH_OPERATION_COND_149_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2000
#define ARITH_OPERATION_COND_150_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2001
#define ARITH_OPERATION_COND_151_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2002
#define ARITH_OPERATION_COND_152_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2003
#define ARITH_OPERATION_COND_153_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2004
#define ARITH_OPERATION_COND_154_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2005
#define ARITH_OPERATION_COND_155_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2006
#define ARITH_OPERATION_COND_156_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2007
#define ARITH_OPERATION_COND_157_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2008
#define ARITH_OPERATION_COND_158_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2009
#define ARITH_OPERATION_COND_159_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2010
#define ARITH_OPERATION_COND_160_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2011
#define ARITH_OPERATION_COND_161_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2012
#define ARITH_OPERATION_COND_162_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2013
#define ARITH_OPERATION_COND_163_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2014
#define ARITH_OPERATION_COND_164_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2015
#define ARITH_OPERATION_COND_165_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2016
#define ARITH_OPERATION_COND_166_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2017
#define ARITH_OPERATION_COND_167_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2018
#define ARITH_OPERATION_COND_168_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2019
#define ARITH_OPERATION_COND_169_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2020
#define ARITH_OPERATION_COND_170_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2021
#define ARITH_OPERATION_COND_171_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2022
#define ARITH_OPERATION_COND_172_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2023
#define ARITH_OPERATION_COND_173_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2024
#define ARITH_OPERATION_COND_174_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2025
#define ARITH_OPERATION_COND_175_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2026
#define ARITH_OPERATION_COND_176_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2027
#define ARITH_OPERATION_COND_177_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2028
#define ARITH_OPERATION_COND_178_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2029
#define ARITH_OPERATION_COND_179_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2030
#define ARITH_OPERATION_COND_180_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2031
#define ARITH_OPERATION_COND_181_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2032
#define ARITH_OPERATION_COND_182_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2033
#define ARITH_OPERATION_COND_183_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2034
#define ARITH_OPERATION_COND_184_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2035
#define ARITH_OPERATION_COND_185_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2036
#define ARITH_OPERATION_COND_186_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2037
#define ARITH_OPERATION_COND_187_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2038
#define ARITH_OPERATION_COND_188_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2039
#define ARITH_OPERATION_COND_189_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2040
#define ARITH_OPERATION_COND_190_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2041
#define ARITH_OPERATION_COND_191_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2042
#define ARITH_OPERATION_COND_192_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2043
#define ARITH_OPERATION_COND_193_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2044
#define ARITH_OPERATION_COND_194_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2045
#define ARITH_OPERATION_COND_195_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2046
#define ARITH_OPERATION_COND_196_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2047
#define ARITH_OPERATION_COND_197_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2048
#define ARITH_OPERATION_COND_198_LE_8 ,
ce81fa6d9024 improve performance of some extensible Standard Functions (ADD, MUL, AND, OR, XOR)"
Mario de Sousa <msousa@fe.up.pt>
parents: 1063
diff changeset
  2049
#define ARITH_OPERATION_COND_199_LE_8 ,
905
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 904
diff changeset
  2050
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 904
diff changeset
  2051
31224f8cac32 Move standard FBs to a pre-converted C file, insted of converting them every time along with the IEC source.
mjsousa
parents: 904
diff changeset
  2052
#endif /* _IEC_STD_FUNCTIONS_H */