mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
mbed_preprocessor.h
00001 /** \addtogroup platform */ 00002 /** @{*/ 00003 /** 00004 * \defgroup platform_preprocessor preprocessor macros 00005 * @{ 00006 */ 00007 00008 /* mbed Microcontroller Library 00009 * Copyright (c) 2006-2013 ARM Limited 00010 * SPDX-License-Identifier: Apache-2.0 00011 * 00012 * Licensed under the Apache License, Version 2.0 (the "License"); 00013 * you may not use this file except in compliance with the License. 00014 * You may obtain a copy of the License at 00015 * 00016 * http://www.apache.org/licenses/LICENSE-2.0 00017 * 00018 * Unless required by applicable law or agreed to in writing, software 00019 * distributed under the License is distributed on an "AS IS" BASIS, 00020 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00021 * See the License for the specific language governing permissions and 00022 * limitations under the License. 00023 */ 00024 #ifndef MBED_PREPROCESSOR_H 00025 #define MBED_PREPROCESSOR_H 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 20:41:15 by 1.7.2