407 return params |
407 return params |
408 |
408 |
409 |
409 |
410 ANY_TO_ANY_LIST=[ |
410 ANY_TO_ANY_LIST=[ |
411 # simple type conv are let as C cast |
411 # simple type conv are let as C cast |
412 (("ANY_NUM","ANY_BIT"),("ANY_NUM","ANY_BIT"), "(%(return_type)s)%(IN_value)s"), |
412 (("ANY_NUM","ANY_BIT"),("ANY_NUM","ANY_BIT"), ("return_type", None, None)), |
413 # TO_TIME |
413 # TO_TIME |
414 (("ANY_INT","ANY_BIT"),("ANY_DATE","TIME"), "(%(return_type)s)__int_to_time(%(IN_value)s)"), |
414 (("ANY_INT","ANY_BIT"),("ANY_DATE","TIME"), ("return_type", "__int_to_time", None)), |
415 (("ANY_REAL",),("ANY_DATE","TIME"), "(%(return_type)s)__real_to_time(%(IN_value)s)"), |
415 (("ANY_REAL",),("ANY_DATE","TIME"), ("return_type", "__real_to_time", None)), |
416 (("ANY_STRING",), ("ANY_DATE","TIME"), "(%(return_type)s)__string_to_time(%(IN_value)s)"), |
416 (("ANY_STRING",), ("ANY_DATE","TIME"), ("return_type", "__string_to_time", None)), |
417 # FROM_TIME |
417 # FROM_TIME |
418 (("ANY_DATE","TIME"), ("ANY_REAL",), "(%(return_type)s)__time_to_real(%(IN_value)s)"), |
418 (("ANY_DATE","TIME"), ("ANY_REAL",), ("return_type", "__time_to_real", None)), |
419 (("ANY_DATE","TIME"), ("ANY_INT","ANY_NBIT"), "(%(return_type)s)__time_to_int(%(IN_value)s)"), |
419 (("ANY_DATE","TIME"), ("ANY_INT","ANY_NBIT"), ("return_type", "__time_to_int", None)), |
420 (("TIME",), ("ANY_STRING",), "(%(return_type)s)__time_to_string(%(IN_value)s)"), |
420 (("TIME",), ("ANY_STRING",), ("return_type", "__time_to_string", None)), |
421 (("DATE",), ("ANY_STRING",), "(%(return_type)s)__date_to_string(%(IN_value)s)"), |
421 (("DATE",), ("ANY_STRING",), ("return_type", "__date_to_string", None)), |
422 (("TOD",), ("ANY_STRING",), "(%(return_type)s)__tod_to_string(%(IN_value)s)"), |
422 (("TOD",), ("ANY_STRING",), ("return_type", "__tod_to_string", None)), |
423 (("DT",), ("ANY_STRING",), "(%(return_type)s)__dt_to_string(%(IN_value)s)"), |
423 (("DT",), ("ANY_STRING",), ("return_type", "__dt_to_string", None)), |
424 # TO_STRING |
424 # TO_STRING |
425 (("BOOL",), ("ANY_STRING",), "(%(return_type)s)__bool_to_string(%(IN_value)s)"), |
425 (("BOOL",), ("ANY_STRING",), ("return_type", "__bool_to_string", None)), |
426 (("ANY_BIT",), ("ANY_STRING",), "(%(return_type)s)__bit_to_string(%(IN_value)s)"), |
426 (("ANY_BIT",), ("ANY_STRING",), ("return_type", "__bit_to_string", None)), |
427 (("ANY_REAL",), ("ANY_STRING",), "(%(return_type)s)__real_to_string(%(IN_value)s)"), |
427 (("ANY_REAL",), ("ANY_STRING",), ("return_type", "__real_to_string", None)), |
428 (("ANY_SINT",), ("ANY_STRING",), "(%(return_type)s)__sint_to_string(%(IN_value)s)"), |
428 (("ANY_SINT",), ("ANY_STRING",), ("return_type", "__sint_to_string", None)), |
429 (("ANY_UINT",), ("ANY_STRING",), "(%(return_type)s)__uint_to_string(%(IN_value)s)"), |
429 (("ANY_UINT",), ("ANY_STRING",), ("return_type", "__uint_to_string", None)), |
430 # FROM_STRING |
430 # FROM_STRING |
431 (("ANY_STRING",), ("BOOL",), "(%(return_type)s)__string_to_bool(%(IN_value)s)"), |
431 (("ANY_STRING",), ("BOOL",), ("return_type", "__string_to_bool", None)), |
432 (("ANY_STRING",), ("ANY_BIT",), "(%(return_type)s)__string_to_bit(%(IN_value)s)"), |
432 (("ANY_STRING",), ("ANY_BIT",), ("return_type", "__string_to_bit", None)), |
433 (("ANY_STRING",), ("ANY_SINT",), "(%(return_type)s)__string_to_sint(%(IN_value)s)"), |
433 (("ANY_STRING",), ("ANY_SINT",), ("return_type", "__string_to_sint", None)), |
434 (("ANY_STRING",), ("ANY_UINT",), "(%(return_type)s)__string_to_uint(%(IN_value)s)"), |
434 (("ANY_STRING",), ("ANY_UINT",), ("return_type", "__string_to_uint", None)), |
435 (("ANY_STRING",), ("ANY_REAL",), "(%(return_type)s)__string_to_real(%(IN_value)s)")] |
435 (("ANY_STRING",), ("ANY_REAL",), ("return_type", "__string_to_real", None))] |
436 |
436 |
437 |
437 |
438 BCD_TO_ANY_LIST=[ |
438 BCD_TO_ANY_LIST=[ |
439 (("BYTE",),("USINT",), "(%(return_type)s)__bcd_to_uint(%(IN_value)s)"), |
439 (("BYTE",),("USINT",), ("return_type", "__bcd_to_uint", None)), |
440 (("WORD",),("UINT",), "(%(return_type)s)__bcd_to_uint(%(IN_value)s)"), |
440 (("WORD",),("UINT",), ("return_type", "__bcd_to_uint", None)), |
441 (("DWORD",),("UDINT",), "(%(return_type)s)__bcd_to_uint(%(IN_value)s)"), |
441 (("DWORD",),("UDINT",), ("return_type", "__bcd_to_uint", None)), |
442 (("LWORD",),("ULINT",), "(%(return_type)s)__bcd_to_uint(%(IN_value)s)")] |
442 (("LWORD",),("ULINT",), ("return_type", "__bcd_to_uint", None))] |
443 |
443 |
444 |
444 |
445 ANY_TO_BCD_LIST=[ |
445 ANY_TO_BCD_LIST=[ |
446 (("USINT",),("BYTE",), "(%(return_type)s)__uint_to_bcd(%(IN_value)s)"), |
446 (("USINT",),("BYTE",), ("return_type", "__uint_to_bcd", None)), |
447 (("UINT",),("WORD",), "(%(return_type)s)__uint_to_bcd(%(IN_value)s)"), |
447 (("UINT",),("WORD",), ("return_type", "__uint_to_bcd", None)), |
448 (("UDINT",),("DWORD",), "(%(return_type)s)__uint_to_bcd(%(IN_value)s)"), |
448 (("UDINT",),("DWORD",), ("return_type", "__uint_to_bcd", None)), |
449 (("ULINT",),("LWORD",), "(%(return_type)s)__uint_to_bcd(%(IN_value)s)")] |
449 (("ULINT",),("LWORD",), ("return_type", "__uint_to_bcd", None))] |
450 |
450 |
451 |
451 |
452 def ANY_TO_ANY_FORMAT_GEN(any_to_any_list, fdecl): |
452 def ANY_TO_ANY_FORMAT_GEN(any_to_any_list, fdecl): |
453 |
453 |
454 for (InTypes, OutTypes, Format) in any_to_any_list: |
454 for (InTypes, OutTypes, Format) in any_to_any_list: |