mbed library sources, mbed-dev only for TYBLE16
Fork of mbed-dev by
Please refer flowing link.
/users/kenjiArai/notebook/tyble16-module-will-become-a-mbed-family--mbedliza/
platform/mbed_preprocessor.h@182:976b131d2800, 2018-02-25 (annotated)
- Committer:
- kenjiArai
- Date:
- Sun Feb 25 02:00:51 2018 +0000
- Revision:
- 182:976b131d2800
- Parent:
- 181:57724642e740
Only for TYBLE16
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 151:5eaa88a5bcc7 | 1 | /** \addtogroup platform */ |
<> | 151:5eaa88a5bcc7 | 2 | /** @{*/ |
AnnaBridge | 178:79309dc6340a | 3 | /** |
AnnaBridge | 178:79309dc6340a | 4 | * \defgroup platform_preprocessor preprocessor macros |
AnnaBridge | 178:79309dc6340a | 5 | * @{ |
AnnaBridge | 178:79309dc6340a | 6 | */ |
AnnaBridge | 178:79309dc6340a | 7 | |
<> | 151:5eaa88a5bcc7 | 8 | /* mbed Microcontroller Library |
<> | 151:5eaa88a5bcc7 | 9 | * Copyright (c) 2006-2013 ARM Limited |
<> | 151:5eaa88a5bcc7 | 10 | * |
<> | 151:5eaa88a5bcc7 | 11 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 151:5eaa88a5bcc7 | 12 | * you may not use this file except in compliance with the License. |
<> | 151:5eaa88a5bcc7 | 13 | * You may obtain a copy of the License at |
<> | 151:5eaa88a5bcc7 | 14 | * |
<> | 151:5eaa88a5bcc7 | 15 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 151:5eaa88a5bcc7 | 16 | * |
<> | 151:5eaa88a5bcc7 | 17 | * Unless required by applicable law or agreed to in writing, software |
<> | 151:5eaa88a5bcc7 | 18 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 151:5eaa88a5bcc7 | 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 151:5eaa88a5bcc7 | 20 | * See the License for the specific language governing permissions and |
<> | 151:5eaa88a5bcc7 | 21 | * limitations under the License. |
<> | 151:5eaa88a5bcc7 | 22 | */ |
<> | 151:5eaa88a5bcc7 | 23 | #ifndef MBED_PREPROCESSOR_H |
<> | 151:5eaa88a5bcc7 | 24 | #define MBED_PREPROCESSOR_H |
<> | 151:5eaa88a5bcc7 | 25 | |
<> | 151:5eaa88a5bcc7 | 26 | |
<> | 151:5eaa88a5bcc7 | 27 | /** MBED_CONCAT |
<> | 151:5eaa88a5bcc7 | 28 | * Concatenate tokens together |
<> | 151:5eaa88a5bcc7 | 29 | * |
<> | 151:5eaa88a5bcc7 | 30 | * @note |
<> | 151:5eaa88a5bcc7 | 31 | * Expands tokens before concatenation |
<> | 151:5eaa88a5bcc7 | 32 | * |
<> | 151:5eaa88a5bcc7 | 33 | * @code |
<> | 151:5eaa88a5bcc7 | 34 | * // Creates a unique label based on the line number |
<> | 151:5eaa88a5bcc7 | 35 | * int MBED_CONCAT(UNIQUE_LABEL_, __LINE__) = 1; |
<> | 151:5eaa88a5bcc7 | 36 | * @endcode |
<> | 151:5eaa88a5bcc7 | 37 | */ |
<> | 151:5eaa88a5bcc7 | 38 | #define MBED_CONCAT(a, b) MBED_CONCAT_(a, b) |
<> | 151:5eaa88a5bcc7 | 39 | #define MBED_CONCAT_(a, b) a##b |
<> | 151:5eaa88a5bcc7 | 40 | |
<> | 151:5eaa88a5bcc7 | 41 | /** MBED_STRINGIFY |
<> | 151:5eaa88a5bcc7 | 42 | * Converts tokens into strings |
<> | 151:5eaa88a5bcc7 | 43 | * |
<> | 151:5eaa88a5bcc7 | 44 | * @note |
<> | 151:5eaa88a5bcc7 | 45 | * Expands tokens before stringification |
<> | 151:5eaa88a5bcc7 | 46 | * |
<> | 151:5eaa88a5bcc7 | 47 | * @code |
<> | 151:5eaa88a5bcc7 | 48 | * // Creates a string based on the parameters |
<> | 151:5eaa88a5bcc7 | 49 | * const char *c = MBED_STRINGIFY(This is a ridiculous way to create a string) |
<> | 151:5eaa88a5bcc7 | 50 | * @endcode |
<> | 151:5eaa88a5bcc7 | 51 | */ |
<> | 151:5eaa88a5bcc7 | 52 | #define MBED_STRINGIFY(a) MBED_STRINGIFY_(a) |
<> | 151:5eaa88a5bcc7 | 53 | #define MBED_STRINGIFY_(a) #a |
<> | 151:5eaa88a5bcc7 | 54 | |
AnnaBridge | 181:57724642e740 | 55 | /** MBED_STRLEN |
AnnaBridge | 181:57724642e740 | 56 | * Reports string token length |
AnnaBridge | 181:57724642e740 | 57 | * |
AnnaBridge | 181:57724642e740 | 58 | * @note |
AnnaBridge | 181:57724642e740 | 59 | * Expands tokens before calculating length |
AnnaBridge | 181:57724642e740 | 60 | * |
AnnaBridge | 181:57724642e740 | 61 | * @code |
AnnaBridge | 181:57724642e740 | 62 | * // Get string length |
AnnaBridge | 181:57724642e740 | 63 | * const int len = MBED_STRLEN("Get the length") |
AnnaBridge | 181:57724642e740 | 64 | * @endcode |
AnnaBridge | 181:57724642e740 | 65 | */ |
AnnaBridge | 181:57724642e740 | 66 | #define MBED_STRLEN(a) MBED_STRLEN_(a) |
AnnaBridge | 181:57724642e740 | 67 | #define MBED_STRLEN_(a) (sizeof(a) - 1) |
AnnaBridge | 181:57724642e740 | 68 | |
AnnaBridge | 181:57724642e740 | 69 | /** MBED_COUNT_VA_ARGS(...) |
AnnaBridge | 181:57724642e740 | 70 | * Reports number of tokens passed |
AnnaBridge | 181:57724642e740 | 71 | * |
AnnaBridge | 181:57724642e740 | 72 | * @note |
AnnaBridge | 181:57724642e740 | 73 | * Token limit is 16 |
AnnaBridge | 181:57724642e740 | 74 | * |
AnnaBridge | 181:57724642e740 | 75 | * @code |
AnnaBridge | 181:57724642e740 | 76 | * // Get number of arguments |
AnnaBridge | 181:57724642e740 | 77 | * const int count = MBED_COUNT_VA_ARGS("Address 0x%x, Data[0] = %d Data[1] = %d", 0x20001234, 10, 20) |
AnnaBridge | 181:57724642e740 | 78 | * @endcode |
AnnaBridge | 181:57724642e740 | 79 | */ |
AnnaBridge | 181:57724642e740 | 80 | #define MBED_COUNT_VA_ARGS(...) GET_NTH_ARG_(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1) |
AnnaBridge | 181:57724642e740 | 81 | #define GET_NTH_ARG_(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, N, ...) N |
<> | 151:5eaa88a5bcc7 | 82 | |
<> | 151:5eaa88a5bcc7 | 83 | #endif |
<> | 151:5eaa88a5bcc7 | 84 | |
<> | 151:5eaa88a5bcc7 | 85 | /** @}*/ |
AnnaBridge | 178:79309dc6340a | 86 | /** @}*/ |