expat_external.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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 <coopercc@users.sourceforge.net>
  10. Copyright (c) 2000-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  11. Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
  12. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  13. Copyright (c) 2016 Cristian Rodríguez <crrodriguez@opensuse.org>
  14. Copyright (c) 2016-2019 Sebastian Pipping <sebastian@pipping.org>
  15. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  16. Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
  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. #if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
  75. # ifndef XML_BUILDING_EXPAT
  76. /* using Expat from an application */
  77. # if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
  78. # define XMLIMPORT __declspec(dllimport)
  79. # endif
  80. # endif
  81. #endif /* not defined XML_STATIC */
  82. #ifndef XML_ENABLE_VISIBILITY
  83. # define XML_ENABLE_VISIBILITY 0
  84. #endif
  85. #if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
  86. # define XMLIMPORT __attribute__((visibility("default")))
  87. #endif
  88. /* If we didn't define it above, define it away: */
  89. #ifndef XMLIMPORT
  90. # define XMLIMPORT
  91. #endif
  92. #if defined(__GNUC__) \
  93. && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
  94. # define XML_ATTR_MALLOC __attribute__((__malloc__))
  95. #else
  96. # define XML_ATTR_MALLOC
  97. #endif
  98. #if defined(__GNUC__) \
  99. && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  100. # define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
  101. #else
  102. # define XML_ATTR_ALLOC_SIZE(x)
  103. #endif
  104. #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
  105. #ifdef __cplusplus
  106. extern "C" {
  107. #endif
  108. #ifdef XML_UNICODE_WCHAR_T
  109. # ifndef XML_UNICODE
  110. # define XML_UNICODE
  111. # endif
  112. # if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
  113. # error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
  114. # endif
  115. #endif
  116. #ifdef XML_UNICODE /* Information is UTF-16 encoded. */
  117. # ifdef XML_UNICODE_WCHAR_T
  118. typedef wchar_t XML_Char;
  119. typedef wchar_t XML_LChar;
  120. # else
  121. typedef unsigned short XML_Char;
  122. typedef char XML_LChar;
  123. # endif /* XML_UNICODE_WCHAR_T */
  124. #else /* Information is UTF-8 encoded. */
  125. typedef char XML_Char;
  126. typedef char XML_LChar;
  127. #endif /* XML_UNICODE */
  128. #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
  129. typedef long long XML_Index;
  130. typedef unsigned long long XML_Size;
  131. #else
  132. typedef long XML_Index;
  133. typedef unsigned long XML_Size;
  134. #endif /* XML_LARGE_SIZE */
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif /* not Expat_External_INCLUDED */