expat_external.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. __ __ _
  3. ___\ \/ /_ __ __ _| |_
  4. / _ \\ /| '_ \ / _` | __|
  5. | __// \| |_) | (_| | |_
  6. \___/_/\_\ .__/ \__,_|\__|
  7. |_| XML parser
  8. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  9. Copyright (c) 2000 Clark Cooper <[email protected]>
  10. Copyright (c) 2000-2004 Fred L. Drake, Jr. <[email protected]>
  11. Copyright (c) 2001-2002 Greg Stein <[email protected]>
  12. Copyright (c) 2002-2006 Karl Waclawek <[email protected]>
  13. Copyright (c) 2016 Cristian Rodríguez <[email protected]>
  14. Copyright (c) 2016-2019 Sebastian Pipping <[email protected]>
  15. Copyright (c) 2017 Rhodri James <[email protected]>
  16. Copyright (c) 2018 Yury Gribov <[email protected]>
  17. Licensed under the MIT license:
  18. Permission is hereby granted, free of charge, to any person obtaining
  19. a copy of this software and associated documentation files (the
  20. "Software"), to deal in the Software without restriction, including
  21. without limitation the rights to use, copy, modify, merge, publish,
  22. distribute, sublicense, and/or sell copies of the Software, and to permit
  23. persons to whom the Software is furnished to do so, subject to the
  24. following conditions:
  25. The above copyright notice and this permission notice shall be included
  26. in all copies or substantial portions of the Software.
  27. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  29. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  30. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  31. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  32. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  33. USE OR OTHER DEALINGS IN THE SOFTWARE.
  34. */
  35. #ifndef Expat_External_INCLUDED
  36. #define Expat_External_INCLUDED 1
  37. /* External API definitions */
  38. /* Expat tries very hard to make the API boundary very specifically
  39. defined. There are two macros defined to control this boundary;
  40. each of these can be defined before including this header to
  41. achieve some different behavior, but doing so it not recommended or
  42. tested frequently.
  43. XMLCALL - The calling convention to use for all calls across the
  44. "library boundary." This will default to cdecl, and
  45. try really hard to tell the compiler that's what we
  46. want.
  47. XMLIMPORT - Whatever magic is needed to note that a function is
  48. to be imported from a dynamically loaded library
  49. (.dll, .so, or .sl, depending on your platform).
  50. The XMLCALL macro was added in Expat 1.95.7. The only one which is
  51. expected to be directly useful in client code is XMLCALL.
  52. Note that on at least some Unix versions, the Expat library must be
  53. compiled with the cdecl calling convention as the default since
  54. system headers may assume the cdecl convention.
  55. */
  56. #ifndef XMLCALL
  57. # if defined(_MSC_VER)
  58. # define XMLCALL __cdecl
  59. # elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
  60. # define XMLCALL __attribute__((cdecl))
  61. # else
  62. /* For any platform which uses this definition and supports more than
  63. one calling convention, we need to extend this definition to
  64. declare the convention used on that platform, if it's possible to
  65. do so.
  66. If this is the case for your platform, please file a bug report
  67. with information on how to identify your platform via the C
  68. pre-processor and how to specify the same calling convention as the
  69. platform's malloc() implementation.
  70. */
  71. # define XMLCALL
  72. # endif
  73. #endif /* not defined XMLCALL */
  74. /* Build within CMake hard-codes use of a static library. */
  75. #define XML_STATIC
  76. #if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
  77. # ifndef XML_BUILDING_EXPAT
  78. /* using Expat from an application */
  79. # if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
  80. # define XMLIMPORT __declspec(dllimport)
  81. # endif
  82. # endif
  83. #endif /* not defined XML_STATIC */
  84. #ifndef XML_ENABLE_VISIBILITY
  85. # define XML_ENABLE_VISIBILITY 0
  86. #endif
  87. #if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
  88. # define XMLIMPORT __attribute__((visibility("default")))
  89. #endif
  90. /* If we didn't define it above, define it away: */
  91. #ifndef XMLIMPORT
  92. # define XMLIMPORT
  93. #endif
  94. #if defined(__GNUC__) \
  95. && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
  96. # define XML_ATTR_MALLOC __attribute__((__malloc__))
  97. #else
  98. # define XML_ATTR_MALLOC
  99. #endif
  100. #if defined(__GNUC__) \
  101. && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  102. # define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
  103. #else
  104. # define XML_ATTR_ALLOC_SIZE(x)
  105. #endif
  106. #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
  107. #ifdef __cplusplus
  108. extern "C" {
  109. #endif
  110. #ifdef XML_UNICODE_WCHAR_T
  111. # ifndef XML_UNICODE
  112. # define XML_UNICODE
  113. # endif
  114. # if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
  115. # error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
  116. # endif
  117. #endif
  118. #ifdef XML_UNICODE /* Information is UTF-16 encoded. */
  119. # ifdef XML_UNICODE_WCHAR_T
  120. typedef wchar_t XML_Char;
  121. typedef wchar_t XML_LChar;
  122. # else
  123. typedef unsigned short XML_Char;
  124. typedef char XML_LChar;
  125. # endif /* XML_UNICODE_WCHAR_T */
  126. #else /* Information is UTF-8 encoded. */
  127. typedef char XML_Char;
  128. typedef char XML_LChar;
  129. #endif /* XML_UNICODE */
  130. #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
  131. typedef long long XML_Index;
  132. typedef unsigned long long XML_Size;
  133. #else
  134. typedef long XML_Index;
  135. typedef unsigned long XML_Size;
  136. #endif /* XML_LARGE_SIZE */
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140. #endif /* not Expat_External_INCLUDED */