diff -r ba80c3ceb6fb -r 2c3c4dc34979 lib/iec_types_all.h --- a/lib/iec_types_all.h Mon Jul 11 09:47:27 2011 +0100 +++ b/lib/iec_types_all.h Fri Jul 29 16:03:28 2011 +0100 @@ -1,7 +1,59 @@ +/* + * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD + * + * See COPYING and COPYING.LESSER files for copyright details. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + * + */ + #ifndef IEC_TYPES_ALL_H #define IEC_TYPES_ALL_H -#include "iec_std_lib_generated.h" + +/* Macro that expand to subtypes */ +#define __ANY(DO) __ANY_DERIVED(DO) __ANY_ELEMENTARY(DO) +#define __ANY_DERIVED(DO) +#define __ANY_ELEMENTARY(DO) __ANY_MAGNITUDE(DO) __ANY_BIT(DO) __ANY_STRING(DO) __ANY_DATE(DO) +#define __ANY_MAGNITUDE(DO) __ANY_NUM(DO) DO(TIME) +#define __ANY_BIT(DO) __ANY_NBIT(DO) DO(BOOL) +#define __ANY_NBIT(DO) DO(BYTE) DO(WORD) DO(DWORD) DO(LWORD) +#define __ANY_STRING(DO) DO(STRING) +#define __ANY_DATE(DO) DO(DATE) DO(TOD) DO(DT) +#define __ANY_NUM(DO) __ANY_REAL(DO) __ANY_INT(DO) +#define __ANY_REAL(DO) DO(REAL) DO(LREAL) +#define __ANY_INT(DO) __ANY_SINT(DO) __ANY_UINT(DO) +#define __ANY_SINT(DO) DO(SINT) DO(INT) DO(DINT) DO(LINT) +#define __ANY_UINT(DO) DO(USINT) DO(UINT) DO(UDINT) DO(ULINT) + + +/* Macro that expand to subtypes */ +#define __ANY_1(DO,P1) __ANY_DERIVED_1(DO,P1) __ANY_ELEMENTARY_1(DO,P1) +#define __ANY_DERIVED_1(DO,P1) +#define __ANY_ELEMENTARY_1(DO,P1) __ANY_MAGNITUDE_1(DO,P1) __ANY_BIT_1(DO,P1) __ANY_STRING_1(DO,P1) __ANY_DATE_1(DO,P1) +#define __ANY_MAGNITUDE_1(DO,P1) __ANY_NUM_1(DO,P1) DO(TIME,P1) +#define __ANY_BIT_1(DO,P1) __ANY_NBIT_1(DO,P1) DO(BOOL,P1) +#define __ANY_NBIT_1(DO,P1) DO(BYTE,P1) DO(WORD,P1) DO(DWORD,P1) DO(LWORD,P1) +#define __ANY_STRING_1(DO,P1) DO(STRING,P1) +#define __ANY_DATE_1(DO,P1) DO(DATE,P1) DO(TOD,P1) DO(DT,P1) +#define __ANY_NUM_1(DO,P1) __ANY_REAL_1(DO,P1) __ANY_INT_1(DO,P1) +#define __ANY_REAL_1(DO,P1) DO(REAL,P1) DO(LREAL,P1) +#define __ANY_INT_1(DO,P1) __ANY_SINT_1(DO,P1) __ANY_UINT_1(DO,P1) +#define __ANY_SINT_1(DO,P1) DO(SINT,P1) DO(INT,P1) DO(DINT,P1) DO(LINT,P1) +#define __ANY_UINT_1(DO,P1) DO(USINT,P1) DO(UINT,P1) DO(UDINT,P1) DO(ULINT,P1) + + /*********************/ /* IEC Types defs */ @@ -67,7 +119,7 @@ /* Those typdefs clash with windows.h */ /* i.e. this file cannot be included aside windows.h */ -ANY(__DECLARE_IEC_TYPE) +__ANY(__DECLARE_IEC_TYPE) typedef struct { __IEC_BOOL_t state; // current step state. 0 : inative, 1: active @@ -85,16 +137,16 @@ } ACTION; /* Extra debug types for SFC */ -#define ANY_SFC(DO) DO(STEP) DO(TRANSITION) DO(ACTION) +#define __ANY_SFC(DO) DO(STEP) DO(TRANSITION) DO(ACTION) /* Enumerate native types */ #define __decl_enum_type(TYPENAME) TYPENAME##_ENUM, #define __decl_enum_pointer(TYPENAME) TYPENAME##_P_ENUM, #define __decl_enum_output(TYPENAME) TYPENAME##_O_ENUM, typedef enum{ - ANY(__decl_enum_type) - ANY(__decl_enum_pointer) - ANY(__decl_enum_output) + __ANY(__decl_enum_type) + __ANY(__decl_enum_pointer) + __ANY(__decl_enum_output) /* SFC specific types are never external or global */ UNKNOWN_ENUM } __IEC_types_enum; @@ -107,7 +159,7 @@ return sizeof(TYPENAME); static inline USINT __get_type_enum_size(__IEC_types_enum t){ switch(t){ - ANY(__decl_size_case) + __ANY(__decl_size_case) /* size do not correspond to real struct. * only a bool is used to represent state*/ default: