expat_external.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
  2. See the file COPYING for copying permission.
  3. */
  4. #ifndef Expat_External_INCLUDED
  5. #define Expat_External_INCLUDED 1
  6. /* External API definitions */
  7. #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
  8. #define XML_USE_MSC_EXTENSIONS 1
  9. #endif
  10. /* Expat tries very hard to make the API boundary very specifically
  11. defined. There are two macros defined to control this boundary;
  12. each of these can be defined before including this header to
  13. achieve some different behavior, but doing so it not recommended or
  14. tested frequently.
  15. XMLCALL - The calling convention to use for all calls across the
  16. "library boundary." This will default to cdecl, and
  17. try really hard to tell the compiler that's what we
  18. want.
  19. XMLIMPORT - Whatever magic is needed to note that a function is
  20. to be imported from a dynamically loaded library
  21. (.dll, .so, or .sl, depending on your platform).
  22. The XMLCALL macro was added in Expat 1.95.7. The only one which is
  23. expected to be directly useful in client code is XMLCALL.
  24. Note that on at least some Unix versions, the Expat library must be
  25. compiled with the cdecl calling convention as the default since
  26. system headers may assume the cdecl convention.
  27. */
  28. #ifndef XMLCALL
  29. #if defined(_MSC_VER)
  30. #define XMLCALL __cdecl
  31. #elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)
  32. #define XMLCALL __attribute__((cdecl))
  33. #else
  34. /* For any platform which uses this definition and supports more than
  35. one calling convention, we need to extend this definition to
  36. declare the convention used on that platform, if it's possible to
  37. do so.
  38. If this is the case for your platform, please file a bug report
  39. with information on how to identify your platform via the C
  40. pre-processor and how to specify the same calling convention as the
  41. platform's malloc() implementation.
  42. */
  43. #define XMLCALL
  44. #endif
  45. #endif /* not defined XMLCALL */
  46. #if !defined(XML_STATIC) && !defined(XMLIMPORT)
  47. #ifndef XML_BUILDING_EXPAT
  48. /* using Expat from an application */
  49. #ifdef XML_USE_MSC_EXTENSIONS
  50. #define XMLIMPORT __declspec(dllimport)
  51. #endif
  52. #endif
  53. #endif /* not defined XML_STATIC */
  54. /* If we didn't define it above, define it away: */
  55. #ifndef XMLIMPORT
  56. #define XMLIMPORT
  57. #endif
  58. #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
  59. #ifdef __cplusplus
  60. extern "C" {
  61. #endif
  62. #ifdef XML_UNICODE_WCHAR_T
  63. #define XML_UNICODE
  64. #endif
  65. #ifdef XML_UNICODE /* Information is UTF-16 encoded. */
  66. #ifdef XML_UNICODE_WCHAR_T
  67. typedef wchar_t XML_Char;
  68. typedef wchar_t XML_LChar;
  69. #else
  70. typedef unsigned short XML_Char;
  71. typedef char XML_LChar;
  72. #endif /* XML_UNICODE_WCHAR_T */
  73. #else /* Information is UTF-8 encoded. */
  74. typedef char XML_Char;
  75. typedef char XML_LChar;
  76. #endif /* XML_UNICODE */
  77. #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
  78. #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
  79. typedef __int64 XML_Index;
  80. typedef unsigned __int64 XML_Size;
  81. #else
  82. typedef long long XML_Index;
  83. typedef unsigned long long XML_Size;
  84. #endif
  85. #else
  86. typedef long XML_Index;
  87. typedef unsigned long XML_Size;
  88. #endif /* XML_LARGE_SIZE */
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif /* not Expat_External_INCLUDED */