1 /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- 2 * 3 * Copyright (c) 2014-2015 Datalight, Inc. 4 * All Rights Reserved Worldwide. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; use version 2 of the License. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 /* Businesses and individuals that for commercial or other reasons cannot 21 * comply with the terms of the GPLv2 license may obtain a commercial license 22 * before incorporating Reliance Edge into proprietary software for 23 * distribution in any form. Visit http://www.datalight.com/reliance-edge for 24 * more information. 25 */ 26 27 /** @file 28 * @brief Defines basic types used by Reliance Edge. 29 * 30 * The following types *must* be defined by this header, either directly (using 31 * typedef) or indirectly (by including other headers, such as the C99 headers 32 * stdint.h and stdbool.h): 33 * 34 * - bool: Boolean type, capable of storing true (1) or false (0) 35 * - uint8_t: Unsigned 8-bit integer 36 * - int8_t: Signed 8-bit integer 37 * - uint16_t: Unsigned 16-bit integer 38 * - int16_t: Signed 16-bit integer 39 * - uint32_t: Unsigned 32-bit integer 40 * - int32_t: Signed 32-bit integer 41 * - uint64_t: Unsigned 64-bit integer 42 * - int64_t: Signed 64-bit integer 43 * - uintptr_t: Unsigned integer capable of storing a pointer, preferably the 44 * same size as pointers themselves. 45 * 46 * These types deliberately use the same names as the standard C99 types, so 47 * that if the C99 headers stdint.h and stdbool.h are available, they may be 48 * included here. 49 * 50 * If the user application defines similar types, those may be reused. For 51 * example, suppose there is an application header apptypes.h which defines 52 * types with a similar purpose but different names. That header could be 53 * reused to define the types Reliance Edge needs: 54 * 55 * ~~~{.c} 56 #include <apptypes.h> 57 * 58 * typedef BOOL bool; 59 * typedef BYTE uint8_t; 60 * typedef INT8 int8_t; 61 * // And so on... 62 * ~~~ 63 * 64 * If there are neither C99 headers nor suitable types in application headers, 65 * this header should be populated with typedefs that define the required types 66 * in terms of the standard C types. This requires knowledge of the size of 67 * the C types on the target hardware (e.g., how big is an "int" or a pointer). 68 * Below is an example which assumes the target has 8-bit chars, 16-bit shorts, 69 * 32-bit ints, 32-bit pointers, and 64-bit long longs: 70 * 71 * ~~~{.c} 72 * typedef int bool; 73 * typedef unsigned char uint8_t; 74 * typedef signed char int8_t; 75 * typedef unsigned short uint16_t; 76 * typedef short int16_t; 77 * typedef unsigned int uint32_t; 78 * typedef int int32_t; 79 * typedef unsigned long long uint64_t; 80 * typedef long long int64_t; 81 * typedef uint32_t uintptr_t; 82 * ~~~ 83 */ 84 #ifndef REDTYPES_H 85 #define REDTYPES_H 86 87 88 typedef int bool; /**< @brief Boolean type; either true or false. */ 89 90 typedef unsigned __int8 uint8_t; /**< @brief Unsigned 8-bit integer. */ 91 typedef __int8 int8_t; /**< @brief Signed 8-bit integer. */ 92 93 typedef unsigned __int16 uint16_t; /**< @brief Unsigned 16-bit integer. */ 94 typedef __int16 int16_t; /**< @brief Signed 16-bit integer. */ 95 96 typedef unsigned __int32 uint32_t; /**< @brief Unsigned 32-bit integer. */ 97 typedef __int32 int32_t; /**< @brief Signed 32-bit integer. */ 98 99 typedef unsigned __int64 uint64_t; /**< @brief Unsigned 64-bit integer. */ 100 typedef __int64 int64_t; /**< @brief Signed 64-bit integer. */ 101 102 /** @brief Unsigned integer capable of storing a pointer. 103 */ 104 #ifdef _WIN64 105 typedef uint64_t uintptr_t; 106 #else 107 typedef uint32_t uintptr_t; 108 #endif 109 110 111 #endif /* ifndef REDTYPES_H */ 112