author | Manuele Conti <manuele.conti@sirius-es.it> |
Thu, 15 Nov 2012 17:30:35 +0100 | |
changeset 745 | 26cb3fa00d29 |
parent 700 | b0ef6711f2a8 |
child 739 | 438cb1078886 |
permissions | -rwxr-xr-x |
107 | 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 | 4 |
* |
5 |
* Offered to the public under the terms of the GNU Lesser General Public |
|
6 |
* License as published by the Free Software Foundation; either version 2 |
|
7 |
* of the License, or (at your option) any later version. |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, but |
|
10 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
|
12 |
* General Public License for more details. |
|
13 |
* |
|
14 |
* This code is made available on the understanding that it will not be |
|
15 |
* used in safety-critical situations without a full and competent review. |
|
16 |
*/ |
|
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 | 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 |
|
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
|
29 |
#include <limits.h> |
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
|
30 |
#include <float.h> |
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
|
31 |
#include <math.h> |
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
|
32 |
#include <time.h> |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
33 |
#include <stdint.h> |
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
|
34 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
35 |
#include <stdio.h> |
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
|
36 |
#include <stdlib.h> |
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
|
37 |
#include <string.h> |
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
|
38 |
#include <stdarg.h> |
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
|
39 |
|
43 | 40 |
#ifdef DEBUG_IEC |
41 |
#define DBG(...) printf(__VA_ARGS__); |
|
42 |
#define DBG_TYPE(TYPENAME, name) __print_##TYPENAME(name); |
|
43 |
#else |
|
44 |
#define DBG(...) |
|
45 |
#define DBG_TYPE(TYPENAME, name) |
|
46 |
#endif |
|
47 |
||
137
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
48 |
/* |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
49 |
* Include type defs. |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
50 |
*/ |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
51 |
#include "iec_types_all.h" |
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
|
52 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
53 |
extern TIME __CURRENT_TIME; |
140
8c0366d41e84
Added __DEBUG global var to eventually change PLC code execution
etisserant
parents:
137
diff
changeset
|
54 |
extern BOOL __DEBUG; |
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
|
55 |
|
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
|
56 |
/* TODO |
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
|
57 |
typedef struct { |
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
|
58 |
__strlen_t len; |
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
|
59 |
u_int16_t body[STR_MAX_LEN]; |
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
|
60 |
} 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
|
61 |
*/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
62 |
/* |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
63 |
# if __WORDSIZE == 64 |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
64 |
#define __32b_sufix |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
65 |
#define __64b_sufix L |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
66 |
#else |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
67 |
#define __32b_sufix L |
180 | 68 |
#define __64b_sufix LL |
69 |
#endif |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
70 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
71 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
72 |
# if __WORDSIZE == 64 |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
73 |
#define __32b_sufix |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
74 |
#define __64b_sufix L |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
75 |
#else |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
76 |
#define __32b_sufix L |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
77 |
/* changed this from LL to L temporarily. It was causing a bug when compiling resulting code with gcc. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
78 |
* I have other things to worry about at the moment.. |
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 |
#define __64b_sufix L |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
81 |
#endif |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
82 |
|
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
83 |
|
582
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
84 |
#define __lit(type,value,...) (type)value##__VA_ARGS__ |
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
85 |
// Keep this macro expention step to let sfx(__VA_ARGS__) change into L or LL |
593
412780374bd3
Fix literal MACRO gcc compliant.
Manuele Conti <conti.ma@alice.it>
parents:
582
diff
changeset
|
86 |
#define __literal(type,value,...) __lit(type,value,##__VA_ARGS__) |
582
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
87 |
|
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
88 |
#define __BOOL_LITERAL(value) __literal(BOOL,value) |
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
89 |
#define __SINT_LITERAL(value) __literal(SINT,value) |
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
90 |
#define __INT_LITERAL(value) __literal(INT,value) |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
91 |
#define __DINT_LITERAL(value) __literal(DINT,value,__32b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
92 |
#define __LINT_LITERAL(value) __literal(LINT,value,__64b_sufix) |
582
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
93 |
#define __USINT_LITERAL(value) __literal(USINT,value) |
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
94 |
#define __UINT_LITERAL(value) __literal(UINT,value) |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
95 |
#define __UDINT_LITERAL(value) __literal(UDINT,value,__32b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
96 |
#define __ULINT_LITERAL(value) __literal(ULINT,value,__64b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
97 |
#define __REAL_LITERAL(value) __literal(REAL,value,__32b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
98 |
#define __LREAL_LITERAL(value) __literal(LREAL,value,__64b_sufix) |
582
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
99 |
#define __TIME_LITERAL(value) __literal(TIME,value) |
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
100 |
#define __DATE_LITERAL(value) __literal(DATE,value) |
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
101 |
#define __TOD_LITERAL(value) __literal(TOD,value) |
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
102 |
#define __DT_LITERAL(value) __literal(DT,value) |
625
c0bda77b37a0
Merge with c2546c6e0cfa5ad55b288895f17f1b9f2a228f3b
Laurent Bessard
parents:
593
diff
changeset
|
103 |
#define __STRING_LITERAL(count,value) (STRING){count,value} |
582
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
104 |
#define __BYTE_LITERAL(value) __literal(BYTE,value) |
8495119e7271
Fix structure initialize.
Manuele conti <conti.ma@alice.it>
parents:
539
diff
changeset
|
105 |
#define __WORD_LITERAL(value) __literal(WORD,value) |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
106 |
#define __DWORD_LITERAL(value) __literal(DWORD,value,__32b_sufix) |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
107 |
#define __LWORD_LITERAL(value) __literal(LWORD,value,__64b_sufix) |
55
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
48
diff
changeset
|
108 |
|
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
48
diff
changeset
|
109 |
|
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
48
diff
changeset
|
110 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
111 |
#define __INIT_REAL 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
112 |
#define __INIT_LREAL 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
113 |
#define __INIT_SINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
114 |
#define __INIT_INT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
115 |
#define __INIT_DINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
116 |
#define __INIT_LINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
117 |
#define __INIT_USINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
118 |
#define __INIT_UINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
119 |
#define __INIT_UDINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
120 |
#define __INIT_ULINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
121 |
#define __INIT_TIME (TIME){0,0} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
122 |
#define __INIT_BOOL 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
123 |
#define __INIT_BYTE 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
124 |
#define __INIT_WORD 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
125 |
#define __INIT_DWORD 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
126 |
#define __INIT_LWORD 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
127 |
#define __INIT_STRING (STRING){0,""} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
128 |
//#define __INIT_WSTRING |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
129 |
#define __INIT_DATE (DATE){0,0} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
130 |
#define __INIT_TOD (TOD){0,0} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
131 |
#define __INIT_DT (DT){0,0} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
132 |
|
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
|
133 |
typedef union __IL_DEFVAR_T { |
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
|
134 |
BOOL BOOLvar; |
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
|
135 |
|
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
|
136 |
SINT SINTvar; |
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
|
137 |
INT INTvar; |
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
|
138 |
DINT DINTvar; |
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
|
139 |
LINT LINTvar; |
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
|
140 |
|
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
|
141 |
USINT USINTvar; |
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
|
142 |
UINT UINTvar; |
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
|
143 |
UDINT UDINTvar; |
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
|
144 |
ULINT ULINTvar; |
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
|
145 |
|
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
|
146 |
BYTE BYTEvar; |
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
|
147 |
WORD WORDvar; |
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
|
148 |
DWORD DWORDvar; |
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
|
149 |
LWORD LWORDvar; |
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
|
150 |
|
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
|
151 |
REAL REALvar; |
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
|
152 |
LREAL LREALvar; |
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
|
153 |
|
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
|
154 |
TIME TIMEvar; |
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
|
155 |
TOD TODvar; |
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
|
156 |
DT DTvar; |
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
|
157 |
DATE DATEvar; |
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
|
158 |
} __IL_DEFVAR_T; |
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
|
159 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
160 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
161 |
/**********************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
162 |
/**********************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
163 |
/***** *****/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
164 |
/***** Some helper functions... *****/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
165 |
/***** ...used later: *****/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
166 |
/***** - when declaring the IEC 61131-3 standard functions *****/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
167 |
/***** - in the C source code itself in SFC and ST expressions *****/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
168 |
/***** *****/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
169 |
/**********************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
170 |
/**********************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
171 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
172 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
173 |
/****************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
174 |
/* Notify IEC runtime error */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
175 |
/****************************/ |
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
|
176 |
|
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
|
177 |
/* function that generates an IEC runtime error */ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
178 |
static inline void __iec_error(void) { |
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
|
179 |
/* TODO... */ |
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
|
180 |
fprintf(stderr, "IEC 61131-3 runtime error.\n"); |
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
|
181 |
/*exit(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
|
182 |
} |
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
|
183 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
184 |
/*******************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
185 |
/* Time normalization function */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
186 |
/*******************************/ |
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
|
187 |
|
254 | 188 |
static inline void __normalize_timespec (IEC_TIMESPEC *ts) { |
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
|
189 |
if( ts->tv_nsec < -1000000000 || (( ts->tv_sec > 0 ) && ( ts->tv_nsec < 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
|
190 |
ts->tv_sec--; |
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
|
191 |
ts->tv_nsec += 1000000000; |
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
|
192 |
} |
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
|
193 |
if( ts->tv_nsec > 1000000000 || (( ts->tv_sec < 0 ) && ( ts->tv_nsec > 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
|
194 |
ts->tv_sec++; |
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
|
195 |
ts->tv_nsec -= 1000000000; |
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
|
196 |
} |
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
|
197 |
} |
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
|
198 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
199 |
/**********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
200 |
/* Time conversion to/from timespec functions */ |
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 |
|
254 | 203 |
static inline IEC_TIMESPEC __time_to_timespec(int sign, double mseconds, double seconds, double minutes, double hours, double days) { |
204 |
IEC_TIMESPEC ts; |
|
180 | 205 |
|
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
|
206 |
/* sign is 1 for positive values, -1 for negative 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
|
207 |
long double total_sec = ((days*24 + hours)*60 + minutes)*60 + seconds + mseconds/1e3; |
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
|
208 |
if (sign >= 0) sign = 1; else sign = -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
|
209 |
ts.tv_sec = sign * (long int)total_sec; |
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
|
210 |
ts.tv_nsec = sign * (long int)((total_sec - ts.tv_sec)*1e9); |
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
|
211 |
|
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
|
212 |
return ts; |
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
|
213 |
} |
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
|
214 |
|
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
|
215 |
|
254 | 216 |
static inline IEC_TIMESPEC __tod_to_timespec(double seconds, double minutes, double hours) { |
217 |
IEC_TIMESPEC ts; |
|
180 | 218 |
|
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
|
219 |
long double total_sec = (hours*60 + minutes)*60 + seconds; |
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
|
220 |
ts.tv_sec = (long int)total_sec; |
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
|
221 |
ts.tv_nsec = (long int)((total_sec - ts.tv_sec)*1e9); |
180 | 222 |
|
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
|
223 |
return ts; |
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
|
224 |
} |
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
|
225 |
|
254 | 226 |
static inline IEC_TIMESPEC __date_to_timespec(int day, int month, int year) { |
227 |
IEC_TIMESPEC ts; |
|
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
|
228 |
struct tm broken_down_time; |
200 | 229 |
time_t epoch_seconds; |
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
|
230 |
|
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
|
231 |
broken_down_time.tm_sec = 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
|
232 |
broken_down_time.tm_min = 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
|
233 |
broken_down_time.tm_hour = 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
|
234 |
broken_down_time.tm_mday = day; /* day of month, from 1 to 31 */ |
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
|
235 |
broken_down_time.tm_mon = month - 1; /* month since January, in the range 0 to 11 */ |
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
|
236 |
broken_down_time.tm_year = year - 1900; /* number of years since 1900 */ |
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
|
237 |
|
200 | 238 |
epoch_seconds = mktime(&broken_down_time); /* determine number of seconds since the epoch, i.e. Jan 1st 1970 */ |
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
|
239 |
|
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
|
240 |
if ((time_t)(-1) == epoch_seconds) |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
241 |
__iec_error(); |
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
|
242 |
|
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
|
243 |
ts.tv_sec = epoch_seconds; |
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
|
244 |
ts.tv_nsec = 0; |
180 | 245 |
|
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
|
246 |
return ts; |
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
|
247 |
} |
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
|
248 |
|
254 | 249 |
static inline IEC_TIMESPEC __dt_to_timespec(double seconds, double minutes, double hours, int day, int month, int year) { |
250 |
IEC_TIMESPEC ts; |
|
200 | 251 |
struct tm broken_down_time; |
252 |
time_t epoch_seconds; |
|
180 | 253 |
|
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
|
254 |
long double total_sec = (hours*60 + minutes)*60 + seconds; |
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
|
255 |
ts.tv_sec = (long int)total_sec; |
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
|
256 |
ts.tv_nsec = (long int)((total_sec - ts.tv_sec)*1e9); |
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
|
257 |
|
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
|
258 |
broken_down_time.tm_sec = 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
|
259 |
broken_down_time.tm_min = 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
|
260 |
broken_down_time.tm_hour = 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
|
261 |
broken_down_time.tm_mday = day; /* day of month, from 1 to 31 */ |
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
|
262 |
broken_down_time.tm_mon = month - 1; /* month since January, in the range 0 to 11 */ |
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
|
263 |
broken_down_time.tm_year = year - 1900; /* number of years since 1900 */ |
539
1ff26534a54f
Fix __dt_to_timespec primitive function.
Conti Manuele <conti.ma@alice.it>
parents:
538
diff
changeset
|
264 |
broken_down_time.tm_isdst = 0; /* disable daylight savings time */ |
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
|
265 |
|
200 | 266 |
epoch_seconds = mktime(&broken_down_time); /* determine number of seconds since the epoch, i.e. Jan 1st 1970 */ |
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
|
267 |
if ((time_t)(-1) == epoch_seconds) |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
268 |
__iec_error(); |
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
|
269 |
|
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
|
270 |
ts.tv_sec += epoch_seconds; |
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
|
271 |
if (ts.tv_sec < epoch_seconds) |
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
|
272 |
/* since the TOD is always positive, if the above happens then we had an overflow */ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
273 |
__iec_error(); |
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
|
274 |
|
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
|
275 |
return ts; |
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
|
276 |
} |
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
|
277 |
|
350
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 operations */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
280 |
/*******************/ |
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 |
#define __time_cmp(t1, t2) (t2.tv_sec == t1.tv_sec ? t1.tv_nsec - t2.tv_nsec : t1.tv_sec - t2.tv_sec) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
283 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
284 |
static inline TIME __time_add(TIME IN1, TIME IN2){ |
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
|
285 |
TIME res ={IN1.tv_sec + IN2.tv_sec, |
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
|
286 |
IN1.tv_nsec + IN2.tv_nsec }; |
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
|
287 |
__normalize_timespec(&res); |
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
|
288 |
return res; |
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
|
289 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
290 |
static inline TIME __time_sub(TIME IN1, TIME IN2){ |
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
|
291 |
TIME res ={IN1.tv_sec - IN2.tv_sec, |
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
|
292 |
IN1.tv_nsec - IN2.tv_nsec }; |
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
|
293 |
__normalize_timespec(&res); |
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
|
294 |
return res; |
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
|
295 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
296 |
static inline TIME __time_mul(TIME IN1, LREAL IN2){ |
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
|
297 |
LREAL s_f = IN1.tv_sec * IN2; |
700
b0ef6711f2a8
Fix some warning about loss of precision data in iec_std_lib.h file.
Manuele Conti <conti.ma@alice.it>
parents:
696
diff
changeset
|
298 |
time_t s = (time_t)s_f; |
b0ef6711f2a8
Fix some warning about loss of precision data in iec_std_lib.h file.
Manuele Conti <conti.ma@alice.it>
parents:
696
diff
changeset
|
299 |
div_t ns = div((int)((LREAL)IN1.tv_nsec * IN2), 1000000000); |
b0ef6711f2a8
Fix some warning about loss of precision data in iec_std_lib.h file.
Manuele Conti <conti.ma@alice.it>
parents:
696
diff
changeset
|
300 |
TIME res = {(long)s + ns.quot, |
b0ef6711f2a8
Fix some warning about loss of precision data in iec_std_lib.h file.
Manuele Conti <conti.ma@alice.it>
parents:
696
diff
changeset
|
301 |
(long)ns.rem + (s_f - s) * 1000000000 }; |
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
|
302 |
__normalize_timespec(&res); |
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
|
303 |
return res; |
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
|
304 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
305 |
static inline TIME __time_div(TIME IN1, LREAL IN2){ |
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
|
306 |
LREAL s_f = IN1.tv_sec / IN2; |
700
b0ef6711f2a8
Fix some warning about loss of precision data in iec_std_lib.h file.
Manuele Conti <conti.ma@alice.it>
parents:
696
diff
changeset
|
307 |
time_t s = (time_t)s_f; |
b0ef6711f2a8
Fix some warning about loss of precision data in iec_std_lib.h file.
Manuele Conti <conti.ma@alice.it>
parents:
696
diff
changeset
|
308 |
TIME res = {(long)s, |
b0ef6711f2a8
Fix some warning about loss of precision data in iec_std_lib.h file.
Manuele Conti <conti.ma@alice.it>
parents:
696
diff
changeset
|
309 |
(long)(IN1.tv_nsec / IN2 + (s_f - s) * 1000000000) }; |
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
|
310 |
__normalize_timespec(&res); |
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
|
311 |
return res; |
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
|
312 |
} |
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
|
313 |
|
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
|
314 |
|
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
|
315 |
/***************/ |
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
|
316 |
/* Convertions */ |
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
|
317 |
/***************/ |
314
41d4ac0b4821
Fixing REAL_TO_INT conversion (behaved like a trunc and not like a round)
laurent
parents:
313
diff
changeset
|
318 |
/*****************/ |
41d4ac0b4821
Fixing REAL_TO_INT conversion (behaved like a trunc and not like a round)
laurent
parents:
313
diff
changeset
|
319 |
/* REAL_TO_INT */ |
41d4ac0b4821
Fixing REAL_TO_INT conversion (behaved like a trunc and not like a round)
laurent
parents:
313
diff
changeset
|
320 |
/*****************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
321 |
static inline LINT __real_round(LREAL IN) { |
314
41d4ac0b4821
Fixing REAL_TO_INT conversion (behaved like a trunc and not like a round)
laurent
parents:
313
diff
changeset
|
322 |
return fmod(IN, 1) == 0 ? ((LINT)IN / 2) * 2 : (LINT)IN; |
41d4ac0b4821
Fixing REAL_TO_INT conversion (behaved like a trunc and not like a round)
laurent
parents:
313
diff
changeset
|
323 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
324 |
static inline LINT __preal_to_sint(LREAL IN) { |
314
41d4ac0b4821
Fixing REAL_TO_INT conversion (behaved like a trunc and not like a round)
laurent
parents:
313
diff
changeset
|
325 |
return IN >= 0 ? __real_round(IN + 0.5) : __real_round(IN - 0.5); |
41d4ac0b4821
Fixing REAL_TO_INT conversion (behaved like a trunc and not like a round)
laurent
parents:
313
diff
changeset
|
326 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
327 |
static inline LINT __preal_to_uint(LREAL IN) { |
314
41d4ac0b4821
Fixing REAL_TO_INT conversion (behaved like a trunc and not like a round)
laurent
parents:
313
diff
changeset
|
328 |
return IN >= 0 ? __real_round(IN + 0.5) : 0; |
41d4ac0b4821
Fixing REAL_TO_INT conversion (behaved like a trunc and not like a round)
laurent
parents:
313
diff
changeset
|
329 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
330 |
static inline LINT __real_to_sint(LREAL IN) {return (LINT)__preal_to_sint(IN);} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
331 |
static inline LWORD __real_to_bit(LREAL IN) {return (LWORD)__preal_to_uint(IN);} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
332 |
static inline ULINT __real_to_uint(LREAL IN) {return (ULINT)__preal_to_uint(IN);} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
333 |
|
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
|
334 |
/***************/ |
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
|
335 |
/* TO_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
|
336 |
/***************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
337 |
static inline STRING __bool_to_string(BOOL IN) { |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
338 |
if(IN) return (STRING){4, "TRUE"}; |
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
|
339 |
return (STRING){5,"FALSE"}; |
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
|
340 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
341 |
static inline STRING __bit_to_string(LWORD IN) { |
200 | 342 |
STRING res; |
343 |
res = __INIT_STRING; |
|
389
94b67e38188a
silenced warning on X86_64 build by casying numerical operand of snprintf
Edouard Tisserant
parents:
384
diff
changeset
|
344 |
res.len = snprintf((char*)res.body, STR_MAX_LEN, "16#%llx",(long long unsigned int)IN); |
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
|
345 |
if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN; |
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
|
346 |
return res; |
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
|
347 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
348 |
static inline STRING __real_to_string(LREAL IN) { |
200 | 349 |
STRING res; |
350 |
res = __INIT_STRING; |
|
114 | 351 |
res.len = snprintf((char*)res.body, STR_MAX_LEN, "%.10g", IN); |
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
|
352 |
if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN; |
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
|
353 |
return res; |
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 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
355 |
static inline STRING __sint_to_string(LINT IN) { |
200 | 356 |
STRING res; |
357 |
res = __INIT_STRING; |
|
389
94b67e38188a
silenced warning on X86_64 build by casying numerical operand of snprintf
Edouard Tisserant
parents:
384
diff
changeset
|
358 |
res.len = snprintf((char*)res.body, STR_MAX_LEN, "%lld", (long long int)IN); |
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
|
359 |
if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN; |
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 |
return res; |
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 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
362 |
static inline STRING __uint_to_string(ULINT IN) { |
200 | 363 |
STRING res; |
364 |
res = __INIT_STRING; |
|
389
94b67e38188a
silenced warning on X86_64 build by casying numerical operand of snprintf
Edouard Tisserant
parents:
384
diff
changeset
|
365 |
res.len = snprintf((char*)res.body, STR_MAX_LEN, "%llu", (long long unsigned int)IN); |
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
|
366 |
if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN; |
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 |
return res; |
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 |
} |
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 |
/***************/ |
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 |
/* FROM_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 |
/***************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
372 |
static inline BOOL __string_to_bool(STRING IN) { |
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
|
373 |
return IN.len == 5 ? !memcmp(&IN.body,"TRUE", IN.len) : 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
|
374 |
} |
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 |
static inline LINT __pstring_to_sint(STRING* IN) { |
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
|
377 |
LINT res = 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
|
378 |
__strlen_t l; |
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
|
379 |
unsigned int shift = 0; |
180 | 380 |
|
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
|
381 |
if(IN->body[0]=='2' && IN->body[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
|
382 |
/* 2#0101_1010_1011_1111 */ |
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
|
383 |
for(l = IN->len - 1; l >= 2 && shift < 64; l--) |
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
|
384 |
{ |
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
|
385 |
char c = IN->body[l]; |
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
|
386 |
if( c >= '0' && c <= '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
|
387 |
res |= ( c - '0') << shift; |
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
|
388 |
shift += 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
|
389 |
} |
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
|
390 |
} |
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
|
391 |
}else if(IN->body[0]=='8' && IN->body[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
|
392 |
/* 8#1234_5665_4321 */ |
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
|
393 |
for(l = IN->len - 1; l >= 2 && shift < 64; l--) |
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
|
394 |
{ |
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
|
395 |
char c = IN->body[l]; |
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
|
396 |
if( c >= '0' && c <= '7'){ |
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
|
397 |
res |= ( c - '0') << shift; |
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
|
398 |
shift += 3; |
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
|
399 |
} |
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
|
400 |
} |
43 | 401 |
}else if(IN->body[0]=='1' && IN->body[1]=='6' && IN->body[2]=='#'){ |
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
|
402 |
/* 16#1234_5678_9abc_DEFG */ |
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
|
403 |
for(l = IN->len - 1; l >= 3 && shift < 64; l--) |
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
|
404 |
{ |
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
|
405 |
char c = IN->body[l]; |
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
|
406 |
if( c >= '0' && c <= '9'){ |
43 | 407 |
res |= (LWORD)( c - '0') << shift; |
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
|
408 |
shift += 4; |
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
|
409 |
}else if( c >= 'a' && c <= 'f'){ |
43 | 410 |
res |= (LWORD)( c - 'a' + 10 ) << shift; |
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
|
411 |
shift += 4; |
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
|
412 |
}else if( c >= 'A' && c <= 'F'){ |
43 | 413 |
res |= (LWORD)( c - 'A' + 10 ) << shift; |
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
|
414 |
shift += 4; |
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
|
415 |
} |
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
|
416 |
} |
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
|
417 |
}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
|
418 |
/* -123456789 */ |
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
|
419 |
LINT fac = IN->body[0] == '-' ? -1 : 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
|
420 |
for(l = IN->len - 1; l >= 0 && shift < 20; l--) |
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
|
421 |
{ |
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
|
422 |
char c = IN->body[l]; |
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
|
423 |
if( c >= '0' && c <= '9'){ |
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
|
424 |
res += ( c - '0') * fac; |
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
|
425 |
fac *= 10; |
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
|
426 |
shift += 1; |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
427 |
}else if( c >= '.' ){ /* reset value */ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
428 |
res = 0; |
163 | 429 |
fac = IN->body[0] == '-' ? -1 : 1; |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
430 |
shift = 0; |
180 | 431 |
} |
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
|
432 |
} |
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
|
433 |
} |
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
|
434 |
return res; |
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
|
435 |
} |
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
|
436 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
437 |
static inline LINT __string_to_sint(STRING IN) {return (LINT)__pstring_to_sint(&IN);} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
438 |
static inline LWORD __string_to_bit (STRING IN) {return (LWORD)__pstring_to_sint(&IN);} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
439 |
static inline ULINT __string_to_uint(STRING IN) {return (ULINT)__pstring_to_sint(&IN);} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
440 |
static inline LREAL __string_to_real(STRING IN) { |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
441 |
__strlen_t l; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
442 |
l = IN.len; |
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
|
443 |
/* search the dot */ |
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
|
444 |
while(--l > 0 && IN.body[l] != '.'); |
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
|
445 |
if(l != 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
|
446 |
return atof((const char *)&IN.body); |
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
|
447 |
}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
|
448 |
return (LREAL)__pstring_to_sint(&IN); |
180 | 449 |
} |
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
|
450 |
} |
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
|
451 |
|
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
|
452 |
/***************/ |
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
|
453 |
/* TO_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
|
454 |
/***************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
455 |
static inline TIME __int_to_time(LINT IN) {return (TIME){IN, 0};} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
456 |
static inline TIME __real_to_time(LREAL IN) {return (TIME){IN, (IN - (LINT)IN) * 1000000000};} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
457 |
static inline TIME __string_to_time(STRING IN){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
458 |
__strlen_t l; |
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
|
459 |
/* TODO : |
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
|
460 |
* |
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
|
461 |
* Duration literals without underlines: T#14ms T#-14ms T#14.7s T#14.7m |
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
|
462 |
* short prefix T#14.7h t#14.7d t#25h15m |
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
|
463 |
* t#5d14h12m18s3.5ms |
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
|
464 |
* long prefix TIME#14ms TIME#-14ms time#14.7s |
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
|
465 |
* Duration literals with underlines: |
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
|
466 |
* short prefix t#25h_15m t#5d_14h_12m_18s_3.5ms |
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
|
467 |
* long prefix TIME#25h_15m |
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
|
468 |
* time#5d_14h_12m_18s_3.5ms |
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
|
469 |
* |
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
|
470 |
* Long prefix notation Short prefix notation |
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
|
471 |
* DATE#1984-06-25 D#1984-06-25 |
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
|
472 |
* date#1984-06-25 d#1984-06-25 |
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
|
473 |
* TIME_OF_DAY#15:36:55.36 TOD#15:36:55.36 |
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
|
474 |
* time_of_day#15:36:55.36 tod#15:36:55.36 |
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
|
475 |
* DATE_AND_TIME#1984-06-25-15:36:55.36 DT#1984-06-25-15:36:55.36 |
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
|
476 |
* date_and_time#1984-06-25-15:36:55.36 dt#1984-06-25-15:36:55.36 |
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
|
477 |
* |
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
|
478 |
*/ |
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
|
479 |
/* Quick hack : only transform seconds */ |
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
|
480 |
/* search the dot */ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
481 |
l = IN.len; |
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
|
482 |
while(--l > 0 && IN.body[l] != '.'); |
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
|
483 |
if(l != 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
|
484 |
LREAL IN_val = atof((const char *)&IN.body); |
700
b0ef6711f2a8
Fix some warning about loss of precision data in iec_std_lib.h file.
Manuele Conti <conti.ma@alice.it>
parents:
696
diff
changeset
|
485 |
return (TIME){(long)IN_val, (long)(IN_val - (LINT)IN_val)*1000000000}; |
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
|
486 |
}else{ |
700
b0ef6711f2a8
Fix some warning about loss of precision data in iec_std_lib.h file.
Manuele Conti <conti.ma@alice.it>
parents:
696
diff
changeset
|
487 |
return (TIME){(long)__pstring_to_sint(&IN), 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
|
488 |
} |
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
|
489 |
} |
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
|
490 |
|
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
|
491 |
/***************/ |
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
|
492 |
/* FROM_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
|
493 |
/***************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
494 |
static inline LREAL __time_to_real(TIME IN){ |
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
|
495 |
return (LREAL)IN.tv_sec + ((LREAL)IN.tv_nsec/1000000000); |
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
|
496 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
497 |
static inline LINT __time_to_int(TIME IN) {return IN.tv_sec;} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
498 |
static inline STRING __time_to_string(TIME IN){ |
200 | 499 |
STRING res; |
500 |
div_t days; |
|
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
|
501 |
/*t#5d14h12m18s3.5ms*/ |
200 | 502 |
res = __INIT_STRING; |
503 |
days = div(IN.tv_sec ,86400); |
|
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
|
504 |
if(!days.rem && IN.tv_nsec == 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
|
505 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "T#%dd", days.quot); |
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
|
506 |
}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
|
507 |
div_t hours = div(days.rem, 3600); |
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
|
508 |
if(!hours.rem && IN.tv_nsec == 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
|
509 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "T#%dd%dh", days.quot, hours.quot); |
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
|
510 |
}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
|
511 |
div_t minuts = div(hours.rem, 60); |
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
|
512 |
if(!minuts.rem && IN.tv_nsec == 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
|
513 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "T#%dd%dh%dm", days.quot, hours.quot, minuts.quot); |
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
|
514 |
}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
|
515 |
if(IN.tv_nsec == 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
|
516 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "T#%dd%dh%dm%ds", days.quot, hours.quot, minuts.quot, minuts.rem); |
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
|
517 |
}else{ |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
518 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "T#%dd%dh%dm%ds%gms", days.quot, hours.quot, minuts.quot, minuts.rem, (LREAL)IN.tv_nsec / 1000000); |
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
|
519 |
} |
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
|
520 |
} |
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
|
521 |
} |
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
|
522 |
} |
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
|
523 |
if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN; |
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
|
524 |
return res; |
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
|
525 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
526 |
static inline STRING __date_to_string(DATE IN){ |
200 | 527 |
STRING res; |
528 |
struct tm* broken_down_time; |
|
529 |
time_t seconds; |
|
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
|
530 |
/* D#1984-06-25 */ |
200 | 531 |
res = __INIT_STRING; |
532 |
seconds = IN.tv_sec; |
|
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
533 |
if (NULL == (broken_down_time = localtime(&seconds))){ /* get the UTC (GMT) broken down time */ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
534 |
__iec_error(); |
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
|
535 |
return (STRING){7,"D#ERROR"}; |
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
|
536 |
} |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
537 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "D#%d-%2.2d-%2.2d", broken_down_time->tm_year + 1900, broken_down_time->tm_mon + 1, broken_down_time->tm_mday); |
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
|
538 |
if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN; |
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
|
539 |
return res; |
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
|
540 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
541 |
static inline STRING __tod_to_string(TOD IN){ |
200 | 542 |
STRING res; |
543 |
struct tm* broken_down_time; |
|
544 |
time_t seconds; |
|
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
|
545 |
/* TOD#15:36:55.36 */ |
200 | 546 |
res = __INIT_STRING; |
547 |
seconds = IN.tv_sec; |
|
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
548 |
if (NULL == (broken_down_time = localtime(&seconds))){ /* get the UTC (GMT) broken down time */ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
549 |
__iec_error(); |
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
|
550 |
return (STRING){9,"TOD#ERROR"}; |
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
|
551 |
} |
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
|
552 |
if(IN.tv_nsec == 0){ |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
553 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "TOD#%2.2d:%2.2d:%d", broken_down_time->tm_hour, broken_down_time->tm_min, broken_down_time->tm_sec); |
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
|
554 |
}else{ |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
555 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "TOD#%2.2d:%2.2d:%g", broken_down_time->tm_hour, broken_down_time->tm_min, (LREAL)broken_down_time->tm_sec + (LREAL)IN.tv_nsec / 1e9); |
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
|
556 |
} |
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
|
557 |
if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN; |
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
|
558 |
return res; |
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
|
559 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
560 |
static inline STRING __dt_to_string(DT IN){ |
200 | 561 |
STRING res; |
562 |
struct tm* broken_down_time; |
|
563 |
time_t seconds; |
|
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
|
564 |
/* DT#1984-06-25-15:36:55.36 */ |
200 | 565 |
seconds = IN.tv_sec; |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
566 |
if (NULL == (broken_down_time = localtime(&seconds))){ /* get the UTC (GMT) broken down time */ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
567 |
__iec_error(); |
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
|
568 |
return (STRING){8,"DT#ERROR"}; |
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
|
569 |
} |
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
|
570 |
if(IN.tv_nsec == 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
|
571 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "DT#%d-%2.2d-%2.2d-%2.2d:%2.2d:%d", |
538
06cc7500500d
Fix __dt_to_string primitive function.
Conti Manuele <manuele.conti@alice.it>
parents:
501
diff
changeset
|
572 |
broken_down_time->tm_year + 1900, |
06cc7500500d
Fix __dt_to_string primitive function.
Conti Manuele <manuele.conti@alice.it>
parents:
501
diff
changeset
|
573 |
broken_down_time->tm_mon + 1, |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
574 |
broken_down_time->tm_mday, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
575 |
broken_down_time->tm_hour, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
576 |
broken_down_time->tm_min, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
577 |
broken_down_time->tm_sec); |
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
|
578 |
}else{ |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
579 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "DT#%d-%2.2d-%2.2d-%2.2d:%2.2d:%g", |
538
06cc7500500d
Fix __dt_to_string primitive function.
Conti Manuele <manuele.conti@alice.it>
parents:
501
diff
changeset
|
580 |
broken_down_time->tm_year + 1900, |
06cc7500500d
Fix __dt_to_string primitive function.
Conti Manuele <manuele.conti@alice.it>
parents:
501
diff
changeset
|
581 |
broken_down_time->tm_mon + 1, |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
582 |
broken_down_time->tm_mday, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
583 |
broken_down_time->tm_hour, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
584 |
broken_down_time->tm_min, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
585 |
(LREAL)broken_down_time->tm_sec + ((LREAL)IN.tv_nsec / 1e9)); |
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
|
586 |
} |
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
|
587 |
if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN; |
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
|
588 |
return res; |
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
|
589 |
} |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
590 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
591 |
/**********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
592 |
/* [ANY_DATE | TIME] _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
|
593 |
/**********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
594 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
595 |
static inline TOD __date_and_time_to_time_of_day(DT IN) {return (TOD){IN.tv_sec % 86400, IN.tv_nsec};} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
596 |
static inline DATE __date_and_time_to_date(DT IN){return (DATE){IN.tv_sec - (IN.tv_sec % (24*60*60)), 0};} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
597 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
598 |
/*****************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
599 |
/* FROM/TO BCD */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
600 |
/*****************/ |
180 | 601 |
#define __bcd_digit(fac) |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
602 |
static inline ULINT __bcd_to_uint(LWORD IN){ |
212 | 603 |
ULINT res; |
604 |
ULINT i; |
|
605 |
||
606 |
res = IN & 0xf; |
|
607 |
for(i = 10ULL; i <= 1000000000000000ULL; i *= 10){ |
|
608 |
if(!(IN >>= 4)) |
|
609 |
break; |
|
610 |
res += (IN & 0xf) * i; |
|
611 |
} |
|
612 |
return res; |
|
613 |
} |
|
614 |
||
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
615 |
static inline LWORD __uint_to_bcd(ULINT IN){ |
212 | 616 |
LWORD res; |
617 |
USINT i; |
|
618 |
||
619 |
res = IN % 10; |
|
620 |
for(i = 4; i<=60; i += 4){ |
|
621 |
if(!(IN /= 10)) |
|
622 |
break; |
|
623 |
res |= (IN % 10) << i; |
|
624 |
} |
|
625 |
return res; |
|
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
|
626 |
} |
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
|
627 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
628 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
629 |
/************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
630 |
/* MOVE_* */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
631 |
/************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
632 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
633 |
/* some helpful __move_[ANY] functions, used in the *_TO_** and MOVE standard functions */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
634 |
/* e.g. __move_BOOL, __move_BYTE, __move_REAL, __move_TIME, ... */ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
635 |
#define __move_(TYPENAME)\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
636 |
static inline TYPENAME __move_##TYPENAME(TYPENAME op1) {return op1;} |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
637 |
__ANY(__move_) |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
638 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
639 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
640 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
641 |
/*****************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
642 |
/*****************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
643 |
/***** *****/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
644 |
/***** IEC 61131-3 *****/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
645 |
/***** 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
|
646 |
/***** *****/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
647 |
/*****************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
648 |
/*****************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
649 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
650 |
/* 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
|
651 |
* 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
|
652 |
* $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
|
653 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
654 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
655 |
/* 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
|
656 |
* (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
|
657 |
* 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
|
658 |
* (SIN, ADD, ...). |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
659 |
* 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
|
660 |
* 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
|
661 |
* 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
|
662 |
* typed standard function. |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
663 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
664 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
665 |
/* 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
|
666 |
* - 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
|
667 |
* - 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
|
668 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
669 |
* 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
|
670 |
* 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
|
671 |
* "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
|
672 |
* 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
|
673 |
* 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
|
674 |
* 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
|
675 |
* [...] |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
676 |
* "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
|
677 |
* 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
|
678 |
* 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
|
679 |
* 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
|
680 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
681 |
* 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
|
682 |
* 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
|
683 |
* 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
|
684 |
* 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
|
685 |
* |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
686 |
* 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
|
687 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
688 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
689 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
690 |
/********************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
691 |
/* EN/ENO PARAMS */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
692 |
/********************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
693 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
694 |
#define EN_ENO_PARAMS BOOL EN, BOOL *ENO |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
695 |
#define EN_ENO EN, ENO |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
696 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
697 |
#define TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
698 |
if (!EN) {\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
699 |
if (ENO != NULL)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
700 |
*ENO = __BOOL_LITERAL(FALSE);\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
701 |
return __INIT_##TYPENAME;\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
702 |
}\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
703 |
else if (ENO != NULL)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
704 |
*ENO = __BOOL_LITERAL(TRUE); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
705 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
706 |
#define TEST_EN_COND(TYPENAME, COND)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
707 |
if (!EN || (COND)) {\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
708 |
if (ENO != NULL)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
709 |
*ENO = __BOOL_LITERAL(FALSE);\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
710 |
return __INIT_##TYPENAME;\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
711 |
}\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
712 |
else if (ENO != NULL)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
713 |
*ENO = __BOOL_LITERAL(TRUE); |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
714 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
715 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
716 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
717 |
/*****************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
718 |
/*****************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
719 |
/* 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
|
720 |
/*****************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
721 |
/*****************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
722 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
723 |
#define __convert_type(from_TYPENAME,to_TYPENAME, oper) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
724 |
static inline to_TYPENAME from_TYPENAME##_TO_##to_TYPENAME(EN_ENO_PARAMS, from_TYPENAME op){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
725 |
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
|
726 |
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
|
727 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
728 |
|
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
729 |
/******** [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
|
730 |
#define __convert_num_to_bool(TYPENAME) \ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
731 |
static inline BOOL TYPENAME##_TO_BOOL(EN_ENO_PARAMS, TYPENAME op){\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
732 |
TEST_EN(BOOL)\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
733 |
return op == 0 ? 0 : 1;\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
734 |
} |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
735 |
__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
|
736 |
__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
|
737 |
|
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
738 |
/******** [TIME | ANY_DATE]_TO_BOOL ************/ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
739 |
#define __convert_time_to_bool(TYPENAME) \ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
740 |
static inline BOOL TYPENAME##_TO_BOOL(EN_ENO_PARAMS, TYPENAME op){\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
741 |
TEST_EN(BOOL)\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
742 |
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
|
743 |
} |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
744 |
__convert_time_to_bool(TIME) |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
745 |
__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
|
746 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
747 |
#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
|
748 |
#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
|
749 |
#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
|
750 |
#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
|
751 |
#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
|
752 |
#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
|
753 |
#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
|
754 |
#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
|
755 |
|
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
756 |
/******** [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
|
757 |
#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
|
758 |
__ANY_BIT(__to_anynum_) |
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
759 |
__ANY_BIT(__to_anynbit_) |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
760 |
#undef __iec_ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
761 |
|
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
762 |
/******** [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
|
763 |
#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
|
764 |
__ANY_INT(__to_anynum_) |
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
765 |
__ANY_INT(__to_anynbit_) |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
766 |
#undef __iec_ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
767 |
|
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
768 |
/******** [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
|
769 |
#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
|
770 |
__ANY_REAL(__to_anynbit_) |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
771 |
#undef __iec_ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
772 |
|
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
773 |
/******** [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
|
774 |
#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
|
775 |
__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
|
776 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
777 |
#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
|
778 |
__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
|
779 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
780 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
781 |
/******** [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
|
782 |
#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
|
783 |
__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
|
784 |
#undef __iec_ |
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 |
/******** [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
|
787 |
#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
|
788 |
__ANY_BIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
789 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
790 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
791 |
#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
|
792 |
__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
|
793 |
__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
|
794 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
795 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
796 |
/******** [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
|
797 |
#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
|
798 |
__ANY_REAL(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
799 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
800 |
#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
|
801 |
__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
|
802 |
#undef __iec_ |
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 |
/******** [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
|
805 |
#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
|
806 |
__to_anyint_(TIME) |
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
807 |
__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
|
808 |
__ANY_DATE(__to_anyint_) |
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
809 |
__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
|
810 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
811 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
812 |
/******** [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
|
813 |
#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
|
814 |
__to_anyreal_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
815 |
__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
|
816 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
817 |
|
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_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
|
820 |
/* 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
|
821 |
__convert_type(DT, DATE, __date_and_time_to_date) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
822 |
__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
|
823 |
__convert_type(DT, TOD, __date_and_time_to_time_of_day) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
824 |
/* 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
|
825 |
__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
|
826 |
/* 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
|
827 |
/* 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
|
828 |
/* 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
|
829 |
/* 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
|
830 |
/* 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
|
831 |
__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
|
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 |
/******** 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
|
835 |
/* 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
|
836 |
/* 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
|
837 |
/* 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
|
838 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
839 |
/******** TIME_TO_TIME ************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
840 |
__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
|
841 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
842 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
843 |
/******** [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
|
844 |
__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
|
845 |
#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
|
846 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
847 |
#undef __iec_ |
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 |
/******** [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
|
850 |
#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
|
851 |
__ANY_SINT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
852 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
853 |
#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
|
854 |
__ANY_UINT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
855 |
#undef __iec_ |
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_REAL]_TO_STRING ************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
858 |
#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
|
859 |
__ANY_REAL(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
860 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
861 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
862 |
/******** [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
|
863 |
__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
|
864 |
__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
|
865 |
__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
|
866 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
867 |
/******** TIME_TO_STRING ************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
868 |
__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
|
869 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
870 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
871 |
/******** 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
|
872 |
__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
|
873 |
#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
|
874 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
875 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
876 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
877 |
/******** 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
|
878 |
#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
|
879 |
__ANY_SINT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
880 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
881 |
#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
|
882 |
__ANY_UINT(__iec_) |
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 |
/******** 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
|
886 |
#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
|
887 |
__ANY_REAL(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
888 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
889 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
890 |
/******** 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
|
891 |
#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
|
892 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
893 |
#undef __iec_ |
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 |
/******** STRING_TO_TIME ************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
896 |
__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
|
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 |
/******** TRUNC ************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
900 |
#define __iec_(to_TYPENAME,from_TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
901 |
static inline to_TYPENAME TRUNC__##to_TYPENAME##__##from_TYPENAME(EN_ENO_PARAMS, from_TYPENAME op){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
902 |
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
|
903 |
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
|
904 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
905 |
__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
|
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 |
/******** _TO_BCD ************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
910 |
#define __iec_(to_TYPENAME,from_TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
911 |
static inline to_TYPENAME from_TYPENAME##_TO_BCD_##to_TYPENAME(EN_ENO_PARAMS, from_TYPENAME op){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
912 |
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
|
913 |
return (to_TYPENAME)__uint_to_bcd(op);\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
914 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
915 |
__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
|
916 |
#undef __iec_ |
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
919 |
/******** BCD_TO_ ************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
920 |
#define __iec_(to_TYPENAME,from_TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
921 |
static inline to_TYPENAME from_TYPENAME##_BCD_TO_##to_TYPENAME(EN_ENO_PARAMS, from_TYPENAME op){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
922 |
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
|
923 |
return (to_TYPENAME)__bcd_to_uint(op);\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
924 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
925 |
__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
|
926 |
#undef __iec_ |
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
929 |
/***********************************/ |
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 |
/* 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
|
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 |
|
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
|
935 |
/* 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
|
936 |
#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
|
937 |
#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
|
938 |
#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
|
939 |
#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
|
940 |
#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
|
941 |
#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
|
942 |
#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
|
943 |
#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
|
944 |
#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
|
945 |
#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
|
946 |
#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
|
947 |
#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
|
948 |
#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
|
949 |
#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
|
950 |
#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
|
951 |
#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
|
952 |
#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
|
953 |
#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
|
954 |
#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
|
955 |
#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
|
956 |
#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
|
957 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
958 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
959 |
#define __numeric(fname,TYPENAME, FUNC) \ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
960 |
/* explicitly typed function */\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
961 |
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
962 |
TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
963 |
return FUNC(op);\ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
964 |
}\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
965 |
/* overloaded function */\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
966 |
static inline TYPENAME fname##_##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op) {\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
967 |
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
|
968 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
969 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
970 |
/******************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
971 |
/*** 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
|
972 |
/******************************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
973 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
974 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
975 |
/* ABS */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
976 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
977 |
#define __abs_signed(TYPENAME) \ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
978 |
/* explicitly typed function */\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
979 |
static inline TYPENAME ABS_##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
980 |
TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
981 |
if (op < 0)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
982 |
return -op;\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
983 |
return op;\ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
984 |
}\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
985 |
/* overloaded function */\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
986 |
static inline TYPENAME ABS__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op) {\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
987 |
return ABS_##TYPENAME(EN_ENO, op);\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
988 |
} |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
989 |
|
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
990 |
#define __abs_unsigned(TYPENAME) \ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
991 |
/* explicitly typed function */\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
992 |
static inline TYPENAME ABS_##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
993 |
TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
994 |
return op;\ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
995 |
}\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
996 |
/* overloaded function */\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
997 |
static inline TYPENAME ABS__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op) {\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
998 |
return ABS_##TYPENAME(EN_ENO, op);\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
999 |
} |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1000 |
|
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1001 |
__ANY_REAL(__abs_signed) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1002 |
__ANY_SINT(__abs_signed) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1003 |
__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
|
1004 |
|
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 |
/* SQRT */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1008 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1009 |
#define __sqrt(TYPENAME) __numeric(SQRT_, TYPENAME, sqrt) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1010 |
__ANY_REAL(__sqrt) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1011 |
|
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1012 |
|
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1013 |
/**************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1014 |
/* LN */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1015 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1016 |
#define __ln(TYPENAME) __numeric(LN_, TYPENAME, log) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1017 |
__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
|
1018 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1019 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1020 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1021 |
/* LOG */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1022 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1023 |
#define __log(TYPENAME) __numeric(LOG_, TYPENAME, log10) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1024 |
__ANY_REAL(__log) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1025 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1026 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1027 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1028 |
/* EXP */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1029 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1030 |
#define __exp(TYPENAME) __numeric(EXP_, TYPENAME, exp) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1031 |
__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
|
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 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1035 |
/* SIN */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1036 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1037 |
#define __sin(TYPENAME) __numeric(SIN_, TYPENAME, sin) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1038 |
__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
|
1039 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1040 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1041 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1042 |
/* COS */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1043 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1044 |
#define __cos(TYPENAME) __numeric(COS_, TYPENAME, cos) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1045 |
__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
|
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 |
/* TAN */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1049 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1050 |
#define __tan(TYPENAME) __numeric(TAN_, TYPENAME, tan) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1051 |
__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
|
1052 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1053 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1054 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1055 |
/* ASIN */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1056 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1057 |
#define __asin(TYPENAME) __numeric(ASIN_, TYPENAME, asin) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1058 |
__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
|
1059 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1060 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1061 |
/* ACOS */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1062 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1063 |
#define __acos(TYPENAME) __numeric(ACOS_, TYPENAME, acos) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1064 |
__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
|
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 |
/* ATAN */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1068 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1069 |
#define __atan(TYPENAME) __numeric(ATAN_, TYPENAME, atan) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1070 |
__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
|
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 |
|
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 |
/*** 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
|
1076 |
/*****************************************************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1077 |
|
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1078 |
#define __arith_expand(fname,TYPENAME, OP)\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1079 |
static inline TYPENAME fname(EN_ENO_PARAMS, UINT param_count, TYPENAME op1, ...){\ |
149 | 1080 |
va_list ap;\ |
1081 |
UINT i;\ |
|
200 | 1082 |
TEST_EN(TYPENAME)\ |
149 | 1083 |
\ |
1084 |
va_start (ap, op1); /* Initialize the argument list. */\ |
|
1085 |
\ |
|
1086 |
for (i = 0; i < param_count - 1; i++){\ |
|
1087 |
op1 = op1 OP va_arg (ap, VA_ARGS_##TYPENAME);\ |
|
1088 |
}\ |
|
1089 |
\ |
|
1090 |
va_end (ap); /* Clean up. */\ |
|
1091 |
return op1;\ |
|
1092 |
} |
|
1093 |
||
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1094 |
#define __arith_static(fname,TYPENAME, OP)\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1095 |
/* explicitly typed function */\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1096 |
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\ |
149 | 1097 |
TEST_EN(TYPENAME)\ |
1098 |
return op1 OP op2;\ |
|
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1099 |
}\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1100 |
/* overloaded function */\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1101 |
static inline TYPENAME fname##_##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1102 |
return fname##TYPENAME(EN_ENO, op1, op2);\ |
149 | 1103 |
} |
1104 |
||
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1105 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1106 |
/* ADD */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1107 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1108 |
#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
|
1109 |
__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
|
1110 |
__arith_expand(ADD__##TYPENAME##__##TYPENAME, TYPENAME, +) /* overloaded function */ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1111 |
__ANY_NUM(__add) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1112 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1113 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1114 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1115 |
/* MUL */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1116 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1117 |
#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
|
1118 |
__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
|
1119 |
__arith_expand(MUL__##TYPENAME##__##TYPENAME, TYPENAME, *) /* overloaded function */ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1120 |
__ANY_NUM(__mul) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1121 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1122 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1123 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1124 |
/* SUB */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1125 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1126 |
#define __sub(TYPENAME) __arith_static(SUB_, TYPENAME, -) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1127 |
__ANY_NUM(__sub) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1128 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1129 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1130 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1131 |
/* DIV */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1132 |
/**************/ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1133 |
#define __div(TYPENAME)\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1134 |
/* The explicitly typed standard functions */\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1135 |
static inline TYPENAME DIV_##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\ |
149 | 1136 |
TEST_EN_COND(TYPENAME, op2 == 0)\ |
1137 |
return op1 / op2;\ |
|
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1138 |
}\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1139 |
/* The overloaded standard functions */\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1140 |
static inline TYPENAME DIV__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1141 |
return DIV_##TYPENAME(EN_ENO, op1, op2);\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1142 |
} |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1143 |
__ANY_NUM(__div) |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1144 |
|
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1145 |
|
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1146 |
/**************/ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1147 |
/* MOD */ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1148 |
/**************/ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1149 |
#define __mod(TYPENAME)\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1150 |
/* The explicitly typed standard functions */\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1151 |
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
|
1152 |
TEST_EN(TYPENAME)\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1153 |
if (op2 == 0) return 0;\ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1154 |
return op1 % op2;\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1155 |
}\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1156 |
/* The overloaded standard functions */\ |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1157 |
static inline TYPENAME MOD__##TYPENAME##__##TYPENAME##__##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
|
1158 |
return MOD_##TYPENAME(EN_ENO, op1, op2);\ |
393
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1159 |
} |
f09a5ffe1edc
Fixing SUB standard function defined in standard library
laurent
parents:
389
diff
changeset
|
1160 |
__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
|
1161 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1162 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1163 |
/* EXPT */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1164 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1165 |
/* overloaded function */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1166 |
#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
|
1167 |
static inline in1_TYPENAME EXPT__##in1_TYPENAME##__##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
|
1168 |
(EN_ENO_PARAMS, in1_TYPENAME IN1, in2_TYPENAME IN2){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1169 |
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
|
1170 |
return pow(IN1, IN2);\ |
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 |
#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
|
1173 |
__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
|
1174 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1175 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1176 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1177 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1178 |
/***************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1179 |
/* MOVE */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1180 |
/***************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1181 |
/* 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
|
1182 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1183 |
static inline TYPENAME MOVE_##TYPENAME(EN_ENO_PARAMS, TYPENAME op1){\ |
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 op1;\ |
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(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1188 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1189 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1190 |
/* Overloaded function */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1191 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1192 |
static inline TYPENAME MOVE__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op1){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1193 |
TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1194 |
return op1;\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1195 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1196 |
__ANY(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1197 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1198 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1199 |
|
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1202 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1203 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1204 |
/***********************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1205 |
/***********************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1206 |
/* 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
|
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1210 |
/****************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1211 |
/*** 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
|
1212 |
/****************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1213 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1214 |
/* 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
|
1215 |
* 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
|
1216 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1217 |
#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
|
1218 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1219 |
#define __shift_(fname, in1_TYPENAME, in2_TYPENAME, OP)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1220 |
static inline in1_TYPENAME fname(EN_ENO_PARAMS, in1_TYPENAME IN, in2_TYPENAME N) {\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1221 |
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
|
1222 |
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
|
1223 |
} |
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 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1226 |
/* SHL */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1227 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1228 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1229 |
/* Overloaded function */\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1230 |
static inline BOOL SHL__BOOL__##TYPENAME(EN_ENO_PARAMS, BOOL IN, TYPENAME N) { \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1231 |
TEST_EN(BOOL);\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1232 |
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
|
1233 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1234 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1235 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1236 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1237 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1238 |
#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
|
1239 |
__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
|
1240 |
__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
|
1241 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1242 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1243 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1244 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1245 |
/* SHR */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1246 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1247 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1248 |
/* Overloaded function */\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1249 |
static inline BOOL SHR__BOOL__##TYPENAME(EN_ENO_PARAMS, BOOL IN, TYPENAME N) { \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1250 |
TEST_EN(BOOL);\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1251 |
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
|
1252 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1253 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1254 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1255 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1256 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1257 |
#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
|
1258 |
__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
|
1259 |
__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
|
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 |
/* ROR */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1265 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1266 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1267 |
/* Overloaded function */\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1268 |
static inline BOOL ROR__BOOL__##TYPENAME(EN_ENO_PARAMS, BOOL IN, TYPENAME N) { \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1269 |
TEST_EN(BOOL);\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1270 |
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
|
1271 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1272 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1273 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1274 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1275 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1276 |
#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
|
1277 |
static inline in1_TYPENAME ROR__##in1_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME(EN_ENO_PARAMS, in1_TYPENAME IN, in2_TYPENAME N){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1278 |
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
|
1279 |
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
|
1280 |
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
|
1281 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1282 |
__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
|
1283 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1284 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1285 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1286 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1287 |
/* ROL */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1288 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1289 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1290 |
/* Overloaded function */\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1291 |
static inline BOOL ROL__BOOL__##TYPENAME(EN_ENO_PARAMS, BOOL IN, TYPENAME N) { \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1292 |
TEST_EN(BOOL);\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1293 |
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
|
1294 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1295 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1296 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1297 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1298 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1299 |
#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
|
1300 |
static inline in1_TYPENAME ROL__##in1_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME(EN_ENO_PARAMS, in1_TYPENAME IN, in2_TYPENAME N){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1301 |
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
|
1302 |
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
|
1303 |
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
|
1304 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1305 |
__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
|
1306 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1307 |
|
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1310 |
/*********************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1311 |
/*** Table 26 ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1312 |
/*********************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1313 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1314 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1315 |
/* AND */ |
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 |
__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
|
1318 |
__arith_expand(AND__BOOL__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
|
1319 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1320 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1321 |
__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
|
1322 |
__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
|
1323 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1324 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1325 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1326 |
/*************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1327 |
/* OR */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1328 |
/*************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1329 |
__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
|
1330 |
__arith_expand(OR__BOOL__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
|
1331 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1332 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1333 |
__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
|
1334 |
__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
|
1335 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1336 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1337 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1338 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1339 |
/* XOR */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1340 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1341 |
#define __xorbool_expand(fname) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1342 |
static inline BOOL fname(EN_ENO_PARAMS, UINT param_count, BOOL op1, ...){ \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1343 |
va_list ap; \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1344 |
UINT i; \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1345 |
TEST_EN(BOOL) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1346 |
\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1347 |
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
|
1348 |
\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1349 |
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
|
1350 |
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
|
1351 |
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
|
1352 |
} \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1353 |
\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1354 |
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
|
1355 |
return op1; \ |
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1358 |
__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
|
1359 |
__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
|
1360 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1361 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1362 |
__arith_expand(XOR_##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
|
1363 |
__arith_expand(XOR__##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
|
1364 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1365 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1366 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1367 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1368 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1369 |
/* NOT */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1370 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1371 |
/* 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
|
1372 |
static inline BOOL NOT_BOOL(EN_ENO_PARAMS, BOOL op1){ |
149 | 1373 |
TEST_EN(BOOL) |
1374 |
return !op1; |
|
1375 |
} |
|
1376 |
||
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1377 |
/* Overloaded function */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1378 |
static inline BOOL NOT__BOOL__BOOL(EN_ENO_PARAMS, BOOL op1){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1379 |
TEST_EN(BOOL) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1380 |
return !op1; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1381 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1382 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1383 |
/* 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 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1385 |
static inline TYPENAME NOT_##TYPENAME(EN_ENO_PARAMS, TYPENAME op1){\ |
149 | 1386 |
TEST_EN(TYPENAME)\ |
1387 |
return ~op1;\ |
|
1388 |
} |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1389 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1390 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1391 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1392 |
/* Overloaded function */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1393 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1394 |
static inline TYPENAME NOT__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op1){\ |
149 | 1395 |
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
|
1396 |
return ~op1;\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1397 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1398 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1399 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1400 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1401 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1402 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1403 |
|
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1406 |
/***************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1407 |
/***************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1408 |
/* 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
|
1409 |
/***************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1410 |
/***************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1411 |
|
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 |
/*** Table 27 ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1414 |
/*********************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1415 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1416 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1417 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1418 |
/* SEL */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1419 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1420 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1421 |
/* 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
|
1422 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1423 |
static inline TYPENAME SEL_##TYPENAME(EN_ENO_PARAMS, BOOL G, TYPENAME op0, TYPENAME op1){\ |
149 | 1424 |
TEST_EN(TYPENAME)\ |
1425 |
return G ? op1 : op0;\ |
|
1426 |
} |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1427 |
__ANY(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1428 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1429 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1430 |
/* Overloaded function */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1431 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1432 |
static inline TYPENAME SEL__##TYPENAME##__BOOL__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, BOOL G, TYPENAME op0, TYPENAME op1){\ |
149 | 1433 |
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
|
1434 |
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
|
1435 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1436 |
__ANY(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1437 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1438 |
|
149 | 1439 |
|
1440 |
/**************/ |
|
1441 |
/* MAX */ |
|
1442 |
/**************/ |
|
1443 |
||
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
|
1444 |
#define __extrem_(fname,TYPENAME, COND) \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1445 |
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
|
1446 |
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
|
1447 |
UINT i;\ |
200 | 1448 |
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
|
1449 |
\ |
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
|
1450 |
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
|
1451 |
\ |
165
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1452 |
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
|
1453 |
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
|
1454 |
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
|
1455 |
}\ |
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
|
1456 |
\ |
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
|
1457 |
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
|
1458 |
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
|
1459 |
} |
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
|
1460 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1461 |
/* 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
|
1462 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1463 |
__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
|
1464 |
__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
|
1465 |
__ANY_BIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1466 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1467 |
#undef __iec_ |
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 |
/* 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
|
1470 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1471 |
__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
|
1472 |
__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
|
1473 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1474 |
__iec_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1475 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1476 |
|
378
7f2e120c7352
moved declaration __STR_CMP to prevent warning
Edouard Tisserant
parents:
375
diff
changeset
|
1477 |
#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
|
1478 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1479 |
/* 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
|
1480 |
__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
|
1481 |
__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
|
1482 |
|
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
|
1483 |
/**************/ |
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
|
1484 |
/* 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
|
1485 |
/**************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1486 |
/* 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
|
1487 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1488 |
__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
|
1489 |
__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
|
1490 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1491 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1492 |
#undef __iec_ |
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 |
/* 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
|
1495 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1496 |
__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
|
1497 |
__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
|
1498 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1499 |
__iec_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1500 |
#undef __iec_ |
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 |
/* 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
|
1503 |
__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
|
1504 |
__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
|
1505 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1506 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1507 |
/* LIMIT */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1508 |
/**************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1509 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1510 |
/* 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
|
1511 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1512 |
/* 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
|
1513 |
static inline TYPENAME LIMIT_##TYPENAME(EN_ENO_PARAMS, TYPENAME MN, TYPENAME IN, TYPENAME MX){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1514 |
TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1515 |
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
|
1516 |
}\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1517 |
/* Overloaded function */\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1518 |
static inline TYPENAME LIMIT__##TYPENAME##__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME MN, TYPENAME IN, TYPENAME MX){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1519 |
TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1520 |
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
|
1521 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1522 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1523 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1524 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1525 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1526 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1527 |
/* 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
|
1528 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1529 |
/* 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
|
1530 |
static inline TYPENAME LIMIT_##TYPENAME(EN_ENO_PARAMS, TYPENAME MN, TYPENAME IN, TYPENAME MX){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1531 |
TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1532 |
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
|
1533 |
__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
|
1534 |
IN : MX : MN;\ |
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 |
/* Overloaded function */\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1537 |
static inline TYPENAME LIMIT__##TYPENAME##__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME MN, TYPENAME IN, TYPENAME MX){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1538 |
TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1539 |
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
|
1540 |
__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
|
1541 |
IN : MX : MN;\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1542 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1543 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1544 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1545 |
__iec_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1546 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1547 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1548 |
/* 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
|
1549 |
/* 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
|
1550 |
static inline STRING LIMIT_STRING(EN_ENO_PARAMS, STRING MN, STRING IN, STRING MX){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1551 |
TEST_EN(STRING) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1552 |
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
|
1553 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1554 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1555 |
/* Overloaded function */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1556 |
static inline STRING LIMIT__STRING__STRING__STRING__STRING(EN_ENO_PARAMS, STRING MN, STRING IN, STRING MX){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1557 |
TEST_EN(STRING) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1558 |
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
|
1559 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1560 |
|
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
|
1561 |
|
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
|
1562 |
/**************/ |
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
|
1563 |
/* 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
|
1564 |
/**************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1565 |
/* 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
|
1566 |
* 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
|
1567 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1568 |
/* 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
|
1569 |
#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
|
1570 |
#define __iec_(in1_TYPENAME,in2_TYPENAME) \ |
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1571 |
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
|
1572 |
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
|
1573 |
UINT i;\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1574 |
in2_TYPENAME tmp;\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1575 |
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
|
1576 |
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
|
1577 |
\ |
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1578 |
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
|
1579 |
\ |
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
|
1580 |
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
|
1581 |
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
|
1582 |
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
|
1583 |
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
|
1584 |
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
|
1585 |
}else{\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1586 |
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
|
1587 |
}\ |
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
|
1588 |
}\ |
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
|
1589 |
\ |
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
|
1590 |
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
|
1591 |
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
|
1592 |
} |
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
|
1593 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1594 |
__ANY(__in1_anyint_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1595 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1596 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1597 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1598 |
/******************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1599 |
/*** Table 28 ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1600 |
/*** Standard comparison functions ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1601 |
/******************************************/ |
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
|
1602 |
|
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
|
1603 |
#define __compare_(fname,TYPENAME, COND) \ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1604 |
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
|
1605 |
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
|
1606 |
UINT i;\ |
200 | 1607 |
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
|
1608 |
\ |
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
|
1609 |
va_start (ap, op1); /* Initialize the argument list. */\ |
43 | 1610 |
DBG(#fname #TYPENAME "\n")\ |
1611 |
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
|
1612 |
\ |
43 | 1613 |
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
|
1614 |
TYPENAME tmp = va_arg (ap, VA_ARGS_##TYPENAME);\ |
43 | 1615 |
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
|
1616 |
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
|
1617 |
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
|
1618 |
}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
|
1619 |
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
|
1620 |
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
|
1621 |
}\ |
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
|
1622 |
}\ |
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
|
1623 |
\ |
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
|
1624 |
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
|
1625 |
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
|
1626 |
} |
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
|
1627 |
|
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
|
1628 |
#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
|
1629 |
#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
|
1630 |
#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
|
1631 |
|
149 | 1632 |
|
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
|
1633 |
/**************/ |
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
|
1634 |
/* 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
|
1635 |
/**************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1636 |
/* 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
|
1637 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1638 |
__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
|
1639 |
__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
|
1640 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1641 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1642 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1643 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1644 |
/* 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
|
1645 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1646 |
__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
|
1647 |
__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
|
1648 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1649 |
__iec_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1650 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1651 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1652 |
/* 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
|
1653 |
__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
|
1654 |
__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
|
1655 |
|
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
|
1656 |
/**************/ |
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
|
1657 |
/* 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
|
1658 |
/**************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1659 |
/* 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
|
1660 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1661 |
__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
|
1662 |
__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
|
1663 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1664 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1665 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1666 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1667 |
/* 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
|
1668 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1669 |
__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
|
1670 |
__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
|
1671 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1672 |
__iec_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1673 |
#undef __iec_ |
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 |
/* 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
|
1676 |
__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
|
1677 |
__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
|
1678 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1679 |
|
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
|
1680 |
|
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
|
1681 |
/**************/ |
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
|
1682 |
/* 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
|
1683 |
/**************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1684 |
/* 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
|
1685 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1686 |
__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
|
1687 |
__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
|
1688 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1689 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1690 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1691 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1692 |
/* 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
|
1693 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1694 |
__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
|
1695 |
__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
|
1696 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1697 |
__iec_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1698 |
#undef __iec_ |
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 |
/* 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
|
1701 |
__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
|
1702 |
__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
|
1703 |
|
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
|
1704 |
|
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
|
1705 |
/**************/ |
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
|
1706 |
/* 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
|
1707 |
/**************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1708 |
/* 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
|
1709 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1710 |
__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
|
1711 |
__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
|
1712 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1713 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1714 |
#undef __iec_ |
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 |
/* 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
|
1717 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1718 |
__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
|
1719 |
__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
|
1720 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1721 |
__iec_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1722 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1723 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1724 |
/* 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
|
1725 |
__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
|
1726 |
__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
|
1727 |
|
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
|
1728 |
|
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
|
1729 |
/**************/ |
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
|
1730 |
/* 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
|
1731 |
/**************/ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1732 |
/* 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
|
1733 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1734 |
__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
|
1735 |
__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
|
1736 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1737 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1738 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1739 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1740 |
/* 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
|
1741 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1742 |
__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
|
1743 |
__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
|
1744 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1745 |
__iec_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1746 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1747 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1748 |
/* 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
|
1749 |
__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
|
1750 |
__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
|
1751 |
|
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
|
1752 |
|
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
|
1753 |
/**************/ |
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
|
1754 |
/* 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
|
1755 |
/**************/ |
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1756 |
#define __ne_num(fname, TYPENAME) \ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1757 |
static inline BOOL fname(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1758 |
TEST_EN(BOOL)\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1759 |
return op1 != op2 ? 1 : 0;\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1760 |
} |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1761 |
|
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1762 |
#define __ne_time(fname, TYPENAME) \ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1763 |
static inline BOOL fname(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1764 |
TEST_EN(BOOL)\ |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1765 |
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
|
1766 |
} |
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1767 |
|
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1768 |
|
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1769 |
/* 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
|
1770 |
#define __iec_(TYPENAME) \ |
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1771 |
__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
|
1772 |
__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
|
1773 |
__ANY_NBIT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1774 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1775 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1776 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1777 |
/* 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
|
1778 |
#define __iec_(TYPENAME) \ |
398
f1f3facc59e7
Fix issues in standard library with MUX, MOD, NE and convertions to BOOL
laurent
parents:
393
diff
changeset
|
1779 |
__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
|
1780 |
__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
|
1781 |
__ANY_DATE(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1782 |
__iec_(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1783 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1784 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1785 |
/* 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
|
1786 |
__compare_string(NE_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
|
1787 |
__compare_string(NE__BOOL__STRING__STRING, != ) /* Overloaded function */ |
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1790 |
|
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1793 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1794 |
/*********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1795 |
/*********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1796 |
/* 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
|
1797 |
/*********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1798 |
/*********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1799 |
|
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 |
/*** Table 29 ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1802 |
/*** Character string Functions ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1803 |
/*************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1804 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1805 |
/* 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
|
1806 |
* 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
|
1807 |
*/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1808 |
|
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 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1811 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1812 |
/***************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1813 |
/* LEN */ |
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 |
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
|
1816 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1817 |
/* 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
|
1818 |
#define __genoper_1p_(fname,ret_TYPENAME, par_TYPENAME, OPERATION) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1819 |
static inline ret_TYPENAME fname(EN_ENO_PARAMS, par_TYPENAME par1){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1820 |
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
|
1821 |
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
|
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 |
#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
|
1825 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1826 |
#undef __iec_ |
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 |
/****************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1830 |
/* LEFT */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1831 |
/****************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1832 |
|
384
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1833 |
#define __left(TYPENAME) \ |
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1834 |
static inline STRING LEFT__STRING__STRING__##TYPENAME(EN_ENO_PARAMS, STRING IN, TYPENAME L){\ |
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1835 |
STRING res;\ |
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1836 |
TEST_EN_COND(STRING, L < 0)\ |
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1837 |
res = __INIT_STRING;\ |
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1838 |
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
|
1839 |
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
|
1840 |
res.len = (__strlen_t)L;\ |
384
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1841 |
return res;\ |
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1842 |
} |
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1843 |
__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
|
1844 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1845 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1846 |
/*****************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1847 |
/* RIGHT */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1848 |
/*****************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1849 |
|
379
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1850 |
#define __right(TYPENAME) \ |
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1851 |
static inline STRING RIGHT__STRING__STRING__##TYPENAME(EN_ENO_PARAMS, STRING IN, TYPENAME L){\ |
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1852 |
STRING res;\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1853 |
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
|
1854 |
res = __INIT_STRING;\ |
384
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1855 |
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
|
1856 |
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
|
1857 |
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
|
1858 |
return res;\ |
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1859 |
} |
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1860 |
__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
|
1861 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1862 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1863 |
/***************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1864 |
/* MID */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1865 |
/***************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1866 |
|
379
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1867 |
#define __mid(TYPENAME) \ |
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1868 |
static inline STRING MID__STRING__STRING__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, STRING IN, TYPENAME L, TYPENAME P){\ |
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1869 |
STRING res;\ |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1870 |
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
|
1871 |
res = __INIT_STRING;\ |
384
4626828277f9
fixed signedness warning on string slicing funcs in std lib
Edouard Tisserant
parents:
379
diff
changeset
|
1872 |
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
|
1873 |
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
|
1874 |
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
|
1875 |
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
|
1876 |
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
|
1877 |
}\ |
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1878 |
return res;\ |
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1879 |
} |
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1880 |
__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
|
1881 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1882 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1883 |
/******************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1884 |
/* CONCAT */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1885 |
/******************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1886 |
|
379
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1887 |
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
|
1888 |
UINT i; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1889 |
STRING res; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1890 |
va_list ap; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1891 |
__strlen_t charcount; |
379
7dc97c825bb8
Fix bug in definition of CONCAT standard function in iec_std_lib.h
laurent
parents:
378
diff
changeset
|
1892 |
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
|
1893 |
charcount = 0; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1894 |
res = __INIT_STRING; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1895 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1896 |
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
|
1897 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1898 |
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
|
1899 |
{ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1900 |
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
|
1901 |
__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
|
1902 |
__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
|
1903 |
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
|
1904 |
charcount += to_write; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1905 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1906 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1907 |
res.len = charcount; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1908 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1909 |
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
|
1910 |
return res; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1911 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1912 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1913 |
/******************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1914 |
/* INSERT */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1915 |
/******************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1916 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1917 |
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
|
1918 |
STRING res; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1919 |
__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
|
1920 |
res = __INIT_STRING; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1921 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1922 |
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
|
1923 |
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
|
1924 |
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
|
1925 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1926 |
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
|
1927 |
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
|
1928 |
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
|
1929 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1930 |
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
|
1931 |
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
|
1932 |
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
|
1933 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1934 |
return res; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1935 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1936 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1937 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1938 |
static inline STRING INSERT__STRING__STRING__STRING__##TYPENAME(EN_ENO_PARAMS, STRING str1, STRING str2, TYPENAME P){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1939 |
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
|
1940 |
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
|
1941 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1942 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1943 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1944 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1945 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1946 |
/******************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1947 |
/* DELETE */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1948 |
/******************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1949 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1950 |
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
|
1951 |
STRING res; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1952 |
__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
|
1953 |
res = __INIT_STRING; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1954 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1955 |
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
|
1956 |
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
|
1957 |
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
|
1958 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1959 |
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
|
1960 |
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
|
1961 |
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
|
1962 |
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
|
1963 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1964 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1965 |
return res; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1966 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1967 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1968 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1969 |
static inline STRING DELETE__STRING__STRING__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, STRING str, TYPENAME L, TYPENAME P){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1970 |
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
|
1971 |
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
|
1972 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1973 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1974 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1975 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1976 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1977 |
/*******************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1978 |
/* REPLACE */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1979 |
/*******************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1980 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1981 |
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
|
1982 |
STRING res; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1983 |
__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
|
1984 |
res = __INIT_STRING; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1985 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1986 |
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
|
1987 |
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
|
1988 |
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
|
1989 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1990 |
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
|
1991 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1992 |
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
|
1993 |
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
|
1994 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1995 |
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
|
1996 |
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
|
1997 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1998 |
P += L; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
1999 |
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
|
2000 |
{ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2001 |
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
|
2002 |
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
|
2003 |
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
|
2004 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2005 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2006 |
return res; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2007 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2008 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2009 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2010 |
static inline STRING REPLACE__STRING__STRING__STRING__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, STRING str1, STRING str2, TYPENAME L, TYPENAME P){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2011 |
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
|
2012 |
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
|
2013 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2014 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2015 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2016 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2017 |
/****************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2018 |
/* FIND */ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2019 |
/****************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2020 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2021 |
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
|
2022 |
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
|
2023 |
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
|
2024 |
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
|
2025 |
{ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2026 |
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
|
2027 |
count1 += count2 + 1; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2028 |
count2 = 0; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2029 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2030 |
else { |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2031 |
count2++; |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2032 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2033 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2034 |
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
|
2035 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2036 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2037 |
#define __iec_(TYPENAME) \ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2038 |
static inline TYPENAME FIND__##TYPENAME##__STRING__STRING(EN_ENO_PARAMS, STRING str1, STRING str2){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2039 |
TEST_EN(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2040 |
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
|
2041 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2042 |
__ANY_INT(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2043 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2044 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2045 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2046 |
/*********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2047 |
/*********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2048 |
/* 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
|
2049 |
/*********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2050 |
/*********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2051 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2052 |
/**************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2053 |
/*** Table 30 ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2054 |
/*** 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
|
2055 |
/**************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2056 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2057 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2058 |
static inline TIME ADD_TIME(EN_ENO_PARAMS, TIME IN1, TIME IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2059 |
TEST_EN(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2060 |
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
|
2061 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2062 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2063 |
static inline TOD ADD_TOD_TIME(EN_ENO_PARAMS, TOD IN1, TIME IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2064 |
TEST_EN(TOD) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2065 |
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
|
2066 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2067 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2068 |
static inline DT ADD_DT_TIME(EN_ENO_PARAMS, DT IN1, TIME IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2069 |
TEST_EN(DT) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2070 |
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
|
2071 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2072 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2073 |
static inline TIME SUB_TIME(EN_ENO_PARAMS, TIME IN1, TIME IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2074 |
TEST_EN(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2075 |
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
|
2076 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2077 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2078 |
static inline TIME SUB_DATE_DATE(EN_ENO_PARAMS, DATE IN1, DATE IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2079 |
TEST_EN(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2080 |
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
|
2081 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2082 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2083 |
static inline TOD SUB_TOD_TIME(EN_ENO_PARAMS, TOD IN1, TIME IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2084 |
TEST_EN(TOD) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2085 |
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
|
2086 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2087 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2088 |
static inline TIME SUB_TOD_TOD(EN_ENO_PARAMS, TOD IN1, TOD IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2089 |
TEST_EN(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2090 |
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
|
2091 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2092 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2093 |
static inline DT SUB_DT_TIME(EN_ENO_PARAMS, DT IN1, TIME IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2094 |
TEST_EN(DT) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2095 |
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
|
2096 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2097 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2098 |
static inline TIME SUB_DT_DT(EN_ENO_PARAMS, DT IN1, DT IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2099 |
TEST_EN(TIME) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2100 |
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
|
2101 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2102 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2103 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2104 |
/*** MULTIME ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2105 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2106 |
static inline TIME MULTIME__TIME__TIME__##TYPENAME(EN_ENO_PARAMS, TIME IN1, TYPENAME IN2){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2107 |
TEST_EN(TIME)\ |
696
7530eae6786d
Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents:
625
diff
changeset
|
2108 |
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
|
2109 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2110 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2111 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2112 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2113 |
/*** MUL ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2114 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2115 |
static inline TIME MUL__TIME__TIME__##TYPENAME(EN_ENO_PARAMS, TIME IN1, TYPENAME IN2){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2116 |
TEST_EN(TIME)\ |
696
7530eae6786d
Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents:
625
diff
changeset
|
2117 |
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
|
2118 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2119 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2120 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2121 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2122 |
/*** DIVTIME ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2123 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2124 |
static inline TIME DIVTIME__TIME__TIME__##TYPENAME(EN_ENO_PARAMS, TIME IN1, TYPENAME IN2){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2125 |
TEST_EN(TIME)\ |
696
7530eae6786d
Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents:
625
diff
changeset
|
2126 |
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
|
2127 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2128 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2129 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2130 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2131 |
/*** DIV ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2132 |
#define __iec_(TYPENAME)\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2133 |
static inline TIME DIV__TIME__TIME__##TYPENAME(EN_ENO_PARAMS, TIME IN1, TYPENAME IN2){\ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2134 |
TEST_EN(TIME)\ |
696
7530eae6786d
Removing several warning in iec_std_lib.h
Manuele Conti <conti.ma@alice.it>
parents:
625
diff
changeset
|
2135 |
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
|
2136 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2137 |
__ANY_NUM(__iec_) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2138 |
#undef __iec_ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2139 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2140 |
/*** CONCAT_DATE_TOD ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2141 |
static inline DT CONCAT_DATE_TOD(EN_ENO_PARAMS, DATE IN1, TOD IN2){ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2142 |
TEST_EN(DT) |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2143 |
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
|
2144 |
} |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2145 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2146 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2147 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2148 |
/****************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2149 |
/****************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2150 |
/* 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
|
2151 |
/****************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2152 |
/****************************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2153 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2154 |
/********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2155 |
/*** Table 31 ***/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2156 |
/*** 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
|
2157 |
/********************************************/ |
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2158 |
|
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
314
diff
changeset
|
2159 |
/* Do we support this? */ |