Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
5.3 KiB

  1. /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
  2. *
  3. * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  4. * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  5. * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  6. *
  7. * Last changed in libpng 1.5.0 [January 6, 2011]
  8. *
  9. * This code is released under the libpng license.
  10. * For conditions of distribution and use, see the disclaimer
  11. * and license in png.h
  12. */
  13. /* Define PNG_DEBUG at compile time for debugging information. Higher
  14. * numbers for PNG_DEBUG mean more debugging information. This has
  15. * only been added since version 0.95 so it is not implemented throughout
  16. * libpng yet, but more support will be added as needed.
  17. *
  18. * png_debug[1-2]?(level, message ,arg{0-2})
  19. * Expands to a statement (either a simple expression or a compound
  20. * do..while(0) statement) that outputs a message with parameter
  21. * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
  22. * is undefined, 0 or 1 every png_debug expands to a simple expression
  23. * (actually ((void)0)).
  24. *
  25. * level: level of detail of message, starting at 0. A level 'n'
  26. * message is preceded by 'n' tab characters (not implemented
  27. * on Microsoft compilers unless PNG_DEBUG_FILE is also
  28. * defined, to allow debug DLL compilation with no standard IO).
  29. * message: a printf(3) style text string. A trailing '\n' is added
  30. * to the message.
  31. * arg: 0 to 2 arguments for printf(3) style substitution in message.
  32. */
  33. #ifndef PNGDEBUG_H
  34. #define PNGDEBUG_H
  35. /* These settings control the formatting of messages in png.c and pngerror.c */
  36. /* Moved to pngdebug.h at 1.5.0 */
  37. # ifndef PNG_LITERAL_SHARP
  38. # define PNG_LITERAL_SHARP 0x23
  39. # endif
  40. # ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
  41. # define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
  42. # endif
  43. # ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
  44. # define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
  45. # endif
  46. # ifndef PNG_STRING_NEWLINE
  47. # define PNG_STRING_NEWLINE "\n"
  48. # endif
  49. #ifdef PNG_DEBUG
  50. # if (PNG_DEBUG > 0)
  51. # if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
  52. # include <crtdbg.h>
  53. # if (PNG_DEBUG > 1)
  54. # ifndef _DEBUG
  55. # define _DEBUG
  56. # endif
  57. # ifndef png_debug
  58. # define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
  59. # endif
  60. # ifndef png_debug1
  61. # define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
  62. # endif
  63. # ifndef png_debug2
  64. # define png_debug2(l,m,p1,p2) \
  65. _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
  66. # endif
  67. # endif
  68. # else /* PNG_DEBUG_FILE || !_MSC_VER */
  69. # ifndef PNG_STDIO_SUPPORTED
  70. # include <stdio.h> /* not included yet */
  71. # endif
  72. # ifndef PNG_DEBUG_FILE
  73. # define PNG_DEBUG_FILE stderr
  74. # endif /* PNG_DEBUG_FILE */
  75. # if (PNG_DEBUG > 1)
  76. /* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
  77. * non-ISO compilers
  78. */
  79. # ifdef __STDC__
  80. # ifndef png_debug
  81. # define png_debug(l,m) \
  82. do { \
  83. int num_tabs=l; \
  84. fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
  85. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
  86. } while (0)
  87. # endif
  88. # ifndef png_debug1
  89. # define png_debug1(l,m,p1) \
  90. do { \
  91. int num_tabs=l; \
  92. fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
  93. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
  94. } while (0)
  95. # endif
  96. # ifndef png_debug2
  97. # define png_debug2(l,m,p1,p2) \
  98. do { \
  99. int num_tabs=l; \
  100. fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
  101. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
  102. } while (0)
  103. # endif
  104. # else /* __STDC __ */
  105. # ifndef png_debug
  106. # define png_debug(l,m) \
  107. do { \
  108. int num_tabs=l; \
  109. char format[256]; \
  110. snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
  111. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
  112. m,PNG_STRING_NEWLINE); \
  113. fprintf(PNG_DEBUG_FILE,format); \
  114. } while (0)
  115. # endif
  116. # ifndef png_debug1
  117. # define png_debug1(l,m,p1) \
  118. do { \
  119. int num_tabs=l; \
  120. char format[256]; \
  121. snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
  122. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
  123. m,PNG_STRING_NEWLINE); \
  124. fprintf(PNG_DEBUG_FILE,format,p1); \
  125. } while (0)
  126. # endif
  127. # ifndef png_debug2
  128. # define png_debug2(l,m,p1,p2) \
  129. do { \
  130. int num_tabs=l; \
  131. char format[256]; \
  132. snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
  133. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
  134. m,PNG_STRING_NEWLINE); \
  135. fprintf(PNG_DEBUG_FILE,format,p1,p2); \
  136. } while (0)
  137. # endif
  138. # endif /* __STDC __ */
  139. # endif /* (PNG_DEBUG > 1) */
  140. # endif /* _MSC_VER */
  141. # endif /* (PNG_DEBUG > 0) */
  142. #endif /* PNG_DEBUG */
  143. #ifndef png_debug
  144. # define png_debug(l, m) ((void)0)
  145. #endif
  146. #ifndef png_debug1
  147. # define png_debug1(l, m, p1) ((void)0)
  148. #endif
  149. #ifndef png_debug2
  150. # define png_debug2(l, m, p1, p2) ((void)0)
  151. #endif
  152. #endif /* PNGDEBUG_H */