expat_external.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. #if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
  68. # ifndef XML_BUILDING_EXPAT
  69. /* using Expat from an application */
  70. # if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
  71. # define XMLIMPORT __declspec(dllimport)
  72. # endif
  73. # endif
  74. #endif /* not defined XML_STATIC */
  75. #ifndef XML_ENABLE_VISIBILITY
  76. # define XML_ENABLE_VISIBILITY 0
  77. #endif
  78. #if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
  79. # define XMLIMPORT __attribute__((visibility("default")))
  80. #endif
  81. /* If we didn't define it above, define it away: */
  82. #ifndef XMLIMPORT
  83. # define XMLIMPORT
  84. #endif
  85. #if defined(__GNUC__) \
  86. && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
  87. # define XML_ATTR_MALLOC __attribute__((__malloc__))
  88. #else
  89. # define XML_ATTR_MALLOC
  90. #endif
  91. #if defined(__GNUC__) \
  92. && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  93. # define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
  94. #else
  95. # define XML_ATTR_ALLOC_SIZE(x)
  96. #endif
  97. #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
  98. #ifdef __cplusplus
  99. extern "C" {
  100. #endif
  101. #ifdef XML_UNICODE_WCHAR_T
  102. # ifndef XML_UNICODE
  103. # define XML_UNICODE
  104. # endif
  105. # if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
  106. # error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
  107. # endif
  108. #endif
  109. #ifdef XML_UNICODE /* Information is UTF-16 encoded. */
  110. # ifdef XML_UNICODE_WCHAR_T
  111. typedef wchar_t XML_Char;
  112. typedef wchar_t XML_LChar;
  113. # else
  114. typedef unsigned short XML_Char;
  115. typedef char XML_LChar;
  116. # endif /* XML_UNICODE_WCHAR_T */
  117. #else /* Information is UTF-8 encoded. */
  118. typedef char XML_Char;
  119. typedef char XML_LChar;
  120. #endif /* XML_UNICODE */
  121. #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
  122. typedef long long XML_Index;
  123. typedef unsigned long long XML_Size;
  124. #else
  125. typedef long XML_Index;
  126. typedef unsigned long XML_Size;
  127. #endif /* XML_LARGE_SIZE */
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif /* not Expat_External_INCLUDED */