--- a/lib/create_standard_function_txt.sh Wed Jan 25 01:16:30 2012 +0100
+++ b/lib/create_standard_function_txt.sh Thu Feb 02 00:34:04 2012 +0100
@@ -712,8 +712,8 @@
/* Should be for: ANY_ELEMENTARY, but we currently do not support WSTRING yet... */
/* However, we can call __ANY_ELEMENTARY since the __ANY_STRING macro does not call DO(WSTRING) */
#define __iec_(TYPENAME) \
-__function_1e(NE, BOOL, IN, TYPENAME, 1) /* overloaded function */ \
-__function_1e(NE_##TYPENAME, BOOL, IN, TYPENAME, 1) /* explicitly typed function */
+__function_2p(NE, BOOL, IN1, TYPENAME, IN2, TYPENAME) /* overloaded function */ \
+__function_2p(NE_##TYPENAME, BOOL, IN1, TYPENAME, IN2, TYPENAME) /* explicitly typed function */
__ANY_ELEMENTARY(__iec_)
#undef __iec_
--- a/lib/iec_std_lib.h Wed Jan 25 01:16:30 2012 +0100
+++ b/lib/iec_std_lib.h Thu Feb 02 00:34:04 2012 +0100
@@ -725,6 +725,23 @@
return (to_TYPENAME)oper(op);\
}
+/******** [ANY_NUM | ANY_NBIT]_TO_BOOL ************/
+#define __convert_num_to_bool(TYPENAME) \
+static inline BOOL TYPENAME##_TO_BOOL(EN_ENO_PARAMS, TYPENAME op){\
+ TEST_EN(BOOL)\
+ return op == 0 ? 0 : 1;\
+}
+__ANY_NUM(__convert_num_to_bool)
+__ANY_NBIT(__convert_num_to_bool)
+
+/******** [TIME | ANY_DATE]_TO_BOOL ************/
+#define __convert_time_to_bool(TYPENAME) \
+static inline BOOL TYPENAME##_TO_BOOL(EN_ENO_PARAMS, TYPENAME op){\
+ TEST_EN(BOOL)\
+ return op.tv_sec == 0 && op.tv_nsec == 0 ? 0 : 1;\
+}
+__convert_time_to_bool(TIME)
+__ANY_DATE(__convert_time_to_bool)
#define __to_anynum_(from_TYPENAME) __ANY_NUM_1(__iec_,from_TYPENAME)
#define __to_anyint_(from_TYPENAME) __ANY_INT_1(__iec_,from_TYPENAME)
@@ -735,24 +752,24 @@
#define __to_anyreal_(from_TYPENAME) __ANY_REAL_1(__iec_,from_TYPENAME)
#define __to_anydate_(from_TYPENAME) __ANY_DATE_1(__iec_,from_TYPENAME)
-/******** [ANY_BIT]_TO_[ANY_NUM | ANT_BIT] ************/
+/******** [ANY_BIT]_TO_[ANY_NUM | ANT_NBIT] ************/
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __move_##to_TYPENAME)
__ANY_BIT(__to_anynum_)
-__ANY_BIT(__to_anybit_)
-#undef __iec_
-
-/******** [ANY_INT]_TO_[ANY_NUM | ANT_BIT] ************/
+__ANY_BIT(__to_anynbit_)
+#undef __iec_
+
+/******** [ANY_INT]_TO_[ANY_NUM | ANT_NBIT] ************/
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __move_##to_TYPENAME)
__ANY_INT(__to_anynum_)
-__ANY_INT(__to_anybit_)
-#undef __iec_
-
-/******** [ANY_REAL]_TO_[ANY_BIT] ************/
+__ANY_INT(__to_anynbit_)
+#undef __iec_
+
+/******** [ANY_REAL]_TO_[ANY_NBIT] ************/
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __real_to_bit)
-__ANY_REAL(__to_anybit_)
-#undef __iec_
-
-/******** [ANY_REAL]_TO_[ANY_INT] ************/
+__ANY_REAL(__to_anynbit_)
+#undef __iec_
+
+/******** [ANY_REAL]_TO_[ANY_NINT] ************/
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __real_to_sint)
__ANY_REAL(__to_anysint_)
#undef __iec_
@@ -786,9 +803,9 @@
/******** [TIME | ANY_DATE]_TO_[ANY_BIT | ANY_INT] ************/
#define __iec_(to_TYPENAME,from_TYPENAME) __convert_type(from_TYPENAME, to_TYPENAME, __time_to_int)
__to_anyint_(TIME)
-__to_anybit_(TIME)
+__to_anynbit_(TIME)
__ANY_DATE(__to_anyint_)
-__ANY_DATE(__to_anybit_)
+__ANY_DATE(__to_anynbit_)
#undef __iec_
/******** [TIME | ANY_DATE]_TO_[ANY_REAL] ************/
@@ -1131,12 +1148,13 @@
#define __mod(TYPENAME)\
/* The explicitly typed standard functions */\
static inline TYPENAME MOD_##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
- TEST_EN_COND(TYPENAME, op2 == 0)\
+ TEST_EN(TYPENAME)\
+ if (op2 == 0) return 0;\
return op1 % op2;\
}\
/* The overloaded standard functions */\
static inline TYPENAME MOD__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
- return DIV_##TYPENAME(EN_ENO, op1, op2);\
+ return MOD_##TYPENAME(EN_ENO, op1, op2);\
}
__ANY_INT(__mod)
@@ -1549,14 +1567,14 @@
/* The explicitly typed standard functions */
#define __in1_anyint_(in2_TYPENAME) __ANY_INT_1(__iec_,in2_TYPENAME)
#define __iec_(in1_TYPENAME,in2_TYPENAME) \
-static inline in2_TYPENAME MUX__##in2_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME(EN_ENO_PARAMS, UINT param_count, in1_TYPENAME K, ...){\
+static inline in2_TYPENAME MUX__##in2_TYPENAME##__##in1_TYPENAME##__##in2_TYPENAME(EN_ENO_PARAMS, in1_TYPENAME K, UINT param_count, ...){\
va_list ap;\
UINT i;\
in2_TYPENAME tmp;\
TEST_EN_COND(in2_TYPENAME, K >= param_count)\
tmp = __INIT_##in2_TYPENAME;\
\
- va_start (ap, K); /* Initialize the argument list. */\
+ va_start (ap, param_count); /* Initialize the argument list. */\
\
for (i = 0; i < param_count; i++){\
if(K == i){\
@@ -1734,18 +1752,32 @@
/**************/
/* NE */
/**************/
+
+#define __ne_num(fname, TYPENAME) \
+static inline BOOL fname(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
+ TEST_EN(BOOL)\
+ return op1 != op2 ? 1 : 0;\
+}
+
+#define __ne_time(fname, TYPENAME) \
+static inline BOOL fname(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
+ TEST_EN(BOOL)\
+ return __time_cmp(op1, op2) != 0 ? 1 : 0;\
+}
+
+
/* Comparison for numerical data types */
#define __iec_(TYPENAME) \
-__compare_num(NE_##TYPENAME, TYPENAME, != ) /* The explicitly typed standard functions */\
-__compare_num(NE__BOOL__##TYPENAME##__##TYPENAME, TYPENAME, != ) /* Overloaded function */
+__ne_num(NE_##TYPENAME, TYPENAME) /* The explicitly typed standard functions */\
+__ne_num(NE__BOOL__##TYPENAME##__##TYPENAME, TYPENAME) /* Overloaded function */
__ANY_NBIT(__iec_)
__ANY_NUM(__iec_)
#undef __iec_
/* Comparison for time data types */
#define __iec_(TYPENAME) \
-__compare_time(NE_##TYPENAME, TYPENAME, != ) /* The explicitly typed standard functions */\
-__compare_time(NE__BOOL__##TYPENAME##__##TYPENAME, TYPENAME, != ) /* Overloaded function */
+__ne_time(NE_##TYPENAME, TYPENAME) /* The explicitly typed standard functions */\
+__ne_time(NE__BOOL__##TYPENAME##__##TYPENAME, TYPENAME) /* Overloaded function */
__ANY_DATE(__iec_)
__iec_(TIME)
#undef __iec_
--- a/lib/standard_functions.txt Wed Jan 25 01:16:30 2012 +0100
+++ b/lib/standard_functions.txt Thu Feb 02 00:34:04 2012 +0100
@@ -1630,46 +1630,46 @@
FUNCTION LE_TOD : BOOL VAR_INPUT IN 1 .. : TOD; END_VAR RETURN; END_FUNCTION
FUNCTION LE : BOOL VAR_INPUT IN 1 .. : DT; END_VAR RETURN; END_FUNCTION
FUNCTION LE_DT : BOOL VAR_INPUT IN 1 .. : DT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : REAL; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_REAL : BOOL VAR_INPUT IN 1 .. : REAL; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : LREAL; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_LREAL : BOOL VAR_INPUT IN 1 .. : LREAL; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : SINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_SINT : BOOL VAR_INPUT IN 1 .. : SINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : INT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_INT : BOOL VAR_INPUT IN 1 .. : INT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : DINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_DINT : BOOL VAR_INPUT IN 1 .. : DINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : LINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_LINT : BOOL VAR_INPUT IN 1 .. : LINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : USINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_USINT : BOOL VAR_INPUT IN 1 .. : USINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : UINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_UINT : BOOL VAR_INPUT IN 1 .. : UINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : UDINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_UDINT : BOOL VAR_INPUT IN 1 .. : UDINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : ULINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_ULINT : BOOL VAR_INPUT IN 1 .. : ULINT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : TIME; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_TIME : BOOL VAR_INPUT IN 1 .. : TIME; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : BYTE; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_BYTE : BOOL VAR_INPUT IN 1 .. : BYTE; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : WORD; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_WORD : BOOL VAR_INPUT IN 1 .. : WORD; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : DWORD; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_DWORD : BOOL VAR_INPUT IN 1 .. : DWORD; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : LWORD; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_LWORD : BOOL VAR_INPUT IN 1 .. : LWORD; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : BOOL; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_BOOL : BOOL VAR_INPUT IN 1 .. : BOOL; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : STRING; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_STRING : BOOL VAR_INPUT IN 1 .. : STRING; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : DATE; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_DATE : BOOL VAR_INPUT IN 1 .. : DATE; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : TOD; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_TOD : BOOL VAR_INPUT IN 1 .. : TOD; END_VAR RETURN; END_FUNCTION
-FUNCTION NE : BOOL VAR_INPUT IN 1 .. : DT; END_VAR RETURN; END_FUNCTION
-FUNCTION NE_DT : BOOL VAR_INPUT IN 1 .. : DT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : REAL; IN2 : REAL; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_REAL : BOOL VAR_INPUT IN1 : REAL; IN2 : REAL; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : LREAL; IN2 : LREAL; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_LREAL : BOOL VAR_INPUT IN1 : LREAL; IN2 : LREAL; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : SINT; IN2 : SINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_SINT : BOOL VAR_INPUT IN1 : SINT; IN2 : SINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : INT; IN2 : INT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_INT : BOOL VAR_INPUT IN1 : INT; IN2 : INT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : DINT; IN2 : DINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_DINT : BOOL VAR_INPUT IN1 : DINT; IN2 : DINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : LINT; IN2 : LINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_LINT : BOOL VAR_INPUT IN1 : LINT; IN2 : LINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : USINT; IN2 : USINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_USINT : BOOL VAR_INPUT IN1 : USINT; IN2 : USINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : UINT; IN2 : UINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_UINT : BOOL VAR_INPUT IN1 : UINT; IN2 : UINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : UDINT; IN2 : UDINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_UDINT : BOOL VAR_INPUT IN1 : UDINT; IN2 : UDINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : ULINT; IN2 : ULINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_ULINT : BOOL VAR_INPUT IN1 : ULINT; IN2 : ULINT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : TIME; IN2 : TIME; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_TIME : BOOL VAR_INPUT IN1 : TIME; IN2 : TIME; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : BYTE; IN2 : BYTE; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_BYTE : BOOL VAR_INPUT IN1 : BYTE; IN2 : BYTE; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : WORD; IN2 : WORD; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_WORD : BOOL VAR_INPUT IN1 : WORD; IN2 : WORD; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : DWORD; IN2 : DWORD; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_DWORD : BOOL VAR_INPUT IN1 : DWORD; IN2 : DWORD; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : LWORD; IN2 : LWORD; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_LWORD : BOOL VAR_INPUT IN1 : LWORD; IN2 : LWORD; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : BOOL; IN2 : BOOL; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_BOOL : BOOL VAR_INPUT IN1 : BOOL; IN2 : BOOL; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : STRING; IN2 : STRING; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_STRING : BOOL VAR_INPUT IN1 : STRING; IN2 : STRING; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : DATE; IN2 : DATE; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_DATE : BOOL VAR_INPUT IN1 : DATE; IN2 : DATE; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : TOD; IN2 : TOD; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_TOD : BOOL VAR_INPUT IN1 : TOD; IN2 : TOD; END_VAR RETURN; END_FUNCTION
+FUNCTION NE : BOOL VAR_INPUT IN1 : DT; IN2 : DT; END_VAR RETURN; END_FUNCTION
+FUNCTION NE_DT : BOOL VAR_INPUT IN1 : DT; IN2 : DT; END_VAR RETURN; END_FUNCTION
FUNCTION LEN : SINT VAR_INPUT IN : STRING; END_VAR RETURN; END_FUNCTION
FUNCTION LEN : INT VAR_INPUT IN : STRING; END_VAR RETURN; END_FUNCTION
FUNCTION LEN : DINT VAR_INPUT IN : STRING; END_VAR RETURN; END_FUNCTION