Backup 1

Committer:
borlanic
Date:
Tue Apr 24 11:45:18 2018 +0000
Revision:
0:02dd72d1d465
BaBoRo_test2 - backup 1

Who changed what in which revision?

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