lib/iec_types.h
author laurent
Sat, 05 Dec 2009 18:35:38 +0100
changeset 225 36d05588f91b
parent 212 8c9ec7d37d3a
child 254 28bd86c56793
permissions -rwxr-xr-x
Fix accessor code
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents: 59
diff changeset
     1
#ifndef IEC_TYPES_H
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents: 59
diff changeset
     2
#define IEC_TYPES_H
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents: 59
diff changeset
     3
59
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
     4
#include <limits.h>
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
     5
#include <float.h>
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
     6
#include <time.h>
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
     7
#include <stdint.h>
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
     8
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
     9
/*********************/
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    10
/*  IEC Types defs   */
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    11
/*********************/
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    12
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    13
typedef uint8_t  IEC_BOOL;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    14
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    15
typedef int8_t    IEC_SINT;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    16
typedef int16_t   IEC_INT;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    17
typedef int32_t   IEC_DINT;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    18
typedef int64_t   IEC_LINT;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    19
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    20
typedef uint8_t    IEC_USINT;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    21
typedef uint16_t   IEC_UINT;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    22
typedef uint32_t   IEC_UDINT;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    23
typedef uint64_t   IEC_ULINT;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    24
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    25
typedef uint8_t    IEC_BYTE;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    26
typedef uint16_t   IEC_WORD;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    27
typedef uint32_t   IEC_DWORD;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    28
typedef uint64_t   IEC_LWORD;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    29
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    30
typedef float    IEC_REAL;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    31
typedef double   IEC_LREAL;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    32
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    33
212
8c9ec7d37d3a Fix some warnings on compilation
greg
parents: 170
diff changeset
    34
#if !defined __timespec_defined && !defined __time_t_defined
59
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    35
# define __timespec_defined     1
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    36
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    37
struct timespec
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    38
  {
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    39
    long int tv_sec;            /* Seconds.  */
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    40
    long int tv_nsec;           /* Nanoseconds.  */
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    41
  };
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    42
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    43
#endif
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    44
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    45
typedef struct timespec IEC_TIME;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    46
typedef struct timespec IEC_DATE;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    47
typedef struct timespec IEC_DT;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    48
typedef struct timespec IEC_TOD;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    49
161
a27957e13d42 STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents: 137
diff changeset
    50
#ifndef STR_MAX_LEN
170
e10fbd3707df Disable compiling warnings on Windows
lbessard
parents: 168
diff changeset
    51
#define STR_MAX_LEN 126
161
a27957e13d42 STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents: 137
diff changeset
    52
#endif
a27957e13d42 STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents: 137
diff changeset
    53
a27957e13d42 STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents: 137
diff changeset
    54
#ifndef STR_LEN_TYPE
163
61f65dd6eeb9 Fixed errors in string_to_int.
etisserant
parents: 161
diff changeset
    55
#define STR_LEN_TYPE int8_t
161
a27957e13d42 STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents: 137
diff changeset
    56
#endif
a27957e13d42 STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents: 137
diff changeset
    57
a27957e13d42 STRING max size and length type can now be overloaded (define STR_MAX_LEN and STR_LEN_TYPE before including iec_types.h)
etisserant
parents: 137
diff changeset
    58
typedef STR_LEN_TYPE __strlen_t;
59
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    59
typedef struct {
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    60
    __strlen_t len;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    61
    uint8_t body[STR_MAX_LEN];
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    62
} IEC_STRING;
37ba6f9e51e2 Splitted type declaration out of iec std lib, to avoid DWORD, BOOL, TIME ,... clash with windows.h
etisserant
parents:
diff changeset
    63
137
9ceda59abd27 Re-organized types headers, to ease debug code generation
etisserant
parents: 59
diff changeset
    64
#endif /*IEC_TYPES_H*/