author | lbessard |
Mon, 27 Aug 2007 14:52:15 +0200 | |
changeset 52 | f44458d1fa29 |
parent 48 | 3d24cc85bb3c |
child 55 | 8b7a21820737 |
permissions | -rw-r--r-- |
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
|
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
|
2 |
* IEC 61131-3 standard function lib |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
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
|
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
|
5 |
#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
|
6 |
#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
|
7 |
#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
|
8 |
#include <time.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
|
9 |
#include <sys/types.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
|
10 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
11 |
#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
|
12 |
#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
|
13 |
#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
|
14 |
#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
|
15 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
16 |
#include "iec_std_lib_generated.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
|
17 |
|
43 | 18 |
#define __print_BOOL(name) printf(" %s = (BOOL) %s\n",#name, name?"TRUE":"FALSE"); |
19 |
#define __print_SINT(name) printf(" %s = (SINT) %d\n",#name, name); |
|
20 |
#define __print_INT(name) printf(" %s = (INT) %d\n",#name, name); |
|
21 |
#define __print_DINT(name) printf(" %s = (DINT) %d\n",#name, name); |
|
22 |
#define __print_LINT(name) printf(" %s = (LINT) %d\n",#name, name); |
|
23 |
#define __print_USINT(name) printf(" %s = (USINT) %u\n",#name, name); |
|
24 |
#define __print_UINT(name) printf(" %s = (UINT) %u\n",#name, name); |
|
25 |
#define __print_UDINT(name) printf(" %s = (UDINT) %u\n",#name, name); |
|
26 |
#define __print_ULINT(name) printf(" %s = (ULINT) %lu\n",#name, name); |
|
27 |
#define __print_REAL(name) printf(" %s = (REAL) %f\n",#name, (double)name); |
|
28 |
#define __print_LREAL(name) printf(" %s = (LREAL) %f\n",#name, (double)name); |
|
29 |
#define __print_TIME(name) {STRING __tmp = __time_to_string(name);__tmp.body[__tmp.len] = 0; printf(" %s = (TIME) %*s\n",#name, __tmp.len, &__tmp.body);} |
|
30 |
#define __print_DATE(name) {STRING __tmp = __date_to_string(name);__tmp.body[__tmp.len] = 0; printf(" %s = (DATE) %*s\n",#name, __tmp.len, &__tmp.body);} |
|
31 |
#define __print_TOD(name) {STRING __tmp = __tod_to_string(name);__tmp.body[__tmp.len] = 0; printf(" %s = (TOD) %*s\n",#name, __tmp.len, &__tmp.body);} |
|
32 |
#define __print_DT(name) {STRING __tmp = __dt_to_string(name);__tmp.body[__tmp.len] = 0; printf(" %s = (DT) %*s\n",#name, __tmp.len, &__tmp.body);} |
|
33 |
#define __print_STRING(name) printf(" %s = (STRING) {%d, \"%*s\"}\n",#name, name.len, name.len, &name.body); |
|
34 |
#define __print_BYTE(name) printf(" %s = (BYTE) 0x%2.2x\n",#name, name); |
|
35 |
#define __print_WORD(name) printf(" %s = (WORD) 0x%4.4x\n",#name, name); |
|
36 |
#define __print_DWORD(name) printf(" %s = (DWORD) 0x%8.8x\n",#name, name); |
|
37 |
#define __print_LWORD(name) printf(" %s = (LWORD) 0x%16.16lx\n",#name, name); |
|
38 |
||
39 |
#ifdef DEBUG_IEC |
|
40 |
#define DBG(...) printf(__VA_ARGS__); |
|
41 |
#define DBG_TYPE(TYPENAME, name) __print_##TYPENAME(name); |
|
42 |
#else |
|
43 |
#define DBG(...) |
|
44 |
#define DBG_TYPE(TYPENAME, name) |
|
45 |
#endif |
|
46 |
||
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 |
/* Types defs */ |
873a5b60a7ea
Fixed -I 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 |
/*****************/ |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
typedef u_int8_t BOOL; |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
#define TRUE 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
|
54 |
#define FALSE 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
|
55 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
56 |
typedef int8_t SINT; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
57 |
typedef int16_t INT; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
58 |
typedef int32_t 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
|
59 |
typedef int64_t 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
|
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
|
61 |
typedef u_int8_t USINT; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
62 |
typedef u_int16_t UINT; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
63 |
typedef u_int32_t 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
|
64 |
typedef u_int64_t 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
|
65 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
66 |
typedef u_int8_t BYTE; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
67 |
typedef u_int16_t WORD; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
68 |
typedef u_int32_t 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
|
69 |
typedef u_int64_t 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
|
70 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
71 |
typedef float REAL; |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
72 |
typedef double 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
|
73 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
74 |
typedef struct timespec 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
|
75 |
typedef struct timespec 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
|
76 |
typedef struct timespec 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
|
77 |
typedef struct timespec 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
|
78 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
79 |
#define __TIME_CMP(t1, t2) (t2.tv_sec == t1.tv_sec ? t2.tv_nsec - t1.tv_nsec : t1.tv_sec - t2.tv_sec) |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
80 |
extern TIME __CURRENT_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
|
81 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
82 |
#define STR_MAX_LEN 40 |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
83 |
typedef int8_t __strlen_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
|
84 |
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
|
85 |
__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
|
86 |
u_int8_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
|
87 |
} 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
|
88 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
89 |
#define __STR_CMP(str1, str2) memcmp((char*)&str1.body,(char*)&str2.body, str1.len < str2.len ? str1.len : str2.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
|
90 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
91 |
/* 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
|
92 |
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
|
93 |
__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
|
94 |
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
|
95 |
} 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
|
96 |
*/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
97 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
98 |
#define __INIT_REAL 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
99 |
#define __INIT_LREAL 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
100 |
#define __INIT_SINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
101 |
#define __INIT_INT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
102 |
#define __INIT_DINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
103 |
#define __INIT_LINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
104 |
#define __INIT_USINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
105 |
#define __INIT_UINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
106 |
#define __INIT_UDINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
107 |
#define __INIT_ULINT 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
108 |
#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
|
109 |
#define __INIT_BOOL 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
110 |
#define __INIT_BYTE 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
111 |
#define __INIT_WORD 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
112 |
#define __INIT_DWORD 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
113 |
#define __INIT_LWORD 0 |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
114 |
#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
|
115 |
//#define __INIT_WSTRING |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
116 |
#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
|
117 |
#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
|
118 |
#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
|
119 |
|
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
|
120 |
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
|
121 |
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
|
122 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
124 |
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
|
125 |
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
|
126 |
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
|
127 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
129 |
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
|
130 |
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
|
131 |
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
|
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 |
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
|
134 |
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
|
135 |
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
|
136 |
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
|
137 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
139 |
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
|
140 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
141 |
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
|
142 |
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
|
143 |
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
|
144 |
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
|
145 |
} __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
|
146 |
|
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
/* 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
|
152 |
/*****************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
153 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
154 |
/* 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
|
155 |
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
|
156 |
/* 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
|
157 |
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
|
158 |
/*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
|
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 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
|
163 |
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
|
164 |
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
|
165 |
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
|
166 |
} |
873a5b60a7ea
Fixed -I 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( 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
|
168 |
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
|
169 |
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
|
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 |
} |
873a5b60a7ea
Fixed -I 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 |
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
|
174 |
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
|
175 |
|
873a5b60a7ea
Fixed -I 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 |
/* 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
|
177 |
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
|
178 |
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
|
179 |
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
|
180 |
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
|
181 |
|
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
187 |
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
|
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 |
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
|
190 |
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
|
191 |
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
|
192 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
193 |
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
|
194 |
} |
873a5b60a7ea
Fixed -I 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 |
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
|
197 |
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
|
198 |
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
|
199 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
201 |
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
|
202 |
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
|
203 |
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
|
204 |
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
|
205 |
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
|
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 |
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
|
208 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
209 |
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
|
210 |
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
|
211 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
212 |
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
|
213 |
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
|
214 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
215 |
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
|
216 |
} |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
219 |
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
|
220 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
222 |
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
|
223 |
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
|
224 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
225 |
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
|
226 |
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
|
227 |
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
|
228 |
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
|
229 |
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
|
230 |
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
|
231 |
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
|
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 |
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
|
234 |
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
|
235 |
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
|
236 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
237 |
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
|
238 |
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
|
239 |
/* 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
|
240 |
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
|
241 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
242 |
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
|
243 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
244 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
245 |
/***************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
246 |
/* 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
|
247 |
/***************/ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
248 |
static inline TIME __date_and_time_to_time_of_day(TIME IN){ |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
249 |
return (TIME){IN.tv_sec % 86400, IN.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
|
250 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
251 |
static inline TIME __date_and_time_to_date(TIME IN){ |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
252 |
return (TIME){IN.tv_sec - (IN.tv_sec % (24*60*60)), 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
|
253 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
254 |
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
|
255 |
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
|
256 |
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
|
257 |
__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
|
258 |
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
|
259 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
260 |
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
|
261 |
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
|
262 |
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
|
263 |
__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
|
264 |
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
|
265 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
266 |
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
|
267 |
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
|
268 |
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
|
269 |
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
|
270 |
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
|
271 |
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
|
272 |
__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
|
273 |
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
|
274 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
275 |
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
|
276 |
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
|
277 |
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
|
278 |
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
|
279 |
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
|
280 |
__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
|
281 |
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
|
282 |
} |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
/***************/ |
873a5b60a7ea
Fixed -I 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 |
/* 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
|
286 |
/***************/ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
287 |
static inline UINT __len(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
|
288 |
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
|
289 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
290 |
static inline STRING __left(STRING IN, SINT L){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
291 |
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
|
292 |
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
|
293 |
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
|
294 |
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
|
295 |
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
|
296 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
297 |
static inline STRING __right(STRING IN, SINT L){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
298 |
STRING res = __INIT_STRING; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
299 |
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
|
300 |
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
|
301 |
res.len = L; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
302 |
return res; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
303 |
} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
304 |
static inline STRING __mid(STRING IN, SINT L, SINT P){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
305 |
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
|
306 |
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
|
307 |
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
|
308 |
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
|
309 |
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
|
310 |
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
|
311 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
312 |
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
|
313 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
314 |
static inline STRING __concat(SINT 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
|
315 |
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
|
316 |
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
|
317 |
__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
|
318 |
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
|
319 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
320 |
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
|
321 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
322 |
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
|
323 |
{ |
873a5b60a7ea
Fixed -I 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 |
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
|
325 |
__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
|
326 |
__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
|
327 |
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
|
328 |
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
|
329 |
} |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
332 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
333 |
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
|
334 |
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
|
335 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
336 |
static inline STRING __insert(STRING IN1, STRING IN2, SINT P){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
337 |
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
|
338 |
__strlen_t 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
|
339 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
340 |
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
|
341 |
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
|
342 |
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
|
343 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
345 |
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
|
346 |
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
|
347 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
349 |
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
|
350 |
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
|
351 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
352 |
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
|
353 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
354 |
static inline STRING __delete(STRING IN, SINT L, SINT P){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
355 |
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
|
356 |
__strlen_t 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
|
357 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
358 |
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
|
359 |
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
|
360 |
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
|
361 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
362 |
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
|
363 |
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
|
364 |
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
|
365 |
res.len += to_copy; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
366 |
} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
367 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
368 |
return res; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
369 |
} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
370 |
static inline STRING __replace(STRING IN1, STRING IN2, SINT L, SINT P){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
371 |
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
|
372 |
__strlen_t 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
|
373 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
374 |
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
|
375 |
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
|
376 |
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
|
377 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
378 |
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
|
379 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
380 |
if( to_copy + res.len > STR_MAX_LEN ) |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
381 |
to_copy = STR_MAX_LEN - res.len; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
382 |
|
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
|
383 |
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
|
384 |
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
|
385 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
386 |
P += L; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
387 |
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
|
388 |
{ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
389 |
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
|
390 |
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
|
391 |
res.len += to_copy; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
392 |
} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
393 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
394 |
return res; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
395 |
} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
396 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
397 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
398 |
|
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
399 |
static inline UINT __pfind(STRING* IN1, STRING* IN2){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
400 |
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
|
401 |
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
|
402 |
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
|
403 |
{ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
404 |
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
|
405 |
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
|
406 |
count2 = 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
|
407 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
408 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
409 |
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
|
410 |
} |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
411 |
static inline UINT __find(STRING IN1, STRING 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
|
412 |
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
|
413 |
} |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
415 |
/***************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
416 |
/* 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
|
417 |
/***************/ |
873a5b60a7ea
Fixed -I 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 |
/***************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
419 |
/* 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
|
420 |
/***************/ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
421 |
static inline STRING __bool_to_string(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
|
422 |
{ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
423 |
if(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
|
424 |
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
|
425 |
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
|
426 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
427 |
static inline STRING __bit_to_string(LWORD IN){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
428 |
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
|
429 |
res.len = snprintf(res.body, STR_MAX_LEN, "16#%llx", 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
|
430 |
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
|
431 |
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
|
432 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
433 |
static inline STRING __real_to_string(LREAL IN){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
434 |
STRING res = __INIT_STRING; |
43 | 435 |
res.len = snprintf(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
|
436 |
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
|
437 |
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
|
438 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
439 |
static inline STRING __sint_to_string(LINT IN){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
440 |
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
|
441 |
res.len = snprintf(res.body, STR_MAX_LEN, "%lld", 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
|
442 |
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
|
443 |
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
|
444 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
445 |
static inline STRING __uint_to_string(ULINT IN){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
446 |
STRING res = __INIT_STRING; |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
447 |
res.len = snprintf(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
|
448 |
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
|
449 |
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
|
450 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
451 |
/***************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
452 |
/* 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
|
453 |
/***************/ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
454 |
static inline BOOL __string_to_bool(STRING IN){ |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
455 |
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
|
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 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
458 |
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
|
459 |
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
|
460 |
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
|
461 |
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
|
462 |
__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
|
463 |
unsigned int shift = 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
|
464 |
|
873a5b60a7ea
Fixed -I 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 |
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
|
466 |
/* 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
|
467 |
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
|
468 |
{ |
873a5b60a7ea
Fixed -I 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 |
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
|
470 |
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
|
471 |
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
|
472 |
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
|
473 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
474 |
} |
873a5b60a7ea
Fixed -I 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 |
}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
|
476 |
/* 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
|
477 |
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
|
478 |
{ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
479 |
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
|
480 |
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
|
481 |
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
|
482 |
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
|
483 |
} |
873a5b60a7ea
Fixed -I 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 |
} |
43 | 485 |
}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
|
486 |
/* 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
|
487 |
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
|
488 |
{ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
489 |
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
|
490 |
if( c >= '0' && c <= '9'){ |
43 | 491 |
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
|
492 |
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
|
493 |
}else if( c >= 'a' && c <= 'f'){ |
43 | 494 |
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
|
495 |
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
|
496 |
}else if( c >= 'A' && c <= 'F'){ |
43 | 497 |
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
|
498 |
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
|
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 |
} |
873a5b60a7ea
Fixed -I 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 |
}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
|
502 |
/* -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
|
503 |
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
|
504 |
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
|
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 |
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
|
507 |
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
|
508 |
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
|
509 |
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
|
510 |
shift += 1; |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
511 |
}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
|
512 |
res = 0; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
513 |
fac = 1; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
514 |
shift = 0; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
515 |
} |
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
|
516 |
} |
873a5b60a7ea
Fixed -I 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 |
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
|
519 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
520 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
521 |
static inline LINT __string_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
|
522 |
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
|
523 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
524 |
static inline LWORD __string_to_bit(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
|
525 |
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
|
526 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
527 |
static inline ULINT __string_to_uint(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
|
528 |
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
|
529 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
530 |
static inline LREAL __string_to_real(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
|
531 |
/* 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
|
532 |
__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
|
533 |
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
|
534 |
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
|
535 |
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
|
536 |
}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
|
537 |
return (LREAL)__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
|
538 |
} |
873a5b60a7ea
Fixed -I 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 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
540 |
|
873a5b60a7ea
Fixed -I 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 |
/***************/ |
873a5b60a7ea
Fixed -I 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 |
/* 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
|
543 |
/***************/ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
544 |
static inline TIME __int_to_time(LINT 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
|
545 |
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
|
546 |
} |
873a5b60a7ea
Fixed -I 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 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
548 |
static inline TIME __real_to_time(LREAL 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
|
549 |
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
|
550 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
551 |
static inline TIME __string_to_time(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
|
552 |
/* 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
|
553 |
* |
873a5b60a7ea
Fixed -I 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 |
* 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
|
555 |
* 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
|
556 |
* 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
|
557 |
* 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
|
558 |
* 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
|
559 |
* 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
|
560 |
* 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
|
561 |
* 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
|
562 |
* |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
563 |
* 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
|
564 |
* 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
|
565 |
* 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
|
566 |
* 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
|
567 |
* 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
|
568 |
* 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
|
569 |
* 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
|
570 |
* |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
571 |
*/ |
873a5b60a7ea
Fixed -I 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 |
/* 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
|
573 |
/* 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
|
574 |
__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
|
575 |
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
|
576 |
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
|
577 |
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
|
578 |
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
|
579 |
}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
|
580 |
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
|
581 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
582 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
583 |
|
873a5b60a7ea
Fixed -I 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 |
/***************/ |
873a5b60a7ea
Fixed -I 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 |
/* 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
|
586 |
/***************/ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
587 |
static inline LREAL __time_to_real(TIME IN){ |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
588 |
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
|
589 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
590 |
static inline LINT __time_to_int(TIME IN){ |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
591 |
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
|
592 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
593 |
static inline STRING __time_to_string(TIME IN){ |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
594 |
/*t#5d14h12m18s3.5ms*/ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
595 |
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
|
596 |
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
|
597 |
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
|
598 |
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
|
599 |
}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
|
600 |
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
|
601 |
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
|
602 |
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
|
603 |
}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
|
604 |
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
|
605 |
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
|
606 |
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
|
607 |
}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
|
608 |
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
|
609 |
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
|
610 |
}else{ |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
611 |
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
|
612 |
} |
873a5b60a7ea
Fixed -I 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 |
} |
873a5b60a7ea
Fixed -I 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 |
} |
873a5b60a7ea
Fixed -I 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 |
} |
873a5b60a7ea
Fixed -I 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 |
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
|
617 |
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
|
618 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
619 |
static inline STRING __date_to_string(DATE 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
|
620 |
/* 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
|
621 |
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
|
622 |
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
|
623 |
time_t seconds = IN.tv_sec; |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
624 |
if (NULL == localtime_r(&seconds, &broken_down_time)){ /* 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
|
625 |
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
|
626 |
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
|
627 |
} |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
628 |
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
|
629 |
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
|
630 |
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
|
631 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
632 |
static inline STRING __tod_to_string(TOD 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
|
633 |
/* 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
|
634 |
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
|
635 |
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
|
636 |
time_t seconds = IN.tv_sec; |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
637 |
if (NULL == localtime_r(&seconds, &broken_down_time)){ /* 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
|
638 |
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
|
639 |
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
|
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 |
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
|
642 |
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); |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
643 |
}else{ |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
644 |
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
|
645 |
} |
873a5b60a7ea
Fixed -I 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 |
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
|
647 |
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
|
648 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
649 |
static inline STRING __dt_to_string(DT 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
|
650 |
/* 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
|
651 |
STRING 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
|
652 |
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
|
653 |
time_t seconds = IN.tv_sec; |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
654 |
if (NULL == localtime_r(&seconds, &broken_down_time)){ /* 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
|
655 |
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
|
656 |
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
|
657 |
} |
873a5b60a7ea
Fixed -I 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 |
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
|
659 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "DT#%d-%2.2d-%2.2d-%2.2d:%2.2d:%d", |
873a5b60a7ea
Fixed -I 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 |
broken_down_time.tm_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
|
661 |
broken_down_time.tm_mon, |
873a5b60a7ea
Fixed -I 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 |
broken_down_time.tm_mday, |
873a5b60a7ea
Fixed -I 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 |
broken_down_time.tm_hour, |
873a5b60a7ea
Fixed -I 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 |
broken_down_time.tm_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
|
665 |
broken_down_time.tm_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
|
666 |
}else{ |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
667 |
res.len = snprintf((char*)&res.body, STR_MAX_LEN, "DT#%d-%2.2d-%2.2d-%2.2d:%2.2d:%g", |
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
|
668 |
broken_down_time.tm_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
|
669 |
broken_down_time.tm_mon, |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
670 |
broken_down_time.tm_mday, |
873a5b60a7ea
Fixed -I 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 |
broken_down_time.tm_hour, |
873a5b60a7ea
Fixed -I 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 |
broken_down_time.tm_min, |
42
b45c7f34dec1
IEC std lib test enhanced string ops, from string and to string conv.
etisserant
parents:
41
diff
changeset
|
673 |
(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
|
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 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
678 |
/* BCD */ |
48
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
679 |
#define __bcd_digit(fac) |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
680 |
static inline ULINT __bcd_to_uint(LWORD 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
|
681 |
return IN & 0xf + |
48
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
682 |
!(IN >>= 4) ? 0 : IN & 0xf * 10ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
683 |
!(IN >>= 4) ? 0 : IN & 0xf * 100ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
684 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
685 |
!(IN >>= 4) ? 0 : IN & 0xf * 10000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
686 |
!(IN >>= 4) ? 0 : IN & 0xf * 100000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
687 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
688 |
!(IN >>= 4) ? 0 : IN & 0xf * 10000000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
689 |
!(IN >>= 4) ? 0 : IN & 0xf * 100000000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
690 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000000000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
691 |
!(IN >>= 4) ? 0 : IN & 0xf * 10000000000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
692 |
!(IN >>= 4) ? 0 : IN & 0xf * 100000000000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
693 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000000000000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
694 |
!(IN >>= 4) ? 0 : IN & 0xf * 10000000000000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
695 |
!(IN >>= 4) ? 0 : IN & 0xf * 100000000000000ULL + |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
696 |
!(IN >>= 4) ? 0 : IN & 0xf * 1000000000000000ULL; |
3d24cc85bb3c
Fixed some problems win 32 bits GCC and Long Long literals
etisserant
parents:
43
diff
changeset
|
697 |
|
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
|
698 |
} |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
699 |
static inline LWORD __uint_to_bcd(ULINT 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
|
700 |
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
|
701 |
(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
|
702 |
(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
|
703 |
(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
|
704 |
(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
|
705 |
(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
|
706 |
(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
|
707 |
(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
|
708 |
(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
|
709 |
(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
|
710 |
(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
|
711 |
(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
|
712 |
(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
|
713 |
(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
|
714 |
(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
|
715 |
(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
|
716 |
} |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
/**************/ |
873a5b60a7ea
Fixed -I 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 |
/* Binary 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
|
720 |
/**************/ |
873a5b60a7ea
Fixed -I 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 |
#define __ror_(TYPENAME)\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
722 |
static inline TYPENAME __ror_##TYPENAME( TYPENAME IN, USINT N){\ |
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
|
723 |
N %= 8*sizeof(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
|
724 |
return (IN >> N) | (IN << 8*sizeof(TYPENAME)-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
|
725 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
726 |
/* Call previously defined macro for each ANY_NBIT */ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
727 |
ANY_NBIT(__ror_) |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
729 |
#define __rol_(TYPENAME)\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
730 |
static inline TYPENAME __rol_##TYPENAME( TYPENAME IN, USINT N){\ |
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
|
731 |
N %= 8*sizeof(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
|
732 |
return (IN << N) | (IN >> 8*sizeof(TYPENAME)-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
|
733 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
734 |
/* Call previously defined macro for each ANY_NBIT */ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
735 |
ANY_NBIT(__rol_) |
873a5b60a7ea
Fixed -I 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 |
/**************/ |
873a5b60a7ea
Fixed -I 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 |
/* Selection */ |
873a5b60a7ea
Fixed -I 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 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
741 |
/* limit */ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
742 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
743 |
|
873a5b60a7ea
Fixed -I 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 |
#define __limit_(TYPENAME)\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
745 |
static inline TYPENAME __limit_##TYPENAME( TYPENAME MN, TYPENAME IN, TYPENAME MX){\ |
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
|
746 |
return IN > MN ? IN < MX ? IN : MX : MN;\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
747 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
748 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
749 |
/* 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
|
750 |
ANY_NBIT(__limit_) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
751 |
ANY_NUM(__limit_) |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
752 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
753 |
#define __limit_time(TYPENAME)\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
754 |
static inline TIME __limit_##TYPENAME( TYPENAME MN, TYPENAME IN, TYPENAME MX){\ |
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
|
755 |
return __TIME_CMP(IN, MN) > 0 ? /* IN>MN ?*/\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
756 |
__TIME_CMP(IN, MX) < 0 ? /* IN<MX ?*/\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
757 |
IN : MX : MN;\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
758 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
759 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
760 |
/* 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
|
761 |
ANY_DATE(__limit_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
|
762 |
__limit_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
|
763 |
|
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
764 |
static inline STRING __limit_STRING( STRING MN, STRING IN, STRING MX){ |
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
|
765 |
return __STR_CMP(IN, MN) > 0 ? __STR_CMP(IN, MX) < 0 ? IN : MX : MN; |
873a5b60a7ea
Fixed -I 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 |
} |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
/**************/ |
873a5b60a7ea
Fixed -I 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 |
/* MAX */ |
873a5b60a7ea
Fixed -I 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 |
/**************/ |
873a5b60a7ea
Fixed -I 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 |
|
873a5b60a7ea
Fixed -I 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 |
/* workaround for va-atgs limitation on shorter that int params */ |
873a5b60a7ea
Fixed -I 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 |
#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
|
774 |
#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
|
775 |
#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
|
776 |
#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
|
777 |
#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
|
778 |
#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
|
779 |
#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
|
780 |
#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
|
781 |
#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
|
782 |
#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
|
783 |
#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
|
784 |
#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
|
785 |
#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
|
786 |
#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
|
787 |
#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
|
788 |
#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
|
789 |
#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
|
790 |
#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
|
791 |
#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
|
792 |
#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
|
793 |
#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
|
794 |
|
873a5b60a7ea
Fixed -I 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 __extrem_(fname,TYPENAME, COND) \ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
796 |
static inline TYPENAME fname##TYPENAME( UINT param_count, TYPENAME op1, ...){\ |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
797 |
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
|
798 |
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
|
799 |
\ |
873a5b60a7ea
Fixed -I 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 |
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
|
801 |
\ |
873a5b60a7ea
Fixed -I 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 |
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
|
803 |
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
|
804 |
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
|
805 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
806 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
807 |
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
|
808 |
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
|
809 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
810 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
811 |
#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
|
812 |
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
|
813 |
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
|
814 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
815 |
__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
|
816 |
#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
|
817 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
818 |
/* 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
|
819 |
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
|
820 |
__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
|
821 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
822 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
823 |
/* 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
|
824 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
825 |
#define __min_num(TYPENAME) __extrem_(__min, 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
|
826 |
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
|
827 |
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
|
828 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
829 |
__extrem_(__min, 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
|
830 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
831 |
#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
|
832 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
833 |
/* 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
|
834 |
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
|
835 |
__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
|
836 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
837 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
838 |
/* 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
|
839 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
840 |
#define __mux_(TYPENAME) \ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
841 |
static inline TYPENAME __mux_##TYPENAME( UINT param_count, UINT K, ...){\ |
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
|
842 |
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
|
843 |
UINT i;\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
844 |
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
|
845 |
\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
846 |
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
|
847 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
848 |
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
|
849 |
if(K == i){\ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
850 |
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
|
851 |
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
|
852 |
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
|
853 |
}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
|
854 |
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
|
855 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
856 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
857 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
858 |
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
|
859 |
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
|
860 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
861 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
862 |
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
|
863 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
864 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
865 |
/* 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
|
866 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
867 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
868 |
#define __compare_(fname,TYPENAME, COND) \ |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
40
diff
changeset
|
869 |
static inline BOOL fname##TYPENAME( UINT param_count, TYPENAME op1, ...){\ |
40
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
870 |
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
|
871 |
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
|
872 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
873 |
va_start (ap, op1); /* Initialize the argument list. */\ |
43 | 874 |
DBG(#fname #TYPENAME "\n")\ |
875 |
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
|
876 |
\ |
43 | 877 |
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
|
878 |
TYPENAME tmp = va_arg (ap, VA_ARGS_##TYPENAME);\ |
43 | 879 |
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
|
880 |
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
|
881 |
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
|
882 |
}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
|
883 |
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
|
884 |
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
|
885 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
886 |
}\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
887 |
\ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
888 |
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
|
889 |
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
|
890 |
} |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
891 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
892 |
#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
|
893 |
#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
|
894 |
#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
|
895 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
896 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
897 |
/* 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
|
898 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
899 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
900 |
#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
|
901 |
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
|
902 |
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
|
903 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
904 |
#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
|
905 |
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
|
906 |
__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
|
907 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
908 |
__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
|
909 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
910 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
911 |
/* 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
|
912 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
913 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
914 |
#define __ge_num(TYPENAME) __compare_num(__ge_, TYPENAME, >= ) |
43 | 915 |
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
|
916 |
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
|
917 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
918 |
#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
|
919 |
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
|
920 |
__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
|
921 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
922 |
__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
|
923 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
924 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
925 |
/* 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
|
926 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
927 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
928 |
#define __eq_num(TYPENAME) __compare_num(__eq_, TYPENAME, == ) |
43 | 929 |
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
|
930 |
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
|
931 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
932 |
#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
|
933 |
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
|
934 |
__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
|
935 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
936 |
__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
|
937 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
938 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
939 |
/* 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
|
940 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
941 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
942 |
#define __lt_num(TYPENAME) __compare_num(__lt_, TYPENAME, < ) |
43 | 943 |
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
|
944 |
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
|
945 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
946 |
#define __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
|
947 |
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
|
948 |
__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
|
949 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
950 |
__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
|
951 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
952 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
953 |
/* 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
|
954 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
955 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
956 |
#define __le_num(TYPENAME) __compare_num(__le_, TYPENAME, <= ) |
43 | 957 |
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
|
958 |
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
|
959 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
960 |
#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
|
961 |
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
|
962 |
__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
|
963 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
964 |
__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
|
965 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
966 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
967 |
/* 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
|
968 |
/**************/ |
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
969 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
970 |
#define __ne_num(TYPENAME) __compare_num(__ne_, TYPENAME, != ) |
43 | 971 |
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
|
972 |
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
|
973 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
974 |
#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
|
975 |
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
|
976 |
__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
|
977 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
978 |
__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
|
979 |
|
873a5b60a7ea
Fixed -I library include path behavior + removed old lib implementation + added generated lib func names to stage 1_2 + added Makefile.Linux
etisserant
parents:
diff
changeset
|
980 |