author | lbessard |
Wed, 10 Jun 2009 13:20:52 +0200 | |
changeset 191 | 0941a912dcae |
parent 187 | f2cd0b5236f7 |
child 199 | b075f28ec081 |
permissions | -rw-r--r-- |
107 | 1 |
/* |
2 |
* (c) 2008 Edouard TISSERANT |
|
3 |
* |
|
4 |
* Offered to the public under the terms of the GNU Lesser General Public |
|
5 |
* License as published by the Free Software Foundation; either version 2 |
|
6 |
* of the License, or (at your option) any later version. |
|
7 |
* |
|
8 |
* This program is distributed in the hope that it will be useful, but |
|
9 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
|
11 |
* General Public License for more details. |
|
12 |
* |
|
13 |
* This code is made available on the understanding that it will not be |
|
14 |
* used in safety-critical situations without a full and competent review. |
|
15 |
*/ |
|
16 |
||
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
|
17 |
/**** |
107 | 18 |
* 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
|
19 |
*/ |
873a5b60a7ea
Fixed -I 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 |
#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
|
22 |
#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
|
23 |
#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
|
24 |
#include <time.h> |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
25 |
#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
|
26 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
27 |
#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
|
28 |
#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
|
29 |
#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
|
30 |
#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
|
31 |
|
43 | 32 |
#ifdef DEBUG_IEC |
33 |
#define DBG(...) printf(__VA_ARGS__); |
|
34 |
#define DBG_TYPE(TYPENAME, name) __print_##TYPENAME(name); |
|
35 |
#else |
|
36 |
#define DBG(...) |
|
37 |
#define DBG_TYPE(TYPENAME, name) |
|
38 |
#endif |
|
39 |
||
137
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
40 |
/* |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
41 |
* Include type defs. |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
42 |
*/ |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
43 |
#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
|
44 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
45 |
extern TIME __CURRENT_TIME; |
140
8c0366d41e84
Added __DEBUG global var to eventually change PLC code execution
etisserant
parents:
137
diff
changeset
|
46 |
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
|
47 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
48 |
/* 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
|
49 |
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
|
50 |
__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
|
51 |
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
|
52 |
} 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
|
53 |
*/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
54 |
|
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
55 |
# if __WORDSIZE == 64 |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
56 |
#define __32b_sufix |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
57 |
#define __64b_sufix L |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
58 |
#else |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
59 |
#define __32b_sufix L |
180 | 60 |
#define __64b_sufix LL |
61 |
#endif |
|
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
62 |
|
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
63 |
#define __lit(type,value,sfx) (type)value##sfx |
180 | 64 |
// Keep this macro expention step to let sfx change into L or LL |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
65 |
#define __literal(type,value,sfx) __lit(type,value,sfx) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
66 |
|
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
67 |
#define __BOOL_LITERAL(value) __literal(BOOL,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
68 |
#define __SINT_LITERAL(value) __literal(SINT,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
69 |
#define __INT_LITERAL(value) __literal(INT,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
70 |
#define __DINT_LITERAL(value) __literal(DINT,value,__32b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
71 |
#define __LINT_LITERAL(value) __literal(LINT,value,__64b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
72 |
#define __USINT_LITERAL(value) __literal(USINT,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
73 |
#define __UINT_LITERAL(value) __literal(UINT,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
74 |
#define __UDINT_LITERAL(value) __literal(UDINT,value,__32b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
75 |
#define __ULINT_LITERAL(value) __literal(ULINT,value,__64b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
76 |
#define __REAL_LITERAL(value) __literal(REAL,value,__32b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
77 |
#define __LREAL_LITERAL(value) __literal(LREAL,value,__64b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
78 |
#define __TIME_LITERAL(value) __literal(TIME,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
79 |
#define __DATE_LITERAL(value) __literal(DATE,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
80 |
#define __TOD_LITERAL(value) __literal(TOD,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
81 |
#define __DT_LITERAL(value) __literal(DT,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
82 |
#define __STRING_LITERAL(value) __literal(STRING,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
83 |
#define __BYTE_LITERAL(value) __literal(BYTE,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
84 |
#define __WORD_LITERAL(value) __literal(WORD,value,) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
85 |
#define __DWORD_LITERAL(value) __literal(DWORD,value,__32b_sufix) |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
86 |
#define __LWORD_LITERAL(value) __literal(LWORD,value,__32b_sufix) |
55
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
48
diff
changeset
|
87 |
|
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
48
diff
changeset
|
88 |
|
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
48
diff
changeset
|
89 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
90 |
#define __INIT_REAL 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
91 |
#define __INIT_LREAL 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
92 |
#define __INIT_SINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
93 |
#define __INIT_INT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
94 |
#define __INIT_DINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
95 |
#define __INIT_LINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
96 |
#define __INIT_USINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
97 |
#define __INIT_UINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
98 |
#define __INIT_UDINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
99 |
#define __INIT_ULINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
100 |
#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
|
101 |
#define __INIT_BOOL 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
102 |
#define __INIT_BYTE 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
103 |
#define __INIT_WORD 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
104 |
#define __INIT_DWORD 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
105 |
#define __INIT_LWORD 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
106 |
#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
|
107 |
//#define __INIT_WSTRING |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
108 |
#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
|
109 |
#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
|
110 |
#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
|
111 |
|
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
|
112 |
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
|
113 |
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
|
114 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
115 |
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
|
116 |
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
|
117 |
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
|
118 |
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
|
119 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
120 |
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
|
121 |
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
|
122 |
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
|
123 |
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
|
124 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
125 |
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
|
126 |
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
|
127 |
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
|
128 |
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
|
129 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
130 |
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
|
131 |
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
|
132 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
134 |
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
|
135 |
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
|
136 |
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
|
137 |
} __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
|
138 |
|
873a5b60a7ea
Fixed -I 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 |
/*****************/ |
873a5b60a7ea
Fixed -I 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 |
/* Misc internal */ |
873a5b60a7ea
Fixed -I 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 |
/*****************/ |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
/* function that generates an IEC runtime error */ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
144 |
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
|
145 |
/* 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
|
146 |
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
|
147 |
/*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
|
148 |
} |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
static inline void __normalize_timespec (struct timespec *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
|
152 |
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
|
153 |
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
|
154 |
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
|
155 |
} |
873a5b60a7ea
Fixed -I 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 |
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
|
157 |
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
|
158 |
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
|
159 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
160 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
161 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
162 |
static inline struct timespec __time_to_timespec(int sign, double mseconds, double seconds, double minutes, double hours, double days) { |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
163 |
struct timespec ts; |
180 | 164 |
|
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
|
165 |
/* 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
|
166 |
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
|
167 |
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
|
168 |
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
|
169 |
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
|
170 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
171 |
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
|
172 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
173 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
174 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
175 |
static inline struct timespec __tod_to_timespec(double seconds, double minutes, double hours) { |
873a5b60a7ea
Fixed -I 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 |
struct timespec ts; |
180 | 177 |
|
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
|
178 |
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
|
179 |
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
|
180 |
ts.tv_nsec = (long int)((total_sec - ts.tv_sec)*1e9); |
180 | 181 |
|
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
|
182 |
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
|
183 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
184 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
185 |
static inline struct timespec __date_to_timespec(int day, int month, int year) { |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
186 |
struct timespec 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
|
187 |
struct tm broken_down_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
|
188 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
190 |
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
|
191 |
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
|
192 |
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
|
193 |
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
|
194 |
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
|
195 |
|
873a5b60a7ea
Fixed -I 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 |
time_t epoch_seconds = mktime(&broken_down_time); /* determine number of seconds since the epoch, i.e. Jan 1st 1970 */ |
873a5b60a7ea
Fixed -I 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 |
if ((time_t)(-1) == 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
|
199 |
IEC_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
|
200 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
201 |
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
|
202 |
ts.tv_nsec = 0; |
180 | 203 |
|
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
|
204 |
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
|
205 |
} |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
static inline struct timespec __dt_to_timespec(double seconds, double minutes, double hours, int day, int month, int year) { |
873a5b60a7ea
Fixed -I 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 |
struct timespec ts; |
180 | 209 |
|
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
|
210 |
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
|
211 |
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
|
212 |
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
|
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 |
struct tm broken_down_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
|
215 |
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
|
216 |
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
|
217 |
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
|
218 |
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
|
219 |
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
|
220 |
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
|
221 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
222 |
time_t epoch_seconds = mktime(&broken_down_time); /* determine number of seconds since the epoch, i.e. Jan 1st 1970 */ |
873a5b60a7ea
Fixed -I 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 |
if ((time_t)(-1) == 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
|
224 |
IEC_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
|
225 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
226 |
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
|
227 |
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
|
228 |
/* since the TOD is always positive, if the above happens then we had an overflow */ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
229 |
IEC_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
|
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 |
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
|
232 |
} |
873a5b60a7ea
Fixed -I 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 |
|
149 | 234 |
/********************/ |
235 |
/* EN/ENO PARAMS */ |
|
236 |
/********************/ |
|
237 |
||
238 |
#define EN_ENO_PARAMS BOOL EN, BOOL *ENO |
|
239 |
#define TEST_EN(TYPENAME)\ |
|
240 |
if (!EN) {\ |
|
241 |
if (ENO != NULL)\ |
|
242 |
*ENO = __BOOL_LITERAL(FALSE);\ |
|
243 |
return __INIT_##TYPENAME;\ |
|
244 |
}\ |
|
245 |
else if (ENO != NULL)\ |
|
246 |
*ENO = __BOOL_LITERAL(TRUE); |
|
247 |
#define TEST_EN_COND(TYPENAME, COND)\ |
|
248 |
if (!EN || (COND)) {\ |
|
249 |
if (ENO != NULL)\ |
|
250 |
*ENO = __BOOL_LITERAL(FALSE);\ |
|
251 |
return __INIT_##TYPENAME;\ |
|
252 |
}\ |
|
253 |
else if (ENO != NULL)\ |
|
254 |
*ENO = __BOOL_LITERAL(TRUE); |
|
255 |
||
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
|
256 |
/***************/ |
873a5b60a7ea
Fixed -I 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 |
/* Time ops */ |
873a5b60a7ea
Fixed -I 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 |
/***************/ |
180 | 259 |
#define __TIME_CMP(t1, t2) (t2.tv_sec == t1.tv_sec ? t1.tv_nsec - t2.tv_nsec : t1.tv_sec - t2.tv_sec) |
149 | 260 |
|
261 |
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
|
262 |
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
|
263 |
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
|
264 |
__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
|
265 |
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
|
266 |
} |
149 | 267 |
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
|
268 |
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
|
269 |
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
|
270 |
__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
|
271 |
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
|
272 |
} |
149 | 273 |
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
|
274 |
LREAL s_f = IN1.tv_sec * IN2; |
873a5b60a7ea
Fixed -I 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 |
time_t s = s_f; |
873a5b60a7ea
Fixed -I 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 |
div_t ns = div((LREAL)IN1.tv_nsec * IN2, 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
|
277 |
TIME res = {s + ns.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
|
278 |
ns.rem + (s_f - s) * 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
|
279 |
__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
|
280 |
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
|
281 |
} |
149 | 282 |
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
|
283 |
LREAL s_f = IN1.tv_sec / IN2; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
284 |
time_t s = s_f; |
873a5b60a7ea
Fixed -I 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 = {s, |
873a5b60a7ea
Fixed -I 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 + (s_f - s) * 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
|
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 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
290 |
|
149 | 291 |
static inline TIME __date_and_time_to_time_of_day(EN_ENO_PARAMS, TIME IN){ |
292 |
TEST_EN(TIME) |
|
293 |
return (TIME){IN.tv_sec % 86400, IN.tv_nsec}; |
|
294 |
} |
|
295 |
static inline TIME __date_and_time_to_date(EN_ENO_PARAMS, TIME IN){ |
|
296 |
TEST_EN(TIME) |
|
297 |
return (TIME){IN.tv_sec - (IN.tv_sec % (24*60*60)), 0}; |
|
298 |
} |
|
299 |
static inline TIME __time_add(EN_ENO_PARAMS, TIME IN1, TIME IN2){ |
|
300 |
TEST_EN(TIME) |
|
301 |
return __TIME_ADD(IN1, IN2); |
|
302 |
} |
|
303 |
static inline TIME __time_sub(EN_ENO_PARAMS, TIME IN1, TIME IN2){ |
|
304 |
TEST_EN(TIME) |
|
305 |
return __TIME_SUB(IN1, IN2); |
|
306 |
} |
|
307 |
static inline TIME __time_mul(EN_ENO_PARAMS, TIME IN1, LREAL IN2){ |
|
308 |
TEST_EN(TIME) |
|
309 |
return __TIME_MUL(IN1, IN2); |
|
310 |
} |
|
311 |
static inline TIME __time_div(EN_ENO_PARAMS, TIME IN1, LREAL IN2){ |
|
312 |
TEST_EN(TIME) |
|
313 |
return __TIME_DIV(IN1, IN2); |
|
314 |
} |
|
315 |
||
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
|
316 |
/***************/ |
873a5b60a7ea
Fixed -I 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 |
/* String ops */ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
318 |
/***************/ |
149 | 319 |
#define __STR_CMP(str1, str2) memcmp((char*)&str1.body,(char*)&str2.body, str1.len < str2.len ? str1.len : str2.len) |
320 |
||
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
321 |
static inline __strlen_t __len(EN_ENO_PARAMS, STRING IN){ |
149 | 322 |
TEST_EN(UINT) |
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
|
323 |
return IN.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
|
324 |
} |
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
325 |
static inline STRING __left(EN_ENO_PARAMS, STRING IN, __strlen_t L){ |
149 | 326 |
TEST_EN_COND(STRING, L < 0) |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
327 |
STRING res = __INIT_STRING; |
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
|
328 |
L = L < IN.len ? L : IN.len; |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
329 |
memcpy(&res.body, &IN.body, 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
|
330 |
res.len = 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
|
331 |
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
|
332 |
} |
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
333 |
static inline STRING __right(EN_ENO_PARAMS, STRING IN, __strlen_t L){ |
149 | 334 |
TEST_EN_COND(STRING, L < 0) |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
335 |
STRING res = __INIT_STRING; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
336 |
L = L < IN.len ? L : IN.len; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
337 |
memcpy(&res.body, &IN.body[IN.len - L], L); |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
338 |
res.len = L; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
339 |
return res; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
340 |
} |
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
341 |
static inline STRING __mid(EN_ENO_PARAMS, STRING IN, __strlen_t L, __strlen_t P){ |
149 | 342 |
TEST_EN_COND(STRING, L < 0 || P < 0) |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
343 |
STRING res = __INIT_STRING; |
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
|
344 |
if(P <= IN.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
|
345 |
P -= 1; /* now can be used as [index]*/ |
873a5b60a7ea
Fixed -I 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 |
L = L + P <= IN.len ? L : IN.len - P; |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
347 |
memcpy(&res.body, &IN.body[P] , 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
|
348 |
res.len = 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
|
349 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
350 |
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
|
351 |
} |
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
352 |
static inline STRING __concat(EN_ENO_PARAMS, UINT param_count, ...){ |
149 | 353 |
TEST_EN(STRING) |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
354 |
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
|
355 |
UINT 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
|
356 |
__strlen_t charcount = 0; |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
357 |
STRING res = __INIT_STRING; |
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
|
358 |
|
873a5b60a7ea
Fixed -I 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 |
va_start (ap, param_count); /* 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
|
360 |
|
873a5b60a7ea
Fixed -I 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 |
for (i = 0; i < param_count && charcount < STR_MAX_LEN; 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
|
362 |
{ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
363 |
STRING tmp = va_arg(ap, 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
|
364 |
__strlen_t charrem = STR_MAX_LEN - charcount; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
365 |
__strlen_t to_write = tmp.len > charrem ? charrem : tmp.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
|
366 |
memcpy(&res.body[charcount], &tmp.body , to_write); |
873a5b60a7ea
Fixed -I 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 |
charcount += to_write; |
873a5b60a7ea
Fixed -I 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 |
res.len = charcount; |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
372 |
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
|
373 |
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
|
374 |
} |
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
375 |
static inline STRING __insert(EN_ENO_PARAMS, STRING IN1, STRING IN2, __strlen_t P){ |
149 | 376 |
TEST_EN_COND(STRING, P < 0) |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
377 |
STRING res = __INIT_STRING; |
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
|
378 |
__strlen_t to_copy; |
180 | 379 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
380 |
to_copy = P > IN1.len ? IN1.len : P - 1; |
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 |
memcpy(&res.body, &IN1.body , to_copy); |
873a5b60a7ea
Fixed -I 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 |
P = res.len = to_copy; |
180 | 383 |
|
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
|
384 |
to_copy = IN2.len + res.len > STR_MAX_LEN ? STR_MAX_LEN - res.len : IN2.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
|
385 |
memcpy(&res.body[res.len], &IN2.body , to_copy); |
873a5b60a7ea
Fixed -I 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 |
res.len += to_copy; |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
to_copy = IN1.len - P < STR_MAX_LEN - res.len ? IN1.len - P : STR_MAX_LEN - res.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
|
389 |
memcpy(&res.body[res.len], &IN1.body[P] , to_copy); |
873a5b60a7ea
Fixed -I 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 |
res.len += to_copy; |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
393 |
} |
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
394 |
static inline STRING __delete(EN_ENO_PARAMS, STRING IN, __strlen_t L, __strlen_t P){ |
149 | 395 |
TEST_EN_COND(STRING, L < 0 || P < 0) |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
396 |
STRING res = __INIT_STRING; |
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
|
397 |
__strlen_t to_copy; |
180 | 398 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
399 |
to_copy = P > IN.len ? IN.len : P-1; |
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
|
400 |
memcpy(&res.body, &IN.body , to_copy); |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
401 |
P = res.len = to_copy; |
873a5b60a7ea
Fixed -I 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 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
403 |
if( IN.len > P + L ){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
404 |
to_copy = IN.len - P - L; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
405 |
memcpy(&res.body[res.len], &IN.body[P + L], to_copy); |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
406 |
res.len += to_copy; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
407 |
} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
408 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
409 |
return res; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
410 |
} |
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
411 |
static inline STRING __replace(EN_ENO_PARAMS, STRING IN1, STRING IN2, __strlen_t L, __strlen_t P){ |
149 | 412 |
TEST_EN_COND(STRING, L < 0 || P < 0) |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
413 |
STRING res = __INIT_STRING; |
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 |
__strlen_t to_copy; |
180 | 415 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
416 |
to_copy = P > IN1.len ? IN1.len : P-1; |
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
|
417 |
memcpy(&res.body, &IN1.body , to_copy); |
873a5b60a7ea
Fixed -I 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 |
P = res.len = to_copy; |
180 | 419 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
420 |
to_copy = IN2.len < L ? IN2.len : L; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
421 |
|
180 | 422 |
if( to_copy + res.len > STR_MAX_LEN ) |
423 |
to_copy = STR_MAX_LEN - res.len; |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
424 |
|
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
|
425 |
memcpy(&res.body[res.len], &IN2.body , to_copy); |
873a5b60a7ea
Fixed -I 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 |
res.len += to_copy; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
427 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
428 |
P += L; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
429 |
if( res.len < STR_MAX_LEN && P < IN1.len) |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
430 |
{ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
431 |
to_copy = IN1.len - P; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
432 |
memcpy(&res.body[res.len], &IN1.body[P] , to_copy); |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
433 |
res.len += to_copy; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
434 |
} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
435 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
436 |
return res; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
437 |
} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
438 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
439 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
440 |
|
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
441 |
static inline __strlen_t __pfind(STRING* IN1, STRING* IN2){ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
442 |
UINT count1 = 0; /* offset of first matching char in IN1 */ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
443 |
UINT count2 = 0; /* count of matching char */ |
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
|
444 |
while(count1 + count2 < IN1->len && count2 < IN2->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
|
445 |
{ |
873a5b60a7ea
Fixed -I 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 |
if(IN1->body[count1 + count2] != IN2->body[count2++]){ |
873a5b60a7ea
Fixed -I 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 |
count1 += count2; |
873a5b60a7ea
Fixed -I 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 |
count2 = 0; |
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 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
451 |
return count2 == IN2->len -1 ? 0 : count1 + 1; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
452 |
} |
161
a27957e13d42
STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents:
156
diff
changeset
|
453 |
static inline __strlen_t __find(EN_ENO_PARAMS, STRING IN1, STRING IN2){ |
149 | 454 |
TEST_EN(UINT) |
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
|
455 |
return __pfind(&IN1, &IN2); |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
456 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
457 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
458 |
/***************/ |
873a5b60a7ea
Fixed -I 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 |
/* 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
|
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 |
/***************/ |
873a5b60a7ea
Fixed -I 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 |
/* 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
|
463 |
/***************/ |
149 | 464 |
static inline STRING __bool_to_string(EN_ENO_PARAMS, BOOL 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
|
465 |
{ |
149 | 466 |
TEST_EN(STRING) |
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
|
467 |
if(IN) |
873a5b60a7ea
Fixed -I 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 |
return (STRING){4, "TRUE"}; |
873a5b60a7ea
Fixed -I 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 |
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
|
470 |
} |
149 | 471 |
static inline STRING __bit_to_string(EN_ENO_PARAMS, LWORD IN){ |
472 |
TEST_EN(STRING) |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
473 |
STRING res = __INIT_STRING; |
114 | 474 |
res.len = snprintf((char*)res.body, STR_MAX_LEN, "16#%llx", 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
|
475 |
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
|
476 |
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
|
477 |
} |
149 | 478 |
static inline STRING __real_to_string(EN_ENO_PARAMS, LREAL IN){ |
479 |
TEST_EN(STRING) |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
480 |
STRING res = __INIT_STRING; |
114 | 481 |
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
|
482 |
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
|
483 |
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
|
484 |
} |
149 | 485 |
static inline STRING __sint_to_string(EN_ENO_PARAMS, LINT IN){ |
486 |
TEST_EN(STRING) |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
487 |
STRING res = __INIT_STRING; |
114 | 488 |
res.len = snprintf((char*)res.body, STR_MAX_LEN, "%lld", 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
|
489 |
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
|
490 |
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
|
491 |
} |
149 | 492 |
static inline STRING __uint_to_string(EN_ENO_PARAMS, ULINT IN){ |
493 |
TEST_EN(STRING) |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
494 |
STRING res = __INIT_STRING; |
114 | 495 |
res.len = snprintf((char*)res.body, STR_MAX_LEN, "%llu", 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
|
496 |
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
|
497 |
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
|
498 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
499 |
/***************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
500 |
/* 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
|
501 |
/***************/ |
149 | 502 |
static inline BOOL __string_to_bool(EN_ENO_PARAMS, STRING IN){ |
503 |
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
|
504 |
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
|
505 |
} |
873a5b60a7ea
Fixed -I 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 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
507 |
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
|
508 |
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
|
509 |
char tmp[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
|
510 |
char tmp2[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
|
511 |
__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
|
512 |
unsigned int shift = 0; |
180 | 513 |
|
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
|
514 |
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
|
515 |
/* 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
|
516 |
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
|
517 |
{ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
518 |
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
|
519 |
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
|
520 |
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
|
521 |
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
|
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 |
} |
873a5b60a7ea
Fixed -I 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 |
}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
|
525 |
/* 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
|
526 |
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
|
527 |
{ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
528 |
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
|
529 |
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
|
530 |
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
|
531 |
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
|
532 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
533 |
} |
43 | 534 |
}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
|
535 |
/* 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
|
536 |
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
|
537 |
{ |
873a5b60a7ea
Fixed -I 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 |
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
|
539 |
if( c >= '0' && c <= '9'){ |
43 | 540 |
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
|
541 |
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
|
542 |
}else if( c >= 'a' && c <= 'f'){ |
43 | 543 |
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
|
544 |
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
|
545 |
}else if( c >= 'A' && c <= 'F'){ |
43 | 546 |
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
|
547 |
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
|
548 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
549 |
} |
873a5b60a7ea
Fixed -I 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 |
}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
|
551 |
/* -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
|
552 |
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
|
553 |
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
|
554 |
{ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
555 |
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
|
556 |
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
|
557 |
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
|
558 |
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
|
559 |
shift += 1; |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
560 |
}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
|
561 |
res = 0; |
163 | 562 |
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
|
563 |
shift = 0; |
180 | 564 |
} |
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
|
565 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
566 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
567 |
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
|
568 |
} |
873a5b60a7ea
Fixed -I 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 |
|
149 | 570 |
static inline LINT __string_to_sint(EN_ENO_PARAMS, STRING IN){ |
571 |
TEST_EN(LINT) |
|
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
|
572 |
return (LWORD)__pstring_to_sint(&IN); |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
573 |
} |
149 | 574 |
static inline LWORD __string_to_bit(EN_ENO_PARAMS, STRING IN){ |
575 |
TEST_EN(LWORD) |
|
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
|
576 |
return (LWORD)__pstring_to_sint(&IN); |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
577 |
} |
149 | 578 |
static inline ULINT __string_to_uint(EN_ENO_PARAMS, STRING IN){ |
579 |
TEST_EN(ULINT) |
|
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
|
580 |
return (ULINT)__pstring_to_sint(&IN); |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
581 |
} |
149 | 582 |
static inline LREAL __string_to_real(EN_ENO_PARAMS, STRING IN){ |
583 |
TEST_EN(LREAL) |
|
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
|
584 |
/* 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
|
585 |
__strlen_t l = IN.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
|
586 |
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
|
587 |
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
|
588 |
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
|
589 |
}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
|
590 |
return (LREAL)__pstring_to_sint(&IN); |
180 | 591 |
} |
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
|
592 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
593 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
594 |
/***************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
595 |
/* 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
|
596 |
/***************/ |
149 | 597 |
static inline TIME __int_to_time(EN_ENO_PARAMS, LINT IN){ |
598 |
TEST_EN(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
|
599 |
return (TIME){IN, 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
|
600 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
601 |
|
149 | 602 |
static inline TIME __real_to_time(EN_ENO_PARAMS, LREAL IN){ |
603 |
TEST_EN(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
|
604 |
return (TIME){IN, (IN - (LINT)IN) * 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
|
605 |
} |
149 | 606 |
static inline TIME __string_to_time(EN_ENO_PARAMS, STRING IN){ |
607 |
TEST_EN(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
|
608 |
/* 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
|
609 |
* |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
610 |
* 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
|
611 |
* 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
|
612 |
* 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
|
613 |
* 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
|
614 |
* 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
|
615 |
* 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
|
616 |
* 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
|
617 |
* 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
|
618 |
* |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
619 |
* 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
|
620 |
* 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
|
621 |
* 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
|
622 |
* 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
|
623 |
* 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
|
624 |
* 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
|
625 |
* 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
|
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 |
*/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
628 |
/* 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
|
629 |
/* 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
|
630 |
__strlen_t l = IN.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
|
631 |
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
|
632 |
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
|
633 |
LREAL IN_val = 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
|
634 |
return (TIME){IN_val, (IN_val - (LINT)IN_val)*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
|
635 |
}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
|
636 |
return (TIME){__pstring_to_sint(&IN), 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
|
637 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
638 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
639 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
640 |
/***************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
641 |
/* 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
|
642 |
/***************/ |
149 | 643 |
static inline LREAL __time_to_real(EN_ENO_PARAMS, TIME IN){ |
644 |
TEST_EN(LREAL) |
|
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
|
645 |
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
|
646 |
} |
149 | 647 |
static inline LINT __time_to_int(EN_ENO_PARAMS, TIME IN){ |
648 |
TEST_EN(LINT) |
|
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
|
649 |
return IN.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
|
650 |
} |
149 | 651 |
static inline STRING __time_to_string(EN_ENO_PARAMS, TIME IN){ |
652 |
TEST_EN(STRING) |
|
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
|
653 |
/*t#5d14h12m18s3.5ms*/ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
654 |
STRING res = __INIT_STRING; |
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
|
655 |
div_t days = div(IN.tv_sec ,86400); |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
656 |
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
|
657 |
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
|
658 |
}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
|
659 |
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
|
660 |
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
|
661 |
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
|
662 |
}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
|
663 |
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
|
664 |
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
|
665 |
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
|
666 |
}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
|
667 |
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
|
668 |
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
|
669 |
}else{ |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
670 |
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
|
671 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
672 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
673 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
674 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
675 |
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
|
676 |
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
|
677 |
} |
149 | 678 |
static inline STRING __date_to_string(EN_ENO_PARAMS, DATE IN){ |
679 |
TEST_EN(STRING) |
|
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
|
680 |
/* D#1984-06-25 */ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
681 |
STRING res = __INIT_STRING; |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
682 |
struct tm* broken_down_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
|
683 |
time_t seconds = IN.tv_sec; |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
684 |
if (NULL == (broken_down_time = localtime(&seconds))){ /* get the UTC (GMT) broken down 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
|
685 |
IEC_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
|
686 |
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
|
687 |
} |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
688 |
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
|
689 |
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
|
690 |
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
|
691 |
} |
149 | 692 |
static inline STRING __tod_to_string(EN_ENO_PARAMS, TOD IN){ |
693 |
TEST_EN(STRING) |
|
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
|
694 |
/* TOD#15:36:55.36 */ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
695 |
STRING res = __INIT_STRING; |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
696 |
struct tm* broken_down_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
|
697 |
time_t seconds = IN.tv_sec; |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
698 |
if (NULL == (broken_down_time = localtime(&seconds))){ /* get the UTC (GMT) broken down 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
|
699 |
IEC_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
|
700 |
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
|
701 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
702 |
if(IN.tv_nsec == 0){ |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
703 |
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
|
704 |
}else{ |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
705 |
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
|
706 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
707 |
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
|
708 |
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
|
709 |
} |
149 | 710 |
static inline STRING __dt_to_string(EN_ENO_PARAMS, DT IN){ |
711 |
TEST_EN(STRING) |
|
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
|
712 |
/* 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
|
713 |
STRING res; |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
714 |
struct tm* broken_down_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
|
715 |
time_t seconds = IN.tv_sec; |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
716 |
if (NULL == (broken_down_time = localtime(&seconds))){ /* get the UTC (GMT) broken down 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
|
717 |
IEC_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
|
718 |
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
|
719 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
720 |
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
|
721 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "DT#%d-%2.2d-%2.2d-%2.2d:%2.2d:%d", |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
722 |
broken_down_time->tm_year, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
723 |
broken_down_time->tm_mon, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
724 |
broken_down_time->tm_mday, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
725 |
broken_down_time->tm_hour, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
726 |
broken_down_time->tm_min, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
727 |
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
|
728 |
}else{ |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
729 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "DT#%d-%2.2d-%2.2d-%2.2d:%2.2d:%g", |
57
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
730 |
broken_down_time->tm_year, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
731 |
broken_down_time->tm_mon, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
732 |
broken_down_time->tm_mday, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
733 |
broken_down_time->tm_hour, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
734 |
broken_down_time->tm_min, |
db9cadaab2ea
Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
55
diff
changeset
|
735 |
(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
|
736 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
737 |
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
|
738 |
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
|
739 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
740 |
/* BCD */ |
180 | 741 |
#define __bcd_digit(fac) |
149 | 742 |
static inline ULINT __bcd_to_uint(EN_ENO_PARAMS, LWORD IN){ |
743 |
TEST_EN(ULINT) |
|
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
|
744 |
return IN & 0xf + |
180 | 745 |
!(IN >>= 4) ? 0 : IN & 0xf * 10ULL + |
746 |
!(IN >>= 4) ? 0 : IN & 0xf * 100ULL + |
|
747 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000ULL + |
|
748 |
!(IN >>= 4) ? 0 : IN & 0xf * 10000ULL + |
|
749 |
!(IN >>= 4) ? 0 : IN & 0xf * 100000ULL + |
|
750 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000000ULL + |
|
751 |
!(IN >>= 4) ? 0 : IN & 0xf * 10000000ULL + |
|
752 |
!(IN >>= 4) ? 0 : IN & 0xf * 100000000ULL + |
|
753 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000000000ULL + |
|
754 |
!(IN >>= 4) ? 0 : IN & 0xf * 10000000000ULL + |
|
755 |
!(IN >>= 4) ? 0 : IN & 0xf * 100000000000ULL + |
|
756 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000000000000ULL + |
|
757 |
!(IN >>= 4) ? 0 : IN & 0xf * 10000000000000ULL + |
|
758 |
!(IN >>= 4) ? 0 : IN & 0xf * 100000000000000ULL + |
|
48
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
759 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000000000000000ULL; |
180 | 760 |
|
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
|
761 |
} |
149 | 762 |
static inline LWORD __uint_to_bcd(EN_ENO_PARAMS, ULINT IN){ |
763 |
TEST_EN(LWORD) |
|
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
|
764 |
return (IN - (IN /= 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
|
765 |
(IN - (IN /= 10)) << 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
|
766 |
(IN - (IN /= 10)) << 8 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
767 |
(IN - (IN /= 10)) << 12 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
768 |
(IN - (IN /= 10)) << 16 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
769 |
(IN - (IN /= 10)) << 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
|
770 |
(IN - (IN /= 10)) << 24 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
771 |
(IN - (IN /= 10)) << 28 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
772 |
(IN - (IN /= 10)) << 32 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
773 |
(IN - (IN /= 10)) << 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
|
774 |
(IN - (IN /= 10)) << 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
|
775 |
(IN - (IN /= 10)) << 44 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
776 |
(IN - (IN /= 10)) << 48 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
777 |
(IN - (IN /= 10)) << 52 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
778 |
(IN - (IN /= 10)) << 56 | |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
779 |
(IN - (IN /= 10)) << 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
|
780 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
781 |
|
180 | 782 |
/* workaround for va-atgs limitation on shorter that 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
|
783 |
#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
|
784 |
#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
|
785 |
#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
|
786 |
#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
|
787 |
#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
|
788 |
#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
|
789 |
#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
|
790 |
#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
|
791 |
#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
|
792 |
#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
|
793 |
#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
|
794 |
#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
|
795 |
#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
|
796 |
#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
|
797 |
#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
|
798 |
#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
|
799 |
#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
|
800 |
#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
|
801 |
#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
|
802 |
#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
|
803 |
#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
|
804 |
|
149 | 805 |
/*******************************************/ |
806 |
/* Arithmetic and bitwise functions */ |
|
807 |
/*******************************************/ |
|
808 |
#define __arith_expand(fname,TYPENAME, OP) \ |
|
809 |
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS, UINT param_count, TYPENAME op1, ...){\ |
|
810 |
TEST_EN(TYPENAME)\ |
|
811 |
va_list ap;\ |
|
812 |
UINT i;\ |
|
813 |
\ |
|
814 |
va_start (ap, op1); /* Initialize the argument list. */\ |
|
815 |
\ |
|
816 |
for (i = 0; i < param_count - 1; i++){\ |
|
817 |
op1 = op1 OP va_arg (ap, VA_ARGS_##TYPENAME);\ |
|
818 |
}\ |
|
819 |
\ |
|
820 |
va_end (ap); /* Clean up. */\ |
|
821 |
return op1;\ |
|
822 |
} |
|
823 |
||
824 |
#define __arith_static(fname,TYPENAME, OP) \ |
|
825 |
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\ |
|
826 |
TEST_EN(TYPENAME)\ |
|
827 |
return op1 OP op2;\ |
|
828 |
} |
|
829 |
||
830 |
/**************/ |
|
831 |
/* ADD */ |
|
832 |
/**************/ |
|
833 |
#define __add_(TYPENAME) __arith_expand(__add_, TYPENAME, + ) |
|
834 |
ANY_NUM(__add_) |
|
835 |
||
836 |
/**************/ |
|
837 |
/* MUL */ |
|
838 |
/**************/ |
|
839 |
#define __mul_(TYPENAME) __arith_expand(__mul_, TYPENAME, * ) |
|
840 |
ANY_NUM(__mul_) |
|
841 |
||
842 |
/**************/ |
|
843 |
/* SUB */ |
|
844 |
/**************/ |
|
845 |
#define __sub_(TYPENAME) __arith_static(__sub_, TYPENAME, - ) |
|
846 |
ANY_NUM(__sub_) |
|
847 |
||
848 |
/**************/ |
|
849 |
/* DIV */ |
|
850 |
/**************/ |
|
851 |
#define __div_(TYPENAME)\ |
|
852 |
static inline TYPENAME __div_##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\ |
|
853 |
TEST_EN_COND(TYPENAME, op2 == 0)\ |
|
854 |
return op1 / op2;\ |
|
855 |
} |
|
856 |
ANY_NUM(__div_) |
|
857 |
||
858 |
/**************/ |
|
859 |
/* MOD */ |
|
860 |
/**************/ |
|
861 |
#define __mod_(TYPENAME) __arith_static(__mod_, TYPENAME, % ) |
|
862 |
ANY_INT(__mod_) |
|
863 |
||
864 |
/**************/ |
|
865 |
/* AND */ |
|
866 |
/**************/ |
|
867 |
__arith_expand(__and_, BOOL, && ) |
|
868 |
#define __and_(TYPENAME) __arith_expand(__and_, TYPENAME, & ) |
|
869 |
ANY_NBIT(__and_) |
|
870 |
||
871 |
/*************/ |
|
872 |
/* OR */ |
|
873 |
/*************/ |
|
874 |
__arith_expand(__or_, BOOL, || ) |
|
875 |
#define __or_(TYPENAME) __arith_expand(__or_, TYPENAME, |) |
|
876 |
ANY_NBIT(__or_) |
|
877 |
||
878 |
/**************/ |
|
879 |
/* XOR */ |
|
880 |
/**************/ |
|
881 |
static inline BOOL __xor_BOOL(EN_ENO_PARAMS, UINT param_count, BOOL op1, ...){ |
|
882 |
TEST_EN(BOOL) |
|
883 |
va_list ap; |
|
884 |
UINT i; |
|
180 | 885 |
|
149 | 886 |
va_start (ap, op1); /* Initialize the argument list. */ |
180 | 887 |
|
149 | 888 |
for (i = 0; i < param_count - 1; i++){ |
889 |
BOOL tmp = va_arg (ap, VA_ARGS_BOOL); |
|
890 |
op1 = (op1 && !tmp) || (!op1 && tmp); |
|
891 |
} |
|
180 | 892 |
|
149 | 893 |
va_end (ap); /* Clean up. */ |
894 |
return op1; |
|
895 |
} |
|
896 |
#define __xor_(TYPENAME) __arith_expand(__xor_, TYPENAME, ^) |
|
897 |
ANY_NBIT(__xor_) |
|
898 |
||
899 |
/**************/ |
|
900 |
/* NOT */ |
|
901 |
/**************/ |
|
902 |
static inline BOOL __not_BOOL(EN_ENO_PARAMS, BOOL op1){ |
|
903 |
TEST_EN(BOOL) |
|
904 |
return !op1; |
|
905 |
} |
|
906 |
||
907 |
#define __not_(TYPENAME)\ |
|
908 |
static inline TYPENAME __not_##TYPENAME(EN_ENO_PARAMS, TYPENAME op1){\ |
|
909 |
TEST_EN(TYPENAME)\ |
|
910 |
return ~op1;\ |
|
911 |
} |
|
912 |
ANY_NBIT(__not_) |
|
913 |
||
914 |
/***************/ |
|
915 |
/* MOVE */ |
|
916 |
/***************/ |
|
917 |
#define __move_(TYPENAME)\ |
|
918 |
static inline TYPENAME __move_##TYPENAME(EN_ENO_PARAMS, TYPENAME op1){\ |
|
919 |
TEST_EN(TYPENAME)\ |
|
920 |
return op1;\ |
|
921 |
} |
|
922 |
ANY(__move_) |
|
923 |
||
924 |
/**************/ |
|
925 |
/* Binary ops */ |
|
926 |
/**************/ |
|
927 |
#define __shift_(fname, TYPENAME, OP)\ |
|
928 |
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS, TYPENAME IN, USINT N) {\ |
|
156 | 929 |
TEST_EN(TYPENAME)\ |
149 | 930 |
return IN OP N;\ |
931 |
} |
|
932 |
||
933 |
#define __shl_(TYPENAME) __shift_(__shl_, TYPENAME, << ) |
|
934 |
/* Call previously defined macro for each ANY_NBIT */ |
|
935 |
ANY_NBIT(__shl_) |
|
936 |
||
937 |
#define __shr_(TYPENAME) __shift_(__shr_, TYPENAME, >> ) |
|
938 |
/* Call previously defined macro for each ANY_NBIT */ |
|
939 |
ANY_NBIT(__shr_) |
|
940 |
||
941 |
#define __ror_(TYPENAME)\ |
|
942 |
static inline TYPENAME __ror_##TYPENAME(EN_ENO_PARAMS, TYPENAME IN, USINT N){\ |
|
156 | 943 |
TEST_EN(TYPENAME)\ |
149 | 944 |
N %= 8*sizeof(TYPENAME);\ |
945 |
return (IN >> N) | (IN << 8*sizeof(TYPENAME)-N);\ |
|
946 |
} |
|
947 |
/* Call previously defined macro for each ANY_NBIT */ |
|
948 |
ANY_NBIT(__ror_) |
|
949 |
||
950 |
#define __rol_(TYPENAME)\ |
|
951 |
static inline TYPENAME __rol_##TYPENAME(EN_ENO_PARAMS, TYPENAME IN, USINT N){\ |
|
156 | 952 |
TEST_EN(TYPENAME)\ |
149 | 953 |
N %= 8*sizeof(TYPENAME);\ |
954 |
return (IN << N) | (IN >> 8*sizeof(TYPENAME)-N);\ |
|
955 |
} |
|
956 |
/* Call previously defined macro for each ANY_NBIT */ |
|
957 |
ANY_NBIT(__rol_) |
|
958 |
||
165
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
959 |
/*******************************************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
960 |
/* Arithmetic and bitwise functions */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
961 |
/*******************************************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
962 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
963 |
#define __numeric(fname,TYPENAME, FUNC) \ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
964 |
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
965 |
TEST_EN(TYPENAME)\ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
966 |
return FUNC(op);\ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
967 |
} |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
968 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
969 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
970 |
/* ABS */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
971 |
/**************/ |
187
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
972 |
#define __abs_signed(TYPENAME) \ |
180 | 973 |
static inline TYPENAME __abs_##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\ |
974 |
TEST_EN(TYPENAME)\ |
|
975 |
if (op < 0)\ |
|
976 |
return -op;\ |
|
977 |
return op;\ |
|
978 |
} |
|
187
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
979 |
ANY_REAL(__abs_signed) |
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
980 |
ANY_SINT(__abs_signed) |
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
981 |
|
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
982 |
#define __abs_unsigned(TYPENAME) \ |
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
983 |
static inline TYPENAME __abs_##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\ |
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
984 |
TEST_EN(TYPENAME)\ |
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
985 |
return op;\ |
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
986 |
} |
f2cd0b5236f7
Warning when compiling abs functions for unsigned integer fixed
lbessard
parents:
180
diff
changeset
|
987 |
ANY_UINT(__abs_unsigned) |
165
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
988 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
989 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
990 |
/* SQRT */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
991 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
992 |
#define __sqrt_(TYPENAME) __numeric(__sqrt_, TYPENAME, sqrt) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
993 |
ANY_REAL(__sqrt_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
994 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
995 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
996 |
/* LN */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
997 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
998 |
#define __ln_(TYPENAME) __numeric(__ln_, TYPENAME, ln) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
999 |
ANY_REAL(__ln_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1000 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1001 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1002 |
/* LOG */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1003 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1004 |
#define __log_(TYPENAME) __numeric(__log_, TYPENAME, log) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1005 |
ANY_REAL(__log_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1006 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1007 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1008 |
/* EXP */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1009 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1010 |
#define __exp_(TYPENAME) __numeric(__exp_, TYPENAME, exp) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1011 |
ANY_REAL(__exp_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1012 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1013 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1014 |
/* SIN */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1015 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1016 |
#define __sin_(TYPENAME) __numeric(__sin_, TYPENAME, sin) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1017 |
ANY_REAL(__sin_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1018 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1019 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1020 |
/* COS */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1021 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1022 |
#define __cos_(TYPENAME) __numeric(__cos_, TYPENAME, cos) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1023 |
ANY_REAL(__cos_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1024 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1025 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1026 |
/* TAN */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1027 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1028 |
#define __tan_(TYPENAME) __numeric(__tan_, TYPENAME, tan) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1029 |
ANY_REAL(__tan_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1030 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1031 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1032 |
/* ASIN */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1033 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1034 |
#define __asin_(TYPENAME) __numeric(__asin_, TYPENAME, asin) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1035 |
ANY_REAL(__asin_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1036 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1037 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1038 |
/* ACOS */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1039 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1040 |
#define __acos_(TYPENAME) __numeric(__acos_, TYPENAME, acos) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1041 |
ANY_REAL(__acos_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1042 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1043 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1044 |
/* ATAN */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1045 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1046 |
#define __atan_(TYPENAME) __numeric(__atan_, TYPENAME, atan) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1047 |
ANY_REAL(__atan_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1048 |
|
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1049 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1050 |
/* EXPT */ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1051 |
/**************/ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1052 |
#define __expt_(TYPENAME)\ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1053 |
static inline TYPENAME __expt_##TYPENAME(EN_ENO_PARAMS, TYPENAME IN1, REAL IN2){\ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1054 |
TEST_EN(TYPENAME)\ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1055 |
return pow(IN1, IN2);\ |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1056 |
}ANY_REAL(__expt_) |
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1057 |
|
149 | 1058 |
/**************/ |
1059 |
/* Selection */ |
|
1060 |
/**************/ |
|
1061 |
||
1062 |
/**************/ |
|
1063 |
/* SEL */ |
|
1064 |
/**************/ |
|
1065 |
||
1066 |
#define __sel_(TYPENAME)\ |
|
1067 |
static inline TYPENAME __sel_##TYPENAME(EN_ENO_PARAMS, BOOL G, TYPENAME op0, TYPENAME op1){\ |
|
1068 |
TEST_EN(TYPENAME)\ |
|
1069 |
return G ? op1 : op0;\ |
|
1070 |
} |
|
1071 |
ANY(__sel_) |
|
1072 |
||
1073 |
/**************/ |
|
1074 |
/* limit */ |
|
1075 |
/**************/ |
|
1076 |
||
1077 |
#define __limit_(TYPENAME)\ |
|
1078 |
static inline TYPENAME __limit_##TYPENAME(EN_ENO_PARAMS, TYPENAME MN, TYPENAME IN, TYPENAME MX){\ |
|
1079 |
TEST_EN(TYPENAME)\ |
|
1080 |
return IN > MN ? IN < MX ? IN : MX : MN;\ |
|
1081 |
} |
|
1082 |
||
1083 |
/* Call previously defined macro for each concerned type */ |
|
1084 |
ANY_NBIT(__limit_) |
|
1085 |
ANY_NUM(__limit_) |
|
1086 |
||
1087 |
#define __limit_time(TYPENAME)\ |
|
1088 |
static inline TYPENAME __limit_##TYPENAME(EN_ENO_PARAMS, TYPENAME MN, TYPENAME IN, TYPENAME MX){\ |
|
1089 |
TEST_EN(TYPENAME)\ |
|
1090 |
return __TIME_CMP(IN, MN) > 0 ? /* IN>MN ?*/\ |
|
1091 |
__TIME_CMP(IN, MX) < 0 ? /* IN<MX ?*/\ |
|
1092 |
IN : MX : MN;\ |
|
1093 |
} |
|
1094 |
||
1095 |
/* Call previously defined macro for each concerned type */ |
|
1096 |
ANY_DATE(__limit_time) |
|
1097 |
__limit_time(TIME) |
|
1098 |
||
1099 |
static inline STRING __limit_STRING(EN_ENO_PARAMS, STRING MN, STRING IN, STRING MX){ |
|
1100 |
TEST_EN(STRING) |
|
1101 |
return __STR_CMP(IN, MN) > 0 ? __STR_CMP(IN, MX) < 0 ? IN : MX : MN; |
|
1102 |
} |
|
1103 |
||
1104 |
/**************/ |
|
1105 |
/* MAX */ |
|
1106 |
/**************/ |
|
1107 |
||
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
|
1108 |
#define __extrem_(fname,TYPENAME, COND) \ |
149 | 1109 |
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS, UINT param_count, TYPENAME op1, ...){\ |
1110 |
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
|
1111 |
va_list ap;\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1112 |
UINT i;\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1113 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1114 |
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
|
1115 |
\ |
165
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1116 |
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
|
1117 |
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
|
1118 |
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
|
1119 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1120 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1121 |
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
|
1122 |
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
|
1123 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1124 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1125 |
#define __max_num(TYPENAME) __extrem_(__max_,TYPENAME, 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
|
1126 |
ANY_NBIT(__max_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1127 |
ANY_NUM(__max_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1128 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1129 |
__extrem_(__max_, STRING, __STR_CMP(op1,tmp) < 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
|
1130 |
#define __max_time(TYPENAME) __extrem_(__max_, TYPENAME, __TIME_CMP(op1, tmp) < 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
|
1131 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1132 |
/* Call previously defined macro for each concerned type */ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1133 |
ANY_DATE(__max_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
|
1134 |
__max_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
|
1135 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1136 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1137 |
/* 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
|
1138 |
/**************/ |
165
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1139 |
#define __min_num(TYPENAME) __extrem_(__min_, TYPENAME, op1 > 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
|
1140 |
ANY_NBIT(__min_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1141 |
ANY_NUM(__min_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1142 |
|
165
83963465b773
Bug on standard function not defined with EN/ENO fixed
lbessard
parents:
163
diff
changeset
|
1143 |
__extrem_(__min_, STRING, __STR_CMP(op1,tmp) > 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
|
1144 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1145 |
#define __min_time(TYPENAME) __extrem_(__min_, TYPENAME, __TIME_CMP(op1, tmp) > 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
|
1146 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1147 |
/* Call previously defined macro for each concerned type */ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1148 |
ANY_DATE(__min_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
|
1149 |
__min_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
|
1150 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1151 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1152 |
/* 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
|
1153 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1154 |
#define __mux_(TYPENAME) \ |
149 | 1155 |
static inline TYPENAME __mux_##TYPENAME(EN_ENO_PARAMS, UINT param_count, UINT K, ...){\ |
156 | 1156 |
TEST_EN_COND(TYPENAME, K >= 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
|
1157 |
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
|
1158 |
UINT i;\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
1159 |
TYPENAME tmp = __INIT_##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
|
1160 |
\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
1161 |
va_start (ap, K); /* 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
|
1162 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1163 |
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
|
1164 |
if(K == i){\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
1165 |
tmp = va_arg (ap, VA_ARGS_##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
|
1166 |
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
|
1167 |
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
|
1168 |
}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
|
1169 |
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
|
1170 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1171 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1172 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1173 |
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
|
1174 |
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
|
1175 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1176 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1177 |
ANY(__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
|
1178 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1179 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1180 |
/* Comparison */ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1181 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1182 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1183 |
#define __compare_(fname,TYPENAME, COND) \ |
149 | 1184 |
static inline BOOL fname##TYPENAME(EN_ENO_PARAMS, UINT param_count, TYPENAME op1, ...){\ |
1185 |
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
|
1186 |
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
|
1187 |
UINT 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
|
1188 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1189 |
va_start (ap, op1); /* Initialize the argument list. */\ |
43 | 1190 |
DBG(#fname #TYPENAME "\n")\ |
1191 |
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
|
1192 |
\ |
43 | 1193 |
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
|
1194 |
TYPENAME tmp = va_arg (ap, VA_ARGS_##TYPENAME);\ |
43 | 1195 |
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
|
1196 |
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
|
1197 |
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
|
1198 |
}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
|
1199 |
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
|
1200 |
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
|
1201 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1202 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1203 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1204 |
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
|
1205 |
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
|
1206 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1207 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1208 |
#define __compare_num(fname, TYPENAME, TEST) __compare_(fname, TYPENAME, op1 TEST 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
|
1209 |
#define __compare_time(fname, TYPENAME, TEST) __compare_(fname, TYPENAME, __TIME_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
|
1210 |
#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
|
1211 |
|
149 | 1212 |
|
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
|
1213 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1214 |
/* 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
|
1215 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1216 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1217 |
#define __gt_num(TYPENAME) __compare_num(__gt_, 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
|
1218 |
ANY_NBIT(__gt_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1219 |
ANY_NUM(__gt_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1220 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1221 |
#define __gt_time(TYPENAME) __compare_time(__gt_, 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
|
1222 |
ANY_DATE(__gt_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
|
1223 |
__gt_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
|
1224 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1225 |
__compare_string(__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
|
1226 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1227 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1228 |
/* 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
|
1229 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1230 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1231 |
#define __ge_num(TYPENAME) __compare_num(__ge_, TYPENAME, >= ) |
43 | 1232 |
ANY_BIT(__ge_num) |
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
|
1233 |
ANY_NUM(__ge_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1234 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1235 |
#define __ge_time(TYPENAME) __compare_time(__ge_, 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
|
1236 |
ANY_DATE(__ge_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
|
1237 |
__ge_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
|
1238 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1239 |
__compare_string(__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
|
1240 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1241 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1242 |
/* 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
|
1243 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1244 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1245 |
#define __eq_num(TYPENAME) __compare_num(__eq_, TYPENAME, == ) |
43 | 1246 |
ANY_BIT(__eq_num) |
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
|
1247 |
ANY_NUM(__eq_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1248 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1249 |
#define __eq_time(TYPENAME) __compare_time(__eq_, 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
|
1250 |
ANY_DATE(__eq_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
|
1251 |
__eq_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
|
1252 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1253 |
__compare_string(__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
|
1254 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1255 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1256 |
/* 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
|
1257 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1258 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1259 |
#define __lt_num(TYPENAME) __compare_num(__lt_, TYPENAME, < ) |
43 | 1260 |
ANY_BIT(__lt_num) |
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
|
1261 |
ANY_NUM(__lt_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1262 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1263 |
#define __lt_time(TYPENAME) __compare_time(__lt_, 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
|
1264 |
ANY_DATE(__lt_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
|
1265 |
__lt_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
|
1266 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1267 |
__compare_string(__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
|
1268 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1269 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1270 |
/* 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
|
1271 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1272 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1273 |
#define __le_num(TYPENAME) __compare_num(__le_, TYPENAME, <= ) |
43 | 1274 |
ANY_BIT(__le_num) |
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
|
1275 |
ANY_NUM(__le_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1276 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1277 |
#define __le_time(TYPENAME) __compare_time(__le_, 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
|
1278 |
ANY_DATE(__le_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
|
1279 |
__le_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
|
1280 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1281 |
__compare_string(__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
|
1282 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1283 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1284 |
/* 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
|
1285 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1286 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1287 |
#define __ne_num(TYPENAME) __compare_num(__ne_, TYPENAME, != ) |
43 | 1288 |
ANY_BIT(__ne_num) |
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
|
1289 |
ANY_NUM(__ne_num) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1290 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1291 |
#define __ne_time(TYPENAME) __compare_time(__ne_, 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
|
1292 |
ANY_DATE(__ne_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
|
1293 |
__ne_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
|
1294 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1295 |
__compare_string(__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
|
1296 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
1297 |
|
137
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1298 |
///* Get string representation of variable referenced by a void pointer |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1299 |
// * where type is given as its number */ |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1300 |
//#define __decl_str_case(cat,TYPENAME) \ |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1301 |
// case TYPENAME##_ENUM:\ |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1302 |
// return __##cat##_to_string(*(TYPENAME*)p); |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1303 |
//#define __decl_str_case_bit(TYPENAME) __decl_str_case(bit,TYPENAME) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1304 |
//#define __decl_str_case_real(TYPENAME) __decl_str_case(real,TYPENAME) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1305 |
//#define __decl_str_case_sint(TYPENAME) __decl_str_case(sint,TYPENAME) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1306 |
//#define __decl_str_case_uint(TYPENAME) __decl_str_case(uint,TYPENAME) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1307 |
//static inline STRING __get_type_enum_str(__IEC_types_enum t, void* p){ |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1308 |
// switch(t){ |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1309 |
// __decl_str_case(bool,BOOL) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1310 |
// ANY_NBIT(__decl_str_case_bit) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1311 |
// ANY_REAL(__decl_str_case_real) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1312 |
// ANY_SINT(__decl_str_case_sint) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1313 |
// ANY_UINT(__decl_str_case_uint) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1314 |
// __decl_str_case(time,TIME) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1315 |
// __decl_str_case(date,DATE) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1316 |
// __decl_str_case(tod,TOD) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1317 |
// __decl_str_case(dt, DT) |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1318 |
// } |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1319 |
//} |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1320 |
// |
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1321 |
|
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1322 |
|
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1323 |
|
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1324 |
|
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1325 |
|
9ceda59abd27
Re-organized types headers, to ease debug code generation
etisserant
parents:
129
diff
changeset
|
1326 |