tpaste.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*!
  2. * Copyright (C) 2001-2010 by egnite Software GmbH
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. *
  34. * Portions Copyright Atmel Corporation, see the following note.
  35. */
  36. /* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
  37. /*This file is prepared for Doxygen automatic documentation generation.*/
  38. /*! \file *********************************************************************
  39. *
  40. * \brief Preprocessor token pasting utils.
  41. *
  42. * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
  43. * - Supported devices: All AVR32 devices can be used.
  44. *
  45. * \author Atmel Corporation: http://www.atmel.com \n
  46. * Support and FAQ: http://support.atmel.no/
  47. *
  48. ******************************************************************************/
  49. /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
  50. *
  51. * Redistribution and use in source and binary forms, with or without
  52. * modification, are permitted provided that the following conditions are met:
  53. *
  54. * 1. Redistributions of source code must retain the above copyright notice, this
  55. * list of conditions and the following disclaimer.
  56. *
  57. * 2. Redistributions in binary form must reproduce the above copyright notice,
  58. * this list of conditions and the following disclaimer in the documentation
  59. * and/or other materials provided with the distribution.
  60. *
  61. * 3. The name of Atmel may not be used to endorse or promote products derived
  62. * from this software without specific prior written permission.
  63. *
  64. * 4. This software may only be redistributed and used in connection with an Atmel
  65. * AVR product.
  66. *
  67. * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
  68. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  69. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  70. * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
  71. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  72. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  73. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  74. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  75. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  76. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
  77. *
  78. */
  79. #ifndef _TPASTE_H_
  80. #define _TPASTE_H_
  81. /*! \name Token Paste
  82. *
  83. * Paste N preprocessing tokens together, these tokens being allowed to be \#defined.
  84. *
  85. * May be used only within macros with the tokens passed as arguments if the tokens are \#defined.
  86. *
  87. * For example, writing TPASTE2(U, WIDTH) within a macro \#defined by
  88. * UTYPE(WIDTH) and invoked as UTYPE(UL_WIDTH) with UL_WIDTH \#defined as 32 is
  89. * equivalent to writing U32.
  90. */
  91. //! @{
  92. #define TPASTE2( a, b) a##b
  93. #define TPASTE3( a, b, c) a##b##c
  94. #define TPASTE4( a, b, c, d) a##b##c##d
  95. #define TPASTE5( a, b, c, d, e) a##b##c##d##e
  96. #define TPASTE6( a, b, c, d, e, f) a##b##c##d##e##f
  97. #define TPASTE7( a, b, c, d, e, f, g) a##b##c##d##e##f##g
  98. #define TPASTE8( a, b, c, d, e, f, g, h) a##b##c##d##e##f##g##h
  99. #define TPASTE9( a, b, c, d, e, f, g, h, i) a##b##c##d##e##f##g##h##i
  100. #define TPASTE10(a, b, c, d, e, f, g, h, i, j) a##b##c##d##e##f##g##h##i##j
  101. //! @}
  102. /*! \name Absolute Token Paste
  103. *
  104. * Paste N preprocessing tokens together, these tokens being allowed to be \#defined.
  105. *
  106. * No restriction of use if the tokens are \#defined.
  107. *
  108. * For example, writing ATPASTE2(U, UL_WIDTH) anywhere with UL_WIDTH \#defined
  109. * as 32 is equivalent to writing U32.
  110. */
  111. //! @{
  112. #define ATPASTE2( a, b) TPASTE2( a, b)
  113. #define ATPASTE3( a, b, c) TPASTE3( a, b, c)
  114. #define ATPASTE4( a, b, c, d) TPASTE4( a, b, c, d)
  115. #define ATPASTE5( a, b, c, d, e) TPASTE5( a, b, c, d, e)
  116. #define ATPASTE6( a, b, c, d, e, f) TPASTE6( a, b, c, d, e, f)
  117. #define ATPASTE7( a, b, c, d, e, f, g) TPASTE7( a, b, c, d, e, f, g)
  118. #define ATPASTE8( a, b, c, d, e, f, g, h) TPASTE8( a, b, c, d, e, f, g, h)
  119. #define ATPASTE9( a, b, c, d, e, f, g, h, i) TPASTE9( a, b, c, d, e, f, g, h, i)
  120. #define ATPASTE10(a, b, c, d, e, f, g, h, i, j) TPASTE10(a, b, c, d, e, f, g, h, i, j)
  121. //! @}
  122. #endif // _TPASTE_H_