Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
mbed_preprocessor.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2019 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #ifndef MBED_PREPROCESSOR_H 00018 #define MBED_PREPROCESSOR_H 00019 00020 /** \addtogroup platform-public-api */ 00021 /** @{*/ 00022 00023 /** 00024 * \defgroup platform_preprocessor preprocessor macros 00025 * @{ 00026 */ 00027 00028 /** MBED_CONCAT 00029 * Concatenate tokens together 00030 * 00031 * @note 00032 * Expands tokens before concatenation 00033 * 00034 * @code 00035 * // Creates a unique label based on the line number 00036 * int MBED_CONCAT(UNIQUE_LABEL_, __LINE__) = 1; 00037 * @endcode 00038 */ 00039 #define MBED_CONCAT(a, b) MBED_CONCAT_(a, b) 00040 #define MBED_CONCAT_(a, b) a##b 00041 00042 /** MBED_STRINGIFY 00043 * Converts tokens into strings 00044 * 00045 * @note 00046 * Expands tokens before stringification 00047 * 00048 * @code 00049 * // Creates a string based on the parameters 00050 * const char *c = MBED_STRINGIFY(This is a ridiculous way to create a string) 00051 * @endcode 00052 */ 00053 #define MBED_STRINGIFY(a) MBED_STRINGIFY_(a) 00054 #define MBED_STRINGIFY_(a) #a 00055 00056 /** MBED_STRLEN 00057 * Reports string token length 00058 * 00059 * @note 00060 * Expands tokens before calculating length 00061 * 00062 * @code 00063 * // Get string length 00064 * const int len = MBED_STRLEN("Get the length") 00065 * @endcode 00066 */ 00067 #define MBED_STRLEN(a) MBED_STRLEN_(a) 00068 #define MBED_STRLEN_(a) (sizeof(a) - 1) 00069 00070 /** MBED_COUNT_VA_ARGS(...) 00071 * Reports number of tokens passed 00072 * 00073 * @note 00074 * Token limit is 16 00075 * 00076 * @code 00077 * // Get number of arguments 00078 * const int count = MBED_COUNT_VA_ARGS("Address 0x%x, Data[0] = %d Data[1] = %d", 0x20001234, 10, 20) 00079 * @endcode 00080 */ 00081 #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) 00082 #define GET_NTH_ARG_(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, N, ...) N 00083 00084 #endif 00085 00086 /** @}*/ 00087 /** @}*/
Generated on Tue Jul 12 2022 13:54:33 by
1.7.2