tpaste.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*****************************************************************************
  2. *
  3. * \file
  4. *
  5. * \brief Preprocessor token pasting utils.
  6. *
  7. * Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
  8. *
  9. * \asf_license_start
  10. *
  11. * \page License
  12. *
  13. * Subject to your compliance with these terms, you may use Microchip
  14. * software and any derivatives exclusively with Microchip products.
  15. * It is your responsibility to comply with third party license terms applicable
  16. * to your use of third party software (including open source software) that
  17. * may accompany Microchip software.
  18. *
  19. * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
  20. * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
  21. * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
  22. * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
  23. * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
  24. * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
  25. * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
  26. * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
  27. * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
  28. * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
  29. * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
  30. *
  31. * \asf_license_stop
  32. *
  33. ******************************************************************************/
  34. /*
  35. * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
  36. */
  37. #ifndef _TPASTE_H_
  38. #define _TPASTE_H_
  39. /**
  40. * \defgroup group_avr32_utils_tpaste Preprocessor - Token Paste
  41. *
  42. * \ingroup group_avr32_utils
  43. *
  44. * \{
  45. */
  46. /*! \name Token Paste
  47. *
  48. * Paste N preprocessing tokens together, these tokens being allowed to be \#defined.
  49. *
  50. * May be used only within macros with the tokens passed as arguments if the tokens are \#defined.
  51. *
  52. * For example, writing TPASTE2(U, WIDTH) within a macro \#defined by
  53. * UTYPE(WIDTH) and invoked as UTYPE(UL_WIDTH) with UL_WIDTH \#defined as 32 is
  54. * equivalent to writing U32.
  55. */
  56. //! @{
  57. #define TPASTE2( a, b) a##b
  58. #define TPASTE3( a, b, c) a##b##c
  59. #define TPASTE4( a, b, c, d) a##b##c##d
  60. #define TPASTE5( a, b, c, d, e) a##b##c##d##e
  61. #define TPASTE6( a, b, c, d, e, f) a##b##c##d##e##f
  62. #define TPASTE7( a, b, c, d, e, f, g) a##b##c##d##e##f##g
  63. #define TPASTE8( a, b, c, d, e, f, g, h) a##b##c##d##e##f##g##h
  64. #define TPASTE9( a, b, c, d, e, f, g, h, i) a##b##c##d##e##f##g##h##i
  65. #define TPASTE10(a, b, c, d, e, f, g, h, i, j) a##b##c##d##e##f##g##h##i##j
  66. //! @}
  67. /*! \name Absolute Token Paste
  68. *
  69. * Paste N preprocessing tokens together, these tokens being allowed to be \#defined.
  70. *
  71. * No restriction of use if the tokens are \#defined.
  72. *
  73. * For example, writing ATPASTE2(U, UL_WIDTH) anywhere with UL_WIDTH \#defined
  74. * as 32 is equivalent to writing U32.
  75. */
  76. //! @{
  77. #define ATPASTE2( a, b) TPASTE2( a, b)
  78. #define ATPASTE3( a, b, c) TPASTE3( a, b, c)
  79. #define ATPASTE4( a, b, c, d) TPASTE4( a, b, c, d)
  80. #define ATPASTE5( a, b, c, d, e) TPASTE5( a, b, c, d, e)
  81. #define ATPASTE6( a, b, c, d, e, f) TPASTE6( a, b, c, d, e, f)
  82. #define ATPASTE7( a, b, c, d, e, f, g) TPASTE7( a, b, c, d, e, f, g)
  83. #define ATPASTE8( a, b, c, d, e, f, g, h) TPASTE8( a, b, c, d, e, f, g, h)
  84. #define ATPASTE9( a, b, c, d, e, f, g, h, i) TPASTE9( a, b, c, d, e, f, g, h, i)
  85. #define ATPASTE10(a, b, c, d, e, f, g, h, i, j) TPASTE10(a, b, c, d, e, f, g, h, i, j)
  86. //! @}
  87. /**
  88. * \}
  89. */
  90. #endif // _TPASTE_H_