internal.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* internal.h
  2. Internal definitions used by Expat. This is not needed to compile
  3. client code.
  4. The following calling convention macros are defined for frequently
  5. called functions:
  6. FASTCALL - Used for those internal functions that have a simple
  7. body and a low number of arguments and local variables.
  8. PTRCALL - Used for functions called though function pointers.
  9. PTRFASTCALL - Like PTRCALL, but for low number of arguments.
  10. inline - Used for selected internal functions for which inlining
  11. may improve performance on some platforms.
  12. Note: Use of these macros is based on judgement, not hard rules,
  13. and therefore subject to change.
  14. __ __ _
  15. ___\ \/ /_ __ __ _| |_
  16. / _ \\ /| '_ \ / _` | __|
  17. | __// \| |_) | (_| | |_
  18. \___/_/\_\ .__/ \__,_|\__|
  19. |_| XML parser
  20. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  21. Copyright (c) 2000-2017 Expat development team
  22. Licensed under the MIT license:
  23. Permission is hereby granted, free of charge, to any person obtaining
  24. a copy of this software and associated documentation files (the
  25. "Software"), to deal in the Software without restriction, including
  26. without limitation the rights to use, copy, modify, merge, publish,
  27. distribute, sublicense, and/or sell copies of the Software, and to permit
  28. persons to whom the Software is furnished to do so, subject to the
  29. following conditions:
  30. The above copyright notice and this permission notice shall be included
  31. in all copies or substantial portions of the Software.
  32. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  33. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  34. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  35. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  36. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  37. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  38. USE OR OTHER DEALINGS IN THE SOFTWARE.
  39. */
  40. #if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__)
  41. /* We'll use this version by default only where we know it helps.
  42. regparm() generates warnings on Solaris boxes. See SF bug #692878.
  43. Instability reported with egcs on a RedHat Linux 7.3.
  44. Let's comment out:
  45. #define FASTCALL __attribute__((stdcall, regparm(3)))
  46. and let's try this:
  47. */
  48. #define FASTCALL __attribute__((regparm(3)))
  49. #define PTRFASTCALL __attribute__((regparm(3)))
  50. #endif
  51. /* Using __fastcall seems to have an unexpected negative effect under
  52. MS VC++, especially for function pointers, so we won't use it for
  53. now on that platform. It may be reconsidered for a future release
  54. if it can be made more effective.
  55. Likely reason: __fastcall on Windows is like stdcall, therefore
  56. the compiler cannot perform stack optimizations for call clusters.
  57. */
  58. /* Make sure all of these are defined if they aren't already. */
  59. #ifndef FASTCALL
  60. #define FASTCALL
  61. #endif
  62. #ifndef PTRCALL
  63. #define PTRCALL
  64. #endif
  65. #ifndef PTRFASTCALL
  66. #define PTRFASTCALL
  67. #endif
  68. #ifndef XML_MIN_SIZE
  69. #if !defined(__cplusplus) && !defined(inline)
  70. #ifdef __GNUC__
  71. #define inline __inline
  72. #endif /* __GNUC__ */
  73. #endif
  74. #endif /* XML_MIN_SIZE */
  75. #ifdef __cplusplus
  76. #define inline inline
  77. #else
  78. #ifndef inline
  79. #define inline
  80. #endif
  81. #endif
  82. #ifndef UNUSED_P
  83. # ifdef __GNUC__
  84. # define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__))
  85. # else
  86. # define UNUSED_P(p) UNUSED_ ## p
  87. # endif
  88. #endif
  89. #ifdef __cplusplus
  90. extern "C" {
  91. #endif
  92. void
  93. _INTERNAL_trim_to_complete_utf8_characters(const char * from, const char ** fromLimRef);
  94. #ifdef __cplusplus
  95. }
  96. #endif