Webserver+3d print
common/compiler_port.h@0:8918a71cdbe9, 2017-02-04 (annotated)
- Committer:
- Sergunb
- Date:
- Sat Feb 04 18:15:49 2017 +0000
- Revision:
- 0:8918a71cdbe9
nothing else
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sergunb | 0:8918a71cdbe9 | 1 | /** |
Sergunb | 0:8918a71cdbe9 | 2 | * @file compiler_port.h |
Sergunb | 0:8918a71cdbe9 | 3 | * @brief Compiler specific definitions |
Sergunb | 0:8918a71cdbe9 | 4 | * |
Sergunb | 0:8918a71cdbe9 | 5 | * @section License |
Sergunb | 0:8918a71cdbe9 | 6 | * |
Sergunb | 0:8918a71cdbe9 | 7 | * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. |
Sergunb | 0:8918a71cdbe9 | 8 | * |
Sergunb | 0:8918a71cdbe9 | 9 | * This program is free software; you can redistribute it and/or |
Sergunb | 0:8918a71cdbe9 | 10 | * modify it under the terms of the GNU General Public License |
Sergunb | 0:8918a71cdbe9 | 11 | * as published by the Free Software Foundation; either version 2 |
Sergunb | 0:8918a71cdbe9 | 12 | * of the License, or (at your option) any later version. |
Sergunb | 0:8918a71cdbe9 | 13 | * |
Sergunb | 0:8918a71cdbe9 | 14 | * This program is distributed in the hope that it will be useful, |
Sergunb | 0:8918a71cdbe9 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Sergunb | 0:8918a71cdbe9 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Sergunb | 0:8918a71cdbe9 | 17 | * GNU General Public License for more details. |
Sergunb | 0:8918a71cdbe9 | 18 | * |
Sergunb | 0:8918a71cdbe9 | 19 | * You should have received a copy of the GNU General Public License |
Sergunb | 0:8918a71cdbe9 | 20 | * along with this program; if not, write to the Free Software Foundation, |
Sergunb | 0:8918a71cdbe9 | 21 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
Sergunb | 0:8918a71cdbe9 | 22 | * |
Sergunb | 0:8918a71cdbe9 | 23 | * @author Oryx Embedded SARL (www.oryx-embedded.com) |
Sergunb | 0:8918a71cdbe9 | 24 | * @version 1.7.6 |
Sergunb | 0:8918a71cdbe9 | 25 | **/ |
Sergunb | 0:8918a71cdbe9 | 26 | |
Sergunb | 0:8918a71cdbe9 | 27 | #ifndef _COMPILER_PORT_H |
Sergunb | 0:8918a71cdbe9 | 28 | #define _COMPILER_PORT_H |
Sergunb | 0:8918a71cdbe9 | 29 | |
Sergunb | 0:8918a71cdbe9 | 30 | //Dependencies |
Sergunb | 0:8918a71cdbe9 | 31 | #include <stddef.h> |
Sergunb | 0:8918a71cdbe9 | 32 | #include <stdint.h> |
Sergunb | 0:8918a71cdbe9 | 33 | #include <inttypes.h> |
Sergunb | 0:8918a71cdbe9 | 34 | |
Sergunb | 0:8918a71cdbe9 | 35 | //Types |
Sergunb | 0:8918a71cdbe9 | 36 | typedef char char_t; |
Sergunb | 0:8918a71cdbe9 | 37 | typedef signed int int_t; |
Sergunb | 0:8918a71cdbe9 | 38 | typedef unsigned int uint_t; |
Sergunb | 0:8918a71cdbe9 | 39 | typedef uint32_t systime_t; |
Sergunb | 0:8918a71cdbe9 | 40 | |
Sergunb | 0:8918a71cdbe9 | 41 | #if !defined(R_TYPEDEFS_H) && !defined(USE_CHIBIOS_2) |
Sergunb | 0:8918a71cdbe9 | 42 | typedef int bool_t; |
Sergunb | 0:8918a71cdbe9 | 43 | #endif |
Sergunb | 0:8918a71cdbe9 | 44 | |
Sergunb | 0:8918a71cdbe9 | 45 | #if defined(__linux__) |
Sergunb | 0:8918a71cdbe9 | 46 | #define PRIuSIZE "zu" |
Sergunb | 0:8918a71cdbe9 | 47 | #define PRIuTIME "lu" |
Sergunb | 0:8918a71cdbe9 | 48 | #elif defined(_WIN32) |
Sergunb | 0:8918a71cdbe9 | 49 | #define PRIuSIZE "Iu" |
Sergunb | 0:8918a71cdbe9 | 50 | #define PRIuTIME "lu" |
Sergunb | 0:8918a71cdbe9 | 51 | #elif defined(__XC32) |
Sergunb | 0:8918a71cdbe9 | 52 | #define PRIuSIZE "u" |
Sergunb | 0:8918a71cdbe9 | 53 | #define PRIuTIME "u" |
Sergunb | 0:8918a71cdbe9 | 54 | #elif defined(__CWCC__) |
Sergunb | 0:8918a71cdbe9 | 55 | #define PRIu8 "u" |
Sergunb | 0:8918a71cdbe9 | 56 | #define PRIu16 "u" |
Sergunb | 0:8918a71cdbe9 | 57 | #define PRIu32 "u" |
Sergunb | 0:8918a71cdbe9 | 58 | #define PRIx8 "x" |
Sergunb | 0:8918a71cdbe9 | 59 | #define PRIx16 "x" |
Sergunb | 0:8918a71cdbe9 | 60 | #define PRIx32 "x" |
Sergunb | 0:8918a71cdbe9 | 61 | #define PRIX8 "X" |
Sergunb | 0:8918a71cdbe9 | 62 | #define PRIX16 "X" |
Sergunb | 0:8918a71cdbe9 | 63 | #define PRIX32 "X" |
Sergunb | 0:8918a71cdbe9 | 64 | #define PRIuSIZE "u" |
Sergunb | 0:8918a71cdbe9 | 65 | #define PRIuTIME "u" |
Sergunb | 0:8918a71cdbe9 | 66 | #else |
Sergunb | 0:8918a71cdbe9 | 67 | #define PRIuSIZE "u" |
Sergunb | 0:8918a71cdbe9 | 68 | #define PRIuTIME "lu" |
Sergunb | 0:8918a71cdbe9 | 69 | #endif |
Sergunb | 0:8918a71cdbe9 | 70 | |
Sergunb | 0:8918a71cdbe9 | 71 | #if defined(__CC_ARM) |
Sergunb | 0:8918a71cdbe9 | 72 | #undef PRIu8 |
Sergunb | 0:8918a71cdbe9 | 73 | #define PRIu8 "u" |
Sergunb | 0:8918a71cdbe9 | 74 | #undef PRIu16 |
Sergunb | 0:8918a71cdbe9 | 75 | #define PRIu16 "u" |
Sergunb | 0:8918a71cdbe9 | 76 | #endif |
Sergunb | 0:8918a71cdbe9 | 77 | |
Sergunb | 0:8918a71cdbe9 | 78 | //CodeWarrior compiler? |
Sergunb | 0:8918a71cdbe9 | 79 | #if defined(__CWCC__) |
Sergunb | 0:8918a71cdbe9 | 80 | typedef uint32_t time_t; |
Sergunb | 0:8918a71cdbe9 | 81 | int strcasecmp(const char *s1, const char *s2); |
Sergunb | 0:8918a71cdbe9 | 82 | int strncasecmp(const char *s1, const char *s2, size_t n); |
Sergunb | 0:8918a71cdbe9 | 83 | char *strtok_r(char *s, const char *delim, char **last); |
Sergunb | 0:8918a71cdbe9 | 84 | //TI ARM C compiler? |
Sergunb | 0:8918a71cdbe9 | 85 | #elif defined(__TI_ARM__) |
Sergunb | 0:8918a71cdbe9 | 86 | int strcasecmp(const char *s1, const char *s2); |
Sergunb | 0:8918a71cdbe9 | 87 | int strncasecmp(const char *s1, const char *s2, size_t n); |
Sergunb | 0:8918a71cdbe9 | 88 | char *strtok_r(char *s, const char *delim, char **last); |
Sergunb | 0:8918a71cdbe9 | 89 | #endif |
Sergunb | 0:8918a71cdbe9 | 90 | |
Sergunb | 0:8918a71cdbe9 | 91 | //Microchip XC32 compiler? |
Sergunb | 0:8918a71cdbe9 | 92 | #if defined(__XC32) |
Sergunb | 0:8918a71cdbe9 | 93 | #define sprintf _sprintf |
Sergunb | 0:8918a71cdbe9 | 94 | int sprintf(char * str, const char * format, ...); |
Sergunb | 0:8918a71cdbe9 | 95 | int strcasecmp(const char *s1, const char *s2); |
Sergunb | 0:8918a71cdbe9 | 96 | int strncasecmp(const char *s1, const char *s2, size_t n); |
Sergunb | 0:8918a71cdbe9 | 97 | char *strtok_r(char *s, const char *delim, char **last); |
Sergunb | 0:8918a71cdbe9 | 98 | #endif |
Sergunb | 0:8918a71cdbe9 | 99 | |
Sergunb | 0:8918a71cdbe9 | 100 | //GCC compiler? |
Sergunb | 0:8918a71cdbe9 | 101 | #if defined(__GNUC__) |
Sergunb | 0:8918a71cdbe9 | 102 | #undef __start_packed |
Sergunb | 0:8918a71cdbe9 | 103 | #define __start_packed |
Sergunb | 0:8918a71cdbe9 | 104 | #undef __end_packed |
Sergunb | 0:8918a71cdbe9 | 105 | #define __end_packed __attribute__((__packed__)) |
Sergunb | 0:8918a71cdbe9 | 106 | //Keil MDK-ARM compiler? |
Sergunb | 0:8918a71cdbe9 | 107 | #elif defined(__CC_ARM) |
Sergunb | 0:8918a71cdbe9 | 108 | #pragma anon_unions |
Sergunb | 0:8918a71cdbe9 | 109 | #undef __start_packed |
Sergunb | 0:8918a71cdbe9 | 110 | #define __start_packed __packed |
Sergunb | 0:8918a71cdbe9 | 111 | #undef __end_packed |
Sergunb | 0:8918a71cdbe9 | 112 | #define __end_packed |
Sergunb | 0:8918a71cdbe9 | 113 | //IAR C compiler? |
Sergunb | 0:8918a71cdbe9 | 114 | #elif defined(__IAR_SYSTEMS_ICC__) |
Sergunb | 0:8918a71cdbe9 | 115 | #undef __start_packed |
Sergunb | 0:8918a71cdbe9 | 116 | #define __start_packed __packed |
Sergunb | 0:8918a71cdbe9 | 117 | #undef __end_packed |
Sergunb | 0:8918a71cdbe9 | 118 | #define __end_packed |
Sergunb | 0:8918a71cdbe9 | 119 | //CodeWarrior compiler? |
Sergunb | 0:8918a71cdbe9 | 120 | #elif defined(__CWCC__) |
Sergunb | 0:8918a71cdbe9 | 121 | #undef __start_packed |
Sergunb | 0:8918a71cdbe9 | 122 | #define __start_packed |
Sergunb | 0:8918a71cdbe9 | 123 | #undef __end_packed |
Sergunb | 0:8918a71cdbe9 | 124 | #define __end_packed |
Sergunb | 0:8918a71cdbe9 | 125 | //TI ARM C compiler? |
Sergunb | 0:8918a71cdbe9 | 126 | #elif defined(__TI_ARM__) |
Sergunb | 0:8918a71cdbe9 | 127 | #undef __start_packed |
Sergunb | 0:8918a71cdbe9 | 128 | #define __start_packed |
Sergunb | 0:8918a71cdbe9 | 129 | #undef __end_packed |
Sergunb | 0:8918a71cdbe9 | 130 | #define __end_packed __attribute__((__packed__)) |
Sergunb | 0:8918a71cdbe9 | 131 | //Win32 compiler? |
Sergunb | 0:8918a71cdbe9 | 132 | #elif defined(_WIN32) |
Sergunb | 0:8918a71cdbe9 | 133 | #undef interface |
Sergunb | 0:8918a71cdbe9 | 134 | #undef __start_packed |
Sergunb | 0:8918a71cdbe9 | 135 | #define __start_packed |
Sergunb | 0:8918a71cdbe9 | 136 | #undef __end_packed |
Sergunb | 0:8918a71cdbe9 | 137 | #define __end_packed |
Sergunb | 0:8918a71cdbe9 | 138 | #endif |
Sergunb | 0:8918a71cdbe9 | 139 | |
Sergunb | 0:8918a71cdbe9 | 140 | #endif |
Sergunb | 0:8918a71cdbe9 | 141 |