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.
Fork of OmniWheels by
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 * 00011 * Licensed under the Apache License, Version 2.0 (the "License"); 00012 * you may not use this file except in compliance with the License. 00013 * You may obtain a copy of the License at 00014 * 00015 * http://www.apache.org/licenses/LICENSE-2.0 00016 * 00017 * Unless required by applicable law or agreed to in writing, software 00018 * distributed under the License is distributed on an "AS IS" BASIS, 00019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 * See the License for the specific language governing permissions and 00021 * limitations under the License. 00022 */ 00023 #ifndef MBED_PREPROCESSOR_H 00024 #define MBED_PREPROCESSOR_H 00025 00026 00027 /** MBED_CONCAT 00028 * Concatenate tokens together 00029 * 00030 * @note 00031 * Expands tokens before concatenation 00032 * 00033 * @code 00034 * // Creates a unique label based on the line number 00035 * int MBED_CONCAT(UNIQUE_LABEL_, __LINE__) = 1; 00036 * @endcode 00037 */ 00038 #define MBED_CONCAT(a, b) MBED_CONCAT_(a, b) 00039 #define MBED_CONCAT_(a, b) a##b 00040 00041 /** MBED_STRINGIFY 00042 * Converts tokens into strings 00043 * 00044 * @note 00045 * Expands tokens before stringification 00046 * 00047 * @code 00048 * // Creates a string based on the parameters 00049 * const char *c = MBED_STRINGIFY(This is a ridiculous way to create a string) 00050 * @endcode 00051 */ 00052 #define MBED_STRINGIFY(a) MBED_STRINGIFY_(a) 00053 #define MBED_STRINGIFY_(a) #a 00054 00055 /** MBED_STRLEN 00056 * Reports string token length 00057 * 00058 * @note 00059 * Expands tokens before calculating length 00060 * 00061 * @code 00062 * // Get string length 00063 * const int len = MBED_STRLEN("Get the length") 00064 * @endcode 00065 */ 00066 #define MBED_STRLEN(a) MBED_STRLEN_(a) 00067 #define MBED_STRLEN_(a) (sizeof(a) - 1) 00068 00069 /** MBED_COUNT_VA_ARGS(...) 00070 * Reports number of tokens passed 00071 * 00072 * @note 00073 * Token limit is 16 00074 * 00075 * @code 00076 * // Get number of arguments 00077 * const int count = MBED_COUNT_VA_ARGS("Address 0x%x, Data[0] = %d Data[1] = %d", 0x20001234, 10, 20) 00078 * @endcode 00079 */ 00080 #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) 00081 #define GET_NTH_ARG_(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, N, ...) N 00082 00083 #endif 00084 00085 /** @}*/ 00086 /** @}*/
Generated on Fri Jul 22 2022 04:53:56 by
