# HG changeset patch # User etisserant # Date 1184752656 -7200 # Node ID 37dd4e2fd2ec94eda852961bd57988ff9b8e0e87 # Parent b45c7f34dec1bbda0e01811a419da8b0221f782e Test IEC_LIB and fix bugs (EQ, GT et all) diff -r b45c7f34dec1 -r 37dd4e2fd2ec lib/iec_std_lib.h --- a/lib/iec_std_lib.h Tue Jul 17 12:19:59 2007 +0200 +++ b/lib/iec_std_lib.h Wed Jul 18 11:57:36 2007 +0200 @@ -15,6 +15,35 @@ #include "iec_std_lib_generated.h" +#define __print_BOOL(name) printf(" %s = (BOOL) %s\n",#name, name?"TRUE":"FALSE"); +#define __print_SINT(name) printf(" %s = (SINT) %d\n",#name, name); +#define __print_INT(name) printf(" %s = (INT) %d\n",#name, name); +#define __print_DINT(name) printf(" %s = (DINT) %d\n",#name, name); +#define __print_LINT(name) printf(" %s = (LINT) %d\n",#name, name); +#define __print_USINT(name) printf(" %s = (USINT) %u\n",#name, name); +#define __print_UINT(name) printf(" %s = (UINT) %u\n",#name, name); +#define __print_UDINT(name) printf(" %s = (UDINT) %u\n",#name, name); +#define __print_ULINT(name) printf(" %s = (ULINT) %lu\n",#name, name); +#define __print_REAL(name) printf(" %s = (REAL) %f\n",#name, (double)name); +#define __print_LREAL(name) printf(" %s = (LREAL) %f\n",#name, (double)name); +#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);} +#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);} +#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);} +#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);} +#define __print_STRING(name) printf(" %s = (STRING) {%d, \"%*s\"}\n",#name, name.len, name.len, &name.body); +#define __print_BYTE(name) printf(" %s = (BYTE) 0x%2.2x\n",#name, name); +#define __print_WORD(name) printf(" %s = (WORD) 0x%4.4x\n",#name, name); +#define __print_DWORD(name) printf(" %s = (DWORD) 0x%8.8x\n",#name, name); +#define __print_LWORD(name) printf(" %s = (LWORD) 0x%16.16lx\n",#name, name); + +#ifdef DEBUG_IEC +#define DBG(...) printf(__VA_ARGS__); +#define DBG_TYPE(TYPENAME, name) __print_##TYPENAME(name); +#else +#define DBG(...) +#define DBG_TYPE(TYPENAME, name) +#endif + /*****************/ /* Types defs */ /*****************/ @@ -403,7 +432,7 @@ } static inline STRING __real_to_string(LREAL IN){ STRING res = __INIT_STRING; - res.len = snprintf(res.body, STR_MAX_LEN, "%g", IN); + res.len = snprintf(res.body, STR_MAX_LEN, "%.10g", IN); if(res.len > STR_MAX_LEN) res.len = STR_MAX_LEN; return res; } @@ -453,19 +482,19 @@ shift += 3; } } - }else if(IN->body[0]=='1' && IN->body[1]=='6' && IN->body[1]=='#'){ + }else if(IN->body[0]=='1' && IN->body[1]=='6' && IN->body[2]=='#'){ /* 16#1234_5678_9abc_DEFG */ for(l = IN->len - 1; l >= 3 && shift < 64; l--) { char c = IN->body[l]; if( c >= '0' && c <= '9'){ - res |= ( c - '0') << shift; + res |= (LWORD)( c - '0') << shift; shift += 4; }else if( c >= 'a' && c <= 'f'){ - res |= ( c - 'a' + 10 ) << shift; + res |= (LWORD)( c - 'a' + 10 ) << shift; shift += 4; }else if( c >= 'A' && c <= 'F'){ - res |= ( c - 'A' + 10 ) << shift; + res |= (LWORD)( c - 'A' + 10 ) << shift; shift += 4; } } @@ -840,9 +869,12 @@ UINT i;\ \ va_start (ap, op1); /* Initialize the argument list. */\ + DBG(#fname #TYPENAME "\n")\ + DBG_TYPE(TYPENAME, op1)\ \ - for (i = 0; i < param_count; i++){\ + for (i = 0; i < param_count - 1; i++){\ TYPENAME tmp = va_arg (ap, VA_ARGS_##TYPENAME);\ + DBG_TYPE(TYPENAME, tmp)\ if(COND){\ op1 = tmp;\ }else{\ @@ -878,7 +910,7 @@ /**************/ #define __ge_num(TYPENAME) __compare_num(__ge_, TYPENAME, >= ) -ANY_NBIT(__ge_num) +ANY_BIT(__ge_num) ANY_NUM(__ge_num) #define __ge_time(TYPENAME) __compare_time(__ge_, TYPENAME, >= ) @@ -892,7 +924,7 @@ /**************/ #define __eq_num(TYPENAME) __compare_num(__eq_, TYPENAME, == ) -ANY_NBIT(__eq_num) +ANY_BIT(__eq_num) ANY_NUM(__eq_num) #define __eq_time(TYPENAME) __compare_time(__eq_, TYPENAME, == ) @@ -906,7 +938,7 @@ /**************/ #define __lt_num(TYPENAME) __compare_num(__lt_, TYPENAME, < ) -ANY_NBIT(__lt_num) +ANY_BIT(__lt_num) ANY_NUM(__lt_num) #define __lt_time(TYPENAME) __compare_time(__lt_, TYPENAME, < ) @@ -920,7 +952,7 @@ /**************/ #define __le_num(TYPENAME) __compare_num(__le_, TYPENAME, <= ) -ANY_NBIT(__le_num) +ANY_BIT(__le_num) ANY_NUM(__le_num) #define __le_time(TYPENAME) __compare_time(__le_, TYPENAME, <= ) @@ -934,7 +966,7 @@ /**************/ #define __ne_num(TYPENAME) __compare_num(__ne_, TYPENAME, != ) -ANY_NBIT(__ne_num) +ANY_BIT(__ne_num) ANY_NUM(__ne_num) #define __ne_time(TYPENAME) __compare_time(__ne_, TYPENAME, != ) diff -r b45c7f34dec1 -r 37dd4e2fd2ec stage4/generate_cc/il_code_gen.c --- a/stage4/generate_cc/il_code_gen.c Tue Jul 17 12:19:59 2007 +0200 +++ b/stage4/generate_cc/il_code_gen.c Wed Jul 18 11:57:36 2007 +0200 @@ -14175,7 +14175,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__gt_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -14259,7 +14259,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__ge_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -14343,7 +14343,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__eq_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -14427,7 +14427,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__lt_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -14511,7 +14511,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__le_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -14595,7 +14595,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__ne_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); diff -r b45c7f34dec1 -r 37dd4e2fd2ec stage4/generate_cc/st_code_gen.c --- a/stage4/generate_cc/st_code_gen.c Tue Jul 17 12:19:59 2007 +0200 +++ b/stage4/generate_cc/st_code_gen.c Wed Jul 18 11:57:36 2007 +0200 @@ -15803,7 +15803,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__gt_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -15891,7 +15891,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__ge_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -15979,7 +15979,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__eq_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -16067,7 +16067,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__lt_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -16155,7 +16155,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__le_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); @@ -16243,7 +16243,7 @@ symbol_c * return_type_symbol = &search_constant_type_c::bool_type_name; s4o.indent_right(); s4o.print("__ne_"); - return_type_symbol->accept(*this); + last_type_symbol->accept(*this); s4o.print("("); s4o.print_integer(nb_param); s4o.print(",\n" + s4o.indent_spaces); diff -r b45c7f34dec1 -r 37dd4e2fd2ec tests/STD_TEST.xml --- a/tests/STD_TEST.xml Tue Jul 17 12:19:59 2007 +0200 +++ b/tests/STD_TEST.xml Wed Jul 18 11:57:36 2007 +0200 @@ -72,30 +72,6 @@ TESTNR - - - - - - - - - - - - - - - - - - - - - - - - @@ -109,28 +85,6 @@ INTRES - - - - - - - - - - - - - - - - - - - - - - @@ -183,22 +137,22 @@ - + - - - + + + - + - - - + + + @@ -208,8 +162,8 @@ - - + + @@ -223,69 +177,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + IN1 @@ -297,23 +192,23 @@ IN1 - + IN2 - + - - - - + + + + @@ -321,10 +216,10 @@ - - - - + + + + @@ -339,14 +234,14 @@ - + IN1 - + @@ -409,13 +304,6 @@ The FROM STRING test machine - - - - - - 1000.0 - @@ -443,19 +331,19 @@ 'LEN' - - - - - - 'STRING_TO_REAL *1000' - - - - - - - 'STRING_TO_INT' + + + + + + 'EQ(IN1,IN2)' + + + + + + + 'EQ(IN2,IN2)' @@ -470,7 +358,7 @@ - + @@ -492,11 +380,11 @@ - + - - - + + + @@ -545,6 +433,76 @@ TEST_NAME + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1555,21 +1513,26 @@ + + + + + - + - - - - - + + + + + @@ -1584,14 +1547,16 @@ - + - - + + + + @@ -1606,16 +1571,16 @@ - + - - - - - + + + + + @@ -1630,14 +1595,14 @@ - + - - - + + + @@ -1652,14 +1617,14 @@ - + - - - + + + @@ -1674,16 +1639,16 @@ - + - - - - - + + + + + @@ -1698,16 +1663,16 @@ - + - - - - - + + + + + @@ -1722,16 +1687,16 @@ - + - - - - - + + + + + @@ -1746,14 +1711,14 @@ - + - - - + + + @@ -1768,16 +1733,16 @@ - + - - - - - + + + + + @@ -1792,18 +1757,16 @@ - + - - - - - - - + + + + + @@ -1818,16 +1781,16 @@ - + - - - - - + + + + + @@ -1842,16 +1805,16 @@ - + - - - - - + + + + + @@ -1866,16 +1829,16 @@ - + - - - - - + + + + + @@ -1890,16 +1853,16 @@ - + - - - - - + + + + + @@ -1914,16 +1877,16 @@ - + - - - - - + + + + + @@ -1938,16 +1901,16 @@ - + - - - - - + + + + + @@ -1962,16 +1925,16 @@ - + - - - - - + + + + + @@ -1986,128 +1949,128 @@ - + FALSE - + -23 - + -1678 - + -1000000000 - + -100000000000 - + 23 - + 1678 - + 1000000000 - + 100000000000 - + 1.2345678 - + 1.23456789 - + t#5d14h12m18s3.5ms - + D#1984-06-25 - + TOD#15:36:55.36 - + DT#1984-06-25-15:36:55.36 - + 16#12 - + - - - - - + + + + + @@ -2122,277 +2085,275 @@ - + 16#1234 - + 16#1234_5678 - + 16#1234_5678_9abc_def0 - - + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - + TESTNR - - + + - - - - + + + + @@ -2400,10 +2361,10 @@ - - - - + + + + @@ -2411,10 +2372,10 @@ - - - - + + + + @@ -2429,428 +2390,1773 @@ - + 0 - + 18 - + - - - - - + + + + + RES_STR - + - - - - + + + + NEXT_TEST - + 'BOOL_TO_STRING' - + 'SINT_TO_STRING' - + 'INT_TO_STRING' - + 'DINT_TO_STRING' - + 'LINT_TO_STRING' - + 'USINT_TO_STRING' - + 'UINT_TO_STRING' - + 'UDINT_TO_STRING' - + 'ULINT_TO_STRING' - + 'REAL_TO_STRING' - + 'LREAL_TO_STRING' - + 'TIME_TO_STRING' - + 'DATE_TO_STRING' - + 'TOD_TO_STRING' - + 'DT_TO_STRING' - + 'BYTE_TO_STRING' - + 'WORD_TO_STRING' - + 'DWORD_TO_STRING' - + 'LWORD_TO_STRING' - - + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - - - - + + + + + TEST_NAME - - - This tests test litterals for all types, and convertion from ANY to STRING + + + +This POU tests: +- litterals for ANY types +- convertion from ANY types to STRING +- convertion from STRING to ANY types +- EQ test for ANY types + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RES_BOOL + @@ -2917,6 +4223,11 @@ + + + + + @@ -2964,14 +4275,14 @@ 3 - + - - - - + + + + RES_FROM_STR @@ -2983,26 +4294,13 @@ TEST_NB - - - - - - - - - - - - TEST_NB - - + @@ -3013,7 +4311,7 @@ - + @@ -3024,7 +4322,7 @@ - + @@ -3046,7 +4344,7 @@ - + @@ -3057,7 +4355,7 @@ - + @@ -3068,7 +4366,7 @@ - + @@ -3097,14 +4395,14 @@ - + - - + + @@ -3114,8 +4412,8 @@ - - + + @@ -3124,9 +4422,9 @@ - - - + + + @@ -3153,25 +4451,27 @@ - + - - - - - + + + + + TO_STR_TEST_NAME - + - - - + + + + + FROM_STR_TEST_NAME @@ -3181,27 +4481,27 @@ Main program for testing standard lib funcs - + - - - - - + + + + + - - - - - + + + + + @@ -3216,79 +4516,45 @@ - + - - - + + + TEST_NB - + 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + + + + + RES_TO_STR - + - - - - - + + + + + STR_OPS_TEST_NAME @@ -3306,6 +4572,184 @@ RES_STR_OPS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RES_TO_STR_BOOL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 'TEST_FROM_STRINGS : ' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 'TEST_STRING_OPS : ' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 'TEST_TO_STRINGS : ' + diff -r b45c7f34dec1 -r 37dd4e2fd2ec tests/build.sh --- a/tests/build.sh Tue Jul 17 12:19:59 2007 +0200 +++ b/tests/build.sh Wed Jul 18 11:57:36 2007 +0200 @@ -1,9 +1,12 @@ #!/bin/bash -../iec2cc STD_TEST.st -I ../lib +CFLAGS=$* -gcc -I ../lib -c -g STD_RESSOURCE.c +../iec2cc STD_TEST.st -I ../lib +#2>/dev/null -gcc -I ../lib -c -g STD_CONF.c +gcc -I ../lib -c STD_RESSOURCE.c $CFLAGS -gcc -I ../lib main.c STD_CONF.o STD_RESSOURCE.o -g -l rt -o test +gcc -I ../lib -c STD_CONF.c $CFLAGS + +gcc -I ../lib main.c STD_CONF.o STD_RESSOURCE.o $CFLAGS -l rt -o test diff -r b45c7f34dec1 -r 37dd4e2fd2ec tests/main.c --- a/tests/main.c Tue Jul 17 12:19:59 2007 +0200 +++ b/tests/main.c Wed Jul 18 11:57:36 2007 +0200 @@ -20,27 +20,6 @@ #include "LOCATED_VARIABLES.h" #undef __LOCATED_VAR -#define print_BOOL(name) printf(" %s = (BOOL) %s\n",#name, name?"TRUE":"FALSE"); -#define print_SINT(name) printf(" %s = (SINT) %d\n",#name, name); -#define print_INT(name) printf(" %s = (INT) %d\n",#name, name); -#define print_DINT(name) printf(" %s = (DINT) %d\n",#name, name); -#define print_LINT(name) printf(" %s = (LINT) %d\n",#name, name); -#define print_USINT(name) printf(" %s = (USINT) %u\n",#name, name); -#define print_UINT(name) printf(" %s = (UINT) %u\n",#name, name); -#define print_UDINT(name) printf(" %s = (UDINT) %u\n",#name, name); -#define print_ULINT(name) printf(" %s = (ULINT) %lu\n",#name, name); -#define print_REAL(name) printf(" %s = (REAL) %f\n",#name, (double)name); -#define print_LREAL(name) printf(" %s = (LREAL) %f\n",#name, (double)name); -#define print_TIME(name) {tmp STRING = __time_to_string(name);tmp.body[tmp.len] = 0; printf(" %s = (TIME) %s*s\n",#name, tmp.len, &tmp.body);} -#define print_DATE(name) {tmp STRING = __date_to_string(name);tmp.body[tmp.len] = 0; printf(" %s = (TIME) %*s\n",#name, tmp.len, &tmp.body);} -#define print_TOD(name) {tmp STRING = __tod_to_string(name);tmp.body[tmp.len] = 0; printf(" %s = (TIME) %*s\n",#name, tmp.len, &tmp.body);} -#define print_DT(name) {tmp STRING = __dt_to_string(name);tmp.body[tmp.len] = 0; printf(" %s = (TIME) %*s\n",#name, tmp.len, &tmp.body);} -#define print_STRING(name) printf(" %s = (STRING) {%d, \"%*s\"}\n",#name, name.len, name.len, &name.body); -#define print_BYTE(name) printf(" %s = (BYTE) 0x%2.2x\n",#name, name); -#define print_WORD(name) printf(" %s = (WORD) 0x%d4.4\n",#name, name); -#define print_DWORD(name) printf(" %s = (DWORD) 0x%d8.8\n",#name, name); -#define print_LWORD(name) printf(" %s = (LWORD) 0x%d16.16\n",#name, name); - static int tick = 0; void timer_notify(sigval_t val) { @@ -48,7 +27,7 @@ printf("Tick %d\n",tick); config_run__(tick++); printf(" Located variables : \n"); -#define __LOCATED_VAR(type, name) print_##type(name); +#define __LOCATED_VAR(type, name) __print_##type(name); #include "LOCATED_VARIABLES.h" #undef __LOCATED_VAR }