/Modules/expat/pyexpatns.h

http://unladen-swallow.googlecode.com/ · C++ Header · 124 lines · 83 code · 5 blank · 36 comment · 0 complexity · 6edd503165774f39b46f9eb1c52f1c78 MD5 · raw file

  1. /* Copyright (c) 2005-2006 ActiveState Software Inc.
  2. *
  3. * Namespace all expat exported symbols to avoid dynamic loading symbol
  4. * collisions when embedding Python.
  5. *
  6. * The Problem:
  7. * - you embed Python in some app
  8. * - the app dynamically loads libexpat of version X
  9. * - the embedded Python imports pyexpat (which was built against
  10. * libexpat version X+n)
  11. * --> pyexpat gets the expat symbols from the already loaded and *older*
  12. * libexpat: crash (Specifically the crash we observed was in
  13. * getting an old XML_ErrorString (from xmlparse.c) and then calling
  14. * it with newer values in the XML_Error enum:
  15. *
  16. * // pyexpat.c, line 1970
  17. * ...
  18. * // Added in Expat 1.95.7.
  19. * MYCONST(XML_ERROR_UNBOUND_PREFIX);
  20. * ...
  21. *
  22. *
  23. * The Solution:
  24. * Prefix all a exported symbols with "PyExpat_". This is similar to
  25. * what Mozilla does for some common libs:
  26. * http://lxr.mozilla.org/seamonkey/source/modules/libimg/png/mozpngconf.h#115
  27. *
  28. * The list of relevant exported symbols can be had with this command:
  29. *
  30. nm pyexpat.so \
  31. | grep -v " [a-zBUA] " \
  32. | grep -v "_fini\|_init\|initpyexpat"
  33. *
  34. * If any of those symbols are NOT prefixed with "PyExpat_" then
  35. * a #define should be added for it here.
  36. */
  37. #ifndef PYEXPATNS_H
  38. #define PYEXPATNS_H
  39. #define XML_DefaultCurrent PyExpat_XML_DefaultCurrent
  40. #define XML_ErrorString PyExpat_XML_ErrorString
  41. #define XML_ExpatVersion PyExpat_XML_ExpatVersion
  42. #define XML_ExpatVersionInfo PyExpat_XML_ExpatVersionInfo
  43. #define XML_ExternalEntityParserCreate PyExpat_XML_ExternalEntityParserCreate
  44. #define XML_FreeContentModel PyExpat_XML_FreeContentModel
  45. #define XML_GetBase PyExpat_XML_GetBase
  46. #define XML_GetBuffer PyExpat_XML_GetBuffer
  47. #define XML_GetCurrentByteCount PyExpat_XML_GetCurrentByteCount
  48. #define XML_GetCurrentByteIndex PyExpat_XML_GetCurrentByteIndex
  49. #define XML_GetCurrentColumnNumber PyExpat_XML_GetCurrentColumnNumber
  50. #define XML_GetCurrentLineNumber PyExpat_XML_GetCurrentLineNumber
  51. #define XML_GetErrorCode PyExpat_XML_GetErrorCode
  52. #define XML_GetFeatureList PyExpat_XML_GetFeatureList
  53. #define XML_GetIdAttributeIndex PyExpat_XML_GetIdAttributeIndex
  54. #define XML_GetInputContext PyExpat_XML_GetInputContext
  55. #define XML_GetParsingStatus PyExpat_XML_GetParsingStatus
  56. #define XML_GetSpecifiedAttributeCount PyExpat_XML_GetSpecifiedAttributeCount
  57. #define XmlGetUtf16InternalEncoding PyExpat_XmlGetUtf16InternalEncoding
  58. #define XmlGetUtf16InternalEncodingNS PyExpat_XmlGetUtf16InternalEncodingNS
  59. #define XmlGetUtf8InternalEncoding PyExpat_XmlGetUtf8InternalEncoding
  60. #define XmlGetUtf8InternalEncodingNS PyExpat_XmlGetUtf8InternalEncodingNS
  61. #define XmlInitEncoding PyExpat_XmlInitEncoding
  62. #define XmlInitEncodingNS PyExpat_XmlInitEncodingNS
  63. #define XmlInitUnknownEncoding PyExpat_XmlInitUnknownEncoding
  64. #define XmlInitUnknownEncodingNS PyExpat_XmlInitUnknownEncodingNS
  65. #define XML_MemFree PyExpat_XML_MemFree
  66. #define XML_MemMalloc PyExpat_XML_MemMalloc
  67. #define XML_MemRealloc PyExpat_XML_MemRealloc
  68. #define XML_Parse PyExpat_XML_Parse
  69. #define XML_ParseBuffer PyExpat_XML_ParseBuffer
  70. #define XML_ParserCreate PyExpat_XML_ParserCreate
  71. #define XML_ParserCreate_MM PyExpat_XML_ParserCreate_MM
  72. #define XML_ParserCreateNS PyExpat_XML_ParserCreateNS
  73. #define XML_ParserFree PyExpat_XML_ParserFree
  74. #define XML_ParserReset PyExpat_XML_ParserReset
  75. #define XmlParseXmlDecl PyExpat_XmlParseXmlDecl
  76. #define XmlParseXmlDeclNS PyExpat_XmlParseXmlDeclNS
  77. #define XmlPrologStateInit PyExpat_XmlPrologStateInit
  78. #define XmlPrologStateInitExternalEntity PyExpat_XmlPrologStateInitExternalEntity
  79. #define XML_ResumeParser PyExpat_XML_ResumeParser
  80. #define XML_SetAttlistDeclHandler PyExpat_XML_SetAttlistDeclHandler
  81. #define XML_SetBase PyExpat_XML_SetBase
  82. #define XML_SetCdataSectionHandler PyExpat_XML_SetCdataSectionHandler
  83. #define XML_SetCharacterDataHandler PyExpat_XML_SetCharacterDataHandler
  84. #define XML_SetCommentHandler PyExpat_XML_SetCommentHandler
  85. #define XML_SetDefaultHandler PyExpat_XML_SetDefaultHandler
  86. #define XML_SetDefaultHandlerExpand PyExpat_XML_SetDefaultHandlerExpand
  87. #define XML_SetDoctypeDeclHandler PyExpat_XML_SetDoctypeDeclHandler
  88. #define XML_SetElementDeclHandler PyExpat_XML_SetElementDeclHandler
  89. #define XML_SetElementHandler PyExpat_XML_SetElementHandler
  90. #define XML_SetEncoding PyExpat_XML_SetEncoding
  91. #define XML_SetEndCdataSectionHandler PyExpat_XML_SetEndCdataSectionHandler
  92. #define XML_SetEndDoctypeDeclHandler PyExpat_XML_SetEndDoctypeDeclHandler
  93. #define XML_SetEndElementHandler PyExpat_XML_SetEndElementHandler
  94. #define XML_SetEndNamespaceDeclHandler PyExpat_XML_SetEndNamespaceDeclHandler
  95. #define XML_SetEntityDeclHandler PyExpat_XML_SetEntityDeclHandler
  96. #define XML_SetExternalEntityRefHandler PyExpat_XML_SetExternalEntityRefHandler
  97. #define XML_SetExternalEntityRefHandlerArg PyExpat_XML_SetExternalEntityRefHandlerArg
  98. #define XML_SetNamespaceDeclHandler PyExpat_XML_SetNamespaceDeclHandler
  99. #define XML_SetNotationDeclHandler PyExpat_XML_SetNotationDeclHandler
  100. #define XML_SetNotStandaloneHandler PyExpat_XML_SetNotStandaloneHandler
  101. #define XML_SetParamEntityParsing PyExpat_XML_SetParamEntityParsing
  102. #define XML_SetProcessingInstructionHandler PyExpat_XML_SetProcessingInstructionHandler
  103. #define XML_SetReturnNSTriplet PyExpat_XML_SetReturnNSTriplet
  104. #define XML_SetSkippedEntityHandler PyExpat_XML_SetSkippedEntityHandler
  105. #define XML_SetStartCdataSectionHandler PyExpat_XML_SetStartCdataSectionHandler
  106. #define XML_SetStartDoctypeDeclHandler PyExpat_XML_SetStartDoctypeDeclHandler
  107. #define XML_SetStartElementHandler PyExpat_XML_SetStartElementHandler
  108. #define XML_SetStartNamespaceDeclHandler PyExpat_XML_SetStartNamespaceDeclHandler
  109. #define XML_SetUnknownEncodingHandler PyExpat_XML_SetUnknownEncodingHandler
  110. #define XML_SetUnparsedEntityDeclHandler PyExpat_XML_SetUnparsedEntityDeclHandler
  111. #define XML_SetUserData PyExpat_XML_SetUserData
  112. #define XML_SetXmlDeclHandler PyExpat_XML_SetXmlDeclHandler
  113. #define XmlSizeOfUnknownEncoding PyExpat_XmlSizeOfUnknownEncoding
  114. #define XML_StopParser PyExpat_XML_StopParser
  115. #define XML_UseForeignDTD PyExpat_XML_UseForeignDTD
  116. #define XML_UseParserAsHandlerArg PyExpat_XML_UseParserAsHandlerArg
  117. #define XmlUtf16Encode PyExpat_XmlUtf16Encode
  118. #define XmlUtf8Encode PyExpat_XmlUtf8Encode
  119. #endif /* !PYEXPATNS_H */