expat_external.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
  32. # define XML_USE_MSC_EXTENSIONS 1
  33. #endif
  34. /* Expat tries very hard to make the API boundary very specifically
  35. defined. There are two macros defined to control this boundary;
  36. each of these can be defined before including this header to
  37. achieve some different behavior, but doing so it not recommended or
  38. tested frequently.
  39. XMLCALL - The calling convention to use for all calls across the
  40. "library boundary." This will default to cdecl, and
  41. try really hard to tell the compiler that's what we
  42. want.
  43. XMLIMPORT - Whatever magic is needed to note that a function is
  44. to be imported from a dynamically loaded library
  45. (.dll, .so, or .sl, depending on your platform).
  46. The XMLCALL macro was added in Expat 1.95.7. The only one which is
  47. expected to be directly useful in client code is XMLCALL.
  48. Note that on at least some Unix versions, the Expat library must be
  49. compiled with the cdecl calling convention as the default since
  50. system headers may assume the cdecl convention.
  51. */
  52. #ifndef XMLCALL
  53. # if defined(_MSC_VER)
  54. # define XMLCALL __cdecl
  55. # elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)
  56. # define XMLCALL __attribute__((cdecl))
  57. # else
  58. /* For any platform which uses this definition and supports more than
  59. one calling convention, we need to extend this definition to
  60. declare the convention used on that platform, if it's possible to
  61. do so.
  62. If this is the case for your platform, please file a bug report
  63. with information on how to identify your platform via the C
  64. pre-processor and how to specify the same calling convention as the
  65. platform's malloc() implementation.
  66. */
  67. # define XMLCALL
  68. # endif
  69. #endif /* not defined XMLCALL */
  70. #if !defined(XML_STATIC) && !defined(XMLIMPORT)
  71. # ifndef XML_BUILDING_EXPAT
  72. /* using Expat from an application */
  73. # ifdef XML_USE_MSC_EXTENSIONS
  74. # define XMLIMPORT __declspec(dllimport)
  75. # endif
  76. # endif
  77. #endif /* not defined XML_STATIC */
  78. #ifndef XML_ENABLE_VISIBILITY
  79. # define XML_ENABLE_VISIBILITY 0
  80. #endif
  81. #if !defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
  82. # define XMLIMPORT __attribute__ ((visibility ("default")))
  83. #endif
  84. /* If we didn't define it above, define it away: */
  85. #ifndef XMLIMPORT
  86. # define XMLIMPORT
  87. #endif
  88. #if defined(__GNUC__) && (__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__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  94. # define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
  95. #else
  96. # define XML_ATTR_ALLOC_SIZE(x)
  97. #endif
  98. #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
  99. #ifdef __cplusplus
  100. extern "C" {
  101. #endif
  102. #ifdef XML_UNICODE_WCHAR_T
  103. # ifndef XML_UNICODE
  104. # define XML_UNICODE
  105. # endif
  106. # if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
  107. # error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
  108. # endif
  109. #endif
  110. #ifdef XML_UNICODE /* Information is UTF-16 encoded. */
  111. # ifdef XML_UNICODE_WCHAR_T
  112. typedef wchar_t XML_Char;
  113. typedef wchar_t XML_LChar;
  114. # else
  115. typedef unsigned short XML_Char;
  116. typedef char XML_LChar;
  117. # endif /* XML_UNICODE_WCHAR_T */
  118. #else /* Information is UTF-8 encoded. */
  119. typedef char XML_Char;
  120. typedef char XML_LChar;
  121. #endif /* XML_UNICODE */
  122. #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
  123. # if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
  124. typedef __int64 XML_Index;
  125. typedef unsigned __int64 XML_Size;
  126. # else
  127. typedef long long XML_Index;
  128. typedef unsigned long long XML_Size;
  129. # endif
  130. #else
  131. typedef long XML_Index;
  132. typedef unsigned long XML_Size;
  133. #endif /* XML_LARGE_SIZE */
  134. #ifdef __cplusplus
  135. }
  136. #endif
  137. #endif /* not Expat_External_INCLUDED */