tpaste.h 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
  2. /*This file is prepared for Doxygen automatic documentation generation.*/
  3. /*! \file *********************************************************************
  4. *
  5. * \brief Preprocessor token pasting utils.
  6. *
  7. * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
  8. * - Supported devices: All AVR32 devices can be used.
  9. *
  10. * \author Atmel Corporation: http://www.atmel.com \n
  11. * Support and FAQ: http://support.atmel.no/
  12. *
  13. ******************************************************************************/
  14. /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
  15. *
  16. * Redistribution and use in source and binary forms, with or without
  17. * modification, are permitted provided that the following conditions are met:
  18. *
  19. * 1. Redistributions of source code must retain the above copyright notice, this
  20. * list of conditions and the following disclaimer.
  21. *
  22. * 2. Redistributions in binary form must reproduce the above copyright notice,
  23. * this list of conditions and the following disclaimer in the documentation
  24. * and/or other materials provided with the distribution.
  25. *
  26. * 3. The name of Atmel may not be used to endorse or promote products derived
  27. * from this software without specific prior written permission.
  28. *
  29. * 4. This software may only be redistributed and used in connection with an Atmel
  30. * AVR product.
  31. *
  32. * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
  33. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  34. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  35. * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
  36. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  37. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  38. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  39. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  40. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  41. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
  42. *
  43. */
  44. #ifndef _TPASTE_H_
  45. #define _TPASTE_H_
  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. #endif // _TPASTE_H_