expat_external.h 5.5 KB

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